@stokr/components-library 5.0.0 → 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/dist/components/AddressItem/AddressItem.d.ts +38 -0
- package/dist/components/AddressItem/AddressItem.js +51 -0
- package/dist/components/AddressItem/AddressItem.styles.d.ts +31 -0
- package/dist/components/AddressItem/AddressItem.styles.js +71 -0
- package/dist/components/AdminDashboard/Table/Table.styles.js +18 -25
- package/dist/components/AgreementItem/AgreementItem.styles.js +1 -1
- package/dist/components/BackButton/BackButton.styles.js +15 -15
- package/dist/components/BasicTable/BasicTable.styles.js +6 -8
- package/dist/components/BlogPost/BlogPost.styles.js +9 -13
- package/dist/components/Button/Button.styles.d.ts +1 -1
- package/dist/components/Button/Button.styles.js +122 -11
- package/dist/components/Button/GlareButton.js +1 -1
- package/dist/components/Card/Card.styles.js +3 -4
- package/dist/components/CardTabs/CardTabs.styles.js +17 -17
- package/dist/components/ChartLegend/ChartLegend.styles.js +6 -7
- package/dist/components/Checkbox/Checkbox.styles.d.ts +1 -0
- package/dist/components/Checkbox/Checkbox.styles.js +10 -11
- package/dist/components/Checklist/ChecklistCard.js +3 -3
- package/dist/components/Checklist/ChecklistCard.styles.js +7 -20
- package/dist/components/Chips/Chip.js +2 -2
- package/dist/components/Chips/Chip.styles.js +6 -10
- package/dist/components/Collapsible/Collapsible.d.ts +10 -4
- package/dist/components/Collapsible/Collapsible.js +6 -14
- package/dist/components/Collapsible/Collapsible.styles.d.ts +3 -1
- package/dist/components/Collapsible/Collapsible.styles.js +33 -16
- package/dist/components/ComponentScroll/ComponentScroll.styles.js +5 -5
- package/dist/components/ComponentWrapper/ComponentWrapper.styles.js +5 -5
- package/dist/components/ConfirmModal/ConfirmModal.styles.js +2 -2
- package/dist/components/Country/CountrySelect.js +15 -20
- package/dist/components/Country/FlagFor.d.ts +9 -0
- package/dist/components/Country/FlagFor.js +25 -0
- package/dist/components/Country/flagLoaders.d.ts +5 -0
- package/dist/components/Country/flagLoaders.js +270 -0
- package/dist/components/Country/flagStore.d.ts +6 -0
- package/dist/components/Country/flagStore.js +29 -0
- package/dist/components/CryptoAddress/CryptoAddress.d.ts +6 -2
- package/dist/components/CryptoAddress/CryptoAddress.js +2 -2
- package/dist/components/CryptoAddress/CryptoAddress.styles.d.ts +2 -1
- package/dist/components/CryptoAddress/CryptoAddress.styles.js +20 -27
- package/dist/components/CryptoAddressWrapper/CryptoAddressWrapper.styles.js +2 -2
- package/dist/components/FAQ/FAQ.d.ts +29 -0
- package/dist/components/FAQ/FAQ.js +18 -18
- package/dist/components/FAQ/FAQ.styles.d.ts +11 -3
- package/dist/components/FAQ/FAQ.styles.js +59 -10
- package/dist/components/Form/Form.styles.js +5 -5
- package/dist/components/Grid/Grid.styles.js +7 -7
- package/dist/components/IdentityInfo/IdentityInfo.js +2 -1
- package/dist/components/IdentityInfo/IdentityInfo.styles.js +13 -23
- package/dist/components/InfoBox/InfoBox.d.ts +15 -13
- package/dist/components/InfoBox/InfoBox.js +31 -14
- package/dist/components/InfoIcon/InfoIcon.styles.js +2 -2
- package/dist/components/Input/DatePickerInput.styles.js +23 -24
- package/dist/components/Input/Input.d.ts +3 -0
- package/dist/components/Input/Input.js +5 -2
- package/dist/components/Input/Input.styles.d.ts +4 -0
- package/dist/components/Input/Input.styles.js +77 -27
- package/dist/components/Input/InputPassword.styles.js +11 -11
- package/dist/components/Input/InputWithButton.styles.js +5 -5
- package/dist/components/Input/MultiSelect.js +17 -17
- package/dist/components/Input/OtpInput.js +1 -1
- package/dist/components/Input/RangeInput.js +2 -2
- package/dist/components/Input/SearchInput.styles.js +10 -10
- package/dist/components/Input/Select.d.ts +57 -0
- package/dist/components/Input/Select.js +101 -106
- package/dist/components/Input/Select.styles.d.ts +89 -0
- package/dist/components/Input/Select.styles.js +115 -19
- package/dist/components/Input/TableFilterDropdown.js +5 -5
- package/dist/components/Input/Textarea.styles.js +11 -13
- package/dist/components/MaterialIcon/requiredIcons.d.ts +1 -1
- package/dist/components/MaterialIcon/requiredIcons.js +2 -0
- package/dist/components/MenuNav/MenuNav.styles.js +2 -5
- package/dist/components/Modal/Modal.styles.js +25 -31
- package/dist/components/Modal/PaymentModal.js +7 -7
- package/dist/components/Modal/SideModal.styles.js +8 -8
- package/dist/components/Modal/SideModalParts.js +15 -16
- package/dist/components/Modal/SuccessModal/SuccessModal.styles.js +5 -8
- package/dist/components/NotificationCounter/NotificationCounter.styles.js +2 -2
- package/dist/components/Number/Number.js +1 -1
- package/dist/components/Number/Number.styles.js +2 -2
- package/dist/components/Pagination/Pagination.styles.js +7 -7
- package/dist/components/PanelCard/PanelCard.d.ts +51 -0
- package/dist/components/PanelCard/PanelCard.js +35 -0
- package/dist/components/PanelCard/PanelCard.styles.d.ts +29 -0
- package/dist/components/PanelCard/PanelCard.styles.js +84 -0
- package/dist/components/Payment/DetailRows.js +1 -1
- package/dist/components/Payment/DetailsToggle.js +4 -6
- package/dist/components/Payment/PaymentDetailsCard.js +29 -53
- package/dist/components/Payment/PaymentDisplay.js +12 -20
- package/dist/components/Payment/PaymentPendingCard.d.ts +1 -1
- package/dist/components/Payment/PaymentPendingCard.js +10 -13
- package/dist/components/Payment/PaymentSuccessCard.js +6 -9
- package/dist/components/Payment/TimerComponent.js +5 -4
- package/dist/components/Process/Process.styles.js +7 -13
- package/dist/components/ProfileBadge/ProfileBadge.styles.js +8 -10
- package/dist/components/ProfileBox/ProfileBox.styles.js +5 -7
- package/dist/components/Radio/Radio.styles.d.ts +1 -0
- package/dist/components/Radio/Radio.styles.js +8 -9
- package/dist/components/RefreshButton/RefreshButton.styles.js +5 -5
- package/dist/components/RequestDataBox/RequestDataBox.styles.js +3 -5
- package/dist/components/Section/Section.styles.js +16 -18
- package/dist/components/SectionTitle/SectionTitle.styles.d.ts +4 -0
- package/dist/components/SectionTitle/SectionTitle.styles.js +4 -7
- package/dist/components/Skeleton/Skeleton.d.ts +1 -1
- package/dist/components/Skeleton/Skeleton.js +3 -3
- package/dist/components/Snackbar/Snackbar.styles.js +8 -10
- package/dist/components/SpanButton/SpanButton.styles.js +2 -2
- package/dist/components/StatusDot/StatusDot.d.ts +1 -1
- package/dist/components/StatusDot/StatusDot.js +5 -5
- package/dist/components/StatusDot/StatusDot.styles.js +2 -5
- package/dist/components/StatusTag/StatusTag.js +1 -1
- package/dist/components/StatusTag/StatusTag.styles.js +4 -4
- package/dist/components/StepController/StepController.styles.js +7 -7
- package/dist/components/StepSidebar/MobileStepProgress.d.ts +12 -0
- package/dist/components/StepSidebar/MobileStepProgress.js +14 -0
- package/dist/components/StepSidebar/MobileStepProgress.styles.d.ts +15 -0
- package/dist/components/StepSidebar/MobileStepProgress.styles.js +39 -0
- package/dist/components/StepSidebar/StepProgress.d.ts +14 -0
- package/dist/components/StepSidebar/StepProgress.js +14 -0
- package/dist/components/StepSidebar/StepProgress.styles.d.ts +30 -0
- package/dist/components/StepSidebar/StepProgress.styles.js +97 -0
- package/dist/components/StepSidebar/StepSidebar.d.ts +36 -0
- package/dist/components/StepSidebar/StepSidebar.js +58 -0
- package/dist/components/StepSidebar/StepSidebar.styles.d.ts +55 -0
- package/dist/components/StepSidebar/StepSidebar.styles.js +168 -0
- package/dist/components/StokrLoader/StokrLoader.d.ts +16 -2
- package/dist/components/StokrLoader/StokrLoader.js +170 -28
- package/dist/components/StokrLoader/loaderSession.d.ts +14 -0
- package/dist/components/StokrLoader/loaderSession.js +30 -0
- package/dist/components/Switch/Switch.styles.js +12 -14
- package/dist/components/TabsNav/TabsNav.styles.js +7 -9
- package/dist/components/TaxResidenceCard/TaxResidenceCard.js +26 -11
- package/dist/components/TaxResidenceCard/TaxResidenceCard.styles.d.ts +29 -12
- package/dist/components/TaxResidenceCard/TaxResidenceCard.styles.js +103 -30
- package/dist/components/Text/Text.styles.d.ts +2 -1
- package/dist/components/Text/Text.styles.js +36 -70
- package/dist/components/TextLink/TextLink.styles.js +5 -7
- package/dist/components/Timeline/Timeline.styles.js +17 -23
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.js +1 -2
- package/dist/components/Tooltip/Tooltip.styles.js +4 -5
- package/dist/components/breakdown/Breakdown.js +3 -5
- package/dist/components/logo/Logo.js +1 -1
- package/dist/constants/chainLogos.d.ts +9 -0
- package/dist/constants/chainLogos.js +17 -0
- package/dist/design-system/css/base.css +14 -14
- package/dist/design-system/css-builders.d.ts +25 -0
- package/dist/design-system/css-builders.js +81 -0
- package/dist/design-system/generated/fonts.css +0 -49
- package/dist/design-system/generated/text-classes.css +123 -123
- package/dist/design-system/generated/text-styles.d.ts +24 -24
- package/dist/design-system/generated/text-styles.js +123 -123
- package/dist/design-system/generated/tokens.css +417 -412
- package/dist/design-system/index.d.ts +2 -1
- package/dist/design-system/styled/build-theme.js +1 -1
- package/dist/design-system/tokens/colors.d.ts +1 -1
- package/dist/design-system/tokens/colors.js +1 -1
- package/dist/design-system/tokens/fonts.d.ts +6 -2
- package/dist/design-system/tokens/fonts.js +1 -1
- package/dist/design-system/tokens/semantic.d.ts +15 -3
- package/dist/design-system/tokens/semantic.js +5 -1
- package/dist/design-system/tokens/typography.d.ts +1 -1
- package/dist/design-system/tokens/typography.js +64 -41
- package/dist/index.d.ts +84 -7
- package/dist/index.js +24 -4
- package/dist/static/images/chains/avalanche.svg +7 -0
- package/dist/static/images/chains/avalanche.svg.js +4 -0
- package/dist/static/images/chains/ethereum.svg +14 -0
- package/dist/static/images/chains/ethereum.svg.js +4 -0
- package/dist/static/images/chains/liquid.svg +7 -0
- package/dist/static/images/chains/liquid.svg.js +4 -0
- package/dist/static/images/chains/solana.svg +29 -0
- package/dist/static/images/chains/solana.svg.js +4 -0
- package/dist/static/images/chains/stellar.svg +17 -0
- package/dist/static/images/chains/stellar.svg.js +4 -0
- package/dist/static/images/chains/tempo.svg +11 -0
- package/dist/static/images/chains/tempo.svg.js +4 -0
- package/dist/styles/borderedField.d.ts +11 -0
- package/dist/styles/borderedField.js +53 -0
- package/package.json +1 -1
- package/dist/static/images/globe.svg.js +0 -5
- package/dist/static/images/trash.svg +0 -17
- package/dist/static/images/trash.svg.js +0 -5
|
@@ -3,16 +3,18 @@ import { text } from "../../design-system/styled/text.js";
|
|
|
3
3
|
const DURATION = "300ms";
|
|
4
4
|
const EASING = "cubic-bezier(0.4, 0, 0.2, 1)";
|
|
5
5
|
const Root = styled.div`
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
${({ $flush }) => !$flush && `
|
|
7
|
+
background: var(--background-default);
|
|
8
|
+
border: 1px solid var(--border-subtle);
|
|
9
|
+
border-radius: var(--radius-lg);
|
|
10
|
+
box-shadow: var(--elevation-xs);
|
|
11
|
+
`}
|
|
10
12
|
|
|
11
13
|
/* Pointer devices only: on touch a tap leaves :hover stuck after closing it. */
|
|
12
|
-
${({ $open }) => !$open && `
|
|
14
|
+
${({ $open, $flush }) => !$open && !$flush && `
|
|
13
15
|
@media (hover: hover) {
|
|
14
16
|
&:hover {
|
|
15
|
-
box-shadow: var(--
|
|
17
|
+
box-shadow: var(--elevation-sm);
|
|
16
18
|
}
|
|
17
19
|
}
|
|
18
20
|
`}
|
|
@@ -24,25 +26,37 @@ const Header = styled.button`
|
|
|
24
26
|
display: flex;
|
|
25
27
|
align-items: center;
|
|
26
28
|
justify-content: space-between;
|
|
27
|
-
gap: var(--
|
|
29
|
+
gap: var(--space-4);
|
|
28
30
|
width: 100%;
|
|
29
|
-
padding: var(--
|
|
31
|
+
padding: var(--collapsible-header-padding, var(--space-5));
|
|
30
32
|
border: none;
|
|
31
33
|
background: none;
|
|
32
|
-
color: var(--
|
|
34
|
+
color: var(--text-primary);
|
|
33
35
|
text-align: left;
|
|
34
36
|
cursor: pointer;
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
/* The rule and the tighter bottom padding follow the body's open animation instead of snapping. */
|
|
39
|
+
${({ $divided, $open }) => $divided && `
|
|
40
|
+
padding-bottom: ${$open ? "var(--space-4)" : "var(--space-5)"};
|
|
41
|
+
transition: padding-bottom ${DURATION} ${EASING};
|
|
38
42
|
|
|
39
43
|
&::after {
|
|
40
44
|
content: '';
|
|
41
45
|
position: absolute;
|
|
42
|
-
right: var(--
|
|
46
|
+
right: var(--space-5);
|
|
43
47
|
bottom: 0;
|
|
44
|
-
left: var(--
|
|
45
|
-
border-bottom: 1px solid var(--
|
|
48
|
+
left: var(--space-5);
|
|
49
|
+
border-bottom: 1px solid var(--border-subtle);
|
|
50
|
+
opacity: ${$open ? 1 : 0};
|
|
51
|
+
transition: opacity ${DURATION} ${EASING};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@media (prefers-reduced-motion: reduce) {
|
|
55
|
+
transition: none;
|
|
56
|
+
|
|
57
|
+
&::after {
|
|
58
|
+
transition: none;
|
|
59
|
+
}
|
|
46
60
|
}
|
|
47
61
|
`}
|
|
48
62
|
`;
|
|
@@ -78,8 +92,11 @@ const BodyClip = styled.div`
|
|
|
78
92
|
`;
|
|
79
93
|
const BodyInner = styled.div`
|
|
80
94
|
${text("bodyS")};
|
|
81
|
-
padding:
|
|
82
|
-
|
|
95
|
+
padding: var(
|
|
96
|
+
--collapsible-body-padding,
|
|
97
|
+
${({ $divided }) => $divided ? "var(--space-6)" : "0"} var(--space-5) var(--space-5)
|
|
98
|
+
);
|
|
99
|
+
color: var(--text-secondary);
|
|
83
100
|
`;
|
|
84
101
|
export {
|
|
85
102
|
Body,
|
|
@@ -37,7 +37,7 @@ const Container = styled.div.withConfig({
|
|
|
37
37
|
`}
|
|
38
38
|
`;
|
|
39
39
|
const TrackH = styled.div`
|
|
40
|
-
background-color: var(--
|
|
40
|
+
background-color: var(--border-subtle);
|
|
41
41
|
left: 16px;
|
|
42
42
|
right: 16px;
|
|
43
43
|
bottom: 14px;
|
|
@@ -51,12 +51,12 @@ const TrackH = styled.div`
|
|
|
51
51
|
`}
|
|
52
52
|
`;
|
|
53
53
|
const ThumbH = styled.div`
|
|
54
|
-
background-color: var(--
|
|
54
|
+
background-color: var(--action-accent-bg);
|
|
55
55
|
height: 4px;
|
|
56
56
|
border-radius: 4px;
|
|
57
57
|
`;
|
|
58
58
|
const TrackV = styled.div`
|
|
59
|
-
background-color: var(--
|
|
59
|
+
background-color: var(--border-subtle);
|
|
60
60
|
top: 16px;
|
|
61
61
|
bottom: 16px;
|
|
62
62
|
right: 14px;
|
|
@@ -70,12 +70,12 @@ const TrackV = styled.div`
|
|
|
70
70
|
`}
|
|
71
71
|
`;
|
|
72
72
|
const ThumbV = styled.div`
|
|
73
|
-
background-color: var(--
|
|
73
|
+
background-color: var(--action-accent-bg);
|
|
74
74
|
width: 4px;
|
|
75
75
|
border-radius: 4px;
|
|
76
76
|
`;
|
|
77
77
|
const View = styled.div`
|
|
78
|
-
scrollbar-color: var(--
|
|
78
|
+
scrollbar-color: var(--action-accent-bg) transparent;
|
|
79
79
|
`;
|
|
80
80
|
const Outer = styled.div.withConfig({
|
|
81
81
|
shouldForwardProp: (props) => !["offset", "barPadding", "topPadding"].includes(props)
|
|
@@ -44,19 +44,19 @@ const ComponentWrapper = styled.div.withConfig({
|
|
|
44
44
|
`}
|
|
45
45
|
|
|
46
46
|
${(props) => props.borderLeft && css`
|
|
47
|
-
border-left: 1px solid var(--
|
|
47
|
+
border-left: 1px solid var(--border-subtle);
|
|
48
48
|
`}
|
|
49
49
|
|
|
50
50
|
${(props) => props.borderRight && css`
|
|
51
|
-
border-right: 1px solid var(--
|
|
51
|
+
border-right: 1px solid var(--border-subtle);
|
|
52
52
|
`}
|
|
53
53
|
|
|
54
54
|
${(props) => props.borderTop && css`
|
|
55
|
-
border-top: 1px solid var(--
|
|
55
|
+
border-top: 1px solid var(--border-subtle);
|
|
56
56
|
`}
|
|
57
57
|
|
|
58
58
|
${(props) => props.borderBottom && css`
|
|
59
|
-
border-bottom: 1px solid var(--
|
|
59
|
+
border-bottom: 1px solid var(--border-subtle);
|
|
60
60
|
`}
|
|
61
61
|
|
|
62
62
|
${(props) => props.noPaddingLeft && css`
|
|
@@ -112,7 +112,7 @@ const ComponentWrapper = styled.div.withConfig({
|
|
|
112
112
|
`}
|
|
113
113
|
|
|
114
114
|
${(props) => props.background && css`
|
|
115
|
-
background-color: var(--
|
|
115
|
+
background-color: var(--background-surface);
|
|
116
116
|
`}
|
|
117
117
|
|
|
118
118
|
${(props) => props.fluid && css`
|
|
@@ -11,7 +11,7 @@ const ContainerWithLine = styled(Text).withConfig({
|
|
|
11
11
|
content: '';
|
|
12
12
|
width: 11px;
|
|
13
13
|
height: ${({ height }) => height ? height - 15 : 50}px;
|
|
14
|
-
background: ${(props) => props.lineColor || "var(--
|
|
14
|
+
background: ${(props) => props.lineColor || "var(--action-accent-bg)"};
|
|
15
15
|
position: absolute;
|
|
16
16
|
left: 0;
|
|
17
17
|
top: 6px;
|
|
@@ -20,7 +20,7 @@ const ContainerWithLine = styled(Text).withConfig({
|
|
|
20
20
|
const RedBar = styled.div.withConfig({
|
|
21
21
|
shouldForwardProp: (props) => !["barColor"].includes(props)
|
|
22
22
|
})`
|
|
23
|
-
background: ${(props) => props.barColor || "var(--
|
|
23
|
+
background: ${(props) => props.barColor || "var(--color-red-500)"};
|
|
24
24
|
bottom: 0;
|
|
25
25
|
height: 20%;
|
|
26
26
|
position: absolute;
|
|
@@ -3,11 +3,11 @@ import PropTypes from "prop-types";
|
|
|
3
3
|
import styled from "styled-components";
|
|
4
4
|
import { useMemo } from "react";
|
|
5
5
|
import { Select } from "../Input/Select.js";
|
|
6
|
-
import
|
|
6
|
+
import { FlagFor } from "./FlagFor.js";
|
|
7
7
|
import { SelectedChipsTitle, SelectedChipsList, SelectedChip, SelectedChipRemove } from "../Input/Select.styles.js";
|
|
8
8
|
const PillChipsWrapper = styled.div`
|
|
9
9
|
${SelectedChipsTitle} {
|
|
10
|
-
color: var(--
|
|
10
|
+
color: var(--text-tertiary);
|
|
11
11
|
margin-bottom: 10px;
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -17,13 +17,13 @@ const PillChipsWrapper = styled.div`
|
|
|
17
17
|
|
|
18
18
|
${SelectedChip} {
|
|
19
19
|
padding: 6px 12px 6px 10px;
|
|
20
|
-
border-color: var(--
|
|
20
|
+
border-color: var(--border-subtle);
|
|
21
21
|
border-radius: 999px;
|
|
22
22
|
font-size: 13px;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
${SelectedChipRemove} {
|
|
26
|
-
color: var(--
|
|
26
|
+
color: var(--text-tertiary);
|
|
27
27
|
font-size: 12px;
|
|
28
28
|
border-radius: 50%;
|
|
29
29
|
transition:
|
|
@@ -31,8 +31,8 @@ const PillChipsWrapper = styled.div`
|
|
|
31
31
|
background-color 0.15s;
|
|
32
32
|
|
|
33
33
|
&:hover {
|
|
34
|
-
color: var(--
|
|
35
|
-
background-color: var(--
|
|
34
|
+
color: var(--action-outline-text);
|
|
35
|
+
background-color: var(--action-outline-bg-hover);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
&:disabled {
|
|
@@ -40,27 +40,19 @@ const PillChipsWrapper = styled.div`
|
|
|
40
40
|
opacity: 0.5;
|
|
41
41
|
|
|
42
42
|
&:hover {
|
|
43
|
-
color: var(--
|
|
43
|
+
color: var(--text-tertiary);
|
|
44
44
|
background-color: transparent;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
`;
|
|
49
|
-
const FlagFor = ({ code }) => {
|
|
50
|
-
if (!code) return null;
|
|
51
|
-
const Cmp = Flags[code.toUpperCase()];
|
|
52
|
-
if (!Cmp) return null;
|
|
53
|
-
return /* @__PURE__ */ jsx(Cmp, { "aria-hidden": "true", focusable: "false" });
|
|
54
|
-
};
|
|
55
|
-
FlagFor.propTypes = {
|
|
56
|
-
code: PropTypes.string
|
|
57
|
-
};
|
|
58
49
|
const CountrySelect = (props) => {
|
|
59
50
|
const {
|
|
60
51
|
countries,
|
|
61
52
|
multiple = false,
|
|
62
53
|
placeholder = multiple ? "Search and select countries" : "Search countries",
|
|
63
54
|
selectedLabel = "Selected",
|
|
55
|
+
variant = "default",
|
|
64
56
|
...rest
|
|
65
57
|
} = props;
|
|
66
58
|
const options = useMemo(
|
|
@@ -71,17 +63,19 @@ const CountrySelect = (props) => {
|
|
|
71
63
|
})),
|
|
72
64
|
[countries]
|
|
73
65
|
);
|
|
74
|
-
|
|
66
|
+
const select = /* @__PURE__ */ jsx(
|
|
75
67
|
Select,
|
|
76
68
|
{
|
|
77
69
|
...rest,
|
|
70
|
+
variant,
|
|
78
71
|
options,
|
|
79
72
|
multiple,
|
|
80
73
|
search: true,
|
|
81
74
|
placeholder,
|
|
82
75
|
selectedLabel
|
|
83
76
|
}
|
|
84
|
-
)
|
|
77
|
+
);
|
|
78
|
+
return variant === "bordered" ? select : /* @__PURE__ */ jsx(PillChipsWrapper, { children: select });
|
|
85
79
|
};
|
|
86
80
|
CountrySelect.propTypes = {
|
|
87
81
|
id: PropTypes.string.isRequired,
|
|
@@ -103,6 +97,8 @@ CountrySelect.propTypes = {
|
|
|
103
97
|
lockedValues: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
|
|
104
98
|
placeholder: PropTypes.string,
|
|
105
99
|
selectedLabel: PropTypes.string,
|
|
100
|
+
/** `bordered`: boxed control with a static label and the sign-up chips. Default keeps the underline look. */
|
|
101
|
+
variant: PropTypes.oneOf(["default", "bordered"]),
|
|
106
102
|
error: PropTypes.bool,
|
|
107
103
|
touched: PropTypes.bool,
|
|
108
104
|
disabled: PropTypes.bool,
|
|
@@ -114,6 +110,5 @@ CountrySelect.propTypes = {
|
|
|
114
110
|
};
|
|
115
111
|
export {
|
|
116
112
|
CountrySelect,
|
|
117
|
-
FlagFor
|
|
118
|
-
Flags
|
|
113
|
+
FlagFor
|
|
119
114
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface FlagForProps {
|
|
2
|
+
/** ISO 3166-1 alpha-2 code, case-insensitive. */
|
|
3
|
+
code?: string | null;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* SVG flag for a country code, loaded on first use (one small chunk per flag) and cached. Renders nothing for an
|
|
7
|
+
* unknown code or until the flag has loaded. Fills the width of its container.
|
|
8
|
+
*/
|
|
9
|
+
export declare const FlagFor: ({ code }: FlagForProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useSyncExternalStore, useEffect } from "react";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import { toFlagKey, subscribeToFlags, getFlagSrc, loadFlag } from "./flagStore.js";
|
|
5
|
+
const FlagImage = styled.img`
|
|
6
|
+
display: block;
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: auto;
|
|
9
|
+
`;
|
|
10
|
+
const FlagFor = ({ code }) => {
|
|
11
|
+
const key = code ? toFlagKey(code) : "";
|
|
12
|
+
const src = useSyncExternalStore(
|
|
13
|
+
subscribeToFlags,
|
|
14
|
+
() => getFlagSrc(key),
|
|
15
|
+
() => void 0
|
|
16
|
+
);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (key) loadFlag(key);
|
|
19
|
+
}, [key]);
|
|
20
|
+
if (!src) return null;
|
|
21
|
+
return /* @__PURE__ */ jsx(FlagImage, { src, alt: "", "aria-hidden": "true" });
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
FlagFor
|
|
25
|
+
};
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
const flagLoaders = {
|
|
2
|
+
AC: () => import("country-flag-icons/string/3x2/AC"),
|
|
3
|
+
AD: () => import("country-flag-icons/string/3x2/AD"),
|
|
4
|
+
AE: () => import("country-flag-icons/string/3x2/AE"),
|
|
5
|
+
AF: () => import("country-flag-icons/string/3x2/AF"),
|
|
6
|
+
AG: () => import("country-flag-icons/string/3x2/AG"),
|
|
7
|
+
AI: () => import("country-flag-icons/string/3x2/AI"),
|
|
8
|
+
AL: () => import("country-flag-icons/string/3x2/AL"),
|
|
9
|
+
AM: () => import("country-flag-icons/string/3x2/AM"),
|
|
10
|
+
AO: () => import("country-flag-icons/string/3x2/AO"),
|
|
11
|
+
AQ: () => import("country-flag-icons/string/3x2/AQ"),
|
|
12
|
+
AR: () => import("country-flag-icons/string/3x2/AR"),
|
|
13
|
+
AS: () => import("country-flag-icons/string/3x2/AS"),
|
|
14
|
+
AT: () => import("country-flag-icons/string/3x2/AT"),
|
|
15
|
+
AU: () => import("country-flag-icons/string/3x2/AU"),
|
|
16
|
+
AW: () => import("country-flag-icons/string/3x2/AW"),
|
|
17
|
+
AX: () => import("country-flag-icons/string/3x2/AX"),
|
|
18
|
+
AZ: () => import("country-flag-icons/string/3x2/AZ"),
|
|
19
|
+
BA: () => import("country-flag-icons/string/3x2/BA"),
|
|
20
|
+
BB: () => import("country-flag-icons/string/3x2/BB"),
|
|
21
|
+
BD: () => import("country-flag-icons/string/3x2/BD"),
|
|
22
|
+
BE: () => import("country-flag-icons/string/3x2/BE"),
|
|
23
|
+
BF: () => import("country-flag-icons/string/3x2/BF"),
|
|
24
|
+
BG: () => import("country-flag-icons/string/3x2/BG"),
|
|
25
|
+
BH: () => import("country-flag-icons/string/3x2/BH"),
|
|
26
|
+
BI: () => import("country-flag-icons/string/3x2/BI"),
|
|
27
|
+
BJ: () => import("country-flag-icons/string/3x2/BJ"),
|
|
28
|
+
BL: () => import("country-flag-icons/string/3x2/BL"),
|
|
29
|
+
BM: () => import("country-flag-icons/string/3x2/BM"),
|
|
30
|
+
BN: () => import("country-flag-icons/string/3x2/BN"),
|
|
31
|
+
BO: () => import("country-flag-icons/string/3x2/BO"),
|
|
32
|
+
BQ_BO: () => import("country-flag-icons/string/3x2/BQ-BO"),
|
|
33
|
+
BQ_SA: () => import("country-flag-icons/string/3x2/BQ-SA"),
|
|
34
|
+
BQ_SE: () => import("country-flag-icons/string/3x2/BQ-SE"),
|
|
35
|
+
BQ: () => import("country-flag-icons/string/3x2/BQ"),
|
|
36
|
+
BR: () => import("country-flag-icons/string/3x2/BR"),
|
|
37
|
+
BS: () => import("country-flag-icons/string/3x2/BS"),
|
|
38
|
+
BT: () => import("country-flag-icons/string/3x2/BT"),
|
|
39
|
+
BV: () => import("country-flag-icons/string/3x2/BV"),
|
|
40
|
+
BW: () => import("country-flag-icons/string/3x2/BW"),
|
|
41
|
+
BY: () => import("country-flag-icons/string/3x2/BY"),
|
|
42
|
+
BZ: () => import("country-flag-icons/string/3x2/BZ"),
|
|
43
|
+
CA: () => import("country-flag-icons/string/3x2/CA"),
|
|
44
|
+
CC: () => import("country-flag-icons/string/3x2/CC"),
|
|
45
|
+
CD: () => import("country-flag-icons/string/3x2/CD"),
|
|
46
|
+
CF: () => import("country-flag-icons/string/3x2/CF"),
|
|
47
|
+
CG: () => import("country-flag-icons/string/3x2/CG"),
|
|
48
|
+
CH: () => import("country-flag-icons/string/3x2/CH"),
|
|
49
|
+
CI: () => import("country-flag-icons/string/3x2/CI"),
|
|
50
|
+
CK: () => import("country-flag-icons/string/3x2/CK"),
|
|
51
|
+
CL: () => import("country-flag-icons/string/3x2/CL"),
|
|
52
|
+
CM: () => import("country-flag-icons/string/3x2/CM"),
|
|
53
|
+
CN: () => import("country-flag-icons/string/3x2/CN"),
|
|
54
|
+
CO: () => import("country-flag-icons/string/3x2/CO"),
|
|
55
|
+
CR: () => import("country-flag-icons/string/3x2/CR"),
|
|
56
|
+
CU: () => import("country-flag-icons/string/3x2/CU"),
|
|
57
|
+
CV: () => import("country-flag-icons/string/3x2/CV"),
|
|
58
|
+
CW: () => import("country-flag-icons/string/3x2/CW"),
|
|
59
|
+
CX: () => import("country-flag-icons/string/3x2/CX"),
|
|
60
|
+
CY: () => import("country-flag-icons/string/3x2/CY"),
|
|
61
|
+
CZ: () => import("country-flag-icons/string/3x2/CZ"),
|
|
62
|
+
DE: () => import("country-flag-icons/string/3x2/DE"),
|
|
63
|
+
DJ: () => import("country-flag-icons/string/3x2/DJ"),
|
|
64
|
+
DK: () => import("country-flag-icons/string/3x2/DK"),
|
|
65
|
+
DM: () => import("country-flag-icons/string/3x2/DM"),
|
|
66
|
+
DO: () => import("country-flag-icons/string/3x2/DO"),
|
|
67
|
+
DZ: () => import("country-flag-icons/string/3x2/DZ"),
|
|
68
|
+
EC: () => import("country-flag-icons/string/3x2/EC"),
|
|
69
|
+
EE: () => import("country-flag-icons/string/3x2/EE"),
|
|
70
|
+
EG: () => import("country-flag-icons/string/3x2/EG"),
|
|
71
|
+
EH: () => import("country-flag-icons/string/3x2/EH"),
|
|
72
|
+
ER: () => import("country-flag-icons/string/3x2/ER"),
|
|
73
|
+
ES_CT: () => import("country-flag-icons/string/3x2/ES-CT"),
|
|
74
|
+
ES: () => import("country-flag-icons/string/3x2/ES"),
|
|
75
|
+
ET: () => import("country-flag-icons/string/3x2/ET"),
|
|
76
|
+
EU: () => import("country-flag-icons/string/3x2/EU"),
|
|
77
|
+
FI: () => import("country-flag-icons/string/3x2/FI"),
|
|
78
|
+
FJ: () => import("country-flag-icons/string/3x2/FJ"),
|
|
79
|
+
FK: () => import("country-flag-icons/string/3x2/FK"),
|
|
80
|
+
FM: () => import("country-flag-icons/string/3x2/FM"),
|
|
81
|
+
FO: () => import("country-flag-icons/string/3x2/FO"),
|
|
82
|
+
FR: () => import("country-flag-icons/string/3x2/FR"),
|
|
83
|
+
GA: () => import("country-flag-icons/string/3x2/GA"),
|
|
84
|
+
GB_ENG: () => import("country-flag-icons/string/3x2/GB-ENG"),
|
|
85
|
+
GB_NIR: () => import("country-flag-icons/string/3x2/GB-NIR"),
|
|
86
|
+
GB_SCT: () => import("country-flag-icons/string/3x2/GB-SCT"),
|
|
87
|
+
GB_WLS: () => import("country-flag-icons/string/3x2/GB-WLS"),
|
|
88
|
+
GB: () => import("country-flag-icons/string/3x2/GB"),
|
|
89
|
+
GD: () => import("country-flag-icons/string/3x2/GD"),
|
|
90
|
+
GE: () => import("country-flag-icons/string/3x2/GE"),
|
|
91
|
+
GF: () => import("country-flag-icons/string/3x2/GF"),
|
|
92
|
+
GG: () => import("country-flag-icons/string/3x2/GG"),
|
|
93
|
+
GH: () => import("country-flag-icons/string/3x2/GH"),
|
|
94
|
+
GI: () => import("country-flag-icons/string/3x2/GI"),
|
|
95
|
+
GL: () => import("country-flag-icons/string/3x2/GL"),
|
|
96
|
+
GM: () => import("country-flag-icons/string/3x2/GM"),
|
|
97
|
+
GN: () => import("country-flag-icons/string/3x2/GN"),
|
|
98
|
+
GP: () => import("country-flag-icons/string/3x2/GP"),
|
|
99
|
+
GQ: () => import("country-flag-icons/string/3x2/GQ"),
|
|
100
|
+
GR: () => import("country-flag-icons/string/3x2/GR"),
|
|
101
|
+
GS: () => import("country-flag-icons/string/3x2/GS"),
|
|
102
|
+
GT: () => import("country-flag-icons/string/3x2/GT"),
|
|
103
|
+
GU: () => import("country-flag-icons/string/3x2/GU"),
|
|
104
|
+
GW: () => import("country-flag-icons/string/3x2/GW"),
|
|
105
|
+
GY: () => import("country-flag-icons/string/3x2/GY"),
|
|
106
|
+
HK: () => import("country-flag-icons/string/3x2/HK"),
|
|
107
|
+
HM: () => import("country-flag-icons/string/3x2/HM"),
|
|
108
|
+
HN: () => import("country-flag-icons/string/3x2/HN"),
|
|
109
|
+
HR: () => import("country-flag-icons/string/3x2/HR"),
|
|
110
|
+
HT: () => import("country-flag-icons/string/3x2/HT"),
|
|
111
|
+
HU: () => import("country-flag-icons/string/3x2/HU"),
|
|
112
|
+
IC: () => import("country-flag-icons/string/3x2/IC"),
|
|
113
|
+
ID: () => import("country-flag-icons/string/3x2/ID"),
|
|
114
|
+
IE: () => import("country-flag-icons/string/3x2/IE"),
|
|
115
|
+
IL: () => import("country-flag-icons/string/3x2/IL"),
|
|
116
|
+
IM: () => import("country-flag-icons/string/3x2/IM"),
|
|
117
|
+
IN: () => import("country-flag-icons/string/3x2/IN"),
|
|
118
|
+
IO: () => import("country-flag-icons/string/3x2/IO"),
|
|
119
|
+
IQ: () => import("country-flag-icons/string/3x2/IQ"),
|
|
120
|
+
IR: () => import("country-flag-icons/string/3x2/IR"),
|
|
121
|
+
IS: () => import("country-flag-icons/string/3x2/IS"),
|
|
122
|
+
IT: () => import("country-flag-icons/string/3x2/IT"),
|
|
123
|
+
JE: () => import("country-flag-icons/string/3x2/JE"),
|
|
124
|
+
JM: () => import("country-flag-icons/string/3x2/JM"),
|
|
125
|
+
JO: () => import("country-flag-icons/string/3x2/JO"),
|
|
126
|
+
JP: () => import("country-flag-icons/string/3x2/JP"),
|
|
127
|
+
KE: () => import("country-flag-icons/string/3x2/KE"),
|
|
128
|
+
KG: () => import("country-flag-icons/string/3x2/KG"),
|
|
129
|
+
KH: () => import("country-flag-icons/string/3x2/KH"),
|
|
130
|
+
KI: () => import("country-flag-icons/string/3x2/KI"),
|
|
131
|
+
KM: () => import("country-flag-icons/string/3x2/KM"),
|
|
132
|
+
KN: () => import("country-flag-icons/string/3x2/KN"),
|
|
133
|
+
KP: () => import("country-flag-icons/string/3x2/KP"),
|
|
134
|
+
KR: () => import("country-flag-icons/string/3x2/KR"),
|
|
135
|
+
KW: () => import("country-flag-icons/string/3x2/KW"),
|
|
136
|
+
KY: () => import("country-flag-icons/string/3x2/KY"),
|
|
137
|
+
KZ: () => import("country-flag-icons/string/3x2/KZ"),
|
|
138
|
+
LA: () => import("country-flag-icons/string/3x2/LA"),
|
|
139
|
+
LB: () => import("country-flag-icons/string/3x2/LB"),
|
|
140
|
+
LC: () => import("country-flag-icons/string/3x2/LC"),
|
|
141
|
+
LI: () => import("country-flag-icons/string/3x2/LI"),
|
|
142
|
+
LK: () => import("country-flag-icons/string/3x2/LK"),
|
|
143
|
+
LR: () => import("country-flag-icons/string/3x2/LR"),
|
|
144
|
+
LS: () => import("country-flag-icons/string/3x2/LS"),
|
|
145
|
+
LT: () => import("country-flag-icons/string/3x2/LT"),
|
|
146
|
+
LU: () => import("country-flag-icons/string/3x2/LU"),
|
|
147
|
+
LV: () => import("country-flag-icons/string/3x2/LV"),
|
|
148
|
+
LY: () => import("country-flag-icons/string/3x2/LY"),
|
|
149
|
+
MA: () => import("country-flag-icons/string/3x2/MA"),
|
|
150
|
+
MC: () => import("country-flag-icons/string/3x2/MC"),
|
|
151
|
+
MD: () => import("country-flag-icons/string/3x2/MD"),
|
|
152
|
+
ME: () => import("country-flag-icons/string/3x2/ME"),
|
|
153
|
+
MF: () => import("country-flag-icons/string/3x2/MF"),
|
|
154
|
+
MG: () => import("country-flag-icons/string/3x2/MG"),
|
|
155
|
+
MH: () => import("country-flag-icons/string/3x2/MH"),
|
|
156
|
+
MK: () => import("country-flag-icons/string/3x2/MK"),
|
|
157
|
+
ML: () => import("country-flag-icons/string/3x2/ML"),
|
|
158
|
+
MM: () => import("country-flag-icons/string/3x2/MM"),
|
|
159
|
+
MN: () => import("country-flag-icons/string/3x2/MN"),
|
|
160
|
+
MO: () => import("country-flag-icons/string/3x2/MO"),
|
|
161
|
+
MP: () => import("country-flag-icons/string/3x2/MP"),
|
|
162
|
+
MQ: () => import("country-flag-icons/string/3x2/MQ"),
|
|
163
|
+
MR: () => import("country-flag-icons/string/3x2/MR"),
|
|
164
|
+
MS: () => import("country-flag-icons/string/3x2/MS"),
|
|
165
|
+
MT: () => import("country-flag-icons/string/3x2/MT"),
|
|
166
|
+
MU: () => import("country-flag-icons/string/3x2/MU"),
|
|
167
|
+
MV: () => import("country-flag-icons/string/3x2/MV"),
|
|
168
|
+
MW: () => import("country-flag-icons/string/3x2/MW"),
|
|
169
|
+
MX: () => import("country-flag-icons/string/3x2/MX"),
|
|
170
|
+
MY: () => import("country-flag-icons/string/3x2/MY"),
|
|
171
|
+
MZ: () => import("country-flag-icons/string/3x2/MZ"),
|
|
172
|
+
NA: () => import("country-flag-icons/string/3x2/NA"),
|
|
173
|
+
NC: () => import("country-flag-icons/string/3x2/NC"),
|
|
174
|
+
NE: () => import("country-flag-icons/string/3x2/NE"),
|
|
175
|
+
NF: () => import("country-flag-icons/string/3x2/NF"),
|
|
176
|
+
NG: () => import("country-flag-icons/string/3x2/NG"),
|
|
177
|
+
NI: () => import("country-flag-icons/string/3x2/NI"),
|
|
178
|
+
NL: () => import("country-flag-icons/string/3x2/NL"),
|
|
179
|
+
NO: () => import("country-flag-icons/string/3x2/NO"),
|
|
180
|
+
NP: () => import("country-flag-icons/string/3x2/NP"),
|
|
181
|
+
NR: () => import("country-flag-icons/string/3x2/NR"),
|
|
182
|
+
NU: () => import("country-flag-icons/string/3x2/NU"),
|
|
183
|
+
NZ: () => import("country-flag-icons/string/3x2/NZ"),
|
|
184
|
+
OM: () => import("country-flag-icons/string/3x2/OM"),
|
|
185
|
+
PA: () => import("country-flag-icons/string/3x2/PA"),
|
|
186
|
+
PE: () => import("country-flag-icons/string/3x2/PE"),
|
|
187
|
+
PF: () => import("country-flag-icons/string/3x2/PF"),
|
|
188
|
+
PG: () => import("country-flag-icons/string/3x2/PG"),
|
|
189
|
+
PH: () => import("country-flag-icons/string/3x2/PH"),
|
|
190
|
+
PK: () => import("country-flag-icons/string/3x2/PK"),
|
|
191
|
+
PL: () => import("country-flag-icons/string/3x2/PL"),
|
|
192
|
+
PM: () => import("country-flag-icons/string/3x2/PM"),
|
|
193
|
+
PN: () => import("country-flag-icons/string/3x2/PN"),
|
|
194
|
+
PR: () => import("country-flag-icons/string/3x2/PR"),
|
|
195
|
+
PS: () => import("country-flag-icons/string/3x2/PS"),
|
|
196
|
+
PT: () => import("country-flag-icons/string/3x2/PT"),
|
|
197
|
+
PW: () => import("country-flag-icons/string/3x2/PW"),
|
|
198
|
+
PY: () => import("country-flag-icons/string/3x2/PY"),
|
|
199
|
+
QA: () => import("country-flag-icons/string/3x2/QA"),
|
|
200
|
+
RE: () => import("country-flag-icons/string/3x2/RE"),
|
|
201
|
+
RO: () => import("country-flag-icons/string/3x2/RO"),
|
|
202
|
+
RS: () => import("country-flag-icons/string/3x2/RS"),
|
|
203
|
+
RU: () => import("country-flag-icons/string/3x2/RU"),
|
|
204
|
+
RW: () => import("country-flag-icons/string/3x2/RW"),
|
|
205
|
+
SA: () => import("country-flag-icons/string/3x2/SA"),
|
|
206
|
+
SB: () => import("country-flag-icons/string/3x2/SB"),
|
|
207
|
+
SC: () => import("country-flag-icons/string/3x2/SC"),
|
|
208
|
+
SD: () => import("country-flag-icons/string/3x2/SD"),
|
|
209
|
+
SE: () => import("country-flag-icons/string/3x2/SE"),
|
|
210
|
+
SG: () => import("country-flag-icons/string/3x2/SG"),
|
|
211
|
+
SH: () => import("country-flag-icons/string/3x2/SH"),
|
|
212
|
+
SI: () => import("country-flag-icons/string/3x2/SI"),
|
|
213
|
+
SJ: () => import("country-flag-icons/string/3x2/SJ"),
|
|
214
|
+
SK: () => import("country-flag-icons/string/3x2/SK"),
|
|
215
|
+
SL: () => import("country-flag-icons/string/3x2/SL"),
|
|
216
|
+
SM: () => import("country-flag-icons/string/3x2/SM"),
|
|
217
|
+
SN: () => import("country-flag-icons/string/3x2/SN"),
|
|
218
|
+
SO: () => import("country-flag-icons/string/3x2/SO"),
|
|
219
|
+
SR: () => import("country-flag-icons/string/3x2/SR"),
|
|
220
|
+
SS: () => import("country-flag-icons/string/3x2/SS"),
|
|
221
|
+
ST: () => import("country-flag-icons/string/3x2/ST"),
|
|
222
|
+
SV: () => import("country-flag-icons/string/3x2/SV"),
|
|
223
|
+
SX: () => import("country-flag-icons/string/3x2/SX"),
|
|
224
|
+
SY: () => import("country-flag-icons/string/3x2/SY"),
|
|
225
|
+
SZ: () => import("country-flag-icons/string/3x2/SZ"),
|
|
226
|
+
TA: () => import("country-flag-icons/string/3x2/TA"),
|
|
227
|
+
TC: () => import("country-flag-icons/string/3x2/TC"),
|
|
228
|
+
TD: () => import("country-flag-icons/string/3x2/TD"),
|
|
229
|
+
TF: () => import("country-flag-icons/string/3x2/TF"),
|
|
230
|
+
TG: () => import("country-flag-icons/string/3x2/TG"),
|
|
231
|
+
TH: () => import("country-flag-icons/string/3x2/TH"),
|
|
232
|
+
TJ: () => import("country-flag-icons/string/3x2/TJ"),
|
|
233
|
+
TK: () => import("country-flag-icons/string/3x2/TK"),
|
|
234
|
+
TL: () => import("country-flag-icons/string/3x2/TL"),
|
|
235
|
+
TM: () => import("country-flag-icons/string/3x2/TM"),
|
|
236
|
+
TN: () => import("country-flag-icons/string/3x2/TN"),
|
|
237
|
+
TO: () => import("country-flag-icons/string/3x2/TO"),
|
|
238
|
+
TR: () => import("country-flag-icons/string/3x2/TR"),
|
|
239
|
+
TT: () => import("country-flag-icons/string/3x2/TT"),
|
|
240
|
+
TV: () => import("country-flag-icons/string/3x2/TV"),
|
|
241
|
+
TW: () => import("country-flag-icons/string/3x2/TW"),
|
|
242
|
+
TZ: () => import("country-flag-icons/string/3x2/TZ"),
|
|
243
|
+
UA: () => import("country-flag-icons/string/3x2/UA"),
|
|
244
|
+
UG: () => import("country-flag-icons/string/3x2/UG"),
|
|
245
|
+
UM: () => import("country-flag-icons/string/3x2/UM"),
|
|
246
|
+
US: () => import("country-flag-icons/string/3x2/US"),
|
|
247
|
+
UY: () => import("country-flag-icons/string/3x2/UY"),
|
|
248
|
+
UZ: () => import("country-flag-icons/string/3x2/UZ"),
|
|
249
|
+
VA: () => import("country-flag-icons/string/3x2/VA"),
|
|
250
|
+
VC: () => import("country-flag-icons/string/3x2/VC"),
|
|
251
|
+
VE: () => import("country-flag-icons/string/3x2/VE"),
|
|
252
|
+
VG: () => import("country-flag-icons/string/3x2/VG"),
|
|
253
|
+
VI: () => import("country-flag-icons/string/3x2/VI"),
|
|
254
|
+
VN: () => import("country-flag-icons/string/3x2/VN"),
|
|
255
|
+
VU: () => import("country-flag-icons/string/3x2/VU"),
|
|
256
|
+
WF: () => import("country-flag-icons/string/3x2/WF"),
|
|
257
|
+
WS: () => import("country-flag-icons/string/3x2/WS"),
|
|
258
|
+
XA: () => import("country-flag-icons/string/3x2/XA"),
|
|
259
|
+
XC: () => import("country-flag-icons/string/3x2/XC"),
|
|
260
|
+
XK: () => import("country-flag-icons/string/3x2/XK"),
|
|
261
|
+
XO: () => import("country-flag-icons/string/3x2/XO"),
|
|
262
|
+
YE: () => import("country-flag-icons/string/3x2/YE"),
|
|
263
|
+
YT: () => import("country-flag-icons/string/3x2/YT"),
|
|
264
|
+
ZA: () => import("country-flag-icons/string/3x2/ZA"),
|
|
265
|
+
ZM: () => import("country-flag-icons/string/3x2/ZM"),
|
|
266
|
+
ZW: () => import("country-flag-icons/string/3x2/ZW")
|
|
267
|
+
};
|
|
268
|
+
export {
|
|
269
|
+
flagLoaders
|
|
270
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const toFlagKey: (code: string) => string;
|
|
2
|
+
export declare const subscribeToFlags: (listener: () => void) => () => void;
|
|
3
|
+
export declare const getFlagSrc: (key: string) => string;
|
|
4
|
+
export declare const loadFlag: (key: string) => void;
|
|
5
|
+
/** Starts loading flags before they render, e.g. for the options of a country list. */
|
|
6
|
+
export declare const preloadFlags: (codes: readonly string[]) => void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { flagLoaders } from "./flagLoaders.js";
|
|
2
|
+
const loaded = /* @__PURE__ */ new Map();
|
|
3
|
+
const pending = /* @__PURE__ */ new Set();
|
|
4
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
5
|
+
const toFlagKey = (code) => code.toUpperCase().replace("-", "_");
|
|
6
|
+
const subscribeToFlags = (listener) => {
|
|
7
|
+
listeners.add(listener);
|
|
8
|
+
return () => {
|
|
9
|
+
listeners.delete(listener);
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
const getFlagSrc = (key) => loaded.get(key);
|
|
13
|
+
const loadFlag = (key) => {
|
|
14
|
+
const loader = flagLoaders[key];
|
|
15
|
+
if (!loader || loaded.has(key) || pending.has(key)) return;
|
|
16
|
+
pending.add(key);
|
|
17
|
+
loader().then(({ default: svg }) => {
|
|
18
|
+
loaded.set(key, `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`);
|
|
19
|
+
listeners.forEach((listener) => listener());
|
|
20
|
+
}).catch(() => void 0).finally(() => pending.delete(key));
|
|
21
|
+
};
|
|
22
|
+
const preloadFlags = (codes) => codes.forEach((code) => loadFlag(toFlagKey(code)));
|
|
23
|
+
export {
|
|
24
|
+
getFlagSrc,
|
|
25
|
+
loadFlag,
|
|
26
|
+
preloadFlags,
|
|
27
|
+
subscribeToFlags,
|
|
28
|
+
toFlagKey
|
|
29
|
+
};
|