@stokr/components-library 5.0.1 → 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.
Files changed (127) hide show
  1. package/README.md +8 -8
  2. package/dist/components/AddressItem/AddressItem.styles.js +9 -9
  3. package/dist/components/AdminDashboard/Table/Table.styles.js +18 -25
  4. package/dist/components/AgreementItem/AgreementItem.styles.js +1 -1
  5. package/dist/components/BackButton/BackButton.styles.js +15 -15
  6. package/dist/components/BasicTable/BasicTable.styles.js +6 -8
  7. package/dist/components/BlogPost/BlogPost.styles.js +9 -13
  8. package/dist/components/Button/Button.styles.d.ts +1 -1
  9. package/dist/components/Button/Button.styles.js +122 -11
  10. package/dist/components/Button/GlareButton.js +1 -1
  11. package/dist/components/Card/Card.styles.js +3 -4
  12. package/dist/components/CardTabs/CardTabs.styles.js +17 -17
  13. package/dist/components/ChartLegend/ChartLegend.styles.js +6 -7
  14. package/dist/components/Checkbox/Checkbox.styles.js +10 -11
  15. package/dist/components/Checklist/ChecklistCard.js +3 -3
  16. package/dist/components/Checklist/ChecklistCard.styles.js +7 -20
  17. package/dist/components/Chips/Chip.js +2 -2
  18. package/dist/components/Chips/Chip.styles.js +6 -10
  19. package/dist/components/Collapsible/Collapsible.styles.js +14 -14
  20. package/dist/components/ComponentScroll/ComponentScroll.styles.js +5 -5
  21. package/dist/components/ComponentWrapper/ComponentWrapper.styles.js +5 -5
  22. package/dist/components/ConfirmModal/ConfirmModal.styles.js +2 -2
  23. package/dist/components/Country/CountrySelect.js +6 -6
  24. package/dist/components/CryptoAddress/CryptoAddress.d.ts +6 -2
  25. package/dist/components/CryptoAddress/CryptoAddress.js +2 -2
  26. package/dist/components/CryptoAddress/CryptoAddress.styles.d.ts +2 -1
  27. package/dist/components/CryptoAddress/CryptoAddress.styles.js +20 -27
  28. package/dist/components/CryptoAddressWrapper/CryptoAddressWrapper.styles.js +2 -2
  29. package/dist/components/FAQ/FAQ.styles.js +15 -20
  30. package/dist/components/Form/Form.styles.js +5 -5
  31. package/dist/components/Grid/Grid.styles.js +7 -7
  32. package/dist/components/IdentityInfo/IdentityInfo.styles.js +10 -22
  33. package/dist/components/InfoBox/InfoBox.d.ts +2 -2
  34. package/dist/components/InfoBox/InfoBox.js +5 -3
  35. package/dist/components/InfoIcon/InfoIcon.styles.js +2 -2
  36. package/dist/components/Input/DatePickerInput.styles.js +23 -24
  37. package/dist/components/Input/Input.styles.js +24 -30
  38. package/dist/components/Input/InputPassword.styles.js +11 -11
  39. package/dist/components/Input/InputWithButton.styles.js +5 -5
  40. package/dist/components/Input/MultiSelect.js +17 -17
  41. package/dist/components/Input/OtpInput.js +1 -1
  42. package/dist/components/Input/RangeInput.js +2 -2
  43. package/dist/components/Input/SearchInput.styles.js +10 -10
  44. package/dist/components/Input/Select.js +21 -16
  45. package/dist/components/Input/Select.styles.js +24 -28
  46. package/dist/components/Input/TableFilterDropdown.js +5 -5
  47. package/dist/components/Input/Textarea.styles.js +11 -13
  48. package/dist/components/MenuNav/MenuNav.styles.js +2 -5
  49. package/dist/components/Modal/Modal.styles.js +25 -31
  50. package/dist/components/Modal/PaymentModal.js +7 -7
  51. package/dist/components/Modal/SideModal.styles.js +8 -8
  52. package/dist/components/Modal/SideModalParts.js +15 -16
  53. package/dist/components/Modal/SuccessModal/SuccessModal.styles.js +5 -8
  54. package/dist/components/NotificationCounter/NotificationCounter.styles.js +2 -2
  55. package/dist/components/Number/Number.js +1 -1
  56. package/dist/components/Number/Number.styles.js +2 -2
  57. package/dist/components/Pagination/Pagination.styles.js +7 -7
  58. package/dist/components/PanelCard/PanelCard.styles.js +17 -17
  59. package/dist/components/Payment/DetailRows.js +1 -1
  60. package/dist/components/Payment/DetailsToggle.js +4 -6
  61. package/dist/components/Payment/PaymentDetailsCard.js +29 -53
  62. package/dist/components/Payment/PaymentDisplay.js +12 -20
  63. package/dist/components/Payment/PaymentPendingCard.d.ts +1 -1
  64. package/dist/components/Payment/PaymentPendingCard.js +10 -13
  65. package/dist/components/Payment/PaymentSuccessCard.js +6 -9
  66. package/dist/components/Payment/TimerComponent.js +5 -4
  67. package/dist/components/Process/Process.styles.js +7 -13
  68. package/dist/components/ProfileBadge/ProfileBadge.styles.js +8 -10
  69. package/dist/components/ProfileBox/ProfileBox.styles.js +5 -7
  70. package/dist/components/Radio/Radio.styles.js +8 -9
  71. package/dist/components/RefreshButton/RefreshButton.styles.js +5 -5
  72. package/dist/components/RequestDataBox/RequestDataBox.styles.js +3 -5
  73. package/dist/components/Section/Section.styles.js +16 -18
  74. package/dist/components/SectionTitle/SectionTitle.styles.d.ts +4 -0
  75. package/dist/components/SectionTitle/SectionTitle.styles.js +4 -7
  76. package/dist/components/Skeleton/Skeleton.d.ts +1 -1
  77. package/dist/components/Skeleton/Skeleton.js +3 -3
  78. package/dist/components/Snackbar/Snackbar.styles.js +8 -10
  79. package/dist/components/SpanButton/SpanButton.styles.js +2 -2
  80. package/dist/components/StatusDot/StatusDot.d.ts +1 -1
  81. package/dist/components/StatusDot/StatusDot.js +5 -5
  82. package/dist/components/StatusDot/StatusDot.styles.js +2 -5
  83. package/dist/components/StatusTag/StatusTag.js +1 -1
  84. package/dist/components/StatusTag/StatusTag.styles.js +4 -4
  85. package/dist/components/StepController/StepController.styles.js +7 -7
  86. package/dist/components/StepSidebar/MobileStepProgress.styles.js +6 -8
  87. package/dist/components/StepSidebar/StepProgress.styles.js +18 -27
  88. package/dist/components/StepSidebar/StepSidebar.styles.js +14 -20
  89. package/dist/components/StokrLoader/StokrLoader.js +41 -13
  90. package/dist/components/StokrLoader/loaderSession.d.ts +14 -0
  91. package/dist/components/StokrLoader/loaderSession.js +30 -0
  92. package/dist/components/Switch/Switch.styles.js +12 -14
  93. package/dist/components/TabsNav/TabsNav.styles.js +7 -9
  94. package/dist/components/TaxResidenceCard/TaxResidenceCard.js +1 -1
  95. package/dist/components/TaxResidenceCard/TaxResidenceCard.styles.js +30 -35
  96. package/dist/components/Text/Text.styles.d.ts +2 -1
  97. package/dist/components/Text/Text.styles.js +36 -70
  98. package/dist/components/TextLink/TextLink.styles.js +5 -7
  99. package/dist/components/Timeline/Timeline.styles.js +17 -23
  100. package/dist/components/Tooltip/Tooltip.d.ts +1 -1
  101. package/dist/components/Tooltip/Tooltip.js +1 -2
  102. package/dist/components/Tooltip/Tooltip.styles.js +4 -5
  103. package/dist/components/breakdown/Breakdown.js +3 -5
  104. package/dist/components/logo/Logo.js +1 -1
  105. package/dist/design-system/css/base.css +14 -14
  106. package/dist/design-system/css-builders.d.ts +25 -0
  107. package/dist/design-system/css-builders.js +81 -0
  108. package/dist/design-system/generated/fonts.css +0 -49
  109. package/dist/design-system/generated/text-classes.css +123 -123
  110. package/dist/design-system/generated/text-styles.d.ts +24 -24
  111. package/dist/design-system/generated/text-styles.js +123 -123
  112. package/dist/design-system/generated/tokens.css +417 -412
  113. package/dist/design-system/index.d.ts +2 -1
  114. package/dist/design-system/styled/build-theme.js +1 -1
  115. package/dist/design-system/tokens/colors.d.ts +1 -1
  116. package/dist/design-system/tokens/colors.js +1 -1
  117. package/dist/design-system/tokens/fonts.d.ts +6 -2
  118. package/dist/design-system/tokens/fonts.js +1 -1
  119. package/dist/design-system/tokens/semantic.d.ts +15 -3
  120. package/dist/design-system/tokens/semantic.js +5 -1
  121. package/dist/design-system/tokens/typography.d.ts +1 -1
  122. package/dist/design-system/tokens/typography.js +64 -41
  123. package/dist/index.d.ts +11 -1
  124. package/dist/index.js +3 -0
  125. package/dist/styles/borderedField.d.ts +1 -1
  126. package/dist/styles/borderedField.js +13 -13
  127. package/package.json +1 -1
@@ -21,11 +21,11 @@ const TextBase = styled.div.withConfig({
21
21
  ].includes(props)
22
22
  })`
23
23
  display: block;
24
- color: var(--stokr-text-${({ color, variant }) => color ?? (variant ? variantColor(variant) : "body")});
24
+ color: var(--text-${({ color, variant }) => color ?? (variant ? variantColor(variant) : "body")});
25
25
 
26
26
  ${({ variant }) => variant && `
27
27
  margin: 0;
28
- font-family: var(--stokr-font-family-base);
28
+ font-family: var(--font-family-base);
29
29
  ${text(variant)}
30
30
  `}
31
31
 
@@ -33,11 +33,11 @@ const TextBase = styled.div.withConfig({
33
33
  h2,
34
34
  h3,
35
35
  h5 {
36
- color: ${({ color }) => color ? "inherit" : "var(--stokr-text-primary)"};
36
+ color: ${({ color }) => color ? "inherit" : "var(--text-primary)"};
37
37
  }
38
38
 
39
39
  h4 {
40
- color: ${({ color }) => color ? "inherit" : "var(--stokr-text-secondary)"};
40
+ color: ${({ color }) => color ? "inherit" : "var(--text-secondary)"};
41
41
  }
42
42
 
43
43
  ${({ withMarginBottom }) => withMarginBottom && `
@@ -56,91 +56,57 @@ const TextBase = styled.div.withConfig({
56
56
 
57
57
 
58
58
 
59
+ /*
60
+ * Heading ladder of rich content (CMS): the only place that decides which kit style each heading level gets.
61
+ * Sizes come from the kit (switching mobile/desktop and type scale by itself), never from px values here.
62
+ */
63
+ h1,
64
+ h2,
65
+ h3 {
66
+ font-family: var(--font-family-base);
67
+ ${text("titleXl")}
68
+ }
69
+
70
+ h4 {
71
+ font-family: var(--font-family-base);
72
+ ${text("titleXs")}
73
+ }
74
+
75
+ h5 {
76
+ font-family: var(--font-family-base);
77
+ ${text("titleL")}
78
+ }
79
+
59
80
  h1 {
60
- font-family: var(--stokr-font-family-base);
61
- font-weight: 800;
62
- font-size: 22px;
63
- line-height: 1.18;
64
- letter-spacing: 0.8px;
65
- text-transform: uppercase;
66
81
  margin-top: 1em;
67
82
  margin-bottom: 32px;
68
83
 
69
84
  ${breakpoint.Medium`
70
- font-size: 34px;
71
- letter-spacing: 1.5px;
72
85
  margin-bottom: 45px;
73
86
  `}
74
87
  }
75
88
 
76
89
  h2 {
77
- font-family: var(--stokr-font-family-base);
78
- font-weight: 300;
79
- font-size: 34px;
80
- line-height: 1.18em;
81
- letter-spacing: 1.5px;
82
90
  margin-top: 1em;
83
91
  margin-bottom: 0.18em;
84
-
85
- ${breakpoint.Medium`
86
- font-size: 42px;
87
- `}
88
-
89
- ${breakpoint.Large`
90
- font-size: 50px;
91
- `}
92
92
  }
93
93
 
94
- h4 {
95
- font-family: var(--stokr-font-family-base);
96
- font-weight: 300;
97
- font-size: 17px;
98
- line-height: 1.27em;
99
- letter-spacing: 0.8px;
94
+ h3 {
100
95
  margin-top: 1em;
101
96
  margin-bottom: 0.27em;
102
-
103
- ${breakpoint.Medium`
104
- //font-size: 34px;
105
- `}
106
-
107
- ${(props) => props.blockchainLoadingMsg && `
108
- width: 100% !important;
109
- `}
110
97
  }
111
98
 
112
- h3 {
113
- font-family: var(--stokr-font-family-base);
114
- font-weight: 800;
115
- font-size: 22px;
116
- line-height: 1.27em;
117
- letter-spacing: 0.8px;
99
+ h4 {
118
100
  margin-top: 1em;
119
101
  margin-bottom: 0.27em;
120
- text-transform: uppercase;
121
102
 
122
- ${breakpoint.Medium`
123
- font-size: 34px;
103
+ ${(props) => props.blockchainLoadingMsg && `
104
+ width: 100% !important;
124
105
  `}
125
-
126
- ${breakpoint.Medium`${breakpoint.below.MLarge`
127
- ${(props) => props.responsiveFont && `
128
- font-size: 22px;
129
- `}
130
- `}`}
131
- }
132
-
133
- h5 {
134
- font-family: var(--stokr-font-family-base);
135
- font-weight: 800;
136
- font-size: 22px;
137
- line-height: 1.27em;
138
- letter-spacing: 0.8px;
139
- text-transform: uppercase;
140
106
  }
141
107
 
142
108
  p {
143
- font-family: var(--stokr-font-family-base);
109
+ font-family: var(--font-family-base);
144
110
  font-weight: 300;
145
111
  font-size: 16px;
146
112
  line-height: 1.5em;
@@ -166,12 +132,12 @@ const TextBase = styled.div.withConfig({
166
132
  color: inherit;
167
133
 
168
134
  &:hover {
169
- color: var(--stokr-text-primary);
135
+ color: var(--text-primary);
170
136
  }
171
137
  }
172
138
 
173
139
  ${(props) => props.success && `
174
- color: var(--stokr-status-success-text);
140
+ color: var(--status-success-text);
175
141
  `}
176
142
  }
177
143
 
@@ -204,10 +170,10 @@ const Caption = styled.p.withConfig({
204
170
  shouldForwardProp: (props) => !["center", "link"].includes(props)
205
171
  })`
206
172
  &&& {
207
- font-family: var(--stokr-font-family-base);
173
+ font-family: var(--font-family-base);
208
174
  font-weight: 300;
209
175
  font-size: 9px;
210
- color: var(--stokr-text-tertiary);
176
+ color: var(--text-tertiary);
211
177
  line-height: 1.78em;
212
178
  letter-spacing: 0.4px;
213
179
 
@@ -230,10 +196,10 @@ const Caption = styled.p.withConfig({
230
196
  a {
231
197
  text-decoration: underline;
232
198
  transition: color 0.2s;
233
- color: var(--stokr-text-link);
199
+ color: var(--action-accent-bg);
234
200
 
235
201
  &:hover {
236
- color: var(--stokr-text-primary);
202
+ color: var(--text-primary);
237
203
  }
238
204
  }
239
205
  }
@@ -1,20 +1,18 @@
1
1
  import styled, { css } from "styled-components";
2
2
  import { Link } from "react-router-dom";
3
3
  import { withGlyph, glyph } from "../MaterialIcon/glyph.js";
4
+ import { text } from "../../design-system/styled/text.js";
4
5
  const withArrow = (props) => ({
5
6
  children: withGlyph(glyph("chevron_right", false, 16), props.children)
6
7
  });
7
8
  const styles = css`
8
9
  background: transparent;
9
- color: var(--stokr-text-link);
10
+ color: var(--text-link);
10
11
  border: none;
11
12
  cursor: pointer;
12
13
  position: relative;
13
- font-family: var(--stokr-font-family-base);
14
- font-weight: bold;
15
- font-size: 11px;
16
- line-height: 14px;
17
- text-transform: uppercase;
14
+ font-family: var(--font-family-base);
15
+ ${text("label")}
18
16
  display: inline-block;
19
17
  padding-left: 18px;
20
18
  padding-right: 6px;
@@ -27,7 +25,7 @@ const styles = css`
27
25
  width: 16px;
28
26
  height: 16px;
29
27
  margin-top: -8px;
30
- color: var(--stokr-color-red-500);
28
+ color: var(--color-red-500);
31
29
  transform: ${(props) => props.reverse ? "rotate(180deg)" : "none"};
32
30
  }
33
31
 
@@ -1,4 +1,5 @@
1
1
  import styled, { css } from "styled-components";
2
+ import { text } from "../../design-system/styled/text.js";
2
3
  const iconSize = 20;
3
4
  const TimelineContainer = styled.div.withConfig({
4
5
  shouldForwardProp: (props) => !["maxWidth"].includes(props)
@@ -40,32 +41,32 @@ const StepIcon = styled.div.withConfig({
40
41
  switch (props.state) {
41
42
  case "completed":
42
43
  return css`
43
- background-color: var(--stokr-status-success-icon);
44
- color: var(--stokr-background-default);
44
+ background-color: var(--status-success-icon);
45
+ color: var(--background-default);
45
46
  `;
46
47
  case "pending":
47
48
  return css`
48
- background-color: var(--stokr-status-warning-icon);
49
- color: var(--stokr-background-default);
49
+ background-color: var(--status-warning-icon);
50
+ color: var(--background-default);
50
51
  `;
51
52
  case "failed":
52
53
  case "cancelled":
53
54
  return css`
54
- background-color: var(--stokr-status-error-icon);
55
- color: var(--stokr-background-default);
55
+ background-color: var(--status-error-icon);
56
+ color: var(--background-default);
56
57
  `;
57
58
  case "inactive":
58
59
  default:
59
60
  return css`
60
61
  background-color: transparent;
61
- border: 1.5px solid var(--stokr-border-subtle);
62
- color: var(--stokr-text-tertiary);
62
+ border: 1.5px solid var(--border-subtle);
63
+ color: var(--text-tertiary);
63
64
  `;
64
65
  }
65
66
  }}
66
67
 
67
68
  > svg path {
68
- stroke: var(--stokr-background-default);
69
+ stroke: var(--background-default);
69
70
  }
70
71
  `;
71
72
  const ConnectingLine = styled.div.withConfig({
@@ -77,7 +78,7 @@ const ConnectingLine = styled.div.withConfig({
77
78
  align-self: center;
78
79
 
79
80
  ${(props) => {
80
- const lineColor = props.state === "completed" ? "var(--stokr-status-success-icon)" : props.state === "pending" ? "var(--stokr-status-warning-icon)" : props.state === "failed" || props.state === "cancelled" ? "var(--stokr-status-error-icon)" : "var(--stokr-border-subtle)";
81
+ const lineColor = props.state === "completed" ? "var(--status-success-icon)" : props.state === "pending" ? "var(--status-warning-icon)" : props.state === "failed" || props.state === "cancelled" ? "var(--status-error-icon)" : "var(--border-subtle)";
81
82
  return css`
82
83
  background-color: ${lineColor};
83
84
  `;
@@ -96,12 +97,8 @@ const StepHeader = styled.div`
96
97
  gap: 8px;
97
98
  `;
98
99
  const StepDate = styled.span`
99
- color: var(--stokr-text-primary);
100
- font-size: 11px;
101
- font-weight: 400;
102
- text-transform: uppercase;
103
- line-height: 15px;
104
- letter-spacing: 2px;
100
+ color: var(--text-primary);
101
+ ${text("labelRegular")}
105
102
  word-wrap: break-word;
106
103
  `;
107
104
  const StepTitle = styled.span.withConfig({
@@ -111,20 +108,17 @@ const StepTitle = styled.span.withConfig({
111
108
  switch (props.state) {
112
109
  case "inactive":
113
110
  case "pending":
114
- return "var(--stokr-text-tertiary)";
111
+ return "var(--text-tertiary)";
115
112
  default:
116
- return "var(--stokr-text-primary)";
113
+ return "var(--text-primary)";
117
114
  }
118
115
  }};
119
116
 
120
- font-size: 16px;
121
- font-weight: 600;
122
- line-height: 24px;
123
- letter-spacing: 0.6px;
117
+ ${text("subtitleM")}
124
118
  word-wrap: break-word;
125
119
  `;
126
120
  const StepCaption = styled.div`
127
- color: var(--stokr-text-tertiary);
121
+ color: var(--text-tertiary);
128
122
  margin-top: 4px;
129
123
  font-size: 12px;
130
124
  font-weight: 400;
@@ -15,7 +15,7 @@ export type TooltipProps = {
15
15
  close?: number;
16
16
  };
17
17
  showArrow?: boolean;
18
- /** Arrow fill. Defaults to the theme primary, falling back to STOKR blue. */
18
+ /** Arrow fill (any CSS colour, `var()` included). Defaults to the accent: blue in light, green in dark. */
19
19
  arrowColor?: string;
20
20
  maxWidth?: number | string;
21
21
  /**
@@ -2,7 +2,6 @@ import { jsx, Fragment, jsxs } from "react/jsx-runtime";
2
2
  import { useState, useRef, isValidElement, cloneElement, useEffect, useLayoutEffect } from "react";
3
3
  import { useFloating, autoUpdate, offset, flip, shift, arrow, useInteractions, useHover, safePolygon, useFocus, useClick, useDismiss, useRole, useTransitionStyles, useMergeRefs, FloatingPortal, FloatingArrow } from "@floating-ui/react";
4
4
  import { TriggerWrapper, Bubble } from "./Tooltip.styles.js";
5
- import { colors } from "../../design-system/tokens/colors.js";
6
5
  const useIsomorphicLayoutEffect = typeof document === "undefined" ? useEffect : useLayoutEffect;
7
6
  const PLACEMENTS = ["top", "bottom", "left", "right"];
8
7
  const FORWARD_REF = /* @__PURE__ */ Symbol.for("react.forward_ref");
@@ -130,7 +129,7 @@ const Tooltip = ({
130
129
  width: ARROW_WIDTH,
131
130
  height: ARROW_HEIGHT,
132
131
  tipRadius: 1,
133
- fill: arrowColor || colors["blue-500"]
132
+ style: { fill: arrowColor || "var(--action-accent-bg)" }
134
133
  }
135
134
  )
136
135
  ]
@@ -9,9 +9,10 @@ const Bubble = styled.div`
9
9
  width: max-content;
10
10
  max-width: ${({ $maxWidth }) => typeof $maxWidth === "number" ? `${$maxWidth}px` : $maxWidth};
11
11
  padding: 12px;
12
+ border: 1px solid var(--elevation-border-lg);
12
13
  border-radius: 10px;
13
- background: var(--stokr-background-surface-raised);
14
- color: var(--stokr-text-primary);
14
+ background: var(--background-surface-raised);
15
+ color: var(--text-primary);
15
16
  font-size: 14px;
16
17
  line-height: 18px;
17
18
  font-weight: 400;
@@ -21,9 +22,7 @@ const Bubble = styled.div`
21
22
  /* tippy.css supplied these; without them macOS subpixel AA renders noticeably heavier. */
22
23
  -webkit-font-smoothing: antialiased;
23
24
  -moz-osx-font-smoothing: grayscale;
24
- box-shadow:
25
- 0 0 12px 8px rgba(0, 0, 0, 0.03),
26
- 0 0 6px 3px rgba(0, 0, 0, 0.02);
25
+ box-shadow: var(--elevation-lg);
27
26
  `;
28
27
  export {
29
28
  Bubble,
@@ -1,5 +1,6 @@
1
1
  import styled, { css } from "styled-components";
2
2
  import dropdown from "../../static/images/arrow-down-black.svg.js";
3
+ import { text } from "../../design-system/styled/text.js";
3
4
  import { breakpoint } from "../../design-system/styled/breakpoint.js";
4
5
  const Breakdown = styled.div.withConfig({
5
6
  shouldForwardProp: (props) => ![
@@ -18,13 +19,10 @@ const Breakdown = styled.div.withConfig({
18
19
  "active"
19
20
  ].includes(props)
20
21
  })`
21
- text-transform: uppercase;
22
- letter-spacing: 2.1px;
23
- font-size: ${({ fontSize }) => fontSize ? `${fontSize}px` : "11px"};
22
+ ${text("label")}
23
+ ${({ fontSize }) => fontSize && `font-size: ${fontSize}px;`}
24
24
  white-space: ${({ withWordWrap }) => withWordWrap ? "unset" : "nowrap"};
25
- line-height: 2.18;
26
25
  color: inherit;
27
- font-weight: bolder;
28
26
  strong {
29
27
  font-weight: bold;
30
28
  }
@@ -4,7 +4,7 @@ import PropTypes from "prop-types";
4
4
  const _Logo = class _Logo extends PureComponent {
5
5
  render() {
6
6
  const { width, height } = this.props;
7
- return /* @__PURE__ */ jsx("svg", { width, height, viewBox: "0 0 70 17", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("g", { id: "Symbols", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ jsx("g", { id: "Top-Nav-1024", transform: "translate(-32 -39)", style: { fill: "var(--stokr-text-primary)" }, children: /* @__PURE__ */ jsx("g", { id: "Top-Nav", children: /* @__PURE__ */ jsx("g", { id: "Logo", transform: "translate(32 39)", children: /* @__PURE__ */ jsxs("g", { id: "Group", children: [
7
+ return /* @__PURE__ */ jsx("svg", { width, height, viewBox: "0 0 70 17", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("g", { id: "Symbols", fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ jsx("g", { id: "Top-Nav-1024", transform: "translate(-32 -39)", style: { fill: "var(--text-primary)" }, children: /* @__PURE__ */ jsx("g", { id: "Top-Nav", children: /* @__PURE__ */ jsx("g", { id: "Logo", transform: "translate(32 39)", children: /* @__PURE__ */ jsxs("g", { id: "Group", children: [
8
8
  /* @__PURE__ */ jsx(
9
9
  "path",
10
10
  {
@@ -10,13 +10,13 @@ html {
10
10
 
11
11
  body {
12
12
  margin: 0;
13
- font-family: var(--stokr-font-family-base);
14
- font-size: var(--stokr-text-body-m-size);
15
- line-height: var(--stokr-text-body-m-line-height);
16
- font-weight: var(--stokr-text-body-m-weight);
17
- letter-spacing: var(--stokr-text-body-m-letter-spacing);
18
- color: var(--stokr-text-body);
19
- background-color: var(--stokr-background-default);
13
+ font-family: var(--font-family-base);
14
+ font-size: var(--text-body-m-size);
15
+ line-height: var(--text-body-m-line-height);
16
+ font-weight: var(--text-body-m-weight);
17
+ letter-spacing: var(--text-body-m-letter-spacing);
18
+ color: var(--text-body);
19
+ background-color: var(--background-default);
20
20
  }
21
21
 
22
22
  /* Browsers give form controls their own font (Arial): take the page font. Zero specificity, any component still wins. */
@@ -25,17 +25,17 @@ body {
25
25
  }
26
26
 
27
27
  :where(strong, b) {
28
- font-weight: var(--stokr-font-weight-semibold);
28
+ font-weight: var(--font-weight-semibold);
29
29
  }
30
30
 
31
31
  /* The accent pair flips as a unit: white on blue in light, black on the brand green in dark. */
32
32
  ::selection {
33
- color: var(--stokr-action-accent-text);
34
- background-color: var(--stokr-action-accent-bg);
33
+ color: var(--action-accent-text);
34
+ background-color: var(--action-accent-bg);
35
35
  }
36
36
 
37
37
  :where(:focus-visible) {
38
- outline: 2px solid var(--stokr-border-focus);
38
+ outline: 2px solid var(--border-focus);
39
39
  outline-offset: 2px;
40
40
  }
41
41
 
@@ -46,8 +46,9 @@ body {
46
46
  * it behaves like the old element selectors and never outranks a component.
47
47
  */
48
48
  /* Normal specificity on purpose: `body {}` above is (0,0,1), a zero-specificity compat rule would lose to it. Nothing but the
49
- body element itself matches this, so it cannot outrank a component. Restores what remotes inherited: 10px text, tight line-height
50
- (this also keeps their `em` sizes exact; their `rem` values were converted to px). */
49
+ body element itself matches this, so it cannot outrank a component. Only the size and line-height are left to the remotes
50
+ (10px text, tight line-height: keeps their `em` sizes exact; their `rem` values were converted to px). Weight, letter-spacing
51
+ and font family are the one shared body above, on the host and on every remote: do not override them here. */
51
52
  body.mf-remote-route {
52
53
  font-size: 10px;
53
54
  line-height: 1;
@@ -69,6 +70,5 @@ body.mf-remote-route {
69
70
  }
70
71
 
71
72
  :where(body.mf-remote-route) :where(a) {
72
- font-weight: normal;
73
73
  color: inherit;
74
74
  }
@@ -0,0 +1,25 @@
1
+ import { FontFamilyName, ScaleName, TextSpec } from './tokens/index';
2
+ export declare const kebab: (s: string) => string;
3
+ export declare const textVar: (name: string, prop: string) => string;
4
+ /** The 24 text styles of a scale as [kebab-case name, spec]. */
5
+ export declare const textEntries: (scale: ScaleName) => [string, TextSpec][];
6
+ /** Desktop `--text-*` declarations of a scale (they sit inside `:root`), headed by a comment naming the scale. */
7
+ export declare const typeScaleDesktopDeclarations: (scale: ScaleName) => string[];
8
+ /** Mobile overrides of a scale (they sit inside `@media (max-width: 767px) { :root { … } }`). */
9
+ export declare const typeScaleMobileDeclarations: (scale: ScaleName) => string[];
10
+ /** `@media` block that holds the mobile overrides, formatted as in generated/tokens.css. */
11
+ export declare const mobileBlock: (declarations: string[]) => string[];
12
+ /**
13
+ * CSS text of the `--text-<name>-*` variables of one scale (desktop in `:root`, mobile in the `@media` block), and
14
+ * nothing else: no colour, no font. For a dev switch that previews another scale: inject it in a `<style>` after the
15
+ * design-system stylesheet.
16
+ */
17
+ export declare const typeScaleCss: (scale: ScaleName) => string;
18
+ /** The `@font-face` rules of a font family; `fileUrl` turns a file name of fonts/ into the url to load it from. */
19
+ export declare const fontFaceRules: (family: FontFamilyName, fileUrl: (file: string) => string) => string[];
20
+ /**
21
+ * Switches the font at runtime: the `:root { --font-family-base }` rule of `family` plus its `@font-face` rules.
22
+ * `urls` maps each woff2 file name of the family (e.g. `inter-latin.woff2`, `inter-latin-ext.woff2`) to the url to load
23
+ * it from, or is a function doing it. Inject it in a `<style>` after the design-system stylesheet.
24
+ */
25
+ export declare const fontCss: (family: FontFamilyName, urls: Record<string, string> | ((file: string) => string)) => string;
@@ -0,0 +1,81 @@
1
+ import { fontFamilies, MOBILE_MAX_WIDTH, textNames, scales } from "./tokens/typography.js";
2
+ import { fontFaces } from "./tokens/fonts.js";
3
+ const indent = (lines) => lines.map((l) => ` ${l}`);
4
+ const kebab = (s) => s.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
5
+ const textVar = (name, prop) => `--text-${name}-${prop}`;
6
+ const textVars = (name, s, desktop) => {
7
+ if (!s) return [];
8
+ const out = [];
9
+ if (s.size !== void 0) out.push(`${textVar(name, "size")}: ${s.size};`);
10
+ if (s.lineHeight !== void 0) out.push(`${textVar(name, "line-height")}: ${s.lineHeight};`);
11
+ if (s.weight !== void 0) out.push(`${textVar(name, "weight")}: ${s.weight};`);
12
+ if (s.letterSpacing !== void 0) out.push(`${textVar(name, "letter-spacing")}: ${s.letterSpacing};`);
13
+ if (desktop || s.uppercase !== void 0)
14
+ out.push(`${textVar(name, "transform")}: ${s.uppercase ? "uppercase" : "none"};`);
15
+ if (s.underline !== void 0) out.push(`${textVar(name, "decoration")}: ${s.underline ? "underline" : "none"};`);
16
+ return out;
17
+ };
18
+ const textEntries = (scale) => textNames.map((n) => [kebab(n), scales[scale][n]]);
19
+ const typeScaleDesktopDeclarations = (scale) => [
20
+ `/* type scale: ${scale} (desktop) */`,
21
+ ...textEntries(scale).flatMap(([n, spec]) => textVars(n, spec.desktop, true))
22
+ ];
23
+ const typeScaleMobileDeclarations = (scale) => textEntries(scale).flatMap(([n, spec]) => textVars(n, spec.mobile, false));
24
+ const mobileBlock = (declarations) => [
25
+ `@media (max-width: ${MOBILE_MAX_WIDTH}) {`,
26
+ " :root {",
27
+ ...indent(indent(declarations)),
28
+ " }",
29
+ "}"
30
+ ];
31
+ const typeScaleCss = (scale) => [
32
+ ":root {",
33
+ ...indent(typeScaleDesktopDeclarations(scale)),
34
+ "}",
35
+ "",
36
+ ...mobileBlock(typeScaleMobileDeclarations(scale)),
37
+ ""
38
+ ].join("\n");
39
+ const face = (family, url, weight, style, range, stretch) => `@font-face {
40
+ font-family: '${family}';
41
+ font-style: ${style};
42
+ font-weight: ${weight};
43
+ ${stretch ? " font-stretch: 100%;\n" : ""} font-display: swap;
44
+ src: url('${url}') format('woff2');
45
+ unicode-range: ${range};
46
+ }`;
47
+ const fontFaceRules = (family, fileUrl) => fontFaces[family].flatMap(
48
+ (set) => set.files.flatMap(
49
+ (f) => (
50
+ // Variable file: one face covering the whole weight range; static files: one face per weight.
51
+ (set.weightRange ? [`${set.weightRange[0]} ${set.weightRange[1]}`] : set.weights).map(
52
+ (w) => face(set.family, fileUrl(f.file), w, f.style, f.range, set.stretch)
53
+ )
54
+ )
55
+ )
56
+ );
57
+ const fontCss = (family, urls) => {
58
+ const fileUrl = typeof urls === "function" ? urls : (file) => {
59
+ const url = urls[file];
60
+ if (!url) throw new Error(`fontCss('${family}'): no url for ${file}`);
61
+ return url;
62
+ };
63
+ return [
64
+ `:root {
65
+ --font-family-base: ${fontFamilies[family]};
66
+ }`,
67
+ ...fontFaceRules(family, fileUrl),
68
+ ""
69
+ ].join("\n\n");
70
+ };
71
+ export {
72
+ fontCss,
73
+ fontFaceRules,
74
+ kebab,
75
+ mobileBlock,
76
+ textEntries,
77
+ textVar,
78
+ typeScaleCss,
79
+ typeScaleDesktopDeclarations,
80
+ typeScaleMobileDeclarations
81
+ };
@@ -20,16 +20,6 @@
20
20
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
21
21
  }
22
22
 
23
- @font-face {
24
- font-family: 'Open Sans';
25
- font-style: normal;
26
- font-weight: 500;
27
- font-stretch: 100%;
28
- font-display: swap;
29
- src: url('../fonts/open-sans-latin-ext.woff2') format('woff2');
30
- unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
31
- }
32
-
33
23
  @font-face {
34
24
  font-family: 'Open Sans';
35
25
  font-style: normal;
@@ -80,16 +70,6 @@
80
70
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
81
71
  }
82
72
 
83
- @font-face {
84
- font-family: 'Open Sans';
85
- font-style: normal;
86
- font-weight: 500;
87
- font-stretch: 100%;
88
- font-display: swap;
89
- src: url('../fonts/open-sans-latin.woff2') format('woff2');
90
- unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
91
- }
92
-
93
73
  @font-face {
94
74
  font-family: 'Open Sans';
95
75
  font-style: normal;
@@ -140,16 +120,6 @@
140
120
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
141
121
  }
142
122
 
143
- @font-face {
144
- font-family: 'Open Sans';
145
- font-style: italic;
146
- font-weight: 500;
147
- font-stretch: 100%;
148
- font-display: swap;
149
- src: url('../fonts/open-sans-latin-ext-italic.woff2') format('woff2');
150
- unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
151
- }
152
-
153
123
  @font-face {
154
124
  font-family: 'Open Sans';
155
125
  font-style: italic;
@@ -200,16 +170,6 @@
200
170
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
201
171
  }
202
172
 
203
- @font-face {
204
- font-family: 'Open Sans';
205
- font-style: italic;
206
- font-weight: 500;
207
- font-stretch: 100%;
208
- font-display: swap;
209
- src: url('../fonts/open-sans-latin-italic.woff2') format('woff2');
210
- unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
211
- }
212
-
213
173
  @font-face {
214
174
  font-family: 'Open Sans';
215
175
  font-style: italic;
@@ -258,15 +218,6 @@
258
218
  unicode-range: U+20BF;
259
219
  }
260
220
 
261
- @font-face {
262
- font-family: 'Open Sans';
263
- font-style: normal;
264
- font-weight: 500;
265
- font-display: swap;
266
- src: url('../fonts/inter-bitcoin-sign.woff2') format('woff2');
267
- unicode-range: U+20BF;
268
- }
269
-
270
221
  @font-face {
271
222
  font-family: 'Open Sans';
272
223
  font-style: normal;