@stokr/components-library 4.0.0 → 4.0.3
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 +6 -2
- package/dist/components/BackButton/BackButton.js +10 -14
- package/dist/components/BackButton/BackButton.styles.js +7 -4
- package/dist/components/ChartLegend/ChartLegend.styles.js +4 -2
- package/dist/components/Checkbox/Checkbox.js +5 -1
- package/dist/components/Checkbox/Checkbox.styles.js +12 -27
- package/dist/components/Checklist/ChecklistCard.js +6 -6
- package/dist/components/Checklist/ChecklistCard.styles.js +0 -39
- package/dist/components/Chips/Chip.js +14 -1
- package/dist/components/Chips/Chip.styles.js +4 -3
- package/dist/components/CryptoAddress/CryptoAddress.styles.js +15 -94
- package/dist/components/CryptoAddressWrapper/CryptoAddressWrapper.styles.js +7 -10
- package/dist/components/FAQ/FAQ.styles.js +6 -2
- package/dist/components/Icon/Icon.style.js +5 -26
- package/dist/components/InfoBox/InfoBox.js +4 -2
- package/dist/components/InfoIcon/InfoIcon.js +24 -28
- package/dist/components/InfoIcon/InfoIcon.styles.d.ts +1 -1
- package/dist/components/InfoIcon/InfoIcon.styles.js +4 -3
- package/dist/components/Input/InputPassword.js +2 -1
- package/dist/components/Input/Select.js +0 -2
- package/dist/components/Input/Select.styles.js +5 -2
- package/dist/components/MaterialIcon/MaterialIcon.d.ts +8 -10
- package/dist/components/MaterialIcon/MaterialIcon.js +14 -12
- package/dist/components/MaterialIcon/MaterialIcon.styles.d.ts +8 -3
- package/dist/components/MaterialIcon/MaterialIcon.styles.js +8 -2
- package/dist/components/MaterialIcon/glyph.d.ts +5 -0
- package/dist/components/MaterialIcon/glyph.js +8 -0
- package/dist/components/MaterialIcon/iconConfig.d.ts +24 -3
- package/dist/components/MaterialIcon/iconConfig.js +7 -7
- package/dist/components/MaterialIcon/requiredIcons.d.ts +5 -0
- package/dist/components/MaterialIcon/requiredIcons.js +21 -0
- package/dist/components/Modal/Modal.js +27 -31
- package/dist/components/Modal/Modal.styles.d.ts +3 -3
- package/dist/components/Modal/Modal.styles.js +31 -51
- package/dist/components/Modal/PaymentModal.js +10 -3
- package/dist/components/Modal/SideModal.js +45 -49
- package/dist/components/Pagination/Pagination.js +3 -3
- package/dist/components/Payment/TimerComponent.js +4 -3
- package/dist/components/Process/Process.styles.js +13 -18
- package/dist/components/ProfileBox/ProfileBox.styles.js +8 -8
- package/dist/components/Section/Section.d.ts +3 -3
- package/dist/components/Section/Section.js +8 -5
- package/dist/components/StatusTag/StatusTag.js +2 -2
- package/dist/components/StokrLoader/StokrLoader.d.ts +2 -1
- package/dist/components/StokrLoader/StokrLoader.js +1 -1
- package/dist/components/TaxResidenceCard/TaxResidenceCard.js +0 -2
- package/dist/components/TaxResidenceCard/TaxResidenceCard.styles.js +4 -2
- package/dist/components/TextLink/TextLink.styles.js +11 -20
- package/dist/components/Timeline/TimelineStep.js +2 -2
- package/dist/index.d.ts +4 -3
- package/dist/index.js +5 -5
- package/dist/styles/rwd.d.ts +7 -2
- package/dist/styles/rwd.js +7 -2
- package/dist/utils/copyToClipboard.d.ts +13 -3
- package/dist/utils/copyToClipboard.js +3 -3
- package/package.json +2 -1
- package/dist/static/images/copy_icon.svg +0 -4
- package/dist/static/images/copy_icon.svg.js +0 -5
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import DOMPurify from "dompurify";
|
|
3
3
|
import parse from "html-react-parser";
|
|
4
|
-
import { IoniconsStyles } from "../../styles/ioniconsStyles.js";
|
|
5
4
|
import { Tooltip } from "../Tooltip/Tooltip.js";
|
|
6
5
|
import { Container, Icon } from "./InfoIcon.styles.js";
|
|
7
6
|
const DEAD_TIPPY_PROPS = [
|
|
@@ -59,32 +58,29 @@ const InfoIcon = ({
|
|
|
59
58
|
}
|
|
60
59
|
containerProps[key] = rest[key];
|
|
61
60
|
});
|
|
62
|
-
return /* @__PURE__ */
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
)
|
|
87
|
-
] });
|
|
61
|
+
return /* @__PURE__ */ jsx(
|
|
62
|
+
Container,
|
|
63
|
+
{
|
|
64
|
+
noMargin,
|
|
65
|
+
noMarginLeft,
|
|
66
|
+
noMarginRight,
|
|
67
|
+
fullWidth,
|
|
68
|
+
style: { ...style, ...containerStyle },
|
|
69
|
+
...containerProps,
|
|
70
|
+
children: /* @__PURE__ */ jsx(
|
|
71
|
+
Tooltip,
|
|
72
|
+
{
|
|
73
|
+
content,
|
|
74
|
+
placement: position,
|
|
75
|
+
disabled,
|
|
76
|
+
showArrow: showArrow ?? arrow,
|
|
77
|
+
arrowColor,
|
|
78
|
+
...tooltipProps,
|
|
79
|
+
children: noIcon ? children : /* @__PURE__ */ jsx(Icon, { outline })
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
);
|
|
88
84
|
};
|
|
89
85
|
export {
|
|
90
86
|
InfoIcon,
|
|
@@ -8,5 +8,5 @@ export declare const Container: import('styled-components/dist/types').IStyledCo
|
|
|
8
8
|
type IconProps = {
|
|
9
9
|
outline?: boolean;
|
|
10
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<
|
|
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<HTMLSpanElement>, HTMLSpanElement>, import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>>, IconProps>, IconProps>> & string;
|
|
12
12
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
2
|
import theme from "../../styles/theme.js";
|
|
3
|
+
import { glyph } from "../MaterialIcon/glyph.js";
|
|
3
4
|
const CONTAINER_OWN_PROPS = ["noMargin", "noMarginLeft", "noMarginRight", "fullWidth"];
|
|
4
5
|
const Container = styled.div.withConfig({
|
|
5
6
|
shouldForwardProp: (prop) => !CONTAINER_OWN_PROPS.includes(prop)
|
|
@@ -22,15 +23,15 @@ const Container = styled.div.withConfig({
|
|
|
22
23
|
justify-content: center;
|
|
23
24
|
`}
|
|
24
25
|
`;
|
|
25
|
-
const Icon = styled.
|
|
26
|
+
const Icon = styled.span.withConfig({
|
|
26
27
|
shouldForwardProp: (prop) => prop !== "outline"
|
|
27
28
|
}).attrs((props) => ({
|
|
28
|
-
|
|
29
|
+
children: glyph("info", !props.outline)
|
|
29
30
|
}))`
|
|
30
31
|
position: relative;
|
|
31
32
|
left: -0.4px;
|
|
32
33
|
|
|
33
|
-
display: inline-
|
|
34
|
+
display: inline-flex;
|
|
34
35
|
vertical-align: middle;
|
|
35
36
|
font-size: 16px;
|
|
36
37
|
line-height: 16px;
|
|
@@ -6,6 +6,7 @@ import { InfoIcon } from "../InfoIcon/InfoIcon.js";
|
|
|
6
6
|
import { Wrapper, Label, InputWrap } from "./Input.styles.js";
|
|
7
7
|
import { getPasswordEntropy, ENTROPY_WEAK, ENTROPY_MEDIUM } from "../../utils/password-validation.js";
|
|
8
8
|
import { InfoIconWrapper, ShowPassword, BottomWrap, PasswordStrengthWrap, PasswordStrengthIndicators, PasswordStrengthIndicator, PasswordStrengthText, CapslockIndicator } from "./InputPassword.styles.js";
|
|
9
|
+
import { MaterialIcon } from "../MaterialIcon/MaterialIcon.js";
|
|
9
10
|
const PasswordStrength = {
|
|
10
11
|
NONE: "none",
|
|
11
12
|
WEAK: "Weak",
|
|
@@ -87,7 +88,7 @@ const InputPassword = (props) => {
|
|
|
87
88
|
onClick: togglePasswordVisibility,
|
|
88
89
|
"aria-label": isPasswordVisible ? "Hide password" : "Show password",
|
|
89
90
|
"data-cy": toggleDataCy ?? `${id}-password-visibility-toggle`,
|
|
90
|
-
children:
|
|
91
|
+
children: /* @__PURE__ */ jsx(MaterialIcon, { name: isPasswordVisible ? "visibility_off" : "visibility", size: "1em" })
|
|
91
92
|
}
|
|
92
93
|
),
|
|
93
94
|
/* @__PURE__ */ jsxs(BottomWrap, { children: [
|
|
@@ -4,7 +4,6 @@ import { Wrapper, Label } from "./Input.styles.js";
|
|
|
4
4
|
import { useState, useMemo } from "react";
|
|
5
5
|
import CreatableSelect from "react-select/creatable";
|
|
6
6
|
import ReactSelect, { components } from "react-select";
|
|
7
|
-
import { IoniconsStyles } from "../../styles/ioniconsStyles.js";
|
|
8
7
|
import { SelectContainer, SelectMenu, SelectControl, SelectedChipsWrapper, SelectedChipsTitle, SelectedChipsList, SelectedChip, SelectedChipLabel, SelectedChipRemove, SelectOption, OptionRow, OptionLabel, OptionCheckbox, SelectMenuList, SelectIcon, OptionIcon } from "./Select.styles.js";
|
|
9
8
|
import { SelectValueContainer, SelectWrapper } from "./Select.styles.js";
|
|
10
9
|
const renderIcon = (icon) => {
|
|
@@ -170,7 +169,6 @@ const Select = (props) => {
|
|
|
170
169
|
const isLabelUp = floatingLabel ? hasFocus || hasValue : Boolean(label);
|
|
171
170
|
const effectivePlaceholder = label ? hasFocus && placeholder ? placeholder : "" : placeholder;
|
|
172
171
|
return /* @__PURE__ */ jsxs(Wrapper, { children: [
|
|
173
|
-
/* @__PURE__ */ jsx(IoniconsStyles, {}),
|
|
174
172
|
label && /* @__PURE__ */ jsx(Label, { isUp: isLabelUp, active: hasFocus, error: error && touched, htmlFor: id, children: label }),
|
|
175
173
|
/* @__PURE__ */ jsx(
|
|
176
174
|
SelectComponent,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
2
|
import { TrackV } from "../ComponentScroll/ComponentScroll.styles.js";
|
|
3
3
|
import stdin_default from "../ComponentScroll/ComponentScroll.js";
|
|
4
|
+
import { glyph } from "../MaterialIcon/glyph.js";
|
|
4
5
|
const SelectControl = css`
|
|
5
6
|
&&& {
|
|
6
7
|
z-index: 10 !important;
|
|
@@ -81,12 +82,14 @@ const SelectValueContainer = css`
|
|
|
81
82
|
margin-left: -2px;
|
|
82
83
|
}
|
|
83
84
|
`;
|
|
84
|
-
const SelectIcon = styled.
|
|
85
|
+
const SelectIcon = styled.span.withConfig({
|
|
85
86
|
shouldForwardProp: (props) => !["isMenuOpen"].includes(props)
|
|
86
87
|
}).attrs({
|
|
87
|
-
|
|
88
|
+
children: glyph("keyboard_arrow_down")
|
|
88
89
|
})`
|
|
89
90
|
&&& {
|
|
91
|
+
display: inline-flex;
|
|
92
|
+
font-size: 18px;
|
|
90
93
|
transition: 0.3s transform;
|
|
91
94
|
transform: rotate(0);
|
|
92
95
|
color: #202020;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentType, SVGProps } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { MaterialIconName } from './iconConfig';
|
|
3
3
|
export declare const ICON_SIZES: {
|
|
4
4
|
readonly xs: 12;
|
|
5
5
|
readonly sm: 16;
|
|
@@ -7,9 +7,9 @@ export declare const ICON_SIZES: {
|
|
|
7
7
|
readonly lg: 24;
|
|
8
8
|
readonly xl: 32;
|
|
9
9
|
};
|
|
10
|
-
export type IconSize = keyof typeof ICON_SIZES | number;
|
|
10
|
+
export type IconSize = keyof typeof ICON_SIZES | number | (string & {});
|
|
11
11
|
interface IconBaseProps {
|
|
12
|
-
/** Token or
|
|
12
|
+
/** Token, px number, or a CSS length such as `1em` to follow the font size. Default `lg` (24px). */
|
|
13
13
|
size?: IconSize;
|
|
14
14
|
/** Any CSS colour. Default: the surrounding text colour. */
|
|
15
15
|
color?: string;
|
|
@@ -19,18 +19,16 @@ interface IconBaseProps {
|
|
|
19
19
|
dataCy?: string;
|
|
20
20
|
}
|
|
21
21
|
export interface MaterialIconProps extends IconBaseProps {
|
|
22
|
-
/** Material Symbols name in snake_case, e.g. `arrow_back` (see fonts.google.com/icons). */
|
|
23
|
-
name:
|
|
22
|
+
/** Material Symbols name in snake_case, e.g. `arrow_back` (see fonts.google.com/icons). Must be registered. */
|
|
23
|
+
name: MaterialIconName;
|
|
24
24
|
variant?: 'outlined' | 'rounded' | 'sharp';
|
|
25
25
|
filled?: boolean;
|
|
26
|
-
/** Stroke weight; needs that weight's package hosted (see `setMaterialIconsBaseUrl`). */
|
|
27
|
-
weight?: MaterialIconWeight;
|
|
28
26
|
}
|
|
29
27
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
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.
|
|
32
30
|
*/
|
|
33
|
-
export declare const MaterialIcon: ({ name, variant, filled,
|
|
31
|
+
export declare const MaterialIcon: ({ name, variant, filled, size, color, label, className, dataCy, }: MaterialIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
34
32
|
export interface SvgIconProps extends IconBaseProps {
|
|
35
33
|
/** An SVG React component (`import Logo from './logo.svg?react'`), or the URL of a single-colour SVG. */
|
|
36
34
|
svg: ComponentType<SVGProps<SVGSVGElement>> | string;
|
|
@@ -1,37 +1,39 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { createElement } from "react";
|
|
3
|
+
import { InlineIcon, MaskedIcon, IconBox } from "./MaterialIcon.styles.js";
|
|
4
|
+
import { getRegisteredMaterialIcon } from "./iconConfig.js";
|
|
4
5
|
const ICON_SIZES = { xs: 12, sm: 16, md: 20, lg: 24, xl: 32 };
|
|
5
|
-
const
|
|
6
|
+
const toLength = (size) => {
|
|
7
|
+
if (typeof size === "number") return `${size}px`;
|
|
8
|
+
return Object.prototype.hasOwnProperty.call(ICON_SIZES, size) ? `${ICON_SIZES[size]}px` : size;
|
|
9
|
+
};
|
|
6
10
|
const a11y = (label) => label ? { role: "img", "aria-label": label } : { "aria-hidden": true };
|
|
7
|
-
const VALID_NAME = /^[a-z0-9_]+$/;
|
|
8
|
-
const VARIANTS = ["outlined", "rounded", "sharp"];
|
|
9
11
|
const cssUrl = (url) => `url("${encodeURI(url).replace(/["'()]/g, (c) => `%${c.charCodeAt(0).toString(16)}`)}")`;
|
|
10
12
|
const MaterialIcon = ({
|
|
11
13
|
name,
|
|
12
14
|
variant = "outlined",
|
|
13
15
|
filled = false,
|
|
14
|
-
weight = 400,
|
|
15
16
|
size = "lg",
|
|
16
17
|
color,
|
|
17
18
|
label,
|
|
18
19
|
className,
|
|
19
20
|
dataCy
|
|
20
21
|
}) => {
|
|
21
|
-
|
|
22
|
+
const path = `${variant}/${name}${filled ? "-fill" : ""}`;
|
|
23
|
+
const svg = getRegisteredMaterialIcon(path);
|
|
24
|
+
if (!svg) {
|
|
22
25
|
return null;
|
|
23
26
|
}
|
|
24
|
-
const url = `${getMaterialIconsBaseUrl(weight)}/${variant}/${name}${filled ? "-fill" : ""}.svg`;
|
|
25
27
|
return /* @__PURE__ */ jsx(
|
|
26
|
-
|
|
28
|
+
InlineIcon,
|
|
27
29
|
{
|
|
28
30
|
...a11y(label),
|
|
29
31
|
className,
|
|
30
32
|
"data-cy": dataCy,
|
|
31
33
|
"data-icon": name,
|
|
32
|
-
$size:
|
|
34
|
+
$size: toLength(size),
|
|
33
35
|
$color: color,
|
|
34
|
-
|
|
36
|
+
children: createElement(svg, { "aria-hidden": true, focusable: false })
|
|
35
37
|
}
|
|
36
38
|
);
|
|
37
39
|
};
|
|
@@ -41,7 +43,7 @@ const SvgIcon = ({ svg: Svg, size = "lg", color, label, className, dataCy }) =>
|
|
|
41
43
|
className,
|
|
42
44
|
"data-cy": dataCy,
|
|
43
45
|
"data-icon": "custom",
|
|
44
|
-
$size:
|
|
46
|
+
$size: toLength(size),
|
|
45
47
|
$color: color
|
|
46
48
|
};
|
|
47
49
|
if (typeof Svg === "string") {
|
|
@@ -1,9 +1,14 @@
|
|
|
1
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:
|
|
2
|
+
$size: string;
|
|
3
3
|
$color?: string;
|
|
4
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>, "$size" | "$color"> & {
|
|
7
|
+
$size: string;
|
|
8
|
+
$color?: string;
|
|
9
|
+
}, never>> & string;
|
|
5
10
|
/** Paints the SVG at `--icon-url` in the text colour, so any colour works without touching the file. */
|
|
6
|
-
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>, "$
|
|
7
|
-
$size:
|
|
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>, "$size" | "$color"> & {
|
|
12
|
+
$size: string;
|
|
8
13
|
$color?: string;
|
|
9
14
|
}, never>> & string;
|
|
@@ -4,8 +4,8 @@ const IconBox = styled.span`
|
|
|
4
4
|
flex: 0 0 auto;
|
|
5
5
|
align-items: center;
|
|
6
6
|
justify-content: center;
|
|
7
|
-
width: ${({ $size }) => $size}
|
|
8
|
-
height: ${({ $size }) => $size}
|
|
7
|
+
width: ${({ $size }) => $size};
|
|
8
|
+
height: ${({ $size }) => $size};
|
|
9
9
|
color: ${({ $color }) => $color ?? "inherit"};
|
|
10
10
|
vertical-align: middle;
|
|
11
11
|
|
|
@@ -14,6 +14,11 @@ const IconBox = styled.span`
|
|
|
14
14
|
height: 100%;
|
|
15
15
|
}
|
|
16
16
|
`;
|
|
17
|
+
const InlineIcon = styled(IconBox)`
|
|
18
|
+
> svg {
|
|
19
|
+
fill: currentColor;
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
17
22
|
const MaskedIcon = styled(IconBox)`
|
|
18
23
|
background-color: currentColor;
|
|
19
24
|
-webkit-mask: var(--icon-url) center / contain no-repeat;
|
|
@@ -21,5 +26,6 @@ const MaskedIcon = styled(IconBox)`
|
|
|
21
26
|
`;
|
|
22
27
|
export {
|
|
23
28
|
IconBox,
|
|
29
|
+
InlineIcon,
|
|
24
30
|
MaskedIcon
|
|
25
31
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/** A Material icon that follows the font size, for `styled.span.attrs({ children: glyph('close') })`. */
|
|
3
|
+
export declare const glyph: (name: string, filled?: boolean, size?: string | number) => import('react').FunctionComponentElement<import('./MaterialIcon').MaterialIconProps>;
|
|
4
|
+
/** An icon placed before the element's own children, for `.attrs((props) => ({ children: withGlyph(...) }))`. */
|
|
5
|
+
export declare const withGlyph: (icon: ReactNode, children: ReactNode) => import('react').FunctionComponentElement<import('react').FragmentProps>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createElement, Fragment } from "react";
|
|
2
|
+
import { MaterialIcon } from "./MaterialIcon.js";
|
|
3
|
+
const glyph = (name, filled = false, size = "1em") => createElement(MaterialIcon, { name, filled, size });
|
|
4
|
+
const withGlyph = (icon, children) => createElement(Fragment, null, icon, children);
|
|
5
|
+
export {
|
|
6
|
+
glyph,
|
|
7
|
+
withGlyph
|
|
8
|
+
};
|
|
@@ -1,3 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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 {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
function
|
|
3
|
-
|
|
1
|
+
const registered = /* @__PURE__ */ new Map();
|
|
2
|
+
function registerMaterialIcons(icons) {
|
|
3
|
+
for (const [key, svg] of Object.entries(icons)) registered.set(key, svg);
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
return
|
|
5
|
+
function getRegisteredMaterialIcon(key) {
|
|
6
|
+
return registered.get(key);
|
|
7
7
|
}
|
|
8
8
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
getRegisteredMaterialIcon,
|
|
10
|
+
registerMaterialIcons
|
|
11
11
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Material Symbols (`<variant>/<name>[-fill]`) the library's own components draw. The host registers them with
|
|
3
|
+
* `registerMaterialIcons`; a component whose icon is not registered renders it empty.
|
|
4
|
+
*/
|
|
5
|
+
export declare const requiredMaterialIcons: readonly ["outlined/add_circle", "outlined/cancel-fill", "outlined/check", "outlined/check_circle-fill", "outlined/chevron_left", "outlined/chevron_right", "outlined/close", "outlined/content_copy", "outlined/edit", "outlined/info", "outlined/info-fill", "outlined/keyboard_arrow_down", "outlined/search_activity", "outlined/visibility", "outlined/visibility_off", "outlined/warning"];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const requiredMaterialIcons = [
|
|
2
|
+
"outlined/add_circle",
|
|
3
|
+
"outlined/cancel-fill",
|
|
4
|
+
"outlined/check",
|
|
5
|
+
"outlined/check_circle-fill",
|
|
6
|
+
"outlined/chevron_left",
|
|
7
|
+
"outlined/chevron_right",
|
|
8
|
+
"outlined/close",
|
|
9
|
+
"outlined/content_copy",
|
|
10
|
+
"outlined/edit",
|
|
11
|
+
"outlined/info",
|
|
12
|
+
"outlined/info-fill",
|
|
13
|
+
"outlined/keyboard_arrow_down",
|
|
14
|
+
"outlined/search_activity",
|
|
15
|
+
"outlined/visibility",
|
|
16
|
+
"outlined/visibility_off",
|
|
17
|
+
"outlined/warning"
|
|
18
|
+
];
|
|
19
|
+
export {
|
|
20
|
+
requiredMaterialIcons
|
|
21
|
+
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Portal } from "react-portal";
|
|
3
3
|
import { useState, useEffect } from "react";
|
|
4
4
|
import { ModalRoot, Dimmer, Box, ModalClose } from "./Modal.styles.js";
|
|
5
5
|
import { ModalBack, ModalInner, ModalInnerSmartContractAddress, ModalInnerWithBorder, ModalLink, ModalLinkWrap, ModalScroll } from "./Modal.styles.js";
|
|
6
|
-
import { IoniconsStyles } from "../../styles/ioniconsStyles.js";
|
|
7
6
|
const timeout = 300;
|
|
8
7
|
const Modal = ({
|
|
9
8
|
children,
|
|
@@ -59,35 +58,32 @@ const Modal = ({
|
|
|
59
58
|
};
|
|
60
59
|
}, [isOpen]);
|
|
61
60
|
if (!shouldRender) return null;
|
|
62
|
-
return /* @__PURE__ */
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
{
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
children
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
)
|
|
90
|
-
] });
|
|
61
|
+
return /* @__PURE__ */ jsx(Portal, { isOpened: isOpen, children: /* @__PURE__ */ jsx(
|
|
62
|
+
ModalRoot,
|
|
63
|
+
{
|
|
64
|
+
className,
|
|
65
|
+
style: {
|
|
66
|
+
opacity: isVisible ? 1 : 0,
|
|
67
|
+
transition: `opacity ${timeout}ms ease-in-out`
|
|
68
|
+
},
|
|
69
|
+
children: /* @__PURE__ */ jsx(Dimmer, { background, kyc, children: /* @__PURE__ */ jsxs(
|
|
70
|
+
Box,
|
|
71
|
+
{
|
|
72
|
+
kyc,
|
|
73
|
+
fullscreen,
|
|
74
|
+
thin,
|
|
75
|
+
isRegisterEntity,
|
|
76
|
+
style: boxStyles,
|
|
77
|
+
maxHeight,
|
|
78
|
+
maxWidth,
|
|
79
|
+
children: [
|
|
80
|
+
!hideCloseButton && /* @__PURE__ */ jsx(ModalClose, { onClick: onClose }),
|
|
81
|
+
children
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
) })
|
|
85
|
+
}
|
|
86
|
+
) });
|
|
91
87
|
};
|
|
92
88
|
export {
|
|
93
89
|
Modal,
|
|
@@ -42,11 +42,11 @@ export interface ModalInnerProps {
|
|
|
42
42
|
noPaddingHorizontal?: boolean;
|
|
43
43
|
}
|
|
44
44
|
export declare const ModalInner: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, ModalInnerProps>> & string;
|
|
45
|
-
export declare const ModalClose: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<
|
|
46
|
-
export declare const ModalBack: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('styled-components').FastOmit<import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<
|
|
45
|
+
export declare const ModalClose: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>>, never>, never>> & string;
|
|
46
|
+
export declare const ModalBack: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('styled-components').FastOmit<import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>>, never>, {
|
|
47
47
|
hide?: boolean;
|
|
48
48
|
}>> & string;
|
|
49
|
-
export declare const ModalLinkWrap: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
49
|
+
export declare const ModalLinkWrap: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>>, never>, never>> & string;
|
|
50
50
|
/** Props of `ModalLink`: a router link (`to`), or any element via `as` (e.g. `as="button"`, then `to` isn't needed). */
|
|
51
51
|
export type ModalLinkProps = Partial<LinkProps> & AnchorHTMLAttributes<HTMLAnchorElement> & ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
52
52
|
as?: ElementType;
|