@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,8 +1,8 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
|
-
|
|
2
|
+
styled.div`
|
|
3
3
|
position: relative;
|
|
4
4
|
`;
|
|
5
|
-
|
|
5
|
+
styled.div`
|
|
6
6
|
z-index: 1;
|
|
7
7
|
position: absolute;
|
|
8
8
|
top: 0;
|
|
@@ -11,12 +11,12 @@ const HeadWrapper = styled.div`
|
|
|
11
11
|
overflow: hidden;
|
|
12
12
|
background-color: ${(props) => props.theme.cWhite};
|
|
13
13
|
`;
|
|
14
|
-
|
|
14
|
+
styled.div`
|
|
15
15
|
z-index: 0;
|
|
16
16
|
position: relative;
|
|
17
17
|
display: block;
|
|
18
18
|
`;
|
|
19
|
-
|
|
19
|
+
styled.div`
|
|
20
20
|
display: table;
|
|
21
21
|
min-width: 100%;
|
|
22
22
|
`;
|
|
@@ -44,7 +44,7 @@ const Column = styled.div.withConfig({
|
|
|
44
44
|
max-width: ${props.maxWidth}
|
|
45
45
|
`};
|
|
46
46
|
`;
|
|
47
|
-
|
|
47
|
+
styled.div.withConfig({
|
|
48
48
|
shouldForwardProp: (props) => !["hidden"].includes(props)
|
|
49
49
|
})`
|
|
50
50
|
display: table-header-group;
|
|
@@ -71,7 +71,7 @@ const Head = styled.div.withConfig({
|
|
|
71
71
|
padding: 10px 10px;
|
|
72
72
|
}
|
|
73
73
|
`;
|
|
74
|
-
|
|
74
|
+
styled.div`
|
|
75
75
|
display: table-row-group;
|
|
76
76
|
|
|
77
77
|
${Row} {
|
|
@@ -245,19 +245,13 @@ StyledReactTable.Tr = StyledTr;
|
|
|
245
245
|
StyledReactTable.Th = StyledTh;
|
|
246
246
|
StyledReactTable.Td = StyledTd;
|
|
247
247
|
export {
|
|
248
|
-
Body,
|
|
249
248
|
Column,
|
|
250
|
-
Container,
|
|
251
|
-
Head,
|
|
252
|
-
HeadWrapper,
|
|
253
249
|
Row,
|
|
254
250
|
StyledReactTable,
|
|
255
|
-
StyledTable,
|
|
256
251
|
StyledTd,
|
|
257
252
|
StyledTh,
|
|
258
253
|
StyledTr,
|
|
259
254
|
Styles,
|
|
260
255
|
TableDropdownIcon,
|
|
261
|
-
TableWrap
|
|
262
|
-
TableWrapper
|
|
256
|
+
TableWrap
|
|
263
257
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import rwd from "../../styles/rwd.js";
|
|
2
2
|
import theme from "../../styles/theme.js";
|
|
3
|
-
import
|
|
3
|
+
import { Button } from "../Button/Button.styles.js";
|
|
4
4
|
import styled, { css } from "styled-components";
|
|
5
5
|
import { Breakdown } from "../breakdown/Breakdown.js";
|
|
6
6
|
const Content = styled.div.withConfig({
|
|
@@ -190,7 +190,7 @@ const Category = styled(Breakdown).withConfig({
|
|
|
190
190
|
}
|
|
191
191
|
`}
|
|
192
192
|
`;
|
|
193
|
-
const StyledButton = styled(
|
|
193
|
+
const StyledButton = styled(Button)`
|
|
194
194
|
opacity: 0;
|
|
195
195
|
transition: opacity 0.3s ease;
|
|
196
196
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type ButtonSize = 'sm' | 'md' | 'lg';
|
|
2
|
+
export interface ButtonProps {
|
|
3
|
+
/** Figma size (32 / 40 / 48px tall, label/cta text, room for icons). Without it the button keeps its original look. */
|
|
4
|
+
size?: ButtonSize;
|
|
5
|
+
/** Outlined blue on white. */
|
|
6
|
+
secondary?: boolean;
|
|
7
|
+
/** White outline, for dark backgrounds. */
|
|
8
|
+
outline?: boolean;
|
|
9
|
+
/** Grey outline, turns blue on hover. */
|
|
10
|
+
outlineBlack?: boolean;
|
|
11
|
+
/** Grey outline, turns black on hover. */
|
|
12
|
+
black?: boolean;
|
|
13
|
+
/** Red outline, for destructive actions. */
|
|
14
|
+
negative?: boolean;
|
|
15
|
+
/** No background or border, text only. */
|
|
16
|
+
onlyText?: boolean;
|
|
17
|
+
/** Full width of the container. */
|
|
18
|
+
fluid?: boolean;
|
|
19
|
+
/** Centers the button horizontally. */
|
|
20
|
+
center?: boolean;
|
|
21
|
+
/** CSS min-width, e.g. `200px`. */
|
|
22
|
+
minWidth?: string;
|
|
23
|
+
withMarginBottom?: boolean;
|
|
24
|
+
marginTop?: string;
|
|
25
|
+
marginRight?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const Button: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('styled-components/dist/types').Substitute<import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>>, ButtonProps>, ButtonProps>> & string;
|
|
28
|
+
export default Button;
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import theme from "../../styles/theme.js";
|
|
3
|
+
import { typography } from "../../styles/typography.js";
|
|
4
|
+
const SIZES = {
|
|
5
|
+
sm: { height: 32, padding: "5px 15px", icon: 12 },
|
|
6
|
+
md: { height: 40, padding: "9px 23px", icon: 16 },
|
|
7
|
+
lg: { height: 48, padding: "13px 31px", icon: 20 }
|
|
8
|
+
};
|
|
4
9
|
const Button = styled.button.withConfig({
|
|
5
10
|
shouldForwardProp: (props) => ![
|
|
6
|
-
"
|
|
7
|
-
"isCancel",
|
|
8
|
-
"isDone",
|
|
11
|
+
"size",
|
|
9
12
|
"withMarginBottom",
|
|
10
13
|
"minWidth",
|
|
11
14
|
"fluid",
|
|
12
15
|
"center",
|
|
13
16
|
"secondary",
|
|
14
17
|
"onlyText",
|
|
15
|
-
"disabled",
|
|
16
18
|
"negative",
|
|
17
19
|
"outline",
|
|
18
20
|
"outlineBlack",
|
|
19
21
|
"black",
|
|
20
22
|
"marginTop",
|
|
21
|
-
"marginRight"
|
|
22
|
-
"isLoginMobile"
|
|
23
|
+
"marginRight"
|
|
23
24
|
].includes(props)
|
|
24
25
|
}).attrs((props) => ({
|
|
25
26
|
type: props.type || "button"
|
|
@@ -53,17 +54,22 @@ const Button = styled.button.withConfig({
|
|
|
53
54
|
background-color 0.2s,
|
|
54
55
|
border-color 0.2s;
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
57
|
+
${({ size }) => size && SIZES[size] && css`
|
|
58
|
+
${typography.labelCta};
|
|
59
|
+
display: inline-flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
gap: 8px;
|
|
63
|
+
min-height: ${SIZES[size].height}px;
|
|
64
|
+
white-space: nowrap;
|
|
65
|
+
padding: ${SIZES[size].padding};
|
|
66
|
+
|
|
67
|
+
/* Inline SVGs and MaterialIcon / SvgIcon take the size's icon size. */
|
|
68
|
+
> svg,
|
|
69
|
+
> [data-icon] {
|
|
70
|
+
flex: 0 0 auto;
|
|
71
|
+
width: ${SIZES[size].icon}px;
|
|
72
|
+
height: ${SIZES[size].icon}px;
|
|
67
73
|
}
|
|
68
74
|
`}
|
|
69
75
|
|
|
@@ -77,9 +83,9 @@ const Button = styled.button.withConfig({
|
|
|
77
83
|
`}
|
|
78
84
|
|
|
79
85
|
${(props) => props.fluid && css`
|
|
80
|
-
display: block;
|
|
86
|
+
display: ${props.size ? "flex" : "block"};
|
|
81
87
|
width: 100%;
|
|
82
|
-
padding: 11px 12px;
|
|
88
|
+
${!props.size && "padding: 11px 12px;"}
|
|
83
89
|
`}
|
|
84
90
|
|
|
85
91
|
${(props) => props.center && css`
|
|
@@ -196,8 +202,6 @@ const Button = styled.button.withConfig({
|
|
|
196
202
|
}
|
|
197
203
|
`}
|
|
198
204
|
|
|
199
|
-
//next 2 props added from SUF
|
|
200
|
-
|
|
201
205
|
${(props) => props.marginTop && css`
|
|
202
206
|
margin-top: ${props.marginTop};
|
|
203
207
|
`}
|
|
@@ -205,23 +209,8 @@ const Button = styled.button.withConfig({
|
|
|
205
209
|
${(props) => props.marginRight && css`
|
|
206
210
|
margin-right: ${props.marginRight};
|
|
207
211
|
`}
|
|
208
|
-
|
|
209
|
-
${(props) => props.isLoginMobile && `
|
|
210
|
-
margin-bottom: 20px;
|
|
211
|
-
width: 163.94px;
|
|
212
|
-
`}
|
|
213
212
|
`;
|
|
214
|
-
Button.propTypes = {
|
|
215
|
-
secondary: PropTypes.bool,
|
|
216
|
-
disabled: PropTypes.bool,
|
|
217
|
-
negative: PropTypes.bool,
|
|
218
|
-
center: PropTypes.bool,
|
|
219
|
-
outline: PropTypes.bool,
|
|
220
|
-
outlineBlack: PropTypes.bool,
|
|
221
|
-
black: PropTypes.bool
|
|
222
|
-
};
|
|
223
|
-
var stdin_default = Button;
|
|
224
213
|
export {
|
|
225
214
|
Button,
|
|
226
|
-
|
|
215
|
+
Button as default
|
|
227
216
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
-
import
|
|
3
|
+
import { Button } from "./Button.styles.js";
|
|
4
4
|
import { colors } from "../../styles/colors.js";
|
|
5
5
|
import { useInView } from "react-intersection-observer";
|
|
6
6
|
import { useState, useRef, useId, useEffect } from "react";
|
|
@@ -37,7 +37,7 @@ const ButtonWrapper = styled.div.withConfig({
|
|
|
37
37
|
width: 100%;
|
|
38
38
|
`}
|
|
39
39
|
`;
|
|
40
|
-
const StyledButton = styled(
|
|
40
|
+
const StyledButton = styled(Button).withConfig({
|
|
41
41
|
shouldForwardProp: (props) => !["beauty", "backgroundColor", "textColor", "borderColor", "fullWidth", "disabledColor"].includes(props)
|
|
42
42
|
})`
|
|
43
43
|
position: relative;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { TabContent } from './CardTabs.styles';
|
|
3
|
+
export interface CardTab<T extends string> {
|
|
4
|
+
id: T;
|
|
5
|
+
label: ReactNode;
|
|
6
|
+
/** DOM id of the tab button, e.g. a deep-link anchor. */
|
|
7
|
+
domId?: string;
|
|
8
|
+
/** Shown but not selectable; skipped by the arrow keys. */
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface CardTabsProps<T extends string> {
|
|
12
|
+
tabs: CardTab<T>[];
|
|
13
|
+
activeId: T;
|
|
14
|
+
/** NoInfer: `T` comes from the tabs, so a `useState` setter can be passed directly. */
|
|
15
|
+
onSelect: (id: NoInfer<T>) => void;
|
|
16
|
+
/** Id of the `TabPanel` the tabs control. */
|
|
17
|
+
panelId: string;
|
|
18
|
+
label?: string;
|
|
19
|
+
/** Tabs hug their labels, left-aligned, instead of sharing the row equally. */
|
|
20
|
+
fit?: boolean;
|
|
21
|
+
/** Test-automation hook: each tab gets `data-cy="<dataCy>-<tab id>"`. */
|
|
22
|
+
dataCy?: string;
|
|
23
|
+
/** Space kept above a tab scrolled into view (deep links), e.g. the sticky header's height. px or CSS length. */
|
|
24
|
+
scrollMarginTop?: number | string;
|
|
25
|
+
className?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The card tab bar (Figma "Tab List - Main Actions"), with the white surface sliding to the
|
|
29
|
+
* active tab. Equal-width tabs place it from the index, so the server render is exact; `fit`
|
|
30
|
+
* tabs measure it, the active tab painting its own surface until then.
|
|
31
|
+
*/
|
|
32
|
+
export declare const CardTabs: <T extends string>({ tabs, activeId, onSelect, panelId, label, fit, dataCy, scrollMarginTop, className, }: CardTabsProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export type TabPanelProps = Omit<ComponentProps<typeof TabContent>, '$animate'> & {
|
|
34
|
+
/** The active tab: content fades in each time it changes, not on first render. */
|
|
35
|
+
activeKey: string;
|
|
36
|
+
/** Fade in on first render too: content that only mounts on a click, never on page load. */
|
|
37
|
+
appear?: boolean;
|
|
38
|
+
/** Set false to switch content without the fade. */
|
|
39
|
+
animate?: boolean;
|
|
40
|
+
};
|
|
41
|
+
export declare const TabPanel: ({ activeKey, appear, animate: animateProp, children, ...props }: TabPanelProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, useState, useRef, useEffect, useLayoutEffect } from "react";
|
|
3
|
+
import { TabList, FitHighlight, TabHighlight, TabDivider, Tab, TabContent } from "./CardTabs.styles.js";
|
|
4
|
+
const useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
5
|
+
const useActiveTabBox = (fit, activeId) => {
|
|
6
|
+
const listRef = useRef(null);
|
|
7
|
+
const [box, setBox] = useState(null);
|
|
8
|
+
useIsomorphicLayoutEffect(() => {
|
|
9
|
+
if (!fit) return void 0;
|
|
10
|
+
const tab = listRef.current?.querySelector('[aria-selected="true"]');
|
|
11
|
+
if (!tab) return void 0;
|
|
12
|
+
const measure = () => setBox({ left: tab.offsetLeft, width: tab.offsetWidth });
|
|
13
|
+
measure();
|
|
14
|
+
const observer = new ResizeObserver(measure);
|
|
15
|
+
observer.observe(tab);
|
|
16
|
+
return () => observer.disconnect();
|
|
17
|
+
}, [fit, activeId]);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const list = listRef.current;
|
|
20
|
+
const tab = list?.querySelector('[aria-selected="true"]');
|
|
21
|
+
if (!fit || !list || !tab || list.scrollWidth <= list.clientWidth) return;
|
|
22
|
+
const right = tab.offsetLeft + tab.offsetWidth;
|
|
23
|
+
if (tab.offsetLeft < list.scrollLeft) list.scrollTo({ left: tab.offsetLeft, behavior: "smooth" });
|
|
24
|
+
else if (right > list.scrollLeft + list.clientWidth)
|
|
25
|
+
list.scrollTo({ left: right - list.clientWidth, behavior: "smooth" });
|
|
26
|
+
}, [fit, activeId]);
|
|
27
|
+
return { listRef, box };
|
|
28
|
+
};
|
|
29
|
+
const CardTabs = ({
|
|
30
|
+
tabs,
|
|
31
|
+
activeId,
|
|
32
|
+
onSelect,
|
|
33
|
+
panelId,
|
|
34
|
+
label,
|
|
35
|
+
fit = false,
|
|
36
|
+
dataCy,
|
|
37
|
+
scrollMarginTop,
|
|
38
|
+
className
|
|
39
|
+
}) => {
|
|
40
|
+
const { listRef, box } = useActiveTabBox(fit, activeId);
|
|
41
|
+
const stretch = fit && tabs.length > 1;
|
|
42
|
+
const activeIndex = Math.max(
|
|
43
|
+
0,
|
|
44
|
+
tabs.findIndex((tab) => tab.id === activeId)
|
|
45
|
+
);
|
|
46
|
+
const focusIndex = tabs[activeIndex]?.disabled ? Math.max(
|
|
47
|
+
0,
|
|
48
|
+
tabs.findIndex((tab) => !tab.disabled)
|
|
49
|
+
) : activeIndex;
|
|
50
|
+
const handleKeyDown = (event) => {
|
|
51
|
+
const enabled = tabs.map((tab, index2) => tab.disabled ? -1 : index2).filter((index2) => index2 >= 0);
|
|
52
|
+
if (!enabled.length) return;
|
|
53
|
+
const position = Math.max(0, enabled.indexOf(focusIndex));
|
|
54
|
+
const step = { ArrowRight: position + 1, ArrowLeft: position - 1, Home: 0, End: enabled.length - 1 }[event.key];
|
|
55
|
+
if (step === void 0) return;
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
const index = enabled[(step + enabled.length) % enabled.length];
|
|
58
|
+
onSelect(tabs[index].id);
|
|
59
|
+
listRef.current?.querySelectorAll('[role="tab"]')[index]?.focus();
|
|
60
|
+
};
|
|
61
|
+
return /* @__PURE__ */ jsxs(
|
|
62
|
+
TabList,
|
|
63
|
+
{
|
|
64
|
+
ref: listRef,
|
|
65
|
+
role: "tablist",
|
|
66
|
+
"aria-label": label,
|
|
67
|
+
className,
|
|
68
|
+
$fit: fit,
|
|
69
|
+
$scrollMarginTop: typeof scrollMarginTop === "number" ? `${scrollMarginTop}px` : scrollMarginTop,
|
|
70
|
+
onKeyDown: handleKeyDown,
|
|
71
|
+
children: [
|
|
72
|
+
fit ? box && /* @__PURE__ */ jsx(
|
|
73
|
+
FitHighlight,
|
|
74
|
+
{
|
|
75
|
+
"aria-hidden": "true",
|
|
76
|
+
style: { "--tab-left": `${box.left}px`, "--tab-width": `${box.width}px` }
|
|
77
|
+
}
|
|
78
|
+
) : (
|
|
79
|
+
// Dividers are 1px wide, so the highlight steps by the tab width plus 1px.
|
|
80
|
+
/* @__PURE__ */ jsx(TabHighlight, { $index: activeIndex, $count: tabs.length, $gap: 1, "aria-hidden": "true" })
|
|
81
|
+
),
|
|
82
|
+
tabs.map((tab, index) => {
|
|
83
|
+
const active = tab.id === activeId;
|
|
84
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
85
|
+
!fit && index > 0 && /* @__PURE__ */ jsx(TabDivider, {}),
|
|
86
|
+
/* @__PURE__ */ jsx(
|
|
87
|
+
Tab,
|
|
88
|
+
{
|
|
89
|
+
id: tab.domId,
|
|
90
|
+
type: "button",
|
|
91
|
+
role: "tab",
|
|
92
|
+
"aria-controls": panelId,
|
|
93
|
+
"aria-selected": active,
|
|
94
|
+
disabled: tab.disabled,
|
|
95
|
+
tabIndex: index === focusIndex ? 0 : -1,
|
|
96
|
+
$active: active,
|
|
97
|
+
$fit: fit,
|
|
98
|
+
$stretch: stretch,
|
|
99
|
+
$filled: active && !box,
|
|
100
|
+
"data-cy": dataCy && `${dataCy}-${tab.id}`,
|
|
101
|
+
onClick: () => !tab.disabled && onSelect(tab.id),
|
|
102
|
+
children: tab.label
|
|
103
|
+
}
|
|
104
|
+
),
|
|
105
|
+
fit && /* @__PURE__ */ jsx(TabDivider, { $edge: stretch && index === tabs.length - 1 })
|
|
106
|
+
] }, tab.id);
|
|
107
|
+
})
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
const TabPanel = ({
|
|
113
|
+
activeKey,
|
|
114
|
+
appear = false,
|
|
115
|
+
animate: animateProp = true,
|
|
116
|
+
children,
|
|
117
|
+
...props
|
|
118
|
+
}) => {
|
|
119
|
+
const [shownKey, setShownKey] = useState(activeKey);
|
|
120
|
+
const [animate, setAnimate] = useState(appear);
|
|
121
|
+
if (activeKey !== shownKey) {
|
|
122
|
+
setShownKey(activeKey);
|
|
123
|
+
setAnimate(true);
|
|
124
|
+
}
|
|
125
|
+
return /* @__PURE__ */ jsx(TabContent, { role: "tabpanel", $animate: animateProp && animate, ...props, children }, activeKey);
|
|
126
|
+
};
|
|
127
|
+
export {
|
|
128
|
+
CardTabs,
|
|
129
|
+
TabPanel
|
|
130
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
interface HighlightProps {
|
|
2
|
+
$index: number;
|
|
3
|
+
$count: number;
|
|
4
|
+
/** Gap between tabs and inset from the list edge, px. */
|
|
5
|
+
$gap?: number;
|
|
6
|
+
$inset?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The surface behind the active tab, sliding to it. Equal-width tabs let CSS place it from
|
|
10
|
+
* the index alone, so it is exact on the server render too; the list needs `position: relative`.
|
|
11
|
+
*/
|
|
12
|
+
export declare const TabHighlightBase: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, HighlightProps>> & string;
|
|
13
|
+
/** Tab label colour eases with the highlight. */
|
|
14
|
+
export declare const tabColorTransition: import('styled-components').RuleSet<object>;
|
|
15
|
+
/**
|
|
16
|
+
* New tab content fades in from a blur. Key it by the active tab so it replays on each
|
|
17
|
+
* switch; `$animate` is off until the first switch, so the page does not fade in on load.
|
|
18
|
+
*/
|
|
19
|
+
export declare const TabContent: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
20
|
+
$animate: boolean;
|
|
21
|
+
}>> & string;
|
|
22
|
+
/**
|
|
23
|
+
* The row's bottom rule shows under every tab but the active one: the sliding white highlight
|
|
24
|
+
* covers it. `$fit`: tabs hug their labels, left-aligned, the rest of the row grey.
|
|
25
|
+
*/
|
|
26
|
+
export declare const TabList: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
27
|
+
$fit?: boolean;
|
|
28
|
+
$scrollMarginTop?: string;
|
|
29
|
+
}>> & string;
|
|
30
|
+
/**
|
|
31
|
+
* The white active-tab surface, sliding between tabs. Runs 1px past the row's bottom rule: an
|
|
32
|
+
* edge drawn exactly on the rule lets a hairline of it through (the moving highlight is its own
|
|
33
|
+
* layer, with anti-aliased edges).
|
|
34
|
+
*/
|
|
35
|
+
export declare const TabHighlight: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, keyof HighlightProps> & HighlightProps, never>> & string;
|
|
36
|
+
/** `$fit` tabs differ in width, so the highlight is placed from the measured active tab. */
|
|
37
|
+
export declare const FitHighlight: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
38
|
+
/** `$filled`: the active `$fit` tab paints its own surface until the highlight is measured. */
|
|
39
|
+
export declare const Tab: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
|
|
40
|
+
$active: boolean;
|
|
41
|
+
$fit?: boolean;
|
|
42
|
+
$stretch?: boolean;
|
|
43
|
+
$filled?: boolean;
|
|
44
|
+
}>> & string;
|
|
45
|
+
/**
|
|
46
|
+
* Never shrinks: in a row that overflows (fit tabs on mobile), it would squeeze to 0.
|
|
47
|
+
* `$edge`: the closing divider of stretched tabs, which below desktop would sit on the card's edge.
|
|
48
|
+
*/
|
|
49
|
+
export declare const TabDivider: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
50
|
+
$edge?: boolean;
|
|
51
|
+
}>> & string;
|
|
52
|
+
/** A card whose header is the tab bar . */
|
|
53
|
+
export declare const TabCard: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
54
|
+
/** The tab panel's content area: 24px, 16px on mobile (Figma 3582:127370). */
|
|
55
|
+
export declare const TabCardBody: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import styled, { css, keyframes } from "styled-components";
|
|
2
|
+
import { colors } from "../../styles/colors.js";
|
|
3
|
+
import { media } from "../../styles/rwd.js";
|
|
4
|
+
import { elevation } from "../../styles/elevation.js";
|
|
5
|
+
import { radius, space } from "../../styles/spacing.js";
|
|
6
|
+
import { typography } from "../../styles/typography.js";
|
|
7
|
+
const SPRING = `553ms linear(0, 0.0258, 0.0896, 0.1748, 0.27, 0.3669, 0.4604, 0.5471, 0.6253, 0.6941, 0.7535, 0.804, 0.8462, 0.881, 0.9094, 0.9322, 0.9502, 0.9644, 0.9753, 0.9835, 0.9897, 0.9942, 0.9974, 0.9996, 1.001, 1.0019, 1.0024, 1.0026, 1.0026, 1.0025, 1.0023, 1.0021, 1)`;
|
|
8
|
+
const CONTENT = "500ms ease-in-out";
|
|
9
|
+
const reducedMotion = css`
|
|
10
|
+
@media (prefers-reduced-motion: reduce) {
|
|
11
|
+
transition: none;
|
|
12
|
+
animation: none;
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
15
|
+
const TabHighlightBase = styled.span`
|
|
16
|
+
position: absolute;
|
|
17
|
+
top: ${({ $inset = 0 }) => $inset}px;
|
|
18
|
+
bottom: ${({ $inset = 0 }) => $inset}px;
|
|
19
|
+
left: ${({ $inset = 0 }) => $inset}px;
|
|
20
|
+
z-index: 0;
|
|
21
|
+
width: ${({ $count, $gap = 0, $inset = 0 }) => `calc((100% - ${2 * $inset + $gap * ($count - 1)}px) / ${$count})`};
|
|
22
|
+
transform: translateX(${({ $index, $gap = 0 }) => `calc(${$index} * (100% + ${$gap}px))`});
|
|
23
|
+
pointer-events: none;
|
|
24
|
+
/* Browsers without linear() ignore the second line and keep a plain ease-out. */
|
|
25
|
+
transition: transform 553ms cubic-bezier(0.22, 1, 0.36, 1);
|
|
26
|
+
transition: transform ${SPRING};
|
|
27
|
+
${reducedMotion};
|
|
28
|
+
`;
|
|
29
|
+
const tabColorTransition = css`
|
|
30
|
+
transition: color ${CONTENT};
|
|
31
|
+
${reducedMotion};
|
|
32
|
+
`;
|
|
33
|
+
const enter = keyframes`
|
|
34
|
+
from {
|
|
35
|
+
opacity: 0;
|
|
36
|
+
filter: blur(4px);
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
const TabContent = styled.div`
|
|
40
|
+
${({ $animate }) => $animate && css`
|
|
41
|
+
animation: ${enter} ${CONTENT};
|
|
42
|
+
`}
|
|
43
|
+
${reducedMotion};
|
|
44
|
+
`;
|
|
45
|
+
const TabList = styled.div`
|
|
46
|
+
position: relative;
|
|
47
|
+
display: flex;
|
|
48
|
+
width: 100%;
|
|
49
|
+
background: ${colors.grey3};
|
|
50
|
+
box-shadow: inset 0 -1px 0 ${colors.lightGrey};
|
|
51
|
+
|
|
52
|
+
${({ $scrollMarginTop }) => $scrollMarginTop && css`
|
|
53
|
+
[role='tab'] {
|
|
54
|
+
scroll-margin-top: ${$scrollMarginTop};
|
|
55
|
+
}
|
|
56
|
+
`}
|
|
57
|
+
|
|
58
|
+
${({ $fit }) => $fit && css`
|
|
59
|
+
overflow-x: auto;
|
|
60
|
+
/* Clips the highlight's 1px overhang instead of scrolling by it. */
|
|
61
|
+
overflow-y: hidden;
|
|
62
|
+
scrollbar-width: none;
|
|
63
|
+
|
|
64
|
+
&::-webkit-scrollbar {
|
|
65
|
+
display: none;
|
|
66
|
+
}
|
|
67
|
+
`}
|
|
68
|
+
`;
|
|
69
|
+
const TabHighlight = styled(TabHighlightBase)`
|
|
70
|
+
bottom: -1px;
|
|
71
|
+
background: ${colors.white};
|
|
72
|
+
`;
|
|
73
|
+
const FitHighlight = styled.span`
|
|
74
|
+
position: absolute;
|
|
75
|
+
top: 0;
|
|
76
|
+
/* Past the bottom rule, as TabHighlight. */
|
|
77
|
+
bottom: -1px;
|
|
78
|
+
left: 0;
|
|
79
|
+
z-index: 0;
|
|
80
|
+
width: var(--tab-width);
|
|
81
|
+
transform: translateX(var(--tab-left));
|
|
82
|
+
background: ${colors.white};
|
|
83
|
+
pointer-events: none;
|
|
84
|
+
transition:
|
|
85
|
+
transform 553ms cubic-bezier(0.22, 1, 0.36, 1),
|
|
86
|
+
width 553ms cubic-bezier(0.22, 1, 0.36, 1);
|
|
87
|
+
transition:
|
|
88
|
+
transform ${SPRING},
|
|
89
|
+
width ${SPRING};
|
|
90
|
+
${reducedMotion};
|
|
91
|
+
`;
|
|
92
|
+
const Tab = styled.button`
|
|
93
|
+
${typography.tabLabel};
|
|
94
|
+
${tabColorTransition};
|
|
95
|
+
position: relative;
|
|
96
|
+
z-index: 1;
|
|
97
|
+
/* Equal widths, so the highlight can slide by index: labels are centred, so a narrow
|
|
98
|
+
side padding looks the same as Figma's 32px while not forcing a tab wider. */
|
|
99
|
+
flex: 1 1 0;
|
|
100
|
+
min-width: 0;
|
|
101
|
+
padding: ${space[4]} ${space[2]};
|
|
102
|
+
border: none;
|
|
103
|
+
cursor: pointer;
|
|
104
|
+
background: transparent;
|
|
105
|
+
|
|
106
|
+
&:disabled {
|
|
107
|
+
cursor: not-allowed;
|
|
108
|
+
opacity: 0.5;
|
|
109
|
+
}
|
|
110
|
+
/* Figma: closed tabs in #9b9b9b, a lighter grey than the tertiary text token. */
|
|
111
|
+
color: ${({ $active }) => $active ? colors.black : colors.grey2};
|
|
112
|
+
|
|
113
|
+
${({ $fit, $stretch, $filled }) => $fit && css`
|
|
114
|
+
flex: 0 0 auto;
|
|
115
|
+
padding: ${space[4]} ${space[8]};
|
|
116
|
+
white-space: nowrap;
|
|
117
|
+
background: ${$filled ? colors.white : "transparent"};
|
|
118
|
+
|
|
119
|
+
/* Figma mobile: the tabs share the row (still scrolling once the labels outgrow it). */
|
|
120
|
+
${$stretch && css`
|
|
121
|
+
${media.belowDesktop} {
|
|
122
|
+
flex: 1 0 auto;
|
|
123
|
+
padding: ${space[4]} ${space[5]};
|
|
124
|
+
}
|
|
125
|
+
`}
|
|
126
|
+
`}
|
|
127
|
+
`;
|
|
128
|
+
const TabDivider = styled.div`
|
|
129
|
+
position: relative;
|
|
130
|
+
z-index: 1;
|
|
131
|
+
flex: 0 0 1px;
|
|
132
|
+
width: 1px;
|
|
133
|
+
background: ${colors.lightGrey};
|
|
134
|
+
|
|
135
|
+
${({ $edge }) => $edge && css`
|
|
136
|
+
${media.belowDesktop} {
|
|
137
|
+
display: none;
|
|
138
|
+
}
|
|
139
|
+
`}
|
|
140
|
+
`;
|
|
141
|
+
const TabCard = styled.div`
|
|
142
|
+
display: flex;
|
|
143
|
+
flex-direction: column;
|
|
144
|
+
overflow: hidden;
|
|
145
|
+
background: ${colors.white};
|
|
146
|
+
border: 1px solid ${colors.lightGrey};
|
|
147
|
+
border-radius: ${radius.lg};
|
|
148
|
+
box-shadow: ${elevation.xs};
|
|
149
|
+
`;
|
|
150
|
+
const TabCardBody = styled.div`
|
|
151
|
+
display: flex;
|
|
152
|
+
flex-direction: column;
|
|
153
|
+
gap: ${space[4]};
|
|
154
|
+
padding: ${space[6]};
|
|
155
|
+
|
|
156
|
+
${media.belowDesktop} {
|
|
157
|
+
padding: ${space[4]};
|
|
158
|
+
}
|
|
159
|
+
`;
|
|
160
|
+
export {
|
|
161
|
+
FitHighlight,
|
|
162
|
+
Tab,
|
|
163
|
+
TabCard,
|
|
164
|
+
TabCardBody,
|
|
165
|
+
TabContent,
|
|
166
|
+
TabDivider,
|
|
167
|
+
TabHighlight,
|
|
168
|
+
TabHighlightBase,
|
|
169
|
+
TabList,
|
|
170
|
+
tabColorTransition
|
|
171
|
+
};
|