@stokr/components-library 4.2.4 → 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.
- 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 +73 -0
- 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 +23 -9
- package/dist/components/Country/CountrySelect.js +9 -14
- 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/IdentityInfo/IdentityInfo.js +2 -1
- package/dist/components/IdentityInfo/IdentityInfo.styles.js +3 -1
- package/dist/components/InfoBox/InfoBox.js +44 -20
- package/dist/components/Input/Select.js +7 -5
- package/dist/components/Input/Select.styles.d.ts +19 -9
- package/dist/components/Input/Select.styles.js +36 -1
- package/dist/components/MaterialIcon/requiredIcons.d.ts +1 -1
- package/dist/components/MaterialIcon/requiredIcons.js +2 -0
- 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 +87 -0
- package/dist/components/StepSidebar/MobileStepProgress.styles.js +3 -3
- package/dist/components/StepSidebar/StepSidebar.d.ts +3 -1
- package/dist/components/StepSidebar/StepSidebar.js +2 -0
- package/dist/components/StepSidebar/StepSidebar.styles.js +6 -2
- package/dist/components/TaxResidenceCard/TaxResidenceCard.js +27 -11
- package/dist/components/TaxResidenceCard/TaxResidenceCard.styles.js +88 -7
- package/dist/index.d.ts +43 -2
- package/dist/index.js +11 -3
- 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,6 +3,9 @@ import { TrackV } from "../ComponentScroll/ComponentScroll.styles.js";
|
|
|
3
3
|
import stdin_default from "../ComponentScroll/ComponentScroll.js";
|
|
4
4
|
import { glyph } from "../MaterialIcon/glyph.js";
|
|
5
5
|
import { borderedFieldBox, borderedFieldText, borderedFieldFocus, borderedFieldError, borderedFieldDisabled } from "../../styles/borderedField.js";
|
|
6
|
+
import { colors } from "../../styles/colors.js";
|
|
7
|
+
import { space } from "../../styles/spacing.js";
|
|
8
|
+
import { typography } from "../../styles/typography.js";
|
|
6
9
|
const SelectControl = css`
|
|
7
10
|
&&& {
|
|
8
11
|
z-index: 10 !important;
|
|
@@ -197,7 +200,7 @@ const OptionLabel = styled.span`
|
|
|
197
200
|
text-overflow: ellipsis;
|
|
198
201
|
`;
|
|
199
202
|
const SelectedChipsWrapper = styled.div`
|
|
200
|
-
margin-top: 18px;
|
|
203
|
+
margin-top: ${(props) => props.$variant === "bordered" ? space[4] : "18px"};
|
|
201
204
|
`;
|
|
202
205
|
const SelectedChipsTitle = styled.div`
|
|
203
206
|
font-size: 11px;
|
|
@@ -205,6 +208,13 @@ const SelectedChipsTitle = styled.div`
|
|
|
205
208
|
text-transform: uppercase;
|
|
206
209
|
color: #666;
|
|
207
210
|
margin-bottom: 8px;
|
|
211
|
+
|
|
212
|
+
${(props) => props.$variant === "bordered" && css`
|
|
213
|
+
margin-bottom: ${space[1]};
|
|
214
|
+
line-height: 16px;
|
|
215
|
+
letter-spacing: 2px;
|
|
216
|
+
color: ${colors.grayBlue};
|
|
217
|
+
`}
|
|
208
218
|
`;
|
|
209
219
|
const SelectedChipsList = styled.div`
|
|
210
220
|
display: flex;
|
|
@@ -222,6 +232,15 @@ const SelectedChip = styled.div`
|
|
|
222
232
|
font-size: 12px;
|
|
223
233
|
line-height: 16px;
|
|
224
234
|
color: #202020;
|
|
235
|
+
|
|
236
|
+
${(props) => props.$variant === "bordered" && css`
|
|
237
|
+
gap: 6px;
|
|
238
|
+
padding: ${space[1]} ${space[2]} ${space[1]} ${space[3]};
|
|
239
|
+
border-color: ${colors.lightGrey};
|
|
240
|
+
border-radius: 48px;
|
|
241
|
+
${typography.labelCta}
|
|
242
|
+
color: ${colors.black};
|
|
243
|
+
`}
|
|
225
244
|
`;
|
|
226
245
|
const SelectedChipLabel = styled.span`
|
|
227
246
|
white-space: nowrap;
|
|
@@ -244,6 +263,22 @@ const SelectedChipRemove = styled.button.attrs({ type: "button" })`
|
|
|
244
263
|
&:hover {
|
|
245
264
|
color: #202020;
|
|
246
265
|
}
|
|
266
|
+
|
|
267
|
+
${(props) => props.$variant === "bordered" && css`
|
|
268
|
+
width: 16px;
|
|
269
|
+
height: 16px;
|
|
270
|
+
margin: 0;
|
|
271
|
+
color: ${colors.black};
|
|
272
|
+
|
|
273
|
+
&:hover {
|
|
274
|
+
color: ${colors.black};
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
&:disabled {
|
|
278
|
+
cursor: not-allowed;
|
|
279
|
+
opacity: 0.4;
|
|
280
|
+
}
|
|
281
|
+
`}
|
|
247
282
|
`;
|
|
248
283
|
const SelectWrapper = styled.div.withConfig({
|
|
249
284
|
shouldForwardProp: (props) => !["minWidth", "noMargin"].includes(props)
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* The Material Symbols (`<variant>/<name>[-fill]`) the library's own components draw. The host registers them with
|
|
3
3
|
* `registerMaterialIcons`; a component whose icon is not registered renders it empty.
|
|
4
4
|
*/
|
|
5
|
-
export declare const requiredMaterialIcons: readonly ["outlined/add_circle", "outlined/cancel-fill", "outlined/check", "outlined/check@600", "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"];
|
|
5
|
+
export declare const requiredMaterialIcons: readonly ["outlined/add_circle", "outlined/cancel-fill", "outlined/check", "outlined/check@600", "outlined/check_circle-fill", "outlined/chevron_left", "outlined/chevron_right", "outlined/close", "outlined/content_copy", "outlined/delete", "outlined/edit", "outlined/info", "outlined/info-fill", "outlined/keyboard_arrow_down", "outlined/language", "outlined/search_activity", "outlined/visibility", "outlined/visibility_off", "outlined/warning"];
|
|
@@ -8,10 +8,12 @@ const requiredMaterialIcons = [
|
|
|
8
8
|
"outlined/chevron_right",
|
|
9
9
|
"outlined/close",
|
|
10
10
|
"outlined/content_copy",
|
|
11
|
+
"outlined/delete",
|
|
11
12
|
"outlined/edit",
|
|
12
13
|
"outlined/info",
|
|
13
14
|
"outlined/info-fill",
|
|
14
15
|
"outlined/keyboard_arrow_down",
|
|
16
|
+
"outlined/language",
|
|
15
17
|
"outlined/search_activity",
|
|
16
18
|
"outlined/visibility",
|
|
17
19
|
"outlined/visibility_off",
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ElementType, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface PanelCardProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/** Blue border and a raised shadow: the "added" state. */
|
|
4
|
+
highlighted?: boolean;
|
|
5
|
+
/** Element or component to render as. Default `div`. */
|
|
6
|
+
as?: ElementType;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A bordered card whose children (header, sections, footer) are separated by 1px dividers. Extra props and the ref go
|
|
10
|
+
* to the root element, so `styled(PanelCard)` works.
|
|
11
|
+
*
|
|
12
|
+
* CSS custom properties (set on the card or any ancestor):
|
|
13
|
+
* - `--panel-card-background` (`#fff`), `--panel-card-border-color` (`#e1e1e1`), `--panel-card-radius` (`8px`)
|
|
14
|
+
* - `--panel-card-highlight-color` (`#0050ca`), `--panel-card-highlight-shadow` (`elevation.md`)
|
|
15
|
+
* - `--panel-card-divider` (`1px solid #e1e1e1`)
|
|
16
|
+
*/
|
|
17
|
+
export declare const PanelCard: import('react').ForwardRefExoticComponent<PanelCardProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
18
|
+
export interface PanelCardHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
19
|
+
/** Slot before the text, e.g. an icon or logo. */
|
|
20
|
+
leading?: ReactNode;
|
|
21
|
+
title?: ReactNode;
|
|
22
|
+
subtitle?: ReactNode;
|
|
23
|
+
/** Slot after the text: below it on mobile, at the right edge from 992px. */
|
|
24
|
+
trailing?: ReactNode;
|
|
25
|
+
/** Element for the title. Default `div`; use `h2` etc. for a real heading. */
|
|
26
|
+
titleAs?: ElementType;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Card header: leading slot, title and subtitle, trailing slot. `children` render in place of the title block when no
|
|
30
|
+
* `title` or `subtitle` is given.
|
|
31
|
+
*
|
|
32
|
+
* CSS custom properties: `--panel-card-header-padding` (`16px`, `24px` from 992px), `--panel-card-header-gap`
|
|
33
|
+
* (`20px`, between text and trailing), `--panel-card-header-leading-gap` (`12px`).
|
|
34
|
+
*/
|
|
35
|
+
export declare const PanelCardHeader: import('react').ForwardRefExoticComponent<PanelCardHeaderProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
36
|
+
export type PanelCardSectionProps = HTMLAttributes<HTMLDivElement>;
|
|
37
|
+
/**
|
|
38
|
+
* Plain padded block, e.g. one row. Use one section per row: the card draws full-width dividers between its children.
|
|
39
|
+
*
|
|
40
|
+
* CSS custom properties: `--panel-card-section-padding` (`16px`, `16px 24px` from 992px),
|
|
41
|
+
* `--panel-card-section-background` (`#fff`).
|
|
42
|
+
*/
|
|
43
|
+
export declare const PanelCardSection: import('react').ForwardRefExoticComponent<PanelCardSectionProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
44
|
+
export type PanelCardFooterProps = HTMLAttributes<HTMLDivElement>;
|
|
45
|
+
/**
|
|
46
|
+
* Footer on a grey surface.
|
|
47
|
+
*
|
|
48
|
+
* CSS custom properties: `--panel-card-footer-padding` (`12px 16px`, `12px 24px` from 992px),
|
|
49
|
+
* `--panel-card-footer-background` (`#f8f8f8`).
|
|
50
|
+
*/
|
|
51
|
+
export declare const PanelCardFooter: import('react').ForwardRefExoticComponent<PanelCardFooterProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { Root, Footer, Header, HeaderMain, HeaderText, HeaderTitle, HeaderSubtitle, HeaderTrailing, Section } from "./PanelCard.styles.js";
|
|
4
|
+
const PanelCard = forwardRef(function PanelCardBase({ highlighted = false, as, ...rest }, ref) {
|
|
5
|
+
return /* @__PURE__ */ jsx(Root, { ...rest, ref, as, $highlighted: highlighted });
|
|
6
|
+
});
|
|
7
|
+
const PanelCardHeader = forwardRef(function PanelCardHeaderBase({ leading, title, subtitle, trailing, titleAs, children, ...rest }, ref) {
|
|
8
|
+
const hasText = title != null || subtitle != null;
|
|
9
|
+
return /* @__PURE__ */ jsxs(Header, { ...rest, ref, children: [
|
|
10
|
+
/* @__PURE__ */ jsxs(HeaderMain, { children: [
|
|
11
|
+
leading,
|
|
12
|
+
hasText ? /* @__PURE__ */ jsxs(HeaderText, { children: [
|
|
13
|
+
title != null && /* @__PURE__ */ jsx(HeaderTitle, { as: titleAs, children: title }),
|
|
14
|
+
subtitle != null && /* @__PURE__ */ jsx(HeaderSubtitle, { children: subtitle })
|
|
15
|
+
] }) : children
|
|
16
|
+
] }),
|
|
17
|
+
trailing != null && /* @__PURE__ */ jsx(HeaderTrailing, { children: trailing })
|
|
18
|
+
] });
|
|
19
|
+
});
|
|
20
|
+
const PanelCardSection = forwardRef(
|
|
21
|
+
function PanelCardSectionBase(props, ref) {
|
|
22
|
+
return /* @__PURE__ */ jsx(Section, { ...props, ref });
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
const PanelCardFooter = forwardRef(
|
|
26
|
+
function PanelCardFooterBase(props, ref) {
|
|
27
|
+
return /* @__PURE__ */ jsx(Footer, { ...props, ref });
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
export {
|
|
31
|
+
PanelCard,
|
|
32
|
+
PanelCardFooter,
|
|
33
|
+
PanelCardHeader,
|
|
34
|
+
PanelCardSection
|
|
35
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
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"> & {
|
|
2
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
3
|
+
}, {
|
|
4
|
+
$highlighted: boolean;
|
|
5
|
+
}>> & string;
|
|
6
|
+
export declare const Header: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
7
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
8
|
+
}> & string;
|
|
9
|
+
export declare const HeaderMain: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
10
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
11
|
+
}> & string;
|
|
12
|
+
export declare const HeaderText: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
13
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
14
|
+
}> & string;
|
|
15
|
+
export declare const HeaderTitle: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
16
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
17
|
+
}> & string;
|
|
18
|
+
export declare const HeaderSubtitle: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
19
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
20
|
+
}> & string;
|
|
21
|
+
export declare const HeaderTrailing: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
22
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
23
|
+
}> & string;
|
|
24
|
+
export declare const Section: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
25
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
26
|
+
}> & string;
|
|
27
|
+
export declare const Footer: import('styled-components/dist/types').IStyledComponentBase<"web", Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
28
|
+
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars;
|
|
29
|
+
}> & string;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { colors } from "../../styles/colors.js";
|
|
3
|
+
import { elevation } from "../../styles/elevation.js";
|
|
4
|
+
import rwd from "../../styles/rwd.js";
|
|
5
|
+
import { radius, space } from "../../styles/spacing.js";
|
|
6
|
+
import { typography } from "../../styles/typography.js";
|
|
7
|
+
const divider = `var(--panel-card-divider, 1px solid ${colors.lightGrey})`;
|
|
8
|
+
const Root = styled.div`
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
background: var(--panel-card-background, ${colors.white});
|
|
12
|
+
border: 1px solid
|
|
13
|
+
${({ $highlighted }) => $highlighted ? `var(--panel-card-highlight-color, ${colors.blue})` : `var(--panel-card-border-color, ${colors.lightGrey})`};
|
|
14
|
+
border-radius: var(--panel-card-radius, ${radius.lg});
|
|
15
|
+
box-shadow: ${({ $highlighted }) => $highlighted ? `var(--panel-card-highlight-shadow, ${elevation.md})` : "none"};
|
|
16
|
+
|
|
17
|
+
> * + * {
|
|
18
|
+
border-top: ${divider};
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
21
|
+
const Header = styled.div`
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
align-items: flex-start;
|
|
25
|
+
gap: var(--panel-card-header-gap, ${space[5]});
|
|
26
|
+
padding: var(--panel-card-header-padding, ${space[4]});
|
|
27
|
+
|
|
28
|
+
${rwd.MLarge`
|
|
29
|
+
flex-direction: row;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: space-between;
|
|
32
|
+
padding: var(--panel-card-header-padding, ${space[6]});
|
|
33
|
+
`}
|
|
34
|
+
`;
|
|
35
|
+
const HeaderMain = styled.div`
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
gap: var(--panel-card-header-leading-gap, ${space[3]});
|
|
39
|
+
min-width: 0;
|
|
40
|
+
`;
|
|
41
|
+
const HeaderText = styled.div`
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
min-width: 0;
|
|
45
|
+
`;
|
|
46
|
+
const HeaderTitle = styled.div`
|
|
47
|
+
${typography.bodyLgCallout};
|
|
48
|
+
color: ${colors.black};
|
|
49
|
+
`;
|
|
50
|
+
const HeaderSubtitle = styled.div`
|
|
51
|
+
${typography.bodyMd};
|
|
52
|
+
color: ${colors.grayBlue};
|
|
53
|
+
`;
|
|
54
|
+
const HeaderTrailing = styled.div`
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
flex: 0 0 auto;
|
|
58
|
+
`;
|
|
59
|
+
const Section = styled.div`
|
|
60
|
+
box-sizing: border-box;
|
|
61
|
+
padding: var(--panel-card-section-padding, ${space[4]});
|
|
62
|
+
background: var(--panel-card-section-background, ${colors.white});
|
|
63
|
+
|
|
64
|
+
${rwd.MLarge`
|
|
65
|
+
padding: var(--panel-card-section-padding, ${space[4]} ${space[6]});
|
|
66
|
+
`}
|
|
67
|
+
`;
|
|
68
|
+
const Footer = styled.div`
|
|
69
|
+
box-sizing: border-box;
|
|
70
|
+
padding: var(--panel-card-footer-padding, ${space[3]} ${space[4]});
|
|
71
|
+
background: var(--panel-card-footer-background, ${colors.grey3});
|
|
72
|
+
|
|
73
|
+
${rwd.MLarge`
|
|
74
|
+
padding: var(--panel-card-footer-padding, ${space[3]} ${space[6]});
|
|
75
|
+
`}
|
|
76
|
+
`;
|
|
77
|
+
export {
|
|
78
|
+
Footer,
|
|
79
|
+
Header,
|
|
80
|
+
HeaderMain,
|
|
81
|
+
HeaderSubtitle,
|
|
82
|
+
HeaderText,
|
|
83
|
+
HeaderTitle,
|
|
84
|
+
HeaderTrailing,
|
|
85
|
+
Root,
|
|
86
|
+
Section
|
|
87
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
2
|
import { colors } from "../../styles/colors.js";
|
|
3
3
|
const SEGMENT_COLOR = {
|
|
4
|
-
done:
|
|
4
|
+
done: "#38c229",
|
|
5
5
|
active: colors.white,
|
|
6
6
|
upcoming: "#4a4a4a"
|
|
7
7
|
};
|
|
@@ -13,7 +13,7 @@ const Strip = styled.div`
|
|
|
13
13
|
`;
|
|
14
14
|
const Segments = styled.div`
|
|
15
15
|
display: flex;
|
|
16
|
-
gap:
|
|
16
|
+
gap: 12px;
|
|
17
17
|
width: 100%;
|
|
18
18
|
`;
|
|
19
19
|
const Segment = styled.span`
|
|
@@ -29,7 +29,7 @@ const Caption = styled.p`
|
|
|
29
29
|
font-weight: 600;
|
|
30
30
|
letter-spacing: 1.2px;
|
|
31
31
|
text-transform: uppercase;
|
|
32
|
-
color:
|
|
32
|
+
color: ${colors.grey2};
|
|
33
33
|
white-space: nowrap;
|
|
34
34
|
overflow: hidden;
|
|
35
35
|
text-overflow: ellipsis;
|
|
@@ -24,6 +24,8 @@ export interface StepSidebarProps {
|
|
|
24
24
|
logoAlt: string;
|
|
25
25
|
/** Makes the logo a button. */
|
|
26
26
|
onLogoClick?: () => void;
|
|
27
|
+
/** Mobile header content on the right, e.g. a log-out button. */
|
|
28
|
+
mobileAction?: ReactNode;
|
|
27
29
|
/** Shows the close (×) button in the mobile header. */
|
|
28
30
|
onClose?: () => void;
|
|
29
31
|
closeLabel?: string;
|
|
@@ -31,4 +33,4 @@ export interface StepSidebarProps {
|
|
|
31
33
|
className?: string;
|
|
32
34
|
}
|
|
33
35
|
/** Dark flow sidebar shell: logo, intro, your content and a support contact; a compact header on mobile. */
|
|
34
|
-
export declare const StepSidebar: ({ children, mobileContent, intro, support, logoAlt, onLogoClick, onClose, closeLabel, dataCyPrefix, className, }: StepSidebarProps) => import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
export declare const StepSidebar: ({ children, mobileContent, mobileAction, intro, support, logoAlt, onLogoClick, onClose, closeLabel, dataCyPrefix, className, }: StepSidebarProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,6 +5,7 @@ const LOGO_URL = "https://res.cloudinary.com/stokr/image/upload/v1782908299/STOK
|
|
|
5
5
|
const StepSidebar = ({
|
|
6
6
|
children,
|
|
7
7
|
mobileContent,
|
|
8
|
+
mobileAction,
|
|
8
9
|
intro,
|
|
9
10
|
support,
|
|
10
11
|
logoAlt,
|
|
@@ -18,6 +19,7 @@ const StepSidebar = ({
|
|
|
18
19
|
return /* @__PURE__ */ jsxs(Aside, { className, children: [
|
|
19
20
|
/* @__PURE__ */ jsxs(MobileHeader, { children: [
|
|
20
21
|
logo(MobileLogoImg, "logo-mobile"),
|
|
22
|
+
mobileAction,
|
|
21
23
|
onClose && /* @__PURE__ */ jsx(CloseButton, { type: "button", "aria-label": closeLabel, onClick: onClose, "data-cy": `${dataCyPrefix}-close`, children: /* @__PURE__ */ jsx(MaterialIcon, { name: "close", size: 28 }) })
|
|
22
24
|
] }),
|
|
23
25
|
/* @__PURE__ */ jsx(DesktopOnly, { children: logo(DesktopLogoImg, "logo") }),
|
|
@@ -29,9 +29,13 @@ const Aside = styled.aside`
|
|
|
29
29
|
const MobileHeader = styled.div`
|
|
30
30
|
display: flex;
|
|
31
31
|
align-items: center;
|
|
32
|
-
justify-content: space-between;
|
|
33
32
|
gap: 16px;
|
|
34
|
-
|
|
33
|
+
height: 56px;
|
|
34
|
+
padding: 0 18px;
|
|
35
|
+
|
|
36
|
+
> :first-child {
|
|
37
|
+
margin-right: auto;
|
|
38
|
+
}
|
|
35
39
|
|
|
36
40
|
${media.desktopUp} {
|
|
37
41
|
display: none;
|
|
@@ -2,11 +2,19 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState, useMemo, useCallback } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { Input } from "../Input/Input.js";
|
|
5
|
+
import { colors } from "../../styles/colors.js";
|
|
5
6
|
import { Checkbox } from "../Checkbox/Checkbox.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { FlagFor, CountrySelect } from "../Country/CountrySelect.js";
|
|
7
|
+
import { MaterialIcon } from "../MaterialIcon/MaterialIcon.js";
|
|
8
|
+
import { CountrySelect } from "../Country/CountrySelect.js";
|
|
9
9
|
import { CardWrapper, CardHeader, HeaderIcon, FlagWrapper, HeaderTitle, HeaderActions, DeleteButton, ChevronIcon, CardBodyCollapse, CardBody, CheckboxRow } from "./TaxResidenceCard.styles.js";
|
|
10
|
+
import { FlagFor } from "../Country/FlagFor.js";
|
|
11
|
+
const NO_TIN_TEXT_STYLE = {
|
|
12
|
+
fontSize: 12,
|
|
13
|
+
lineHeight: "18px",
|
|
14
|
+
fontWeight: 400,
|
|
15
|
+
letterSpacing: "0.6px",
|
|
16
|
+
color: colors.black
|
|
17
|
+
};
|
|
10
18
|
const TaxResidenceCard = (props) => {
|
|
11
19
|
const {
|
|
12
20
|
id,
|
|
@@ -25,6 +33,7 @@ const TaxResidenceCard = (props) => {
|
|
|
25
33
|
countryPlaceholder = "Search countries",
|
|
26
34
|
disabled = false,
|
|
27
35
|
hideNoTin = false,
|
|
36
|
+
variant = "default",
|
|
28
37
|
error,
|
|
29
38
|
touched,
|
|
30
39
|
dataCy
|
|
@@ -39,6 +48,7 @@ const TaxResidenceCard = (props) => {
|
|
|
39
48
|
() => country ? countries?.find((c) => c.value === country) : null,
|
|
40
49
|
[countries, country]
|
|
41
50
|
);
|
|
51
|
+
const bordered = variant === "bordered";
|
|
42
52
|
const headerTitle = selectedCountry?.label || emptyTitle;
|
|
43
53
|
const toggle = useCallback(() => {
|
|
44
54
|
const next = !isOpen;
|
|
@@ -68,11 +78,12 @@ const TaxResidenceCard = (props) => {
|
|
|
68
78
|
onDelete?.();
|
|
69
79
|
};
|
|
70
80
|
const cy = dataCy || `tax-residence-card-${id}`;
|
|
71
|
-
return /* @__PURE__ */ jsxs(CardWrapper, { isOpen, "data-cy": cy, children: [
|
|
81
|
+
return /* @__PURE__ */ jsxs(CardWrapper, { isOpen, $variant: variant, "data-cy": cy, children: [
|
|
72
82
|
/* @__PURE__ */ jsxs(
|
|
73
83
|
CardHeader,
|
|
74
84
|
{
|
|
75
85
|
isOpen,
|
|
86
|
+
$variant: variant,
|
|
76
87
|
onClick: toggle,
|
|
77
88
|
onKeyDown: handleHeaderKeyDown,
|
|
78
89
|
role: "button",
|
|
@@ -81,9 +92,9 @@ const TaxResidenceCard = (props) => {
|
|
|
81
92
|
"aria-controls": `${id}-body`,
|
|
82
93
|
"data-cy": `${cy}-toggle`,
|
|
83
94
|
children: [
|
|
84
|
-
/* @__PURE__ */ jsx(HeaderIcon, { "aria-hidden": "true", children: selectedCountry ? /* @__PURE__ */ jsx(FlagWrapper, { children: /* @__PURE__ */ jsx(FlagFor, { code: selectedCountry.value }) }) : /* @__PURE__ */ jsx(
|
|
85
|
-
/* @__PURE__ */ jsx(HeaderTitle, { children: headerTitle }),
|
|
86
|
-
/* @__PURE__ */ jsxs(HeaderActions, { children: [
|
|
95
|
+
/* @__PURE__ */ jsx(HeaderIcon, { "aria-hidden": "true", children: selectedCountry ? /* @__PURE__ */ jsx(FlagWrapper, { $variant: variant, children: /* @__PURE__ */ jsx(FlagFor, { code: selectedCountry.value }) }) : /* @__PURE__ */ jsx(MaterialIcon, { name: "language", size: 20 }) }),
|
|
96
|
+
/* @__PURE__ */ jsx(HeaderTitle, { $variant: variant, children: headerTitle }),
|
|
97
|
+
/* @__PURE__ */ jsxs(HeaderActions, { $variant: variant, children: [
|
|
87
98
|
onDelete && !disabled && /* @__PURE__ */ jsx(
|
|
88
99
|
DeleteButton,
|
|
89
100
|
{
|
|
@@ -92,15 +103,15 @@ const TaxResidenceCard = (props) => {
|
|
|
92
103
|
"aria-label": `Delete ${headerTitle}`,
|
|
93
104
|
disabled,
|
|
94
105
|
"data-cy": `${cy}-delete`,
|
|
95
|
-
children: /* @__PURE__ */ jsx(
|
|
106
|
+
children: /* @__PURE__ */ jsx(MaterialIcon, { name: "delete", size: 20 })
|
|
96
107
|
}
|
|
97
108
|
),
|
|
98
|
-
/* @__PURE__ */ jsx(ChevronIcon, { isOpen, "aria-hidden": "true" })
|
|
109
|
+
/* @__PURE__ */ jsx(ChevronIcon, { isOpen, $variant: variant, "aria-hidden": "true" })
|
|
99
110
|
] })
|
|
100
111
|
]
|
|
101
112
|
}
|
|
102
113
|
),
|
|
103
|
-
/* @__PURE__ */ jsx(CardBodyCollapse, { isOpened: isOpen, children: /* @__PURE__ */ jsxs(CardBody, { id: `${id}-body`, children: [
|
|
114
|
+
/* @__PURE__ */ jsx(CardBodyCollapse, { isOpened: isOpen, $variant: variant, children: /* @__PURE__ */ jsxs(CardBody, { id: `${id}-body`, $variant: variant, children: [
|
|
104
115
|
/* @__PURE__ */ jsx(
|
|
105
116
|
CountrySelect,
|
|
106
117
|
{
|
|
@@ -112,6 +123,7 @@ const TaxResidenceCard = (props) => {
|
|
|
112
123
|
onChange: handleCountryChange,
|
|
113
124
|
placeholder: countryPlaceholder,
|
|
114
125
|
disabled,
|
|
126
|
+
variant,
|
|
115
127
|
error: !!error?.country,
|
|
116
128
|
touched: !!touched?.country,
|
|
117
129
|
dataCy: `${cy}-country`
|
|
@@ -126,12 +138,13 @@ const TaxResidenceCard = (props) => {
|
|
|
126
138
|
value: tin,
|
|
127
139
|
onChange: handleTinChange,
|
|
128
140
|
disabled: disabled || noTinIssued,
|
|
141
|
+
variant,
|
|
129
142
|
error: !!error?.tin,
|
|
130
143
|
touched: !!touched?.tin,
|
|
131
144
|
"data-cy": `${cy}-tin`
|
|
132
145
|
}
|
|
133
146
|
),
|
|
134
|
-
(disabled && (tin === "" || !tin) || !disabled) && !hideNoTin && /* @__PURE__ */ jsx(CheckboxRow, { children: /* @__PURE__ */ jsx(
|
|
147
|
+
(disabled && (tin === "" || !tin) || !disabled) && !hideNoTin && /* @__PURE__ */ jsx(CheckboxRow, { $variant: variant, children: /* @__PURE__ */ jsx(
|
|
135
148
|
Checkbox,
|
|
136
149
|
{
|
|
137
150
|
id: `${id}-no-tin`,
|
|
@@ -140,6 +153,7 @@ const TaxResidenceCard = (props) => {
|
|
|
140
153
|
checked: noTinIssued,
|
|
141
154
|
onChange: handleNoTinChange,
|
|
142
155
|
disabled,
|
|
156
|
+
textStyle: bordered ? NO_TIN_TEXT_STYLE : void 0,
|
|
143
157
|
"data-cy": `${cy}-no-tin`
|
|
144
158
|
}
|
|
145
159
|
) })
|
|
@@ -189,6 +203,8 @@ TaxResidenceCard.propTypes = {
|
|
|
189
203
|
disabled: PropTypes.bool,
|
|
190
204
|
/** Whether to hide the "no TIN issued" checkbox. */
|
|
191
205
|
hideNoTin: PropTypes.bool,
|
|
206
|
+
/** `bordered`: white card with a 20px padding and boxed fields (sign-up redesign). Default keeps the list look. */
|
|
207
|
+
variant: PropTypes.oneOf(["default", "bordered"]),
|
|
192
208
|
/** Per-field error flags: `{ country, tin }`. */
|
|
193
209
|
error: PropTypes.shape({
|
|
194
210
|
country: PropTypes.bool,
|
|
@@ -2,8 +2,15 @@ import styled, { css } from "styled-components";
|
|
|
2
2
|
import { Collapse } from "react-collapse";
|
|
3
3
|
import theme from "../../styles/theme.js";
|
|
4
4
|
import { glyph } from "../MaterialIcon/glyph.js";
|
|
5
|
+
import { colors } from "../../styles/colors.js";
|
|
6
|
+
import { elevation } from "../../styles/elevation.js";
|
|
7
|
+
import { space, radius } from "../../styles/spacing.js";
|
|
8
|
+
import { typography } from "../../styles/typography.js";
|
|
9
|
+
import { BORDERED_BORDER } from "../../styles/borderedField.js";
|
|
10
|
+
const bordered = (rules) => (props) => props.$variant === "bordered" && rules;
|
|
11
|
+
const NOT_FORWARDED = ["isOpen", "$variant"];
|
|
5
12
|
const CardWrapper = styled.div.withConfig({
|
|
6
|
-
shouldForwardProp: (prop) => !
|
|
13
|
+
shouldForwardProp: (prop) => !NOT_FORWARDED.includes(prop)
|
|
7
14
|
})`
|
|
8
15
|
background: ${theme.cWhite};
|
|
9
16
|
border: 1px solid ${theme.cLightGrey};
|
|
@@ -18,12 +25,21 @@ const CardWrapper = styled.div.withConfig({
|
|
|
18
25
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
|
|
19
26
|
`}
|
|
20
27
|
|
|
28
|
+
${bordered(css`
|
|
29
|
+
padding: ${space[5]};
|
|
30
|
+
border: ${BORDERED_BORDER};
|
|
31
|
+
border-radius: ${radius.lg};
|
|
32
|
+
background: ${colors.white};
|
|
33
|
+
box-shadow: ${elevation.md};
|
|
34
|
+
overflow: visible;
|
|
35
|
+
`)}
|
|
36
|
+
|
|
21
37
|
& + & {
|
|
22
38
|
margin-top: 12px;
|
|
23
39
|
}
|
|
24
40
|
`;
|
|
25
41
|
const CardHeader = styled.div.withConfig({
|
|
26
|
-
shouldForwardProp: (prop) => !
|
|
42
|
+
shouldForwardProp: (prop) => !NOT_FORWARDED.includes(prop)
|
|
27
43
|
})`
|
|
28
44
|
display: flex;
|
|
29
45
|
align-items: center;
|
|
@@ -46,6 +62,21 @@ const CardHeader = styled.div.withConfig({
|
|
|
46
62
|
&:focus-visible {
|
|
47
63
|
box-shadow: inset 0 0 0 2px ${theme.cPrimary};
|
|
48
64
|
}
|
|
65
|
+
|
|
66
|
+
${bordered(css`
|
|
67
|
+
padding: 0;
|
|
68
|
+
|
|
69
|
+
&:hover {
|
|
70
|
+
background-color: transparent;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&:focus-visible {
|
|
74
|
+
box-shadow: none;
|
|
75
|
+
outline: 2px solid ${theme.cPrimary};
|
|
76
|
+
outline-offset: 4px;
|
|
77
|
+
border-radius: ${radius.sm};
|
|
78
|
+
}
|
|
79
|
+
`)}
|
|
49
80
|
`;
|
|
50
81
|
const HeaderIcon = styled.span`
|
|
51
82
|
display: inline-flex;
|
|
@@ -55,8 +86,14 @@ const HeaderIcon = styled.span`
|
|
|
55
86
|
margin-right: 16px;
|
|
56
87
|
flex-shrink: 0;
|
|
57
88
|
color: ${theme.cBlack};
|
|
89
|
+
|
|
90
|
+
${bordered(css`
|
|
91
|
+
margin-right: ${space[3]};
|
|
92
|
+
`)}
|
|
58
93
|
`;
|
|
59
|
-
const FlagWrapper = styled.span
|
|
94
|
+
const FlagWrapper = styled.span.withConfig({
|
|
95
|
+
shouldForwardProp: (prop) => !NOT_FORWARDED.includes(prop)
|
|
96
|
+
})`
|
|
60
97
|
display: inline-flex;
|
|
61
98
|
width: 24px;
|
|
62
99
|
height: 18px;
|
|
@@ -70,8 +107,14 @@ const FlagWrapper = styled.span`
|
|
|
70
107
|
object-fit: cover;
|
|
71
108
|
display: block;
|
|
72
109
|
}
|
|
110
|
+
|
|
111
|
+
${bordered(css`
|
|
112
|
+
height: 20px;
|
|
113
|
+
`)}
|
|
73
114
|
`;
|
|
74
|
-
const HeaderTitle = styled.span
|
|
115
|
+
const HeaderTitle = styled.span.withConfig({
|
|
116
|
+
shouldForwardProp: (prop) => !NOT_FORWARDED.includes(prop)
|
|
117
|
+
})`
|
|
75
118
|
flex: 1;
|
|
76
119
|
min-width: 0;
|
|
77
120
|
font-family: 'Open Sans';
|
|
@@ -84,13 +127,25 @@ const HeaderTitle = styled.span`
|
|
|
84
127
|
white-space: nowrap;
|
|
85
128
|
overflow: hidden;
|
|
86
129
|
text-overflow: ellipsis;
|
|
130
|
+
|
|
131
|
+
${bordered(css`
|
|
132
|
+
${typography.bodyMdCallout}
|
|
133
|
+
text-transform: none;
|
|
134
|
+
color: ${colors.black};
|
|
135
|
+
`)}
|
|
87
136
|
`;
|
|
88
|
-
const HeaderActions = styled.div
|
|
137
|
+
const HeaderActions = styled.div.withConfig({
|
|
138
|
+
shouldForwardProp: (prop) => !NOT_FORWARDED.includes(prop)
|
|
139
|
+
})`
|
|
89
140
|
display: flex;
|
|
90
141
|
align-items: center;
|
|
91
142
|
gap: 14px;
|
|
92
143
|
margin-left: 12px;
|
|
93
144
|
flex-shrink: 0;
|
|
145
|
+
|
|
146
|
+
${bordered(css`
|
|
147
|
+
gap: ${space[3]};
|
|
148
|
+
`)}
|
|
94
149
|
`;
|
|
95
150
|
const DeleteButton = styled.button`
|
|
96
151
|
display: inline-flex;
|
|
@@ -129,7 +184,7 @@ const DeleteButton = styled.button`
|
|
|
129
184
|
}
|
|
130
185
|
`;
|
|
131
186
|
const ChevronIcon = styled.span.withConfig({
|
|
132
|
-
shouldForwardProp: (prop) => !
|
|
187
|
+
shouldForwardProp: (prop) => !NOT_FORWARDED.includes(prop)
|
|
133
188
|
}).attrs({
|
|
134
189
|
children: glyph("keyboard_arrow_down")
|
|
135
190
|
})`
|
|
@@ -143,18 +198,44 @@ const ChevronIcon = styled.span.withConfig({
|
|
|
143
198
|
${(props) => props.isOpen && css`
|
|
144
199
|
transform: rotate(180deg);
|
|
145
200
|
`}
|
|
201
|
+
|
|
202
|
+
${bordered(css`
|
|
203
|
+
font-size: 16px;
|
|
204
|
+
`)}
|
|
146
205
|
`;
|
|
147
|
-
const CardBodyCollapse = styled(Collapse)
|
|
206
|
+
const CardBodyCollapse = styled(Collapse).withConfig({
|
|
207
|
+
shouldForwardProp: (prop) => !NOT_FORWARDED.includes(prop)
|
|
208
|
+
})`
|
|
148
209
|
border-top: 1px solid ${theme.cLightGrey};
|
|
210
|
+
|
|
211
|
+
${bordered(css`
|
|
212
|
+
border-top: 0;
|
|
213
|
+
`)}
|
|
149
214
|
`;
|
|
150
215
|
const CardBody = styled.div`
|
|
151
216
|
display: flex;
|
|
152
217
|
flex-direction: column;
|
|
153
218
|
gap: 26px;
|
|
154
219
|
padding: 24px 22px 20px;
|
|
220
|
+
|
|
221
|
+
${bordered(css`
|
|
222
|
+
gap: ${space[8]};
|
|
223
|
+
padding: ${space[8]} 0 0;
|
|
224
|
+
|
|
225
|
+
/* Figma labels the card's fields 14/20; the shared bordered label is 12/16. */
|
|
226
|
+
& > * > label {
|
|
227
|
+
font-size: 14px;
|
|
228
|
+
line-height: 20px;
|
|
229
|
+
letter-spacing: 0.5px;
|
|
230
|
+
}
|
|
231
|
+
`)}
|
|
155
232
|
`;
|
|
156
233
|
const CheckboxRow = styled.div`
|
|
157
234
|
padding-top: 4px;
|
|
235
|
+
|
|
236
|
+
${bordered(css`
|
|
237
|
+
padding-top: 0;
|
|
238
|
+
`)}
|
|
158
239
|
`;
|
|
159
240
|
export {
|
|
160
241
|
CardBody,
|