carbon-react 110.1.0 → 110.1.3
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 +5 -1
- package/esm/__internal__/form-field/form-field.component.js +8 -5
- package/esm/__internal__/utils/helpers/tags/tags.d.ts +5 -2
- package/esm/__spec_helper__/mock-match-media.d.ts +3 -1
- package/esm/components/button-toggle/button-toggle-icon.component.d.ts +15 -0
- package/esm/components/button-toggle/button-toggle-icon.component.js +19 -16
- package/esm/components/button-toggle/button-toggle-input.component.d.ts +25 -0
- package/esm/components/button-toggle/button-toggle-input.component.js +13 -25
- package/esm/components/button-toggle/button-toggle.component.d.ts +24 -0
- package/esm/components/button-toggle/button-toggle.component.js +23 -59
- package/esm/components/button-toggle/button-toggle.style.d.ts +26 -0
- package/esm/components/button-toggle/button-toggle.style.js +3 -8
- package/esm/components/button-toggle/index.d.ts +2 -2
- package/esm/components/content/content.style.js +0 -1
- package/esm/components/date/__internal__/utils.js +1 -1
- package/esm/components/definition-list/definition-list.style.js +0 -9
- package/esm/components/loader/index.d.ts +2 -1
- package/esm/components/loader/loader-square.style.d.ts +9 -1
- package/esm/components/loader/loader-square.style.js +4 -11
- package/esm/components/loader/loader.component.d.ts +9 -0
- package/esm/components/loader/loader.component.js +162 -24
- package/esm/components/loader/loader.config.d.ts +1 -1
- package/esm/components/loader/loader.style.d.ts +2 -0
- package/esm/components/loader-bar/index.d.ts +2 -1
- package/esm/components/loader-bar/loader-bar.component.d.ts +7 -0
- package/esm/components/loader-bar/loader-bar.component.js +156 -7
- package/esm/components/loader-bar/loader-bar.config.d.ts +1 -0
- package/esm/components/loader-bar/loader-bar.style.d.ts +10 -0
- package/esm/components/loader-bar/loader-bar.style.js +14 -25
- package/esm/components/pod/pod.component.js +1 -0
- package/esm/components/pod/pod.style.js +8 -4
- package/esm/components/portrait/index.d.ts +2 -1
- package/esm/components/portrait/portrait-gravatar.component.d.ts +16 -0
- package/esm/components/portrait/portrait-gravatar.component.js +9 -24
- package/esm/components/portrait/portrait-initials.component.d.ts +16 -0
- package/esm/components/portrait/portrait-initials.component.js +22 -33
- package/esm/components/portrait/portrait.component.d.ts +50 -0
- package/esm/components/portrait/portrait.component.js +178 -72
- package/esm/components/portrait/portrait.config.d.ts +32 -0
- package/esm/components/portrait/portrait.style.d.ts +28 -0
- package/esm/components/portrait/portrait.style.js +7 -55
- package/esm/components/profile/profile.style.d.ts +2 -2
- package/esm/components/show-edit-pod/show-edit-pod.style.js +1 -8
- package/esm/style/fonts.css +19 -12
- package/lib/__internal__/form-field/form-field.component.d.ts +5 -1
- package/lib/__internal__/form-field/form-field.component.js +8 -5
- package/lib/__internal__/utils/helpers/tags/tags.d.ts +5 -2
- package/lib/__spec_helper__/mock-match-media.d.ts +3 -1
- package/lib/components/button-toggle/button-toggle-icon.component.d.ts +15 -0
- package/lib/components/button-toggle/button-toggle-icon.component.js +19 -16
- package/lib/components/button-toggle/button-toggle-input.component.d.ts +25 -0
- package/lib/components/button-toggle/button-toggle-input.component.js +13 -25
- package/lib/components/button-toggle/button-toggle.component.d.ts +24 -0
- package/lib/components/button-toggle/button-toggle.component.js +24 -60
- package/lib/components/button-toggle/button-toggle.style.d.ts +26 -0
- package/lib/components/button-toggle/button-toggle.style.js +6 -12
- package/lib/components/button-toggle/index.d.ts +2 -2
- package/lib/components/content/content.style.js +0 -1
- package/lib/components/date/__internal__/utils.js +1 -1
- package/lib/components/definition-list/definition-list.style.js +0 -10
- package/lib/components/loader/index.d.ts +2 -1
- package/lib/components/loader/loader-square.style.d.ts +9 -1
- package/lib/components/loader/loader-square.style.js +4 -15
- package/lib/components/loader/loader.component.d.ts +9 -0
- package/lib/components/loader/loader.component.js +163 -28
- package/lib/components/loader/loader.config.d.ts +1 -1
- package/lib/components/loader/loader.style.d.ts +2 -0
- package/lib/components/loader-bar/index.d.ts +2 -1
- package/lib/components/loader-bar/loader-bar.component.d.ts +7 -0
- package/lib/components/loader-bar/loader-bar.component.js +156 -10
- package/lib/components/loader-bar/loader-bar.config.d.ts +1 -0
- package/lib/components/loader-bar/loader-bar.style.d.ts +10 -0
- package/lib/components/loader-bar/loader-bar.style.js +13 -27
- package/lib/components/pod/pod.component.js +1 -0
- package/lib/components/pod/pod.style.js +8 -4
- package/lib/components/portrait/index.d.ts +2 -1
- package/lib/components/portrait/portrait-gravatar.component.d.ts +16 -0
- package/lib/components/portrait/portrait-gravatar.component.js +9 -24
- package/lib/components/portrait/portrait-initials.component.d.ts +16 -0
- package/lib/components/portrait/portrait-initials.component.js +22 -33
- package/lib/components/portrait/portrait.component.d.ts +50 -0
- package/lib/components/portrait/portrait.component.js +179 -75
- package/lib/components/portrait/portrait.config.d.ts +32 -0
- package/lib/components/portrait/portrait.style.d.ts +28 -0
- package/lib/components/portrait/portrait.style.js +9 -59
- package/lib/components/profile/profile.style.d.ts +2 -2
- package/lib/components/show-edit-pod/show-edit-pod.style.js +1 -12
- package/lib/style/fonts.css +19 -12
- package/package.json +4 -3
- package/esm/components/button-toggle/button-toggle-types.d.ts +0 -1
- package/esm/components/button-toggle/button-toggle.d.ts +0 -45
- package/esm/components/loader/loader.d.ts +0 -16
- package/esm/components/loader-bar/loader-bar.d.ts +0 -10
- package/esm/components/portrait/portrait-gravatar.d.ts +0 -18
- package/esm/components/portrait/portrait-initials.d.ts +0 -18
- package/esm/components/portrait/portrait.d.ts +0 -54
- package/lib/components/button-toggle/button-toggle-types.d.ts +0 -1
- package/lib/components/button-toggle/button-toggle.d.ts +0 -45
- package/lib/components/loader/loader.d.ts +0 -16
- package/lib/components/loader-bar/loader-bar.d.ts +0 -10
- package/lib/components/portrait/portrait-gravatar.d.ts +0 -18
- package/lib/components/portrait/portrait-initials.d.ts +0 -18
- package/lib/components/portrait/portrait.d.ts +0 -54
package/esm/style/fonts.css
CHANGED
|
@@ -9,28 +9,35 @@
|
|
|
9
9
|
font-family: "Sage UI";
|
|
10
10
|
font-style: normal;
|
|
11
11
|
font-weight: 400;
|
|
12
|
-
src: url("~@sage/design-tokens/assets/fonts/sageui-regular.woff2")
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
src: url("~@sage/design-tokens/assets/fonts/sageui-regular.woff2")
|
|
13
|
+
format("woff2"),
|
|
14
|
+
url("~@sage/design-tokens/assets/fonts/sageui-regular.woff") format("woff"),
|
|
15
|
+
url("~@sage/design-tokens/assets/fonts/sageui-regular.ttf")
|
|
16
|
+
format("truetype"),
|
|
17
|
+
url("~@sage/design-tokens/assets/fonts/sageui-regular.otf")
|
|
18
|
+
format("opentype");
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
@font-face {
|
|
19
22
|
font-family: "Sage UI";
|
|
20
23
|
font-style: normal;
|
|
21
24
|
font-weight: 700;
|
|
22
|
-
src: url("~@sage/design-tokens/assets/fonts/sageui-medium.woff2")
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
src: url("~@sage/design-tokens/assets/fonts/sageui-medium.woff2")
|
|
26
|
+
format("woff2"),
|
|
27
|
+
url("~@sage/design-tokens/assets/fonts/sageui-medium.woff") format("woff"),
|
|
28
|
+
url("~@sage/design-tokens/assets/fonts/sageui-medium.ttf")
|
|
29
|
+
format("truetype"),
|
|
30
|
+
url("~@sage/design-tokens/assets/fonts/sageui-medium.otf")
|
|
31
|
+
format("opentype");
|
|
26
32
|
}
|
|
27
33
|
|
|
28
34
|
@font-face {
|
|
29
35
|
font-family: "Sage UI";
|
|
30
36
|
font-style: normal;
|
|
31
37
|
font-weight: 900;
|
|
32
|
-
src: url("~@sage/design-tokens/assets/fonts/sageui-bold.woff2")
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
src: url("~@sage/design-tokens/assets/fonts/sageui-bold.woff2")
|
|
39
|
+
format("woff2"),
|
|
40
|
+
url("~@sage/design-tokens/assets/fonts/sageui-bold.woff") format("woff"),
|
|
41
|
+
url("~@sage/design-tokens/assets/fonts/sageui-bold.ttf") format("truetype"),
|
|
42
|
+
url("~@sage/design-tokens/assets/fonts/sageui-bold.otf") format("opentype");
|
|
36
43
|
}
|
|
@@ -32,6 +32,10 @@ interface CommonFormFieldProps extends MarginProps, ValidationProps {
|
|
|
32
32
|
reverse?: boolean;
|
|
33
33
|
/** Id of the validation icon */
|
|
34
34
|
validationIconId?: string;
|
|
35
|
+
/**
|
|
36
|
+
* @private @ignore
|
|
37
|
+
* Flag dedicating if latest validation design should be used */
|
|
38
|
+
validationRedesignOptIn?: boolean;
|
|
35
39
|
}
|
|
36
40
|
export interface FormFieldProps extends CommonFormFieldProps, TagProps {
|
|
37
41
|
/** Breakpoint for adaptive label (inline labels change to top aligned). Enables the adaptive behaviour when set */
|
|
@@ -53,7 +57,7 @@ export interface FormFieldProps extends CommonFormFieldProps, TagProps {
|
|
|
53
57
|
useValidationIcon?: boolean;
|
|
54
58
|
}
|
|
55
59
|
declare const FormField: {
|
|
56
|
-
({ children, disabled, fieldHelp: fieldHelpContent, fieldHelpInline, error, warning, info, tooltipId, fieldHelpId, label, labelId, labelAlign, labelHelp, labelHelpIcon, labelInline, labelSpacing, labelWidth, id, reverse, isOptional, useValidationIcon, adaptiveLabelBreakpoint, isRequired, validationIconId, ...rest }: FormFieldProps): JSX.Element;
|
|
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): JSX.Element;
|
|
57
61
|
displayName: string;
|
|
58
62
|
};
|
|
59
63
|
export default FormField;
|
|
@@ -35,6 +35,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
35
35
|
|
|
36
36
|
const FormField = ({
|
|
37
37
|
children,
|
|
38
|
+
"data-component": dataComponent,
|
|
38
39
|
disabled,
|
|
39
40
|
fieldHelp: fieldHelpContent,
|
|
40
41
|
fieldHelpInline,
|
|
@@ -58,6 +59,7 @@ const FormField = ({
|
|
|
58
59
|
adaptiveLabelBreakpoint,
|
|
59
60
|
isRequired,
|
|
60
61
|
validationIconId,
|
|
62
|
+
validationRedesignOptIn,
|
|
61
63
|
...rest
|
|
62
64
|
}) => {
|
|
63
65
|
const invalidValidationProp = (0, _react.useMemo)(() => {
|
|
@@ -93,15 +95,15 @@ const FormField = ({
|
|
|
93
95
|
labelWidth: labelWidth,
|
|
94
96
|
id: fieldHelpId
|
|
95
97
|
}, fieldHelpContent) : null;
|
|
96
|
-
return /*#__PURE__*/_react.default.createElement(_formField.default, _extends({}, (0, _tags.default)(
|
|
98
|
+
return /*#__PURE__*/_react.default.createElement(_formField.default, _extends({}, (0, _tags.default)(dataComponent, rest), marginProps), /*#__PURE__*/_react.default.createElement(_formField.FieldLineStyle, {
|
|
97
99
|
inline: inlineLabel
|
|
98
100
|
}, reverse && children, label && /*#__PURE__*/_react.default.createElement(_label.default, {
|
|
99
101
|
labelId: labelId,
|
|
100
102
|
align: labelAlign,
|
|
101
103
|
disabled: disabled,
|
|
102
|
-
error: !
|
|
103
|
-
warning: !
|
|
104
|
-
info: !
|
|
104
|
+
error: !validationRedesignOptIn && error,
|
|
105
|
+
warning: !validationRedesignOptIn && warning,
|
|
106
|
+
info: !validationRedesignOptIn && info,
|
|
105
107
|
help: labelHelp,
|
|
106
108
|
tooltipId: tooltipId,
|
|
107
109
|
htmlFor: id,
|
|
@@ -120,7 +122,7 @@ const FormField = ({
|
|
|
120
122
|
FormField.propTypes = {
|
|
121
123
|
"adaptiveLabelBreakpoint": _propTypes.default.number,
|
|
122
124
|
"children": _propTypes.default.node,
|
|
123
|
-
"data-component": _propTypes.default.string
|
|
125
|
+
"data-component": _propTypes.default.string,
|
|
124
126
|
"data-element": _propTypes.default.string,
|
|
125
127
|
"data-role": _propTypes.default.string,
|
|
126
128
|
"disabled": _propTypes.default.bool,
|
|
@@ -298,6 +300,7 @@ FormField.propTypes = {
|
|
|
298
300
|
"tooltipId": _propTypes.default.string,
|
|
299
301
|
"useValidationIcon": _propTypes.default.bool,
|
|
300
302
|
"validationIconId": _propTypes.default.string,
|
|
303
|
+
"validationRedesignOptIn": _propTypes.default.bool,
|
|
301
304
|
"warning": _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool])
|
|
302
305
|
};
|
|
303
306
|
FormField.displayName = "FormField";
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
interface DataProps {
|
|
2
|
+
/** Identifier used for testing purposes, applied to the root element of the component. */
|
|
2
3
|
"data-element"?: string;
|
|
4
|
+
/** Identifier used for testing purposes, applied to the root element of the component. */
|
|
3
5
|
"data-role"?: string;
|
|
4
6
|
[restKeys: string]: any;
|
|
5
7
|
}
|
|
6
8
|
export interface TagProps extends DataProps {
|
|
7
|
-
|
|
9
|
+
/** Identifier used for testing purposes, applied to the root element of the component. */
|
|
10
|
+
"data-component"?: string;
|
|
8
11
|
}
|
|
9
12
|
/**
|
|
10
13
|
* Builds props object containing top level data tags
|
|
11
14
|
*/
|
|
12
|
-
declare function tagComponent(componentName: string, props: DataProps): TagProps;
|
|
15
|
+
declare function tagComponent(componentName: string | undefined, props: DataProps): TagProps;
|
|
13
16
|
export default tagComponent;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { StyledButtonToggleIconProps } from "./button-toggle.style";
|
|
3
|
+
import { IconType } from "../icon";
|
|
4
|
+
export interface ButtonToggleIconProps extends StyledButtonToggleIconProps {
|
|
5
|
+
/**
|
|
6
|
+
* <a href="https://brand.sage.com/d/NdbrveWvNheA/foundations#/icons/icons" target="_blank">List of supported icons</a>
|
|
7
|
+
*
|
|
8
|
+
* buttonIcon to render.
|
|
9
|
+
*/
|
|
10
|
+
buttonIcon: IconType;
|
|
11
|
+
/** Sets the icon in the disabled state */
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
declare const ButtonToggleIcon: ({ buttonIcon, buttonIconSize, disabled, hasContent, }: ButtonToggleIconProps) => JSX.Element;
|
|
15
|
+
export default ButtonToggleIcon;
|
|
@@ -15,24 +15,27 @@ var _icon = _interopRequireDefault(require("../icon"));
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
const ButtonToggleIcon = ({
|
|
19
|
+
buttonIcon,
|
|
20
|
+
buttonIconSize,
|
|
21
|
+
disabled,
|
|
22
|
+
hasContent
|
|
23
|
+
}) => /*#__PURE__*/_react.default.createElement(_buttonToggle.StyledButtonToggleIcon, {
|
|
24
|
+
buttonIconSize: buttonIconSize,
|
|
25
|
+
hasContent: hasContent
|
|
26
|
+
}, /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
27
|
+
"aria-hidden": true,
|
|
28
|
+
type: buttonIcon,
|
|
29
|
+
fontSize: buttonIconSize,
|
|
30
|
+
bgSize: "extra-small",
|
|
31
|
+
disabled: disabled
|
|
32
|
+
}));
|
|
25
33
|
|
|
26
34
|
ButtonToggleIcon.propTypes = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
*/
|
|
32
|
-
buttonIcon: _propTypes.default.string,
|
|
33
|
-
|
|
34
|
-
/** Sets the size of the buttonIcon (eg. large) */
|
|
35
|
-
buttonIconSize: _propTypes.default.oneOf(["small", "large"])
|
|
35
|
+
"buttonIcon": _propTypes.default.oneOf(["add", "admin", "alert", "analysis", "arrow_down", "arrow_left_boxed", "arrow_left_right_small", "arrow_left_small", "arrow_left", "arrow_right_small", "arrow_right", "arrow_up", "arrow", "attach", "bank", "basket_with_squares", "basket", "bin", "block_arrow_right", "blocked_square", "blocked", "bold", "boxed_shapes", "bulk_destroy", "bullet_list_dotted", "bullet_list_numbers", "bullet_list", "business", "calendar_today", "calendar", "call", "camera", "card_view", "caret_down", "caret_large_down", "caret_large_left", "caret_large_right", "caret_large_up", "caret_left", "caret_right", "caret_up", "cart", "chart_bar", "chart_line", "chart_pie", "chat_notes", "chat", "chevron_down_thick", "chevron_down", "chevron_left_thick", "chevron_left", "chevron_right_thick", "chevron_right", "chevron_up_thick", "chevron_up", "circle_with_dots", "circles_connection", "clock", "close", "coins", "collaborate", "computer_clock", "connect", "contacts", "copy", "create", "credit_card_slash", "credit_card", "cross_circle", "cross", "csv", "delete", "delivery", "disconnect", "disputed", "document_right_align", "document_tick", "document_vertical_lines", "download", "draft", "drag_vertical", "drag", "dropdown", "duplicate", "edit", "edited", "ellipsis_horizontal", "ellipsis_vertical", "email_switch", "email", "entry", "envelope_dollar", "envelope_euro", "error_square", "error", "euro", "expand", "factory", "favourite_lined", "favourite", "fax", "feedback", "file_excel", "file_generic", "file_image", "file_pdf", "file_word", "files_leaning", "filter_new", "filter", "fit_height", "fit_width", "flag", "folder", "gift", "go", "graph", "grid", "help", "hide", "home", "image", "in_progress", "in_transit", "individual", "info", "italic", "key", "ledger_arrow_left", "ledger_arrow_right", "ledger", "lightbulb_off", "lightbulb_on", "link", "list_view", "location", "locked", "logout", "lookup", "marker", "message", "minus_large", "minus", "mobile", "money_bag", "none", "old_warning", "pause_circle", "pause", "pdf", "people_switch", "people", "person_info", "person_tick", "person", "phone", "piggy_bank", "play_circle", "play", "plus_large", "plus", "pound", "print", "progress", "progressed", "question_hollow", "question_mark", "question", "refresh_clock", "refresh", "remove", "sage_coin", "save", "scan", "search", "services", "settings_old", "settings", "share", "shop", "sort_down", "sort_up", "spanner", "split_container", "split", "square_dot", "squares_nine", "stacked_boxes", "stacked_squares", "submitted", "sync", "tag", "talk", "three_boxes", "tick_circle", "tick", "true_tick", "undo", "unlocked", "upload", "uploaded", "video", "view", "warning"]).isRequired,
|
|
36
|
+
"buttonIconSize": _propTypes.default.oneOf(["large", "small"]),
|
|
37
|
+
"disabled": _propTypes.default.bool,
|
|
38
|
+
"hasContent": _propTypes.default.bool
|
|
36
39
|
};
|
|
37
40
|
var _default = ButtonToggleIcon;
|
|
38
41
|
exports.default = _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface ButtonToggleInputProps {
|
|
3
|
+
/** Prop to specify the aria-label of the component */
|
|
4
|
+
"aria-label"?: string;
|
|
5
|
+
/** Prop to specify the aria-labelledby property of the component */
|
|
6
|
+
"aria-labelledby"?: string;
|
|
7
|
+
/** Set the checked value of the radio button */
|
|
8
|
+
checked?: boolean;
|
|
9
|
+
/** Disable all user interaction. */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
/** Unique ID attribute for input */
|
|
12
|
+
guid?: string;
|
|
13
|
+
/** Name used on the hidden radio button. */
|
|
14
|
+
name?: string;
|
|
15
|
+
/** Callback triggered by blur event on the input. */
|
|
16
|
+
onBlur?: (ev: React.FocusEvent<HTMLInputElement>) => void;
|
|
17
|
+
/** Callback triggered by change event on the input. */
|
|
18
|
+
onChange?: (ev: React.ChangeEvent<HTMLInputElement>) => void;
|
|
19
|
+
/** Callback triggered by focus event on the input. */
|
|
20
|
+
onFocus?: (ev: React.FocusEvent<HTMLInputElement>) => void;
|
|
21
|
+
/** Value for the input */
|
|
22
|
+
value?: string;
|
|
23
|
+
}
|
|
24
|
+
declare const ButtonToggleInput: React.ForwardRefExoticComponent<ButtonToggleInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
25
|
+
export default ButtonToggleInput;
|
|
@@ -32,7 +32,7 @@ const ButtonToggleInput = /*#__PURE__*/_react.default.forwardRef((props, forward
|
|
|
32
32
|
props.onBlur(ev);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
if (onBlur) onBlur(
|
|
35
|
+
if (onBlur) onBlur();
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
const handleFocus = ev => {
|
|
@@ -40,7 +40,7 @@ const ButtonToggleInput = /*#__PURE__*/_react.default.forwardRef((props, forward
|
|
|
40
40
|
props.onFocus(ev);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
if (onFocus) onFocus(
|
|
43
|
+
if (onFocus) onFocus();
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
return /*#__PURE__*/_react.default.createElement(_buttonToggle.StyledButtonToggleInput, _extends({}, props, {
|
|
@@ -53,29 +53,17 @@ const ButtonToggleInput = /*#__PURE__*/_react.default.forwardRef((props, forward
|
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
ButtonToggleInput.propTypes = {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
guid: _propTypes.default.string,
|
|
67
|
-
|
|
68
|
-
/** Value for the input */
|
|
69
|
-
value: _propTypes.default.string,
|
|
70
|
-
|
|
71
|
-
/** Callback triggered by change event on the input. */
|
|
72
|
-
onChange: _propTypes.default.func,
|
|
73
|
-
|
|
74
|
-
/** Callback triggered by blur event on the input. */
|
|
75
|
-
onBlur: _propTypes.default.func,
|
|
76
|
-
|
|
77
|
-
/** Callback triggered by focus event on the input. */
|
|
78
|
-
onFocus: _propTypes.default.func
|
|
56
|
+
"aria-label": _propTypes.default.string,
|
|
57
|
+
"aria-labelledby": _propTypes.default.string,
|
|
58
|
+
"checked": _propTypes.default.bool,
|
|
59
|
+
"disabled": _propTypes.default.bool,
|
|
60
|
+
"guid": _propTypes.default.string,
|
|
61
|
+
"name": _propTypes.default.string,
|
|
62
|
+
"onBlur": _propTypes.default.func,
|
|
63
|
+
"onChange": _propTypes.default.func,
|
|
64
|
+
"onFocus": _propTypes.default.func,
|
|
65
|
+
"value": _propTypes.default.string
|
|
79
66
|
};
|
|
67
|
+
ButtonToggleInput.displayName = "ButtonToggleInput";
|
|
80
68
|
var _default = ButtonToggleInput;
|
|
81
69
|
exports.default = _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StyledButtonToggleLabelProps } from "./button-toggle.style";
|
|
3
|
+
import { ButtonToggleInputProps } from "./button-toggle-input.component";
|
|
4
|
+
export interface ButtonToggleProps extends ButtonToggleInputProps, Partial<StyledButtonToggleLabelProps> {
|
|
5
|
+
/** A required prop. This is the button text. */
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
/** Identifier used for testing purposes, applied to the root element of the component. */
|
|
8
|
+
"data-component"?: string;
|
|
9
|
+
/** Identifier used for testing purposes, applied to the root element of the component. */
|
|
10
|
+
"data-element"?: string;
|
|
11
|
+
/** Identifier used for testing purposes, applied to the root element of the component. */
|
|
12
|
+
"data-role"?: string;
|
|
13
|
+
/** Set the default value of the Group if component is meant to be used as uncontrolled. */
|
|
14
|
+
defaultChecked?: boolean;
|
|
15
|
+
/** Remove spacing from between buttons. */
|
|
16
|
+
grouped?: boolean;
|
|
17
|
+
/** Callback triggered by click event on the input. */
|
|
18
|
+
onClick?: (ev: React.MouseEvent<HTMLInputElement>) => void;
|
|
19
|
+
}
|
|
20
|
+
export declare const ButtonToggle: {
|
|
21
|
+
(props: ButtonToggleProps): JSX.Element;
|
|
22
|
+
displayName: string;
|
|
23
|
+
};
|
|
24
|
+
export default ButtonToggle;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.default = exports.ButtonToggle = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
@@ -30,7 +30,7 @@ const ButtonToggle = props => {
|
|
|
30
30
|
"aria-label": ariaLabel,
|
|
31
31
|
"aria-labelledby": ariaLabelledBy,
|
|
32
32
|
buttonIcon,
|
|
33
|
-
buttonIconSize,
|
|
33
|
+
buttonIconSize = "small",
|
|
34
34
|
checked,
|
|
35
35
|
children,
|
|
36
36
|
"data-component": dataComponent,
|
|
@@ -42,7 +42,7 @@ const ButtonToggle = props => {
|
|
|
42
42
|
onBlur,
|
|
43
43
|
onChange,
|
|
44
44
|
onFocus,
|
|
45
|
-
size,
|
|
45
|
+
size = "medium",
|
|
46
46
|
value
|
|
47
47
|
} = props;
|
|
48
48
|
const {
|
|
@@ -55,16 +55,17 @@ const ButtonToggle = props => {
|
|
|
55
55
|
|
|
56
56
|
if (buttonIcon) {
|
|
57
57
|
icon = /*#__PURE__*/_react.default.createElement(_buttonToggleIcon.default, {
|
|
58
|
-
"aria-hidden": true,
|
|
59
58
|
buttonIcon: buttonIcon,
|
|
60
59
|
buttonIconSize: buttonIconSize,
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
disabled: disabled,
|
|
61
|
+
hasContent: !!children
|
|
63
62
|
});
|
|
64
63
|
}
|
|
65
64
|
|
|
66
65
|
function handleClick() {
|
|
67
|
-
|
|
66
|
+
var _inputRef$current;
|
|
67
|
+
|
|
68
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
return /*#__PURE__*/_react.default.createElement(_buttonToggle.StyledButtonToggle, {
|
|
@@ -97,65 +98,28 @@ const ButtonToggle = props => {
|
|
|
97
98
|
}, /*#__PURE__*/_react.default.createElement(_buttonToggle.StyledButtonToggleContentWrapper, null, icon, children)));
|
|
98
99
|
};
|
|
99
100
|
|
|
101
|
+
exports.ButtonToggle = ButtonToggle;
|
|
100
102
|
ButtonToggle.propTypes = {
|
|
101
|
-
/** Prop to specify the aria-label of the component */
|
|
102
103
|
"aria-label": _propTypes.default.string,
|
|
103
|
-
|
|
104
|
-
/** Prop to specify the aria-labelledby property of the component */
|
|
105
104
|
"aria-labelledby": _propTypes.default.string,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
checked: _propTypes.default.bool,
|
|
109
|
-
|
|
110
|
-
/** Identifier used for testing purposes, applied to the root element of the component. */
|
|
105
|
+
"buttonIcon": _propTypes.default.oneOf(["add", "admin", "alert", "analysis", "arrow_down", "arrow_left_boxed", "arrow_left_right_small", "arrow_left_small", "arrow_left", "arrow_right_small", "arrow_right", "arrow_up", "arrow", "attach", "bank", "basket_with_squares", "basket", "bin", "block_arrow_right", "blocked_square", "blocked", "bold", "boxed_shapes", "bulk_destroy", "bullet_list_dotted", "bullet_list_numbers", "bullet_list", "business", "calendar_today", "calendar", "call", "camera", "card_view", "caret_down", "caret_large_down", "caret_large_left", "caret_large_right", "caret_large_up", "caret_left", "caret_right", "caret_up", "cart", "chart_bar", "chart_line", "chart_pie", "chat_notes", "chat", "chevron_down_thick", "chevron_down", "chevron_left_thick", "chevron_left", "chevron_right_thick", "chevron_right", "chevron_up_thick", "chevron_up", "circle_with_dots", "circles_connection", "clock", "close", "coins", "collaborate", "computer_clock", "connect", "contacts", "copy", "create", "credit_card_slash", "credit_card", "cross_circle", "cross", "csv", "delete", "delivery", "disconnect", "disputed", "document_right_align", "document_tick", "document_vertical_lines", "download", "draft", "drag_vertical", "drag", "dropdown", "duplicate", "edit", "edited", "ellipsis_horizontal", "ellipsis_vertical", "email_switch", "email", "entry", "envelope_dollar", "envelope_euro", "error_square", "error", "euro", "expand", "factory", "favourite_lined", "favourite", "fax", "feedback", "file_excel", "file_generic", "file_image", "file_pdf", "file_word", "files_leaning", "filter_new", "filter", "fit_height", "fit_width", "flag", "folder", "gift", "go", "graph", "grid", "help", "hide", "home", "image", "in_progress", "in_transit", "individual", "info", "italic", "key", "ledger_arrow_left", "ledger_arrow_right", "ledger", "lightbulb_off", "lightbulb_on", "link", "list_view", "location", "locked", "logout", "lookup", "marker", "message", "minus_large", "minus", "mobile", "money_bag", "none", "old_warning", "pause_circle", "pause", "pdf", "people_switch", "people", "person_info", "person_tick", "person", "phone", "piggy_bank", "play_circle", "play", "plus_large", "plus", "pound", "print", "progress", "progressed", "question_hollow", "question_mark", "question", "refresh_clock", "refresh", "remove", "sage_coin", "save", "scan", "search", "services", "settings_old", "settings", "share", "shop", "sort_down", "sort_up", "spanner", "split_container", "split", "square_dot", "squares_nine", "stacked_boxes", "stacked_squares", "submitted", "sync", "tag", "talk", "three_boxes", "tick_circle", "tick", "true_tick", "undo", "unlocked", "upload", "uploaded", "video", "view", "warning"]),
|
|
106
|
+
"buttonIconSize": _propTypes.default.oneOf(["large", "small"]),
|
|
107
|
+
"checked": _propTypes.default.bool,
|
|
108
|
+
"children": _propTypes.default.node,
|
|
111
109
|
"data-component": _propTypes.default.string,
|
|
112
|
-
|
|
113
|
-
/** Identifier used for testing purposes, applied to the root element of the component. */
|
|
114
110
|
"data-element": _propTypes.default.string,
|
|
115
|
-
|
|
116
|
-
/** Identifier used for testing purposes, applied to the root element of the component. */
|
|
117
111
|
"data-role": _propTypes.default.string,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
onFocus: _propTypes.default.func,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
onBlur: _propTypes.default.func,
|
|
130
|
-
|
|
131
|
-
/** ButtonToggle size */
|
|
132
|
-
size: _propTypes.default.oneOf(["small", "medium", "large"]),
|
|
133
|
-
|
|
134
|
-
/** buttonIcon to render. */
|
|
135
|
-
buttonIcon: _propTypes.default.string,
|
|
136
|
-
|
|
137
|
-
/** Sets the size of the buttonIcon (eg. large) */
|
|
138
|
-
buttonIconSize: _propTypes.default.oneOf(["small", "large"]),
|
|
139
|
-
|
|
140
|
-
/** Remove spacing from between buttons. */
|
|
141
|
-
grouped: _propTypes.default.bool,
|
|
142
|
-
|
|
143
|
-
/** Disable all user interaction. */
|
|
144
|
-
disabled: _propTypes.default.bool,
|
|
145
|
-
|
|
146
|
-
/** A required prop. This is the button text. */
|
|
147
|
-
children: _propTypes.default.node.isRequired,
|
|
148
|
-
|
|
149
|
-
/** Set the default value of the Group if component is meant to be used as uncontrolled. */
|
|
150
|
-
defaultChecked: _propTypes.default.bool,
|
|
151
|
-
// eslint-disable-line react/no-unused-prop-types
|
|
152
|
-
|
|
153
|
-
/** Value for the input */
|
|
154
|
-
value: _propTypes.default.string
|
|
155
|
-
};
|
|
156
|
-
ButtonToggle.defaultProps = {
|
|
157
|
-
size: "medium",
|
|
158
|
-
buttonIconSize: "small"
|
|
112
|
+
"defaultChecked": _propTypes.default.bool,
|
|
113
|
+
"disabled": _propTypes.default.bool,
|
|
114
|
+
"grouped": _propTypes.default.bool,
|
|
115
|
+
"guid": _propTypes.default.string,
|
|
116
|
+
"name": _propTypes.default.string,
|
|
117
|
+
"onBlur": _propTypes.default.func,
|
|
118
|
+
"onChange": _propTypes.default.func,
|
|
119
|
+
"onClick": _propTypes.default.func,
|
|
120
|
+
"onFocus": _propTypes.default.func,
|
|
121
|
+
"size": _propTypes.default.oneOf(["large", "medium", "small"]),
|
|
122
|
+
"value": _propTypes.default.string
|
|
159
123
|
};
|
|
160
124
|
ButtonToggle.displayName = "ButtonToggle";
|
|
161
125
|
var _default = ButtonToggle;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IconType } from "../icon";
|
|
2
|
+
export declare type ButtonToggleIconSizes = "small" | "large";
|
|
3
|
+
declare const StyledButtonToggleContentWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
+
export interface StyledButtonToggleLabelProps {
|
|
5
|
+
/** buttonIcon to render. */
|
|
6
|
+
buttonIcon?: IconType;
|
|
7
|
+
/** Sets the size of the buttonIcon (eg. large) */
|
|
8
|
+
buttonIconSize?: ButtonToggleIconSizes;
|
|
9
|
+
/** Disable all user interaction. */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
/** ButtonToggle size */
|
|
12
|
+
size: "small" | "medium" | "large";
|
|
13
|
+
}
|
|
14
|
+
declare const StyledButtonToggleLabel: import("styled-components").StyledComponent<"label", any, StyledButtonToggleLabelProps, never>;
|
|
15
|
+
export interface StyledButtonToggleIconProps {
|
|
16
|
+
/** Sets the size of the buttonIcon (eg. large) */
|
|
17
|
+
buttonIconSize?: ButtonToggleIconSizes;
|
|
18
|
+
hasContent?: boolean;
|
|
19
|
+
}
|
|
20
|
+
declare const StyledButtonToggleIcon: import("styled-components").StyledComponent<"div", any, StyledButtonToggleIconProps, never>;
|
|
21
|
+
export interface StyledButtonToggleProps {
|
|
22
|
+
grouped?: boolean;
|
|
23
|
+
}
|
|
24
|
+
declare const StyledButtonToggle: import("styled-components").StyledComponent<"div", any, StyledButtonToggleProps, never>;
|
|
25
|
+
declare const StyledButtonToggleInput: import("styled-components").StyledComponent<"input", any, {}, never>;
|
|
26
|
+
export { StyledButtonToggle, StyledButtonToggleLabel, StyledButtonToggleIcon, StyledButtonToggleInput, StyledButtonToggleContentWrapper, };
|
|
@@ -5,18 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.StyledButtonToggleContentWrapper = exports.StyledButtonToggleInput = exports.StyledButtonToggleIcon = exports.StyledButtonToggleLabel = exports.StyledButtonToggle = void 0;
|
|
7
7
|
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
|
|
10
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
11
9
|
|
|
12
10
|
var _icon = _interopRequireDefault(require("../icon/icon.style"));
|
|
13
11
|
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
14
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
15
15
|
|
|
16
16
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
17
|
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
18
|
const heightConfig = {
|
|
21
19
|
small: 32,
|
|
22
20
|
medium: 40,
|
|
@@ -125,10 +123,9 @@ const iconFontSizes = {
|
|
|
125
123
|
};
|
|
126
124
|
const StyledButtonToggleIcon = _styledComponents.default.div`
|
|
127
125
|
${({
|
|
128
|
-
|
|
129
|
-
}) =>
|
|
130
|
-
|
|
131
|
-
`}
|
|
126
|
+
hasContent
|
|
127
|
+
}) => hasContent && `margin-right: 8px;`}
|
|
128
|
+
|
|
132
129
|
${({
|
|
133
130
|
buttonIconSize
|
|
134
131
|
}) => buttonIconSize === "large" && (0, _styledComponents.css)`
|
|
@@ -175,7 +172,4 @@ const StyledButtonToggleInput = _styledComponents.default.input`
|
|
|
175
172
|
height: 0;
|
|
176
173
|
opacity: 0;
|
|
177
174
|
`;
|
|
178
|
-
exports.StyledButtonToggleInput = StyledButtonToggleInput;
|
|
179
|
-
StyledButtonToggleIcon.propTypes = {
|
|
180
|
-
buttonIconSize: _propTypes.default.string
|
|
181
|
-
};
|
|
175
|
+
exports.StyledButtonToggleInput = StyledButtonToggleInput;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from "./button-toggle";
|
|
2
|
-
export { ButtonToggleProps } from "./button-toggle";
|
|
1
|
+
export { default } from "./button-toggle.component";
|
|
2
|
+
export type { ButtonToggleProps } from "./button-toggle.component";
|
|
@@ -48,7 +48,6 @@ const StyledContentTitle = _styledComponents.default.div`
|
|
|
48
48
|
return (0, _styledComponents.css)`
|
|
49
49
|
display: ${inline ? "inline-block" : "block"};
|
|
50
50
|
font-weight: bold;
|
|
51
|
-
color: var(--colorsUtilityYin090);
|
|
52
51
|
width: ${titleWidth && `calc(${titleWidth}% - 30px)`};
|
|
53
52
|
text-align: ${!inline && align};
|
|
54
53
|
|
|
@@ -17,7 +17,7 @@ exports.getSeparator = void 0;
|
|
|
17
17
|
var _fp = require("date-fns/fp");
|
|
18
18
|
|
|
19
19
|
function parseDate(formatString, valueString) {
|
|
20
|
-
if (!valueString || !formatString) return
|
|
20
|
+
if (!valueString || !formatString) return null;
|
|
21
21
|
return (0, _fp.parse)(new Date(), formatString, valueString);
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -11,8 +11,6 @@ var _styledSystem = require("styled-system");
|
|
|
11
11
|
|
|
12
12
|
var _button = _interopRequireDefault(require("../button/button.style"));
|
|
13
13
|
|
|
14
|
-
var _link = require("../link/link.style");
|
|
15
|
-
|
|
16
14
|
var _themes = require("../../style/themes");
|
|
17
15
|
|
|
18
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -86,14 +84,6 @@ const StyledDd = _styledComponents.default.dd`
|
|
|
86
84
|
padding: 0;
|
|
87
85
|
border: none;
|
|
88
86
|
}
|
|
89
|
-
|
|
90
|
-
${_link.StyledLink} {
|
|
91
|
-
a,
|
|
92
|
-
button {
|
|
93
|
-
font-weight: 700px;
|
|
94
|
-
text-decoration: none;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
87
|
${_styledSystem.space}
|
|
98
88
|
`;
|
|
99
89
|
exports.StyledDd = StyledDd;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default } from "./loader";
|
|
1
|
+
export { default } from "./loader.component";
|
|
2
|
+
export type { LoaderProps } from "./loader.component";
|
|
@@ -1,2 +1,10 @@
|
|
|
1
|
+
export interface StyledLoaderSquareProps {
|
|
2
|
+
/** Size of the loader. */
|
|
3
|
+
size?: "small" | "medium" | "large";
|
|
4
|
+
/** Applies white color. */
|
|
5
|
+
isInsideButton?: boolean;
|
|
6
|
+
/** Applies slate color. Available only when isInsideButton is true. */
|
|
7
|
+
isActive?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const StyledLoaderSquare: import("styled-components").StyledComponent<"div", any, StyledLoaderSquareProps, never>;
|
|
1
10
|
export default StyledLoaderSquare;
|
|
2
|
-
declare const StyledLoaderSquare: import("styled-components").StyledComponent<"div", any, {}, never>;
|