carbon-react 152.2.0 → 152.3.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__/ai-icon/ai-icon.component.d.ts +4 -0
- package/esm/__internal__/ai-icon/ai-icon.component.js +28 -0
- package/esm/__internal__/ai-icon/index.d.ts +1 -0
- package/esm/__internal__/ai-icon/index.js +1 -0
- 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/__internal__/utils/helpers/events/events.d.ts +1 -1
- package/esm/components/button/button-types.style.js +11 -1
- package/esm/components/button/button.component.js +1 -1
- 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/hr/hr.style.js +1 -1
- package/esm/components/image/image.style.d.ts +1 -1
- 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/message/message.component.d.ts +5 -1
- package/esm/components/message/message.component.js +38 -24
- package/esm/components/message/message.style.d.ts +4 -1
- package/esm/components/message/message.style.js +39 -13
- 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/split-button/split-button-toggle.style.d.ts +1 -0
- package/esm/components/split-button/split-button-toggle.style.js +30 -2
- package/esm/components/split-button/split-button.component.d.ts +2 -0
- package/esm/components/split-button/split-button.component.js +4 -0
- 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/time/index.d.ts +1 -1
- package/esm/components/time/time.component.js +22 -4
- package/esm/components/toast/toast.component.js +2 -1
- package/esm/components/toast/toast.style.d.ts +2 -3
- package/esm/components/toast/toast.style.js +1 -2
- package/esm/components/typography/typography.style.d.ts +1 -1
- package/esm/locales/en-gb.js +2 -1
- package/esm/locales/locale.d.ts +1 -0
- package/lib/__internal__/ai-icon/ai-icon.component.d.ts +4 -0
- package/lib/__internal__/ai-icon/ai-icon.component.js +36 -0
- package/lib/__internal__/ai-icon/index.d.ts +1 -0
- package/lib/__internal__/ai-icon/index.js +13 -0
- package/lib/__internal__/{form-spacing-provider → ai-icon}/package.json +1 -1
- 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/__internal__/utils/helpers/events/events.d.ts +1 -1
- package/lib/components/button/button-types.style.js +11 -1
- package/lib/components/button/button.component.js +1 -1
- 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/hr/hr.style.js +1 -1
- package/lib/components/image/image.style.d.ts +1 -1
- 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/message/message.component.d.ts +5 -1
- package/lib/components/message/message.component.js +38 -24
- package/lib/components/message/message.style.d.ts +4 -1
- package/lib/components/message/message.style.js +38 -13
- 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/split-button/split-button-toggle.style.d.ts +1 -0
- package/lib/components/split-button/split-button-toggle.style.js +30 -2
- package/lib/components/split-button/split-button.component.d.ts +2 -0
- package/lib/components/split-button/split-button.component.js +4 -0
- 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/time/index.d.ts +1 -1
- package/lib/components/time/time.component.js +21 -3
- package/lib/components/toast/toast.component.js +2 -1
- package/lib/components/toast/toast.style.d.ts +2 -3
- package/lib/components/toast/toast.style.js +0 -7
- package/lib/components/typography/typography.style.d.ts +1 -1
- package/lib/locales/en-gb.js +2 -1
- package/lib/locales/locale.d.ts +1 -0
- package/package.json +15 -15
- 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/components/message/__internal__/message-content/message-content.component.d.ts +0 -9
- package/esm/components/message/__internal__/message-content/message-content.component.js +0 -19
- package/esm/components/message/__internal__/message-content/message-content.style.d.ts +0 -3
- package/esm/components/message/__internal__/message-content/message-content.style.js +0 -12
- package/esm/components/message/__internal__/type-icon/type-icon.component.d.ts +0 -8
- package/esm/components/message/__internal__/type-icon/type-icon.component.js +0 -20
- package/esm/components/message/__internal__/type-icon/type-icon.style.d.ts +0 -7
- package/esm/components/message/__internal__/type-icon/type-icon.style.js +0 -38
- 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/components/message/__internal__/message-content/message-content.component.d.ts +0 -9
- package/lib/components/message/__internal__/message-content/message-content.component.js +0 -26
- package/lib/components/message/__internal__/message-content/message-content.style.d.ts +0 -3
- package/lib/components/message/__internal__/message-content/message-content.style.js +0 -19
- package/lib/components/message/__internal__/type-icon/type-icon.component.d.ts +0 -8
- package/lib/components/message/__internal__/type-icon/type-icon.component.js +0 -27
- package/lib/components/message/__internal__/type-icon/type-icon.style.d.ts +0 -7
- package/lib/components/message/__internal__/type-icon/type-icon.style.js +0 -46
- 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
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
import React from "react";
|
|
3
|
+
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
4
|
+
export const AiIcon = ({
|
|
5
|
+
...rest
|
|
6
|
+
}) => /*#__PURE__*/React.createElement("svg", _extends({}, tagComponent("ai-icon", rest), {
|
|
7
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8
|
+
width: "20",
|
|
9
|
+
height: "20",
|
|
10
|
+
fill: "none",
|
|
11
|
+
viewBox: "0 0 20 20"
|
|
12
|
+
}), /*#__PURE__*/React.createElement("g", {
|
|
13
|
+
clipPath: "url(#a)"
|
|
14
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
15
|
+
"data-role": "white-star",
|
|
16
|
+
fill: "#fff",
|
|
17
|
+
d: "m16.378 9.799-3.776-1.49a1.615 1.615 0 0 1-.91-.91l-1.49-3.775c-.537-1.364-2.466-1.364-3.004 0L5.708 7.4a1.615 1.615 0 0 1-.91.91L1.022 9.799c-1.363.537-1.363 2.466 0 3.004l3.776 1.49c.417.163.746.493.91.91l1.49 3.775c.538 1.363 2.467 1.363 3.005 0l1.489-3.776c.164-.416.494-.745.91-.91l3.776-1.489c1.364-.538 1.364-2.467 0-3.004Z"
|
|
18
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
19
|
+
"data-role": "green-circle",
|
|
20
|
+
fill: "#00D639",
|
|
21
|
+
d: "M17.172 5.655a2.827 2.827 0 1 0 0-5.655 2.827 2.827 0 0 0 0 5.655Z"
|
|
22
|
+
})), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
|
|
23
|
+
id: "a"
|
|
24
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
25
|
+
fill: "#fff",
|
|
26
|
+
d: "M0 0h20v20H0z"
|
|
27
|
+
}))));
|
|
28
|
+
export default AiIcon;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./ai-icon.component";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./ai-icon.component";
|
|
@@ -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;
|
|
@@ -17,7 +17,7 @@ declare const Events: {
|
|
|
17
17
|
/**
|
|
18
18
|
* Determines if event is a keyboard event
|
|
19
19
|
*/
|
|
20
|
-
isKeyboardEvent: (ev: React.SyntheticEvent | Event) => ev is React.KeyboardEvent<Element
|
|
20
|
+
isKeyboardEvent: (ev: React.SyntheticEvent | Event) => ev is KeyboardEvent | React.KeyboardEvent<Element>;
|
|
21
21
|
/**
|
|
22
22
|
* Determines if a number key along the top of the keyboard or a number key on the
|
|
23
23
|
* keypad is pressed
|
|
@@ -76,6 +76,16 @@ export default (isDisabled, destructive, isWhite) => ({
|
|
|
76
76
|
${makeColors("var(--colorsActionMajorYang100)")};
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
${isWhite && (!isDisabled || !destructive) ? `
|
|
80
|
+
border-color: var(--colorsActionMajorYang100);
|
|
81
|
+
${makeColors("var(--colorsActionMajorYang100)")};
|
|
82
|
+
&:hover {
|
|
83
|
+
background: var(--colorsActionMajorYang100);
|
|
84
|
+
border-color: var(--colorsActionMajorYang100);
|
|
85
|
+
${makeColors("var(--colorsYin100)")};
|
|
86
|
+
}
|
|
87
|
+
` : ""}
|
|
88
|
+
|
|
79
89
|
${destructive ? `
|
|
80
90
|
border-color: var(--colorsSemanticNegative500);
|
|
81
91
|
${makeColors("var(--colorsSemanticNegative500)")}
|
|
@@ -86,7 +96,7 @@ export default (isDisabled, destructive, isWhite) => ({
|
|
|
86
96
|
}
|
|
87
97
|
` : ""}
|
|
88
98
|
|
|
89
|
-
${isDisabled ? `
|
|
99
|
+
${isDisabled && !isWhite ? `
|
|
90
100
|
border-color: var(--colorsActionDisabled500);
|
|
91
101
|
${makeColors("var(--colorsActionMajorYin030)")};
|
|
92
102
|
&:hover {
|
|
@@ -64,13 +64,13 @@ const Button = /*#__PURE__*/React.forwardRef(({
|
|
|
64
64
|
children,
|
|
65
65
|
destructive = false,
|
|
66
66
|
disabled = false,
|
|
67
|
+
isWhite = false,
|
|
67
68
|
fullWidth: fullWidthProp = false,
|
|
68
69
|
href,
|
|
69
70
|
iconPosition: iconPositionProp = "before",
|
|
70
71
|
iconTooltipMessage,
|
|
71
72
|
iconTooltipPosition,
|
|
72
73
|
iconType,
|
|
73
|
-
isWhite = false,
|
|
74
74
|
m = 0,
|
|
75
75
|
noWrap,
|
|
76
76
|
onClick,
|
|
@@ -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
|
|
@@ -34,5 +34,5 @@ declare const StyledImage: import("styled-components").StyledComponent<"div", an
|
|
|
34
34
|
bottom: string | undefined;
|
|
35
35
|
left: string | undefined;
|
|
36
36
|
as?: string | undefined;
|
|
37
|
-
} & StyledImageProps, "hidden" | "children" | "left" | "right" | "top" | "bottom" | "
|
|
37
|
+
} & StyledImageProps, "hidden" | "children" | "left" | "right" | "top" | "bottom" | "as" | "src" | "position">;
|
|
38
38
|
export { StyledImage };
|
|
@@ -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;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { MarginProps } from "styled-system";
|
|
3
3
|
import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
|
|
4
|
-
export
|
|
4
|
+
export interface TypeIconProps {
|
|
5
|
+
transparent?: boolean;
|
|
6
|
+
variant: MessageVariant;
|
|
7
|
+
}
|
|
8
|
+
export declare type MessageVariant = "error" | "info" | "success" | "warning" | "neutral" | "ai";
|
|
5
9
|
export interface MessageProps extends MarginProps, TagProps {
|
|
6
10
|
/** Set the component's content */
|
|
7
11
|
children?: React.ReactNode;
|
|
@@ -1,12 +1,12 @@
|
|
|
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, { useRef } from "react";
|
|
3
3
|
import Typography from "../typography";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import MessageContent from "./__internal__/message-content/message-content.component";
|
|
4
|
+
import Content from "../content";
|
|
5
|
+
import MessageStyle, { MessageContent, TypeIconStyle } from "./message.style";
|
|
7
6
|
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
8
7
|
import Icon from "../icon";
|
|
9
8
|
import IconButton from "../icon-button";
|
|
9
|
+
import AiIcon from "../../__internal__/ai-icon";
|
|
10
10
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
11
11
|
import useLocale from "../../hooks/__internal__/useLocale";
|
|
12
12
|
export const Message = /*#__PURE__*/React.forwardRef(({
|
|
@@ -22,38 +22,52 @@ export const Message = /*#__PURE__*/React.forwardRef(({
|
|
|
22
22
|
width,
|
|
23
23
|
...props
|
|
24
24
|
}, ref) => {
|
|
25
|
-
const
|
|
26
|
-
const
|
|
25
|
+
const localRef = useRef(null);
|
|
26
|
+
const messageRef = ref || localRef;
|
|
27
|
+
const locale = useLocale();
|
|
27
28
|
const marginProps = filterStyledSystemMarginProps(props);
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
onClick: onDismiss
|
|
35
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
36
|
-
type: "close"
|
|
37
|
-
}));
|
|
29
|
+
const VARIANT_ICON_MAP = {
|
|
30
|
+
neutral: "info",
|
|
31
|
+
success: "tick_circle",
|
|
32
|
+
error: "error",
|
|
33
|
+
warning: "warning",
|
|
34
|
+
info: "info"
|
|
38
35
|
};
|
|
39
|
-
|
|
36
|
+
if (!open) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
return /*#__PURE__*/React.createElement(MessageStyle, _extends({}, tagComponent("Message", props), {
|
|
40
40
|
transparent: transparent,
|
|
41
41
|
variant: variant,
|
|
42
42
|
id: id,
|
|
43
43
|
width: width,
|
|
44
|
-
ref:
|
|
44
|
+
ref: messageRef
|
|
45
45
|
}, marginProps, {
|
|
46
46
|
tabIndex: -1
|
|
47
|
-
}), /*#__PURE__*/React.createElement(
|
|
47
|
+
}), /*#__PURE__*/React.createElement(TypeIconStyle, {
|
|
48
48
|
variant: variant,
|
|
49
49
|
transparent: transparent
|
|
50
|
-
}
|
|
50
|
+
}, variant === "ai" ? /*#__PURE__*/React.createElement(AiIcon, {
|
|
51
|
+
"data-role": "ai-icon"
|
|
52
|
+
}) : /*#__PURE__*/React.createElement(Icon, {
|
|
53
|
+
"data-role": "category-icon",
|
|
54
|
+
type: VARIANT_ICON_MAP[variant]
|
|
55
|
+
})), /*#__PURE__*/React.createElement(Typography, {
|
|
51
56
|
screenReaderOnly: true
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
}, locale.message?.[variant]?.()), /*#__PURE__*/React.createElement(MessageContent, {
|
|
58
|
+
"data-element": "message-content",
|
|
59
|
+
"data-role": "message-content"
|
|
60
|
+
}, !showCloseIcon || !onDismiss ? /*#__PURE__*/React.createElement(Content, {
|
|
61
|
+
title: title
|
|
62
|
+
}, children) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Content, {
|
|
63
|
+
title: title
|
|
64
|
+
}, children), /*#__PURE__*/React.createElement(IconButton, {
|
|
65
|
+
"data-element": "close",
|
|
66
|
+
"aria-label": closeButtonAriaLabel || locale.message.closeButtonAriaLabel(),
|
|
67
|
+
onClick: onDismiss
|
|
68
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
69
|
+
type: "close"
|
|
70
|
+
})))));
|
|
57
71
|
});
|
|
58
72
|
Message.displayName = "Message";
|
|
59
73
|
export default Message;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { MarginProps } from "styled-system";
|
|
2
|
-
import { MessageVariant } from "./message.component";
|
|
2
|
+
import { MessageVariant, TypeIconProps } from "./message.component";
|
|
3
3
|
declare type MessageStyleProps = {
|
|
4
4
|
variant?: MessageVariant;
|
|
5
5
|
transparent?: boolean;
|
|
6
6
|
width?: string;
|
|
7
7
|
};
|
|
8
8
|
declare const MessageStyle: import("styled-components").StyledComponent<"div", any, MessageStyleProps & MarginProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>>, never>;
|
|
9
|
+
declare const MessageContent: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
10
|
+
declare const TypeIconStyle: import("styled-components").StyledComponent<"div", any, TypeIconProps, never>;
|
|
9
11
|
export default MessageStyle;
|
|
12
|
+
export { MessageContent, TypeIconStyle };
|