carbon-react 142.10.0 → 142.11.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 +3 -3
- package/esm/__internal__/checkable-input/checkable-input.component.js +2 -6
- package/esm/__internal__/popover/popover.component.d.ts +32 -0
- package/esm/__internal__/popover/popover.component.js +3 -1
- package/esm/__internal__/radio-button-mapper/radio-button-mapper.component.js +0 -1
- package/esm/components/checkbox/checkbox-group/checkbox-group.component.d.ts +3 -3
- package/esm/components/checkbox/checkbox-group/checkbox-group.component.js +6 -2
- package/esm/components/checkbox/checkbox.component.d.ts +2 -2
- package/esm/components/checkbox/checkbox.component.js +10 -12
- package/esm/components/checkbox/checkbox.style.js +3 -4
- package/esm/components/flat-table/flat-table-row/flat-table-row.style.js +6 -1
- package/esm/components/flat-table/flat-table.component.d.ts +6 -1
- package/esm/components/flat-table/flat-table.component.js +5 -0
- package/esm/components/flat-table/flat-table.style.d.ts +2 -1
- package/esm/components/flat-table/flat-table.style.js +22 -8
- package/esm/components/radio-button/radio-button-group/radio-button-group.component.d.ts +2 -2
- package/esm/components/radio-button/radio-button-group/radio-button-group.component.js +8 -1
- package/esm/components/radio-button/radio-button.component.d.ts +2 -2
- package/esm/components/radio-button/radio-button.component.js +16 -12
- package/lib/__internal__/checkable-input/checkable-input.component.d.ts +3 -3
- package/lib/__internal__/checkable-input/checkable-input.component.js +1 -5
- package/lib/__internal__/popover/popover.component.d.ts +32 -0
- package/lib/__internal__/popover/popover.component.js +3 -1
- package/lib/__internal__/radio-button-mapper/radio-button-mapper.component.js +0 -1
- package/lib/components/checkbox/checkbox-group/checkbox-group.component.d.ts +3 -3
- package/lib/components/checkbox/checkbox-group/checkbox-group.component.js +6 -2
- package/lib/components/checkbox/checkbox.component.d.ts +2 -2
- package/lib/components/checkbox/checkbox.component.js +10 -12
- package/lib/components/checkbox/checkbox.style.js +3 -4
- package/lib/components/flat-table/flat-table-row/flat-table-row.style.js +6 -1
- package/lib/components/flat-table/flat-table.component.d.ts +6 -1
- package/lib/components/flat-table/flat-table.component.js +5 -0
- package/lib/components/flat-table/flat-table.style.d.ts +2 -1
- package/lib/components/flat-table/flat-table.style.js +22 -8
- package/lib/components/radio-button/radio-button-group/radio-button-group.component.d.ts +2 -2
- package/lib/components/radio-button/radio-button-group/radio-button-group.component.js +8 -1
- package/lib/components/radio-button/radio-button.component.d.ts +2 -2
- package/lib/components/radio-button/radio-button.component.js +16 -12
- package/package.json +1 -1
|
@@ -6,10 +6,10 @@ export interface CommonCheckableInputProps extends ValidationProps, CommonHidden
|
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
/** @private @ignore */
|
|
8
8
|
loading?: boolean;
|
|
9
|
-
/**
|
|
9
|
+
/** Help content to be displayed under an input */
|
|
10
10
|
fieldHelp?: React.ReactNode;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* If true, the FieldHelp will be displayed inline
|
|
13
13
|
* To be used with labelInline prop set to true
|
|
14
14
|
*/
|
|
15
15
|
fieldHelpInline?: boolean;
|
|
@@ -19,7 +19,7 @@ export interface CommonCheckableInputProps extends ValidationProps, CommonHidden
|
|
|
19
19
|
inputWidth?: number;
|
|
20
20
|
/** Label content */
|
|
21
21
|
label?: React.ReactNode;
|
|
22
|
-
/**
|
|
22
|
+
/** The content for the help tooltip, to appear next to the Label */
|
|
23
23
|
labelHelp?: React.ReactNode;
|
|
24
24
|
/** Spacing between label and a field for inline label, given number will be multiplied by base spacing unit (8) */
|
|
25
25
|
labelSpacing?: 1 | 2;
|
|
@@ -1,5 +1,5 @@
|
|
|
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
|
-
import React, { useRef
|
|
2
|
+
import React, { useRef } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { StyledCheckableInput, StyledCheckableInputWrapper } from "./checkable-input.style";
|
|
5
5
|
import { InputBehaviour } from "../input-behaviour";
|
|
@@ -7,7 +7,6 @@ import FormField from "../form-field";
|
|
|
7
7
|
import HiddenCheckableInput from "./hidden-checkable-input.component";
|
|
8
8
|
import guid from "../utils/helpers/guid";
|
|
9
9
|
import useInputAccessibility from "../../hooks/__internal__/useInputAccessibility";
|
|
10
|
-
import NewValidationContext from "../../components/carbon-provider/__internal__/new-validation.context";
|
|
11
10
|
const CheckableInput = /*#__PURE__*/React.forwardRef(({
|
|
12
11
|
ariaLabelledBy,
|
|
13
12
|
autoFocus,
|
|
@@ -42,9 +41,6 @@ const CheckableInput = /*#__PURE__*/React.forwardRef(({
|
|
|
42
41
|
const {
|
|
43
42
|
current: id
|
|
44
43
|
} = useRef(inputId || guid());
|
|
45
|
-
const {
|
|
46
|
-
validationRedesignOptIn
|
|
47
|
-
} = useContext(NewValidationContext);
|
|
48
44
|
const {
|
|
49
45
|
labelId,
|
|
50
46
|
fieldHelpId,
|
|
@@ -80,7 +76,7 @@ const CheckableInput = /*#__PURE__*/React.forwardRef(({
|
|
|
80
76
|
// However, we still want the input element to receive the required prop
|
|
81
77
|
isRequired: required,
|
|
82
78
|
isOptional,
|
|
83
|
-
useValidationIcon:
|
|
79
|
+
useValidationIcon: validationOnLabel
|
|
84
80
|
};
|
|
85
81
|
const inputProps = {
|
|
86
82
|
ariaDescribedBy,
|
|
@@ -4,15 +4,47 @@ declare type CustomRefObject<T> = {
|
|
|
4
4
|
current?: T | null;
|
|
5
5
|
};
|
|
6
6
|
export interface PopoverProps {
|
|
7
|
+
/**
|
|
8
|
+
* Element to be positioned, has to be a single node and has to accept `ref` and `style` props.
|
|
9
|
+
*/
|
|
7
10
|
children: React.ReactElement;
|
|
11
|
+
/**
|
|
12
|
+
* Placement of children in relation to the reference element.
|
|
13
|
+
*/
|
|
8
14
|
placement?: Placement;
|
|
15
|
+
/**
|
|
16
|
+
* Disables interaction with background UI.
|
|
17
|
+
*/
|
|
9
18
|
disableBackgroundUI?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Optional middleware array, for more information go to:
|
|
21
|
+
* [https://floating-ui.com/docs/middleware](https://floating-ui.com/docs/middleware)
|
|
22
|
+
*/
|
|
10
23
|
middleware?: Middleware[];
|
|
24
|
+
/**
|
|
25
|
+
* When true, children are not rendered in portal.
|
|
26
|
+
*/
|
|
11
27
|
disablePortal?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Reference element, children will be positioned in relation to this element - should be a ref shaped object.
|
|
30
|
+
*/
|
|
12
31
|
reference: CustomRefObject<HTMLElement>;
|
|
32
|
+
/**
|
|
33
|
+
* Determines if the popover is currently open/visible or not. Defaults to true.
|
|
34
|
+
*/
|
|
13
35
|
isOpen?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Whether to update the position of the floating element on every animation frame if required. This is optimized for performance but can still be costly. Use with caution!
|
|
38
|
+
* [https://floating-ui.com/docs/autoUpdate#animationframe](https://floating-ui.com/docs/autoUpdate#animationframe)
|
|
39
|
+
*/
|
|
14
40
|
animationFrame?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Optional strategy to use for positioning the floating element. Defaults to "absolute".
|
|
43
|
+
*/
|
|
15
44
|
popoverStrategy?: "absolute" | "fixed";
|
|
45
|
+
/**
|
|
46
|
+
* Allows child ref to be set via a prop instead of dynamically finding it via children iteration.
|
|
47
|
+
*/
|
|
16
48
|
childRefOverride?: MutableRefObject<HTMLDivElement | null>;
|
|
17
49
|
}
|
|
18
50
|
declare const Popover: ({ children, placement, disablePortal, reference, middleware, disableBackgroundUI, isOpen, animationFrame, popoverStrategy, childRefOverride, }: PopoverProps) => React.JSX.Element;
|
|
@@ -67,7 +67,9 @@ const Popover = ({
|
|
|
67
67
|
if (disableBackgroundUI) {
|
|
68
68
|
content = /*#__PURE__*/React.createElement(StyledPopoverContent, {
|
|
69
69
|
isOpen: isOpen
|
|
70
|
-
}, /*#__PURE__*/React.createElement(StyledBackdrop,
|
|
70
|
+
}, /*#__PURE__*/React.createElement(StyledBackdrop, {
|
|
71
|
+
"data-role": "popup-backdrop"
|
|
72
|
+
}, content));
|
|
71
73
|
}
|
|
72
74
|
if (disablePortal) {
|
|
73
75
|
return content;
|
|
@@ -5,8 +5,8 @@ export interface CheckboxGroupProps extends ValidationProps, MarginProps {
|
|
|
5
5
|
/** The content for the CheckboxGroup Legend */
|
|
6
6
|
legend?: string;
|
|
7
7
|
/**
|
|
8
|
-
* The content for the CheckboxGroup
|
|
9
|
-
* will
|
|
8
|
+
* The content for the CheckboxGroup Help tooltip,
|
|
9
|
+
* will be rendered as hint text when `validationRedesignOptIn` is true.
|
|
10
10
|
*/
|
|
11
11
|
legendHelp?: string;
|
|
12
12
|
/** [Legacy] When true, legend is placed inline with the checkboxes */
|
|
@@ -27,7 +27,7 @@ export interface CheckboxGroupProps extends ValidationProps, MarginProps {
|
|
|
27
27
|
isOptional?: boolean;
|
|
28
28
|
/** [Legacy] Overrides the default tooltip */
|
|
29
29
|
tooltipPosition?: "top" | "bottom" | "left" | "right";
|
|
30
|
-
/** When true, Checkboxes are
|
|
30
|
+
/** When true, Checkboxes are in line */
|
|
31
31
|
inline?: boolean;
|
|
32
32
|
}
|
|
33
33
|
export declare const CheckboxGroup: {
|
|
@@ -35,8 +35,12 @@ export const CheckboxGroup = props => {
|
|
|
35
35
|
return /*#__PURE__*/React.createElement(React.Fragment, null, validationRedesignOptIn ? /*#__PURE__*/React.createElement(Fieldset, _extends({
|
|
36
36
|
legend: legend,
|
|
37
37
|
inline: legendInline,
|
|
38
|
+
legendWidth: legendWidth,
|
|
39
|
+
legendAlign: legendAlign,
|
|
40
|
+
legendSpacing: legendSpacing,
|
|
38
41
|
error: error,
|
|
39
42
|
warning: warning,
|
|
43
|
+
info: info,
|
|
40
44
|
isRequired: required,
|
|
41
45
|
isOptional: isOptional
|
|
42
46
|
}, tagComponent("checkboxgroup", props), {
|
|
@@ -52,6 +56,7 @@ export const CheckboxGroup = props => {
|
|
|
52
56
|
}), /*#__PURE__*/React.createElement(StyledCheckboxGroup, {
|
|
53
57
|
"data-component": "checkbox-group",
|
|
54
58
|
"data-role": "checkbox-group",
|
|
59
|
+
legendInline: legendInline,
|
|
55
60
|
inline: inline
|
|
56
61
|
}, /*#__PURE__*/React.createElement(CheckboxGroupContext.Provider, {
|
|
57
62
|
value: {
|
|
@@ -78,8 +83,7 @@ export const CheckboxGroup = props => {
|
|
|
78
83
|
}, filterStyledSystemMarginProps(props)), /*#__PURE__*/React.createElement(StyledCheckboxGroup, {
|
|
79
84
|
"data-component": "checkbox-group",
|
|
80
85
|
"data-role": "checkbox-group",
|
|
81
|
-
legendInline: legendInline
|
|
82
|
-
inline: inline
|
|
86
|
+
legendInline: legendInline
|
|
83
87
|
}, /*#__PURE__*/React.createElement(CheckboxGroupContext.Provider, {
|
|
84
88
|
value: {
|
|
85
89
|
error: !!error,
|
|
@@ -12,13 +12,13 @@ export interface CheckboxProps extends CommonCheckableInputProps, MarginProps {
|
|
|
12
12
|
"data-element"?: string;
|
|
13
13
|
/** Identifier used for testing purposes, applied to the root element of the component. */
|
|
14
14
|
"data-role"?: string;
|
|
15
|
-
/**
|
|
15
|
+
/** Aria label for rendered help component */
|
|
16
16
|
helpAriaLabel?: string;
|
|
17
17
|
/** When true label is inline */
|
|
18
18
|
labelInline?: boolean;
|
|
19
19
|
/** Accepts a callback function which is triggered on click event */
|
|
20
20
|
onClick?: (ev: React.MouseEvent<HTMLInputElement>) => void;
|
|
21
|
-
/**
|
|
21
|
+
/** Overrides the default tooltip position */
|
|
22
22
|
tooltipPosition?: "top" | "bottom" | "left" | "right";
|
|
23
23
|
/** The value of the checkbox, passed on form submit */
|
|
24
24
|
value?: string;
|
|
@@ -61,13 +61,6 @@ const Checkbox = /*#__PURE__*/React.forwardRef(({
|
|
|
61
61
|
deprecateUncontrolledWarnTriggered = true;
|
|
62
62
|
Logger.deprecate("Uncontrolled behaviour in `Checkbox` is deprecated and support will soon be removed. Please make sure all your inputs are controlled.");
|
|
63
63
|
}
|
|
64
|
-
const commonProps = {
|
|
65
|
-
fieldHelpInline,
|
|
66
|
-
labelSpacing,
|
|
67
|
-
labelHelp,
|
|
68
|
-
fieldHelp
|
|
69
|
-
};
|
|
70
|
-
const isInGroup = Object.keys(checkboxGroupContext).length !== 0;
|
|
71
64
|
const inputProps = {
|
|
72
65
|
ariaLabelledBy,
|
|
73
66
|
onClick,
|
|
@@ -81,23 +74,28 @@ const Checkbox = /*#__PURE__*/React.forwardRef(({
|
|
|
81
74
|
type: "checkbox",
|
|
82
75
|
name,
|
|
83
76
|
reverse: !reverse,
|
|
77
|
+
fieldHelp,
|
|
84
78
|
autoFocus,
|
|
79
|
+
labelHelp,
|
|
80
|
+
labelSpacing,
|
|
85
81
|
required,
|
|
86
82
|
isOptional,
|
|
83
|
+
fieldHelpInline,
|
|
87
84
|
checked,
|
|
88
85
|
disabled,
|
|
89
86
|
inputWidth,
|
|
90
87
|
labelWidth,
|
|
91
88
|
ref,
|
|
92
|
-
...rest
|
|
93
|
-
...(isInGroup && validationRedesignOptIn ? {} : {
|
|
94
|
-
...commonProps
|
|
95
|
-
})
|
|
89
|
+
...rest
|
|
96
90
|
};
|
|
97
91
|
const validationProps = {
|
|
98
92
|
error: contextError || error,
|
|
99
93
|
warning: contextWarning || warning,
|
|
100
|
-
|
|
94
|
+
...(validationRedesignOptIn ? {
|
|
95
|
+
validationOnLabel: false
|
|
96
|
+
} : {
|
|
97
|
+
info: contextInfo || info
|
|
98
|
+
})
|
|
101
99
|
};
|
|
102
100
|
const marginProps = useFormSpacing(rest);
|
|
103
101
|
const componentToRender = /*#__PURE__*/React.createElement(CheckboxStyle, _extends({
|
|
@@ -41,12 +41,11 @@ const StyledCheckbox = styled.div`
|
|
|
41
41
|
${!disabled && css`
|
|
42
42
|
border: 1px solid var(--colorsUtilityMajor300);
|
|
43
43
|
|
|
44
|
+
${info && `border: 1px solid var(--colorsSemanticInfo500);`}
|
|
45
|
+
${warning && `border: 1px solid var(--colorsSemanticCaution500);`}
|
|
44
46
|
${error && `border: 2px solid var(--colorsSemanticNegative500);`}
|
|
45
47
|
|
|
46
|
-
${
|
|
47
|
-
${info && `border: 1px solid var(--colorsSemanticInfo500);`}
|
|
48
|
-
${warning && `border: 1px solid var(--colorsSemanticCaution500);`}
|
|
49
|
-
`}
|
|
48
|
+
${warning && applyNewValidation && `border: 1px solid var(--colorsUtilityMajor300);`}
|
|
50
49
|
`}
|
|
51
50
|
}
|
|
52
51
|
|
|
@@ -171,7 +171,12 @@ const StyledFlatTableRow = styled.tr`
|
|
|
171
171
|
${StyledFlatTableHeader} {
|
|
172
172
|
border-bottom: 1px solid ${borderColor(colorTheme)};
|
|
173
173
|
|
|
174
|
-
${
|
|
174
|
+
${horizontalBorderSize !== "small" && css`
|
|
175
|
+
border-bottom: ${horizontalBorderSizes[horizontalBorderSize]} solid
|
|
176
|
+
var(--colorsUtilityMajor100);
|
|
177
|
+
`}
|
|
178
|
+
|
|
179
|
+
${!isInSidebar && !colorTheme?.includes("transparent") && `
|
|
175
180
|
:first-child {
|
|
176
181
|
border-left: 1px solid ${borderColor(colorTheme)};
|
|
177
182
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { MarginProps } from "styled-system";
|
|
3
|
+
import * as DesignTokens from "@sage/design-tokens/js/base/common";
|
|
3
4
|
export interface FlatTableProps extends MarginProps {
|
|
4
5
|
/** The HTML id of the element that contains a description of this table. */
|
|
5
6
|
ariaDescribedby?: string;
|
|
@@ -25,13 +26,17 @@ export interface FlatTableProps extends MarginProps {
|
|
|
25
26
|
size?: "compact" | "small" | "medium" | "large" | "extraLarge";
|
|
26
27
|
/** Applies max-height of 100% to FlatTable if true */
|
|
27
28
|
hasMaxHeight?: boolean;
|
|
29
|
+
/** Toggles the visibility of the table's outer left and right borders. When false, the left border of the first column and the right border of the last column are hidden. */
|
|
30
|
+
hasOuterVerticalBorders?: boolean;
|
|
31
|
+
/** Sets the border radius of the first and last cells in the last row. */
|
|
32
|
+
bottomBorderRadius?: Extract<keyof typeof DesignTokens, `borderRadius${number}`>;
|
|
28
33
|
/** Set the overflow X of the table wrapper. Any valid CSS string */
|
|
29
34
|
overflowX?: string;
|
|
30
35
|
/** Width of the table. Any valid CSS string */
|
|
31
36
|
width?: string;
|
|
32
37
|
}
|
|
33
38
|
export declare const FlatTable: {
|
|
34
|
-
({ caption, children, hasStickyHead, colorTheme, footer, hasStickyFooter, height, isZebra, size, hasMaxHeight, ariaDescribedby, minHeight, overflowX, width, ...rest }: FlatTableProps): React.JSX.Element;
|
|
39
|
+
({ caption, children, hasStickyHead, colorTheme, footer, hasStickyFooter, height, isZebra, size, hasMaxHeight, hasOuterVerticalBorders, bottomBorderRadius, ariaDescribedby, minHeight, overflowX, width, ...rest }: FlatTableProps): React.JSX.Element;
|
|
35
40
|
displayName: string;
|
|
36
41
|
};
|
|
37
42
|
export default FlatTable;
|
|
@@ -17,6 +17,8 @@ export const FlatTable = ({
|
|
|
17
17
|
isZebra,
|
|
18
18
|
size = "medium",
|
|
19
19
|
hasMaxHeight = false,
|
|
20
|
+
hasOuterVerticalBorders = true,
|
|
21
|
+
bottomBorderRadius = "borderRadius100",
|
|
20
22
|
ariaDescribedby,
|
|
21
23
|
minHeight,
|
|
22
24
|
overflowX,
|
|
@@ -134,6 +136,7 @@ export const FlatTable = ({
|
|
|
134
136
|
return /*#__PURE__*/React.createElement(StyledFlatTableWrapper, _extends({
|
|
135
137
|
ref: wrapperRef,
|
|
136
138
|
"data-component": "flat-table-wrapper",
|
|
139
|
+
"data-role": "flat-table-wrapper",
|
|
137
140
|
isInSidebar: isInSidebar,
|
|
138
141
|
hasStickyHead: hasStickyHead,
|
|
139
142
|
colorTheme: colorTheme,
|
|
@@ -141,6 +144,8 @@ export const FlatTable = ({
|
|
|
141
144
|
overflowY: hasStickyHead || hasStickyFooter ? "auto" : undefined,
|
|
142
145
|
height: addDefaultHeight && !hasMaxHeight ? "99%" : height,
|
|
143
146
|
maxHeight: hasMaxHeight ? "100%" : undefined,
|
|
147
|
+
hasOuterVerticalBorders: hasOuterVerticalBorders,
|
|
148
|
+
bottomBorderRadius: bottomBorderRadius,
|
|
144
149
|
display: "flex",
|
|
145
150
|
flexDirection: "column",
|
|
146
151
|
justifyContent: hasStickyFooter || height ? "space-between" : undefined,
|
|
@@ -4,12 +4,13 @@ declare const StyledTableContainer: import("styled-components").StyledComponent<
|
|
|
4
4
|
declare const StyledFlatTable: import("styled-components").StyledComponent<"table", any, Pick<FlatTableProps, "caption" | "isZebra"> & {
|
|
5
5
|
size: NonNullable<FlatTableProps["size"]>;
|
|
6
6
|
}, never>;
|
|
7
|
-
interface StyledFlatTableWrapperProps extends Pick<FlatTableProps, "hasStickyFooter" | "colorTheme" | "hasStickyHead" | "footer">, Partial<DrawerSidebarContextProps> {
|
|
7
|
+
interface StyledFlatTableWrapperProps extends Pick<FlatTableProps, "hasStickyFooter" | "colorTheme" | "hasStickyHead" | "footer" | "hasOuterVerticalBorders">, Partial<DrawerSidebarContextProps> {
|
|
8
8
|
hasHorizontalScrollbar: boolean;
|
|
9
9
|
hasVerticalScrollbar: boolean;
|
|
10
10
|
lastColRowSpanIndex: number;
|
|
11
11
|
firstColRowSpanIndex: number;
|
|
12
12
|
isFocused: boolean;
|
|
13
|
+
bottomBorderRadius: NonNullable<FlatTableProps["bottomBorderRadius"]>;
|
|
13
14
|
}
|
|
14
15
|
declare const StyledFlatTableWrapper: import("styled-components").StyledComponent<"div", any, import("../box").BoxProps & StyledFlatTableWrapperProps, never>;
|
|
15
16
|
declare const StyledFlatTableFooter: import("styled-components").StyledComponent<"div", any, Pick<FlatTableProps, "hasStickyFooter">, never>;
|
|
@@ -100,12 +100,27 @@ const StyledFlatTable = styled.table`
|
|
|
100
100
|
const StyledFlatTableWrapper = styled(StyledBox)`
|
|
101
101
|
border-top-left-radius: var(--borderRadius100);
|
|
102
102
|
border-top-right-radius: var(--borderRadius100);
|
|
103
|
+
|
|
104
|
+
${({
|
|
105
|
+
hasOuterVerticalBorders
|
|
106
|
+
}) => !hasOuterVerticalBorders && css`
|
|
107
|
+
${StyledFlatTableRow} {
|
|
108
|
+
& > ${StyledFlatTableCell}:first-child {
|
|
109
|
+
border-left-color: var(--colorsUtilityMajorTransparent);
|
|
110
|
+
}
|
|
111
|
+
& > ${StyledFlatTableCell}:last-child {
|
|
112
|
+
border-right-color: var(--colorsUtilityMajorTransparent);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
`}
|
|
116
|
+
|
|
103
117
|
${({
|
|
104
118
|
hasStickyFooter,
|
|
105
|
-
hasHorizontalScrollbar
|
|
119
|
+
hasHorizontalScrollbar,
|
|
120
|
+
bottomBorderRadius
|
|
106
121
|
}) => !hasStickyFooter && !hasHorizontalScrollbar && css`
|
|
107
|
-
border-bottom-left-radius: var(
|
|
108
|
-
border-bottom-right-radius: var(
|
|
122
|
+
border-bottom-left-radius: var(--${bottomBorderRadius});
|
|
123
|
+
border-bottom-right-radius: var(--${bottomBorderRadius});
|
|
109
124
|
`}
|
|
110
125
|
|
|
111
126
|
${({
|
|
@@ -152,7 +167,6 @@ css`
|
|
|
152
167
|
${StyledFlatTableHeader},
|
|
153
168
|
${StyledFlatTableHead} ${StyledFlatTableCheckbox} {
|
|
154
169
|
background-color: var(--colorsUtilityMajor025);
|
|
155
|
-
border-right: 1px solid var(--colorsUtilityMajor025);
|
|
156
170
|
border-bottom-color: var(--colorsUtilityMajor100);
|
|
157
171
|
}
|
|
158
172
|
${StyledFlatTableHead} ${StyledFlatTableRowHeader} {
|
|
@@ -167,7 +181,6 @@ css`
|
|
|
167
181
|
${StyledFlatTableHeader},
|
|
168
182
|
${StyledFlatTableHead} ${StyledFlatTableCheckbox} {
|
|
169
183
|
background-color: var(--colorsUtilityYang100);
|
|
170
|
-
border-right: 1px solid var(--colorsUtilityYang100);
|
|
171
184
|
border-bottom-color: var(--colorsUtilityMajor100);
|
|
172
185
|
}
|
|
173
186
|
${StyledFlatTableHead} ${StyledFlatTableRowHeader} {
|
|
@@ -294,7 +307,8 @@ css`
|
|
|
294
307
|
firstColRowSpanIndex,
|
|
295
308
|
lastColRowSpanIndex,
|
|
296
309
|
hasHorizontalScrollbar,
|
|
297
|
-
hasVerticalScrollbar
|
|
310
|
+
hasVerticalScrollbar,
|
|
311
|
+
bottomBorderRadius
|
|
298
312
|
}) => !footer && css`
|
|
299
313
|
tbody {
|
|
300
314
|
${firstColRowSpanIndex >= 0 && css`
|
|
@@ -319,13 +333,13 @@ css`
|
|
|
319
333
|
${!hasHorizontalScrollbar && firstColRowSpanIndex === -1 && css`
|
|
320
334
|
th:first-child,
|
|
321
335
|
td:first-child {
|
|
322
|
-
border-bottom-left-radius: var(
|
|
336
|
+
border-bottom-left-radius: var(--${bottomBorderRadius});
|
|
323
337
|
}
|
|
324
338
|
`}
|
|
325
339
|
${!hasVerticalScrollbar && !hasHorizontalScrollbar && lastColRowSpanIndex === -1 && css`
|
|
326
340
|
th:last-child,
|
|
327
341
|
td:last-child {
|
|
328
|
-
border-bottom-right-radius: var(
|
|
342
|
+
border-bottom-right-radius: var(--${bottomBorderRadius});
|
|
329
343
|
}
|
|
330
344
|
`}
|
|
331
345
|
}
|
|
@@ -15,8 +15,8 @@ export interface RadioButtonGroupProps extends ValidationProps, MarginProps {
|
|
|
15
15
|
/** The content for the RadioGroup Legend */
|
|
16
16
|
legend?: string;
|
|
17
17
|
/**
|
|
18
|
-
* The content for the RadioButtonGroup
|
|
19
|
-
* will
|
|
18
|
+
* The content for the RadioButtonGroup Legend Help tooltip,
|
|
19
|
+
* will be rendered as hint text when `validationRedesignOptIn` is true.
|
|
20
20
|
*/
|
|
21
21
|
legendHelp?: string;
|
|
22
22
|
/** [Legacy] Text alignment of legend when inline */
|
|
@@ -60,7 +60,11 @@ export const RadioButtonGroup = props => {
|
|
|
60
60
|
legend: legend,
|
|
61
61
|
error: error,
|
|
62
62
|
warning: warning,
|
|
63
|
+
info: info,
|
|
63
64
|
inline: inlineLegend,
|
|
65
|
+
legendWidth: legendWidth,
|
|
66
|
+
legendAlign: legendAlign,
|
|
67
|
+
legendSpacing: legendSpacing,
|
|
64
68
|
isRequired: required,
|
|
65
69
|
isOptional: isOptional
|
|
66
70
|
}, tagComponent("radiogroup", props), marginProps, {
|
|
@@ -78,7 +82,8 @@ export const RadioButtonGroup = props => {
|
|
|
78
82
|
}), /*#__PURE__*/React.createElement(RadioButtonGroupStyle, {
|
|
79
83
|
"data-component": "radio-button-group",
|
|
80
84
|
role: "radiogroup",
|
|
81
|
-
inline: inline
|
|
85
|
+
inline: inline,
|
|
86
|
+
legendInline: inlineLegend
|
|
82
87
|
}, /*#__PURE__*/React.createElement(RadioButtonMapper, {
|
|
83
88
|
name: name,
|
|
84
89
|
onBlur: onBlur,
|
|
@@ -93,6 +98,8 @@ export const RadioButtonGroup = props => {
|
|
|
93
98
|
labelSpacing,
|
|
94
99
|
error: !!error,
|
|
95
100
|
warning: !!warning,
|
|
101
|
+
info: !!info,
|
|
102
|
+
required,
|
|
96
103
|
...child.props
|
|
97
104
|
});
|
|
98
105
|
}))))) : /*#__PURE__*/React.createElement(TooltipProvider, {
|
|
@@ -15,9 +15,9 @@ export interface RadioButtonProps extends Omit<CommonCheckableInputProps, "requi
|
|
|
15
15
|
onClick?: (ev: React.MouseEvent<HTMLInputElement>) => void;
|
|
16
16
|
/** the value of the Radio Button, passed on form submit */
|
|
17
17
|
value: string;
|
|
18
|
-
/**
|
|
18
|
+
/** Overrides the default tooltip position */
|
|
19
19
|
tooltipPosition?: "top" | "bottom" | "left" | "right";
|
|
20
|
-
/**
|
|
20
|
+
/** Aria label for rendered help component */
|
|
21
21
|
helpAriaLabel?: string;
|
|
22
22
|
}
|
|
23
23
|
export declare const RadioButton: React.ForwardRefExoticComponent<RadioButtonProps & InternalRadioButtonProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -52,31 +52,34 @@ const RadioButton = /*#__PURE__*/React.forwardRef(({
|
|
|
52
52
|
event.target.focus();
|
|
53
53
|
}, [onChange]);
|
|
54
54
|
const validationProps = {
|
|
55
|
+
disabled,
|
|
56
|
+
inputWidth,
|
|
55
57
|
error,
|
|
56
58
|
warning,
|
|
57
59
|
info
|
|
58
60
|
};
|
|
59
61
|
const commonProps = {
|
|
62
|
+
...validationProps,
|
|
60
63
|
fieldHelpInline,
|
|
61
|
-
|
|
62
|
-
fieldHelp
|
|
64
|
+
labelSpacing
|
|
63
65
|
};
|
|
64
66
|
const inputProps = {
|
|
65
|
-
...(
|
|
67
|
+
...(validationRedesignOptIn ? {
|
|
68
|
+
...validationProps
|
|
69
|
+
} : {
|
|
66
70
|
...commonProps
|
|
67
71
|
}),
|
|
68
72
|
autoFocus,
|
|
69
73
|
checked,
|
|
74
|
+
fieldHelp,
|
|
70
75
|
name,
|
|
71
76
|
onChange: handleChange,
|
|
72
77
|
onBlur,
|
|
73
78
|
onFocus,
|
|
74
79
|
labelInline: true,
|
|
75
80
|
labelWidth,
|
|
76
|
-
labelSpacing,
|
|
77
81
|
label,
|
|
78
|
-
|
|
79
|
-
inputWidth,
|
|
82
|
+
labelHelp,
|
|
80
83
|
id,
|
|
81
84
|
value,
|
|
82
85
|
type: "radio",
|
|
@@ -97,12 +100,13 @@ const RadioButton = /*#__PURE__*/React.forwardRef(({
|
|
|
97
100
|
"data-element": dataElement,
|
|
98
101
|
inline: inline,
|
|
99
102
|
reverse: reverse,
|
|
100
|
-
size: size
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
size: size
|
|
104
|
+
}, validationRedesignOptIn ? {
|
|
105
|
+
...validationProps
|
|
106
|
+
} : {
|
|
107
|
+
...commonProps,
|
|
108
|
+
fieldHelp
|
|
109
|
+
}, marginProps), /*#__PURE__*/React.createElement(CheckableInput, inputProps, /*#__PURE__*/React.createElement(RadioButtonSvg, null)));
|
|
106
110
|
return /*#__PURE__*/React.createElement(React.Fragment, null, validationRedesignOptIn ? componentToRender : /*#__PURE__*/React.createElement(TooltipProvider, {
|
|
107
111
|
helpAriaLabel: helpAriaLabel,
|
|
108
112
|
tooltipPosition: tooltipPosition
|
|
@@ -6,10 +6,10 @@ export interface CommonCheckableInputProps extends ValidationProps, CommonHidden
|
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
/** @private @ignore */
|
|
8
8
|
loading?: boolean;
|
|
9
|
-
/**
|
|
9
|
+
/** Help content to be displayed under an input */
|
|
10
10
|
fieldHelp?: React.ReactNode;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* If true, the FieldHelp will be displayed inline
|
|
13
13
|
* To be used with labelInline prop set to true
|
|
14
14
|
*/
|
|
15
15
|
fieldHelpInline?: boolean;
|
|
@@ -19,7 +19,7 @@ export interface CommonCheckableInputProps extends ValidationProps, CommonHidden
|
|
|
19
19
|
inputWidth?: number;
|
|
20
20
|
/** Label content */
|
|
21
21
|
label?: React.ReactNode;
|
|
22
|
-
/**
|
|
22
|
+
/** The content for the help tooltip, to appear next to the Label */
|
|
23
23
|
labelHelp?: React.ReactNode;
|
|
24
24
|
/** Spacing between label and a field for inline label, given number will be multiplied by base spacing unit (8) */
|
|
25
25
|
labelSpacing?: 1 | 2;
|
|
@@ -12,7 +12,6 @@ var _formField = _interopRequireDefault(require("../form-field"));
|
|
|
12
12
|
var _hiddenCheckableInput = _interopRequireDefault(require("./hidden-checkable-input.component"));
|
|
13
13
|
var _guid = _interopRequireDefault(require("../utils/helpers/guid"));
|
|
14
14
|
var _useInputAccessibility = _interopRequireDefault(require("../../hooks/__internal__/useInputAccessibility"));
|
|
15
|
-
var _newValidation = _interopRequireDefault(require("../../components/carbon-provider/__internal__/new-validation.context"));
|
|
16
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
16
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
18
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -51,9 +50,6 @@ const CheckableInput = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
51
50
|
const {
|
|
52
51
|
current: id
|
|
53
52
|
} = (0, _react.useRef)(inputId || (0, _guid.default)());
|
|
54
|
-
const {
|
|
55
|
-
validationRedesignOptIn
|
|
56
|
-
} = (0, _react.useContext)(_newValidation.default);
|
|
57
53
|
const {
|
|
58
54
|
labelId,
|
|
59
55
|
fieldHelpId,
|
|
@@ -89,7 +85,7 @@ const CheckableInput = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
89
85
|
// However, we still want the input element to receive the required prop
|
|
90
86
|
isRequired: required,
|
|
91
87
|
isOptional,
|
|
92
|
-
useValidationIcon:
|
|
88
|
+
useValidationIcon: validationOnLabel
|
|
93
89
|
};
|
|
94
90
|
const inputProps = {
|
|
95
91
|
ariaDescribedBy,
|
|
@@ -4,15 +4,47 @@ declare type CustomRefObject<T> = {
|
|
|
4
4
|
current?: T | null;
|
|
5
5
|
};
|
|
6
6
|
export interface PopoverProps {
|
|
7
|
+
/**
|
|
8
|
+
* Element to be positioned, has to be a single node and has to accept `ref` and `style` props.
|
|
9
|
+
*/
|
|
7
10
|
children: React.ReactElement;
|
|
11
|
+
/**
|
|
12
|
+
* Placement of children in relation to the reference element.
|
|
13
|
+
*/
|
|
8
14
|
placement?: Placement;
|
|
15
|
+
/**
|
|
16
|
+
* Disables interaction with background UI.
|
|
17
|
+
*/
|
|
9
18
|
disableBackgroundUI?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Optional middleware array, for more information go to:
|
|
21
|
+
* [https://floating-ui.com/docs/middleware](https://floating-ui.com/docs/middleware)
|
|
22
|
+
*/
|
|
10
23
|
middleware?: Middleware[];
|
|
24
|
+
/**
|
|
25
|
+
* When true, children are not rendered in portal.
|
|
26
|
+
*/
|
|
11
27
|
disablePortal?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Reference element, children will be positioned in relation to this element - should be a ref shaped object.
|
|
30
|
+
*/
|
|
12
31
|
reference: CustomRefObject<HTMLElement>;
|
|
32
|
+
/**
|
|
33
|
+
* Determines if the popover is currently open/visible or not. Defaults to true.
|
|
34
|
+
*/
|
|
13
35
|
isOpen?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Whether to update the position of the floating element on every animation frame if required. This is optimized for performance but can still be costly. Use with caution!
|
|
38
|
+
* [https://floating-ui.com/docs/autoUpdate#animationframe](https://floating-ui.com/docs/autoUpdate#animationframe)
|
|
39
|
+
*/
|
|
14
40
|
animationFrame?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Optional strategy to use for positioning the floating element. Defaults to "absolute".
|
|
43
|
+
*/
|
|
15
44
|
popoverStrategy?: "absolute" | "fixed";
|
|
45
|
+
/**
|
|
46
|
+
* Allows child ref to be set via a prop instead of dynamically finding it via children iteration.
|
|
47
|
+
*/
|
|
16
48
|
childRefOverride?: MutableRefObject<HTMLDivElement | null>;
|
|
17
49
|
}
|
|
18
50
|
declare const Popover: ({ children, placement, disablePortal, reference, middleware, disableBackgroundUI, isOpen, animationFrame, popoverStrategy, childRefOverride, }: PopoverProps) => React.JSX.Element;
|
|
@@ -76,7 +76,9 @@ const Popover = ({
|
|
|
76
76
|
if (disableBackgroundUI) {
|
|
77
77
|
content = /*#__PURE__*/_react.default.createElement(_popover.StyledPopoverContent, {
|
|
78
78
|
isOpen: isOpen
|
|
79
|
-
}, /*#__PURE__*/_react.default.createElement(_popover.StyledBackdrop,
|
|
79
|
+
}, /*#__PURE__*/_react.default.createElement(_popover.StyledBackdrop, {
|
|
80
|
+
"data-role": "popup-backdrop"
|
|
81
|
+
}, content));
|
|
80
82
|
}
|
|
81
83
|
if (disablePortal) {
|
|
82
84
|
return content;
|
|
@@ -32,7 +32,6 @@ const RadioButtonMapper = ({
|
|
|
32
32
|
const [checkedValue, setCheckedValue] = (0, _react.useState)(false);
|
|
33
33
|
const onChangeProp = (0, _react.useCallback)(event => {
|
|
34
34
|
onChange?.(event);
|
|
35
|
-
/* istanbul ignore else */
|
|
36
35
|
if (!isControlled) {
|
|
37
36
|
setCheckedValue(event.target.value);
|
|
38
37
|
}
|
|
@@ -5,8 +5,8 @@ export interface CheckboxGroupProps extends ValidationProps, MarginProps {
|
|
|
5
5
|
/** The content for the CheckboxGroup Legend */
|
|
6
6
|
legend?: string;
|
|
7
7
|
/**
|
|
8
|
-
* The content for the CheckboxGroup
|
|
9
|
-
* will
|
|
8
|
+
* The content for the CheckboxGroup Help tooltip,
|
|
9
|
+
* will be rendered as hint text when `validationRedesignOptIn` is true.
|
|
10
10
|
*/
|
|
11
11
|
legendHelp?: string;
|
|
12
12
|
/** [Legacy] When true, legend is placed inline with the checkboxes */
|
|
@@ -27,7 +27,7 @@ export interface CheckboxGroupProps extends ValidationProps, MarginProps {
|
|
|
27
27
|
isOptional?: boolean;
|
|
28
28
|
/** [Legacy] Overrides the default tooltip */
|
|
29
29
|
tooltipPosition?: "top" | "bottom" | "left" | "right";
|
|
30
|
-
/** When true, Checkboxes are
|
|
30
|
+
/** When true, Checkboxes are in line */
|
|
31
31
|
inline?: boolean;
|
|
32
32
|
}
|
|
33
33
|
export declare const CheckboxGroup: {
|
|
@@ -44,8 +44,12 @@ const CheckboxGroup = props => {
|
|
|
44
44
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, validationRedesignOptIn ? /*#__PURE__*/_react.default.createElement(_fieldset.default, _extends({
|
|
45
45
|
legend: legend,
|
|
46
46
|
inline: legendInline,
|
|
47
|
+
legendWidth: legendWidth,
|
|
48
|
+
legendAlign: legendAlign,
|
|
49
|
+
legendSpacing: legendSpacing,
|
|
47
50
|
error: error,
|
|
48
51
|
warning: warning,
|
|
52
|
+
info: info,
|
|
49
53
|
isRequired: required,
|
|
50
54
|
isOptional: isOptional
|
|
51
55
|
}, (0, _tags.default)("checkboxgroup", props), {
|
|
@@ -61,6 +65,7 @@ const CheckboxGroup = props => {
|
|
|
61
65
|
}), /*#__PURE__*/_react.default.createElement(_checkboxGroup.default, {
|
|
62
66
|
"data-component": "checkbox-group",
|
|
63
67
|
"data-role": "checkbox-group",
|
|
68
|
+
legendInline: legendInline,
|
|
64
69
|
inline: inline
|
|
65
70
|
}, /*#__PURE__*/_react.default.createElement(_checkboxGroup2.default.Provider, {
|
|
66
71
|
value: {
|
|
@@ -87,8 +92,7 @@ const CheckboxGroup = props => {
|
|
|
87
92
|
}, (0, _utils.filterStyledSystemMarginProps)(props)), /*#__PURE__*/_react.default.createElement(_checkboxGroup.default, {
|
|
88
93
|
"data-component": "checkbox-group",
|
|
89
94
|
"data-role": "checkbox-group",
|
|
90
|
-
legendInline: legendInline
|
|
91
|
-
inline: inline
|
|
95
|
+
legendInline: legendInline
|
|
92
96
|
}, /*#__PURE__*/_react.default.createElement(_checkboxGroup2.default.Provider, {
|
|
93
97
|
value: {
|
|
94
98
|
error: !!error,
|
|
@@ -12,13 +12,13 @@ export interface CheckboxProps extends CommonCheckableInputProps, MarginProps {
|
|
|
12
12
|
"data-element"?: string;
|
|
13
13
|
/** Identifier used for testing purposes, applied to the root element of the component. */
|
|
14
14
|
"data-role"?: string;
|
|
15
|
-
/**
|
|
15
|
+
/** Aria label for rendered help component */
|
|
16
16
|
helpAriaLabel?: string;
|
|
17
17
|
/** When true label is inline */
|
|
18
18
|
labelInline?: boolean;
|
|
19
19
|
/** Accepts a callback function which is triggered on click event */
|
|
20
20
|
onClick?: (ev: React.MouseEvent<HTMLInputElement>) => void;
|
|
21
|
-
/**
|
|
21
|
+
/** Overrides the default tooltip position */
|
|
22
22
|
tooltipPosition?: "top" | "bottom" | "left" | "right";
|
|
23
23
|
/** The value of the checkbox, passed on form submit */
|
|
24
24
|
value?: string;
|
|
@@ -70,13 +70,6 @@ const Checkbox = exports.Checkbox = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
70
70
|
deprecateUncontrolledWarnTriggered = true;
|
|
71
71
|
_logger.default.deprecate("Uncontrolled behaviour in `Checkbox` is deprecated and support will soon be removed. Please make sure all your inputs are controlled.");
|
|
72
72
|
}
|
|
73
|
-
const commonProps = {
|
|
74
|
-
fieldHelpInline,
|
|
75
|
-
labelSpacing,
|
|
76
|
-
labelHelp,
|
|
77
|
-
fieldHelp
|
|
78
|
-
};
|
|
79
|
-
const isInGroup = Object.keys(checkboxGroupContext).length !== 0;
|
|
80
73
|
const inputProps = {
|
|
81
74
|
ariaLabelledBy,
|
|
82
75
|
onClick,
|
|
@@ -90,23 +83,28 @@ const Checkbox = exports.Checkbox = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
90
83
|
type: "checkbox",
|
|
91
84
|
name,
|
|
92
85
|
reverse: !reverse,
|
|
86
|
+
fieldHelp,
|
|
93
87
|
autoFocus,
|
|
88
|
+
labelHelp,
|
|
89
|
+
labelSpacing,
|
|
94
90
|
required,
|
|
95
91
|
isOptional,
|
|
92
|
+
fieldHelpInline,
|
|
96
93
|
checked,
|
|
97
94
|
disabled,
|
|
98
95
|
inputWidth,
|
|
99
96
|
labelWidth,
|
|
100
97
|
ref,
|
|
101
|
-
...rest
|
|
102
|
-
...(isInGroup && validationRedesignOptIn ? {} : {
|
|
103
|
-
...commonProps
|
|
104
|
-
})
|
|
98
|
+
...rest
|
|
105
99
|
};
|
|
106
100
|
const validationProps = {
|
|
107
101
|
error: contextError || error,
|
|
108
102
|
warning: contextWarning || warning,
|
|
109
|
-
|
|
103
|
+
...(validationRedesignOptIn ? {
|
|
104
|
+
validationOnLabel: false
|
|
105
|
+
} : {
|
|
106
|
+
info: contextInfo || info
|
|
107
|
+
})
|
|
110
108
|
};
|
|
111
109
|
const marginProps = (0, _useFormSpacing.default)(rest);
|
|
112
110
|
const componentToRender = /*#__PURE__*/_react.default.createElement(_checkbox.default, _extends({
|
|
@@ -50,12 +50,11 @@ const StyledCheckbox = _styledComponents.default.div`
|
|
|
50
50
|
${!disabled && (0, _styledComponents.css)`
|
|
51
51
|
border: 1px solid var(--colorsUtilityMajor300);
|
|
52
52
|
|
|
53
|
+
${info && `border: 1px solid var(--colorsSemanticInfo500);`}
|
|
54
|
+
${warning && `border: 1px solid var(--colorsSemanticCaution500);`}
|
|
53
55
|
${error && `border: 2px solid var(--colorsSemanticNegative500);`}
|
|
54
56
|
|
|
55
|
-
${
|
|
56
|
-
${info && `border: 1px solid var(--colorsSemanticInfo500);`}
|
|
57
|
-
${warning && `border: 1px solid var(--colorsSemanticCaution500);`}
|
|
58
|
-
`}
|
|
57
|
+
${warning && applyNewValidation && `border: 1px solid var(--colorsUtilityMajor300);`}
|
|
59
58
|
`}
|
|
60
59
|
}
|
|
61
60
|
|
|
@@ -180,7 +180,12 @@ const StyledFlatTableRow = _styledComponents.default.tr`
|
|
|
180
180
|
${_flatTableHeader.default} {
|
|
181
181
|
border-bottom: 1px solid ${borderColor(colorTheme)};
|
|
182
182
|
|
|
183
|
-
${
|
|
183
|
+
${horizontalBorderSize !== "small" && (0, _styledComponents.css)`
|
|
184
|
+
border-bottom: ${horizontalBorderSizes[horizontalBorderSize]} solid
|
|
185
|
+
var(--colorsUtilityMajor100);
|
|
186
|
+
`}
|
|
187
|
+
|
|
188
|
+
${!isInSidebar && !colorTheme?.includes("transparent") && `
|
|
184
189
|
:first-child {
|
|
185
190
|
border-left: 1px solid ${borderColor(colorTheme)};
|
|
186
191
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { MarginProps } from "styled-system";
|
|
3
|
+
import * as DesignTokens from "@sage/design-tokens/js/base/common";
|
|
3
4
|
export interface FlatTableProps extends MarginProps {
|
|
4
5
|
/** The HTML id of the element that contains a description of this table. */
|
|
5
6
|
ariaDescribedby?: string;
|
|
@@ -25,13 +26,17 @@ export interface FlatTableProps extends MarginProps {
|
|
|
25
26
|
size?: "compact" | "small" | "medium" | "large" | "extraLarge";
|
|
26
27
|
/** Applies max-height of 100% to FlatTable if true */
|
|
27
28
|
hasMaxHeight?: boolean;
|
|
29
|
+
/** Toggles the visibility of the table's outer left and right borders. When false, the left border of the first column and the right border of the last column are hidden. */
|
|
30
|
+
hasOuterVerticalBorders?: boolean;
|
|
31
|
+
/** Sets the border radius of the first and last cells in the last row. */
|
|
32
|
+
bottomBorderRadius?: Extract<keyof typeof DesignTokens, `borderRadius${number}`>;
|
|
28
33
|
/** Set the overflow X of the table wrapper. Any valid CSS string */
|
|
29
34
|
overflowX?: string;
|
|
30
35
|
/** Width of the table. Any valid CSS string */
|
|
31
36
|
width?: string;
|
|
32
37
|
}
|
|
33
38
|
export declare const FlatTable: {
|
|
34
|
-
({ caption, children, hasStickyHead, colorTheme, footer, hasStickyFooter, height, isZebra, size, hasMaxHeight, ariaDescribedby, minHeight, overflowX, width, ...rest }: FlatTableProps): React.JSX.Element;
|
|
39
|
+
({ caption, children, hasStickyHead, colorTheme, footer, hasStickyFooter, height, isZebra, size, hasMaxHeight, hasOuterVerticalBorders, bottomBorderRadius, ariaDescribedby, minHeight, overflowX, width, ...rest }: FlatTableProps): React.JSX.Element;
|
|
35
40
|
displayName: string;
|
|
36
41
|
};
|
|
37
42
|
export default FlatTable;
|
|
@@ -26,6 +26,8 @@ const FlatTable = ({
|
|
|
26
26
|
isZebra,
|
|
27
27
|
size = "medium",
|
|
28
28
|
hasMaxHeight = false,
|
|
29
|
+
hasOuterVerticalBorders = true,
|
|
30
|
+
bottomBorderRadius = "borderRadius100",
|
|
29
31
|
ariaDescribedby,
|
|
30
32
|
minHeight,
|
|
31
33
|
overflowX,
|
|
@@ -143,6 +145,7 @@ const FlatTable = ({
|
|
|
143
145
|
return /*#__PURE__*/_react.default.createElement(_flatTable.StyledFlatTableWrapper, _extends({
|
|
144
146
|
ref: wrapperRef,
|
|
145
147
|
"data-component": "flat-table-wrapper",
|
|
148
|
+
"data-role": "flat-table-wrapper",
|
|
146
149
|
isInSidebar: isInSidebar,
|
|
147
150
|
hasStickyHead: hasStickyHead,
|
|
148
151
|
colorTheme: colorTheme,
|
|
@@ -150,6 +153,8 @@ const FlatTable = ({
|
|
|
150
153
|
overflowY: hasStickyHead || hasStickyFooter ? "auto" : undefined,
|
|
151
154
|
height: addDefaultHeight && !hasMaxHeight ? "99%" : height,
|
|
152
155
|
maxHeight: hasMaxHeight ? "100%" : undefined,
|
|
156
|
+
hasOuterVerticalBorders: hasOuterVerticalBorders,
|
|
157
|
+
bottomBorderRadius: bottomBorderRadius,
|
|
153
158
|
display: "flex",
|
|
154
159
|
flexDirection: "column",
|
|
155
160
|
justifyContent: hasStickyFooter || height ? "space-between" : undefined,
|
|
@@ -4,12 +4,13 @@ declare const StyledTableContainer: import("styled-components").StyledComponent<
|
|
|
4
4
|
declare const StyledFlatTable: import("styled-components").StyledComponent<"table", any, Pick<FlatTableProps, "caption" | "isZebra"> & {
|
|
5
5
|
size: NonNullable<FlatTableProps["size"]>;
|
|
6
6
|
}, never>;
|
|
7
|
-
interface StyledFlatTableWrapperProps extends Pick<FlatTableProps, "hasStickyFooter" | "colorTheme" | "hasStickyHead" | "footer">, Partial<DrawerSidebarContextProps> {
|
|
7
|
+
interface StyledFlatTableWrapperProps extends Pick<FlatTableProps, "hasStickyFooter" | "colorTheme" | "hasStickyHead" | "footer" | "hasOuterVerticalBorders">, Partial<DrawerSidebarContextProps> {
|
|
8
8
|
hasHorizontalScrollbar: boolean;
|
|
9
9
|
hasVerticalScrollbar: boolean;
|
|
10
10
|
lastColRowSpanIndex: number;
|
|
11
11
|
firstColRowSpanIndex: number;
|
|
12
12
|
isFocused: boolean;
|
|
13
|
+
bottomBorderRadius: NonNullable<FlatTableProps["bottomBorderRadius"]>;
|
|
13
14
|
}
|
|
14
15
|
declare const StyledFlatTableWrapper: import("styled-components").StyledComponent<"div", any, import("../box").BoxProps & StyledFlatTableWrapperProps, never>;
|
|
15
16
|
declare const StyledFlatTableFooter: import("styled-components").StyledComponent<"div", any, Pick<FlatTableProps, "hasStickyFooter">, never>;
|
|
@@ -109,12 +109,27 @@ const StyledFlatTable = exports.StyledFlatTable = _styledComponents.default.tabl
|
|
|
109
109
|
const StyledFlatTableWrapper = exports.StyledFlatTableWrapper = (0, _styledComponents.default)(_box.default)`
|
|
110
110
|
border-top-left-radius: var(--borderRadius100);
|
|
111
111
|
border-top-right-radius: var(--borderRadius100);
|
|
112
|
+
|
|
113
|
+
${({
|
|
114
|
+
hasOuterVerticalBorders
|
|
115
|
+
}) => !hasOuterVerticalBorders && (0, _styledComponents.css)`
|
|
116
|
+
${_flatTableRow.default} {
|
|
117
|
+
& > ${_flatTableCell.StyledFlatTableCell}:first-child {
|
|
118
|
+
border-left-color: var(--colorsUtilityMajorTransparent);
|
|
119
|
+
}
|
|
120
|
+
& > ${_flatTableCell.StyledFlatTableCell}:last-child {
|
|
121
|
+
border-right-color: var(--colorsUtilityMajorTransparent);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
`}
|
|
125
|
+
|
|
112
126
|
${({
|
|
113
127
|
hasStickyFooter,
|
|
114
|
-
hasHorizontalScrollbar
|
|
128
|
+
hasHorizontalScrollbar,
|
|
129
|
+
bottomBorderRadius
|
|
115
130
|
}) => !hasStickyFooter && !hasHorizontalScrollbar && (0, _styledComponents.css)`
|
|
116
|
-
border-bottom-left-radius: var(
|
|
117
|
-
border-bottom-right-radius: var(
|
|
131
|
+
border-bottom-left-radius: var(--${bottomBorderRadius});
|
|
132
|
+
border-bottom-right-radius: var(--${bottomBorderRadius});
|
|
118
133
|
`}
|
|
119
134
|
|
|
120
135
|
${({
|
|
@@ -161,7 +176,6 @@ const StyledFlatTableWrapper = exports.StyledFlatTableWrapper = (0, _styledCompo
|
|
|
161
176
|
${_flatTableHeader.default},
|
|
162
177
|
${_flatTableHead.default} ${_flatTableCheckbox.default} {
|
|
163
178
|
background-color: var(--colorsUtilityMajor025);
|
|
164
|
-
border-right: 1px solid var(--colorsUtilityMajor025);
|
|
165
179
|
border-bottom-color: var(--colorsUtilityMajor100);
|
|
166
180
|
}
|
|
167
181
|
${_flatTableHead.default} ${_flatTableRowHeader.StyledFlatTableRowHeader} {
|
|
@@ -176,7 +190,6 @@ const StyledFlatTableWrapper = exports.StyledFlatTableWrapper = (0, _styledCompo
|
|
|
176
190
|
${_flatTableHeader.default},
|
|
177
191
|
${_flatTableHead.default} ${_flatTableCheckbox.default} {
|
|
178
192
|
background-color: var(--colorsUtilityYang100);
|
|
179
|
-
border-right: 1px solid var(--colorsUtilityYang100);
|
|
180
193
|
border-bottom-color: var(--colorsUtilityMajor100);
|
|
181
194
|
}
|
|
182
195
|
${_flatTableHead.default} ${_flatTableRowHeader.StyledFlatTableRowHeader} {
|
|
@@ -303,7 +316,8 @@ const StyledFlatTableWrapper = exports.StyledFlatTableWrapper = (0, _styledCompo
|
|
|
303
316
|
firstColRowSpanIndex,
|
|
304
317
|
lastColRowSpanIndex,
|
|
305
318
|
hasHorizontalScrollbar,
|
|
306
|
-
hasVerticalScrollbar
|
|
319
|
+
hasVerticalScrollbar,
|
|
320
|
+
bottomBorderRadius
|
|
307
321
|
}) => !footer && (0, _styledComponents.css)`
|
|
308
322
|
tbody {
|
|
309
323
|
${firstColRowSpanIndex >= 0 && (0, _styledComponents.css)`
|
|
@@ -328,13 +342,13 @@ const StyledFlatTableWrapper = exports.StyledFlatTableWrapper = (0, _styledCompo
|
|
|
328
342
|
${!hasHorizontalScrollbar && firstColRowSpanIndex === -1 && (0, _styledComponents.css)`
|
|
329
343
|
th:first-child,
|
|
330
344
|
td:first-child {
|
|
331
|
-
border-bottom-left-radius: var(
|
|
345
|
+
border-bottom-left-radius: var(--${bottomBorderRadius});
|
|
332
346
|
}
|
|
333
347
|
`}
|
|
334
348
|
${!hasVerticalScrollbar && !hasHorizontalScrollbar && lastColRowSpanIndex === -1 && (0, _styledComponents.css)`
|
|
335
349
|
th:last-child,
|
|
336
350
|
td:last-child {
|
|
337
|
-
border-bottom-right-radius: var(
|
|
351
|
+
border-bottom-right-radius: var(--${bottomBorderRadius});
|
|
338
352
|
}
|
|
339
353
|
`}
|
|
340
354
|
}
|
|
@@ -15,8 +15,8 @@ export interface RadioButtonGroupProps extends ValidationProps, MarginProps {
|
|
|
15
15
|
/** The content for the RadioGroup Legend */
|
|
16
16
|
legend?: string;
|
|
17
17
|
/**
|
|
18
|
-
* The content for the RadioButtonGroup
|
|
19
|
-
* will
|
|
18
|
+
* The content for the RadioButtonGroup Legend Help tooltip,
|
|
19
|
+
* will be rendered as hint text when `validationRedesignOptIn` is true.
|
|
20
20
|
*/
|
|
21
21
|
legendHelp?: string;
|
|
22
22
|
/** [Legacy] Text alignment of legend when inline */
|
|
@@ -69,7 +69,11 @@ const RadioButtonGroup = props => {
|
|
|
69
69
|
legend: legend,
|
|
70
70
|
error: error,
|
|
71
71
|
warning: warning,
|
|
72
|
+
info: info,
|
|
72
73
|
inline: inlineLegend,
|
|
74
|
+
legendWidth: legendWidth,
|
|
75
|
+
legendAlign: legendAlign,
|
|
76
|
+
legendSpacing: legendSpacing,
|
|
73
77
|
isRequired: required,
|
|
74
78
|
isOptional: isOptional
|
|
75
79
|
}, (0, _tags.default)("radiogroup", props), marginProps, {
|
|
@@ -87,7 +91,8 @@ const RadioButtonGroup = props => {
|
|
|
87
91
|
}), /*#__PURE__*/_react.default.createElement(_radioButtonGroup.default, {
|
|
88
92
|
"data-component": "radio-button-group",
|
|
89
93
|
role: "radiogroup",
|
|
90
|
-
inline: inline
|
|
94
|
+
inline: inline,
|
|
95
|
+
legendInline: inlineLegend
|
|
91
96
|
}, /*#__PURE__*/_react.default.createElement(_radioButtonMapper.default, {
|
|
92
97
|
name: name,
|
|
93
98
|
onBlur: onBlur,
|
|
@@ -102,6 +107,8 @@ const RadioButtonGroup = props => {
|
|
|
102
107
|
labelSpacing,
|
|
103
108
|
error: !!error,
|
|
104
109
|
warning: !!warning,
|
|
110
|
+
info: !!info,
|
|
111
|
+
required,
|
|
105
112
|
...child.props
|
|
106
113
|
});
|
|
107
114
|
}))))) : /*#__PURE__*/_react.default.createElement(_tooltipProvider.TooltipProvider, {
|
|
@@ -15,9 +15,9 @@ export interface RadioButtonProps extends Omit<CommonCheckableInputProps, "requi
|
|
|
15
15
|
onClick?: (ev: React.MouseEvent<HTMLInputElement>) => void;
|
|
16
16
|
/** the value of the Radio Button, passed on form submit */
|
|
17
17
|
value: string;
|
|
18
|
-
/**
|
|
18
|
+
/** Overrides the default tooltip position */
|
|
19
19
|
tooltipPosition?: "top" | "bottom" | "left" | "right";
|
|
20
|
-
/**
|
|
20
|
+
/** Aria label for rendered help component */
|
|
21
21
|
helpAriaLabel?: string;
|
|
22
22
|
}
|
|
23
23
|
export declare const RadioButton: React.ForwardRefExoticComponent<RadioButtonProps & InternalRadioButtonProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -61,31 +61,34 @@ const RadioButton = exports.RadioButton = /*#__PURE__*/_react.default.forwardRef
|
|
|
61
61
|
event.target.focus();
|
|
62
62
|
}, [onChange]);
|
|
63
63
|
const validationProps = {
|
|
64
|
+
disabled,
|
|
65
|
+
inputWidth,
|
|
64
66
|
error,
|
|
65
67
|
warning,
|
|
66
68
|
info
|
|
67
69
|
};
|
|
68
70
|
const commonProps = {
|
|
71
|
+
...validationProps,
|
|
69
72
|
fieldHelpInline,
|
|
70
|
-
|
|
71
|
-
fieldHelp
|
|
73
|
+
labelSpacing
|
|
72
74
|
};
|
|
73
75
|
const inputProps = {
|
|
74
|
-
...(
|
|
76
|
+
...(validationRedesignOptIn ? {
|
|
77
|
+
...validationProps
|
|
78
|
+
} : {
|
|
75
79
|
...commonProps
|
|
76
80
|
}),
|
|
77
81
|
autoFocus,
|
|
78
82
|
checked,
|
|
83
|
+
fieldHelp,
|
|
79
84
|
name,
|
|
80
85
|
onChange: handleChange,
|
|
81
86
|
onBlur,
|
|
82
87
|
onFocus,
|
|
83
88
|
labelInline: true,
|
|
84
89
|
labelWidth,
|
|
85
|
-
labelSpacing,
|
|
86
90
|
label,
|
|
87
|
-
|
|
88
|
-
inputWidth,
|
|
91
|
+
labelHelp,
|
|
89
92
|
id,
|
|
90
93
|
value,
|
|
91
94
|
type: "radio",
|
|
@@ -106,12 +109,13 @@ const RadioButton = exports.RadioButton = /*#__PURE__*/_react.default.forwardRef
|
|
|
106
109
|
"data-element": dataElement,
|
|
107
110
|
inline: inline,
|
|
108
111
|
reverse: reverse,
|
|
109
|
-
size: size
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
size: size
|
|
113
|
+
}, validationRedesignOptIn ? {
|
|
114
|
+
...validationProps
|
|
115
|
+
} : {
|
|
116
|
+
...commonProps,
|
|
117
|
+
fieldHelp
|
|
118
|
+
}, marginProps), /*#__PURE__*/_react.default.createElement(_checkableInput.default, inputProps, /*#__PURE__*/_react.default.createElement(_radioButtonSvg.default, null)));
|
|
115
119
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, validationRedesignOptIn ? componentToRender : /*#__PURE__*/_react.default.createElement(_tooltipProvider.TooltipProvider, {
|
|
116
120
|
helpAriaLabel: helpAriaLabel,
|
|
117
121
|
tooltipPosition: tooltipPosition
|