@stokr/components-library 5.0.0 → 5.0.2
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/README.md +8 -8
- package/dist/components/AddressItem/AddressItem.d.ts +38 -0
- package/dist/components/AddressItem/AddressItem.js +51 -0
- package/dist/components/AddressItem/AddressItem.styles.d.ts +31 -0
- package/dist/components/AddressItem/AddressItem.styles.js +71 -0
- package/dist/components/AdminDashboard/Table/Table.styles.js +18 -25
- package/dist/components/AgreementItem/AgreementItem.styles.js +1 -1
- package/dist/components/BackButton/BackButton.styles.js +15 -15
- package/dist/components/BasicTable/BasicTable.styles.js +6 -8
- package/dist/components/BlogPost/BlogPost.styles.js +9 -13
- package/dist/components/Button/Button.styles.d.ts +1 -1
- package/dist/components/Button/Button.styles.js +122 -11
- package/dist/components/Button/GlareButton.js +1 -1
- package/dist/components/Card/Card.styles.js +3 -4
- package/dist/components/CardTabs/CardTabs.styles.js +17 -17
- package/dist/components/ChartLegend/ChartLegend.styles.js +6 -7
- package/dist/components/Checkbox/Checkbox.styles.d.ts +1 -0
- package/dist/components/Checkbox/Checkbox.styles.js +10 -11
- package/dist/components/Checklist/ChecklistCard.js +3 -3
- package/dist/components/Checklist/ChecklistCard.styles.js +7 -20
- package/dist/components/Chips/Chip.js +2 -2
- package/dist/components/Chips/Chip.styles.js +6 -10
- package/dist/components/Collapsible/Collapsible.d.ts +10 -4
- package/dist/components/Collapsible/Collapsible.js +6 -14
- package/dist/components/Collapsible/Collapsible.styles.d.ts +3 -1
- package/dist/components/Collapsible/Collapsible.styles.js +33 -16
- package/dist/components/ComponentScroll/ComponentScroll.styles.js +5 -5
- package/dist/components/ComponentWrapper/ComponentWrapper.styles.js +5 -5
- package/dist/components/ConfirmModal/ConfirmModal.styles.js +2 -2
- package/dist/components/Country/CountrySelect.js +15 -20
- package/dist/components/Country/FlagFor.d.ts +9 -0
- package/dist/components/Country/FlagFor.js +25 -0
- package/dist/components/Country/flagLoaders.d.ts +5 -0
- package/dist/components/Country/flagLoaders.js +270 -0
- package/dist/components/Country/flagStore.d.ts +6 -0
- package/dist/components/Country/flagStore.js +29 -0
- package/dist/components/CryptoAddress/CryptoAddress.d.ts +6 -2
- package/dist/components/CryptoAddress/CryptoAddress.js +2 -2
- package/dist/components/CryptoAddress/CryptoAddress.styles.d.ts +2 -1
- package/dist/components/CryptoAddress/CryptoAddress.styles.js +20 -27
- package/dist/components/CryptoAddressWrapper/CryptoAddressWrapper.styles.js +2 -2
- package/dist/components/FAQ/FAQ.d.ts +29 -0
- package/dist/components/FAQ/FAQ.js +18 -18
- package/dist/components/FAQ/FAQ.styles.d.ts +11 -3
- package/dist/components/FAQ/FAQ.styles.js +59 -10
- package/dist/components/Form/Form.styles.js +5 -5
- package/dist/components/Grid/Grid.styles.js +7 -7
- package/dist/components/IdentityInfo/IdentityInfo.js +2 -1
- package/dist/components/IdentityInfo/IdentityInfo.styles.js +13 -23
- package/dist/components/InfoBox/InfoBox.d.ts +15 -13
- package/dist/components/InfoBox/InfoBox.js +31 -14
- package/dist/components/InfoIcon/InfoIcon.styles.js +2 -2
- package/dist/components/Input/DatePickerInput.styles.js +23 -24
- package/dist/components/Input/Input.d.ts +3 -0
- package/dist/components/Input/Input.js +5 -2
- package/dist/components/Input/Input.styles.d.ts +4 -0
- package/dist/components/Input/Input.styles.js +77 -27
- package/dist/components/Input/InputPassword.styles.js +11 -11
- package/dist/components/Input/InputWithButton.styles.js +5 -5
- package/dist/components/Input/MultiSelect.js +17 -17
- package/dist/components/Input/OtpInput.js +1 -1
- package/dist/components/Input/RangeInput.js +2 -2
- package/dist/components/Input/SearchInput.styles.js +10 -10
- package/dist/components/Input/Select.d.ts +57 -0
- package/dist/components/Input/Select.js +101 -106
- package/dist/components/Input/Select.styles.d.ts +89 -0
- package/dist/components/Input/Select.styles.js +115 -19
- package/dist/components/Input/TableFilterDropdown.js +5 -5
- package/dist/components/Input/Textarea.styles.js +11 -13
- package/dist/components/MaterialIcon/requiredIcons.d.ts +1 -1
- package/dist/components/MaterialIcon/requiredIcons.js +2 -0
- package/dist/components/MenuNav/MenuNav.styles.js +2 -5
- package/dist/components/Modal/Modal.styles.js +25 -31
- package/dist/components/Modal/PaymentModal.js +7 -7
- package/dist/components/Modal/SideModal.styles.js +8 -8
- package/dist/components/Modal/SideModalParts.js +15 -16
- package/dist/components/Modal/SuccessModal/SuccessModal.styles.js +5 -8
- package/dist/components/NotificationCounter/NotificationCounter.styles.js +2 -2
- package/dist/components/Number/Number.js +1 -1
- package/dist/components/Number/Number.styles.js +2 -2
- package/dist/components/Pagination/Pagination.styles.js +7 -7
- package/dist/components/PanelCard/PanelCard.d.ts +51 -0
- package/dist/components/PanelCard/PanelCard.js +35 -0
- package/dist/components/PanelCard/PanelCard.styles.d.ts +29 -0
- package/dist/components/PanelCard/PanelCard.styles.js +84 -0
- package/dist/components/Payment/DetailRows.js +1 -1
- package/dist/components/Payment/DetailsToggle.js +4 -6
- package/dist/components/Payment/PaymentDetailsCard.js +29 -53
- package/dist/components/Payment/PaymentDisplay.js +12 -20
- package/dist/components/Payment/PaymentPendingCard.d.ts +1 -1
- package/dist/components/Payment/PaymentPendingCard.js +10 -13
- package/dist/components/Payment/PaymentSuccessCard.js +6 -9
- package/dist/components/Payment/TimerComponent.js +5 -4
- package/dist/components/Process/Process.styles.js +7 -13
- package/dist/components/ProfileBadge/ProfileBadge.styles.js +8 -10
- package/dist/components/ProfileBox/ProfileBox.styles.js +5 -7
- package/dist/components/Radio/Radio.styles.d.ts +1 -0
- package/dist/components/Radio/Radio.styles.js +8 -9
- package/dist/components/RefreshButton/RefreshButton.styles.js +5 -5
- package/dist/components/RequestDataBox/RequestDataBox.styles.js +3 -5
- package/dist/components/Section/Section.styles.js +16 -18
- package/dist/components/SectionTitle/SectionTitle.styles.d.ts +4 -0
- package/dist/components/SectionTitle/SectionTitle.styles.js +4 -7
- package/dist/components/Skeleton/Skeleton.d.ts +1 -1
- package/dist/components/Skeleton/Skeleton.js +3 -3
- package/dist/components/Snackbar/Snackbar.styles.js +8 -10
- package/dist/components/SpanButton/SpanButton.styles.js +2 -2
- package/dist/components/StatusDot/StatusDot.d.ts +1 -1
- package/dist/components/StatusDot/StatusDot.js +5 -5
- package/dist/components/StatusDot/StatusDot.styles.js +2 -5
- package/dist/components/StatusTag/StatusTag.js +1 -1
- package/dist/components/StatusTag/StatusTag.styles.js +4 -4
- package/dist/components/StepController/StepController.styles.js +7 -7
- package/dist/components/StepSidebar/MobileStepProgress.d.ts +12 -0
- package/dist/components/StepSidebar/MobileStepProgress.js +14 -0
- package/dist/components/StepSidebar/MobileStepProgress.styles.d.ts +15 -0
- package/dist/components/StepSidebar/MobileStepProgress.styles.js +39 -0
- package/dist/components/StepSidebar/StepProgress.d.ts +14 -0
- package/dist/components/StepSidebar/StepProgress.js +14 -0
- package/dist/components/StepSidebar/StepProgress.styles.d.ts +30 -0
- package/dist/components/StepSidebar/StepProgress.styles.js +97 -0
- package/dist/components/StepSidebar/StepSidebar.d.ts +36 -0
- package/dist/components/StepSidebar/StepSidebar.js +58 -0
- package/dist/components/StepSidebar/StepSidebar.styles.d.ts +55 -0
- package/dist/components/StepSidebar/StepSidebar.styles.js +168 -0
- package/dist/components/StokrLoader/StokrLoader.d.ts +16 -2
- package/dist/components/StokrLoader/StokrLoader.js +170 -28
- package/dist/components/StokrLoader/loaderSession.d.ts +14 -0
- package/dist/components/StokrLoader/loaderSession.js +30 -0
- package/dist/components/Switch/Switch.styles.js +12 -14
- package/dist/components/TabsNav/TabsNav.styles.js +7 -9
- package/dist/components/TaxResidenceCard/TaxResidenceCard.js +26 -11
- package/dist/components/TaxResidenceCard/TaxResidenceCard.styles.d.ts +29 -12
- package/dist/components/TaxResidenceCard/TaxResidenceCard.styles.js +103 -30
- package/dist/components/Text/Text.styles.d.ts +2 -1
- package/dist/components/Text/Text.styles.js +36 -70
- package/dist/components/TextLink/TextLink.styles.js +5 -7
- package/dist/components/Timeline/Timeline.styles.js +17 -23
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.js +1 -2
- package/dist/components/Tooltip/Tooltip.styles.js +4 -5
- package/dist/components/breakdown/Breakdown.js +3 -5
- package/dist/components/logo/Logo.js +1 -1
- package/dist/constants/chainLogos.d.ts +9 -0
- package/dist/constants/chainLogos.js +17 -0
- package/dist/design-system/css/base.css +14 -14
- package/dist/design-system/css-builders.d.ts +25 -0
- package/dist/design-system/css-builders.js +81 -0
- package/dist/design-system/generated/fonts.css +0 -49
- package/dist/design-system/generated/text-classes.css +123 -123
- package/dist/design-system/generated/text-styles.d.ts +24 -24
- package/dist/design-system/generated/text-styles.js +123 -123
- package/dist/design-system/generated/tokens.css +417 -412
- package/dist/design-system/index.d.ts +2 -1
- package/dist/design-system/styled/build-theme.js +1 -1
- package/dist/design-system/tokens/colors.d.ts +1 -1
- package/dist/design-system/tokens/colors.js +1 -1
- package/dist/design-system/tokens/fonts.d.ts +6 -2
- package/dist/design-system/tokens/fonts.js +1 -1
- package/dist/design-system/tokens/semantic.d.ts +15 -3
- package/dist/design-system/tokens/semantic.js +5 -1
- package/dist/design-system/tokens/typography.d.ts +1 -1
- package/dist/design-system/tokens/typography.js +64 -41
- package/dist/index.d.ts +84 -7
- package/dist/index.js +24 -4
- package/dist/static/images/chains/avalanche.svg +7 -0
- package/dist/static/images/chains/avalanche.svg.js +4 -0
- package/dist/static/images/chains/ethereum.svg +14 -0
- package/dist/static/images/chains/ethereum.svg.js +4 -0
- package/dist/static/images/chains/liquid.svg +7 -0
- package/dist/static/images/chains/liquid.svg.js +4 -0
- package/dist/static/images/chains/solana.svg +29 -0
- package/dist/static/images/chains/solana.svg.js +4 -0
- package/dist/static/images/chains/stellar.svg +17 -0
- package/dist/static/images/chains/stellar.svg.js +4 -0
- package/dist/static/images/chains/tempo.svg +11 -0
- package/dist/static/images/chains/tempo.svg.js +4 -0
- package/dist/styles/borderedField.d.ts +11 -0
- package/dist/styles/borderedField.js +53 -0
- package/package.json +1 -1
- package/dist/static/images/globe.svg.js +0 -5
- package/dist/static/images/trash.svg +0 -17
- package/dist/static/images/trash.svg.js +0 -5
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MaterialIcon } from "../MaterialIcon/MaterialIcon.js";
|
|
3
|
+
import { Aside, MobileHeader, CloseButton, DesktopOnly, TopBlock, Eyebrow, NameGroup, Title, Description, MobileOnly, Spacer, SupportWrap, SupportHeading, SupportBody, SupportLink, LogoButton, MobileLogoImg, DesktopLogoImg } from "./StepSidebar.styles.js";
|
|
4
|
+
const LOGO_URL = "https://res.cloudinary.com/stokr/image/upload/v1782908299/STOKR_v7r1dp.png";
|
|
5
|
+
const StepSidebar = ({
|
|
6
|
+
children,
|
|
7
|
+
mobileContent,
|
|
8
|
+
mobileAction,
|
|
9
|
+
intro,
|
|
10
|
+
support,
|
|
11
|
+
logoAlt,
|
|
12
|
+
onLogoClick,
|
|
13
|
+
onClose,
|
|
14
|
+
closeLabel = "Close",
|
|
15
|
+
dataCyPrefix = "step-sidebar",
|
|
16
|
+
className
|
|
17
|
+
}) => {
|
|
18
|
+
const logo = (Img, suffix) => onLogoClick ? /* @__PURE__ */ jsx(LogoButton, { type: "button", onClick: onLogoClick, "data-cy": `${dataCyPrefix}-${suffix}`, children: /* @__PURE__ */ jsx(Img, { src: LOGO_URL, alt: logoAlt }) }) : /* @__PURE__ */ jsx(Img, { src: LOGO_URL, alt: logoAlt, "data-cy": `${dataCyPrefix}-${suffix}` });
|
|
19
|
+
return /* @__PURE__ */ jsxs(Aside, { className, "data-theme": "dark", children: [
|
|
20
|
+
/* @__PURE__ */ jsxs(MobileHeader, { children: [
|
|
21
|
+
logo(MobileLogoImg, "logo-mobile"),
|
|
22
|
+
mobileAction,
|
|
23
|
+
onClose && /* @__PURE__ */ jsx(CloseButton, { type: "button", "aria-label": closeLabel, onClick: onClose, "data-cy": `${dataCyPrefix}-close`, children: /* @__PURE__ */ jsx(MaterialIcon, { name: "close", size: 28 }) })
|
|
24
|
+
] }),
|
|
25
|
+
/* @__PURE__ */ jsx(DesktopOnly, { children: logo(DesktopLogoImg, "logo") }),
|
|
26
|
+
intro && /* @__PURE__ */ jsx(DesktopOnly, { children: /* @__PURE__ */ jsxs(TopBlock, { children: [
|
|
27
|
+
/* @__PURE__ */ jsx(Eyebrow, { children: intro.eyebrow }),
|
|
28
|
+
/* @__PURE__ */ jsxs(NameGroup, { children: [
|
|
29
|
+
/* @__PURE__ */ jsx(Title, { children: intro.title }),
|
|
30
|
+
intro.description && /* @__PURE__ */ jsx(Description, { children: intro.description })
|
|
31
|
+
] })
|
|
32
|
+
] }) }),
|
|
33
|
+
children && /* @__PURE__ */ jsx(DesktopOnly, { children }),
|
|
34
|
+
mobileContent && /* @__PURE__ */ jsx(MobileOnly, { children: mobileContent }),
|
|
35
|
+
/* @__PURE__ */ jsxs(DesktopOnly, { children: [
|
|
36
|
+
/* @__PURE__ */ jsx(Spacer, {}),
|
|
37
|
+
support && /* @__PURE__ */ jsxs(SupportWrap, { children: [
|
|
38
|
+
/* @__PURE__ */ jsx(SupportHeading, { children: support.heading }),
|
|
39
|
+
/* @__PURE__ */ jsxs(SupportBody, { children: [
|
|
40
|
+
support.body,
|
|
41
|
+
" ",
|
|
42
|
+
/* @__PURE__ */ jsx(
|
|
43
|
+
SupportLink,
|
|
44
|
+
{
|
|
45
|
+
href: support.href,
|
|
46
|
+
"data-cy": `${dataCyPrefix}-support-link`,
|
|
47
|
+
...support.external && { target: "_blank", rel: "noopener noreferrer" },
|
|
48
|
+
children: support.linkLabel
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
] })
|
|
52
|
+
] })
|
|
53
|
+
] })
|
|
54
|
+
] });
|
|
55
|
+
};
|
|
56
|
+
export {
|
|
57
|
+
StepSidebar
|
|
58
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** Always dark: the component sets `data-theme="dark"` on it, so every semantic token below resolves to its dark value in either theme. */
|
|
2
|
+
export declare const Aside: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLElement>, HTMLElement>, "style"> & {
|
|
3
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
4
|
+
}> & string;
|
|
5
|
+
export declare const MobileHeader: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
6
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
7
|
+
}> & string;
|
|
8
|
+
export declare const CloseButton: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
|
|
9
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
10
|
+
}> & string;
|
|
11
|
+
export declare const DesktopOnly: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
12
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
13
|
+
}> & string;
|
|
14
|
+
export declare const MobileOnly: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
15
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
16
|
+
}> & string;
|
|
17
|
+
export declare const Spacer: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
18
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
19
|
+
}> & string;
|
|
20
|
+
export declare const LogoButton: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
|
|
21
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
22
|
+
}> & string;
|
|
23
|
+
export declare const MobileLogoImg: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "style"> & {
|
|
24
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
25
|
+
}> & string;
|
|
26
|
+
export declare const DesktopLogoImg: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "style"> & {
|
|
27
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
28
|
+
}> & string;
|
|
29
|
+
export declare const TopBlock: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
30
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
31
|
+
}> & string;
|
|
32
|
+
export declare const NameGroup: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
33
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
34
|
+
}> & string;
|
|
35
|
+
export declare const Eyebrow: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "style"> & {
|
|
36
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
37
|
+
}> & string;
|
|
38
|
+
export declare const Title: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "style"> & {
|
|
39
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
40
|
+
}> & string;
|
|
41
|
+
export declare const Description: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "style"> & {
|
|
42
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
43
|
+
}> & string;
|
|
44
|
+
export declare const SupportWrap: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
45
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
46
|
+
}> & string;
|
|
47
|
+
export declare const SupportHeading: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "style"> & {
|
|
48
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
49
|
+
}> & string;
|
|
50
|
+
export declare const SupportBody: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "style"> & {
|
|
51
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
52
|
+
}> & string;
|
|
53
|
+
export declare const SupportLink: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "style"> & {
|
|
54
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
55
|
+
}> & string;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { breakpoint } from "../../design-system/styled/breakpoint.js";
|
|
3
|
+
import { text } from "../../design-system/styled/text.js";
|
|
4
|
+
const Aside = styled.aside`
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
background-color: var(--background-default);
|
|
8
|
+
color: var(--text-primary);
|
|
9
|
+
position: sticky;
|
|
10
|
+
top: 0;
|
|
11
|
+
z-index: 10;
|
|
12
|
+
-webkit-font-smoothing: antialiased;
|
|
13
|
+
-moz-osx-font-smoothing: grayscale;
|
|
14
|
+
|
|
15
|
+
${breakpoint.MLarge`
|
|
16
|
+
align-items: stretch;
|
|
17
|
+
gap: 48px;
|
|
18
|
+
width: 100%;
|
|
19
|
+
min-width: 0;
|
|
20
|
+
height: 100vh;
|
|
21
|
+
padding: 48px;
|
|
22
|
+
overflow-x: hidden;
|
|
23
|
+
overflow-y: auto;
|
|
24
|
+
overflow-wrap: anywhere;
|
|
25
|
+
border-right: 1px solid var(--border-subtle);
|
|
26
|
+
`}
|
|
27
|
+
`;
|
|
28
|
+
const MobileHeader = styled.div`
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
gap: 16px;
|
|
32
|
+
height: 56px;
|
|
33
|
+
padding: 0 18px;
|
|
34
|
+
|
|
35
|
+
> :first-child {
|
|
36
|
+
margin-right: auto;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
${breakpoint.MLarge`
|
|
40
|
+
display: none;
|
|
41
|
+
`}
|
|
42
|
+
`;
|
|
43
|
+
const CloseButton = styled.button`
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
flex-shrink: 0;
|
|
48
|
+
width: 32px;
|
|
49
|
+
height: 32px;
|
|
50
|
+
padding: 0;
|
|
51
|
+
background: none;
|
|
52
|
+
border: none;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
color: var(--text-primary);
|
|
55
|
+
transition: opacity 0.2s;
|
|
56
|
+
|
|
57
|
+
&:hover {
|
|
58
|
+
opacity: 0.7;
|
|
59
|
+
}
|
|
60
|
+
`;
|
|
61
|
+
const DesktopOnly = styled.div`
|
|
62
|
+
display: none;
|
|
63
|
+
|
|
64
|
+
${breakpoint.MLarge`
|
|
65
|
+
display: contents;
|
|
66
|
+
`}
|
|
67
|
+
`;
|
|
68
|
+
const MobileOnly = styled.div`
|
|
69
|
+
display: contents;
|
|
70
|
+
|
|
71
|
+
${breakpoint.MLarge`
|
|
72
|
+
display: none;
|
|
73
|
+
`}
|
|
74
|
+
`;
|
|
75
|
+
const Spacer = styled.div`
|
|
76
|
+
flex: 1 1 auto;
|
|
77
|
+
`;
|
|
78
|
+
const LogoButton = styled.button`
|
|
79
|
+
display: inline-block;
|
|
80
|
+
padding: 0;
|
|
81
|
+
background: none;
|
|
82
|
+
border: none;
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
color: var(--text-primary);
|
|
85
|
+
`;
|
|
86
|
+
const MobileLogoImg = styled.img`
|
|
87
|
+
display: block;
|
|
88
|
+
width: 100px;
|
|
89
|
+
height: auto;
|
|
90
|
+
`;
|
|
91
|
+
const DesktopLogoImg = styled.img`
|
|
92
|
+
display: block;
|
|
93
|
+
width: 140px;
|
|
94
|
+
height: auto;
|
|
95
|
+
`;
|
|
96
|
+
const TopBlock = styled.div`
|
|
97
|
+
display: flex;
|
|
98
|
+
flex-direction: column;
|
|
99
|
+
gap: 16px;
|
|
100
|
+
`;
|
|
101
|
+
const NameGroup = styled.div`
|
|
102
|
+
display: flex;
|
|
103
|
+
flex-direction: column;
|
|
104
|
+
gap: 12px;
|
|
105
|
+
`;
|
|
106
|
+
const Eyebrow = styled.p`
|
|
107
|
+
${text("labelRegular")}
|
|
108
|
+
margin: 0;
|
|
109
|
+
color: var(--text-primary);
|
|
110
|
+
`;
|
|
111
|
+
const Title = styled.p`
|
|
112
|
+
${text("titleL")}
|
|
113
|
+
margin: 0;
|
|
114
|
+
color: var(--text-primary);
|
|
115
|
+
`;
|
|
116
|
+
const Description = styled.p`
|
|
117
|
+
${text("bodyM")}
|
|
118
|
+
margin: 0;
|
|
119
|
+
color: var(--text-primary);
|
|
120
|
+
`;
|
|
121
|
+
const SupportWrap = styled.div`
|
|
122
|
+
padding-top: 21px;
|
|
123
|
+
border-top: 1px solid var(--border-strong);
|
|
124
|
+
`;
|
|
125
|
+
const SupportHeading = styled.p`
|
|
126
|
+
margin: 0 0 6px;
|
|
127
|
+
${text("subtitleM")}
|
|
128
|
+
color: var(--text-primary);
|
|
129
|
+
`;
|
|
130
|
+
const SupportBody = styled.p`
|
|
131
|
+
margin: 0;
|
|
132
|
+
font-size: 12px;
|
|
133
|
+
font-weight: 400;
|
|
134
|
+
line-height: 18px;
|
|
135
|
+
color: var(--text-primary);
|
|
136
|
+
|
|
137
|
+
${breakpoint.XLarge`
|
|
138
|
+
font-size: 13px;
|
|
139
|
+
`}
|
|
140
|
+
`;
|
|
141
|
+
const SupportLink = styled.a`
|
|
142
|
+
color: var(--action-accent-bg);
|
|
143
|
+
text-decoration: underline;
|
|
144
|
+
|
|
145
|
+
&:hover {
|
|
146
|
+
color: var(--action-accent-bg);
|
|
147
|
+
}
|
|
148
|
+
`;
|
|
149
|
+
export {
|
|
150
|
+
Aside,
|
|
151
|
+
CloseButton,
|
|
152
|
+
Description,
|
|
153
|
+
DesktopLogoImg,
|
|
154
|
+
DesktopOnly,
|
|
155
|
+
Eyebrow,
|
|
156
|
+
LogoButton,
|
|
157
|
+
MobileHeader,
|
|
158
|
+
MobileLogoImg,
|
|
159
|
+
MobileOnly,
|
|
160
|
+
NameGroup,
|
|
161
|
+
Spacer,
|
|
162
|
+
SupportBody,
|
|
163
|
+
SupportHeading,
|
|
164
|
+
SupportLink,
|
|
165
|
+
SupportWrap,
|
|
166
|
+
Title,
|
|
167
|
+
TopBlock
|
|
168
|
+
};
|
|
@@ -9,14 +9,28 @@ export declare const LoaderRing: ({ size, className }: {
|
|
|
9
9
|
size?: number;
|
|
10
10
|
className?: string;
|
|
11
11
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
/**
|
|
13
|
+
* The STOKR wordmark loader: the letters form top to bottom, the O draws itself, then keeps turning. Transparent
|
|
14
|
+
* background, drawn in `text-primary` (black in light, white in dark). The height follows the `width`.
|
|
15
|
+
*/
|
|
16
|
+
export declare const LoaderLogo: ({ width, className }: {
|
|
17
|
+
width?: number;
|
|
18
|
+
className?: string;
|
|
19
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
/** `ring` is the circle; `logo` is the STOKR wordmark whose O keeps turning. */
|
|
21
|
+
export type StokrLoaderVariant = 'ring' | 'logo';
|
|
12
22
|
export interface StokrLoaderProps {
|
|
13
23
|
/** Leaves the top 97px (the header) visible instead of covering the whole screen. */
|
|
14
24
|
noFullscreen?: boolean;
|
|
25
|
+
/** Which animation to show. Default `ring`. */
|
|
26
|
+
variant?: StokrLoaderVariant;
|
|
15
27
|
}
|
|
16
28
|
/** Full-screen STOKR loading animation, shown while a page loads. */
|
|
17
|
-
export declare function StokrLoader({ noFullscreen }: StokrLoaderProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export declare function StokrLoader({ noFullscreen, variant }: StokrLoaderProps): import("react/jsx-runtime").JSX.Element;
|
|
18
30
|
/** The loading animation centred in its container, for a loading area inside a page. */
|
|
19
|
-
export declare const StokrLoaderBox: (
|
|
31
|
+
export declare const StokrLoaderBox: ({ variant }: {
|
|
32
|
+
variant?: StokrLoaderVariant;
|
|
33
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
20
34
|
export declare const AnimatedSpan: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Merged<Omit<import('react').DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "style"> & {
|
|
21
35
|
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
22
36
|
}, {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from "react";
|
|
3
|
+
import styled, { keyframes, css } from "styled-components";
|
|
4
|
+
import { useLoaderElapsed, elapsedStyle } from "./loaderSession.js";
|
|
3
5
|
import { breakpoint } from "../../design-system/styled/breakpoint.js";
|
|
4
6
|
const loaderGif = "https://res.cloudinary.com/stokr/image/upload/f_webp,fl_awebp,q_auto/v1575035788/Static/stokr_loader_white_400x400_egnhgb.gif";
|
|
5
7
|
const RING_CIRCUMFERENCE = 1021;
|
|
@@ -23,7 +25,7 @@ const RingSvg = styled.svg`
|
|
|
23
25
|
display: block;
|
|
24
26
|
max-width: 100%;
|
|
25
27
|
max-height: 100%;
|
|
26
|
-
color: var(--
|
|
28
|
+
color: var(--text-primary);
|
|
27
29
|
|
|
28
30
|
circle {
|
|
29
31
|
transform-origin: 200px 200px;
|
|
@@ -31,6 +33,125 @@ const RingSvg = styled.svg`
|
|
|
31
33
|
}
|
|
32
34
|
`;
|
|
33
35
|
const LoaderRing = ({ size = 400, className }) => /* @__PURE__ */ jsx(RingSvg, { className, width: size, height: size, viewBox: "0 0 400 400", role: "img", "aria-label": "Loading", children: /* @__PURE__ */ jsx("circle", { cx: "200", cy: "200", r: "162.5", fill: "none", stroke: "currentColor", strokeWidth: "75" }) });
|
|
36
|
+
const LOGO_WIDTH = 140;
|
|
37
|
+
const LOGO_HEIGHT = 34;
|
|
38
|
+
const LOGO_O_CENTER = "64.94px 17px";
|
|
39
|
+
const LOGO_O_CIRCUMFERENCE = 86.35;
|
|
40
|
+
const LOGO_O_DRAWN = 64.76;
|
|
41
|
+
const LOGO_LETTERS = [
|
|
42
|
+
{
|
|
43
|
+
key: "s",
|
|
44
|
+
d: "M14.8041 9.24243C13.2455 7.01254 11.6592 5.89746 10.0438 5.89746C9.25726 5.89746 8.61397 6.11412 8.1137 6.54658C7.61343 6.97961 7.36329 7.46753 7.36329 8.01005C7.36329 8.55315 7.54164 9.0665 7.89945 9.55038C8.38521 10.1963 9.85041 11.5827 12.2948 13.7094C14.5816 15.6755 15.9682 16.9151 16.4545 17.4285C17.6693 18.6903 18.5304 19.8964 19.0381 21.0485C19.5455 22.2 19.7995 23.4578 19.7995 24.8221C19.7995 27.4778 18.9063 29.6707 17.1208 31.402C15.3348 33.133 13.0066 33.9985 10.1356 33.9985C7.8926 33.9985 5.93918 33.4334 4.27479 32.3042C2.61068 31.1744 1.18548 29.3995 0 26.9786L5.03781 23.8541C6.55288 26.7146 8.29644 28.1449 10.2688 28.1449C11.2973 28.1449 12.1622 27.8372 12.8625 27.2207C13.563 26.6048 13.9132 25.8933 13.9132 25.0862C13.9132 24.353 13.6485 23.6195 13.1197 22.8858C12.5907 22.1523 11.426 21.03 9.62493 19.5188C6.19397 16.6436 3.97808 14.4244 2.97753 12.8621C1.97699 11.2998 1.47699 9.74104 1.47699 8.18627C1.47699 5.94166 2.30932 4.01597 3.9737 2.40978C5.63781 0.803307 7.69178 0.000213623 10.1348 0.000213623C11.7066 0.000213623 13.203 0.374027 14.6244 1.12252C16.046 1.87044 17.5852 3.23512 19.2427 5.2157L19.8038 5.83564L15.2899 9.93054L14.8041 9.24243Z"
|
|
45
|
+
},
|
|
46
|
+
{ key: "t", d: "M28 7.75029H33.3333V34H38.6667V7.75029H44V1.91705H28V7.75029Z" },
|
|
47
|
+
{
|
|
48
|
+
key: "k",
|
|
49
|
+
d: "M110.8 1.91705H103.596L95.3794 12.6707L94.0003 14.4478V1.91705H88V34H94.0003V17.9804L95.3794 19.9973L104.885 34H112L100 16.5008L110.8 1.91705Z"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
key: "r",
|
|
53
|
+
d: "M132.873 12.4215H132.873C132.866 17.5985 125.568 17.0776 123.965 17.0796V12.4215V12.4138V7.75566C125.568 7.75735 132.866 7.23676 132.873 12.4138H132.873V12.4175V12.4215ZM133.447 21.3952C136.481 20.0128 138.812 17.3912 138.812 12.4186C138.812 2.82858 130.151 1.96959 124.481 1.92016C124.436 1.9196 124.39 1.91903 124.345 1.91875C124.236 1.9179 124.129 1.91762 124.022 1.91762C123.96 1.91734 123.897 1.91705 123.836 1.91705C123.815 1.91705 123.796 1.91705 123.776 1.91705C123.62 1.91705 123.469 1.9179 123.319 1.91847C123.274 1.91875 123.227 1.91875 123.182 1.91903C123.017 1.9179 122.855 1.91762 122.695 1.91762H122.682C122.657 1.91762 122.633 1.9179 122.608 1.9179C122.436 1.9179 122.268 1.91847 122.103 1.91931C121.844 1.92044 121.592 1.92214 121.354 1.92327H118.026H118.003V12.4186V22.914L118 34H123.965V22.9199C124.243 22.9196 124.529 22.9174 124.823 22.9129C124.831 22.9129 124.838 22.9129 124.846 22.9126C125.123 22.9083 125.406 22.9013 125.694 22.8917C125.738 22.89 125.782 22.8883 125.826 22.8866C126.388 22.8663 126.968 22.8326 127.558 22.7809C127.603 22.7773 127.647 22.7753 127.692 22.7711L133.508 34H140L133.447 21.3952Z"
|
|
54
|
+
}
|
|
55
|
+
];
|
|
56
|
+
const logoWipe = keyframes`
|
|
57
|
+
to { transform: scaleY(1); }
|
|
58
|
+
`;
|
|
59
|
+
const logoDraw = keyframes`
|
|
60
|
+
from { stroke-dasharray: 0 ${LOGO_O_CIRCUMFERENCE}; }
|
|
61
|
+
to { stroke-dasharray: ${LOGO_O_DRAWN} ${LOGO_O_CIRCUMFERENCE}; }
|
|
62
|
+
`;
|
|
63
|
+
const logoSpin = keyframes`
|
|
64
|
+
to { transform: rotate(360deg); }
|
|
65
|
+
`;
|
|
66
|
+
const LogoSvg = styled.svg`
|
|
67
|
+
display: block;
|
|
68
|
+
max-width: 100%;
|
|
69
|
+
height: auto;
|
|
70
|
+
color: var(--text-primary);
|
|
71
|
+
|
|
72
|
+
.wipe {
|
|
73
|
+
transform-box: fill-box;
|
|
74
|
+
transform-origin: 50% 0;
|
|
75
|
+
transform: scaleY(0);
|
|
76
|
+
animation: ${logoWipe} 0.95s cubic-bezier(0.65, 0, 0.35, 1) forwards;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* Every delay minus the time this loading moment already ran (see useLoaderElapsed): a negative delay starts the
|
|
80
|
+
animation part-way, so a loader replacing another one carries on instead of restarting. */
|
|
81
|
+
.wipe-s {
|
|
82
|
+
animation-delay: calc(0s - var(--loader-elapsed, 0s));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.wipe-t {
|
|
86
|
+
animation-delay: calc(0.15s - var(--loader-elapsed, 0s));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.wipe-k {
|
|
90
|
+
animation-delay: calc(0.6s - var(--loader-elapsed, 0s));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.wipe-r {
|
|
94
|
+
animation-delay: calc(0.75s - var(--loader-elapsed, 0s));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.draw {
|
|
98
|
+
animation: ${logoDraw} 1s cubic-bezier(0.65, 0, 0.35, 1) both;
|
|
99
|
+
animation-delay: calc(0.3s - var(--loader-elapsed, 0s));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.spin {
|
|
103
|
+
transform-origin: ${LOGO_O_CENTER};
|
|
104
|
+
animation: ${logoSpin} 2.2s cubic-bezier(0.65, 0, 0.35, 1) infinite;
|
|
105
|
+
animation-delay: calc(1.8s - var(--loader-elapsed, 0s));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* No motion asked for: the finished wordmark, with the O as drawn, standing still. The label still says "Loading". */
|
|
109
|
+
@media (prefers-reduced-motion: reduce) {
|
|
110
|
+
.wipe {
|
|
111
|
+
animation: none;
|
|
112
|
+
transform: scaleY(1);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.draw,
|
|
116
|
+
.spin {
|
|
117
|
+
animation: none;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
`;
|
|
121
|
+
const LoaderLogo = ({ width = LOGO_WIDTH, className }) => {
|
|
122
|
+
const elapsed = useLoaderElapsed();
|
|
123
|
+
const id = useId().replace(/:/g, "");
|
|
124
|
+
return /* @__PURE__ */ jsxs(
|
|
125
|
+
LogoSvg,
|
|
126
|
+
{
|
|
127
|
+
className,
|
|
128
|
+
style: elapsedStyle(elapsed),
|
|
129
|
+
width,
|
|
130
|
+
height: width * LOGO_HEIGHT / LOGO_WIDTH,
|
|
131
|
+
viewBox: `0 0 ${LOGO_WIDTH} ${LOGO_HEIGHT}`,
|
|
132
|
+
fill: "none",
|
|
133
|
+
role: "img",
|
|
134
|
+
"aria-label": "Loading",
|
|
135
|
+
children: [
|
|
136
|
+
/* @__PURE__ */ jsx("defs", { children: LOGO_LETTERS.map(({ key }) => /* @__PURE__ */ jsx("clipPath", { id: `${id}-${key}`, children: /* @__PURE__ */ jsx("rect", { className: `wipe wipe-${key}`, x: "-2", y: "-1", width: LOGO_WIDTH + 4, height: LOGO_HEIGHT + 2 }) }, key)) }),
|
|
137
|
+
LOGO_LETTERS.map(({ key, d }) => /* @__PURE__ */ jsx("g", { clipPath: `url(#${id}-${key})`, children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d, fill: "currentColor" }) }, key)),
|
|
138
|
+
/* @__PURE__ */ jsx("g", { className: "spin", children: /* @__PURE__ */ jsx(
|
|
139
|
+
"circle",
|
|
140
|
+
{
|
|
141
|
+
className: "draw",
|
|
142
|
+
cx: "64.94",
|
|
143
|
+
cy: "17",
|
|
144
|
+
r: "13.743",
|
|
145
|
+
stroke: "currentColor",
|
|
146
|
+
strokeWidth: "6.515",
|
|
147
|
+
strokeDasharray: `${LOGO_O_DRAWN} ${LOGO_O_CIRCUMFERENCE}`,
|
|
148
|
+
transform: "rotate(-90 64.94 17)"
|
|
149
|
+
}
|
|
150
|
+
) })
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
};
|
|
34
155
|
const CenterFullWidth = styled.div`
|
|
35
156
|
width: 100%;
|
|
36
157
|
height: 100%;
|
|
@@ -52,11 +173,12 @@ const fadeIn = keyframes`
|
|
|
52
173
|
}
|
|
53
174
|
`;
|
|
54
175
|
const StyledStokrLoader = styled.div.withConfig({
|
|
55
|
-
shouldForwardProp: (props) => !["noFullscreen"].includes(props)
|
|
176
|
+
shouldForwardProp: (props) => !["noFullscreen", "variant"].includes(props)
|
|
56
177
|
})`
|
|
57
178
|
align-items: center;
|
|
58
179
|
animation: ${fadeIn} 1.8s ease-in-out forwards;
|
|
59
|
-
|
|
180
|
+
animation-delay: calc(0s - var(--loader-elapsed, 0s));
|
|
181
|
+
background: var(--background-default);
|
|
60
182
|
display: flex;
|
|
61
183
|
height: 100vh;
|
|
62
184
|
justify-content: center;
|
|
@@ -66,39 +188,58 @@ const StyledStokrLoader = styled.div.withConfig({
|
|
|
66
188
|
width: 100vw;
|
|
67
189
|
z-index: 1000;
|
|
68
190
|
|
|
191
|
+
/* The fade-in is decoration too: show the loader at once when motion is reduced. */
|
|
192
|
+
@media (prefers-reduced-motion: reduce) {
|
|
193
|
+
animation: none;
|
|
194
|
+
}
|
|
195
|
+
|
|
69
196
|
${({ noFullscreen }) => noFullscreen && `
|
|
70
197
|
height: calc(100vh - 97px);
|
|
71
198
|
bottom: 0;
|
|
72
199
|
top: unset;
|
|
73
200
|
`}
|
|
74
201
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
`}
|
|
202
|
+
${({ variant }) => variant === "logo" ? css`
|
|
203
|
+
/* The wordmark is 140 × 34, so it needs far more width than the ring to carry the same weight on the page. */
|
|
204
|
+
svg {
|
|
205
|
+
width: min(80vw, 280px);
|
|
206
|
+
}
|
|
82
207
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
208
|
+
${breakpoint.Medium`
|
|
209
|
+
svg {
|
|
210
|
+
width: min(60vw, 480px);
|
|
211
|
+
}
|
|
212
|
+
`}
|
|
213
|
+
` : css`
|
|
214
|
+
/* 320px, 375px and 768px at the 16px base. */
|
|
215
|
+
${breakpoint.Small`
|
|
216
|
+
svg {
|
|
217
|
+
height: 150px;
|
|
218
|
+
width: 150px;
|
|
219
|
+
}
|
|
220
|
+
`}
|
|
89
221
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
222
|
+
${breakpoint.Small`
|
|
223
|
+
svg {
|
|
224
|
+
height: 180px;
|
|
225
|
+
width: 180px;
|
|
226
|
+
}
|
|
227
|
+
`}
|
|
228
|
+
|
|
229
|
+
${breakpoint.Medium`
|
|
230
|
+
svg {
|
|
231
|
+
height: 300px;
|
|
232
|
+
width: 300px;
|
|
233
|
+
}
|
|
234
|
+
`}
|
|
235
|
+
`}
|
|
96
236
|
`;
|
|
97
|
-
function StokrLoader({ noFullscreen }) {
|
|
98
|
-
|
|
237
|
+
function StokrLoader({ noFullscreen, variant = "ring" }) {
|
|
238
|
+
const elapsed = useLoaderElapsed();
|
|
239
|
+
return /* @__PURE__ */ jsx(StyledStokrLoader, { noFullscreen, variant, style: elapsedStyle(elapsed), children: variant === "logo" ? /* @__PURE__ */ jsx(LoaderLogo, {}) : /* @__PURE__ */ jsx(LoaderRing, {}) });
|
|
99
240
|
}
|
|
100
|
-
const StokrLoaderBox = () => {
|
|
101
|
-
return /* @__PURE__ */ jsx(CenterFullWidth, { children: /* @__PURE__ */ jsx(LoaderRing, {}) });
|
|
241
|
+
const StokrLoaderBox = ({ variant = "ring" }) => {
|
|
242
|
+
return /* @__PURE__ */ jsx(CenterFullWidth, { children: variant === "logo" ? /* @__PURE__ */ jsx(LoaderLogo, { width: 280 }) : /* @__PURE__ */ jsx(LoaderRing, {}) });
|
|
102
243
|
};
|
|
103
244
|
const fadeInOut = keyframes`
|
|
104
245
|
50% {
|
|
@@ -133,6 +274,7 @@ const LoadingDots = (props) => {
|
|
|
133
274
|
};
|
|
134
275
|
export {
|
|
135
276
|
AnimatedSpan,
|
|
277
|
+
LoaderLogo,
|
|
136
278
|
LoaderRing,
|
|
137
279
|
LoadingDots,
|
|
138
280
|
StokrLoader,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
export interface LoaderSession {
|
|
3
|
+
start: number;
|
|
4
|
+
mounted: number;
|
|
5
|
+
lastUnmount: number;
|
|
6
|
+
}
|
|
7
|
+
/** A loader that mounts within this gap after another one left continues the same animation. */
|
|
8
|
+
export declare const LOADER_CONTINUES_WITHIN_MS = 600;
|
|
9
|
+
/** Seconds the current loading moment has been running at time `at` (ms); 0 when this is a new moment. */
|
|
10
|
+
export declare const loaderElapsed: (session: LoaderSession, at: number) => number;
|
|
11
|
+
/** Elapsed seconds, read once when the loader first renders, and the loader registered while it is on screen. */
|
|
12
|
+
export declare const useLoaderElapsed: () => number;
|
|
13
|
+
/** The CSS variable the animation delays subtract, so a loader that mounts late starts that far into the animation. */
|
|
14
|
+
export declare const elapsedStyle: (elapsed: number) => CSSProperties;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useState, useEffect } from "react";
|
|
2
|
+
const SESSION_KEY = /* @__PURE__ */ Symbol.for("stokr.loader.session");
|
|
3
|
+
const LOADER_CONTINUES_WITHIN_MS = 600;
|
|
4
|
+
const getSession = () => {
|
|
5
|
+
const holder = globalThis;
|
|
6
|
+
return holder[SESSION_KEY] ??= { start: 0, mounted: 0, lastUnmount: -Infinity };
|
|
7
|
+
};
|
|
8
|
+
const clock = () => typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
9
|
+
const loaderElapsed = (session, at) => session.mounted > 0 || at - session.lastUnmount <= LOADER_CONTINUES_WITHIN_MS ? Math.max(0, (at - session.start) / 1e3) : 0;
|
|
10
|
+
const useLoaderElapsed = () => {
|
|
11
|
+
const [elapsed] = useState(() => loaderElapsed(getSession(), clock()));
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const session = getSession();
|
|
14
|
+
const at = clock();
|
|
15
|
+
if (session.mounted === 0 && at - session.lastUnmount > LOADER_CONTINUES_WITHIN_MS) session.start = at;
|
|
16
|
+
session.mounted += 1;
|
|
17
|
+
return () => {
|
|
18
|
+
session.mounted -= 1;
|
|
19
|
+
session.lastUnmount = clock();
|
|
20
|
+
};
|
|
21
|
+
}, []);
|
|
22
|
+
return elapsed;
|
|
23
|
+
};
|
|
24
|
+
const elapsedStyle = (elapsed) => ({ "--loader-elapsed": `${elapsed.toFixed(2)}s` });
|
|
25
|
+
export {
|
|
26
|
+
LOADER_CONTINUES_WITHIN_MS,
|
|
27
|
+
elapsedStyle,
|
|
28
|
+
loaderElapsed,
|
|
29
|
+
useLoaderElapsed
|
|
30
|
+
};
|