@stokr/components-library 5.0.0 → 5.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/README.md +8 -8
  2. package/dist/components/AddressItem/AddressItem.d.ts +38 -0
  3. package/dist/components/AddressItem/AddressItem.js +51 -0
  4. package/dist/components/AddressItem/AddressItem.styles.d.ts +31 -0
  5. package/dist/components/AddressItem/AddressItem.styles.js +71 -0
  6. package/dist/components/AdminDashboard/Table/Table.styles.js +18 -25
  7. package/dist/components/AgreementItem/AgreementItem.styles.js +1 -1
  8. package/dist/components/BackButton/BackButton.styles.js +15 -15
  9. package/dist/components/BasicTable/BasicTable.styles.js +6 -8
  10. package/dist/components/BlogPost/BlogPost.styles.js +9 -13
  11. package/dist/components/Button/Button.styles.d.ts +1 -1
  12. package/dist/components/Button/Button.styles.js +122 -11
  13. package/dist/components/Button/GlareButton.js +1 -1
  14. package/dist/components/Card/Card.styles.js +3 -4
  15. package/dist/components/CardTabs/CardTabs.styles.js +17 -17
  16. package/dist/components/ChartLegend/ChartLegend.styles.js +6 -7
  17. package/dist/components/Checkbox/Checkbox.styles.d.ts +1 -0
  18. package/dist/components/Checkbox/Checkbox.styles.js +10 -11
  19. package/dist/components/Checklist/ChecklistCard.js +3 -3
  20. package/dist/components/Checklist/ChecklistCard.styles.js +7 -20
  21. package/dist/components/Chips/Chip.js +2 -2
  22. package/dist/components/Chips/Chip.styles.js +6 -10
  23. package/dist/components/Collapsible/Collapsible.d.ts +10 -4
  24. package/dist/components/Collapsible/Collapsible.js +6 -14
  25. package/dist/components/Collapsible/Collapsible.styles.d.ts +3 -1
  26. package/dist/components/Collapsible/Collapsible.styles.js +33 -16
  27. package/dist/components/ComponentScroll/ComponentScroll.styles.js +5 -5
  28. package/dist/components/ComponentWrapper/ComponentWrapper.styles.js +5 -5
  29. package/dist/components/ConfirmModal/ConfirmModal.styles.js +2 -2
  30. package/dist/components/Country/CountrySelect.js +15 -20
  31. package/dist/components/Country/FlagFor.d.ts +9 -0
  32. package/dist/components/Country/FlagFor.js +25 -0
  33. package/dist/components/Country/flagLoaders.d.ts +5 -0
  34. package/dist/components/Country/flagLoaders.js +270 -0
  35. package/dist/components/Country/flagStore.d.ts +6 -0
  36. package/dist/components/Country/flagStore.js +29 -0
  37. package/dist/components/CryptoAddress/CryptoAddress.d.ts +6 -2
  38. package/dist/components/CryptoAddress/CryptoAddress.js +2 -2
  39. package/dist/components/CryptoAddress/CryptoAddress.styles.d.ts +2 -1
  40. package/dist/components/CryptoAddress/CryptoAddress.styles.js +20 -27
  41. package/dist/components/CryptoAddressWrapper/CryptoAddressWrapper.styles.js +2 -2
  42. package/dist/components/FAQ/FAQ.d.ts +29 -0
  43. package/dist/components/FAQ/FAQ.js +18 -18
  44. package/dist/components/FAQ/FAQ.styles.d.ts +11 -3
  45. package/dist/components/FAQ/FAQ.styles.js +59 -10
  46. package/dist/components/Form/Form.styles.js +5 -5
  47. package/dist/components/Grid/Grid.styles.js +7 -7
  48. package/dist/components/IdentityInfo/IdentityInfo.js +2 -1
  49. package/dist/components/IdentityInfo/IdentityInfo.styles.js +13 -23
  50. package/dist/components/InfoBox/InfoBox.d.ts +15 -13
  51. package/dist/components/InfoBox/InfoBox.js +31 -14
  52. package/dist/components/InfoIcon/InfoIcon.styles.js +2 -2
  53. package/dist/components/Input/DatePickerInput.styles.js +23 -24
  54. package/dist/components/Input/Input.d.ts +3 -0
  55. package/dist/components/Input/Input.js +5 -2
  56. package/dist/components/Input/Input.styles.d.ts +4 -0
  57. package/dist/components/Input/Input.styles.js +77 -27
  58. package/dist/components/Input/InputPassword.styles.js +11 -11
  59. package/dist/components/Input/InputWithButton.styles.js +5 -5
  60. package/dist/components/Input/MultiSelect.js +17 -17
  61. package/dist/components/Input/OtpInput.js +1 -1
  62. package/dist/components/Input/RangeInput.js +2 -2
  63. package/dist/components/Input/SearchInput.styles.js +10 -10
  64. package/dist/components/Input/Select.d.ts +57 -0
  65. package/dist/components/Input/Select.js +101 -106
  66. package/dist/components/Input/Select.styles.d.ts +89 -0
  67. package/dist/components/Input/Select.styles.js +115 -19
  68. package/dist/components/Input/TableFilterDropdown.js +5 -5
  69. package/dist/components/Input/Textarea.styles.js +11 -13
  70. package/dist/components/MaterialIcon/requiredIcons.d.ts +1 -1
  71. package/dist/components/MaterialIcon/requiredIcons.js +2 -0
  72. package/dist/components/MenuNav/MenuNav.styles.js +2 -5
  73. package/dist/components/Modal/Modal.styles.js +25 -31
  74. package/dist/components/Modal/PaymentModal.js +7 -7
  75. package/dist/components/Modal/SideModal.styles.js +8 -8
  76. package/dist/components/Modal/SideModalParts.js +15 -16
  77. package/dist/components/Modal/SuccessModal/SuccessModal.styles.js +5 -8
  78. package/dist/components/NotificationCounter/NotificationCounter.styles.js +2 -2
  79. package/dist/components/Number/Number.js +1 -1
  80. package/dist/components/Number/Number.styles.js +2 -2
  81. package/dist/components/Pagination/Pagination.styles.js +7 -7
  82. package/dist/components/PanelCard/PanelCard.d.ts +51 -0
  83. package/dist/components/PanelCard/PanelCard.js +35 -0
  84. package/dist/components/PanelCard/PanelCard.styles.d.ts +29 -0
  85. package/dist/components/PanelCard/PanelCard.styles.js +84 -0
  86. package/dist/components/Payment/DetailRows.js +1 -1
  87. package/dist/components/Payment/DetailsToggle.js +4 -6
  88. package/dist/components/Payment/PaymentDetailsCard.js +29 -53
  89. package/dist/components/Payment/PaymentDisplay.js +12 -20
  90. package/dist/components/Payment/PaymentPendingCard.d.ts +1 -1
  91. package/dist/components/Payment/PaymentPendingCard.js +10 -13
  92. package/dist/components/Payment/PaymentSuccessCard.js +6 -9
  93. package/dist/components/Payment/TimerComponent.js +5 -4
  94. package/dist/components/Process/Process.styles.js +7 -13
  95. package/dist/components/ProfileBadge/ProfileBadge.styles.js +8 -10
  96. package/dist/components/ProfileBox/ProfileBox.styles.js +5 -7
  97. package/dist/components/Radio/Radio.styles.d.ts +1 -0
  98. package/dist/components/Radio/Radio.styles.js +8 -9
  99. package/dist/components/RefreshButton/RefreshButton.styles.js +5 -5
  100. package/dist/components/RequestDataBox/RequestDataBox.styles.js +3 -5
  101. package/dist/components/Section/Section.styles.js +16 -18
  102. package/dist/components/SectionTitle/SectionTitle.styles.d.ts +4 -0
  103. package/dist/components/SectionTitle/SectionTitle.styles.js +4 -7
  104. package/dist/components/Skeleton/Skeleton.d.ts +1 -1
  105. package/dist/components/Skeleton/Skeleton.js +3 -3
  106. package/dist/components/Snackbar/Snackbar.styles.js +8 -10
  107. package/dist/components/SpanButton/SpanButton.styles.js +2 -2
  108. package/dist/components/StatusDot/StatusDot.d.ts +1 -1
  109. package/dist/components/StatusDot/StatusDot.js +5 -5
  110. package/dist/components/StatusDot/StatusDot.styles.js +2 -5
  111. package/dist/components/StatusTag/StatusTag.js +1 -1
  112. package/dist/components/StatusTag/StatusTag.styles.js +4 -4
  113. package/dist/components/StepController/StepController.styles.js +7 -7
  114. package/dist/components/StepSidebar/MobileStepProgress.d.ts +12 -0
  115. package/dist/components/StepSidebar/MobileStepProgress.js +14 -0
  116. package/dist/components/StepSidebar/MobileStepProgress.styles.d.ts +15 -0
  117. package/dist/components/StepSidebar/MobileStepProgress.styles.js +39 -0
  118. package/dist/components/StepSidebar/StepProgress.d.ts +14 -0
  119. package/dist/components/StepSidebar/StepProgress.js +14 -0
  120. package/dist/components/StepSidebar/StepProgress.styles.d.ts +30 -0
  121. package/dist/components/StepSidebar/StepProgress.styles.js +97 -0
  122. package/dist/components/StepSidebar/StepSidebar.d.ts +36 -0
  123. package/dist/components/StepSidebar/StepSidebar.js +58 -0
  124. package/dist/components/StepSidebar/StepSidebar.styles.d.ts +55 -0
  125. package/dist/components/StepSidebar/StepSidebar.styles.js +168 -0
  126. package/dist/components/StokrLoader/StokrLoader.d.ts +16 -2
  127. package/dist/components/StokrLoader/StokrLoader.js +170 -28
  128. package/dist/components/StokrLoader/loaderSession.d.ts +14 -0
  129. package/dist/components/StokrLoader/loaderSession.js +30 -0
  130. package/dist/components/Switch/Switch.styles.js +12 -14
  131. package/dist/components/TabsNav/TabsNav.styles.js +7 -9
  132. package/dist/components/TaxResidenceCard/TaxResidenceCard.js +26 -11
  133. package/dist/components/TaxResidenceCard/TaxResidenceCard.styles.d.ts +29 -12
  134. package/dist/components/TaxResidenceCard/TaxResidenceCard.styles.js +103 -30
  135. package/dist/components/Text/Text.styles.d.ts +2 -1
  136. package/dist/components/Text/Text.styles.js +36 -70
  137. package/dist/components/TextLink/TextLink.styles.js +5 -7
  138. package/dist/components/Timeline/Timeline.styles.js +17 -23
  139. package/dist/components/Tooltip/Tooltip.d.ts +1 -1
  140. package/dist/components/Tooltip/Tooltip.js +1 -2
  141. package/dist/components/Tooltip/Tooltip.styles.js +4 -5
  142. package/dist/components/breakdown/Breakdown.js +3 -5
  143. package/dist/components/logo/Logo.js +1 -1
  144. package/dist/constants/chainLogos.d.ts +9 -0
  145. package/dist/constants/chainLogos.js +17 -0
  146. package/dist/design-system/css/base.css +14 -14
  147. package/dist/design-system/css-builders.d.ts +25 -0
  148. package/dist/design-system/css-builders.js +81 -0
  149. package/dist/design-system/generated/fonts.css +0 -49
  150. package/dist/design-system/generated/text-classes.css +123 -123
  151. package/dist/design-system/generated/text-styles.d.ts +24 -24
  152. package/dist/design-system/generated/text-styles.js +123 -123
  153. package/dist/design-system/generated/tokens.css +417 -412
  154. package/dist/design-system/index.d.ts +2 -1
  155. package/dist/design-system/styled/build-theme.js +1 -1
  156. package/dist/design-system/tokens/colors.d.ts +1 -1
  157. package/dist/design-system/tokens/colors.js +1 -1
  158. package/dist/design-system/tokens/fonts.d.ts +6 -2
  159. package/dist/design-system/tokens/fonts.js +1 -1
  160. package/dist/design-system/tokens/semantic.d.ts +15 -3
  161. package/dist/design-system/tokens/semantic.js +5 -1
  162. package/dist/design-system/tokens/typography.d.ts +1 -1
  163. package/dist/design-system/tokens/typography.js +64 -41
  164. package/dist/index.d.ts +84 -7
  165. package/dist/index.js +24 -4
  166. package/dist/static/images/chains/avalanche.svg +7 -0
  167. package/dist/static/images/chains/avalanche.svg.js +4 -0
  168. package/dist/static/images/chains/ethereum.svg +14 -0
  169. package/dist/static/images/chains/ethereum.svg.js +4 -0
  170. package/dist/static/images/chains/liquid.svg +7 -0
  171. package/dist/static/images/chains/liquid.svg.js +4 -0
  172. package/dist/static/images/chains/solana.svg +29 -0
  173. package/dist/static/images/chains/solana.svg.js +4 -0
  174. package/dist/static/images/chains/stellar.svg +17 -0
  175. package/dist/static/images/chains/stellar.svg.js +4 -0
  176. package/dist/static/images/chains/tempo.svg +11 -0
  177. package/dist/static/images/chains/tempo.svg.js +4 -0
  178. package/dist/styles/borderedField.d.ts +11 -0
  179. package/dist/styles/borderedField.js +53 -0
  180. package/package.json +1 -1
  181. package/dist/static/images/globe.svg.js +0 -5
  182. package/dist/static/images/trash.svg +0 -17
  183. package/dist/static/images/trash.svg.js +0 -5
@@ -10,7 +10,7 @@ const Container = styled.div.withConfig({
10
10
  ${(props) => props.separatorTop && `
11
11
  padding-top: 20px;
12
12
  margin-top: 20px;
13
- border-top: 1px solid var(--stokr-border-subtle);
13
+ border-top: 1px solid var(--border-subtle);
14
14
  `}
15
15
  `;
16
16
  const InputWrap = styled.div`
@@ -30,21 +30,21 @@ const Input = styled.input`
30
30
  width: 100%;
31
31
  padding: 9px 23px;
32
32
  padding-right: 63px;
33
- font-family: var(--stokr-font-family-base);
33
+ font-family: var(--font-family-base);
34
34
  font-size: 14px;
35
35
  line-height: 20px;
36
- border: 1px solid var(--stokr-border-subtle);
36
+ border: 1px solid var(--border-subtle);
37
37
  border-radius: 20px;
38
38
  outline: 0;
39
39
  transition: border-color 0.2s;
40
40
 
41
41
  &:focus,
42
42
  &:hover {
43
- border: 1px solid var(--stokr-border-focus);
43
+ border: 1px solid var(--border-focus);
44
44
  }
45
45
 
46
46
  &::placeholder {
47
- color: var(--stokr-text-tertiary);
47
+ color: var(--text-tertiary);
48
48
  opacity: 1;
49
49
  }
50
50
  `;
@@ -13,8 +13,8 @@ const CountBadge = styled.span`
13
13
  min-width: 18px;
14
14
  height: 18px;
15
15
  padding: 0 6px;
16
- background-color: var(--stokr-action-primary-bg);
17
- color: var(--stokr-action-primary-text);
16
+ background-color: var(--action-primary-bg);
17
+ color: var(--action-primary-text);
18
18
  border-radius: 10px;
19
19
  font-size: 12px;
20
20
  font-weight: 600;
@@ -28,7 +28,7 @@ const CheckboxWrapperDiv = styled.div`
28
28
  transition: background-color 0.15s ease;
29
29
 
30
30
  &:hover {
31
- background-color: var(--stokr-action-outline-bg-hover);
31
+ background-color: var(--action-outline-bg-hover);
32
32
  }
33
33
  `;
34
34
  const CheckboxDiv = styled.div.withConfig({
@@ -36,13 +36,13 @@ const CheckboxDiv = styled.div.withConfig({
36
36
  })`
37
37
  width: 14px;
38
38
  height: 14px;
39
- border: 1px solid ${(props) => props.isSelected ? "var(--stokr-text-primary)" : "var(--stokr-text-tertiary)"};
39
+ border: 1px solid ${(props) => props.isSelected ? "var(--text-primary)" : "var(--text-tertiary)"};
40
40
  border-radius: 3px;
41
41
  margin-right: 12px;
42
42
  display: flex;
43
43
  align-items: center;
44
44
  justify-content: center;
45
- background-color: ${(props) => props.isSelected ? "var(--stokr-brand-pure-white)" : "var(--stokr-brand-pure-white)"};
45
+ background-color: ${(props) => props.isSelected ? "var(--brand-pure-white)" : "var(--brand-pure-white)"};
46
46
  transition: all 0.15s ease;
47
47
  flex-shrink: 0;
48
48
 
@@ -54,12 +54,12 @@ const CheckboxDiv = styled.div.withConfig({
54
54
  }
55
55
 
56
56
  svg path {
57
- stroke: var(--stokr-action-accent-bg);
57
+ stroke: var(--action-accent-bg);
58
58
  }
59
59
  `;
60
60
  const OptionLabel = styled.span`
61
61
  font-size: 14px;
62
- color: var(--stokr-text-primary);
62
+ color: var(--text-primary);
63
63
  font-weight: 400;
64
64
  letter-spacing: 0.6px;
65
65
  line-height: 1.5;
@@ -71,7 +71,7 @@ const OptionLabel = styled.span`
71
71
  `;
72
72
  const PlaceholderText = styled.span`
73
73
  font-size: 14px;
74
- color: var(--stokr-text-primary);
74
+ color: var(--text-primary);
75
75
  font-weight: 400;
76
76
  `;
77
77
  const CheckboxOption = (props) => {
@@ -176,23 +176,23 @@ const MultiSelect = (props) => {
176
176
  alignItems: "center",
177
177
  // minHeight: '44px',
178
178
  padding: "0 10px",
179
- backgroundColor: "var(--stokr-background-default)",
180
- border: `1px solid ${state.isFocused ? "var(--stokr-border-default)" : "var(--stokr-border-subtle)"}`,
179
+ backgroundColor: "var(--background-default)",
180
+ border: `1px solid ${state.isFocused ? "var(--border-default)" : "var(--border-subtle)"}`,
181
181
  borderRadius: "10px",
182
182
  boxShadow: "none",
183
183
  cursor: "pointer",
184
184
  "&:hover": {
185
- borderColor: "var(--stokr-border-default)"
185
+ borderColor: "var(--border-default)"
186
186
  }
187
187
  }),
188
188
  menu: (baseStyle) => ({
189
189
  ...baseStyle,
190
190
  marginTop: "4px",
191
191
  zIndex: 1e3,
192
- backgroundColor: "var(--stokr-background-surface-raised)",
192
+ backgroundColor: "var(--background-surface-raised)",
193
193
  borderRadius: "8px",
194
194
  boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)",
195
- border: `1px solid var(--stokr-border-subtle)`,
195
+ border: `1px solid var(--border-subtle)`,
196
196
  overflow: "hidden",
197
197
  minWidth: minMenuWidth,
198
198
  maxWidth: maxMenuWidth,
@@ -207,15 +207,15 @@ const MultiSelect = (props) => {
207
207
  // When using checkboxes, padding is handled by CheckboxOption
208
208
  // Otherwise, add padding for the default option
209
209
  padding: showCheckboxes ? 0 : "12px 16px",
210
- backgroundColor: state.isFocused ? "var(--stokr-action-outline-bg-hover)" : "transparent",
211
- color: "var(--stokr-text-primary)",
210
+ backgroundColor: state.isFocused ? "var(--action-outline-bg-hover)" : "transparent",
211
+ color: "var(--text-primary)",
212
212
  cursor: "pointer",
213
213
  fontWeight: state.isSelected ? 600 : 400,
214
214
  whiteSpace: "nowrap",
215
215
  overflow: "hidden",
216
216
  textOverflow: "ellipsis",
217
217
  "&:active": {
218
- backgroundColor: "var(--stokr-action-outline-bg-hover)"
218
+ backgroundColor: "var(--action-outline-bg-hover)"
219
219
  }
220
220
  }),
221
221
  valueContainer: (baseStyle) => ({
@@ -236,7 +236,7 @@ const MultiSelect = (props) => {
236
236
  ...baseStyle,
237
237
  margin: 0,
238
238
  padding: 0,
239
- color: "var(--stokr-text-primary)"
239
+ color: "var(--text-primary)"
240
240
  }),
241
241
  indicatorsContainer: (baseStyle) => ({
242
242
  ...baseStyle,
@@ -7,7 +7,7 @@ import { breakpoint } from "../../design-system/styled/breakpoint.js";
7
7
  const inputStyle = {
8
8
  outline: "none",
9
9
  border: "none",
10
- borderBottom: `1.5px solid var(--stokr-border-strong)`,
10
+ borderBottom: `1.5px solid var(--border-strong)`,
11
11
  padding: "10px",
12
12
  paddingBottom: "2px",
13
13
  minWidth: 30,
@@ -30,7 +30,7 @@ const RangeInput = ({
30
30
  borderRadius: "10px",
31
31
  background: getTrackBackground({
32
32
  values: [value],
33
- colors: ["var(--stokr-action-accent-bg)", "var(--stokr-border-subtle)"],
33
+ colors: ["var(--action-accent-bg)", "var(--border-subtle)"],
34
34
  min,
35
35
  max
36
36
  })
@@ -47,7 +47,7 @@ const RangeInput = ({
47
47
  ...props.style,
48
48
  height: "24px",
49
49
  width: "24px",
50
- backgroundColor: "var(--stokr-action-accent-bg)",
50
+ backgroundColor: "var(--action-accent-bg)",
51
51
  borderRadius: "50%",
52
52
  border: "4px solid white"
53
53
  }
@@ -16,8 +16,8 @@ const SearchInputWrapper = styled.div.withConfig({
16
16
  transition: all 0.2s ease;
17
17
 
18
18
  /* Default filled variant */
19
- background-color: ${(props) => props.variant === "outlined" ? "transparent" : "var(--stokr-background-surface)"};
20
- border: ${(props) => props.variant === "outlined" ? `1px solid var(--stokr-border-subtle)` : "1px solid transparent"};
19
+ background-color: ${(props) => props.variant === "outlined" ? "transparent" : "var(--background-surface)"};
20
+ border: ${(props) => props.variant === "outlined" ? `1px solid var(--border-subtle)` : "1px solid transparent"};
21
21
 
22
22
  ${(props) => props.disabled && `
23
23
  opacity: 0.6;
@@ -25,13 +25,13 @@ const SearchInputWrapper = styled.div.withConfig({
25
25
  `}
26
26
 
27
27
  &:focus-within {
28
- background-color: ${(props) => props.variant === "outlined" ? "transparent" : "var(--stokr-background-default)"};
29
- border-color: ${(props) => props.variant === "outlined" ? "var(--stokr-border-default)" : "transparent"};
30
- box-shadow: ${(props) => props.variant === "outlined" ? "none" : `0 0 0 2px var(--stokr-border-subtle)`};
28
+ background-color: ${(props) => props.variant === "outlined" ? "transparent" : "var(--background-default)"};
29
+ border-color: ${(props) => props.variant === "outlined" ? "var(--border-default)" : "transparent"};
30
+ box-shadow: ${(props) => props.variant === "outlined" ? "none" : `0 0 0 2px var(--border-subtle)`};
31
31
  }
32
32
 
33
33
  &:hover {
34
- border-color: ${(props) => props.variant === "outlined" ? "var(--stokr-border-default)" : "transparent"};
34
+ border-color: ${(props) => props.variant === "outlined" ? "var(--border-default)" : "transparent"};
35
35
  }
36
36
  `;
37
37
  const SearchIconWrapper = styled.div`
@@ -39,7 +39,7 @@ const SearchIconWrapper = styled.div`
39
39
  align-items: center;
40
40
  justify-content: center;
41
41
  margin-right: 12px;
42
- color: var(--stokr-text-tertiary);
42
+ color: var(--text-tertiary);
43
43
  flex-shrink: 0;
44
44
  width: 16px;
45
45
  height: 16px;
@@ -50,7 +50,7 @@ const SearchIconWrapper = styled.div`
50
50
  }
51
51
 
52
52
  ${SearchInputWrapper}:focus-within & {
53
- color: var(--stokr-text-primary);
53
+ color: var(--text-primary);
54
54
  }
55
55
  `;
56
56
  const SearchInputField = styled.input`
@@ -61,13 +61,13 @@ const SearchInputField = styled.input`
61
61
  font-size: 14px;
62
62
  font-weight: 400;
63
63
  line-height: 18px;
64
- color: var(--stokr-text-primary);
64
+ color: var(--text-primary);
65
65
  width: 100%;
66
66
  min-width: 0;
67
67
  letter-spacing: 0.6px;
68
68
 
69
69
  &::placeholder {
70
- color: var(--stokr-text-tertiary);
70
+ color: var(--text-tertiary);
71
71
  opacity: 1;
72
72
  }
73
73
 
@@ -0,0 +1,57 @@
1
+ import { ReactNode } from 'react';
2
+ import { GroupBase, Props as ReactSelectProps } from 'react-select';
3
+ import { FieldVariant } from '../../styles/borderedField';
4
+ import { SelectIcon, SelectMenu, SelectOption, SelectControl, SelectWrapper, SelectMenuList, SelectContainer, SelectValueContainer } from './Select.styles';
5
+ export type SelectValue = string | number;
6
+ export interface SelectOptionItem {
7
+ key?: string;
8
+ value: SelectValue;
9
+ label: ReactNode;
10
+ /** URL string (rendered as <img>) or a React node (e.g. an SVG flag) shown left of the label. */
11
+ icon?: ReactNode;
12
+ }
13
+ /** What `onChange` / `onBlur` / `onFocus` receive. `value` is the option value, or an array of values in `multiple` mode. */
14
+ export interface SelectChange {
15
+ name: string;
16
+ value: any;
17
+ }
18
+ type PassthroughProps = ReactSelectProps<any, boolean, GroupBase<any>>;
19
+ type OwnPropKeys = 'id' | 'name' | 'value' | 'options' | 'placeholder' | 'onChange' | 'onBlur' | 'onFocus' | 'formatCreateLabel' | 'dataCy' | 'variant';
20
+ export interface SelectProps extends Omit<PassthroughProps, OwnPropKeys> {
21
+ id: string;
22
+ name: string;
23
+ label?: string;
24
+ /** string|number for single mode, array for multi mode. */
25
+ value?: SelectValue | readonly SelectValue[];
26
+ options: readonly SelectOptionItem[];
27
+ placeholder?: string;
28
+ /** Shown as an error state once `touched` is true. */
29
+ error?: boolean;
30
+ touched?: boolean;
31
+ disabled?: boolean;
32
+ /** Lets the user type to filter the options. */
33
+ search?: boolean;
34
+ /** Lets the user add a value that is not in `options`. */
35
+ creatable?: boolean;
36
+ /** Multi-select: checkbox options + chips list rendered below the field. */
37
+ multiple?: boolean;
38
+ /** Multi mode: values that cannot be removed (chip ✕ disabled, can't be deselected). */
39
+ lockedValues?: readonly SelectValue[];
40
+ /** Max menu height in px. */
41
+ menuHeight?: number;
42
+ /** Heading shown above the chips list in multi mode (default: "Selected"). */
43
+ selectedLabel?: string;
44
+ /** Input-like floating label behavior: label starts in-field, moves up on focus/value. Ignored when `bordered`. */
45
+ floatingLabel?: boolean;
46
+ formatCreateLabel?: (input: string) => ReactNode;
47
+ onChange?(field: SelectChange): void;
48
+ onBlur?(field: SelectChange): void;
49
+ onFocus?(field: SelectChange): void;
50
+ /** Playwright / autocapture: `data-cy` selector on the react-select control. */
51
+ dataCy?: string;
52
+ /** `bordered`: boxed control with a static label above (sign-up redesign). Default keeps the underline look. */
53
+ variant?: FieldVariant;
54
+ }
55
+ /** Dropdown with a floating label on react-select: single, searchable, multiple (checkboxes + chips) or creatable. */
56
+ declare const Select: (props: SelectProps) => import("react/jsx-runtime").JSX.Element;
57
+ export { Select, SelectControl, SelectMenu, SelectMenuList, SelectOption, SelectContainer, SelectValueContainer, SelectIcon, SelectWrapper, };
@@ -1,64 +1,72 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
- import PropTypes from "prop-types";
2
+ import { useState, useMemo, useRef, useEffect } from "react";
3
3
  import { Wrapper, Label } from "./Input.styles.js";
4
+ import { MaterialIcon } from "../MaterialIcon/MaterialIcon.js";
4
5
  import { OptionCheckbox } from "../Checkbox/OptionCheckbox.js";
5
- import { useState, useMemo, useRef, useEffect } from "react";
6
6
  import CreatableSelect from "react-select/creatable";
7
7
  import ReactSelect, { components } from "react-select";
8
- import { SelectContainer, SelectControl, SelectedChipsWrapper, SelectedChipsTitle, SelectedChipsList, SelectedChip, SelectedChipLabel, SelectedChipRemove, OptionRow, OptionLabel, SelectMenuList, SelectIcon, OptionIcon } from "./Select.styles.js";
8
+ import { BORDERED_BORDER } from "../../styles/borderedField.js";
9
+ import { borderedControlCss, SelectedChipsWrapper, SelectedChipsTitle, SelectedChipsList, SelectedChip, SelectedChipLabel, SelectedChipRemove, OptionRow, OptionLabel, SelectMenuList, SelectIcon, SelectContainer, SelectControl, OptionIcon } from "./Select.styles.js";
9
10
  import { SelectMenu, SelectOption, SelectValueContainer, SelectWrapper } from "./Select.styles.js";
10
- const renderIcon = (icon) => {
11
+ const renderIcon = (icon, variant) => {
11
12
  if (!icon) return null;
12
13
  if (typeof icon === "string") {
13
- return /* @__PURE__ */ jsx(OptionIcon, { children: /* @__PURE__ */ jsx("img", { src: icon, alt: "" }) });
14
+ return /* @__PURE__ */ jsx(OptionIcon, { $variant: variant, children: /* @__PURE__ */ jsx("img", { src: icon, alt: "" }) });
14
15
  }
15
- return /* @__PURE__ */ jsx(OptionIcon, { children: icon });
16
+ return /* @__PURE__ */ jsx(OptionIcon, { $variant: variant, children: icon });
16
17
  };
18
+ const asStyle = (value) => value;
19
+ const buildBorderedOptionStyle = (_base, state) => asStyle({
20
+ cursor: "pointer",
21
+ padding: "10px 16px",
22
+ fontSize: 14,
23
+ lineHeight: "20px",
24
+ border: 0,
25
+ color: "var(--text-primary)",
26
+ transition: "background-color 0.12s ease",
27
+ fontWeight: state.isSelected ? 600 : 400,
28
+ backgroundColor: state.isFocused ? "var(--background-surface)" : "transparent"
29
+ });
17
30
  const buildOptionStyle = (multiple) => (base, state) => {
18
31
  if (multiple) {
19
- return {
32
+ return asStyle({
20
33
  cursor: "pointer",
21
34
  padding: "10px 14px",
22
35
  fontSize: 13,
23
36
  lineHeight: "18px",
24
37
  border: 0,
25
- color: "var(--stokr-text-primary)",
38
+ color: "var(--text-primary)",
26
39
  transition: "background-color 0.12s ease",
27
40
  fontWeight: state.isSelected ? 600 : 400,
28
- backgroundColor: state.isSelected ? "var(--stokr-action-secondary-bg)" : state.isFocused ? "var(--stokr-background-surface)" : "transparent"
29
- };
41
+ backgroundColor: state.isSelected ? "var(--action-secondary-bg)" : state.isFocused ? "var(--background-surface)" : "transparent"
42
+ });
30
43
  }
31
- return {
44
+ return asStyle({
32
45
  ...base,
33
46
  cursor: "pointer",
34
- color: "var(--stokr-text-primary)",
47
+ /* Same box as `SelectOption` (the base would inherit the page font size, 10px in a remote). */
48
+ padding: "8px 0 8px 4px",
49
+ fontSize: 12,
50
+ lineHeight: "18px",
51
+ border: 0,
52
+ color: "var(--text-primary)",
35
53
  backgroundColor: "transparent",
36
54
  fontWeight: state.isSelected || state.isFocused ? "bold" : "normal",
37
- ":active": { backgroundColor: "var(--stokr-action-secondary-bg)" }
38
- };
39
- };
40
- const DropdownIndicator = (props) => /* @__PURE__ */ jsx(components.DropdownIndicator, { ...props, children: /* @__PURE__ */ jsx(SelectIcon, { isMenuOpen: props.selectProps.menuIsOpen }) });
41
- DropdownIndicator.propTypes = {
42
- selectProps: PropTypes.instanceOf(Object).isRequired
55
+ ":active": { backgroundColor: "var(--action-secondary-bg)" }
56
+ });
43
57
  };
58
+ const extrasOf = (props) => props.selectProps;
59
+ const DropdownIndicator = (props) => /* @__PURE__ */ jsx(components.DropdownIndicator, { ...props, children: /* @__PURE__ */ jsx(SelectIcon, { isMenuOpen: props.selectProps.menuIsOpen, $variant: extrasOf(props).variant }) });
44
60
  const ScrollableMenuList = (props) => {
45
61
  const { children, selectProps } = props;
46
62
  const { maxMenuHeight = 300 } = selectProps;
47
63
  return /* @__PURE__ */ jsx(SelectMenuList, { autoHeight: true, autoHeightMax: maxMenuHeight, fullHeight: true, children });
48
64
  };
49
- ScrollableMenuList.propTypes = {
50
- children: PropTypes.node.isRequired,
51
- selectProps: PropTypes.instanceOf(Object).isRequired
52
- };
53
65
  const ControlWithDataCy = (props) => {
54
- const cy = props.selectProps?.dataCy;
66
+ const cy = extrasOf(props)?.dataCy;
55
67
  if (!cy) return /* @__PURE__ */ jsx(components.Control, { ...props });
56
68
  return /* @__PURE__ */ jsx(components.Control, { ...props, innerProps: { ...props.innerProps, "data-cy": cy } });
57
69
  };
58
- ControlWithDataCy.propTypes = {
59
- innerProps: PropTypes.instanceOf(Object),
60
- selectProps: PropTypes.instanceOf(Object).isRequired
61
- };
62
70
  const useScrollIntoViewWhenFocused = (isFocused) => {
63
71
  const ref = useRef(null);
64
72
  useEffect(() => {
@@ -67,17 +75,13 @@ const useScrollIntoViewWhenFocused = (isFocused) => {
67
75
  return ref;
68
76
  };
69
77
  const SingleOption = (props) => {
78
+ const variant = extrasOf(props).variant;
70
79
  const ref = useScrollIntoViewWhenFocused(props.isFocused);
71
80
  return /* @__PURE__ */ jsx(components.Option, { ...props, children: /* @__PURE__ */ jsxs(OptionRow, { ref, children: [
72
- renderIcon(props.data?.icon),
81
+ renderIcon(props.data?.icon, variant),
73
82
  /* @__PURE__ */ jsx(OptionLabel, { children: props.label })
74
83
  ] }) });
75
84
  };
76
- SingleOption.propTypes = {
77
- data: PropTypes.instanceOf(Object),
78
- label: PropTypes.node,
79
- isFocused: PropTypes.bool
80
- };
81
85
  const MultiOption = (props) => {
82
86
  const ref = useScrollIntoViewWhenFocused(props.isFocused);
83
87
  return /* @__PURE__ */ jsx(components.Option, { ...props, children: /* @__PURE__ */ jsx(OptionCheckbox, { checked: props.isSelected, children: /* @__PURE__ */ jsxs(OptionRow, { ref, children: [
@@ -85,19 +89,10 @@ const MultiOption = (props) => {
85
89
  /* @__PURE__ */ jsx(OptionLabel, { children: props.label })
86
90
  ] }) }) });
87
91
  };
88
- MultiOption.propTypes = {
89
- data: PropTypes.instanceOf(Object),
90
- label: PropTypes.node,
91
- isSelected: PropTypes.bool,
92
- isFocused: PropTypes.bool
93
- };
94
92
  const SingleValueWithIcon = (props) => /* @__PURE__ */ jsx(components.SingleValue, { ...props, children: /* @__PURE__ */ jsxs(OptionRow, { children: [
95
- renderIcon(props.data?.icon),
93
+ renderIcon(props.data?.icon, extrasOf(props).variant),
96
94
  /* @__PURE__ */ jsx(OptionLabel, { children: props.data?.label })
97
95
  ] }) });
98
- SingleValueWithIcon.propTypes = {
99
- data: PropTypes.instanceOf(Object).isRequired
100
- };
101
96
  const Select = (props) => {
102
97
  const {
103
98
  id,
@@ -118,6 +113,7 @@ const Select = (props) => {
118
113
  floatingLabel = true,
119
114
  formatCreateLabel,
120
115
  dataCy,
116
+ variant = "default",
121
117
  onChange,
122
118
  onBlur,
123
119
  onFocus,
@@ -155,34 +151,72 @@ const Select = (props) => {
155
151
  onChange?.({ name, value: arr });
156
152
  };
157
153
  const SelectComponent = creatable ? CreatableSelect : ReactSelect;
154
+ const bordered = variant === "bordered";
155
+ const invalid = Boolean(error && touched);
158
156
  const selectStyles = useMemo(
159
- () => ({
160
- control: () => SelectControl,
157
+ () => bordered ? {
158
+ control: (_base, state) => asStyle(borderedControlCss({ focused: state.isFocused, invalid, disabled: state.isDisabled })),
159
+ menu: (base) => ({
160
+ ...base,
161
+ marginTop: 4,
162
+ zIndex: 1e3,
163
+ overflow: "hidden",
164
+ border: BORDERED_BORDER,
165
+ borderRadius: "var(--radius-lg)",
166
+ boxShadow: "none",
167
+ backgroundColor: "var(--background-default)"
168
+ }),
169
+ option: buildBorderedOptionStyle,
170
+ valueContainer: (base) => ({ ...base, padding: 0 }),
171
+ singleValue: (base) => ({ ...base, margin: 0, color: "var(--text-primary)" }),
172
+ placeholder: (base, state) => ({
173
+ ...base,
174
+ margin: 0,
175
+ color: state.isMulti && state.selectProps.menuIsOpen && state.selectProps.value ? "var(--text-secondary)" : "var(--text-tertiary)",
176
+ maxWidth: "100%",
177
+ overflow: "hidden",
178
+ whiteSpace: "nowrap",
179
+ textOverflow: "ellipsis"
180
+ }),
181
+ input: (base) => ({
182
+ ...base,
183
+ margin: 0,
184
+ padding: 0,
185
+ color: "var(--text-primary)"
186
+ }),
187
+ dropdownIndicator: (base) => ({
188
+ ...base,
189
+ padding: 0,
190
+ color: "var(--text-primary)"
191
+ }),
192
+ clearIndicator: (base) => ({ ...base, padding: "0 8px" })
193
+ } : {
194
+ control: () => asStyle(SelectControl),
161
195
  menu: (base) => ({
162
196
  ...base,
163
197
  marginTop: 0,
164
198
  zIndex: 1e3,
165
- backgroundColor: "var(--stokr-background-surface-raised)"
199
+ backgroundColor: "var(--background-surface-raised)"
166
200
  }),
167
201
  option: buildOptionStyle(multiple),
168
202
  singleValue: (base, state) => ({
169
203
  ...base,
170
- color: state.isDisabled ? "var(--stokr-text-tertiary)" : "var(--stokr-text-primary)"
204
+ color: state.isDisabled ? "var(--text-tertiary)" : "var(--text-primary)"
171
205
  }),
172
- input: (base) => ({ ...base, color: "var(--stokr-text-primary)" }),
206
+ input: (base) => ({ ...base, color: "var(--text-primary)" }),
173
207
  // While open, a multiple select shows who is selected here (see `overview`): readable text, one line.
174
208
  placeholder: (base, state) => ({
175
209
  ...base,
176
- color: state.isMulti && state.selectProps.menuIsOpen && state.selectProps.value?.length ? "var(--stokr-text-secondary)" : "var(--stokr-text-tertiary)",
210
+ color: state.isMulti && state.selectProps.menuIsOpen && state.selectProps.value ? "var(--text-secondary)" : "var(--text-tertiary)",
177
211
  maxWidth: "100%",
178
212
  overflow: "hidden",
179
213
  whiteSpace: "nowrap",
180
214
  textOverflow: "ellipsis"
181
215
  }),
182
- selectContainer: () => SelectContainer,
216
+ selectContainer: () => asStyle(SelectContainer),
183
217
  valueContainer: (base) => ({ ...base, padding: 0 })
184
- }),
185
- [multiple]
218
+ },
219
+ [multiple, bordered, invalid]
186
220
  );
187
221
  const selectComponents = useMemo(
188
222
  () => ({
@@ -205,16 +239,17 @@ const Select = (props) => {
205
239
  }
206
240
  return options?.find((o) => o.value === value) || null;
207
241
  }, [multiple, creatable, value, options]);
242
+ const selectedOptions = multiple ? currentValue : [];
208
243
  const hasValue = useMemo(() => {
209
- if (multiple) return currentValue.length > 0;
244
+ if (multiple) return selectedOptions.length > 0;
210
245
  return currentValue != null && currentValue.value !== "";
211
- }, [multiple, currentValue]);
246
+ }, [multiple, currentValue, selectedOptions.length]);
212
247
  const isLabelUp = floatingLabel ? hasFocus || hasValue : Boolean(label);
213
- const ownPlaceholder = label ? hasFocus && placeholder ? placeholder : "" : placeholder;
214
- const overview = multiple && menuIsOpen && currentValue.length > 0 ? `${selectedLabel} (${currentValue.length}): ${currentValue.map((opt) => typeof opt.label === "string" ? opt.label : String(opt.value)).join(", ")}` : null;
248
+ const ownPlaceholder = label && !bordered ? hasFocus && placeholder ? placeholder : "" : placeholder;
249
+ const overview = multiple && menuIsOpen && selectedOptions.length > 0 ? `${selectedLabel} (${selectedOptions.length}): ${selectedOptions.map((opt) => typeof opt.label === "string" ? opt.label : String(opt.value)).join(", ")}` : null;
215
250
  const effectivePlaceholder = overview ?? ownPlaceholder;
216
251
  return /* @__PURE__ */ jsxs(Wrapper, { children: [
217
- label && /* @__PURE__ */ jsx(Label, { isUp: isLabelUp, active: hasFocus, error: error && touched, htmlFor: id, children: label }),
252
+ label && /* @__PURE__ */ jsx(Label, { isUp: isLabelUp, active: hasFocus, error: error && touched, htmlFor: id, $variant: variant, children: label }),
218
253
  /* @__PURE__ */ jsx(
219
254
  SelectComponent,
220
255
  {
@@ -248,31 +283,32 @@ const Select = (props) => {
248
283
  onFocus: handleFocus,
249
284
  styles: selectStyles,
250
285
  components: selectComponents,
251
- dataCy,
286
+ ...{ dataCy, variant },
252
287
  ...creatable && {
253
288
  formatCreateLabel: formatCreateLabel || ((input) => `Create "${input}"`)
254
289
  }
255
290
  }
256
291
  ),
257
- multiple && currentValue.length > 0 && /* @__PURE__ */ jsxs(SelectedChipsWrapper, { "data-cy": dataCy ? `${dataCy}-chips` : void 0, children: [
258
- /* @__PURE__ */ jsxs(SelectedChipsTitle, { children: [
292
+ multiple && selectedOptions.length > 0 && /* @__PURE__ */ jsxs(SelectedChipsWrapper, { "data-cy": dataCy ? `${dataCy}-chips` : void 0, $variant: variant, children: [
293
+ /* @__PURE__ */ jsxs(SelectedChipsTitle, { $variant: variant, children: [
259
294
  selectedLabel,
260
295
  " (",
261
- currentValue.length,
296
+ selectedOptions.length,
262
297
  ")"
263
298
  ] }),
264
- /* @__PURE__ */ jsx(SelectedChipsList, { children: currentValue.map((opt) => {
299
+ /* @__PURE__ */ jsx(SelectedChipsList, { children: selectedOptions.map((opt) => {
265
300
  const isLocked = lockedValues.includes(opt.value);
266
- return /* @__PURE__ */ jsxs(SelectedChip, { children: [
267
- renderIcon(opt.icon),
301
+ return /* @__PURE__ */ jsxs(SelectedChip, { $variant: variant, children: [
302
+ !bordered && renderIcon(opt.icon),
268
303
  /* @__PURE__ */ jsx(SelectedChipLabel, { children: opt.label }),
269
304
  /* @__PURE__ */ jsx(
270
305
  SelectedChipRemove,
271
306
  {
307
+ $variant: variant,
272
308
  onClick: () => removeValue(opt.value),
273
309
  "aria-label": `Remove ${typeof opt.label === "string" ? opt.label : opt.value}`,
274
310
  disabled: disabled || isLocked,
275
- children: "✕"
311
+ children: bordered ? /* @__PURE__ */ jsx(MaterialIcon, { name: "close", size: 16 }) : "✕"
276
312
  }
277
313
  )
278
314
  ] }, opt.key ?? opt.value);
@@ -280,47 +316,6 @@ const Select = (props) => {
280
316
  ] })
281
317
  ] });
282
318
  };
283
- Select.propTypes = {
284
- id: PropTypes.string.isRequired,
285
- name: PropTypes.string.isRequired,
286
- label: PropTypes.string,
287
- /** string|number for single mode, array for multi mode */
288
- value: PropTypes.oneOfType([
289
- PropTypes.string,
290
- PropTypes.number,
291
- PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))
292
- ]),
293
- options: PropTypes.arrayOf(
294
- PropTypes.shape({
295
- key: PropTypes.string,
296
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
297
- label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
298
- /** URL string (rendered as <img>) or a React node (e.g. an SVG flag) shown left of the label */
299
- icon: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
300
- })
301
- ).isRequired,
302
- placeholder: PropTypes.string,
303
- error: PropTypes.bool,
304
- touched: PropTypes.bool,
305
- disabled: PropTypes.bool,
306
- search: PropTypes.bool,
307
- creatable: PropTypes.bool,
308
- /** Multi-select: checkbox options + chips list rendered below the field. */
309
- multiple: PropTypes.bool,
310
- /** Multi mode: values that cannot be removed (chip ✕ disabled, can't be deselected). */
311
- lockedValues: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
312
- menuHeight: PropTypes.number,
313
- /** Heading shown above the chips list in multi mode (default: "Selected"). */
314
- selectedLabel: PropTypes.string,
315
- /** Input-like floating label behavior: label starts in-field, moves up on focus/value. */
316
- floatingLabel: PropTypes.bool,
317
- formatCreateLabel: PropTypes.func,
318
- onChange: PropTypes.func,
319
- onBlur: PropTypes.func,
320
- onFocus: PropTypes.func,
321
- /** Playwright / autocapture: `data-cy` selector on the react-select control. */
322
- dataCy: PropTypes.string
323
- };
324
319
  export {
325
320
  Select,
326
321
  SelectContainer,