carbon-react 118.5.2 → 119.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/__internal__/form-field/form-field.component.d.ts +3 -1
- package/esm/__internal__/form-field/form-field.component.js +3 -1
- package/esm/__internal__/label/label.component.d.ts +3 -2
- package/esm/__internal__/label/label.component.js +10 -5
- package/esm/components/breadcrumbs/breadcrumbs.component.d.ts +2 -1
- package/esm/components/breadcrumbs/breadcrumbs.component.js +310 -2
- package/esm/components/breadcrumbs/breadcrumbs.style.js +9 -0
- package/esm/components/breadcrumbs/crumb/crumb.component.d.ts +0 -2
- package/esm/components/breadcrumbs/crumb/crumb.component.js +5 -3
- package/esm/components/button-toggle/button-toggle-group/button-toggle-group.component.d.ts +64 -0
- package/esm/components/button-toggle/button-toggle-group/button-toggle-group.component.js +157 -0
- package/esm/components/button-toggle/button-toggle-group/button-toggle-group.style.d.ts +6 -0
- package/esm/components/button-toggle/button-toggle-group/button-toggle-group.style.js +64 -0
- package/esm/components/button-toggle/button-toggle.component.d.ts +21 -8
- package/esm/components/button-toggle/button-toggle.component.js +94 -27
- package/esm/components/button-toggle/button-toggle.style.d.ts +7 -6
- package/esm/components/button-toggle/button-toggle.style.js +46 -37
- package/esm/components/button-toggle/index.d.ts +3 -1
- package/esm/components/button-toggle/index.js +2 -1
- package/lib/__internal__/form-field/form-field.component.d.ts +3 -1
- package/lib/__internal__/form-field/form-field.component.js +3 -1
- package/lib/__internal__/label/label.component.d.ts +3 -2
- package/lib/__internal__/label/label.component.js +10 -5
- package/lib/components/breadcrumbs/breadcrumbs.component.d.ts +2 -1
- package/lib/components/breadcrumbs/breadcrumbs.component.js +310 -2
- package/lib/components/breadcrumbs/breadcrumbs.style.js +9 -0
- package/lib/components/breadcrumbs/crumb/crumb.component.d.ts +0 -2
- package/lib/components/breadcrumbs/crumb/crumb.component.js +5 -3
- package/lib/components/button-toggle/button-toggle-group/button-toggle-group.component.d.ts +64 -0
- package/lib/components/button-toggle/button-toggle-group/button-toggle-group.component.js +168 -0
- package/lib/components/button-toggle/button-toggle-group/button-toggle-group.style.d.ts +6 -0
- package/lib/components/{button-toggle-group → button-toggle/button-toggle-group}/button-toggle-group.style.js +29 -46
- package/lib/components/button-toggle/button-toggle-group/package.json +6 -0
- package/lib/components/button-toggle/button-toggle.component.d.ts +21 -8
- package/lib/components/button-toggle/button-toggle.component.js +93 -26
- package/lib/components/button-toggle/button-toggle.style.d.ts +7 -6
- package/lib/components/button-toggle/button-toggle.style.js +48 -40
- package/lib/components/button-toggle/index.d.ts +3 -1
- package/lib/components/button-toggle/index.js +8 -1
- package/package.json +1 -1
- package/esm/components/button-toggle/button-toggle-input.component.d.ts +0 -25
- package/esm/components/button-toggle/button-toggle-input.component.js +0 -44
- package/esm/components/button-toggle-group/button-toggle-group.component.d.ts +0 -47
- package/esm/components/button-toggle-group/button-toggle-group.component.js +0 -84
- package/esm/components/button-toggle-group/button-toggle-group.style.d.ts +0 -4
- package/esm/components/button-toggle-group/button-toggle-group.style.js +0 -81
- package/lib/components/button-toggle/button-toggle-input.component.d.ts +0 -25
- package/lib/components/button-toggle/button-toggle-input.component.js +0 -54
- package/lib/components/button-toggle-group/button-toggle-group.component.d.ts +0 -47
- package/lib/components/button-toggle-group/button-toggle-group.component.js +0 -94
- package/lib/components/button-toggle-group/button-toggle-group.style.d.ts +0 -4
- package/lib/components/button-toggle-group/package.json +0 -6
- /package/esm/components/{button-toggle-group → button-toggle/button-toggle-group}/index.d.ts +0 -0
- /package/esm/components/{button-toggle-group → button-toggle/button-toggle-group}/index.js +0 -0
- /package/lib/components/{button-toggle-group → button-toggle/button-toggle-group}/index.d.ts +0 -0
- /package/lib/components/{button-toggle-group → button-toggle/button-toggle-group}/index.js +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { MarginProps } from "styled-system";
|
|
3
3
|
import { ValidationProps } from "../validations";
|
|
4
|
+
import { LabelProps } from "../label";
|
|
4
5
|
import { TagProps } from "../utils/helpers/tags/tags";
|
|
5
6
|
import { IconType } from "../../components/icon";
|
|
6
7
|
interface CommonFormFieldProps extends MarginProps, ValidationProps {
|
|
@@ -28,6 +29,7 @@ interface CommonFormFieldProps extends MarginProps, ValidationProps {
|
|
|
28
29
|
labelSpacing?: 1 | 2;
|
|
29
30
|
/** Label width */
|
|
30
31
|
labelWidth?: number;
|
|
32
|
+
labelAs?: LabelProps["as"];
|
|
31
33
|
/** If true the label switches position with the input */
|
|
32
34
|
reverse?: boolean;
|
|
33
35
|
/** Id of the validation icon */
|
|
@@ -57,7 +59,7 @@ export interface FormFieldProps extends CommonFormFieldProps, TagProps {
|
|
|
57
59
|
useValidationIcon?: boolean;
|
|
58
60
|
}
|
|
59
61
|
declare const FormField: {
|
|
60
|
-
({ children, "data-component": dataComponent, disabled, fieldHelp: fieldHelpContent, fieldHelpInline, error, warning, info, tooltipId, fieldHelpId, label, labelId, labelAlign, labelHelp, labelHelpIcon, labelInline, labelSpacing, labelWidth, id, reverse, isOptional, useValidationIcon, adaptiveLabelBreakpoint, isRequired, validationIconId, validationRedesignOptIn, ...rest }: FormFieldProps): React.JSX.Element;
|
|
62
|
+
({ children, "data-component": dataComponent, disabled, fieldHelp: fieldHelpContent, fieldHelpInline, error, warning, info, tooltipId, fieldHelpId, label, labelId, labelAlign, labelHelp, labelHelpIcon, labelInline, labelSpacing, labelWidth, labelAs, id, reverse, isOptional, useValidationIcon, adaptiveLabelBreakpoint, isRequired, validationIconId, validationRedesignOptIn, ...rest }: FormFieldProps): React.JSX.Element;
|
|
61
63
|
displayName: string;
|
|
62
64
|
};
|
|
63
65
|
export default FormField;
|
|
@@ -29,6 +29,7 @@ const FormField = _ref => {
|
|
|
29
29
|
labelInline,
|
|
30
30
|
labelSpacing = 2,
|
|
31
31
|
labelWidth,
|
|
32
|
+
labelAs,
|
|
32
33
|
id,
|
|
33
34
|
reverse,
|
|
34
35
|
isOptional,
|
|
@@ -104,7 +105,8 @@ const FormField = _ref => {
|
|
|
104
105
|
pr: !reverse ? labelSpacing : undefined,
|
|
105
106
|
pl: reverse ? labelSpacing : undefined,
|
|
106
107
|
isRequired: isRequired,
|
|
107
|
-
validationIconId: validationIconId
|
|
108
|
+
validationIconId: validationIconId,
|
|
109
|
+
as: labelAs
|
|
108
110
|
}, label), fieldHelpInline && fieldHelp, !reverse && children), !fieldHelpInline && fieldHelp);
|
|
109
111
|
};
|
|
110
112
|
FormField.displayName = "FormField";
|
|
@@ -3,6 +3,7 @@ import { StyledLabelProps, StyledLabelContainerProps } from "./label.style";
|
|
|
3
3
|
import { ValidationProps } from "../validations";
|
|
4
4
|
import { IconType } from "../../components/icon";
|
|
5
5
|
export interface LabelProps extends ValidationProps, StyledLabelProps, StyledLabelContainerProps {
|
|
6
|
+
as?: "span" | "label";
|
|
6
7
|
/** Children elements */
|
|
7
8
|
children?: React.ReactNode;
|
|
8
9
|
/** A message that the Help component will display */
|
|
@@ -20,6 +21,6 @@ export interface LabelProps extends ValidationProps, StyledLabelProps, StyledLab
|
|
|
20
21
|
/** Id of the validation icon */
|
|
21
22
|
validationIconId?: string;
|
|
22
23
|
}
|
|
23
|
-
export declare const Label: ({ align, children, disabled, error, help, helpIcon, htmlFor, info, inline, isRequired, labelId, optional, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, }: LabelProps) => React.JSX.Element;
|
|
24
|
-
declare const _default: React.MemoExoticComponent<({ align, children, disabled, error, help, helpIcon, htmlFor, info, inline, isRequired, labelId, optional, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, }: LabelProps) => React.JSX.Element>;
|
|
24
|
+
export declare const Label: ({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isRequired, labelId, optional, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, }: LabelProps) => React.JSX.Element;
|
|
25
|
+
declare const _default: React.MemoExoticComponent<({ align, as, children, disabled, error, help, helpIcon, htmlFor, info, inline, isRequired, labelId, optional, pr, pl, tooltipId, useValidationIcon, validationIconId, warning, width, }: LabelProps) => React.JSX.Element>;
|
|
25
26
|
export default _default;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
1
2
|
import React, { useState, useContext } from "react";
|
|
2
3
|
import PropTypes from "prop-types";
|
|
3
4
|
import Help from "../../components/help";
|
|
@@ -27,6 +28,7 @@ const tooltipPosition = _ref2 => {
|
|
|
27
28
|
export const Label = _ref3 => {
|
|
28
29
|
let {
|
|
29
30
|
align = "right",
|
|
31
|
+
as = "label",
|
|
30
32
|
children,
|
|
31
33
|
disabled,
|
|
32
34
|
error,
|
|
@@ -102,14 +104,17 @@ export const Label = _ref3 => {
|
|
|
102
104
|
optional: optional,
|
|
103
105
|
pr: pr,
|
|
104
106
|
pl: pl
|
|
105
|
-
}, /*#__PURE__*/React.createElement(StyledLabel, {
|
|
107
|
+
}, /*#__PURE__*/React.createElement(StyledLabel, _extends({
|
|
106
108
|
"data-element": "label",
|
|
107
109
|
disabled: disabled,
|
|
108
|
-
id: labelId
|
|
109
|
-
|
|
110
|
+
id: labelId
|
|
111
|
+
}, as === "label" ? {
|
|
112
|
+
htmlFor
|
|
113
|
+
} : {}, {
|
|
110
114
|
onMouseEnter: handleMouseEnter,
|
|
111
115
|
onMouseLeave: handleMouseLeave,
|
|
112
|
-
isRequired: isRequired
|
|
113
|
-
|
|
116
|
+
isRequired: isRequired,
|
|
117
|
+
as: as
|
|
118
|
+
}), children), icon());
|
|
114
119
|
};
|
|
115
120
|
export default /*#__PURE__*/React.memo(Label);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { SpaceProps } from "styled-system";
|
|
2
3
|
import { TagProps } from "../../__internal__/utils/helpers/tags";
|
|
3
|
-
export interface BreadcrumbsProps extends TagProps {
|
|
4
|
+
export interface BreadcrumbsProps extends TagProps, SpaceProps {
|
|
4
5
|
/** Child crumbs to display */
|
|
5
6
|
children: React.ReactNode;
|
|
6
7
|
}
|
|
@@ -15,13 +15,321 @@ const Breadcrumbs = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
15
15
|
role: "navigation"
|
|
16
16
|
}, tagComponent("breadcrumbs", rest), {
|
|
17
17
|
"aria-label": l.breadcrumbs.ariaLabel()
|
|
18
|
-
}), /*#__PURE__*/React.createElement("ol", null, children));
|
|
18
|
+
}, rest), /*#__PURE__*/React.createElement("ol", null, children));
|
|
19
19
|
});
|
|
20
20
|
Breadcrumbs.propTypes = {
|
|
21
21
|
"children": PropTypes.node,
|
|
22
22
|
"data-component": PropTypes.string,
|
|
23
23
|
"data-element": PropTypes.string,
|
|
24
|
-
"data-role": PropTypes.string
|
|
24
|
+
"data-role": PropTypes.string,
|
|
25
|
+
"m": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
26
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
27
|
+
"description": PropTypes.string,
|
|
28
|
+
"toString": PropTypes.func.isRequired,
|
|
29
|
+
"valueOf": PropTypes.func.isRequired
|
|
30
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
31
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
32
|
+
"description": PropTypes.string,
|
|
33
|
+
"toString": PropTypes.func.isRequired,
|
|
34
|
+
"valueOf": PropTypes.func.isRequired
|
|
35
|
+
}), PropTypes.string]),
|
|
36
|
+
"margin": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
37
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
38
|
+
"description": PropTypes.string,
|
|
39
|
+
"toString": PropTypes.func.isRequired,
|
|
40
|
+
"valueOf": PropTypes.func.isRequired
|
|
41
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
42
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
43
|
+
"description": PropTypes.string,
|
|
44
|
+
"toString": PropTypes.func.isRequired,
|
|
45
|
+
"valueOf": PropTypes.func.isRequired
|
|
46
|
+
}), PropTypes.string]),
|
|
47
|
+
"marginBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
48
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
49
|
+
"description": PropTypes.string,
|
|
50
|
+
"toString": PropTypes.func.isRequired,
|
|
51
|
+
"valueOf": PropTypes.func.isRequired
|
|
52
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
53
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
54
|
+
"description": PropTypes.string,
|
|
55
|
+
"toString": PropTypes.func.isRequired,
|
|
56
|
+
"valueOf": PropTypes.func.isRequired
|
|
57
|
+
}), PropTypes.string]),
|
|
58
|
+
"marginLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
59
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
60
|
+
"description": PropTypes.string,
|
|
61
|
+
"toString": PropTypes.func.isRequired,
|
|
62
|
+
"valueOf": PropTypes.func.isRequired
|
|
63
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
64
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
65
|
+
"description": PropTypes.string,
|
|
66
|
+
"toString": PropTypes.func.isRequired,
|
|
67
|
+
"valueOf": PropTypes.func.isRequired
|
|
68
|
+
}), PropTypes.string]),
|
|
69
|
+
"marginRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
70
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
71
|
+
"description": PropTypes.string,
|
|
72
|
+
"toString": PropTypes.func.isRequired,
|
|
73
|
+
"valueOf": PropTypes.func.isRequired
|
|
74
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
75
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
76
|
+
"description": PropTypes.string,
|
|
77
|
+
"toString": PropTypes.func.isRequired,
|
|
78
|
+
"valueOf": PropTypes.func.isRequired
|
|
79
|
+
}), PropTypes.string]),
|
|
80
|
+
"marginTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
81
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
82
|
+
"description": PropTypes.string,
|
|
83
|
+
"toString": PropTypes.func.isRequired,
|
|
84
|
+
"valueOf": PropTypes.func.isRequired
|
|
85
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
86
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
87
|
+
"description": PropTypes.string,
|
|
88
|
+
"toString": PropTypes.func.isRequired,
|
|
89
|
+
"valueOf": PropTypes.func.isRequired
|
|
90
|
+
}), PropTypes.string]),
|
|
91
|
+
"marginX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
92
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
93
|
+
"description": PropTypes.string,
|
|
94
|
+
"toString": PropTypes.func.isRequired,
|
|
95
|
+
"valueOf": PropTypes.func.isRequired
|
|
96
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
97
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
98
|
+
"description": PropTypes.string,
|
|
99
|
+
"toString": PropTypes.func.isRequired,
|
|
100
|
+
"valueOf": PropTypes.func.isRequired
|
|
101
|
+
}), PropTypes.string]),
|
|
102
|
+
"marginY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
103
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
104
|
+
"description": PropTypes.string,
|
|
105
|
+
"toString": PropTypes.func.isRequired,
|
|
106
|
+
"valueOf": PropTypes.func.isRequired
|
|
107
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
108
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
109
|
+
"description": PropTypes.string,
|
|
110
|
+
"toString": PropTypes.func.isRequired,
|
|
111
|
+
"valueOf": PropTypes.func.isRequired
|
|
112
|
+
}), PropTypes.string]),
|
|
113
|
+
"mb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
114
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
115
|
+
"description": PropTypes.string,
|
|
116
|
+
"toString": PropTypes.func.isRequired,
|
|
117
|
+
"valueOf": PropTypes.func.isRequired
|
|
118
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
119
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
120
|
+
"description": PropTypes.string,
|
|
121
|
+
"toString": PropTypes.func.isRequired,
|
|
122
|
+
"valueOf": PropTypes.func.isRequired
|
|
123
|
+
}), PropTypes.string]),
|
|
124
|
+
"ml": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
125
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
126
|
+
"description": PropTypes.string,
|
|
127
|
+
"toString": PropTypes.func.isRequired,
|
|
128
|
+
"valueOf": PropTypes.func.isRequired
|
|
129
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
130
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
131
|
+
"description": PropTypes.string,
|
|
132
|
+
"toString": PropTypes.func.isRequired,
|
|
133
|
+
"valueOf": PropTypes.func.isRequired
|
|
134
|
+
}), PropTypes.string]),
|
|
135
|
+
"mr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
136
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
137
|
+
"description": PropTypes.string,
|
|
138
|
+
"toString": PropTypes.func.isRequired,
|
|
139
|
+
"valueOf": PropTypes.func.isRequired
|
|
140
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
141
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
142
|
+
"description": PropTypes.string,
|
|
143
|
+
"toString": PropTypes.func.isRequired,
|
|
144
|
+
"valueOf": PropTypes.func.isRequired
|
|
145
|
+
}), PropTypes.string]),
|
|
146
|
+
"mt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
147
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
148
|
+
"description": PropTypes.string,
|
|
149
|
+
"toString": PropTypes.func.isRequired,
|
|
150
|
+
"valueOf": PropTypes.func.isRequired
|
|
151
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
152
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
153
|
+
"description": PropTypes.string,
|
|
154
|
+
"toString": PropTypes.func.isRequired,
|
|
155
|
+
"valueOf": PropTypes.func.isRequired
|
|
156
|
+
}), PropTypes.string]),
|
|
157
|
+
"mx": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
158
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
159
|
+
"description": PropTypes.string,
|
|
160
|
+
"toString": PropTypes.func.isRequired,
|
|
161
|
+
"valueOf": PropTypes.func.isRequired
|
|
162
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
163
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
164
|
+
"description": PropTypes.string,
|
|
165
|
+
"toString": PropTypes.func.isRequired,
|
|
166
|
+
"valueOf": PropTypes.func.isRequired
|
|
167
|
+
}), PropTypes.string]),
|
|
168
|
+
"my": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
169
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
170
|
+
"description": PropTypes.string,
|
|
171
|
+
"toString": PropTypes.func.isRequired,
|
|
172
|
+
"valueOf": PropTypes.func.isRequired
|
|
173
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
174
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
175
|
+
"description": PropTypes.string,
|
|
176
|
+
"toString": PropTypes.func.isRequired,
|
|
177
|
+
"valueOf": PropTypes.func.isRequired
|
|
178
|
+
}), PropTypes.string]),
|
|
179
|
+
"p": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
180
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
181
|
+
"description": PropTypes.string,
|
|
182
|
+
"toString": PropTypes.func.isRequired,
|
|
183
|
+
"valueOf": PropTypes.func.isRequired
|
|
184
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
185
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
186
|
+
"description": PropTypes.string,
|
|
187
|
+
"toString": PropTypes.func.isRequired,
|
|
188
|
+
"valueOf": PropTypes.func.isRequired
|
|
189
|
+
}), PropTypes.string]),
|
|
190
|
+
"padding": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
191
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
192
|
+
"description": PropTypes.string,
|
|
193
|
+
"toString": PropTypes.func.isRequired,
|
|
194
|
+
"valueOf": PropTypes.func.isRequired
|
|
195
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
196
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
197
|
+
"description": PropTypes.string,
|
|
198
|
+
"toString": PropTypes.func.isRequired,
|
|
199
|
+
"valueOf": PropTypes.func.isRequired
|
|
200
|
+
}), PropTypes.string]),
|
|
201
|
+
"paddingBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
202
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
203
|
+
"description": PropTypes.string,
|
|
204
|
+
"toString": PropTypes.func.isRequired,
|
|
205
|
+
"valueOf": PropTypes.func.isRequired
|
|
206
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
207
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
208
|
+
"description": PropTypes.string,
|
|
209
|
+
"toString": PropTypes.func.isRequired,
|
|
210
|
+
"valueOf": PropTypes.func.isRequired
|
|
211
|
+
}), PropTypes.string]),
|
|
212
|
+
"paddingLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
213
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
214
|
+
"description": PropTypes.string,
|
|
215
|
+
"toString": PropTypes.func.isRequired,
|
|
216
|
+
"valueOf": PropTypes.func.isRequired
|
|
217
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
218
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
219
|
+
"description": PropTypes.string,
|
|
220
|
+
"toString": PropTypes.func.isRequired,
|
|
221
|
+
"valueOf": PropTypes.func.isRequired
|
|
222
|
+
}), PropTypes.string]),
|
|
223
|
+
"paddingRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
224
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
225
|
+
"description": PropTypes.string,
|
|
226
|
+
"toString": PropTypes.func.isRequired,
|
|
227
|
+
"valueOf": PropTypes.func.isRequired
|
|
228
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
229
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
230
|
+
"description": PropTypes.string,
|
|
231
|
+
"toString": PropTypes.func.isRequired,
|
|
232
|
+
"valueOf": PropTypes.func.isRequired
|
|
233
|
+
}), PropTypes.string]),
|
|
234
|
+
"paddingTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
235
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
236
|
+
"description": PropTypes.string,
|
|
237
|
+
"toString": PropTypes.func.isRequired,
|
|
238
|
+
"valueOf": PropTypes.func.isRequired
|
|
239
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
240
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
241
|
+
"description": PropTypes.string,
|
|
242
|
+
"toString": PropTypes.func.isRequired,
|
|
243
|
+
"valueOf": PropTypes.func.isRequired
|
|
244
|
+
}), PropTypes.string]),
|
|
245
|
+
"paddingX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
246
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
247
|
+
"description": PropTypes.string,
|
|
248
|
+
"toString": PropTypes.func.isRequired,
|
|
249
|
+
"valueOf": PropTypes.func.isRequired
|
|
250
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
251
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
252
|
+
"description": PropTypes.string,
|
|
253
|
+
"toString": PropTypes.func.isRequired,
|
|
254
|
+
"valueOf": PropTypes.func.isRequired
|
|
255
|
+
}), PropTypes.string]),
|
|
256
|
+
"paddingY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
257
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
258
|
+
"description": PropTypes.string,
|
|
259
|
+
"toString": PropTypes.func.isRequired,
|
|
260
|
+
"valueOf": PropTypes.func.isRequired
|
|
261
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
262
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
263
|
+
"description": PropTypes.string,
|
|
264
|
+
"toString": PropTypes.func.isRequired,
|
|
265
|
+
"valueOf": PropTypes.func.isRequired
|
|
266
|
+
}), PropTypes.string]),
|
|
267
|
+
"pb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
268
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
269
|
+
"description": PropTypes.string,
|
|
270
|
+
"toString": PropTypes.func.isRequired,
|
|
271
|
+
"valueOf": PropTypes.func.isRequired
|
|
272
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
273
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
274
|
+
"description": PropTypes.string,
|
|
275
|
+
"toString": PropTypes.func.isRequired,
|
|
276
|
+
"valueOf": PropTypes.func.isRequired
|
|
277
|
+
}), PropTypes.string]),
|
|
278
|
+
"pl": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
279
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
280
|
+
"description": PropTypes.string,
|
|
281
|
+
"toString": PropTypes.func.isRequired,
|
|
282
|
+
"valueOf": PropTypes.func.isRequired
|
|
283
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
284
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
285
|
+
"description": PropTypes.string,
|
|
286
|
+
"toString": PropTypes.func.isRequired,
|
|
287
|
+
"valueOf": PropTypes.func.isRequired
|
|
288
|
+
}), PropTypes.string]),
|
|
289
|
+
"pr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
290
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
291
|
+
"description": PropTypes.string,
|
|
292
|
+
"toString": PropTypes.func.isRequired,
|
|
293
|
+
"valueOf": PropTypes.func.isRequired
|
|
294
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
295
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
296
|
+
"description": PropTypes.string,
|
|
297
|
+
"toString": PropTypes.func.isRequired,
|
|
298
|
+
"valueOf": PropTypes.func.isRequired
|
|
299
|
+
}), PropTypes.string]),
|
|
300
|
+
"pt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
301
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
302
|
+
"description": PropTypes.string,
|
|
303
|
+
"toString": PropTypes.func.isRequired,
|
|
304
|
+
"valueOf": PropTypes.func.isRequired
|
|
305
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
306
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
307
|
+
"description": PropTypes.string,
|
|
308
|
+
"toString": PropTypes.func.isRequired,
|
|
309
|
+
"valueOf": PropTypes.func.isRequired
|
|
310
|
+
}), PropTypes.string]),
|
|
311
|
+
"px": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
312
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
313
|
+
"description": PropTypes.string,
|
|
314
|
+
"toString": PropTypes.func.isRequired,
|
|
315
|
+
"valueOf": PropTypes.func.isRequired
|
|
316
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
317
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
318
|
+
"description": PropTypes.string,
|
|
319
|
+
"toString": PropTypes.func.isRequired,
|
|
320
|
+
"valueOf": PropTypes.func.isRequired
|
|
321
|
+
}), PropTypes.string]),
|
|
322
|
+
"py": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
323
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
324
|
+
"description": PropTypes.string,
|
|
325
|
+
"toString": PropTypes.func.isRequired,
|
|
326
|
+
"valueOf": PropTypes.func.isRequired
|
|
327
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
328
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
329
|
+
"description": PropTypes.string,
|
|
330
|
+
"toString": PropTypes.func.isRequired,
|
|
331
|
+
"valueOf": PropTypes.func.isRequired
|
|
332
|
+
}), PropTypes.string])
|
|
25
333
|
};
|
|
26
334
|
export { Breadcrumbs };
|
|
27
335
|
Breadcrumbs.displayName = "Breadcrumbs";
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
|
+
import { space } from "styled-system";
|
|
3
|
+
import baseTheme from "../../style/themes/base";
|
|
2
4
|
const StyledBreadcrumbs = styled.nav`
|
|
5
|
+
${space}
|
|
6
|
+
|
|
3
7
|
ol {
|
|
8
|
+
padding: 0;
|
|
9
|
+
margin: 0;
|
|
4
10
|
list-style: none;
|
|
5
11
|
display: flex;
|
|
6
12
|
flex-wrap: wrap;
|
|
7
13
|
}
|
|
8
14
|
`;
|
|
15
|
+
StyledBreadcrumbs.defaultProps = {
|
|
16
|
+
theme: baseTheme
|
|
17
|
+
};
|
|
9
18
|
export default StyledBreadcrumbs;
|
|
@@ -4,8 +4,6 @@ import { TagProps } from "../../../__internal__/utils/helpers/tags";
|
|
|
4
4
|
export interface CrumbProps extends Omit<LinkProps, "tooltipMessage" | "tooltipPosition" | "iconType" | "iconAlign" | "isSkipLink" | "isDarkBackground" | "ariaLabel" | "className" | "variant" | "target" | "rel" | "icon" | "disabled">, TagProps {
|
|
5
5
|
/** This sets the Crumb to current, does not render Link */
|
|
6
6
|
isCurrent?: boolean;
|
|
7
|
-
/** The href string for Crumb Link */
|
|
8
|
-
href: string;
|
|
9
7
|
}
|
|
10
8
|
declare const Crumb: React.ForwardRefExoticComponent<CrumbProps & React.RefAttributes<HTMLLinkElement>>;
|
|
11
9
|
export default Crumb;
|
|
@@ -8,14 +8,16 @@ const Crumb = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
8
8
|
href,
|
|
9
9
|
isCurrent,
|
|
10
10
|
children,
|
|
11
|
+
onClick,
|
|
11
12
|
...rest
|
|
12
13
|
} = _ref;
|
|
13
14
|
return /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(StyledCrumb, _extends({
|
|
14
15
|
ref: ref,
|
|
15
16
|
isCurrent: isCurrent,
|
|
16
17
|
"aria-current": isCurrent ? "page" : undefined
|
|
17
|
-
}, tagComponent("crumb", rest), !isCurrent && {
|
|
18
|
-
href
|
|
18
|
+
}, tagComponent("crumb", rest), rest, !isCurrent && {
|
|
19
|
+
href,
|
|
20
|
+
onClick
|
|
19
21
|
}), children), !isCurrent && /*#__PURE__*/React.createElement(Divider, null));
|
|
20
22
|
});
|
|
21
23
|
Crumb.propTypes = {
|
|
@@ -71,7 +73,7 @@ Crumb.propTypes = {
|
|
|
71
73
|
"data-component": PropTypes.string,
|
|
72
74
|
"data-element": PropTypes.string,
|
|
73
75
|
"data-role": PropTypes.string,
|
|
74
|
-
"href": PropTypes.string
|
|
76
|
+
"href": PropTypes.string,
|
|
75
77
|
"isCurrent": PropTypes.bool,
|
|
76
78
|
"onClick": PropTypes.func,
|
|
77
79
|
"onKeyDown": PropTypes.func,
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MarginProps } from "styled-system";
|
|
3
|
+
import { TagProps } from "../../../__internal__/utils/helpers/tags";
|
|
4
|
+
export interface CustomEvent {
|
|
5
|
+
target: {
|
|
6
|
+
name?: string;
|
|
7
|
+
value?: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface ButtonToggleGroupProps extends MarginProps, TagProps {
|
|
11
|
+
/** Unique id for the root element of the component */
|
|
12
|
+
id: string;
|
|
13
|
+
/** Specifies the name prop to be applied to each button in the group */
|
|
14
|
+
name?: string;
|
|
15
|
+
/** Togglable buttons to be rendered. Only accepts children of type ButtonToggle */
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
/** aria-label for the group wrapper. Required for accessibility when no text label is provided */
|
|
18
|
+
"aria-label"?: string;
|
|
19
|
+
/** Text for the visible label of the button group. */
|
|
20
|
+
label?: string;
|
|
21
|
+
/** Text for the label's help tooltip. */
|
|
22
|
+
labelHelp?: React.ReactNode;
|
|
23
|
+
/** Spacing between label and a field for inline label, given number will be multiplied by base spacing unit (8) */
|
|
24
|
+
labelSpacing?: 1 | 2;
|
|
25
|
+
/** The percentage width of the ButtonToggleGroup. */
|
|
26
|
+
inputWidth?: number | string;
|
|
27
|
+
/** The text for the field help. */
|
|
28
|
+
fieldHelp?: string;
|
|
29
|
+
/** Sets the field help to inline. */
|
|
30
|
+
fieldHelpInline?: boolean;
|
|
31
|
+
/** Sets the label to be inline. */
|
|
32
|
+
labelInline?: boolean;
|
|
33
|
+
/** The percentage width of the label. */
|
|
34
|
+
labelWidth?: number;
|
|
35
|
+
/** If true all ButtonToggle children will flex to the full width of the ButtonToggleGroup parent */
|
|
36
|
+
fullWidth?: boolean;
|
|
37
|
+
/** The alignment for the text in the label. */
|
|
38
|
+
labelAlign?: "left" | "right";
|
|
39
|
+
/** Callback triggered by pressing one of the child buttons. Use with controlled components to set the value prop to the value argument */
|
|
40
|
+
onChange?: (ev: React.MouseEvent<HTMLButtonElement>, value?: string, name?: string) => void;
|
|
41
|
+
/** Determines which child button is selected when the component is used as a controlled component */
|
|
42
|
+
value?: string;
|
|
43
|
+
/** Aria label for rendered help component */
|
|
44
|
+
helpAriaLabel?: string;
|
|
45
|
+
/** set this to true to allow the buttons within the group to be deselected when already selected, leaving no selected button */
|
|
46
|
+
allowDeselect?: boolean;
|
|
47
|
+
}
|
|
48
|
+
declare type ButtonToggleGroupContextType = {
|
|
49
|
+
onButtonClick: (value: string) => void;
|
|
50
|
+
handleKeyDown: (ev: React.KeyboardEvent<HTMLButtonElement>) => void;
|
|
51
|
+
pressedButtonValue?: string;
|
|
52
|
+
onChange?: (ev: React.MouseEvent<HTMLButtonElement>, value?: string, name?: string) => void;
|
|
53
|
+
name?: string;
|
|
54
|
+
allowDeselect?: boolean;
|
|
55
|
+
isInGroup: boolean;
|
|
56
|
+
firstButton?: HTMLButtonElement;
|
|
57
|
+
childButtonCallbackRef?: (button: HTMLButtonElement | null) => void;
|
|
58
|
+
};
|
|
59
|
+
export declare const ButtonToggleGroupContext: React.Context<ButtonToggleGroupContextType>;
|
|
60
|
+
declare const ButtonToggleGroup: {
|
|
61
|
+
({ children, fieldHelp, fieldHelpInline, "aria-label": ariaLabel, label, labelHelp, labelSpacing, inputWidth, fullWidth, labelInline, labelWidth, labelAlign, name, onChange, value, "data-component": dataComponent, "data-element": dataElement, "data-role": dataRole, helpAriaLabel, id, allowDeselect, ...props }: ButtonToggleGroupProps): React.JSX.Element;
|
|
62
|
+
displayName: string;
|
|
63
|
+
};
|
|
64
|
+
export default ButtonToggleGroup;
|