@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
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
export type CopyToClipboardTooltipProps = {
|
|
3
|
+
/** Text placed on the clipboard. */
|
|
4
|
+
value: string;
|
|
5
|
+
buttonStyle?: CSSProperties;
|
|
6
|
+
onCopy?: (value: string) => void;
|
|
7
|
+
/** Custom trigger content. Defaults to the standard copy glyph. */
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
copiedLabel?: string;
|
|
10
|
+
idleLabel?: string;
|
|
11
|
+
/** How long the "copied" label sticks, in ms. */
|
|
12
|
+
resetAfter?: number;
|
|
13
|
+
};
|
|
14
|
+
export declare const CopyToClipboardTooltip: ({ value, buttonStyle, onCopy, children, copiedLabel, idleLabel, resetAfter, }: CopyToClipboardTooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default CopyToClipboardTooltip;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Explicit trigger element. The copy glyph is an SVGR component that may not
|
|
3
|
+
* forward refs, and floating-ui needs a real DOM node to measure — so the
|
|
4
|
+
* tooltip anchors to this span rather than to the icon itself.
|
|
5
|
+
*/
|
|
6
|
+
export declare const CopyTrigger: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
@@ -6,7 +6,7 @@ import { CopyToClipboardTooltip } from "../CopyToClipboardTooltip/CopyToClipboar
|
|
|
6
6
|
import { Container, DataWrapper, CheckMark, Head, Title, Status, TitleSide, AddressWrap, Address, Body, DataBox, Value, Equal, InfoBox, OptionsWrapper } from "./CryptoAddress.styles.js";
|
|
7
7
|
import stdin_default$1 from "./RadioWrap.js";
|
|
8
8
|
import stdin_default$2 from "./ComponentWrap.js";
|
|
9
|
-
import
|
|
9
|
+
import shortenAddress from "../../utils/get-short-address.js";
|
|
10
10
|
const copyToClipBoard = (value) => /* @__PURE__ */ jsx(CopyToClipboardTooltip, { value });
|
|
11
11
|
const defaultData = {
|
|
12
12
|
value: "",
|
|
@@ -54,7 +54,7 @@ const CryptoAddress = ({
|
|
|
54
54
|
] }),
|
|
55
55
|
/* @__PURE__ */ jsxs(TitleSide, { children: [
|
|
56
56
|
address && /* @__PURE__ */ jsxs(AddressWrap, { children: [
|
|
57
|
-
/* @__PURE__ */ jsx(Tooltip, { placement: "top", content: address, children: /* @__PURE__ */ jsx(Address, { children:
|
|
57
|
+
/* @__PURE__ */ jsx(Tooltip, { placement: "top", content: address, children: /* @__PURE__ */ jsx(Address, { children: shortenAddress(address) }) }),
|
|
58
58
|
/* @__PURE__ */ jsx("div", { onClick: (e) => e.preventDefault(), children: copyToClipBoard(address) })
|
|
59
59
|
] }),
|
|
60
60
|
src && /* @__PURE__ */ jsx("img", { src, alt: "project logo", height: "50", width: 100, style: { objectFit: "contain" } })
|
|
@@ -64,7 +64,7 @@ const CryptoAddress = ({
|
|
|
64
64
|
/* @__PURE__ */ jsxs(DataBox, { style: dataBoxStyle, children: [
|
|
65
65
|
data.value && /* @__PURE__ */ jsxs(Value, { fontSize, style: dataValueStyle, childMarginLeft: valueChildMarginLeft, children: [
|
|
66
66
|
data.unit && `${data.unit} `,
|
|
67
|
-
data.shortAddress ? /* @__PURE__ */ jsx(Tooltip, { placement: "top", content: data.value, children:
|
|
67
|
+
data.shortAddress ? /* @__PURE__ */ jsx(Tooltip, { placement: "top", content: data.value, children: shortenAddress(data.value) }) : data.value,
|
|
68
68
|
data.tooltip && /* @__PURE__ */ jsx("div", { children: copyToClipBoard(data.value) })
|
|
69
69
|
] }),
|
|
70
70
|
data.eqValue && /* @__PURE__ */ jsxs(Equal, { fontSize: eqValueFontSize, style: { eqValueStyle }, children: [
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { TooltipPlacement, TooltipProps } from '../Tooltip/Tooltip';
|
|
3
|
+
import { Container, Icon } from './InfoIcon.styles';
|
|
4
|
+
export type InfoIconProps = {
|
|
5
|
+
title?: ReactNode;
|
|
6
|
+
/** Rich content. A string is sanitised and parsed. Takes precedence over `title`. */
|
|
7
|
+
html?: ReactNode;
|
|
8
|
+
position?: TooltipPlacement;
|
|
9
|
+
noMargin?: boolean;
|
|
10
|
+
noMarginLeft?: boolean;
|
|
11
|
+
noMarginRight?: boolean;
|
|
12
|
+
/** Use `children` as the trigger instead of the info glyph. */
|
|
13
|
+
noIcon?: boolean;
|
|
14
|
+
/** Render the trigger with no tooltip at all. */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
fullWidth?: boolean;
|
|
17
|
+
showArrow?: boolean;
|
|
18
|
+
arrow?: boolean;
|
|
19
|
+
arrowColor?: string;
|
|
20
|
+
/** @deprecated Only 'light' ever existed; the tooltip now ships its own styling. */
|
|
21
|
+
theme?: string;
|
|
22
|
+
/** @deprecated Hover + focus (and tap on touch) are always wired. */
|
|
23
|
+
trigger?: 'click' | 'focus';
|
|
24
|
+
outline?: boolean;
|
|
25
|
+
containerStyle?: CSSProperties;
|
|
26
|
+
/** Escape hatch forwarded to the underlying Tooltip. */
|
|
27
|
+
tooltipProps?: Partial<TooltipProps>;
|
|
28
|
+
children?: ReactNode;
|
|
29
|
+
[key: string]: unknown;
|
|
30
|
+
};
|
|
31
|
+
declare const InfoIcon: ({ title, html, position, noMargin, noMarginLeft, noMarginRight, noIcon, disabled, fullWidth, arrow, showArrow, arrowColor, theme, trigger, outline, containerStyle, tooltipProps, children, style, ...rest }: InfoIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export { InfoIcon, Container as InfoIconContainer, Icon as InfoIconWrapper };
|
|
33
|
+
export default InfoIcon;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type ContainerProps = {
|
|
2
|
+
noMargin?: boolean;
|
|
3
|
+
noMarginLeft?: boolean;
|
|
4
|
+
noMarginRight?: boolean;
|
|
5
|
+
fullWidth?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const Container: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, ContainerProps>> & string;
|
|
8
|
+
type IconProps = {
|
|
9
|
+
outline?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare const Icon: 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').HTMLAttributes<HTMLElement>, HTMLElement>, import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLElement>, HTMLElement>>, IconProps>, IconProps>> & string;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CSSProperties, InputHTMLAttributes } from 'react';
|
|
2
|
+
import { Wrapper, Label, InputWrap } from './Input.styles';
|
|
3
|
+
export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value'> {
|
|
4
|
+
id: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
/** Floating label above the field. */
|
|
7
|
+
label?: string;
|
|
8
|
+
value?: string | number;
|
|
9
|
+
/** Shown as an error state once `touched` is true (a Formik error string works too). */
|
|
10
|
+
error?: boolean | string;
|
|
11
|
+
touched?: boolean;
|
|
12
|
+
/** Light text and border, for dark backgrounds. */
|
|
13
|
+
inverted?: boolean;
|
|
14
|
+
/** Dashboard styling. */
|
|
15
|
+
dashboard?: boolean;
|
|
16
|
+
/** Lets a long label wrap over several lines. */
|
|
17
|
+
autoHeightLabel?: boolean;
|
|
18
|
+
inputWrapStyle?: CSSProperties;
|
|
19
|
+
wrapperStyle?: CSSProperties;
|
|
20
|
+
}
|
|
21
|
+
/** Text input with a floating label, built for Formik (`onChange`/`onBlur` receive the event). */
|
|
22
|
+
declare const Input: (props: InputProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export { Input, Wrapper as InputWrapper, Label as InputLabel, InputWrap };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect } from "react";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
3
|
import { Wrapper, Label, InputWrap } from "./Input.styles.js";
|
|
5
4
|
const Input = (props) => {
|
|
6
5
|
const {
|
|
@@ -42,23 +41,30 @@ const Input = (props) => {
|
|
|
42
41
|
useEffect(() => {
|
|
43
42
|
if (value && !labelUp) setLabelUp(true);
|
|
44
43
|
}, [value, labelUp]);
|
|
45
|
-
const onBlur = (e
|
|
46
|
-
onBlurProp?.(e
|
|
44
|
+
const onBlur = (e) => {
|
|
45
|
+
onBlurProp?.(e);
|
|
47
46
|
checkLabel(false);
|
|
48
47
|
};
|
|
49
|
-
const onFocus = (e
|
|
50
|
-
onFocusProp?.(e
|
|
48
|
+
const onFocus = (e) => {
|
|
49
|
+
onFocusProp?.(e);
|
|
51
50
|
checkLabel(true);
|
|
52
51
|
};
|
|
53
|
-
const onChange = (e, field) => {
|
|
54
|
-
onChangeProp?.(e, field);
|
|
55
|
-
};
|
|
56
52
|
return /* @__PURE__ */ jsxs(Wrapper, { inverted, style: wrapperStyle, children: [
|
|
57
|
-
label && /* @__PURE__ */ jsx(
|
|
53
|
+
label && /* @__PURE__ */ jsx(
|
|
54
|
+
Label,
|
|
55
|
+
{
|
|
56
|
+
isUp: labelUp,
|
|
57
|
+
active: hasFocus,
|
|
58
|
+
error: Boolean(error && touched),
|
|
59
|
+
htmlFor: id,
|
|
60
|
+
autoHeightLabel,
|
|
61
|
+
children: label
|
|
62
|
+
}
|
|
63
|
+
),
|
|
58
64
|
/* @__PURE__ */ jsx(
|
|
59
65
|
InputWrap,
|
|
60
66
|
{
|
|
61
|
-
error: error && touched,
|
|
67
|
+
error: Boolean(error && touched),
|
|
62
68
|
dashboard,
|
|
63
69
|
disabled,
|
|
64
70
|
style: inputWrapStyle,
|
|
@@ -70,7 +76,7 @@ const Input = (props) => {
|
|
|
70
76
|
id,
|
|
71
77
|
name,
|
|
72
78
|
value,
|
|
73
|
-
onChange,
|
|
79
|
+
onChange: (e) => onChangeProp?.(e),
|
|
74
80
|
onBlur,
|
|
75
81
|
onFocus,
|
|
76
82
|
readOnly,
|
|
@@ -84,22 +90,6 @@ const Input = (props) => {
|
|
|
84
90
|
)
|
|
85
91
|
] });
|
|
86
92
|
};
|
|
87
|
-
Input.propTypes = {
|
|
88
|
-
type: PropTypes.string,
|
|
89
|
-
id: PropTypes.string.isRequired,
|
|
90
|
-
name: PropTypes.string.isRequired,
|
|
91
|
-
label: PropTypes.string,
|
|
92
|
-
placeholder: PropTypes.string,
|
|
93
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
94
|
-
error: PropTypes.bool,
|
|
95
|
-
touched: PropTypes.bool,
|
|
96
|
-
onChange: PropTypes.func,
|
|
97
|
-
onBlur: PropTypes.func,
|
|
98
|
-
onFocus: PropTypes.func,
|
|
99
|
-
readOnly: PropTypes.bool,
|
|
100
|
-
inverted: PropTypes.bool,
|
|
101
|
-
dashboard: PropTypes.bool
|
|
102
|
-
};
|
|
103
93
|
export {
|
|
104
94
|
Input,
|
|
105
95
|
Label as InputLabel,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const Label: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, {
|
|
2
|
+
autoHeightLabel?: boolean;
|
|
3
|
+
isUp?: boolean;
|
|
4
|
+
active?: boolean;
|
|
5
|
+
error?: boolean;
|
|
6
|
+
}>> & string;
|
|
7
|
+
export declare const InputWrap: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
8
|
+
autoHeightLabel?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
dashboard?: boolean;
|
|
11
|
+
error?: boolean;
|
|
12
|
+
}>> & string;
|
|
13
|
+
export declare const Wrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
14
|
+
inverted?: boolean;
|
|
15
|
+
}>> & string;
|
|
@@ -85,6 +85,7 @@ const InputPassword = (props) => {
|
|
|
85
85
|
{
|
|
86
86
|
type: "button",
|
|
87
87
|
onClick: togglePasswordVisibility,
|
|
88
|
+
"aria-label": isPasswordVisible ? "Hide password" : "Show password",
|
|
88
89
|
"data-cy": toggleDataCy ?? `${id}-password-visibility-toggle`,
|
|
89
90
|
children: isPasswordVisible ? /* @__PURE__ */ jsx("i", { className: "ion ion-md-eye-off" }) : /* @__PURE__ */ jsx("i", { className: "ion ion-md-eye" })
|
|
90
91
|
}
|
|
@@ -5,8 +5,11 @@ const BottomWrap = styled.div`
|
|
|
5
5
|
position: relative;
|
|
6
6
|
margin-top: 6px;
|
|
7
7
|
`;
|
|
8
|
-
const ShowPassword = styled.
|
|
8
|
+
const ShowPassword = styled.button`
|
|
9
9
|
display: block;
|
|
10
|
+
border: 0;
|
|
11
|
+
background: none;
|
|
12
|
+
color: inherit;
|
|
10
13
|
position: absolute;
|
|
11
14
|
top: 0;
|
|
12
15
|
right: 0;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import RangeWrapper from "./RangeInput.styles.js";
|
|
5
4
|
import { Range, getTrackBackground } from "react-range";
|
|
6
5
|
import { colors } from "../../styles/colors.js";
|
|
7
6
|
const RangeInput = ({
|
|
@@ -14,64 +13,61 @@ const RangeInput = ({
|
|
|
14
13
|
value,
|
|
15
14
|
id,
|
|
16
15
|
name
|
|
17
|
-
}) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
values: [value],
|
|
42
|
-
colors: [colors.blue, colors.lightGrey],
|
|
43
|
-
min,
|
|
44
|
-
max
|
|
45
|
-
})
|
|
46
|
-
},
|
|
47
|
-
children
|
|
48
|
-
}
|
|
49
|
-
),
|
|
50
|
-
renderThumb: ({ props }, index) => /* @__PURE__ */ jsx(
|
|
51
|
-
"div",
|
|
52
|
-
{
|
|
53
|
-
...props,
|
|
54
|
-
style: {
|
|
55
|
-
...props.style,
|
|
56
|
-
height: "24px",
|
|
57
|
-
width: "24px",
|
|
58
|
-
backgroundColor: colors.blue,
|
|
59
|
-
borderRadius: "50%",
|
|
60
|
-
border: "4px solid white"
|
|
61
|
-
}
|
|
16
|
+
}) => /* @__PURE__ */ jsx("div", { id, children: /* @__PURE__ */ jsx(
|
|
17
|
+
Range,
|
|
18
|
+
{
|
|
19
|
+
disabled,
|
|
20
|
+
max,
|
|
21
|
+
min,
|
|
22
|
+
step,
|
|
23
|
+
values: [value],
|
|
24
|
+
onChange: (values) => onChange(values[0]),
|
|
25
|
+
renderTrack: ({ props, children }) => /* @__PURE__ */ jsx(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
...props,
|
|
29
|
+
style: {
|
|
30
|
+
...props.style,
|
|
31
|
+
height: "9px",
|
|
32
|
+
width: "100%",
|
|
33
|
+
borderRadius: "10px",
|
|
34
|
+
background: getTrackBackground({
|
|
35
|
+
values: [value],
|
|
36
|
+
colors: [colors.blue, colors.lightGrey],
|
|
37
|
+
min,
|
|
38
|
+
max
|
|
39
|
+
})
|
|
62
40
|
},
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
41
|
+
children
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
renderThumb: ({ props: { key, ...props } }) => /* @__PURE__ */ jsx(
|
|
45
|
+
"div",
|
|
46
|
+
{
|
|
47
|
+
...props,
|
|
48
|
+
"aria-label": name,
|
|
49
|
+
style: {
|
|
50
|
+
...props.style,
|
|
51
|
+
height: "24px",
|
|
52
|
+
width: "24px",
|
|
53
|
+
backgroundColor: colors.blue,
|
|
54
|
+
borderRadius: "50%",
|
|
55
|
+
border: "4px solid white"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
key
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
) });
|
|
68
62
|
RangeInput.propTypes = {
|
|
69
|
-
id: PropTypes.string
|
|
70
|
-
|
|
63
|
+
id: PropTypes.string,
|
|
64
|
+
/** Accessible label for the thumb. */
|
|
65
|
+
name: PropTypes.string,
|
|
71
66
|
disabled: PropTypes.bool,
|
|
72
67
|
max: PropTypes.number,
|
|
73
68
|
min: PropTypes.number,
|
|
74
69
|
step: PropTypes.number,
|
|
70
|
+
/** Called with the new value (a number). */
|
|
75
71
|
onChange: PropTypes.func,
|
|
76
72
|
value: PropTypes.number.isRequired
|
|
77
73
|
};
|
|
@@ -5,7 +5,7 @@ const TextareaWrapper = styled.div`
|
|
|
5
5
|
display: block;
|
|
6
6
|
`;
|
|
7
7
|
const StyledTextarea = styled.textarea.withConfig({
|
|
8
|
-
shouldForwardProp: (props) => !["minHeight", "
|
|
8
|
+
shouldForwardProp: (props) => !["minHeight", "error"].includes(props)
|
|
9
9
|
})`
|
|
10
10
|
font-family: 'Open sans';
|
|
11
11
|
display: block;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ComponentType, SVGProps } from 'react';
|
|
2
|
+
import { MaterialIconName } from './iconConfig';
|
|
3
|
+
export declare const ICON_SIZES: {
|
|
4
|
+
readonly xs: 12;
|
|
5
|
+
readonly sm: 16;
|
|
6
|
+
readonly md: 20;
|
|
7
|
+
readonly lg: 24;
|
|
8
|
+
readonly xl: 32;
|
|
9
|
+
};
|
|
10
|
+
export type IconSize = keyof typeof ICON_SIZES | number;
|
|
11
|
+
interface IconBaseProps {
|
|
12
|
+
/** Token or px. Default `lg` (24px). */
|
|
13
|
+
size?: IconSize;
|
|
14
|
+
/** Any CSS colour. Default: the surrounding text colour. */
|
|
15
|
+
color?: string;
|
|
16
|
+
/** Accessible name. Without it the icon is decorative and hidden from screen readers. */
|
|
17
|
+
label?: string;
|
|
18
|
+
className?: string;
|
|
19
|
+
dataCy?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface MaterialIconProps extends IconBaseProps {
|
|
22
|
+
/** Material Symbols name in snake_case, e.g. `arrow_back` (see fonts.google.com/icons). Must be registered. */
|
|
23
|
+
name: MaterialIconName;
|
|
24
|
+
variant?: 'outlined' | 'rounded' | 'sharp';
|
|
25
|
+
filled?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A Material Symbol the app registered with `registerMaterialIcons`, drawn inline (in the server render too, no
|
|
29
|
+
* request) in the text colour or `color`. An unregistered icon renders nothing.
|
|
30
|
+
*/
|
|
31
|
+
export declare const MaterialIcon: ({ name, variant, filled, size, color, label, className, dataCy, }: MaterialIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export interface SvgIconProps extends IconBaseProps {
|
|
33
|
+
/** An SVG React component (`import Logo from './logo.svg?react'`), or the URL of a single-colour SVG. */
|
|
34
|
+
svg: ComponentType<SVGProps<SVGSVGElement>> | string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A custom SVG with the same sizing, colour and accessibility as `MaterialIcon`. A URL is painted in `color`; a
|
|
38
|
+
* component keeps its own colours unless it uses `currentColor`.
|
|
39
|
+
*/
|
|
40
|
+
export declare const SvgIcon: ({ svg: Svg, size, color, label, className, dataCy }: SvgIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createElement } from "react";
|
|
3
|
+
import { InlineIcon, MaskedIcon, IconBox } from "./MaterialIcon.styles.js";
|
|
4
|
+
import { getRegisteredMaterialIcon } from "./iconConfig.js";
|
|
5
|
+
const ICON_SIZES = { xs: 12, sm: 16, md: 20, lg: 24, xl: 32 };
|
|
6
|
+
const toPx = (size) => typeof size === "number" ? size : ICON_SIZES[size];
|
|
7
|
+
const a11y = (label) => label ? { role: "img", "aria-label": label } : { "aria-hidden": true };
|
|
8
|
+
const cssUrl = (url) => `url("${encodeURI(url).replace(/["'()]/g, (c) => `%${c.charCodeAt(0).toString(16)}`)}")`;
|
|
9
|
+
const MaterialIcon = ({
|
|
10
|
+
name,
|
|
11
|
+
variant = "outlined",
|
|
12
|
+
filled = false,
|
|
13
|
+
size = "lg",
|
|
14
|
+
color,
|
|
15
|
+
label,
|
|
16
|
+
className,
|
|
17
|
+
dataCy
|
|
18
|
+
}) => {
|
|
19
|
+
const path = `${variant}/${name}${filled ? "-fill" : ""}`;
|
|
20
|
+
const svg = getRegisteredMaterialIcon(path);
|
|
21
|
+
if (!svg) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
return /* @__PURE__ */ jsx(
|
|
25
|
+
InlineIcon,
|
|
26
|
+
{
|
|
27
|
+
...a11y(label),
|
|
28
|
+
className,
|
|
29
|
+
"data-cy": dataCy,
|
|
30
|
+
"data-icon": name,
|
|
31
|
+
$size: toPx(size),
|
|
32
|
+
$color: color,
|
|
33
|
+
children: createElement(svg, { "aria-hidden": true, focusable: false })
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
const SvgIcon = ({ svg: Svg, size = "lg", color, label, className, dataCy }) => {
|
|
38
|
+
const props = {
|
|
39
|
+
...a11y(label),
|
|
40
|
+
className,
|
|
41
|
+
"data-cy": dataCy,
|
|
42
|
+
"data-icon": "custom",
|
|
43
|
+
$size: toPx(size),
|
|
44
|
+
$color: color
|
|
45
|
+
};
|
|
46
|
+
if (typeof Svg === "string") {
|
|
47
|
+
return /* @__PURE__ */ jsx(MaskedIcon, { ...props, style: { "--icon-url": cssUrl(Svg) } });
|
|
48
|
+
}
|
|
49
|
+
return /* @__PURE__ */ jsx(IconBox, { ...props, children: /* @__PURE__ */ jsx(Svg, { "aria-hidden": "true", focusable: "false" }) });
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
ICON_SIZES,
|
|
53
|
+
MaterialIcon,
|
|
54
|
+
SvgIcon
|
|
55
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const IconBox: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
2
|
+
$size: number;
|
|
3
|
+
$color?: string;
|
|
4
|
+
}>> & string;
|
|
5
|
+
/** A registered Material Symbol drawn inline; the files have no fill, so it takes the text colour. */
|
|
6
|
+
export declare const InlineIcon: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "$color" | "$size"> & {
|
|
7
|
+
$size: number;
|
|
8
|
+
$color?: string;
|
|
9
|
+
}, never>> & string;
|
|
10
|
+
/** Paints the SVG at `--icon-url` in the text colour, so any colour works without touching the file. */
|
|
11
|
+
export declare const MaskedIcon: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "$color" | "$size"> & {
|
|
12
|
+
$size: number;
|
|
13
|
+
$color?: string;
|
|
14
|
+
}, never>> & string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
const IconBox = styled.span`
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
flex: 0 0 auto;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
width: ${({ $size }) => $size}px;
|
|
8
|
+
height: ${({ $size }) => $size}px;
|
|
9
|
+
color: ${({ $color }) => $color ?? "inherit"};
|
|
10
|
+
vertical-align: middle;
|
|
11
|
+
|
|
12
|
+
> svg {
|
|
13
|
+
width: 100%;
|
|
14
|
+
height: 100%;
|
|
15
|
+
}
|
|
16
|
+
`;
|
|
17
|
+
const InlineIcon = styled(IconBox)`
|
|
18
|
+
> svg {
|
|
19
|
+
fill: currentColor;
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
22
|
+
const MaskedIcon = styled(IconBox)`
|
|
23
|
+
background-color: currentColor;
|
|
24
|
+
-webkit-mask: var(--icon-url) center / contain no-repeat;
|
|
25
|
+
mask: var(--icon-url) center / contain no-repeat;
|
|
26
|
+
`;
|
|
27
|
+
export {
|
|
28
|
+
IconBox,
|
|
29
|
+
InlineIcon,
|
|
30
|
+
MaskedIcon
|
|
31
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ComponentType, SVGProps } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Icon names an app allows. Empty here: an app narrows `MaterialIcon`'s `name` to the icons it registered:
|
|
4
|
+
*
|
|
5
|
+
* declare module '@stokr/components-library' { interface MaterialIconRegistry { name: 'home' | 'download' } }
|
|
6
|
+
*/
|
|
7
|
+
export interface MaterialIconRegistry {
|
|
8
|
+
}
|
|
9
|
+
export type MaterialIconName = MaterialIconRegistry extends {
|
|
10
|
+
name: infer K extends string;
|
|
11
|
+
} ? K : string;
|
|
12
|
+
type SvgComponent = ComponentType<SVGProps<SVGSVGElement>>;
|
|
13
|
+
/**
|
|
14
|
+
* Registers the Material Symbols an app uses, as SVG components keyed `<variant>/<name>` (`-fill` for filled): the
|
|
15
|
+
* paths in the `@material-symbols/svg-<weight>` packages. Only these are bundled; `MaterialIcon` draws them inline.
|
|
16
|
+
* Call once at module scope in an entry shared by server and client; with Module Federation the host's call covers
|
|
17
|
+
* the remotes (the library is a shared singleton).
|
|
18
|
+
*
|
|
19
|
+
* import home from '@material-symbols/svg-400/outlined/home.svg?react'
|
|
20
|
+
* registerMaterialIcons({ 'outlined/home': home })
|
|
21
|
+
*/
|
|
22
|
+
export declare function registerMaterialIcons(icons: Record<string, SvgComponent>): void;
|
|
23
|
+
export declare function getRegisteredMaterialIcon(key: string): SvgComponent;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const registered = /* @__PURE__ */ new Map();
|
|
2
|
+
function registerMaterialIcons(icons) {
|
|
3
|
+
for (const [key, svg] of Object.entries(icons)) registered.set(key, svg);
|
|
4
|
+
}
|
|
5
|
+
function getRegisteredMaterialIcon(key) {
|
|
6
|
+
return registered.get(key);
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
getRegisteredMaterialIcon,
|
|
10
|
+
registerMaterialIcons
|
|
11
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CSSProperties, MouseEvent, ReactNode } from 'react';
|
|
2
|
+
import { Box, Dimmer, ModalBack, ModalLink, ModalRoot, ModalInner, ModalClose, ModalScroll, ModalLinkWrap, ModalInnerWithBorder, ModalInnerSmartContractAddress } from './Modal.styles';
|
|
3
|
+
export interface ModalProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
/** Called by the close (X) button, with its click event. */
|
|
7
|
+
onClose: (event: MouseEvent<HTMLElement>) => void;
|
|
8
|
+
className?: string;
|
|
9
|
+
fullscreen?: boolean;
|
|
10
|
+
kyc?: boolean;
|
|
11
|
+
/** Narrower box (8 of 12 columns). */
|
|
12
|
+
thin?: boolean;
|
|
13
|
+
isRegisterEntity?: boolean;
|
|
14
|
+
/** CSS background of the backdrop. */
|
|
15
|
+
background?: string;
|
|
16
|
+
/** CSS max-height of the box. */
|
|
17
|
+
maxHeight?: string;
|
|
18
|
+
/** CSS max width of the box, e.g. `'1200px'`; combined as min(percentage, maxWidth). */
|
|
19
|
+
maxWidth?: string;
|
|
20
|
+
/** Inline style of the box. */
|
|
21
|
+
boxStyles?: CSSProperties;
|
|
22
|
+
/** Hides the (X) close button, for flows dismissed only through their own actions. */
|
|
23
|
+
hideCloseButton?: boolean;
|
|
24
|
+
}
|
|
25
|
+
declare const Modal: ({ children, fullscreen, kyc, thin, isOpen, onClose, className, isRegisterEntity, background, maxHeight, boxStyles, maxWidth, hideCloseButton, }: ModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export { Box as ModalBox, Dimmer as ModalDimmer, Modal, ModalBack, ModalLink, ModalRoot, ModalInner, ModalClose, ModalScroll, ModalLinkWrap, ModalInnerWithBorder, ModalInnerSmartContractAddress, };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
2
|
import { Portal } from "react-portal";
|
|
4
3
|
import { useState, useEffect } from "react";
|
|
5
4
|
import { ModalRoot, Dimmer, Box, ModalClose } from "./Modal.styles.js";
|
|
@@ -70,7 +69,7 @@ const Modal = ({
|
|
|
70
69
|
opacity: isVisible ? 1 : 0,
|
|
71
70
|
transition: `opacity ${timeout}ms ease-in-out`
|
|
72
71
|
},
|
|
73
|
-
children: /* @__PURE__ */ jsx(Dimmer, { background,
|
|
72
|
+
children: /* @__PURE__ */ jsx(Dimmer, { background, kyc, children: /* @__PURE__ */ jsxs(
|
|
74
73
|
Box,
|
|
75
74
|
{
|
|
76
75
|
kyc,
|
|
@@ -90,22 +89,6 @@ const Modal = ({
|
|
|
90
89
|
)
|
|
91
90
|
] });
|
|
92
91
|
};
|
|
93
|
-
Modal.propTypes = {
|
|
94
|
-
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
|
95
|
-
className: PropTypes.string,
|
|
96
|
-
fullscreen: PropTypes.bool,
|
|
97
|
-
kyc: PropTypes.bool,
|
|
98
|
-
thin: PropTypes.bool,
|
|
99
|
-
isOpen: PropTypes.bool.isRequired,
|
|
100
|
-
onClose: PropTypes.func.isRequired,
|
|
101
|
-
background: PropTypes.string,
|
|
102
|
-
boxStyle: PropTypes.object,
|
|
103
|
-
maxHeight: PropTypes.string,
|
|
104
|
-
/** Max width limit in pixels (e.g., '1200px'). Uses min(percentage, maxWidth) */
|
|
105
|
-
maxWidth: PropTypes.string,
|
|
106
|
-
/** Hides the (X) close button — for flows where the modal is dismissed only via its own actions. */
|
|
107
|
-
hideCloseButton: PropTypes.bool
|
|
108
|
-
};
|
|
109
92
|
export {
|
|
110
93
|
Modal,
|
|
111
94
|
ModalBack,
|