@stokr/components-library 3.3.0 → 4.0.1
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 +41 -0
- package/dist/components/MaterialIcon/MaterialIcon.js +55 -0
- package/dist/components/MaterialIcon/MaterialIcon.styles.d.ts +14 -0
- package/dist/components/MaterialIcon/MaterialIcon.styles.js +31 -0
- package/dist/components/MaterialIcon/iconConfig.d.ts +24 -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 +83 -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 +21 -0
- package/dist/components/StokrLoader/StokrLoader.js +22 -23
- 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 -213
- 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 +37 -0
- package/dist/utils/copyToClipboard.js +3 -3
- 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 +12 -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,20 +1,44 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import { StyledChip, ChipText } from "./Chip.styles.js";
|
|
5
4
|
import { InfoIcon } from "../InfoIcon/InfoIcon.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
import { colors } from "../../styles/colors.js";
|
|
6
|
+
import { StyledChip, CHIP_ACTIVE_BG_HEX, ChipText } from "./Chip.styles.js";
|
|
7
|
+
const Chip = ({
|
|
8
|
+
children,
|
|
9
|
+
isActive = false,
|
|
10
|
+
onClick = () => {
|
|
11
|
+
},
|
|
12
|
+
tooltip = null,
|
|
13
|
+
tooltipProps,
|
|
14
|
+
activeColor = CHIP_ACTIVE_BG_HEX,
|
|
15
|
+
activeTextColor = colors.black,
|
|
16
|
+
...props
|
|
17
|
+
}) => {
|
|
18
|
+
return /* @__PURE__ */ jsxs(
|
|
19
|
+
StyledChip,
|
|
20
|
+
{
|
|
21
|
+
onClick,
|
|
22
|
+
isActive,
|
|
23
|
+
activeColor,
|
|
24
|
+
activeTextColor,
|
|
25
|
+
...props,
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ jsx(ChipText, { children }),
|
|
28
|
+
tooltip && /* @__PURE__ */ jsx(InfoIcon, { title: tooltip, position: "top", noMarginLeft: true, noMarginRight: true, tooltipProps })
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
);
|
|
12
32
|
};
|
|
13
33
|
Chip.propTypes = {
|
|
14
34
|
children: PropTypes.node.isRequired,
|
|
15
35
|
isActive: PropTypes.bool,
|
|
16
36
|
onClick: PropTypes.func,
|
|
17
|
-
tooltip: PropTypes.string
|
|
37
|
+
tooltip: PropTypes.string,
|
|
38
|
+
/** Background/border color for hover and active states (neutral by default) */
|
|
39
|
+
activeColor: PropTypes.string,
|
|
40
|
+
/** Text color for hover and active states */
|
|
41
|
+
activeTextColor: PropTypes.string
|
|
18
42
|
};
|
|
19
43
|
var stdin_default = Chip;
|
|
20
44
|
export {
|
|
@@ -1,44 +1,43 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
2
|
import theme from "../../styles/theme.js";
|
|
3
3
|
import { Icon } from "../InfoIcon/InfoIcon.styles.js";
|
|
4
|
+
const CHIP_ACTIVE_BG_HEX = "#f0f0f0";
|
|
5
|
+
const activeStyles = ({ activeColor, activeTextColor }) => `
|
|
6
|
+
border-color: ${activeColor};
|
|
7
|
+
background-color: ${activeColor};
|
|
8
|
+
color: ${activeTextColor};
|
|
9
|
+
|
|
10
|
+
${Icon} {
|
|
11
|
+
color: ${activeTextColor};
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
4
14
|
const StyledChip = styled.div.withConfig({
|
|
5
|
-
shouldForwardProp: (props) => !["isActive"].includes(props)
|
|
15
|
+
shouldForwardProp: (props) => !["isActive", "activeColor", "activeTextColor"].includes(props)
|
|
6
16
|
})`
|
|
7
17
|
display: inline-flex;
|
|
18
|
+
flex-shrink: 0;
|
|
8
19
|
gap: 4px;
|
|
9
20
|
align-items: center;
|
|
10
|
-
padding:
|
|
11
|
-
border
|
|
21
|
+
padding: 12px 16px;
|
|
22
|
+
border: 1px solid #ededed;
|
|
23
|
+
border-radius: 999px;
|
|
12
24
|
background-color: transparent;
|
|
13
|
-
color:
|
|
25
|
+
color: ${theme.cGrey5};
|
|
14
26
|
cursor: pointer;
|
|
15
|
-
transition:
|
|
27
|
+
transition:
|
|
28
|
+
background-color 0.2s ease,
|
|
29
|
+
border-color 0.2s ease;
|
|
16
30
|
font-size: 11px;
|
|
17
|
-
font-weight: 400;
|
|
18
31
|
line-height: 20px;
|
|
19
|
-
letter-spacing:
|
|
32
|
+
letter-spacing: 2px;
|
|
20
33
|
font-weight: 600;
|
|
21
|
-
min-height: 40px;
|
|
22
34
|
|
|
23
35
|
&:hover,
|
|
24
36
|
&:active {
|
|
25
|
-
|
|
26
|
-
color: white;
|
|
27
|
-
|
|
28
|
-
${Icon} {
|
|
29
|
-
color: ${theme.cWhite};
|
|
30
|
-
}
|
|
37
|
+
${(props) => activeStyles(props)}
|
|
31
38
|
}
|
|
32
39
|
|
|
33
|
-
${(
|
|
34
|
-
background-color: red;
|
|
35
|
-
color: white;
|
|
36
|
-
font-weight: 800;
|
|
37
|
-
|
|
38
|
-
${Icon} {
|
|
39
|
-
color: ${theme.cWhite} ;
|
|
40
|
-
}
|
|
41
|
-
`}
|
|
40
|
+
${(props) => props.isActive && activeStyles(props)}
|
|
42
41
|
`;
|
|
43
42
|
const Wrapper = styled.div.withConfig({
|
|
44
43
|
shouldForwardProp: (props) => !["customWrapperStyle"].includes(props)
|
|
@@ -58,14 +57,11 @@ styled.i.attrs({
|
|
|
58
57
|
font-size: 16px;
|
|
59
58
|
line-height: 16px;
|
|
60
59
|
vertical-align: middle;
|
|
61
|
-
color: ${theme.
|
|
60
|
+
color: ${theme.cGrey5};
|
|
62
61
|
transition: color 0.2s;
|
|
63
|
-
|
|
64
|
-
${StyledChip}:hover & {
|
|
65
|
-
color: ${theme.cWhite};
|
|
66
|
-
}
|
|
67
62
|
`;
|
|
68
63
|
export {
|
|
64
|
+
CHIP_ACTIVE_BG_HEX,
|
|
69
65
|
ChipText,
|
|
70
66
|
StyledChip,
|
|
71
67
|
Wrapper
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface CollapsibleProps {
|
|
3
|
+
title: ReactNode;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/** Controlled open state. Omit to let the component manage it. */
|
|
6
|
+
open?: boolean;
|
|
7
|
+
defaultOpen?: boolean;
|
|
8
|
+
onToggle?: (open: boolean) => void;
|
|
9
|
+
id?: string;
|
|
10
|
+
/** Figma's divided variant: a rule under the title while open. */
|
|
11
|
+
divided?: boolean;
|
|
12
|
+
/** Test-automation hook on the title button. */
|
|
13
|
+
dataCy?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* One collapsible card: title row with a chevron, body that animates open.
|
|
17
|
+
*/
|
|
18
|
+
export declare const Collapsible: ({ title, children, open, defaultOpen, onToggle, id, divided, dataCy, }: CollapsibleProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
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 { Root, Header, Chevron, Body, BodyClip, BodyInner } from "./Collapsible.styles.js";
|
|
6
|
+
const Collapsible = ({
|
|
7
|
+
title,
|
|
8
|
+
children,
|
|
9
|
+
open,
|
|
10
|
+
defaultOpen = false,
|
|
11
|
+
onToggle,
|
|
12
|
+
id,
|
|
13
|
+
divided = false,
|
|
14
|
+
dataCy
|
|
15
|
+
}) => {
|
|
16
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
|
|
17
|
+
const isOpen = open ?? uncontrolledOpen;
|
|
18
|
+
const bodyId = useId();
|
|
19
|
+
const toggle = () => {
|
|
20
|
+
if (open === void 0) setUncontrolledOpen(!isOpen);
|
|
21
|
+
onToggle?.(!isOpen);
|
|
22
|
+
};
|
|
23
|
+
return /* @__PURE__ */ jsxs(Root, { id, $open: isOpen, children: [
|
|
24
|
+
/* @__PURE__ */ jsxs(
|
|
25
|
+
Header,
|
|
26
|
+
{
|
|
27
|
+
type: "button",
|
|
28
|
+
"aria-expanded": isOpen,
|
|
29
|
+
"aria-controls": bodyId,
|
|
30
|
+
"data-cy": dataCy,
|
|
31
|
+
onClick: toggle,
|
|
32
|
+
$divided: divided && isOpen,
|
|
33
|
+
children: [
|
|
34
|
+
title,
|
|
35
|
+
/* @__PURE__ */ jsx(Chevron, { $open: isOpen, "aria-hidden": "true", children: /* @__PURE__ */ jsx(ArrowSimple, { width: 10, height: 6 }) })
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
/* @__PURE__ */ jsx(Body, { id: bodyId, $open: isOpen, inert: inertProp(!isOpen), children: /* @__PURE__ */ jsx(BodyClip, { children: /* @__PURE__ */ jsx(BodyInner, { $divided: divided, children }) }) })
|
|
40
|
+
] });
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
Collapsible
|
|
44
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Collapsed, it lifts under the pointer as a collapsed section does. */
|
|
2
|
+
export declare const Root: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
3
|
+
$open: boolean;
|
|
4
|
+
}>> & string;
|
|
5
|
+
export declare const Header: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
|
|
6
|
+
$divided: boolean;
|
|
7
|
+
}>> & string;
|
|
8
|
+
export declare const Chevron: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
9
|
+
$open: boolean;
|
|
10
|
+
}>> & string;
|
|
11
|
+
/** Animates height without measuring: grid rows transition between 0fr and 1fr. */
|
|
12
|
+
export declare const Body: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
13
|
+
$open: boolean;
|
|
14
|
+
}>> & string;
|
|
15
|
+
export declare const BodyClip: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
16
|
+
export declare const BodyInner: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
17
|
+
$divided: boolean;
|
|
18
|
+
}>> & string;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { colors } from "../../styles/colors.js";
|
|
3
|
+
import { elevation } from "../../styles/elevation.js";
|
|
4
|
+
import { radius, space } from "../../styles/spacing.js";
|
|
5
|
+
import { typography } from "../../styles/typography.js";
|
|
6
|
+
const DURATION = "300ms";
|
|
7
|
+
const EASING = "cubic-bezier(0.4, 0, 0.2, 1)";
|
|
8
|
+
const Root = styled.div`
|
|
9
|
+
background: ${colors.white};
|
|
10
|
+
border: 1px solid ${colors.lightGrey};
|
|
11
|
+
border-radius: ${radius.lg};
|
|
12
|
+
box-shadow: ${elevation.xs};
|
|
13
|
+
|
|
14
|
+
/* Pointer devices only: on touch a tap leaves :hover stuck after closing it. */
|
|
15
|
+
${({ $open }) => !$open && `
|
|
16
|
+
@media (hover: hover) {
|
|
17
|
+
&:hover {
|
|
18
|
+
box-shadow: ${elevation.sm};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
`}
|
|
22
|
+
`;
|
|
23
|
+
const Header = styled.button`
|
|
24
|
+
position: relative;
|
|
25
|
+
${typography.bodyMdCallout};
|
|
26
|
+
font-family: inherit;
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
justify-content: space-between;
|
|
30
|
+
gap: ${space[4]};
|
|
31
|
+
width: 100%;
|
|
32
|
+
padding: ${space[5]};
|
|
33
|
+
border: none;
|
|
34
|
+
background: none;
|
|
35
|
+
color: ${colors.black};
|
|
36
|
+
text-align: left;
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
|
|
39
|
+
${({ $divided }) => $divided && `
|
|
40
|
+
padding-bottom: ${space[4]};
|
|
41
|
+
|
|
42
|
+
&::after {
|
|
43
|
+
content: '';
|
|
44
|
+
position: absolute;
|
|
45
|
+
right: ${space[5]};
|
|
46
|
+
bottom: 0;
|
|
47
|
+
left: ${space[5]};
|
|
48
|
+
border-bottom: 1px solid ${colors.lightGrey};
|
|
49
|
+
}
|
|
50
|
+
`}
|
|
51
|
+
`;
|
|
52
|
+
const Chevron = styled.span`
|
|
53
|
+
display: inline-flex;
|
|
54
|
+
flex: 0 0 auto;
|
|
55
|
+
align-items: center;
|
|
56
|
+
justify-content: center;
|
|
57
|
+
width: 16px;
|
|
58
|
+
height: 16px;
|
|
59
|
+
transform: rotate(${({ $open }) => $open ? "180deg" : "0deg"});
|
|
60
|
+
transition: transform ${DURATION} ${EASING};
|
|
61
|
+
|
|
62
|
+
@media (prefers-reduced-motion: reduce) {
|
|
63
|
+
transition: none;
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
const Body = styled.div`
|
|
67
|
+
display: grid;
|
|
68
|
+
grid-template-rows: ${({ $open }) => $open ? "1fr" : "0fr"};
|
|
69
|
+
opacity: ${({ $open }) => $open ? 1 : 0};
|
|
70
|
+
transition:
|
|
71
|
+
grid-template-rows ${DURATION} ${EASING},
|
|
72
|
+
opacity ${DURATION} ${EASING};
|
|
73
|
+
|
|
74
|
+
@media (prefers-reduced-motion: reduce) {
|
|
75
|
+
transition: none;
|
|
76
|
+
}
|
|
77
|
+
`;
|
|
78
|
+
const BodyClip = styled.div`
|
|
79
|
+
min-height: 0;
|
|
80
|
+
overflow: hidden;
|
|
81
|
+
`;
|
|
82
|
+
const BodyInner = styled.div`
|
|
83
|
+
${typography.bodyMdRegular};
|
|
84
|
+
padding: ${({ $divided }) => $divided ? space[6] : "0"} ${space[5]} ${space[5]};
|
|
85
|
+
color: ${colors.grayBlue};
|
|
86
|
+
`;
|
|
87
|
+
export {
|
|
88
|
+
Body,
|
|
89
|
+
BodyClip,
|
|
90
|
+
BodyInner,
|
|
91
|
+
Chevron,
|
|
92
|
+
Header,
|
|
93
|
+
Root
|
|
94
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, CSSProperties } from 'react';
|
|
2
|
+
import { IStyledComponent } from 'styled-components';
|
|
3
|
+
export interface ComponentWrapperProps {
|
|
4
|
+
borderLeft?: boolean;
|
|
5
|
+
borderRight?: boolean;
|
|
6
|
+
borderTop?: boolean;
|
|
7
|
+
borderBottom?: boolean;
|
|
8
|
+
noPaddingLeft?: boolean;
|
|
9
|
+
noPaddingRight?: boolean;
|
|
10
|
+
noPaddingBottom?: boolean;
|
|
11
|
+
noPaddingTop?: boolean;
|
|
12
|
+
noPaddingVertical?: boolean;
|
|
13
|
+
horizontalPaddingHalf?: boolean;
|
|
14
|
+
noPaddingHorizontal?: boolean;
|
|
15
|
+
paddingVerticalHalf?: boolean;
|
|
16
|
+
noPadding?: boolean;
|
|
17
|
+
center?: boolean;
|
|
18
|
+
grow?: boolean;
|
|
19
|
+
wrap?: boolean;
|
|
20
|
+
background?: boolean;
|
|
21
|
+
fluid?: boolean;
|
|
22
|
+
fluidcenter?: boolean;
|
|
23
|
+
titleHalf?: boolean;
|
|
24
|
+
investmentNotifications?: boolean;
|
|
25
|
+
alignVertically?: boolean;
|
|
26
|
+
marginTop?: CSSProperties['marginTop'];
|
|
27
|
+
isAddMember?: boolean;
|
|
28
|
+
flex?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare const ComponentWrapper: IStyledComponent<'web', ComponentPropsWithRef<'div'> & ComponentWrapperProps>;
|
|
31
|
+
export default ComponentWrapper;
|
|
@@ -1,164 +1,162 @@
|
|
|
1
|
-
import styled, { css } from "styled-components";
|
|
2
|
-
import rwd from "../../styles/rwd.js";
|
|
3
1
|
import theme from "../../styles/theme.js";
|
|
2
|
+
import rwd$1 from "../../styles/rwd.js";
|
|
3
|
+
import styled, { css } from "styled-components";
|
|
4
|
+
const COMPONENT_WRAPPER_PROPS = [
|
|
5
|
+
"borderLeft",
|
|
6
|
+
"borderRight",
|
|
7
|
+
"borderTop",
|
|
8
|
+
"borderBottom",
|
|
9
|
+
"noPaddingLeft",
|
|
10
|
+
"noPaddingRight",
|
|
11
|
+
"noPaddingBottom",
|
|
12
|
+
"noPaddingTop",
|
|
13
|
+
"noPaddingVertical",
|
|
14
|
+
"horizontalPaddingHalf",
|
|
15
|
+
"noPaddingHorizontal",
|
|
16
|
+
"paddingVerticalHalf",
|
|
17
|
+
"noPadding",
|
|
18
|
+
"center",
|
|
19
|
+
"grow",
|
|
20
|
+
"wrap",
|
|
21
|
+
"background",
|
|
22
|
+
"fluid",
|
|
23
|
+
"fluidcenter",
|
|
24
|
+
"titleHalf",
|
|
25
|
+
"investmentNotifications",
|
|
26
|
+
"alignVertically",
|
|
27
|
+
"marginTop",
|
|
28
|
+
"isAddMember",
|
|
29
|
+
"flex"
|
|
30
|
+
];
|
|
31
|
+
const blockedComponentWrapperProps = new Set(COMPONENT_WRAPPER_PROPS);
|
|
32
|
+
const rwd = rwd$1;
|
|
4
33
|
const ComponentWrapper = styled.div.withConfig({
|
|
5
|
-
shouldForwardProp: (
|
|
6
|
-
"borderLeft",
|
|
7
|
-
"borderRight",
|
|
8
|
-
"borderTop",
|
|
9
|
-
"borderBottom",
|
|
10
|
-
"noPaddingLeft",
|
|
11
|
-
"noPaddingRight",
|
|
12
|
-
"noPaddingBottom",
|
|
13
|
-
"noPaddingTop",
|
|
14
|
-
"noPaddingVertical",
|
|
15
|
-
"horizontalPaddingHalf",
|
|
16
|
-
"noPaddingHorizontal",
|
|
17
|
-
"paddingVeticalHalf",
|
|
18
|
-
"noPadding",
|
|
19
|
-
"center",
|
|
20
|
-
"grow",
|
|
21
|
-
"wrap",
|
|
22
|
-
"background",
|
|
23
|
-
"fluid",
|
|
24
|
-
"fluidcenter",
|
|
25
|
-
"titleHalf",
|
|
26
|
-
"investmentNotifications",
|
|
27
|
-
"alignVertically",
|
|
28
|
-
"marginTop",
|
|
29
|
-
"isAddMember",
|
|
30
|
-
"flex"
|
|
31
|
-
].includes(props)
|
|
34
|
+
shouldForwardProp: (prop) => !blockedComponentWrapperProps.has(prop)
|
|
32
35
|
})`
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
position: relative;
|
|
37
|
+
padding: 24px;
|
|
38
|
+
text-align: left !important;
|
|
39
|
+
|
|
40
|
+
${(props) => rwd.MLarge`
|
|
41
|
+
padding: 24px 64px;
|
|
37
42
|
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
${props.investmentNotifications && css`
|
|
44
|
+
padding: 0;
|
|
45
|
+
`}
|
|
40
46
|
`}
|
|
41
47
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
${(props) => props.borderLeft && css`
|
|
49
|
+
border-left: 1px solid ${theme.cLightGrey};
|
|
50
|
+
`}
|
|
45
51
|
|
|
46
52
|
${(props) => props.borderRight && css`
|
|
47
|
-
|
|
48
|
-
|
|
53
|
+
border-right: 1px solid ${theme.cLightGrey};
|
|
54
|
+
`}
|
|
49
55
|
|
|
50
56
|
${(props) => props.borderTop && css`
|
|
51
|
-
|
|
52
|
-
|
|
57
|
+
border-top: 1px solid ${theme.cLightGrey};
|
|
58
|
+
`}
|
|
53
59
|
|
|
54
60
|
${(props) => props.borderBottom && css`
|
|
55
|
-
|
|
56
|
-
|
|
61
|
+
border-bottom: 1px solid ${theme.cLightGrey};
|
|
62
|
+
`}
|
|
57
63
|
|
|
58
64
|
${(props) => props.noPaddingLeft && css`
|
|
59
|
-
|
|
60
|
-
|
|
65
|
+
padding-left: 0 !important;
|
|
66
|
+
`}
|
|
61
67
|
|
|
62
68
|
${(props) => props.noPaddingRight && css`
|
|
63
|
-
|
|
64
|
-
|
|
69
|
+
padding-right: 0 !important;
|
|
70
|
+
`}
|
|
65
71
|
|
|
66
72
|
${(props) => props.noPaddingTop && css`
|
|
67
|
-
|
|
68
|
-
|
|
73
|
+
padding-top: 0 !important;
|
|
74
|
+
`}
|
|
69
75
|
|
|
70
76
|
${(props) => props.noPaddingBottom && css`
|
|
71
|
-
|
|
72
|
-
|
|
77
|
+
padding-bottom: 0 !important;
|
|
78
|
+
`}
|
|
73
79
|
|
|
74
80
|
${(props) => props.noPaddingVertical && css`
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
81
|
+
padding-top: 0 !important;
|
|
82
|
+
padding-bottom: 0 !important;
|
|
83
|
+
`}
|
|
78
84
|
|
|
79
85
|
${(props) => props.horizontalPaddingHalf && css`
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
86
|
+
padding-left: 18px !important;
|
|
87
|
+
padding-right: 18px !important;
|
|
88
|
+
`}
|
|
83
89
|
|
|
84
90
|
${(props) => props.noPaddingHorizontal && css`
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
91
|
+
padding-left: 0 !important;
|
|
92
|
+
padding-right: 0 !important;
|
|
93
|
+
`}
|
|
88
94
|
|
|
89
|
-
${(props) => props.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
95
|
+
${(props) => props.paddingVerticalHalf && css`
|
|
96
|
+
padding-top: 16px !important;
|
|
97
|
+
padding-bottom: 16px !important;
|
|
98
|
+
`}
|
|
93
99
|
|
|
94
100
|
${(props) => props.noPadding && css`
|
|
95
|
-
|
|
96
|
-
|
|
101
|
+
padding: 0 !important;
|
|
102
|
+
`}
|
|
97
103
|
|
|
98
104
|
${(props) => props.center && css`
|
|
99
|
-
|
|
100
|
-
|
|
105
|
+
text-align: center !important;
|
|
106
|
+
`}
|
|
101
107
|
|
|
102
108
|
${(props) => props.grow && css`
|
|
103
|
-
|
|
104
|
-
|
|
109
|
+
flex-grow: 1;
|
|
110
|
+
`}
|
|
105
111
|
|
|
106
112
|
${(props) => props.wrap && css`
|
|
107
|
-
|
|
108
|
-
|
|
113
|
+
flex-wrap: wrap;
|
|
114
|
+
`}
|
|
109
115
|
|
|
110
116
|
${(props) => props.background && css`
|
|
111
|
-
|
|
112
|
-
|
|
117
|
+
background-color: ${theme.cGrey};
|
|
118
|
+
`}
|
|
113
119
|
|
|
114
120
|
${(props) => props.fluid && css`
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
${(props) => props.fluidcenter && css`
|
|
119
|
-
width: 100% !important;
|
|
120
|
-
text-align: center !important;
|
|
121
|
-
`}
|
|
122
|
-
|
|
123
|
-
${(props) => props.titleHalf && css`
|
|
124
|
-
h4 {
|
|
125
|
-
width: 50%;
|
|
121
|
+
width: 100%;
|
|
122
|
+
`}
|
|
126
123
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
`}
|
|
124
|
+
${(props) => props.fluidcenter && css`
|
|
125
|
+
width: 100% !important;
|
|
126
|
+
text-align: center !important;
|
|
127
|
+
`}
|
|
132
128
|
|
|
133
|
-
|
|
134
|
-
|
|
129
|
+
${(props) => props.titleHalf && css`
|
|
130
|
+
h4 {
|
|
131
|
+
width: 50%;
|
|
135
132
|
|
|
136
|
-
|
|
137
|
-
|
|
133
|
+
@media screen and (max-width: 767px) {
|
|
134
|
+
width: 100%;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
138
137
|
`}
|
|
139
|
-
}
|
|
140
138
|
|
|
141
139
|
${(props) => props.alignVertically && css`
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
140
|
+
display: flex;
|
|
141
|
+
align-items: center;
|
|
142
|
+
`}
|
|
145
143
|
|
|
146
144
|
${(props) => props.marginTop && css`
|
|
147
|
-
|
|
148
|
-
|
|
145
|
+
margin-top: ${props.marginTop};
|
|
146
|
+
`}
|
|
149
147
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
148
|
+
${(props) => props.isAddMember && css`
|
|
149
|
+
@media screen and (min-width: 768px) {
|
|
150
|
+
padding-left: 10px !important;
|
|
151
|
+
padding-right: 10px !important;
|
|
152
|
+
}
|
|
153
|
+
`}
|
|
156
154
|
|
|
157
|
-
|
|
155
|
+
${(props) => props.flex && `
|
|
158
156
|
display:flex;
|
|
159
157
|
align-items: center;
|
|
160
158
|
`}
|
|
161
|
-
`;
|
|
159
|
+
`;
|
|
162
160
|
export {
|
|
163
161
|
ComponentWrapper,
|
|
164
162
|
ComponentWrapper as default
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CopyValues } from './copySource';
|
|
2
|
+
export interface CopyProps {
|
|
3
|
+
/** Dot-path into the app's copy source, e.g. `hero.mainHeadline`. */
|
|
4
|
+
id: string;
|
|
5
|
+
/** Shown when the copy source has no value for this id (or none is registered). */
|
|
6
|
+
fallback?: string;
|
|
7
|
+
/** Values for `{token}` placeholders in the copy string, e.g. `{ amount: '1,000' }`. */
|
|
8
|
+
values?: CopyValues;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* <Copy id="hero.mainHeadline" fallback="Welcome" /> — the render primitive.
|
|
12
|
+
* Resolves the id against the app's registered copy source (see setCopySource);
|
|
13
|
+
* if there's no source or no value for the id, renders `fallback`, then the id
|
|
14
|
+
* itself. Pass `values` to fill `{token}` placeholders in the resolved string.
|
|
15
|
+
* No provider to wrap, no editing/overlay/Firestore yet — deliberately just
|
|
16
|
+
* "turn an id into a string." Ported from homepage's feature/localization
|
|
17
|
+
* branch (src/copy/Copy.tsx), stripped of the edit-mode wrapper span.
|
|
18
|
+
*/
|
|
19
|
+
export declare const Copy: ({ id, fallback, values }: CopyProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export default Copy;
|
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import "react";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
2
|
import { resolveCopy, interpolate } from "./copySource.js";
|
|
5
3
|
const Copy = ({ id, fallback, values }) => {
|
|
6
4
|
const value = resolveCopy(id) ?? fallback ?? id;
|
|
7
5
|
return /* @__PURE__ */ jsx(Fragment, { children: interpolate(value, values) });
|
|
8
6
|
};
|
|
9
|
-
Copy.propTypes = {
|
|
10
|
-
id: PropTypes.string.isRequired,
|
|
11
|
-
/** Shown when the copy source has no value for this id (or none is registered). */
|
|
12
|
-
fallback: PropTypes.string,
|
|
13
|
-
/** Values for `{token}` placeholders in the copy string, e.g. { amount: '1,000' }. */
|
|
14
|
-
values: PropTypes.object
|
|
15
|
-
};
|
|
16
7
|
export {
|
|
17
8
|
Copy
|
|
18
9
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type CopyValues = Record<string, string | number>;
|
|
2
|
+
/** Register the app's copy. Accepts a nested object (flattened here) or a flat map. */
|
|
3
|
+
export declare function setCopySource(copy: unknown): void;
|
|
4
|
+
/** Resolve a dot-path id to its string, or undefined if absent. */
|
|
5
|
+
export declare function resolveCopy(id: string): string | undefined;
|
|
6
|
+
/** The current flat copy map (e.g. for an all-keys editor table later). */
|
|
7
|
+
export declare function getCopySource(): Record<string, string>;
|
|
8
|
+
/**
|
|
9
|
+
* Replace `{token}` placeholders in a resolved string with values.
|
|
10
|
+
* interpolate('Invest {amount} now', { amount: '1,000' }) -> 'Invest 1,000 now'
|
|
11
|
+
* Unknown tokens are left intact. Shared by both `t()` and `<Copy values>`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function interpolate(str: string, values?: CopyValues): string;
|
|
14
|
+
/**
|
|
15
|
+
* Resolve a dot-path id to its string, with optional `{token}` interpolation.
|
|
16
|
+
* Falls back to the id itself when unregistered (mirrors <Copy>). Use for
|
|
17
|
+
* props/attributes (placeholder, title, alt, aria-label) and interpolated text;
|
|
18
|
+
* use <Copy> for JSX children.
|
|
19
|
+
*/
|
|
20
|
+
export declare function t(id: string, values?: CopyValues): string;
|