@dnanpm/styleguide 3.9.1 → 3.9.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/build/cjs/components/Button/Button.d.ts +4 -0
- package/build/cjs/components/Button/Button.js +1 -1
- package/build/cjs/components/ButtonArrow/ButtonArrow.js +1 -1
- package/build/cjs/components/ButtonCard/ButtonCard.d.ts +4 -0
- package/build/cjs/components/ButtonCard/ButtonCard.js +1 -1
- package/build/cjs/components/ButtonIcon/ButtonIcon.js +1 -1
- package/build/cjs/components/Carousel/Carousel.d.ts +6 -0
- package/build/cjs/components/Carousel/Carousel.js +10 -0
- package/build/cjs/components/Drawer/Drawer.js +22 -21
- package/build/es/components/Button/Button.d.ts +4 -0
- package/build/es/components/Button/Button.js +1 -1
- package/build/es/components/ButtonArrow/ButtonArrow.js +1 -1
- package/build/es/components/ButtonCard/ButtonCard.d.ts +4 -0
- package/build/es/components/ButtonCard/ButtonCard.js +1 -1
- package/build/es/components/ButtonIcon/ButtonIcon.js +1 -1
- package/build/es/components/Carousel/Carousel.d.ts +6 -0
- package/build/es/components/Carousel/Carousel.js +10 -0
- package/build/es/components/Drawer/Drawer.js +23 -22
- package/package.json +1 -1
|
@@ -78,6 +78,10 @@ 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 any data-* attribute
|
|
83
|
+
*/
|
|
84
|
+
dataAttributes?: Record<`data-${string}`, string>;
|
|
81
85
|
}
|
|
82
86
|
export declare const shade: {
|
|
83
87
|
pink: {
|
|
@@ -123,7 +123,7 @@ const Element = styled__default.default.button `
|
|
|
123
123
|
/** @visibleName Button */
|
|
124
124
|
const Button = (_a) => {
|
|
125
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.href && {
|
|
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 && {
|
|
127
127
|
name: props.name,
|
|
128
128
|
disabled: props.disabled,
|
|
129
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))));
|
|
@@ -73,7 +73,7 @@ const buttonsMap = {
|
|
|
73
73
|
const ButtonArrow = (_a) => {
|
|
74
74
|
var { variant = 'primary', 'data-testid': dataTestId, 'data-track-value': dataTrackValue } = _a, props = tslib.__rest(_a, ["variant", 'data-testid', 'data-track-value']);
|
|
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 }, 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 }, 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)));
|
|
77
77
|
};
|
|
78
78
|
|
|
79
79
|
exports.default = ButtonArrow;
|
|
@@ -63,6 +63,10 @@ interface Props {
|
|
|
63
63
|
* Allows to pass testid string for testing purposes
|
|
64
64
|
*/
|
|
65
65
|
'data-testid'?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Allows to pass any data-* attribute
|
|
68
|
+
*/
|
|
69
|
+
dataAttributes?: Record<`data-${string}`, string>;
|
|
66
70
|
}
|
|
67
71
|
/** @visibleName Button Card */
|
|
68
72
|
declare const ButtonCard: ({ type, size, "data-testid": dataTestId, ...props }: Props) => React.JSX.Element;
|
|
@@ -125,7 +125,7 @@ const CtaIcon = styled__default.default(Icon.default) `
|
|
|
125
125
|
/** @visibleName Button Card */
|
|
126
126
|
const ButtonCard = (_a) => {
|
|
127
127
|
var { type = 'submit', size = 'medium', 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ["type", "size", 'data-testid']);
|
|
128
|
-
return (React__default.default.createElement(ButtonCardWrapper, Object.assign({ id: props.id, as: props.href ? 'a' : undefined, type: props.href ? undefined : type, href: props.href, onClick: props.onClick, className: props.className, "data-testid": dataTestId }, (!props.href && {
|
|
128
|
+
return (React__default.default.createElement(ButtonCardWrapper, Object.assign({ id: props.id, as: props.href ? 'a' : undefined, type: props.href ? undefined : type, href: props.href, onClick: props.onClick, className: props.className, "data-testid": dataTestId }, props.dataAttributes, (!props.href && {
|
|
129
129
|
name: props.name,
|
|
130
130
|
})),
|
|
131
131
|
React__default.default.createElement(StyledBox, { elevation: "low", size: size },
|
|
@@ -92,7 +92,7 @@ const ButtonElement = styled__default.default.button `
|
|
|
92
92
|
const ButtonIcon = (_a) => {
|
|
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, { 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 }, 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,
|
|
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 }, 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
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 }),
|
|
97
97
|
props.children && (React__default.default.createElement("span", { "data-testid": dataTestId && `${dataTestId}-text`, "data-no-close": dataNoClose }, props.children))))));
|
|
98
98
|
};
|
|
@@ -134,6 +134,12 @@ const FooterButton = styled.default.div `
|
|
|
134
134
|
grid-column: footerButton;
|
|
135
135
|
text-align: right;
|
|
136
136
|
`;
|
|
137
|
+
const Counter = styled.default.span `
|
|
138
|
+
margin-top: 0.5rem;
|
|
139
|
+
font-size: ${theme.default.fontSize.s};
|
|
140
|
+
font-weight: ${theme.default.fontWeight.medium};
|
|
141
|
+
margin-right: 1rem;
|
|
142
|
+
`;
|
|
137
143
|
/** @visibleName Carousel */
|
|
138
144
|
const Carousel = (_a) => {
|
|
139
145
|
var { 'data-testid': dataTestId } = _a, props = tslib.__rest(_a, ['data-testid']);
|
|
@@ -298,6 +304,10 @@ const Carousel = (_a) => {
|
|
|
298
304
|
React__default.default.createElement(Header, { "data-testid": dataTestId && `${dataTestId}-header` },
|
|
299
305
|
props.title && React__default.default.createElement(Title, null, props.title),
|
|
300
306
|
React__default.default.createElement(Navigation, null,
|
|
307
|
+
props.hasCounter && (React__default.default.createElement(Counter, null,
|
|
308
|
+
slideScreensCount === 0 ? 0 : currentIndex + 1,
|
|
309
|
+
"/",
|
|
310
|
+
slideScreensCount)),
|
|
301
311
|
React__default.default.createElement(ButtonArrow.default, { direction: "left", "aria-label": "Previous", onClick: handleNavigationButtonPreviousClick, disabled: currentIndex <= 0 }),
|
|
302
312
|
React__default.default.createElement(ButtonArrow.default, { direction: "right", "aria-label": "Next", onClick: handleNavigationButtonNextClick, disabled: currentIndex + visibleItems >= React.Children.count(props.children) }))),
|
|
303
313
|
React__default.default.createElement(Content, { "data-testid": dataTestId && `${dataTestId}-content` },
|
|
@@ -12,8 +12,6 @@ var common = require('../../utils/common.js');
|
|
|
12
12
|
var styledUtils = require('../../utils/styledUtils.js');
|
|
13
13
|
var Box = require('../Box/Box.js');
|
|
14
14
|
var ButtonClose = require('../ButtonClose/ButtonClose.js');
|
|
15
|
-
var Floater = require('../Floater/Floater.js');
|
|
16
|
-
var Icon = require('../Icon/Icon.js');
|
|
17
15
|
|
|
18
16
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
19
17
|
|
|
@@ -52,10 +50,10 @@ const StyledReactModal = styled.default(ReactModal__default.default) `
|
|
|
52
50
|
position: fixed;
|
|
53
51
|
top: 0;
|
|
54
52
|
${({ side }) => (side === 'left' ? 'left: 0' : 'right: 0')};
|
|
55
|
-
width:
|
|
53
|
+
width: ${({ size }) => sizeMap[size]};
|
|
56
54
|
height: 100dvh;
|
|
57
|
-
max-width: 100vw;
|
|
58
55
|
max-height: 100%;
|
|
56
|
+
max-width: calc(100vw - ${styledUtils.getMultipliedSize(theme.default.base.baseWidth, 4)});
|
|
59
57
|
transform: translateX(${({ side }) => side === 'left' && '-'}100%);
|
|
60
58
|
animation: ${slideIn} ${({ size }) => animationMap[size][0]}s forwards;
|
|
61
59
|
|
|
@@ -63,9 +61,10 @@ const StyledReactModal = styled.default(ReactModal__default.default) `
|
|
|
63
61
|
animation: ${({ side }) => slideOut(side)} ${({ size }) => animationMap[size][1]}s forwards;
|
|
64
62
|
}
|
|
65
63
|
|
|
66
|
-
${
|
|
67
|
-
width:
|
|
68
|
-
|
|
64
|
+
@media (max-width: ${sizeMap.small}) {
|
|
65
|
+
max-width: 100vw;
|
|
66
|
+
width: 100vw;
|
|
67
|
+
}
|
|
69
68
|
`;
|
|
70
69
|
const StyledReactModalOverlay = styled.default.div `
|
|
71
70
|
display: flex;
|
|
@@ -113,13 +112,16 @@ const StyledReactModalContent = styled.default.div `
|
|
|
113
112
|
const StyledBox = styled.default(Box.default) `
|
|
114
113
|
display: flex;
|
|
115
114
|
flex-direction: column;
|
|
116
|
-
justify-content: space-between;
|
|
117
115
|
border-radius: 0;
|
|
118
116
|
height: 100%;
|
|
119
|
-
overflow-y: auto;
|
|
120
117
|
position: relative;
|
|
121
|
-
|
|
122
|
-
|
|
118
|
+
border: 0;
|
|
119
|
+
`;
|
|
120
|
+
const ContentContainer = styled.default.div `
|
|
121
|
+
flex: 1 1 auto;
|
|
122
|
+
overflow: auto;
|
|
123
|
+
display: flex;
|
|
124
|
+
flex-direction: column;
|
|
123
125
|
`;
|
|
124
126
|
const Header = styled.default.div `
|
|
125
127
|
display: flex;
|
|
@@ -139,6 +141,7 @@ const Header = styled.default.div `
|
|
|
139
141
|
`;
|
|
140
142
|
const Title = styled.default.h2 `
|
|
141
143
|
font-size: ${({ size }) => (size === 'small' ? theme.default.fontSize.h2S : theme.default.fontSize.h2M)};
|
|
144
|
+
line-height: ${({ size }) => (size === 'small' ? theme.default.lineHeight.h2S : theme.default.lineHeight.h2M)};
|
|
142
145
|
color: ${({ variant }) => variant === 'light' ? theme.default.color.default.black : theme.default.color.default.white};
|
|
143
146
|
`;
|
|
144
147
|
const Subtitle = styled.default.p `
|
|
@@ -147,7 +150,7 @@ const Subtitle = styled.default.p `
|
|
|
147
150
|
`;
|
|
148
151
|
const CloseButton = styled.default(ButtonClose.default) `
|
|
149
152
|
margin: 0;
|
|
150
|
-
padding: 0.
|
|
153
|
+
padding: 0.5rem;
|
|
151
154
|
border-radius: 0 0 0 ${theme.default.radius.default};
|
|
152
155
|
background-color: ${({ variant }) => variant === 'light'
|
|
153
156
|
? theme.default.color.background.sand.E01
|
|
@@ -163,7 +166,6 @@ const Footer = styled.default.div `
|
|
|
163
166
|
width: 100%;
|
|
164
167
|
border-top: 1px solid ${theme.default.color.line.L04};
|
|
165
168
|
background-color: ${theme.default.color.background.white.default};
|
|
166
|
-
|
|
167
169
|
${common.default({ elevation: 'high', shadow: '1 0 0 0' })};
|
|
168
170
|
`;
|
|
169
171
|
const ModalOverlay = ({ ref, onClick, onMouseDown, className }, contentElement) => (React__default.default.createElement(StyledReactModalOverlay, { ref: ref, onClick: onClick, onMouseDown: onMouseDown, className: className }, contentElement));
|
|
@@ -176,18 +178,17 @@ const Drawer = (_a) => {
|
|
|
176
178
|
ReactModal__default.default.setAppElement(appElement);
|
|
177
179
|
return (React__default.default.createElement(React__default.default.Fragment, null,
|
|
178
180
|
React__default.default.createElement(StyledReactModal, { id: props.id, isOpen: props.isOpen, overlayElement: ModalOverlay, contentElement: ModalContent, onRequestClose: props.onRequestClose, portalClassName: props.className, contentLabel: props.contentLabel, shouldCloseOnEsc: isClosable, shouldCloseOnOverlayClick: isClosable, closeTimeoutMS: 300, size: size, side: side },
|
|
179
|
-
React__default.default.createElement(StyledBox, { elevation: "extraHigh", margin: props.margin, "
|
|
180
|
-
React__default.default.createElement(
|
|
181
|
-
React__default.default.createElement(Floater.default, null, closeButton && isClosable && (React__default.default.createElement(CloseButton, { onClick: props.onRequestClose, "aria-label": props.closeLabel, "data-testid": dataTestId && `${dataTestId}-close-button`, variant: variant },
|
|
182
|
-
React__default.default.createElement(Icon.default, { icon: icons.Close, color: variant === 'light'
|
|
183
|
-
? theme.default.color.default.plum
|
|
184
|
-
: theme.default.color.default.white })))),
|
|
181
|
+
React__default.default.createElement(StyledBox, { "data-testid": dataTestId, elevation: "extraHigh", margin: props.margin, padding: "0" },
|
|
182
|
+
React__default.default.createElement(ContentContainer, null,
|
|
185
183
|
React__default.default.createElement(Header, { variant: variant, "data-testid": dataTestId && `${dataTestId}-header` },
|
|
186
184
|
React__default.default.createElement(Title, { size: size, variant: variant }, props.title),
|
|
187
185
|
props.subtitle && (React__default.default.createElement(Subtitle, { size: size, variant: variant }, props.subtitle))),
|
|
186
|
+
closeButton && isClosable && (React__default.default.createElement(CloseButton, { onClick: props.onRequestClose, "aria-label": props.closeLabel, "data-testid": dataTestId && `${dataTestId}-close-button`, variant: variant },
|
|
187
|
+
React__default.default.createElement(icons.Close, { color: variant === 'light'
|
|
188
|
+
? theme.default.color.default.plum
|
|
189
|
+
: theme.default.color.default.white }))),
|
|
188
190
|
React__default.default.createElement(Content, { "data-testid": dataTestId && `${dataTestId}-content`, padding: padding }, props.children)),
|
|
189
|
-
props.footer && (React__default.default.createElement(
|
|
190
|
-
React__default.default.createElement(Footer, { "data-testid": dataTestId && `${dataTestId}-footer` }, props.footer))))),
|
|
191
|
+
props.footer && (React__default.default.createElement(Footer, { "data-testid": dataTestId && `${dataTestId}-footer` }, props.footer)))),
|
|
191
192
|
React__default.default.createElement(GlobalStyle, null)));
|
|
192
193
|
};
|
|
193
194
|
|
|
@@ -78,6 +78,10 @@ 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 any data-* attribute
|
|
83
|
+
*/
|
|
84
|
+
dataAttributes?: Record<`data-${string}`, string>;
|
|
81
85
|
}
|
|
82
86
|
export declare const shade: {
|
|
83
87
|
pink: {
|
|
@@ -114,7 +114,7 @@ const Element = styled__default.button `
|
|
|
114
114
|
/** @visibleName Button */
|
|
115
115
|
const Button = (_a) => {
|
|
116
116
|
var { type = 'submit', 'data-testid': dataTestId, 'data-no-close': dataNoClose, 'data-track-value': dataTrackValue } = _a, props = __rest(_a, ["type", 'data-testid', 'data-no-close', 'data-track-value']);
|
|
117
|
-
return (React__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.href && {
|
|
117
|
+
return (React__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 && {
|
|
118
118
|
name: props.name,
|
|
119
119
|
disabled: props.disabled,
|
|
120
120
|
})), props.loading ? (React__default.createElement(PixelLoader, { color: props.darkBg ? theme.color.default.white : theme.color.default.plum })) : (React__default.createElement("span", { "data-testid": dataTestId && `${dataTestId}-text`, "data-no-close": dataNoClose }, props.children))));
|
|
@@ -64,7 +64,7 @@ const buttonsMap = {
|
|
|
64
64
|
const ButtonArrow = (_a) => {
|
|
65
65
|
var { variant = 'primary', 'data-testid': dataTestId, 'data-track-value': dataTrackValue } = _a, props = __rest(_a, ["variant", 'data-testid', 'data-track-value']);
|
|
66
66
|
const Element = buttonsMap[variant];
|
|
67
|
-
return (React__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 }, props.direction ? (React__default.createElement(Icon, { icon: iconsMap[props.direction], size: "1rem" })) : (isValidElement(props.icon) && props.icon.type === Icon && props.icon)));
|
|
67
|
+
return (React__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.createElement(Icon, { icon: iconsMap[props.direction], size: "1rem" })) : (isValidElement(props.icon) && props.icon.type === Icon && props.icon)));
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
export { ButtonArrow as default };
|
|
@@ -63,6 +63,10 @@ interface Props {
|
|
|
63
63
|
* Allows to pass testid string for testing purposes
|
|
64
64
|
*/
|
|
65
65
|
'data-testid'?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Allows to pass any data-* attribute
|
|
68
|
+
*/
|
|
69
|
+
dataAttributes?: Record<`data-${string}`, string>;
|
|
66
70
|
}
|
|
67
71
|
/** @visibleName Button Card */
|
|
68
72
|
declare const ButtonCard: ({ type, size, "data-testid": dataTestId, ...props }: Props) => React.JSX.Element;
|
|
@@ -116,7 +116,7 @@ const CtaIcon = styled__default(Icon) `
|
|
|
116
116
|
/** @visibleName Button Card */
|
|
117
117
|
const ButtonCard = (_a) => {
|
|
118
118
|
var { type = 'submit', size = 'medium', 'data-testid': dataTestId } = _a, props = __rest(_a, ["type", "size", 'data-testid']);
|
|
119
|
-
return (React__default.createElement(ButtonCardWrapper, Object.assign({ id: props.id, as: props.href ? 'a' : undefined, type: props.href ? undefined : type, href: props.href, onClick: props.onClick, className: props.className, "data-testid": dataTestId }, (!props.href && {
|
|
119
|
+
return (React__default.createElement(ButtonCardWrapper, Object.assign({ id: props.id, as: props.href ? 'a' : undefined, type: props.href ? undefined : type, href: props.href, onClick: props.onClick, className: props.className, "data-testid": dataTestId }, props.dataAttributes, (!props.href && {
|
|
120
120
|
name: props.name,
|
|
121
121
|
})),
|
|
122
122
|
React__default.createElement(StyledBox, { elevation: "low", size: size },
|
|
@@ -83,7 +83,7 @@ const ButtonElement = styled__default.button `
|
|
|
83
83
|
const ButtonIcon = (_a) => {
|
|
84
84
|
var { icon = EditUnderline, 'data-testid': dataTestId, 'data-no-close': dataNoClose, 'data-track-value': dataTrackValue } = _a, props = __rest(_a, ["icon", 'data-testid', 'data-no-close', 'data-track-value']);
|
|
85
85
|
const position = props.isReversed ? 'right' : 'left';
|
|
86
|
-
return (React__default.createElement(ButtonElement, { 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 }, props.loading ? (React__default.createElement(PixelLoader, { color: props.darkBg ? theme.color.default.white : theme.color.default.black })) : (React__default.createElement(React__default.Fragment, null,
|
|
86
|
+
return (React__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 }, props.dataAttributes), props.loading ? (React__default.createElement(PixelLoader, { color: props.darkBg ? theme.color.default.white : theme.color.default.black })) : (React__default.createElement(React__default.Fragment, null,
|
|
87
87
|
React__default.createElement(Icon, { icon: icon, color: props.darkBg ? theme.color.default.white : theme.color.default.pink, size: props.small ? '1.25rem' : '1.5rem', position: props.children ? position : undefined }),
|
|
88
88
|
props.children && (React__default.createElement("span", { "data-testid": dataTestId && `${dataTestId}-text`, "data-no-close": dataNoClose }, props.children))))));
|
|
89
89
|
};
|
|
@@ -126,6 +126,12 @@ const FooterButton = styled.div `
|
|
|
126
126
|
grid-column: footerButton;
|
|
127
127
|
text-align: right;
|
|
128
128
|
`;
|
|
129
|
+
const Counter = styled.span `
|
|
130
|
+
margin-top: 0.5rem;
|
|
131
|
+
font-size: ${theme.fontSize.s};
|
|
132
|
+
font-weight: ${theme.fontWeight.medium};
|
|
133
|
+
margin-right: 1rem;
|
|
134
|
+
`;
|
|
129
135
|
/** @visibleName Carousel */
|
|
130
136
|
const Carousel = (_a) => {
|
|
131
137
|
var { 'data-testid': dataTestId } = _a, props = __rest(_a, ['data-testid']);
|
|
@@ -290,6 +296,10 @@ const Carousel = (_a) => {
|
|
|
290
296
|
React__default.createElement(Header, { "data-testid": dataTestId && `${dataTestId}-header` },
|
|
291
297
|
props.title && React__default.createElement(Title, null, props.title),
|
|
292
298
|
React__default.createElement(Navigation, null,
|
|
299
|
+
props.hasCounter && (React__default.createElement(Counter, null,
|
|
300
|
+
slideScreensCount === 0 ? 0 : currentIndex + 1,
|
|
301
|
+
"/",
|
|
302
|
+
slideScreensCount)),
|
|
293
303
|
React__default.createElement(ButtonArrow, { direction: "left", "aria-label": "Previous", onClick: handleNavigationButtonPreviousClick, disabled: currentIndex <= 0 }),
|
|
294
304
|
React__default.createElement(ButtonArrow, { direction: "right", "aria-label": "Next", onClick: handleNavigationButtonNextClick, disabled: currentIndex + visibleItems >= Children.count(props.children) }))),
|
|
295
305
|
React__default.createElement(Content, { "data-testid": dataTestId && `${dataTestId}-content` },
|
|
@@ -5,11 +5,9 @@ import ReactModal from 'react-modal';
|
|
|
5
5
|
import styled, { createGlobalStyle, keyframes } from '../../themes/styled.js';
|
|
6
6
|
import theme from '../../themes/theme.js';
|
|
7
7
|
import getElevationShadow from '../../utils/common.js';
|
|
8
|
-
import {
|
|
8
|
+
import { getMultipliedSize } from '../../utils/styledUtils.js';
|
|
9
9
|
import Box from '../Box/Box.js';
|
|
10
10
|
import ButtonClose from '../ButtonClose/ButtonClose.js';
|
|
11
|
-
import Floater from '../Floater/Floater.js';
|
|
12
|
-
import Icon from '../Icon/Icon.js';
|
|
13
11
|
|
|
14
12
|
const sizeMap = {
|
|
15
13
|
small: '375px',
|
|
@@ -43,10 +41,10 @@ const StyledReactModal = styled(ReactModal) `
|
|
|
43
41
|
position: fixed;
|
|
44
42
|
top: 0;
|
|
45
43
|
${({ side }) => (side === 'left' ? 'left: 0' : 'right: 0')};
|
|
46
|
-
width:
|
|
44
|
+
width: ${({ size }) => sizeMap[size]};
|
|
47
45
|
height: 100dvh;
|
|
48
|
-
max-width: 100vw;
|
|
49
46
|
max-height: 100%;
|
|
47
|
+
max-width: calc(100vw - ${getMultipliedSize(theme.base.baseWidth, 4)});
|
|
50
48
|
transform: translateX(${({ side }) => side === 'left' && '-'}100%);
|
|
51
49
|
animation: ${slideIn} ${({ size }) => animationMap[size][0]}s forwards;
|
|
52
50
|
|
|
@@ -54,9 +52,10 @@ const StyledReactModal = styled(ReactModal) `
|
|
|
54
52
|
animation: ${({ side }) => slideOut(side)} ${({ size }) => animationMap[size][1]}s forwards;
|
|
55
53
|
}
|
|
56
54
|
|
|
57
|
-
${
|
|
58
|
-
width:
|
|
59
|
-
|
|
55
|
+
@media (max-width: ${sizeMap.small}) {
|
|
56
|
+
max-width: 100vw;
|
|
57
|
+
width: 100vw;
|
|
58
|
+
}
|
|
60
59
|
`;
|
|
61
60
|
const StyledReactModalOverlay = styled.div `
|
|
62
61
|
display: flex;
|
|
@@ -104,13 +103,16 @@ const StyledReactModalContent = styled.div `
|
|
|
104
103
|
const StyledBox = styled(Box) `
|
|
105
104
|
display: flex;
|
|
106
105
|
flex-direction: column;
|
|
107
|
-
justify-content: space-between;
|
|
108
106
|
border-radius: 0;
|
|
109
107
|
height: 100%;
|
|
110
|
-
overflow-y: auto;
|
|
111
108
|
position: relative;
|
|
112
|
-
|
|
113
|
-
|
|
109
|
+
border: 0;
|
|
110
|
+
`;
|
|
111
|
+
const ContentContainer = styled.div `
|
|
112
|
+
flex: 1 1 auto;
|
|
113
|
+
overflow: auto;
|
|
114
|
+
display: flex;
|
|
115
|
+
flex-direction: column;
|
|
114
116
|
`;
|
|
115
117
|
const Header = styled.div `
|
|
116
118
|
display: flex;
|
|
@@ -130,6 +132,7 @@ const Header = styled.div `
|
|
|
130
132
|
`;
|
|
131
133
|
const Title = styled.h2 `
|
|
132
134
|
font-size: ${({ size }) => (size === 'small' ? theme.fontSize.h2S : theme.fontSize.h2M)};
|
|
135
|
+
line-height: ${({ size }) => (size === 'small' ? theme.lineHeight.h2S : theme.lineHeight.h2M)};
|
|
133
136
|
color: ${({ variant }) => variant === 'light' ? theme.color.default.black : theme.color.default.white};
|
|
134
137
|
`;
|
|
135
138
|
const Subtitle = styled.p `
|
|
@@ -138,7 +141,7 @@ const Subtitle = styled.p `
|
|
|
138
141
|
`;
|
|
139
142
|
const CloseButton = styled(ButtonClose) `
|
|
140
143
|
margin: 0;
|
|
141
|
-
padding: 0.
|
|
144
|
+
padding: 0.5rem;
|
|
142
145
|
border-radius: 0 0 0 ${theme.radius.default};
|
|
143
146
|
background-color: ${({ variant }) => variant === 'light'
|
|
144
147
|
? theme.color.background.sand.E01
|
|
@@ -154,7 +157,6 @@ const Footer = styled.div `
|
|
|
154
157
|
width: 100%;
|
|
155
158
|
border-top: 1px solid ${theme.color.line.L04};
|
|
156
159
|
background-color: ${theme.color.background.white.default};
|
|
157
|
-
|
|
158
160
|
${getElevationShadow({ elevation: 'high', shadow: '1 0 0 0' })};
|
|
159
161
|
`;
|
|
160
162
|
const ModalOverlay = ({ ref, onClick, onMouseDown, className }, contentElement) => (React__default.createElement(StyledReactModalOverlay, { ref: ref, onClick: onClick, onMouseDown: onMouseDown, className: className }, contentElement));
|
|
@@ -167,18 +169,17 @@ const Drawer = (_a) => {
|
|
|
167
169
|
ReactModal.setAppElement(appElement);
|
|
168
170
|
return (React__default.createElement(React__default.Fragment, null,
|
|
169
171
|
React__default.createElement(StyledReactModal, { id: props.id, isOpen: props.isOpen, overlayElement: ModalOverlay, contentElement: ModalContent, onRequestClose: props.onRequestClose, portalClassName: props.className, contentLabel: props.contentLabel, shouldCloseOnEsc: isClosable, shouldCloseOnOverlayClick: isClosable, closeTimeoutMS: 300, size: size, side: side },
|
|
170
|
-
React__default.createElement(StyledBox, { elevation: "extraHigh", margin: props.margin, "
|
|
171
|
-
React__default.createElement(
|
|
172
|
-
React__default.createElement(Floater, null, closeButton && isClosable && (React__default.createElement(CloseButton, { onClick: props.onRequestClose, "aria-label": props.closeLabel, "data-testid": dataTestId && `${dataTestId}-close-button`, variant: variant },
|
|
173
|
-
React__default.createElement(Icon, { icon: Close, color: variant === 'light'
|
|
174
|
-
? theme.color.default.plum
|
|
175
|
-
: theme.color.default.white })))),
|
|
172
|
+
React__default.createElement(StyledBox, { "data-testid": dataTestId, elevation: "extraHigh", margin: props.margin, padding: "0" },
|
|
173
|
+
React__default.createElement(ContentContainer, null,
|
|
176
174
|
React__default.createElement(Header, { variant: variant, "data-testid": dataTestId && `${dataTestId}-header` },
|
|
177
175
|
React__default.createElement(Title, { size: size, variant: variant }, props.title),
|
|
178
176
|
props.subtitle && (React__default.createElement(Subtitle, { size: size, variant: variant }, props.subtitle))),
|
|
177
|
+
closeButton && isClosable && (React__default.createElement(CloseButton, { onClick: props.onRequestClose, "aria-label": props.closeLabel, "data-testid": dataTestId && `${dataTestId}-close-button`, variant: variant },
|
|
178
|
+
React__default.createElement(Close, { color: variant === 'light'
|
|
179
|
+
? theme.color.default.plum
|
|
180
|
+
: theme.color.default.white }))),
|
|
179
181
|
React__default.createElement(Content, { "data-testid": dataTestId && `${dataTestId}-content`, padding: padding }, props.children)),
|
|
180
|
-
props.footer && (React__default.createElement(
|
|
181
|
-
React__default.createElement(Footer, { "data-testid": dataTestId && `${dataTestId}-footer` }, props.footer))))),
|
|
182
|
+
props.footer && (React__default.createElement(Footer, { "data-testid": dataTestId && `${dataTestId}-footer` }, props.footer)))),
|
|
182
183
|
React__default.createElement(GlobalStyle, null)));
|
|
183
184
|
};
|
|
184
185
|
|