@dnanpm/styleguide 3.9.7 → 3.9.9
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/build/cjs/components/Button/Button.d.ts +13 -1
- package/build/cjs/components/Button/Button.js +5 -5
- package/build/cjs/components/ButtonArrow/ButtonArrow.d.ts +8 -2
- package/build/cjs/components/ButtonArrow/ButtonArrow.js +2 -2
- package/build/cjs/components/ButtonIcon/ButtonIcon.d.ts +11 -1
- package/build/cjs/components/ButtonIcon/ButtonIcon.js +4 -4
- package/build/cjs/components/Carousel/Carousel.d.ts +188 -0
- package/build/cjs/components/Carousel/Carousel.js +23 -10
- package/build/cjs/components/Checkbox/Checkbox.js +65 -4
- package/build/cjs/components/Divider/Divider.d.ts +4 -0
- package/build/cjs/components/Divider/Divider.js +2 -1
- package/build/cjs/components/InfoDialog/InfoDialog.d.ts +4 -0
- package/build/cjs/components/InfoDialog/InfoDialog.js +1 -1
- package/build/cjs/components/Input/Input.d.ts +14 -0
- package/build/cjs/components/Input/Input.js +21 -5
- package/build/cjs/components/Label/Label.d.ts +7 -0
- package/build/cjs/components/Label/Label.js +3 -1
- package/build/cjs/components/LabelText/LabelText.d.ts +5 -3
- package/build/cjs/components/LabelText/LabelText.js +1 -1
- package/build/cjs/components/Modal/Modal.d.ts +51 -27
- package/build/cjs/components/Modal/Modal.js +92 -16
- package/build/cjs/components/ProgressIndicator/ProgressIndicator.d.ts +2 -2
- package/build/cjs/components/ProgressIndicator/ProgressIndicator.js +13 -6
- package/build/cjs/components/RadioButton/RadioButton.js +61 -4
- package/build/cjs/components/ReadMore/ReadMore.d.ts +4 -0
- package/build/cjs/components/ReadMore/ReadMore.js +30 -3
- package/build/cjs/components/Search/Search.d.ts +12 -0
- package/build/cjs/components/Search/Search.js +9 -3
- package/build/cjs/themes/globalStyles.d.ts +0 -166
- package/build/cjs/themes/globalStyles.js +0 -59
- package/build/es/components/Button/Button.d.ts +13 -1
- package/build/es/components/Button/Button.js +5 -5
- package/build/es/components/ButtonArrow/ButtonArrow.d.ts +8 -2
- package/build/es/components/ButtonArrow/ButtonArrow.js +2 -2
- package/build/es/components/ButtonIcon/ButtonIcon.d.ts +11 -1
- package/build/es/components/ButtonIcon/ButtonIcon.js +5 -5
- package/build/es/components/Carousel/Carousel.d.ts +188 -0
- package/build/es/components/Carousel/Carousel.js +23 -11
- package/build/es/components/Checkbox/Checkbox.js +65 -4
- package/build/es/components/Divider/Divider.d.ts +4 -0
- package/build/es/components/Divider/Divider.js +2 -1
- package/build/es/components/InfoDialog/InfoDialog.d.ts +4 -0
- package/build/es/components/InfoDialog/InfoDialog.js +1 -1
- package/build/es/components/Input/Input.d.ts +14 -0
- package/build/es/components/Input/Input.js +21 -5
- package/build/es/components/Label/Label.d.ts +7 -0
- package/build/es/components/Label/Label.js +3 -1
- package/build/es/components/LabelText/LabelText.d.ts +5 -3
- package/build/es/components/LabelText/LabelText.js +1 -1
- package/build/es/components/Modal/Modal.d.ts +51 -27
- package/build/es/components/Modal/Modal.js +93 -17
- package/build/es/components/ProgressIndicator/ProgressIndicator.d.ts +2 -2
- package/build/es/components/ProgressIndicator/ProgressIndicator.js +13 -6
- package/build/es/components/RadioButton/RadioButton.js +61 -4
- package/build/es/components/ReadMore/ReadMore.d.ts +4 -0
- package/build/es/components/ReadMore/ReadMore.js +31 -4
- package/build/es/components/Search/Search.d.ts +12 -0
- package/build/es/components/Search/Search.js +9 -3
- package/build/es/themes/globalStyles.d.ts +0 -166
- package/build/es/themes/globalStyles.js +3 -61
- package/package.json +10 -9
|
@@ -78,10 +78,22 @@ export interface Props {
|
|
|
78
78
|
* Allows to pass testid string for testing purposes
|
|
79
79
|
*/
|
|
80
80
|
'data-testid'?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Allows to pass a screen reader label for the button
|
|
83
|
+
*/
|
|
84
|
+
'aria-label'?: string;
|
|
81
85
|
/**
|
|
82
86
|
* Allows to pass any data-* attribute
|
|
83
87
|
*/
|
|
84
88
|
dataAttributes?: Record<`data-${string}`, string>;
|
|
89
|
+
/**
|
|
90
|
+
* Allows to pass a screen reader label for the loading indicator
|
|
91
|
+
*/
|
|
92
|
+
loadingLabel?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Ref for the button element
|
|
95
|
+
*/
|
|
96
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
85
97
|
}
|
|
86
98
|
export declare const shade: {
|
|
87
99
|
pink: {
|
|
@@ -100,6 +112,6 @@ export declare const shade: {
|
|
|
100
112
|
};
|
|
101
113
|
};
|
|
102
114
|
/** @visibleName Button */
|
|
103
|
-
declare const Button: ({ type, "data-testid": dataTestId, "data-no-close": dataNoClose, "data-track-value": dataTrackValue, ...props }: Props) => React.JSX.Element;
|
|
115
|
+
declare const Button: ({ type, "data-testid": dataTestId, "data-no-close": dataNoClose, "data-track-value": dataTrackValue, "aria-label": ariaLabel, ...props }: Props) => React.JSX.Element;
|
|
104
116
|
/** @component */
|
|
105
117
|
export default Button;
|
|
@@ -52,7 +52,7 @@ const Element = styled__default.default.button `
|
|
|
52
52
|
display: inline-flex;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
&:focus {
|
|
55
|
+
&:focus-visible {
|
|
56
56
|
color: ${({ darkBg }) => (darkBg ? theme.default.color.text.plum : theme.default.color.text.white)};
|
|
57
57
|
background-color: ${({ darkBg }) => darkBg ? theme.default.color.default.white : shade.plum.darker};
|
|
58
58
|
border: 2px solid
|
|
@@ -66,7 +66,7 @@ const Element = styled__default.default.button `
|
|
|
66
66
|
color: ${({ darkBg }) => (darkBg ? theme.default.color.text.plum : theme.default.color.text.white)};
|
|
67
67
|
background-color: ${({ darkBg }) => darkBg ? theme.default.color.default.white : shade.plum.darker};
|
|
68
68
|
|
|
69
|
-
&:focus {
|
|
69
|
+
&:focus-visible {
|
|
70
70
|
border: 2px solid
|
|
71
71
|
${({ darkBg }) => (darkBg ? theme.default.color.focus.dark : theme.default.color.focus.light)};
|
|
72
72
|
box-shadow: 0px 0px 0px 2px
|
|
@@ -122,11 +122,11 @@ const Element = styled__default.default.button `
|
|
|
122
122
|
`;
|
|
123
123
|
/** @visibleName Button */
|
|
124
124
|
const Button = (_a) => {
|
|
125
|
-
var { type = 'submit', 'data-testid': dataTestId, 'data-no-close': dataNoClose, 'data-track-value': dataTrackValue } = _a, props = tslib.__rest(_a, ["type", 'data-testid', 'data-no-close', 'data-track-value']);
|
|
126
|
-
return (React__default.default.createElement(Element, Object.assign({ id: props.id, as: props.href ? 'a' : undefined, type: props.href ? undefined : type, href: props.href, onClick: props.onClick, onMouseDown: props.onMouseDown, small: props.small, darkBg: props.darkBg, fullWidth: props.fullWidth, "$loading": props.loading, tabIndex: props.loading ? -1 : 0, "data-loading": props.loading, className: props.className, "data-testid": dataTestId, "data-no-close": dataNoClose, "data-track-value": dataTrackValue }, props.dataAttributes, (!props.href && {
|
|
125
|
+
var { type = 'submit', 'data-testid': dataTestId, 'data-no-close': dataNoClose, 'data-track-value': dataTrackValue, 'aria-label': ariaLabel } = _a, props = tslib.__rest(_a, ["type", 'data-testid', 'data-no-close', 'data-track-value', 'aria-label']);
|
|
126
|
+
return (React__default.default.createElement(Element, Object.assign({ id: props.id, as: props.href ? 'a' : undefined, type: props.href ? undefined : type, href: props.href, onClick: props.onClick, onMouseDown: props.onMouseDown, small: props.small, darkBg: props.darkBg, fullWidth: props.fullWidth, "$loading": props.loading, tabIndex: props.loading ? -1 : 0, "data-loading": props.loading, className: props.className, "data-testid": dataTestId, "data-no-close": dataNoClose, "data-track-value": dataTrackValue, "aria-label": ariaLabel }, props.dataAttributes, (!props.href && {
|
|
127
127
|
name: props.name,
|
|
128
128
|
disabled: props.disabled,
|
|
129
|
-
})), props.loading ? (React__default.default.createElement(PixelLoader.default, { color: props.darkBg ? theme.default.color.default.white : theme.default.color.default.plum })) : (React__default.default.createElement("span", { "data-testid": dataTestId && `${dataTestId}-text`, "data-no-close": dataNoClose }, props.children))));
|
|
129
|
+
})), props.loading ? (React__default.default.createElement(PixelLoader.default, { color: props.darkBg ? theme.default.color.default.white : theme.default.color.default.plum, label: props.loadingLabel })) : (React__default.default.createElement("span", { "data-testid": dataTestId && `${dataTestId}-text`, "data-no-close": dataNoClose }, props.children))));
|
|
130
130
|
};
|
|
131
131
|
|
|
132
132
|
exports.default = Button;
|
|
@@ -24,7 +24,7 @@ type Props = ({
|
|
|
24
24
|
*/
|
|
25
25
|
icon: ReactNode;
|
|
26
26
|
direction?: never;
|
|
27
|
-
}) & Omit<ButtonProps, 'children' | 'small' | 'fullWidth' | 'loading' | 'data-no-close'> & {
|
|
27
|
+
}) & Omit<ButtonProps, 'children' | 'small' | 'fullWidth' | 'loading' | 'data-no-close' | 'href' | 'loadingLabel'> & {
|
|
28
28
|
/**
|
|
29
29
|
* Allows to change the styling of component
|
|
30
30
|
*
|
|
@@ -34,8 +34,14 @@ type Props = ({
|
|
|
34
34
|
* @default 'primary'
|
|
35
35
|
*/
|
|
36
36
|
variant?: ButtonArrowVariant;
|
|
37
|
+
/**
|
|
38
|
+
* Allows to change the type of resulting HTML element from button (`<button></button>`) to anchor (`<a href="..."></a>`)
|
|
39
|
+
*
|
|
40
|
+
* @deprecated Use `Button` component for href support
|
|
41
|
+
*/
|
|
42
|
+
href?: string;
|
|
37
43
|
};
|
|
38
44
|
/** @visibleName Button Arrow */
|
|
39
|
-
declare const ButtonArrow: ({ variant, "data-testid": dataTestId, "data-track-value": dataTrackValue, ...props }: Props) => React.JSX.Element;
|
|
45
|
+
declare const ButtonArrow: ({ variant, "data-testid": dataTestId, "data-track-value": dataTrackValue, "aria-label": ariaLabel, ...props }: Props) => React.JSX.Element;
|
|
40
46
|
/** @component */
|
|
41
47
|
export default ButtonArrow;
|
|
@@ -71,9 +71,9 @@ const buttonsMap = {
|
|
|
71
71
|
};
|
|
72
72
|
/** @visibleName Button Arrow */
|
|
73
73
|
const ButtonArrow = (_a) => {
|
|
74
|
-
var { variant = 'primary', 'data-testid': dataTestId, 'data-track-value': dataTrackValue } = _a, props = tslib.__rest(_a, ["variant", 'data-testid', 'data-track-value']);
|
|
74
|
+
var { variant = 'primary', 'data-testid': dataTestId, 'data-track-value': dataTrackValue, 'aria-label': ariaLabel } = _a, props = tslib.__rest(_a, ["variant", 'data-testid', 'data-track-value', 'aria-label']);
|
|
75
75
|
const Element = buttonsMap[variant];
|
|
76
|
-
return (React__default.default.createElement(Element, { id: props.id, href: props.href, name: props.name, type: props.type, onClick: props.onClick, onMouseDown: props.onMouseDown, darkBg: props.darkBg, disabled: props.disabled, className: props.className, "data-testid": dataTestId, "data-track-value": dataTrackValue, dataAttributes: props.dataAttributes }, props.direction ? (React__default.default.createElement(Icon.default, { icon: iconsMap[props.direction], size: "1rem" })) : (React.isValidElement(props.icon) && props.icon.type === Icon.default && props.icon)));
|
|
76
|
+
return (React__default.default.createElement(Element, { id: props.id, href: props.href, name: props.name, type: props.type, onClick: props.onClick, onMouseDown: props.onMouseDown, darkBg: props.darkBg, disabled: props.disabled, className: props.className, "data-testid": dataTestId, "data-track-value": dataTrackValue, dataAttributes: props.dataAttributes, "aria-label": ariaLabel }, props.direction ? (React__default.default.createElement(Icon.default, { icon: iconsMap[props.direction], size: "1rem", "aria-hidden": true })) : (React.isValidElement(props.icon) && props.icon.type === Icon.default && props.icon)));
|
|
77
77
|
};
|
|
78
78
|
|
|
79
79
|
exports.default = ButtonArrow;
|
|
@@ -26,8 +26,18 @@ interface Props extends Omit<ButtonProps, 'fullWidth'> {
|
|
|
26
26
|
* @default undefined
|
|
27
27
|
*/
|
|
28
28
|
ariaExpanded?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Allows to pass aria hidden to the icon element for screen readers
|
|
31
|
+
*
|
|
32
|
+
* @default undefined
|
|
33
|
+
*/
|
|
34
|
+
ariaHidden?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Screen reader label describing the purpose of the ButtonIcon,
|
|
37
|
+
*/
|
|
38
|
+
ariaLabel?: string;
|
|
29
39
|
}
|
|
30
40
|
/** @visibleName Button Icon */
|
|
31
|
-
declare const ButtonIcon:
|
|
41
|
+
declare const ButtonIcon: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
32
42
|
/** @component */
|
|
33
43
|
export default ButtonIcon;
|
|
@@ -89,12 +89,12 @@ const ButtonElement = styled__default.default.button `
|
|
|
89
89
|
`}
|
|
90
90
|
`;
|
|
91
91
|
/** @visibleName Button Icon */
|
|
92
|
-
const ButtonIcon = (_a) => {
|
|
92
|
+
const ButtonIcon = React.forwardRef((_a, ref) => {
|
|
93
93
|
var { icon = icons.EditUnderline, 'data-testid': dataTestId, 'data-no-close': dataNoClose, 'data-track-value': dataTrackValue } = _a, props = tslib.__rest(_a, ["icon", 'data-testid', 'data-no-close', 'data-track-value']);
|
|
94
94
|
const position = props.isReversed ? 'right' : 'left';
|
|
95
|
-
return (React__default.default.createElement(ButtonElement, Object.assign({ id: props.id, name: props.name, type: props.type, onClick: props.onClick, onMouseDown: props.onMouseDown, small: props.small, darkBg: props.darkBg, "$loading": props.loading, tabIndex: props.loading ? -1 : 0, "data-loading": props.loading, disabled: props.disabled, hideChildrenMobile: props.hideChildrenMobile, isReversed: props.isReversed, className: props.className, "data-testid": dataTestId, "data-no-close": dataNoClose, "data-track-value": dataTrackValue, "aria-expanded": props.ariaExpanded }, props.dataAttributes), props.loading ? (React__default.default.createElement(PixelLoader.default, { color: props.darkBg ? theme.default.color.default.white : theme.default.color.default.black })) : (React__default.default.createElement(React__default.default.Fragment, null,
|
|
96
|
-
React__default.default.createElement(Icon.default, { icon: icon, color: props.darkBg ? theme.default.color.default.white : theme.default.color.default.pink, size: props.small ? '1.25rem' : '1.5rem', position: props.children ? position : undefined }),
|
|
95
|
+
return (React__default.default.createElement(ButtonElement, Object.assign({ ref: ref, id: props.id, name: props.name, type: props.type, onClick: props.onClick, onMouseDown: props.onMouseDown, small: props.small, darkBg: props.darkBg, "$loading": props.loading, tabIndex: props.loading ? -1 : 0, "data-loading": props.loading, disabled: props.disabled, hideChildrenMobile: props.hideChildrenMobile, isReversed: props.isReversed, className: props.className, "data-testid": dataTestId, "data-no-close": dataNoClose, "data-track-value": dataTrackValue, "aria-expanded": props.ariaExpanded, "aria-label": props.ariaLabel }, props.dataAttributes), props.loading ? (React__default.default.createElement(PixelLoader.default, { color: props.darkBg ? theme.default.color.default.white : theme.default.color.default.black })) : (React__default.default.createElement(React__default.default.Fragment, null,
|
|
96
|
+
React__default.default.createElement(Icon.default, { icon: icon, color: props.darkBg ? theme.default.color.default.white : theme.default.color.default.pink, size: props.small ? '1.25rem' : '1.5rem', position: props.children ? position : undefined, "aria-hidden": props.ariaHidden }),
|
|
97
97
|
props.children && (React__default.default.createElement("span", { "data-testid": dataTestId && `${dataTestId}-text`, "data-no-close": dataNoClose }, props.children))))));
|
|
98
|
-
};
|
|
98
|
+
});
|
|
99
99
|
|
|
100
100
|
exports.default = ButtonIcon;
|
|
@@ -54,8 +54,196 @@ interface Props {
|
|
|
54
54
|
* If not provided, visibleItems property will be used
|
|
55
55
|
*/
|
|
56
56
|
responsive?: Partial<Responsive>;
|
|
57
|
+
/**
|
|
58
|
+
* Allows to pass a screen reader label for the pagination item next to the current slide number
|
|
59
|
+
*/
|
|
60
|
+
paginationAriaLabel?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Allows to pass a screen reader label for the next arrow button
|
|
63
|
+
*/
|
|
64
|
+
nextAriaLabel?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Allows to pass a screen reader label for the previous arrow button
|
|
67
|
+
*/
|
|
68
|
+
previousAriaLabel?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Number of items to move when navigating the carousel
|
|
71
|
+
*
|
|
72
|
+
* @default 1
|
|
73
|
+
*/
|
|
74
|
+
swipeStep?: number;
|
|
57
75
|
}
|
|
76
|
+
declare const SlideItem: import("styled-components").StyledComponent<"div", {
|
|
77
|
+
base: {
|
|
78
|
+
baseHeight: {
|
|
79
|
+
value: number;
|
|
80
|
+
unit: string;
|
|
81
|
+
};
|
|
82
|
+
baseWidth: {
|
|
83
|
+
value: number;
|
|
84
|
+
unit: string;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
breakpoints: import("../../themes/themeComponents/breakpoints").ViewBreakpoints;
|
|
88
|
+
color: {
|
|
89
|
+
default: {
|
|
90
|
+
pink: string;
|
|
91
|
+
plum: string;
|
|
92
|
+
white: string;
|
|
93
|
+
black: string;
|
|
94
|
+
};
|
|
95
|
+
accent: {
|
|
96
|
+
lemon: string;
|
|
97
|
+
sky: string;
|
|
98
|
+
orange: string;
|
|
99
|
+
};
|
|
100
|
+
active: {
|
|
101
|
+
pink: string;
|
|
102
|
+
};
|
|
103
|
+
hover: {
|
|
104
|
+
pink: string;
|
|
105
|
+
};
|
|
106
|
+
text: {
|
|
107
|
+
gray: string;
|
|
108
|
+
pink: string;
|
|
109
|
+
plum: string;
|
|
110
|
+
white: string;
|
|
111
|
+
black: string;
|
|
112
|
+
};
|
|
113
|
+
line: {
|
|
114
|
+
L01: string;
|
|
115
|
+
L02: string;
|
|
116
|
+
L03: string;
|
|
117
|
+
L04: string;
|
|
118
|
+
};
|
|
119
|
+
notification: {
|
|
120
|
+
info: string;
|
|
121
|
+
success: string;
|
|
122
|
+
warning: string;
|
|
123
|
+
error: string;
|
|
124
|
+
};
|
|
125
|
+
background: {
|
|
126
|
+
sand: {
|
|
127
|
+
default: string;
|
|
128
|
+
E01: string;
|
|
129
|
+
E02: string;
|
|
130
|
+
};
|
|
131
|
+
pink: {
|
|
132
|
+
default: string;
|
|
133
|
+
E01: string;
|
|
134
|
+
E02: string;
|
|
135
|
+
};
|
|
136
|
+
plum: {
|
|
137
|
+
default: string;
|
|
138
|
+
E01: string;
|
|
139
|
+
E02: string;
|
|
140
|
+
};
|
|
141
|
+
lemon: {
|
|
142
|
+
default: string;
|
|
143
|
+
E01: string;
|
|
144
|
+
E02: string;
|
|
145
|
+
};
|
|
146
|
+
sky: {
|
|
147
|
+
default: string;
|
|
148
|
+
E01: string;
|
|
149
|
+
E02: string;
|
|
150
|
+
};
|
|
151
|
+
orange: {
|
|
152
|
+
default: string;
|
|
153
|
+
E01: string;
|
|
154
|
+
E02: string;
|
|
155
|
+
};
|
|
156
|
+
white: {
|
|
157
|
+
default: string;
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
focus: {
|
|
161
|
+
dark: string;
|
|
162
|
+
light: string;
|
|
163
|
+
};
|
|
164
|
+
transparency: {
|
|
165
|
+
T0: string;
|
|
166
|
+
T10: string;
|
|
167
|
+
T20: string;
|
|
168
|
+
T30: string;
|
|
169
|
+
T40: string;
|
|
170
|
+
T50: string;
|
|
171
|
+
T60: string;
|
|
172
|
+
T70: string;
|
|
173
|
+
T80: string;
|
|
174
|
+
T90: string;
|
|
175
|
+
T100: string;
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
fontFamily: {
|
|
179
|
+
default: string;
|
|
180
|
+
heading: string;
|
|
181
|
+
numerals: string;
|
|
182
|
+
};
|
|
183
|
+
fontSize: {
|
|
184
|
+
default: string;
|
|
185
|
+
xl: string;
|
|
186
|
+
l: string;
|
|
187
|
+
s: string;
|
|
188
|
+
xs: string;
|
|
189
|
+
h1XL: string;
|
|
190
|
+
h1L: string;
|
|
191
|
+
h1M: string;
|
|
192
|
+
h1S: string;
|
|
193
|
+
h2M: string;
|
|
194
|
+
h2S: string;
|
|
195
|
+
h3: string;
|
|
196
|
+
h4: string;
|
|
197
|
+
h5: string;
|
|
198
|
+
h1: string;
|
|
199
|
+
h2: string;
|
|
200
|
+
};
|
|
201
|
+
fontWeight: {
|
|
202
|
+
book: number;
|
|
203
|
+
medium: number;
|
|
204
|
+
bold: number;
|
|
205
|
+
black: number;
|
|
206
|
+
};
|
|
207
|
+
form: {
|
|
208
|
+
smallSelectWidth: string;
|
|
209
|
+
smallSelectHeight: string;
|
|
210
|
+
};
|
|
211
|
+
grid: {
|
|
212
|
+
gutter: string;
|
|
213
|
+
};
|
|
214
|
+
lineHeight: {
|
|
215
|
+
default: string;
|
|
216
|
+
xl: string;
|
|
217
|
+
s: string;
|
|
218
|
+
xs: string;
|
|
219
|
+
xxs: string;
|
|
220
|
+
auto: string;
|
|
221
|
+
h1XL: string;
|
|
222
|
+
h1L: string;
|
|
223
|
+
h1M: string;
|
|
224
|
+
h1S: string;
|
|
225
|
+
h2M: string;
|
|
226
|
+
h2S: string;
|
|
227
|
+
h3: string;
|
|
228
|
+
h4: string;
|
|
229
|
+
h5: string;
|
|
230
|
+
h1: string;
|
|
231
|
+
h2: string;
|
|
232
|
+
};
|
|
233
|
+
media: Record<string | number, (l: TemplateStringsArray, ...p: (string | number)[]) => string>;
|
|
234
|
+
radius: {
|
|
235
|
+
default: string;
|
|
236
|
+
s: string;
|
|
237
|
+
xs: string;
|
|
238
|
+
circle: string;
|
|
239
|
+
pill: string;
|
|
240
|
+
};
|
|
241
|
+
}, Required<Pick<Props, "visibleItems">> & {
|
|
242
|
+
itemWidthCorrection: number;
|
|
243
|
+
isSwiping: boolean;
|
|
244
|
+
}, never>;
|
|
58
245
|
/** @visibleName Carousel */
|
|
59
246
|
declare const Carousel: ({ "data-testid": dataTestId, ...props }: Props) => React.JSX.Element;
|
|
60
247
|
/** @component */
|
|
61
248
|
export default Carousel;
|
|
249
|
+
export { SlideItem };
|
|
@@ -146,6 +146,7 @@ const Counter = styled.default.span `
|
|
|
146
146
|
`;
|
|
147
147
|
/** @visibleName Carousel */
|
|
148
148
|
const Carousel = (_a) => {
|
|
149
|
+
var _b;
|
|
149
150
|
var { 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ['data-testid']);
|
|
150
151
|
const slidesWrapperRef = React.useRef(null);
|
|
151
152
|
const scrollbarRef = React.useRef(null);
|
|
@@ -175,9 +176,18 @@ const Carousel = (_a) => {
|
|
|
175
176
|
}, 100);
|
|
176
177
|
return () => clearTimeout(timeoutId);
|
|
177
178
|
}, [width, isMobile, props.responsive, props.visibleItems, props.children]);
|
|
179
|
+
const getStep = (step, visibleItems) => {
|
|
180
|
+
if (step > visibleItems) {
|
|
181
|
+
return Math.floor(visibleItems);
|
|
182
|
+
}
|
|
183
|
+
return Math.floor(step);
|
|
184
|
+
};
|
|
178
185
|
const visibleItems = props.visibleItems || calculatedItems;
|
|
179
186
|
const slidesWrapperGapSizePx = 20;
|
|
180
187
|
const slideScreensCount = React.Children.count(props.children) - Math.floor(visibleItems) + 1;
|
|
188
|
+
const step = getStep((_b = props.swipeStep) !== null && _b !== void 0 ? _b : 1, visibleItems);
|
|
189
|
+
const currentStepIndex = Math.ceil(currentIndex / step);
|
|
190
|
+
const totalSwipeSteps = Math.ceil(slideScreensCount / step + ((slideScreensCount - 1) % step !== 0 ? 1 : 0));
|
|
181
191
|
const itemWidthCorrectionRatio = (slidesWrapperGapSizePx * visibleItems) % Math.floor(visibleItems) === 0
|
|
182
192
|
? (visibleItems - 1) / visibleItems
|
|
183
193
|
: Math.floor(visibleItems) / visibleItems;
|
|
@@ -224,14 +234,15 @@ const Carousel = (_a) => {
|
|
|
224
234
|
}
|
|
225
235
|
};
|
|
226
236
|
const handleNavigationButtonPreviousClick = () => {
|
|
227
|
-
handleSetCurrentIndex(currentIndex -
|
|
237
|
+
handleSetCurrentIndex(currentIndex - step);
|
|
228
238
|
};
|
|
229
239
|
const handleNavigationButtonNextClick = () => {
|
|
230
|
-
handleSetCurrentIndex(currentIndex +
|
|
240
|
+
handleSetCurrentIndex(currentIndex + step);
|
|
231
241
|
};
|
|
232
242
|
const handlePaginationItemClick = (e) => {
|
|
233
243
|
if (e.currentTarget.parentElement) {
|
|
234
|
-
|
|
244
|
+
const index = [...e.currentTarget.parentElement.children].indexOf(e.currentTarget);
|
|
245
|
+
handleSetCurrentIndex(index * step);
|
|
235
246
|
}
|
|
236
247
|
};
|
|
237
248
|
const handlePointerMove = (e) => {
|
|
@@ -272,14 +283,14 @@ const Carousel = (_a) => {
|
|
|
272
283
|
if (endTime - data.startTime > 300) {
|
|
273
284
|
const swipeRatio = Math.abs(data.currentTransform - data.startTransform) / data.itemWidth;
|
|
274
285
|
if (swipeRatio >= 0.5) {
|
|
275
|
-
handleSetCurrentIndex(currentIndex + Math.round(data.direction > 0 ? swipeRatio : -swipeRatio));
|
|
286
|
+
handleSetCurrentIndex(currentIndex + Math.round(data.direction > 0 ? swipeRatio : -swipeRatio) * step);
|
|
276
287
|
}
|
|
277
288
|
else {
|
|
278
289
|
handleSetCurrentIndex(currentIndex);
|
|
279
290
|
}
|
|
280
291
|
}
|
|
281
292
|
else {
|
|
282
|
-
handleSetCurrentIndex(currentIndex + data.direction);
|
|
293
|
+
handleSetCurrentIndex(currentIndex + data.direction * step);
|
|
283
294
|
}
|
|
284
295
|
if (data.scrollbarNavigation && data.direction === 0) {
|
|
285
296
|
if (knobRef.current) {
|
|
@@ -341,19 +352,21 @@ const Carousel = (_a) => {
|
|
|
341
352
|
props.title && React__default.default.createElement(Title, null, props.title),
|
|
342
353
|
React__default.default.createElement(Navigation, null,
|
|
343
354
|
props.hasCounter && (React__default.default.createElement(Counter, null,
|
|
344
|
-
slideScreensCount === 0 ? 0 :
|
|
355
|
+
slideScreensCount === 0 ? 0 : currentStepIndex + 1,
|
|
345
356
|
"/",
|
|
346
|
-
|
|
347
|
-
React__default.default.createElement(ButtonArrow.default, { direction: "left", "aria-label":
|
|
348
|
-
React__default.default.createElement(ButtonArrow.default, { direction: "right", "aria-label":
|
|
357
|
+
totalSwipeSteps)),
|
|
358
|
+
React__default.default.createElement(ButtonArrow.default, { direction: "left", "aria-label": props.previousAriaLabel, onClick: handleNavigationButtonPreviousClick, disabled: currentIndex <= 0, type: "button" }),
|
|
359
|
+
React__default.default.createElement(ButtonArrow.default, { direction: "right", "aria-label": props.nextAriaLabel, onClick: handleNavigationButtonNextClick, disabled: currentIndex + visibleItems >= React.Children.count(props.children), type: "button" }))),
|
|
349
360
|
React__default.default.createElement(Content, { "data-testid": dataTestId && `${dataTestId}-content` },
|
|
350
361
|
React__default.default.createElement(SlidesWrapper, { ref: slidesWrapperRef, onPointerDown: handleSlidesPointerDown, gap: slidesWrapperGapSizePx / 16 }, React.Children.map(props.children, child => (React__default.default.createElement(SlideItem, { visibleItems: visibleItems, itemWidthCorrection: itemWidthCorrection, isSwiping: isSwiping, onPointerDown: handlePointerDown }, child))))),
|
|
351
362
|
React__default.default.createElement(Footer, { "data-testid": dataTestId && `${dataTestId}-footer` },
|
|
352
|
-
React__default.default.createElement(Pagination, null, [...Array(
|
|
363
|
+
React__default.default.createElement(Pagination, null, [...Array(totalSwipeSteps).keys()].map((value, index) => (React__default.default.createElement(PaginationItem, { key: value, "aria-label": props.paginationAriaLabel &&
|
|
364
|
+
`${props.paginationAriaLabel} ${index + 1}`, "aria-current": Math.ceil(currentIndex / step) === index, isActive: Math.ceil(currentIndex / step) === index, onClick: handlePaginationItemClick, type: "button" })))),
|
|
353
365
|
React__default.default.createElement(Scrollbar, { ref: scrollbarRef, onPointerDown: handleScrollbarPointerDown },
|
|
354
366
|
React__default.default.createElement(Knob, { ref: knobRef, knobSize: slideScreensCount })),
|
|
355
367
|
props.footerButton && (React__default.default.createElement(FooterButton, null,
|
|
356
368
|
React__default.default.createElement(ButtonIcon.default, { icon: icons.ArrowRight, onClick: props.onFooterButtonClick }, props.footerButton))))));
|
|
357
369
|
};
|
|
358
370
|
|
|
371
|
+
exports.SlideItem = SlideItem;
|
|
359
372
|
exports.default = Carousel;
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var globalStyles = require('../../themes/globalStyles.js');
|
|
8
7
|
var styled = require('../../themes/styled.js');
|
|
9
8
|
var theme = require('../../themes/theme.js');
|
|
10
9
|
var styledUtils = require('../../utils/styledUtils.js');
|
|
@@ -26,17 +25,78 @@ const Container = styled.default.div `
|
|
|
26
25
|
line-height: ${theme.default.lineHeight.default};
|
|
27
26
|
margin-bottom: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 0.5)};
|
|
28
27
|
`;
|
|
29
|
-
const Input = styled.default
|
|
28
|
+
const Input = styled.default.input `
|
|
29
|
+
display: inline-grid;
|
|
30
|
+
appearance: none;
|
|
31
|
+
place-content: center;
|
|
32
|
+
float: left;
|
|
33
|
+
margin: 0;
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
font-family: ${theme.default.fontFamily.default};
|
|
36
|
+
font-size: ${theme.default.fontSize.default};
|
|
37
|
+
line-height: ${theme.default.lineHeight.default};
|
|
38
|
+
min-width: ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 2)};
|
|
39
|
+
width: ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 2)};
|
|
40
|
+
height: ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 2)};
|
|
41
|
+
color: ${theme.default.color.line.L01};
|
|
42
|
+
border: 2px solid ${theme.default.color.line.L01};
|
|
43
|
+
background-color: ${theme.default.color.background.white.default};
|
|
30
44
|
position: relative;
|
|
31
45
|
top: ${styledUtils.getDividedSize(theme.default.base.baseWidth, 5)};
|
|
46
|
+
border-radius: ${theme.default.radius.s};
|
|
47
|
+
|
|
48
|
+
& + label {
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
color: ${theme.default.color.text.black};
|
|
51
|
+
font-weight: ${theme.default.fontWeight.medium};
|
|
52
|
+
padding-left: ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 1)};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&::before {
|
|
56
|
+
content: '';
|
|
57
|
+
transform: scale(0);
|
|
58
|
+
background-color: currentColor;
|
|
59
|
+
}
|
|
32
60
|
|
|
33
61
|
&:checked {
|
|
62
|
+
color: ${theme.default.color.default.pink};
|
|
63
|
+
border-color: ${theme.default.color.default.pink};
|
|
64
|
+
|
|
34
65
|
&::before {
|
|
66
|
+
transform: scale(1);
|
|
35
67
|
width: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 1.6)};
|
|
36
68
|
height: ${styledUtils.getMultipliedSize(theme.default.base.baseHeight, 1.6)};
|
|
37
69
|
background-image: url('${SVGIconData}');
|
|
38
70
|
}
|
|
39
71
|
}
|
|
72
|
+
|
|
73
|
+
&:disabled {
|
|
74
|
+
cursor: not-allowed;
|
|
75
|
+
color: ${theme.default.color.text.gray};
|
|
76
|
+
background-color: ${theme.default.color.line.L02 + theme.default.color.transparency.T40};
|
|
77
|
+
border-color: ${theme.default.color.line.L01 + theme.default.color.transparency.T40};
|
|
78
|
+
|
|
79
|
+
& + label {
|
|
80
|
+
cursor: not-allowed;
|
|
81
|
+
color: ${theme.default.color.text.gray};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&:disabled:checked {
|
|
86
|
+
color: ${theme.default.color.background.pink.E02};
|
|
87
|
+
border-color: ${theme.default.color.background.pink.E02};
|
|
88
|
+
background-color: ${theme.default.color.background.white.default};
|
|
89
|
+
|
|
90
|
+
&::before {
|
|
91
|
+
background-color: ${theme.default.color.background.pink.E02};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&:focus-visible {
|
|
96
|
+
outline: none;
|
|
97
|
+
box-shadow: 0px 0px 0px 2px ${theme.default.color.focus.light},
|
|
98
|
+
0px 0px 0px 4px ${theme.default.color.focus.dark};
|
|
99
|
+
}
|
|
40
100
|
`;
|
|
41
101
|
const Mandatory = styled.default.span `
|
|
42
102
|
color: ${theme.default.color.default.pink};
|
|
@@ -50,6 +110,7 @@ const ErrorMessage = styled.default.div `
|
|
|
50
110
|
`;
|
|
51
111
|
const Checkbox = (_a) => {
|
|
52
112
|
var { 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ['data-testid']);
|
|
113
|
+
const errorId = `${props.id}-error`;
|
|
53
114
|
const handleChange = () => {
|
|
54
115
|
if (props.onChange && !props.disabled) {
|
|
55
116
|
props.onChange(!props.value);
|
|
@@ -57,11 +118,11 @@ const Checkbox = (_a) => {
|
|
|
57
118
|
};
|
|
58
119
|
return (React__default.default.createElement(React__default.default.Fragment, null,
|
|
59
120
|
React__default.default.createElement(Container, null,
|
|
60
|
-
React__default.default.createElement(Input, { id: props.id, name: props.name, type: "checkbox", className: props.className, checked: Boolean(props.value),
|
|
121
|
+
React__default.default.createElement(Input, { id: props.id, name: props.name, type: "checkbox", className: props.className, checked: Boolean(props.value), onChange: handleChange, disabled: props.disabled, "data-testid": dataTestId, "aria-required": props.required, "aria-invalid": props.error ? 'true' : undefined, "aria-errormessage": props.error && props.errorMessage ? errorId : undefined }),
|
|
61
122
|
React__default.default.createElement("label", { htmlFor: props.id, "data-testid": dataTestId && `${dataTestId}-label` },
|
|
62
123
|
props.label,
|
|
63
124
|
props.required && React__default.default.createElement(Mandatory, null, "*"))),
|
|
64
|
-
props.error && props.errorMessage && (React__default.default.createElement(ErrorMessage, { "data-testid": dataTestId && `${dataTestId}-error
|
|
125
|
+
props.error && props.errorMessage && (React__default.default.createElement(ErrorMessage, { "data-testid": dataTestId && `${dataTestId}-error`, id: errorId, role: "alert" }, props.errorMessage))));
|
|
65
126
|
};
|
|
66
127
|
|
|
67
128
|
exports.default = Checkbox;
|
|
@@ -29,6 +29,10 @@ interface Props {
|
|
|
29
29
|
* Allows to pass a custom className
|
|
30
30
|
*/
|
|
31
31
|
className?: string;
|
|
32
|
+
/**
|
|
33
|
+
* An aria-label to the focusable separator should be included if there is more than one focusable separator
|
|
34
|
+
*/
|
|
35
|
+
ariaLabelFocusableSeparator?: string;
|
|
32
36
|
}
|
|
33
37
|
declare const Divider: ({ "data-testid": dataTestId, ...props }: Props) => React.JSX.Element;
|
|
34
38
|
/** @component */
|
|
@@ -26,7 +26,8 @@ const DividerWrapper = styled__default.default.div `
|
|
|
26
26
|
`;
|
|
27
27
|
const Divider = (_a) => {
|
|
28
28
|
var { 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ['data-testid']);
|
|
29
|
-
|
|
29
|
+
const isFocusableSeparator = Boolean(props.children);
|
|
30
|
+
return (React__default.default.createElement(DividerWrapper, { id: props.id, margin: props.margin, padding: props.padding, className: props.className, "data-testid": dataTestId, as: isFocusableSeparator ? 'div' : 'hr', role: isFocusableSeparator ? 'separator' : undefined, "aria-orientation": "horizontal", "aria-label": props.ariaLabelFocusableSeparator, "aria-hidden": !isFocusableSeparator, tabIndex: isFocusableSeparator ? 0 : -1 }, props.children));
|
|
30
31
|
};
|
|
31
32
|
|
|
32
33
|
exports.default = Divider;
|
|
@@ -37,6 +37,10 @@ interface Props {
|
|
|
37
37
|
* Allows to pass testid string for testing purposes
|
|
38
38
|
*/
|
|
39
39
|
'data-testid'?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Allows to pass a screen reader label to the component
|
|
42
|
+
*/
|
|
43
|
+
ariaLabel?: string;
|
|
40
44
|
}
|
|
41
45
|
/** @visibleName Info Dialog */
|
|
42
46
|
declare const InfoDialog: ({ position, type, "data-testid": dataTestId, ...props }: Props) => React.JSX.Element;
|
|
@@ -62,7 +62,7 @@ const InfoDialogContainer = styled.default.div `
|
|
|
62
62
|
/** @visibleName Info Dialog */
|
|
63
63
|
const InfoDialog = (_a) => {
|
|
64
64
|
var { position = 'middle', type = 'default', 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ["position", "type", 'data-testid']);
|
|
65
|
-
return (React__default.default.createElement(InfoDialogContainer, { id: props.id, "data-testid": dataTestId, className: props.className, position: position, type: type }, props.children));
|
|
65
|
+
return (React__default.default.createElement(InfoDialogContainer, { id: props.id, "data-testid": dataTestId, className: props.className, position: position, type: type, role: "region", "aria-label": props.ariaLabel }, props.children));
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
exports.default = InfoDialog;
|
|
@@ -129,6 +129,20 @@ interface Props {
|
|
|
129
129
|
* Allows to pass a custom className
|
|
130
130
|
*/
|
|
131
131
|
className?: string;
|
|
132
|
+
/**
|
|
133
|
+
* Screen reader label describing the purpose of the Input
|
|
134
|
+
*
|
|
135
|
+
* @default id
|
|
136
|
+
*/
|
|
137
|
+
ariaLabel?: string;
|
|
138
|
+
/**
|
|
139
|
+
* Screen reader label describing the password toggle
|
|
140
|
+
*/
|
|
141
|
+
passwordToggleLabel?: string;
|
|
142
|
+
/**
|
|
143
|
+
* Screen reader label describing the clear button
|
|
144
|
+
*/
|
|
145
|
+
clearButtonLabel?: string;
|
|
132
146
|
/**
|
|
133
147
|
* Allows to pass testid string for testing purposes
|
|
134
148
|
*/
|