@stokr/components-library 3.3.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AdminDashboard/Table/Table.styles.js +7 -13
- package/dist/components/BasicTable/BasicTable.js +1 -3
- package/dist/components/BlogPost/BlogPost.styles.js +2 -2
- package/dist/components/Button/Button.styles.d.ts +28 -0
- package/dist/components/Button/Button.styles.js +27 -38
- package/dist/components/Button/GlareButton.js +2 -2
- package/dist/components/CardTabs/CardTabs.d.ts +41 -0
- package/dist/components/CardTabs/CardTabs.js +130 -0
- package/dist/components/CardTabs/CardTabs.styles.d.ts +56 -0
- package/dist/components/CardTabs/CardTabs.styles.js +171 -0
- package/dist/components/Chips/Chip.js +32 -8
- package/dist/components/Chips/Chip.styles.js +24 -28
- package/dist/components/Collapsible/Collapsible.d.ts +18 -0
- package/dist/components/Collapsible/Collapsible.js +44 -0
- package/dist/components/Collapsible/Collapsible.styles.d.ts +18 -0
- package/dist/components/Collapsible/Collapsible.styles.js +94 -0
- package/dist/components/ComponentWrapper/ComponentWrapper.styles.d.ts +31 -0
- package/dist/components/ComponentWrapper/ComponentWrapper.styles.js +107 -109
- package/dist/components/Copy/Copy.d.ts +20 -0
- package/dist/components/Copy/Copy.js +0 -9
- package/dist/components/Copy/copySource.d.ts +20 -0
- package/dist/components/Copy/flatten.d.ts +3 -0
- package/dist/components/CopyToClipboardTooltip/CopyToClipboardTooltip.d.ts +15 -0
- package/dist/components/CopyToClipboardTooltip/CopyToClipboardTooltip.styles.d.ts +6 -0
- package/dist/components/CryptoAddress/CryptoAddress.js +3 -3
- package/dist/components/InfoIcon/InfoIcon.d.ts +33 -0
- package/dist/components/InfoIcon/InfoIcon.styles.d.ts +12 -0
- package/dist/components/Input/Input.d.ts +23 -0
- package/dist/components/Input/Input.js +17 -27
- package/dist/components/Input/Input.styles.d.ts +15 -0
- package/dist/components/Input/InputPassword.js +1 -0
- package/dist/components/Input/InputPassword.styles.js +4 -1
- package/dist/components/Input/MultiSelect.js +1 -0
- package/dist/components/Input/RangeInput.js +49 -53
- package/dist/components/Input/Textarea.styles.js +1 -1
- package/dist/components/MaterialIcon/MaterialIcon.d.ts +43 -0
- package/dist/components/MaterialIcon/MaterialIcon.js +56 -0
- package/dist/components/MaterialIcon/MaterialIcon.styles.d.ts +9 -0
- package/dist/components/MaterialIcon/MaterialIcon.styles.js +25 -0
- package/dist/components/MaterialIcon/iconConfig.d.ts +3 -0
- package/dist/components/MaterialIcon/iconConfig.js +11 -0
- package/dist/components/Modal/Modal.d.ts +26 -0
- package/dist/components/Modal/Modal.js +1 -18
- package/dist/components/Modal/Modal.styles.d.ts +59 -0
- package/dist/components/Modal/Modal.styles.js +18 -3
- package/dist/components/Modal/PaymentModal.js +16 -19
- package/dist/components/Modal/SideModal.d.ts +47 -0
- package/dist/components/Modal/SideModal.js +197 -73
- package/dist/components/Modal/SideModal.styles.d.ts +28 -0
- package/dist/components/Modal/SideModal.styles.js +56 -16
- package/dist/components/Modal/SideModalContext.d.ts +12 -0
- package/dist/components/Modal/SideModalContext.js +10 -0
- package/dist/components/Modal/SideModalParts.d.ts +20 -0
- package/dist/components/Modal/SideModalParts.js +95 -0
- package/dist/components/Pagination/Pagination.js +2 -2
- package/dist/components/Pagination/PaginationControls.js +2 -2
- package/dist/components/Payment/TimerComponent.js +1 -2
- package/dist/components/RefreshButton/RefreshButton.styles.js +2 -2
- package/dist/components/RequestDataBox/RequestDataBox.js +2 -2
- package/dist/components/Section/Section.d.ts +32 -0
- package/dist/components/Section/Section.js +80 -0
- package/dist/components/Section/Section.styles.d.ts +34 -0
- package/dist/components/Section/Section.styles.js +143 -0
- package/dist/components/Skeleton/Skeleton.d.ts +44 -0
- package/dist/components/Skeleton/Skeleton.js +48 -0
- package/dist/components/Skeleton/Skeleton.styles.d.ts +14 -0
- package/dist/components/Skeleton/Skeleton.styles.js +51 -0
- package/dist/components/StokrLoader/StokrLoader.d.ts +20 -0
- package/dist/components/StokrLoader/StokrLoader.js +21 -22
- package/dist/components/Tabs/Tabs.styles.js +3 -1
- package/dist/components/TabsNav/TabsNav.js +1 -1
- package/dist/components/TabsNav/TabsNav.styles.js +1 -1
- package/dist/components/Text/Text.styles.d.ts +20 -0
- package/dist/components/Text/Text.styles.js +2 -2
- package/dist/components/TextLink/TextLink.styles.js +1 -2
- package/dist/components/Tooltip/Tooltip.d.ts +42 -0
- package/dist/components/Tooltip/Tooltip.styles.d.ts +10 -0
- package/dist/constants/globalVariables.js +1 -39
- package/dist/hooks/useMediaQuery.d.ts +7 -0
- package/dist/hooks/useMediaQuery.js +19 -0
- package/dist/index.d.ts +299 -0
- package/dist/index.js +97 -211
- package/dist/styles/colors.d.ts +68 -0
- package/dist/styles/colors.js +13 -1
- package/dist/styles/elevation.d.ts +13 -0
- package/dist/styles/elevation.js +15 -0
- package/dist/styles/fonts.js +0 -65
- package/dist/styles/global.js +0 -2
- package/dist/styles/grid.d.ts +27 -0
- package/dist/styles/grid.js +8 -1
- package/dist/styles/rwd.d.ts +48 -0
- package/dist/styles/rwd.js +33 -17
- package/dist/styles/spacing.d.ts +36 -0
- package/dist/styles/spacing.js +30 -0
- package/dist/styles/theme.d.ts +92 -0
- package/dist/styles/theme.js +2 -0
- package/dist/styles/typography.d.ts +42 -0
- package/dist/styles/typography.js +56 -0
- package/dist/utils/capitalize.d.ts +2 -0
- package/dist/utils/capitalize.js +4 -0
- package/dist/utils/copy-text-to-clipboard.d.ts +10 -0
- package/dist/utils/copyToClipboard.d.ts +27 -0
- package/dist/utils/csv.d.ts +14 -0
- package/dist/utils/csv.js +25 -0
- package/dist/utils/customHooks.d.ts +20 -0
- package/dist/utils/customHooks.js +16 -11
- package/dist/utils/fix-decimals.d.ts +14 -0
- package/dist/utils/formatAmount.d.ts +109 -0
- package/dist/utils/formatAmount.js +170 -0
- package/dist/utils/formatCurrencyValue.d.ts +46 -0
- package/dist/utils/formatCurrencyValue.js +6 -21
- package/dist/utils/formatDate.d.ts +19 -0
- package/dist/utils/formatDate.js +44 -0
- package/dist/utils/get-short-address.d.ts +13 -0
- package/dist/utils/get-short-address.js +9 -2
- package/dist/utils/inertProp.d.ts +5 -0
- package/dist/utils/inertProp.js +6 -0
- package/dist/utils/isUSInvestor.d.ts +4 -0
- package/dist/utils/km_ify.d.ts +5 -0
- package/dist/utils/km_ify.js +19 -18
- package/dist/utils/password-validation.d.ts +16 -0
- package/dist/utils/saveAs.d.ts +2 -0
- package/dist/utils/saveAs.js +5 -2
- package/dist/utils/scrollUtils.d.ts +25 -0
- package/dist/utils/scrollUtils.js +13 -10
- package/dist/utils/transition.d.ts +45 -0
- package/dist/utils/transition.js +0 -28
- package/package.json +11 -12
- package/dist/components/AccountBalance/AccountBalance.js +0 -35
- package/dist/components/AccountBalance/AccountBalance.styles.js +0 -48
- package/dist/components/AdminDashboard/Table/Table.js +0 -123
- package/dist/components/ButtonContainer/ButtonContainer.styles.js +0 -51
- package/dist/components/CryptoAddressDetails/CryptoAddressDetails.js +0 -34
- package/dist/components/CryptoAddressDetails/CryptoAddressDetails.styles.js +0 -125
- package/dist/components/DoubleButton/DoubleButton.styles.js +0 -27
- package/dist/components/ErrorMessage/ErrorMessage.styles.js +0 -9
- package/dist/components/Icon/Icon2.js +0 -12
- package/dist/components/Input/InputUsername.js +0 -92
- package/dist/components/Input/RangeInput.styles.js +0 -129
- package/dist/components/InvestmentStat/InvestmentStat.js +0 -24
- package/dist/components/InvestmentStat/InvestmentStat.styles.js +0 -62
- package/dist/components/LatestUpdate/LatestUpdate.js +0 -24
- package/dist/components/LatestUpdate/LatestUpdate.styles.js +0 -90
- package/dist/components/MultiProgressBar/MultiProgressBar.js +0 -28
- package/dist/components/MultiProgressBar/MultiProgressBar.styles.js +0 -105
- package/dist/components/PageTransition/PageTransition.js +0 -51
- package/dist/components/ProfileStat/ProfileStat.js +0 -29
- package/dist/components/ProfileStat/ProfileStat.styles.js +0 -90
- package/dist/components/SEO/SEO.js +0 -66
- package/dist/components/SideLine/SideLine.js +0 -7
- package/dist/components/SideLine/SideLine.styles.js +0 -33
- package/dist/components/Slider/Slider.js +0 -31
- package/dist/components/Slider/Slider.styles.js +0 -120
- package/dist/components/StatusBadge/StatusBadge.styles.js +0 -18
- package/dist/components/StokrLoader/media.js +0 -23
- package/dist/components/SvgIcons/CameraSvg.js +0 -31
- package/dist/components/SvgIcons/DocumentBackSvg.js +0 -20
- package/dist/components/SvgIcons/DocumentSmallSvg.js +0 -41
- package/dist/components/SvgIcons/DocumentSvg.js +0 -39
- package/dist/components/SvgIcons/EthSvg.js +0 -28
- package/dist/components/SvgIcons/EurSvg.js +0 -27
- package/dist/components/SvgIcons/FaceScanIconSvg.js +0 -17
- package/dist/components/SvgIcons/FourSvg.js +0 -7
- package/dist/components/SvgIcons/Glassess.js +0 -26
- package/dist/components/SvgIcons/OneSvg.js +0 -10
- package/dist/components/SvgIcons/PassportSvg.js +0 -37
- package/dist/components/SvgIcons/SocialInstagram.js +0 -13
- package/dist/components/SvgIcons/SocialMedium.js +0 -21
- package/dist/components/SvgIcons/SocialReddit.js +0 -21
- package/dist/components/SvgIcons/SocialYoutube.js +0 -22
- package/dist/components/SvgIcons/ThreeSvg.js +0 -7
- package/dist/components/SvgIcons/TwoSidedDocumentSvg.js +0 -48
- package/dist/components/SvgIcons/TwoSvg.js +0 -10
- package/dist/components/SvgIcons/UpdateDefaultSvg.js +0 -12
- package/dist/components/SvgIcons/UpdateHardSvg.js +0 -10
- package/dist/components/SvgIcons/UpdateSoftSvg.js +0 -11
- package/dist/components/SvgIcons/UploadSvg.js +0 -12
- package/dist/components/TeamOverview/TeamOverview.js +0 -79
- package/dist/components/TeamOverview/TeamOverview.styles.js +0 -167
- package/dist/components/TransactionDetails/TransactionDetails.js +0 -27
- package/dist/components/TransactionDetails/TransactionDetails.styles.js +0 -38
- package/dist/components/TransactionInfo/TransactionInfo.js +0 -41
- package/dist/components/TransactionInfo/TransactionInfo.styles.js +0 -75
- package/dist/components/icons/Arrow.js +0 -38
- package/dist/components/icons/Check.js +0 -16
- package/dist/components/icons/Facebook.js +0 -10
- package/dist/components/icons/Info.js +0 -27
- package/dist/components/icons/Instagram.js +0 -10
- package/dist/components/icons/LinkIcon.js +0 -49
- package/dist/components/icons/LinkedIn.js +0 -13
- package/dist/components/icons/Medium.js +0 -13
- package/dist/components/icons/Reddit.js +0 -16
- package/dist/components/icons/Share.js +0 -31
- package/dist/components/icons/Telegram.js +0 -13
- package/dist/components/icons/Twitter.js +0 -10
- package/dist/components/icons/X.js +0 -10
- package/dist/components/icons/Youtube.js +0 -10
- package/dist/components/icons/index.js +0 -32
- package/dist/components/landing-page/List.js +0 -51
- package/dist/components/landing-page/PageContent.js +0 -65
- package/dist/components/landing-page/PageText.js +0 -171
- package/dist/components/landing-page/PageTitle.js +0 -259
- package/dist/constants/style.js +0 -48
- package/dist/favicon.ico +0 -0
- package/dist/logo192.png +0 -0
- package/dist/logo512.png +0 -0
- package/dist/manifest.json +0 -25
- package/dist/robots.txt +0 -3
- package/dist/static/fonts/OpenSans/OpenSans-Bold.ttf +0 -0
- package/dist/static/fonts/OpenSans/OpenSans-Bold.ttf.js +0 -4
- package/dist/static/fonts/OpenSans/OpenSans-Bold.woff +0 -0
- package/dist/static/fonts/OpenSans/OpenSans-Bold.woff.js +0 -4
- package/dist/static/fonts/OpenSans/OpenSans-Bold.woff2 +0 -0
- package/dist/static/fonts/OpenSans/OpenSans-Bold.woff2.js +0 -4
- package/dist/static/fonts/OpenSans/OpenSans-ExtraBold.ttf +0 -0
- package/dist/static/fonts/OpenSans/OpenSans-ExtraBold.ttf.js +0 -4
- package/dist/static/fonts/OpenSans/OpenSans-ExtraBold.woff +0 -0
- package/dist/static/fonts/OpenSans/OpenSans-ExtraBold.woff.js +0 -4
- package/dist/static/fonts/OpenSans/OpenSans-ExtraBold.woff2 +0 -0
- package/dist/static/fonts/OpenSans/OpenSans-ExtraBold.woff2.js +0 -4
- package/dist/static/fonts/OpenSans/OpenSans-Light.ttf +0 -0
- package/dist/static/fonts/OpenSans/OpenSans-Light.ttf.js +0 -4
- package/dist/static/fonts/OpenSans/OpenSans-Light.woff +0 -0
- package/dist/static/fonts/OpenSans/OpenSans-Light.woff.js +0 -4
- package/dist/static/fonts/OpenSans/OpenSans-Light.woff2 +0 -0
- package/dist/static/fonts/OpenSans/OpenSans-Light.woff2.js +0 -4
- package/dist/static/fonts/OpenSans/OpenSans-Regular.ttf +0 -0
- package/dist/static/fonts/OpenSans/OpenSans-Regular.ttf.js +0 -4
- package/dist/static/fonts/OpenSans/OpenSans-Regular.woff +0 -0
- package/dist/static/fonts/OpenSans/OpenSans-Regular.woff.js +0 -4
- package/dist/static/fonts/OpenSans/OpenSans-Regular.woff2 +0 -0
- package/dist/static/fonts/OpenSans/OpenSans-Regular.woff2.js +0 -4
- package/dist/static/fonts/OpenSans/OpenSans-SemiBold.ttf +0 -0
- package/dist/static/fonts/OpenSans/OpenSans-SemiBold.ttf.js +0 -4
- package/dist/static/fonts/OpenSans/OpenSans-SemiBold.woff +0 -0
- package/dist/static/fonts/OpenSans/OpenSans-SemiBold.woff.js +0 -4
- package/dist/static/fonts/OpenSans/OpenSans-SemiBold.woff2 +0 -0
- package/dist/static/fonts/OpenSans/OpenSans-SemiBold.woff2.js +0 -4
- package/dist/static/images/avatar-placeholder.png.js +0 -4
- package/dist/styles/reactTippy.js +0 -5
- package/dist/styles/semanticUi.js +0 -84
- package/dist/utils/check-sale-time-left.js +0 -85
- package/dist/utils/moment.js +0 -26
|
@@ -1,55 +1,95 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
2
|
import { colors } from "../../styles/colors.js";
|
|
3
|
+
import { space, radius } from "../../styles/spacing.js";
|
|
4
|
+
const toCss = (size, unit) => typeof size === "number" ? `${size}${unit}` : size;
|
|
3
5
|
const SideModalRoot = styled.div`
|
|
4
6
|
position: fixed;
|
|
5
7
|
top: 0;
|
|
6
8
|
left: 0;
|
|
7
9
|
right: 0;
|
|
8
10
|
bottom: 0;
|
|
9
|
-
z-index:
|
|
11
|
+
z-index: ${({ $zIndex }) => $zIndex};
|
|
12
|
+
${({ $interactiveBehind }) => $interactiveBehind && "pointer-events: none;"}
|
|
10
13
|
`;
|
|
11
|
-
const Dimmer = styled.div
|
|
12
|
-
shouldForwardProp: (props) => !["isVisible"].includes(props)
|
|
13
|
-
})`
|
|
14
|
+
const Dimmer = styled.div`
|
|
14
15
|
position: absolute;
|
|
15
16
|
top: 0;
|
|
16
17
|
left: 0;
|
|
17
18
|
right: 0;
|
|
18
19
|
bottom: 0;
|
|
19
|
-
background-color:
|
|
20
|
+
background-color: ${({ $color }) => $color};
|
|
20
21
|
display: flex;
|
|
21
|
-
justify-content: flex-end;
|
|
22
|
+
justify-content: ${({ $side }) => $side === "left" ? "flex-start" : "flex-end"};
|
|
22
23
|
align-items: stretch;
|
|
23
|
-
opacity: ${(
|
|
24
|
+
opacity: ${({ $isVisible }) => $isVisible ? 1 : 0};
|
|
24
25
|
transition: opacity 0.3s ease-in-out;
|
|
25
|
-
pointer-events: ${(
|
|
26
|
+
pointer-events: ${({ $isVisible, $interactiveBehind }) => $isVisible && !$interactiveBehind ? "auto" : "none"};
|
|
26
27
|
`;
|
|
27
|
-
const SideModalBox = styled.div
|
|
28
|
-
shouldForwardProp: (props) => !["width", "minWidth", "isVisible"].includes(props)
|
|
29
|
-
})`
|
|
28
|
+
const SideModalBox = styled.div`
|
|
30
29
|
position: relative;
|
|
31
|
-
width: ${(
|
|
32
|
-
min-width: ${(
|
|
30
|
+
width: ${({ $width }) => toCss($width, "%")};
|
|
31
|
+
min-width: ${({ $minWidth }) => toCss($minWidth, "px")};
|
|
33
32
|
max-width: 90%;
|
|
34
33
|
height: 100%;
|
|
35
34
|
background-color: ${colors.white};
|
|
36
|
-
box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
|
|
35
|
+
box-shadow: ${({ $side }) => $side === "left" ? "2px" : "-2px"} 0 8px rgba(0, 0, 0, 0.15);
|
|
37
36
|
display: flex;
|
|
38
37
|
flex-direction: column;
|
|
39
38
|
overflow-y: auto;
|
|
40
|
-
transform: translateX(${(
|
|
39
|
+
transform: translateX(${({ $isVisible, $side }) => $isVisible ? "0" : $side === "left" ? "-100%" : "100%"});
|
|
41
40
|
transition: transform 0.3s ease-in-out;
|
|
42
41
|
z-index: 1;
|
|
43
42
|
pointer-events: auto;
|
|
43
|
+
--side-modal-padding: ${({ $padding }) => toCss(Array.isArray($padding) ? $padding[0] : $padding, "px")};
|
|
44
|
+
|
|
45
|
+
/* Same edge as the phone width rule below (max-width: 768px). */
|
|
46
|
+
@media (min-width: 769px) {
|
|
47
|
+
--side-modal-padding: ${({ $padding }) => toCss(Array.isArray($padding) ? $padding[1] : $padding, "px")};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&:focus {
|
|
51
|
+
outline: none;
|
|
52
|
+
}
|
|
44
53
|
|
|
45
54
|
@media (max-width: 768px) {
|
|
46
55
|
width: 90%;
|
|
47
56
|
min-width: 90%;
|
|
48
57
|
max-width: 90%;
|
|
58
|
+
|
|
59
|
+
${({ $fullWidthOnMobile }) => $fullWidthOnMobile && css`
|
|
60
|
+
width: 100%;
|
|
61
|
+
min-width: 100%;
|
|
62
|
+
max-width: 100%;
|
|
63
|
+
box-shadow: none;
|
|
64
|
+
`}
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
const OutlinedCloseButton = styled.button`
|
|
68
|
+
position: ${({ $inHeader }) => $inHeader ? "static" : "absolute"};
|
|
69
|
+
top: ${space[6]};
|
|
70
|
+
right: ${space[6]};
|
|
71
|
+
z-index: 4;
|
|
72
|
+
display: inline-flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
justify-content: center;
|
|
75
|
+
width: 40px;
|
|
76
|
+
height: 40px;
|
|
77
|
+
padding: 0;
|
|
78
|
+
background: ${colors.white};
|
|
79
|
+
border: 2px solid ${colors.lightGrey};
|
|
80
|
+
border-radius: ${radius.full};
|
|
81
|
+
color: ${colors.black};
|
|
82
|
+
cursor: pointer;
|
|
83
|
+
transition: border-color 0.2s;
|
|
84
|
+
|
|
85
|
+
&:hover,
|
|
86
|
+
&:focus-visible {
|
|
87
|
+
border-color: ${colors.black};
|
|
49
88
|
}
|
|
50
89
|
`;
|
|
51
90
|
export {
|
|
52
91
|
Dimmer,
|
|
92
|
+
OutlinedCloseButton,
|
|
53
93
|
SideModalBox,
|
|
54
94
|
SideModalRoot
|
|
55
95
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface SideModalContextValue {
|
|
3
|
+
titleId?: string;
|
|
4
|
+
/** The close button to show in a header (null when the panel keeps its own). */
|
|
5
|
+
closeButton: ReactNode;
|
|
6
|
+
/** The filled close button sits in the panel's corner, so a header leaves room for it. */
|
|
7
|
+
cornerButton: boolean;
|
|
8
|
+
/** A SideModalHeader calls this on mount, so the panel moves its close button there and is named by the title. */
|
|
9
|
+
registerHeader: () => () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const SideModalContext: import('react').Context<SideModalContextValue>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface SideModalHeaderProps {
|
|
3
|
+
title: ReactNode;
|
|
4
|
+
subtitle?: ReactNode;
|
|
5
|
+
/** `md`: section title (new design). `lg`: the dashboards' large uppercase title. */
|
|
6
|
+
size?: 'md' | 'lg';
|
|
7
|
+
/** A rule under the header. */
|
|
8
|
+
divided?: boolean;
|
|
9
|
+
/** Extra content under the title, e.g. tabs or a status. */
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Header of a `SideModal`: names the panel and holds the round close button. It stays fixed only when the content
|
|
14
|
+
* below is in a `SideModalBody`; otherwise it scrolls away with the content.
|
|
15
|
+
*/
|
|
16
|
+
export declare const SideModalHeader: ({ title, subtitle, size, divided, children }: SideModalHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
/** Scrolls between the header and the footer; shadows show when there is more to scroll. */
|
|
18
|
+
export declare const SideModalBody: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
19
|
+
/** Fixed footer of a `SideModal`, e.g. the action buttons. */
|
|
20
|
+
export declare const SideModalFooter: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useContext, useEffect, useLayoutEffect } from "react";
|
|
3
|
+
import styled, { css } from "styled-components";
|
|
4
|
+
import { colors } from "../../styles/colors.js";
|
|
5
|
+
import { space } from "../../styles/spacing.js";
|
|
6
|
+
import { typography } from "../../styles/typography.js";
|
|
7
|
+
import { SideModalContext } from "./SideModalContext.js";
|
|
8
|
+
const useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
9
|
+
const sidePadding = css`
|
|
10
|
+
padding-right: var(--side-modal-padding, 24px);
|
|
11
|
+
padding-left: var(--side-modal-padding, 24px);
|
|
12
|
+
`;
|
|
13
|
+
const HeaderRoot = styled.div`
|
|
14
|
+
${sidePadding};
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-shrink: 0;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: space-between;
|
|
19
|
+
gap: ${space[4]};
|
|
20
|
+
padding-top: ${space[8]};
|
|
21
|
+
padding-bottom: ${space[5]};
|
|
22
|
+
/* Room for the filled close button in the panel's corner. */
|
|
23
|
+
${({ $cornerButton }) => $cornerButton && "padding-right: calc(var(--side-modal-padding, 24px) + 40px);"}
|
|
24
|
+
|
|
25
|
+
/* The rule lines up with the content, inside the side padding. */
|
|
26
|
+
${({ $divided }) => $divided && css`
|
|
27
|
+
background: linear-gradient(${colors.lightGrey}, ${colors.lightGrey}) center bottom /
|
|
28
|
+
calc(100% - 2 * var(--side-modal-padding, 24px)) 1px no-repeat;
|
|
29
|
+
`}
|
|
30
|
+
`;
|
|
31
|
+
const HeaderText = styled.div`
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
gap: ${space[1]};
|
|
35
|
+
min-width: 0;
|
|
36
|
+
`;
|
|
37
|
+
const Title = styled.h2`
|
|
38
|
+
${({ $size }) => $size === "lg" ? typography.h3 : typography.sectionTitle};
|
|
39
|
+
margin: 0;
|
|
40
|
+
color: ${({ $size }) => $size === "lg" ? colors.black : colors.pureBlack};
|
|
41
|
+
${({ $size }) => $size === "md" && "text-transform: none;"}
|
|
42
|
+
`;
|
|
43
|
+
const Subtitle = styled.p`
|
|
44
|
+
${typography.bodyMd};
|
|
45
|
+
margin: 0;
|
|
46
|
+
color: ${colors.grayBlue};
|
|
47
|
+
`;
|
|
48
|
+
const SideModalHeader = ({ title, subtitle, size = "md", divided = false, children }) => {
|
|
49
|
+
const { titleId, closeButton, cornerButton, registerHeader } = useContext(SideModalContext);
|
|
50
|
+
useIsomorphicLayoutEffect(registerHeader, [registerHeader]);
|
|
51
|
+
return /* @__PURE__ */ jsxs(HeaderRoot, { $divided: divided, $cornerButton: cornerButton, children: [
|
|
52
|
+
/* @__PURE__ */ jsxs(HeaderText, { children: [
|
|
53
|
+
/* @__PURE__ */ jsx(Title, { id: titleId, $size: size, children: title }),
|
|
54
|
+
subtitle && /* @__PURE__ */ jsx(Subtitle, { children: subtitle }),
|
|
55
|
+
children
|
|
56
|
+
] }),
|
|
57
|
+
closeButton
|
|
58
|
+
] });
|
|
59
|
+
};
|
|
60
|
+
const SideModalBody = styled.div`
|
|
61
|
+
${sidePadding};
|
|
62
|
+
flex: 1 1 auto;
|
|
63
|
+
min-height: 0;
|
|
64
|
+
overflow-x: hidden;
|
|
65
|
+
overflow-y: auto;
|
|
66
|
+
padding-top: ${space[4]};
|
|
67
|
+
padding-bottom: ${space[8]};
|
|
68
|
+
background:
|
|
69
|
+
linear-gradient(${colors.white} 30%, rgba(255, 255, 255, 0)) center top,
|
|
70
|
+
linear-gradient(rgba(255, 255, 255, 0), ${colors.white} 70%) center bottom,
|
|
71
|
+
radial-gradient(farthest-side at 50% 0, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0)) center top,
|
|
72
|
+
radial-gradient(farthest-side at 50% 100%, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0)) center bottom;
|
|
73
|
+
background-repeat: no-repeat;
|
|
74
|
+
background-size:
|
|
75
|
+
100% 40px,
|
|
76
|
+
100% 40px,
|
|
77
|
+
100% 14px,
|
|
78
|
+
100% 14px;
|
|
79
|
+
background-attachment: local, local, scroll, scroll;
|
|
80
|
+
`;
|
|
81
|
+
const SideModalFooter = styled.div`
|
|
82
|
+
${sidePadding};
|
|
83
|
+
display: flex;
|
|
84
|
+
flex-shrink: 0;
|
|
85
|
+
flex-direction: column;
|
|
86
|
+
gap: ${space[3]};
|
|
87
|
+
padding-top: ${space[4]};
|
|
88
|
+
padding-bottom: ${space[6]};
|
|
89
|
+
border-top: 1px solid ${colors.lightGrey};
|
|
90
|
+
`;
|
|
91
|
+
export {
|
|
92
|
+
SideModalBody,
|
|
93
|
+
SideModalFooter,
|
|
94
|
+
SideModalHeader
|
|
95
|
+
};
|
|
@@ -26,9 +26,9 @@ const Pagination = (props) => {
|
|
|
26
26
|
let lastPage = displayRange[displayRange.length - 1];
|
|
27
27
|
return /* @__PURE__ */ jsxs(StyledList, { listStyle: props.listStyle, children: [
|
|
28
28
|
/* @__PURE__ */ jsx(StyledList.Item, { disabled: currentPage === 1 || displayRange.length === 1, onClick: onPrevious, arrow: true, children: /* @__PURE__ */ jsx(Icon, { icon: iconsMap.arrowLeft }) }),
|
|
29
|
-
displayRange.map((pageNumber) => {
|
|
29
|
+
displayRange.map((pageNumber, index) => {
|
|
30
30
|
if (pageNumber === DOTS) {
|
|
31
|
-
return /* @__PURE__ */ jsx(StyledList.Item, { dots: true, children: "…" },
|
|
31
|
+
return /* @__PURE__ */ jsx(StyledList.Item, { dots: true, children: "…" }, index === 1 ? "dots-left" : "dots-right");
|
|
32
32
|
}
|
|
33
33
|
return /* @__PURE__ */ jsx(
|
|
34
34
|
StyledList.Item,
|
|
@@ -5,7 +5,7 @@ import { ComponentWrapper } from "../ComponentWrapper/ComponentWrapper.styles.js
|
|
|
5
5
|
import stdin_default$1 from "./Pagination.js";
|
|
6
6
|
import { Card, CardTitle } from "../Card/Card.styles.js";
|
|
7
7
|
import stdin_default$2 from "../Input/InputWithButton.js";
|
|
8
|
-
import
|
|
8
|
+
import { Button } from "../Button/Button.styles.js";
|
|
9
9
|
const PaginationControls = ({
|
|
10
10
|
currentPage,
|
|
11
11
|
totalCount,
|
|
@@ -68,7 +68,7 @@ const PaginationControls = ({
|
|
|
68
68
|
setInputPageSize(value);
|
|
69
69
|
},
|
|
70
70
|
children: /* @__PURE__ */ jsx(
|
|
71
|
-
|
|
71
|
+
Button,
|
|
72
72
|
{
|
|
73
73
|
onClick: () => {
|
|
74
74
|
const newPageSize = Math.max(1, Number(inputPageSize) || 1);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React__default, { memo } from "react";
|
|
3
3
|
import { useTimer } from "../../hooks/useTimer.js";
|
|
4
|
-
import { format } from "date-fns-tz";
|
|
5
4
|
import styled from "styled-components";
|
|
6
5
|
import { colors } from "../../styles/colors.js";
|
|
7
6
|
import { Text } from "../Text/Text.styles.js";
|
|
@@ -71,7 +70,7 @@ const TimerComponent = memo(
|
|
|
71
70
|
}
|
|
72
71
|
}, [hasTimerFinished, onTimerExpired, stopTimer]);
|
|
73
72
|
const isWarning = secondsRemaining < warningThreshold;
|
|
74
|
-
const formattedTime =
|
|
73
|
+
const formattedTime = [secondsRemaining / 3600, secondsRemaining % 3600 / 60, secondsRemaining % 60].map((part) => String(Math.floor(part)).padStart(2, "0")).join(":");
|
|
75
74
|
return /* @__PURE__ */ jsx(TimerBlock, { red: isWarning, maxWidth, style: timerBlockStyle, className, children: /* @__PURE__ */ jsxs("div", { style: containerStyle, children: [
|
|
76
75
|
/* @__PURE__ */ jsx(Text, { children: /* @__PURE__ */ jsxs(FlexContainer, { itemsCenter: true, style: { gap: 8 }, children: [
|
|
77
76
|
showIcon && /* @__PURE__ */ jsx(Icon, { icon, size: iconSize }),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
|
-
import
|
|
2
|
+
import { Button } from "../Button/Button.styles.js";
|
|
3
3
|
import theme from "../../styles/theme.js";
|
|
4
4
|
const IconWrap = styled.div`
|
|
5
5
|
display: block;
|
|
@@ -25,7 +25,7 @@ const IconWrap = styled.div`
|
|
|
25
25
|
transition: color 0.2s;
|
|
26
26
|
}
|
|
27
27
|
`;
|
|
28
|
-
const StyledButton = styled(
|
|
28
|
+
const StyledButton = styled(Button).attrs((props) => ({
|
|
29
29
|
type: props.type || "button"
|
|
30
30
|
}))`
|
|
31
31
|
position: relative;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import
|
|
4
|
+
import { Button } from "../Button/Button.styles.js";
|
|
5
5
|
import { Box, Title, Subtitle } from "./RequestDataBox.styles.js";
|
|
6
6
|
const RequestDataBox = ({ title, subtitle, onClick = () => {
|
|
7
7
|
} }) => /* @__PURE__ */ jsxs(Box, { children: [
|
|
@@ -9,7 +9,7 @@ const RequestDataBox = ({ title, subtitle, onClick = () => {
|
|
|
9
9
|
/* @__PURE__ */ jsx(Title, { children: title }),
|
|
10
10
|
/* @__PURE__ */ jsx(Subtitle, { children: subtitle })
|
|
11
11
|
] }),
|
|
12
|
-
/* @__PURE__ */ jsx(
|
|
12
|
+
/* @__PURE__ */ jsx(Button, { minWidth: "240px", onClick, children: title })
|
|
13
13
|
] });
|
|
14
14
|
RequestDataBox.propTypes = {
|
|
15
15
|
title: PropTypes.string.isRequired,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface SectionProps {
|
|
3
|
+
title?: ReactNode;
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
/** `plain` sits on the page background instead of in a card. */
|
|
6
|
+
variant?: 'card' | 'plain';
|
|
7
|
+
/** Figma elevation/xs on the card. */
|
|
8
|
+
elevated?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* The card collapses to its title: `'always'` at every width, `'desktop-open'` only below desktop (open from
|
|
11
|
+
* desktop up until the first toggle; uncontrolled only, with `open` it behaves as `'always'`). Needs a `title`.
|
|
12
|
+
*/
|
|
13
|
+
collapsible?: 'always' | 'desktop-open';
|
|
14
|
+
/** Controlled open state of a collapsible section. Omit to let the component manage it. */
|
|
15
|
+
open?: boolean;
|
|
16
|
+
defaultOpen?: boolean;
|
|
17
|
+
onToggle?: (open: boolean) => void;
|
|
18
|
+
/** Shows skeleton lines instead of `children`. */
|
|
19
|
+
loading?: boolean;
|
|
20
|
+
/** Skeleton lines while loading. Pick what makes the reserved height match the real content. */
|
|
21
|
+
skeletonRows?: number;
|
|
22
|
+
/** Heading element of the title. */
|
|
23
|
+
headingLevel?: 'h2' | 'h3' | 'h4';
|
|
24
|
+
id?: string;
|
|
25
|
+
className?: string;
|
|
26
|
+
/** Test-automation hook on the section; the toggle gets `<dataCy>-toggle`. */
|
|
27
|
+
dataCy?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A titled content block: a card (or plain) with a header rule, optionally collapsible and with a loading state.
|
|
31
|
+
*/
|
|
32
|
+
export declare const Section: ({ title, children, variant, elevated, collapsible: collapsibleProp, open: openProp, defaultOpen, onToggle, loading, skeletonRows, headingLevel, id, className, dataCy, }: SectionProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useId } from "react";
|
|
3
|
+
import { ArrowSimple } from "../icons/ArrowSimple.js";
|
|
4
|
+
import { inertProp } from "../../utils/inertProp.js";
|
|
5
|
+
import { Chevron } from "../Collapsible/Collapsible.styles.js";
|
|
6
|
+
import { SkeletonLines } from "../Skeleton/Skeleton.js";
|
|
7
|
+
import { useMediaQuery } from "../../hooks/useMediaQuery.js";
|
|
8
|
+
import { mediaQuery } from "../../styles/rwd.js";
|
|
9
|
+
import { SectionRoot, SectionHeader, SectionHeading, SectionToggle, SectionBody, SectionBodyClip, SectionBodyInner } from "./Section.styles.js";
|
|
10
|
+
const Section = ({
|
|
11
|
+
title,
|
|
12
|
+
children,
|
|
13
|
+
variant = "card",
|
|
14
|
+
elevated = false,
|
|
15
|
+
collapsible: collapsibleProp,
|
|
16
|
+
open: openProp,
|
|
17
|
+
defaultOpen = false,
|
|
18
|
+
onToggle,
|
|
19
|
+
loading = false,
|
|
20
|
+
skeletonRows = 3,
|
|
21
|
+
headingLevel = "h2",
|
|
22
|
+
id,
|
|
23
|
+
className,
|
|
24
|
+
dataCy
|
|
25
|
+
}) => {
|
|
26
|
+
const collapsible = Boolean(collapsibleProp) && Boolean(title);
|
|
27
|
+
const desktopOpen = collapsibleProp === "desktop-open";
|
|
28
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
|
|
29
|
+
const [touched, setTouched] = useState(false);
|
|
30
|
+
const isDesktop = useMediaQuery(mediaQuery.desktopUp, true);
|
|
31
|
+
const controlled = openProp !== void 0;
|
|
32
|
+
const followsWidth = desktopOpen && !touched && !controlled;
|
|
33
|
+
const open = controlled ? openProp : uncontrolledOpen;
|
|
34
|
+
const isOpen = followsWidth ? isDesktop : open;
|
|
35
|
+
const explicit = !followsWidth;
|
|
36
|
+
const bodyId = useId();
|
|
37
|
+
const toggle = () => {
|
|
38
|
+
if (!controlled) setUncontrolledOpen(!isOpen);
|
|
39
|
+
setTouched(true);
|
|
40
|
+
onToggle?.(!isOpen);
|
|
41
|
+
};
|
|
42
|
+
const content = loading ? /* @__PURE__ */ jsx(SkeletonLines, { lines: skeletonRows, height: 20 }) : children;
|
|
43
|
+
const collapsed = collapsible && (followsWidth || !isOpen);
|
|
44
|
+
return /* @__PURE__ */ jsxs(
|
|
45
|
+
SectionRoot,
|
|
46
|
+
{
|
|
47
|
+
id,
|
|
48
|
+
className,
|
|
49
|
+
"data-cy": dataCy,
|
|
50
|
+
"aria-busy": loading || void 0,
|
|
51
|
+
$variant: variant,
|
|
52
|
+
$elevated: elevated,
|
|
53
|
+
$collapsible: collapsible,
|
|
54
|
+
$collapsed: collapsed,
|
|
55
|
+
$always: explicit,
|
|
56
|
+
children: [
|
|
57
|
+
title && /* @__PURE__ */ jsx(SectionHeader, { $collapsed: collapsed, $always: explicit, children: /* @__PURE__ */ jsx(SectionHeading, { as: headingLevel, children: collapsible ? /* @__PURE__ */ jsxs(
|
|
58
|
+
SectionToggle,
|
|
59
|
+
{
|
|
60
|
+
type: "button",
|
|
61
|
+
$collapsed: collapsed,
|
|
62
|
+
$always: explicit,
|
|
63
|
+
"aria-expanded": isOpen,
|
|
64
|
+
"aria-controls": bodyId,
|
|
65
|
+
"data-cy": dataCy && `${dataCy}-toggle`,
|
|
66
|
+
onClick: toggle,
|
|
67
|
+
children: [
|
|
68
|
+
title,
|
|
69
|
+
/* @__PURE__ */ jsx(Chevron, { $open: isOpen, "aria-hidden": "true", children: /* @__PURE__ */ jsx(ArrowSimple, { width: 10, height: 6 }) })
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
) : title }) }),
|
|
73
|
+
collapsible ? /* @__PURE__ */ jsx(SectionBody, { id: bodyId, $open: !followsWidth && open, $always: explicit, inert: inertProp(!isOpen), children: /* @__PURE__ */ jsx(SectionBodyClip, { $always: explicit, children: /* @__PURE__ */ jsx(SectionBodyInner, { children: content }) }) }) : content
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
export {
|
|
79
|
+
Section
|
|
80
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const SectionRoot: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLElement>, HTMLElement>, {
|
|
2
|
+
$variant: "card" | "plain";
|
|
3
|
+
$elevated: boolean;
|
|
4
|
+
$collapsible: boolean;
|
|
5
|
+
$collapsed?: boolean;
|
|
6
|
+
$always?: boolean;
|
|
7
|
+
}>> & string;
|
|
8
|
+
/** Figma header block: title, with a rule beneath it at padding-bottom space/5. */
|
|
9
|
+
export declare const SectionHeader: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
10
|
+
$collapsed?: boolean;
|
|
11
|
+
$always?: boolean;
|
|
12
|
+
}>> & string;
|
|
13
|
+
/**
|
|
14
|
+
* The title row, the section's toggle. It reaches over the card's padding so the whole header
|
|
15
|
+
* opens it, and while collapsed the whole card; the text stays where the padding put it.
|
|
16
|
+
*/
|
|
17
|
+
export declare const SectionToggle: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
|
|
18
|
+
$collapsed?: boolean;
|
|
19
|
+
$always?: boolean;
|
|
20
|
+
}>> & string;
|
|
21
|
+
/**
|
|
22
|
+
* Collapsible's animated body, always open from desktop up unless `$always`. The overrides use `&&`:
|
|
23
|
+
* the production bundle can emit the base Collapsible rules after these.
|
|
24
|
+
*/
|
|
25
|
+
export declare const SectionBody: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$open"> & {
|
|
26
|
+
$open: boolean;
|
|
27
|
+
}, {
|
|
28
|
+
$always?: boolean;
|
|
29
|
+
}>> & string;
|
|
30
|
+
export declare const SectionBodyClip: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>, {
|
|
31
|
+
$always?: boolean;
|
|
32
|
+
}>> & string;
|
|
33
|
+
export declare const SectionBodyInner: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
34
|
+
export declare const SectionHeading: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
import { Body, BodyClip } from "../Collapsible/Collapsible.styles.js";
|
|
3
|
+
import { colors } from "../../styles/colors.js";
|
|
4
|
+
import { media } from "../../styles/rwd.js";
|
|
5
|
+
import { elevation } from "../../styles/elevation.js";
|
|
6
|
+
import { space, radius } from "../../styles/spacing.js";
|
|
7
|
+
import { typography } from "../../styles/typography.js";
|
|
8
|
+
const MOBILE = media.belowDesktop;
|
|
9
|
+
const DESKTOP = media.desktopUp;
|
|
10
|
+
const SectionRoot = styled.section`
|
|
11
|
+
--section-gap: ${space[8]};
|
|
12
|
+
/* The card's padding, for the toggle to reach over it. */
|
|
13
|
+
--section-pad-y: 0px;
|
|
14
|
+
--section-pad-x: 0px;
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
gap: ${({ $collapsible }) => $collapsible ? "0" : "var(--section-gap)"};
|
|
18
|
+
|
|
19
|
+
${({ $variant, $elevated }) => $variant === "card" && css`
|
|
20
|
+
--section-pad-y: ${space[6]};
|
|
21
|
+
--section-pad-x: ${space[6]};
|
|
22
|
+
padding: var(--section-pad-y) var(--section-pad-x);
|
|
23
|
+
background: ${colors.white};
|
|
24
|
+
border: 1px solid ${colors.lightGrey};
|
|
25
|
+
border-radius: ${radius.lg};
|
|
26
|
+
box-shadow: ${$elevated ? elevation.xs : "none"};
|
|
27
|
+
|
|
28
|
+
/* Figma 3582:128652: mobile cards are 20 / 16 with 16 under the header. */
|
|
29
|
+
${MOBILE} {
|
|
30
|
+
--section-gap: ${space[4]};
|
|
31
|
+
--section-pad-y: ${space[5]};
|
|
32
|
+
--section-pad-x: ${space[4]};
|
|
33
|
+
}
|
|
34
|
+
`}
|
|
35
|
+
|
|
36
|
+
/* Collapsed, the whole card opens it, so it lifts under the pointer as an investment card does. */
|
|
37
|
+
${({ $variant, $collapsed, $always }) => {
|
|
38
|
+
if ($variant !== "card" || !$collapsed) return "";
|
|
39
|
+
const lift = css`
|
|
40
|
+
&:hover {
|
|
41
|
+
box-shadow: ${elevation.sm};
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
44
|
+
return $always ? lift : css`
|
|
45
|
+
${MOBILE} {
|
|
46
|
+
${lift}
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
}}
|
|
50
|
+
`;
|
|
51
|
+
const SectionHeader = styled.div`
|
|
52
|
+
padding-bottom: ${space[5]};
|
|
53
|
+
border-bottom: 1px solid ${colors.lightGrey};
|
|
54
|
+
transition:
|
|
55
|
+
padding-bottom 300ms,
|
|
56
|
+
border-color 300ms;
|
|
57
|
+
|
|
58
|
+
${({ $collapsed, $always }) => $collapsed && ($always ? css`
|
|
59
|
+
padding-bottom: 0;
|
|
60
|
+
border-bottom-color: transparent;
|
|
61
|
+
` : css`
|
|
62
|
+
${MOBILE} {
|
|
63
|
+
padding-bottom: 0;
|
|
64
|
+
border-bottom-color: transparent;
|
|
65
|
+
}
|
|
66
|
+
`)}
|
|
67
|
+
|
|
68
|
+
@media (prefers-reduced-motion: reduce) {
|
|
69
|
+
transition: none;
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
72
|
+
const SectionToggle = styled.button`
|
|
73
|
+
display: flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
justify-content: space-between;
|
|
76
|
+
gap: ${space[4]};
|
|
77
|
+
width: calc(100% + 2 * var(--section-pad-x));
|
|
78
|
+
margin: calc(-1 * var(--section-pad-y)) calc(-1 * var(--section-pad-x)) 0;
|
|
79
|
+
padding: var(--section-pad-y) var(--section-pad-x) 0;
|
|
80
|
+
border-radius: ${radius.lg};
|
|
81
|
+
|
|
82
|
+
${({ $collapsed, $always }) => {
|
|
83
|
+
const reachBottom = css`
|
|
84
|
+
margin-bottom: calc(-1 * var(--section-pad-y));
|
|
85
|
+
padding-bottom: var(--section-pad-y);
|
|
86
|
+
`;
|
|
87
|
+
if (!$collapsed) return "";
|
|
88
|
+
return $always ? reachBottom : css`
|
|
89
|
+
${MOBILE} {
|
|
90
|
+
${reachBottom}
|
|
91
|
+
}
|
|
92
|
+
`;
|
|
93
|
+
}}
|
|
94
|
+
|
|
95
|
+
border: none;
|
|
96
|
+
background: none;
|
|
97
|
+
font: inherit;
|
|
98
|
+
letter-spacing: inherit;
|
|
99
|
+
color: inherit;
|
|
100
|
+
text-align: left;
|
|
101
|
+
cursor: pointer;
|
|
102
|
+
`;
|
|
103
|
+
const SectionBody = styled(Body)`
|
|
104
|
+
${({ $always }) => !$always && css`
|
|
105
|
+
${DESKTOP} {
|
|
106
|
+
&& {
|
|
107
|
+
grid-template-rows: 1fr;
|
|
108
|
+
opacity: 1;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
`}
|
|
112
|
+
`;
|
|
113
|
+
const SectionBodyClip = styled(BodyClip)`
|
|
114
|
+
${({ $always }) => !$always && css`
|
|
115
|
+
${DESKTOP} {
|
|
116
|
+
&& {
|
|
117
|
+
overflow: visible;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
`}
|
|
121
|
+
`;
|
|
122
|
+
const SectionBodyInner = styled.div`
|
|
123
|
+
display: flex;
|
|
124
|
+
flex-direction: column;
|
|
125
|
+
gap: var(--section-gap);
|
|
126
|
+
padding-top: var(--section-gap);
|
|
127
|
+
`;
|
|
128
|
+
const SectionHeading = styled.h2`
|
|
129
|
+
${typography.sectionTitle};
|
|
130
|
+
/* Global h2 rules may uppercase; the design does not. */
|
|
131
|
+
text-transform: none;
|
|
132
|
+
margin: 0;
|
|
133
|
+
color: ${colors.pureBlack};
|
|
134
|
+
`;
|
|
135
|
+
export {
|
|
136
|
+
SectionBody,
|
|
137
|
+
SectionBodyClip,
|
|
138
|
+
SectionBodyInner,
|
|
139
|
+
SectionHeader,
|
|
140
|
+
SectionHeading,
|
|
141
|
+
SectionRoot,
|
|
142
|
+
SectionToggle
|
|
143
|
+
};
|