@stokr/components-library 4.2.3 → 4.2.5

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.
Files changed (59) hide show
  1. package/dist/components/AddressItem/AddressItem.d.ts +38 -0
  2. package/dist/components/AddressItem/AddressItem.js +51 -0
  3. package/dist/components/AddressItem/AddressItem.styles.d.ts +31 -0
  4. package/dist/components/AddressItem/AddressItem.styles.js +73 -0
  5. package/dist/components/Checkbox/Checkbox.styles.d.ts +1 -0
  6. package/dist/components/Collapsible/Collapsible.d.ts +10 -4
  7. package/dist/components/Collapsible/Collapsible.js +6 -14
  8. package/dist/components/Collapsible/Collapsible.styles.d.ts +3 -1
  9. package/dist/components/Collapsible/Collapsible.styles.js +23 -9
  10. package/dist/components/Country/CountrySelect.js +9 -14
  11. package/dist/components/Country/FlagFor.d.ts +9 -0
  12. package/dist/components/Country/FlagFor.js +25 -0
  13. package/dist/components/Country/flagLoaders.d.ts +5 -0
  14. package/dist/components/Country/flagLoaders.js +270 -0
  15. package/dist/components/Country/flagStore.d.ts +6 -0
  16. package/dist/components/Country/flagStore.js +29 -0
  17. package/dist/components/FAQ/FAQ.d.ts +29 -0
  18. package/dist/components/FAQ/FAQ.js +18 -18
  19. package/dist/components/FAQ/FAQ.styles.d.ts +38 -0
  20. package/dist/components/FAQ/FAQ.styles.js +58 -1
  21. package/dist/components/IdentityInfo/IdentityInfo.js +2 -1
  22. package/dist/components/IdentityInfo/IdentityInfo.styles.js +3 -1
  23. package/dist/components/InfoBox/InfoBox.js +44 -20
  24. package/dist/components/Input/Input.d.ts +3 -0
  25. package/dist/components/Input/Input.js +5 -2
  26. package/dist/components/Input/Input.styles.d.ts +4 -0
  27. package/dist/components/Input/Input.styles.js +57 -0
  28. package/dist/components/Input/Select.d.ts +57 -0
  29. package/dist/components/Input/Select.js +77 -98
  30. package/dist/components/Input/Select.styles.d.ts +89 -0
  31. package/dist/components/Input/Select.styles.js +104 -2
  32. package/dist/components/MaterialIcon/requiredIcons.d.ts +1 -1
  33. package/dist/components/MaterialIcon/requiredIcons.js +2 -0
  34. package/dist/components/PanelCard/PanelCard.d.ts +51 -0
  35. package/dist/components/PanelCard/PanelCard.js +35 -0
  36. package/dist/components/PanelCard/PanelCard.styles.d.ts +29 -0
  37. package/dist/components/PanelCard/PanelCard.styles.js +87 -0
  38. package/dist/components/StepSidebar/MobileStepProgress.d.ts +12 -0
  39. package/dist/components/StepSidebar/MobileStepProgress.js +14 -0
  40. package/dist/components/StepSidebar/MobileStepProgress.styles.d.ts +15 -0
  41. package/dist/components/StepSidebar/MobileStepProgress.styles.js +42 -0
  42. package/dist/components/StepSidebar/StepProgress.d.ts +14 -0
  43. package/dist/components/StepSidebar/StepProgress.js +14 -0
  44. package/dist/components/StepSidebar/StepProgress.styles.d.ts +30 -0
  45. package/dist/components/StepSidebar/StepProgress.styles.js +103 -0
  46. package/dist/components/StepSidebar/StepSidebar.d.ts +36 -0
  47. package/dist/components/StepSidebar/StepSidebar.js +58 -0
  48. package/dist/components/StepSidebar/StepSidebar.styles.d.ts +54 -0
  49. package/dist/components/StepSidebar/StepSidebar.styles.js +175 -0
  50. package/dist/components/TaxResidenceCard/TaxResidenceCard.js +27 -11
  51. package/dist/components/TaxResidenceCard/TaxResidenceCard.styles.js +88 -7
  52. package/dist/index.d.ts +64 -7
  53. package/dist/index.js +17 -3
  54. package/dist/styles/borderedField.d.ts +11 -0
  55. package/dist/styles/borderedField.js +56 -0
  56. package/package.json +1 -1
  57. package/dist/static/images/globe.svg.js +0 -5
  58. package/dist/static/images/trash.svg +0 -17
  59. package/dist/static/images/trash.svg.js +0 -5
@@ -0,0 +1,38 @@
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
+ export interface AddressItemProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onCopy'> {
3
+ address: string;
4
+ label?: ReactNode;
5
+ /** Slot in a round grey chip before the text, e.g. a chain logo. */
6
+ leading?: ReactNode;
7
+ /** `true` keeps 6 characters at the start and 4 at the end; pass `{ head, tail }` to change that; `false` shows it all. */
8
+ shorten?: boolean | {
9
+ head: number;
10
+ tail: number;
11
+ };
12
+ /** Copy button after the address. The default icon needs `outlined/content_copy` registered. */
13
+ copyable?: boolean;
14
+ /** Replaces the copy button's icon. */
15
+ copyIcon?: ReactNode;
16
+ /** Replaces the shown text (the copy button and `title` still use `address`), e.g. a formatted or masked address. */
17
+ displayAddress?: ReactNode;
18
+ /** Called with the address after it was copied. */
19
+ onCopy?: (address: string) => void;
20
+ /** Tooltip text before and after copying. Default: the copy tooltip's own texts. */
21
+ copyLabel?: string;
22
+ copiedLabel?: string;
23
+ /** Inline after the address, e.g. a status tag. */
24
+ badge?: ReactNode;
25
+ /** Right-aligned slot, e.g. an action button. */
26
+ trailing?: ReactNode;
27
+ }
28
+ /**
29
+ * A wallet address or hash with an optional label, leading icon, copy button, badge and trailing action. The full
30
+ * address is in the `title` attribute. It has no padding of its own. Extra props and the ref go to the root element.
31
+ *
32
+ * Every part has a `data-part` attribute (`leading`, `label`, `address`, `copy`, `badge`, `trailing`) so an app can
33
+ * restyle it from `styled(AddressItem)` without a new library version.
34
+ *
35
+ * CSS custom properties: `--address-item-gap` (`12px`), `--address-item-address-gap` (`8px`, between address, copy and
36
+ * badge), `--address-item-leading-size` (`24px`), `--address-item-leading-padding` (`4px`), `--address-item-leading-background` (`#f0f0f0`).
37
+ */
38
+ export declare const AddressItem: import('react').ForwardRefExoticComponent<AddressItemProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,51 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { MaterialIcon } from "../MaterialIcon/MaterialIcon.js";
4
+ import { CopyToClipboardTooltip } from "../CopyToClipboardTooltip/CopyToClipboardTooltip.js";
5
+ import shortenAddress from "../../utils/get-short-address.js";
6
+ import { Root, Main, Leading, Body, Label, AddressRow, AddressGroup, Address, Trailing } from "./AddressItem.styles.js";
7
+ const AddressItem = forwardRef(function AddressItemBase({
8
+ address,
9
+ label,
10
+ leading,
11
+ shorten = true,
12
+ copyable = false,
13
+ copyIcon,
14
+ displayAddress,
15
+ onCopy,
16
+ copyLabel,
17
+ copiedLabel,
18
+ badge,
19
+ trailing,
20
+ ...rest
21
+ }, ref) {
22
+ const shown = shorten ? shortenAddress(address, { separator: "...", ...shorten === true ? {} : shorten }) : address;
23
+ return /* @__PURE__ */ jsxs(Root, { ...rest, ref, children: [
24
+ /* @__PURE__ */ jsxs(Main, { children: [
25
+ leading != null && /* @__PURE__ */ jsx(Leading, { "data-part": "leading", children: leading }),
26
+ /* @__PURE__ */ jsxs(Body, { children: [
27
+ label != null && /* @__PURE__ */ jsx(Label, { "data-part": "label", children: label }),
28
+ /* @__PURE__ */ jsxs(AddressRow, { children: [
29
+ /* @__PURE__ */ jsxs(AddressGroup, { children: [
30
+ /* @__PURE__ */ jsx(Address, { "data-part": "address", title: address, $full: !shorten, children: displayAddress ?? shown }),
31
+ copyable && /* @__PURE__ */ jsx("span", { "data-part": "copy", children: /* @__PURE__ */ jsx(
32
+ CopyToClipboardTooltip,
33
+ {
34
+ value: address,
35
+ onCopy,
36
+ idleLabel: copyLabel,
37
+ copiedLabel,
38
+ children: copyIcon ?? /* @__PURE__ */ jsx(MaterialIcon, { name: "content_copy", size: 16 })
39
+ }
40
+ ) })
41
+ ] }),
42
+ badge != null && /* @__PURE__ */ jsx("span", { "data-part": "badge", children: badge })
43
+ ] })
44
+ ] })
45
+ ] }),
46
+ trailing != null && /* @__PURE__ */ jsx(Trailing, { "data-part": "trailing", children: trailing })
47
+ ] });
48
+ });
49
+ export {
50
+ AddressItem
51
+ };
@@ -0,0 +1,31 @@
1
+ export declare const Root: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
2
+ style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
3
+ }> & string;
4
+ export declare const Leading: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "style"> & {
5
+ style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
6
+ }> & string;
7
+ /** Leading + text. Never narrower than the shortened address and its copy button: the trailing slot wraps below instead. */
8
+ export declare const Main: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
9
+ style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
10
+ }> & string;
11
+ export declare const Body: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
12
+ style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
13
+ }> & string;
14
+ export declare const Label: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "style"> & {
15
+ style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
16
+ }> & string;
17
+ export declare const AddressRow: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "style"> & {
18
+ style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
19
+ }> & string;
20
+ export declare const AddressGroup: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "style"> & {
21
+ style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
22
+ }> & string;
23
+ /** A shortened address never shrinks; a full one wraps anywhere instead of being cut. */
24
+ export declare const Address: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Merged<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "style"> & {
25
+ style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
26
+ }, {
27
+ $full: boolean;
28
+ }>> & string;
29
+ export declare const Trailing: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
30
+ style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
31
+ }> & string;
@@ -0,0 +1,73 @@
1
+ import styled from "styled-components";
2
+ import { colors } from "../../styles/colors.js";
3
+ import { space, radius } from "../../styles/spacing.js";
4
+ import { typography } from "../../styles/typography.js";
5
+ const Root = styled.div`
6
+ display: flex;
7
+ flex-wrap: wrap;
8
+ align-items: center;
9
+ gap: var(--address-item-gap, ${space[3]});
10
+ min-width: 0;
11
+ `;
12
+ const Leading = styled.span`
13
+ display: inline-flex;
14
+ flex: 0 0 auto;
15
+ align-items: center;
16
+ justify-content: center;
17
+ box-sizing: content-box;
18
+ width: var(--address-item-leading-size, 24px);
19
+ height: var(--address-item-leading-size, 24px);
20
+ padding: var(--address-item-leading-padding, ${space[1]});
21
+ border-radius: ${radius.full};
22
+ background: var(--address-item-leading-background, ${colors.grey});
23
+ overflow: hidden;
24
+ `;
25
+ const Main = styled.div`
26
+ display: flex;
27
+ flex: 1 1 auto;
28
+ align-items: center;
29
+ gap: var(--address-item-gap, ${space[3]});
30
+ `;
31
+ const Body = styled.div`
32
+ display: flex;
33
+ flex-direction: column;
34
+ `;
35
+ const Label = styled.span`
36
+ ${typography.formInput};
37
+ color: ${colors.black};
38
+ `;
39
+ const AddressRow = styled.span`
40
+ display: flex;
41
+ flex-wrap: wrap;
42
+ align-items: center;
43
+ gap: ${space[1]} var(--address-item-address-gap, ${space[2]});
44
+ min-width: 0;
45
+ `;
46
+ const AddressGroup = styled.span`
47
+ display: inline-flex;
48
+ align-items: center;
49
+ gap: var(--address-item-address-gap, ${space[2]});
50
+ min-width: 0;
51
+ `;
52
+ const Address = styled.span`
53
+ ${typography.bodyLgCallout};
54
+ color: ${colors.black};
55
+ ${({ $full }) => $full ? "min-width: 0; overflow-wrap: anywhere;" : "flex-shrink: 0; white-space: nowrap;"}
56
+ `;
57
+ const Trailing = styled.div`
58
+ display: flex;
59
+ align-items: center;
60
+ flex: 0 0 auto;
61
+ margin-left: auto;
62
+ `;
63
+ export {
64
+ Address,
65
+ AddressGroup,
66
+ AddressRow,
67
+ Body,
68
+ Label,
69
+ Leading,
70
+ Main,
71
+ Root,
72
+ Trailing
73
+ };
@@ -10,6 +10,7 @@ export declare const Label: import('styled-components/dist/types').IStyledCompon
10
10
  isUp?: boolean;
11
11
  active?: boolean;
12
12
  error?: boolean;
13
+ $variant?: import('../..').FieldVariant;
13
14
  }>, "as" | "forwardedAs"> & {
14
15
  as?: import('styled-components').WebTarget;
15
16
  forwardedAs?: import('styled-components').WebTarget;
@@ -1,5 +1,5 @@
1
- import { ReactNode } from 'react';
2
- export interface CollapsibleProps {
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
+ export interface CollapsibleProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'children' | 'onToggle'> {
3
3
  title: ReactNode;
4
4
  children: ReactNode;
5
5
  /** Controlled open state. Omit to let the component manage it. */
@@ -11,8 +11,14 @@ export interface CollapsibleProps {
11
11
  divided?: boolean;
12
12
  /** Test-automation hook on the title button. */
13
13
  dataCy?: string;
14
+ /** `card` (default) has a border, background, radius and shadow; `flush` has none, to sit inside another surface. */
15
+ variant?: 'card' | 'flush';
14
16
  }
15
17
  /**
16
- * One collapsible card: title row with a chevron, body that animates open.
18
+ * One collapsible card: title row with a chevron, body that animates open. Extra props go to the root element.
19
+ *
20
+ * CSS custom properties (set on the root or any ancestor):
21
+ * - `--collapsible-header-padding` (default `20px`)
22
+ * - `--collapsible-body-padding` (default `0 20px 20px`, `24px 20px 20px` when `divided`)
17
23
  */
18
- export declare const Collapsible: ({ title, children, open, defaultOpen, onToggle, id, divided, dataCy, }: CollapsibleProps) => import("react/jsx-runtime").JSX.Element;
24
+ export declare const Collapsible: import('react').ForwardRefExoticComponent<CollapsibleProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -1,18 +1,9 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
- import { useState, useId } from "react";
2
+ import { forwardRef, useState, useId } from "react";
3
3
  import { ArrowSimple } from "../icons/ArrowSimple.js";
4
4
  import { inertProp } from "../../utils/inertProp.js";
5
5
  import { Root, Header, Chevron, Body, BodyClip, BodyInner } from "./Collapsible.styles.js";
6
- const Collapsible = ({
7
- title,
8
- children,
9
- open,
10
- defaultOpen = false,
11
- onToggle,
12
- id,
13
- divided = false,
14
- dataCy
15
- }) => {
6
+ const Collapsible = forwardRef(function CollapsibleBase({ title, children, open, defaultOpen = false, onToggle, id, divided = false, dataCy, variant = "card", ...rest }, ref) {
16
7
  const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
17
8
  const isOpen = open ?? uncontrolledOpen;
18
9
  const bodyId = useId();
@@ -20,7 +11,7 @@ const Collapsible = ({
20
11
  if (open === void 0) setUncontrolledOpen(!isOpen);
21
12
  onToggle?.(!isOpen);
22
13
  };
23
- return /* @__PURE__ */ jsxs(Root, { id, $open: isOpen, children: [
14
+ return /* @__PURE__ */ jsxs(Root, { ...rest, ref, id, $open: isOpen, $flush: variant === "flush", children: [
24
15
  /* @__PURE__ */ jsxs(
25
16
  Header,
26
17
  {
@@ -29,7 +20,8 @@ const Collapsible = ({
29
20
  "aria-controls": bodyId,
30
21
  "data-cy": dataCy,
31
22
  onClick: toggle,
32
- $divided: divided && isOpen,
23
+ $divided: divided,
24
+ $open: isOpen,
33
25
  children: [
34
26
  title,
35
27
  /* @__PURE__ */ jsx(Chevron, { $open: isOpen, "aria-hidden": "true", children: /* @__PURE__ */ jsx(ArrowSimple, { width: 10, height: 6 }) })
@@ -38,7 +30,7 @@ const Collapsible = ({
38
30
  ),
39
31
  /* @__PURE__ */ jsx(Body, { id: bodyId, $open: isOpen, inert: inertProp(!isOpen), children: /* @__PURE__ */ jsx(BodyClip, { children: /* @__PURE__ */ jsx(BodyInner, { $divided: divided, children }) }) })
40
32
  ] });
41
- };
33
+ });
42
34
  export {
43
35
  Collapsible
44
36
  };
@@ -1,13 +1,15 @@
1
- /** Collapsed, it lifts under the pointer as a collapsed section does. */
1
+ /** Card: collapsed, it lifts under the pointer as a collapsed section does. Flush: no surface at all. */
2
2
  export declare const Root: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Merged<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
3
3
  style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
4
4
  }, {
5
5
  $open: boolean;
6
+ $flush: boolean;
6
7
  }>> & string;
7
8
  export declare const Header: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Merged<Omit<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
8
9
  style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
9
10
  }, {
10
11
  $divided: boolean;
12
+ $open: boolean;
11
13
  }>> & string;
12
14
  export declare const Chevron: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Merged<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "style"> & {
13
15
  style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
@@ -6,13 +6,15 @@ import { typography } from "../../styles/typography.js";
6
6
  const DURATION = "300ms";
7
7
  const EASING = "cubic-bezier(0.4, 0, 0.2, 1)";
8
8
  const Root = styled.div`
9
- background: ${colors.white};
10
- border: 1px solid ${colors.lightGrey};
11
- border-radius: ${radius.lg};
12
- box-shadow: ${elevation.xs};
9
+ ${({ $flush }) => !$flush && `
10
+ background: ${colors.white};
11
+ border: 1px solid ${colors.lightGrey};
12
+ border-radius: ${radius.lg};
13
+ box-shadow: ${elevation.xs};
14
+ `}
13
15
 
14
16
  /* Pointer devices only: on touch a tap leaves :hover stuck after closing it. */
15
- ${({ $open }) => !$open && `
17
+ ${({ $open, $flush }) => !$open && !$flush && `
16
18
  @media (hover: hover) {
17
19
  &:hover {
18
20
  box-shadow: ${elevation.sm};
@@ -29,15 +31,17 @@ const Header = styled.button`
29
31
  justify-content: space-between;
30
32
  gap: ${space[4]};
31
33
  width: 100%;
32
- padding: ${space[5]};
34
+ padding: var(--collapsible-header-padding, ${space[5]});
33
35
  border: none;
34
36
  background: none;
35
37
  color: ${colors.black};
36
38
  text-align: left;
37
39
  cursor: pointer;
38
40
 
39
- ${({ $divided }) => $divided && `
40
- padding-bottom: ${space[4]};
41
+ /* The rule and the tighter bottom padding follow the body's open animation instead of snapping. */
42
+ ${({ $divided, $open }) => $divided && `
43
+ padding-bottom: ${$open ? space[4] : space[5]};
44
+ transition: padding-bottom ${DURATION} ${EASING};
41
45
 
42
46
  &::after {
43
47
  content: '';
@@ -46,6 +50,16 @@ const Header = styled.button`
46
50
  bottom: 0;
47
51
  left: ${space[5]};
48
52
  border-bottom: 1px solid ${colors.lightGrey};
53
+ opacity: ${$open ? 1 : 0};
54
+ transition: opacity ${DURATION} ${EASING};
55
+ }
56
+
57
+ @media (prefers-reduced-motion: reduce) {
58
+ transition: none;
59
+
60
+ &::after {
61
+ transition: none;
62
+ }
49
63
  }
50
64
  `}
51
65
  `;
@@ -81,7 +95,7 @@ const BodyClip = styled.div`
81
95
  `;
82
96
  const BodyInner = styled.div`
83
97
  ${typography.bodyMdRegular};
84
- padding: ${({ $divided }) => $divided ? space[6] : "0"} ${space[5]} ${space[5]};
98
+ padding: var(--collapsible-body-padding, ${({ $divided }) => $divided ? space[6] : "0"} ${space[5]} ${space[5]});
85
99
  color: ${colors.grayBlue};
86
100
  `;
87
101
  export {
@@ -3,7 +3,7 @@ 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 * as Flags from "country-flag-icons/react/3x2";
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} {
@@ -46,21 +46,13 @@ const PillChipsWrapper = styled.div`
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
- return /* @__PURE__ */ jsx(PillChipsWrapper, { children: /* @__PURE__ */ jsx(
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,5 @@
1
+ type FlagModule = {
2
+ default: string;
3
+ };
4
+ export declare const flagLoaders: Record<string, () => Promise<FlagModule>>;
5
+ export {};