@swan-io/lake 1.0.0

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 (288) hide show
  1. package/HISTORY.md +3 -0
  2. package/LICENSE +21 -0
  3. package/README.md +49 -0
  4. package/package.json +60 -0
  5. package/src/components/Alert.d.ts +10 -0
  6. package/src/components/Alert.js +36 -0
  7. package/src/components/AppOpeningAnimation.d.ts +10 -0
  8. package/src/components/AppOpeningAnimation.js +50 -0
  9. package/src/components/AutoWidthImage.d.ts +8 -0
  10. package/src/components/AutoWidthImage.js +26 -0
  11. package/src/components/Avatar.d.ts +7 -0
  12. package/src/components/Avatar.js +42 -0
  13. package/src/components/BorderedButton.d.ts +16 -0
  14. package/src/components/BorderedButton.js +98 -0
  15. package/src/components/BorderedIcon.d.ts +12 -0
  16. package/src/components/BorderedIcon.js +25 -0
  17. package/src/components/BottomPanel.d.ts +9 -0
  18. package/src/components/BottomPanel.js +94 -0
  19. package/src/components/Box.d.ts +65 -0
  20. package/src/components/Box.js +31 -0
  21. package/src/components/Breadcrumbs.d.ts +18 -0
  22. package/src/components/Breadcrumbs.js +362 -0
  23. package/src/components/Button.d.ts +15 -0
  24. package/src/components/Button.js +83 -0
  25. package/src/components/Caption.d.ts +6 -0
  26. package/src/components/Caption.js +11 -0
  27. package/src/components/Checkbox.d.ts +12 -0
  28. package/src/components/Checkbox.js +83 -0
  29. package/src/components/ChoicePicker.d.ts +11 -0
  30. package/src/components/ChoicePicker.js +99 -0
  31. package/src/components/Combobox.d.ts +29 -0
  32. package/src/components/Combobox.js +182 -0
  33. package/src/components/FailureIcon.d.ts +8 -0
  34. package/src/components/FailureIcon.js +4 -0
  35. package/src/components/FileTile.d.ts +11 -0
  36. package/src/components/FileTile.js +37 -0
  37. package/src/components/Fill.d.ts +8 -0
  38. package/src/components/Fill.js +24 -0
  39. package/src/components/FilterChooser.d.ts +15 -0
  40. package/src/components/FilterChooser.js +52 -0
  41. package/src/components/Filters.d.ts +57 -0
  42. package/src/components/Filters.js +229 -0
  43. package/src/components/FixedListView.d.ts +104 -0
  44. package/src/components/FixedListView.js +821 -0
  45. package/src/components/FixedListViewCells.d.ts +55 -0
  46. package/src/components/FixedListViewCells.js +157 -0
  47. package/src/components/Flag.d.ts +8 -0
  48. package/src/components/Flag.js +36 -0
  49. package/src/components/FlowPresentation.d.ts +12 -0
  50. package/src/components/FlowPresentation.js +70 -0
  51. package/src/components/FocusTrap.d.ts +16 -0
  52. package/src/components/FocusTrap.js +90 -0
  53. package/src/components/Form.d.ts +8 -0
  54. package/src/components/Form.js +17 -0
  55. package/src/components/FullViewportLayer.d.ts +7 -0
  56. package/src/components/FullViewportLayer.js +91 -0
  57. package/src/components/Grid.d.ts +13 -0
  58. package/src/components/Grid.js +33 -0
  59. package/src/components/Heading.d.ts +61 -0
  60. package/src/components/Heading.js +27 -0
  61. package/src/components/Icon.d.ts +191 -0
  62. package/src/components/Icon.js +11 -0
  63. package/src/components/Input.d.ts +34 -0
  64. package/src/components/Input.js +115 -0
  65. package/src/components/InputError.d.ts +8 -0
  66. package/src/components/InputError.js +16 -0
  67. package/src/components/Label.d.ts +10 -0
  68. package/src/components/Label.js +19 -0
  69. package/src/components/LakeAlert.d.ts +14 -0
  70. package/src/components/LakeAlert.js +75 -0
  71. package/src/components/LakeButton.d.ts +36 -0
  72. package/src/components/LakeButton.js +171 -0
  73. package/src/components/LakeCheckbox.d.ts +16 -0
  74. package/src/components/LakeCheckbox.js +54 -0
  75. package/src/components/LakeCombobox.d.ts +28 -0
  76. package/src/components/LakeCombobox.js +166 -0
  77. package/src/components/LakeCopyButton.d.ts +10 -0
  78. package/src/components/LakeCopyButton.js +16 -0
  79. package/src/components/LakeDownloadButton.d.ts +8 -0
  80. package/src/components/LakeDownloadButton.js +6 -0
  81. package/src/components/LakeHeading.d.ts +10 -0
  82. package/src/components/LakeHeading.js +19 -0
  83. package/src/components/LakeLabel.d.ts +19 -0
  84. package/src/components/LakeLabel.js +43 -0
  85. package/src/components/LakeModal.d.ts +14 -0
  86. package/src/components/LakeModal.js +132 -0
  87. package/src/components/LakeRadio.d.ts +9 -0
  88. package/src/components/LakeRadio.js +44 -0
  89. package/src/components/LakeScrollView.d.ts +10 -0
  90. package/src/components/LakeScrollView.js +35 -0
  91. package/src/components/LakeSearchField.d.ts +10 -0
  92. package/src/components/LakeSearchField.js +111 -0
  93. package/src/components/LakeSelect.d.ts +30 -0
  94. package/src/components/LakeSelect.js +183 -0
  95. package/src/components/LakeSlider.d.ts +12 -0
  96. package/src/components/LakeSlider.js +31 -0
  97. package/src/components/LakeStepper.d.ts +21 -0
  98. package/src/components/LakeStepper.js +134 -0
  99. package/src/components/LakeText.d.ts +19 -0
  100. package/src/components/LakeText.js +20 -0
  101. package/src/components/LakeTextInput.d.ts +36 -0
  102. package/src/components/LakeTextInput.js +154 -0
  103. package/src/components/LakeTooltip.d.ts +24 -0
  104. package/src/components/LakeTooltip.js +188 -0
  105. package/src/components/Link.d.ts +138 -0
  106. package/src/components/Link.js +23 -0
  107. package/src/components/ListRightPanel.d.ts +17 -0
  108. package/src/components/ListRightPanel.js +79 -0
  109. package/src/components/LoadingView.d.ts +9 -0
  110. package/src/components/LoadingView.js +24 -0
  111. package/src/components/Modal.d.ts +12 -0
  112. package/src/components/Modal.js +80 -0
  113. package/src/components/MultiSelect.d.ts +27 -0
  114. package/src/components/MultiSelect.js +223 -0
  115. package/src/components/MultilineInput.d.ts +15 -0
  116. package/src/components/MultilineInput.js +55 -0
  117. package/src/components/Picker.d.ts +26 -0
  118. package/src/components/Picker.js +116 -0
  119. package/src/components/PlainListView.d.ts +36 -0
  120. package/src/components/PlainListView.js +208 -0
  121. package/src/components/Popover.d.ts +23 -0
  122. package/src/components/Popover.js +147 -0
  123. package/src/components/PopoverContent.d.ts +8 -0
  124. package/src/components/PopoverContent.js +9 -0
  125. package/src/components/Portal.d.ts +7 -0
  126. package/src/components/Portal.js +9 -0
  127. package/src/components/Pressable.d.ts +348 -0
  128. package/src/components/Pressable.js +91 -0
  129. package/src/components/ProgressBar.d.ts +11 -0
  130. package/src/components/ProgressBar.js +46 -0
  131. package/src/components/ProjectEnvTag.d.ts +7 -0
  132. package/src/components/ProjectEnvTag.js +12 -0
  133. package/src/components/QuickActions.d.ts +15 -0
  134. package/src/components/QuickActions.js +38 -0
  135. package/src/components/RadioGroup.d.ts +16 -0
  136. package/src/components/RadioGroup.js +34 -0
  137. package/src/components/ReadOnlyFieldList.d.ts +6 -0
  138. package/src/components/ReadOnlyFieldList.js +8 -0
  139. package/src/components/ResponsiveContainer.d.ts +13 -0
  140. package/src/components/ResponsiveContainer.js +23 -0
  141. package/src/components/RightPanel.d.ts +10 -0
  142. package/src/components/RightPanel.js +102 -0
  143. package/src/components/SegmentedControl.d.ts +19 -0
  144. package/src/components/SegmentedControl.js +74 -0
  145. package/src/components/Separator.d.ts +10 -0
  146. package/src/components/Separator.js +19 -0
  147. package/src/components/SidebarNavigationTracker.d.ts +13 -0
  148. package/src/components/SidebarNavigationTracker.js +93 -0
  149. package/src/components/Slider.d.ts +11 -0
  150. package/src/components/Slider.js +119 -0
  151. package/src/components/SmsOpeningAnimation.d.ts +8 -0
  152. package/src/components/SmsOpeningAnimation.js +52 -0
  153. package/src/components/Space.d.ts +10 -0
  154. package/src/components/Space.js +23 -0
  155. package/src/components/Stack.d.ts +12 -0
  156. package/src/components/Stack.js +23 -0
  157. package/src/components/StepDots.d.ts +7 -0
  158. package/src/components/StepDots.js +24 -0
  159. package/src/components/Stepper.d.ts +9 -0
  160. package/src/components/Stepper.js +67 -0
  161. package/src/components/SuccessIcon.d.ts +8 -0
  162. package/src/components/SuccessIcon.js +4 -0
  163. package/src/components/Svg.d.ts +145 -0
  164. package/src/components/Svg.js +24 -0
  165. package/src/components/SwanLogo.d.ts +8 -0
  166. package/src/components/SwanLogo.js +11 -0
  167. package/src/components/Switch.d.ts +9 -0
  168. package/src/components/Switch.js +74 -0
  169. package/src/components/TabView.d.ts +16 -0
  170. package/src/components/TabView.js +398 -0
  171. package/src/components/Table.d.ts +34 -0
  172. package/src/components/Table.js +79 -0
  173. package/src/components/Tag.d.ts +17 -0
  174. package/src/components/Tag.js +76 -0
  175. package/src/components/Tile.d.ts +34 -0
  176. package/src/components/Tile.js +130 -0
  177. package/src/components/TilePlaceholder.d.ts +6 -0
  178. package/src/components/TilePlaceholder.js +51 -0
  179. package/src/components/ToastStack.d.ts +2 -0
  180. package/src/components/ToastStack.js +96 -0
  181. package/src/components/Tooltip.d.ts +18 -0
  182. package/src/components/Tooltip.js +162 -0
  183. package/src/components/TransitionGroupView.d.ts +12 -0
  184. package/src/components/TransitionGroupView.js +43 -0
  185. package/src/components/TransitionView.d.ts +12 -0
  186. package/src/components/TransitionView.js +43 -0
  187. package/src/components/WithCurrentColor.d.ts +12 -0
  188. package/src/components/WithCurrentColor.js +65 -0
  189. package/src/components/WithPartnerAccentColor.d.ts +7 -0
  190. package/src/components/WithPartnerAccentColor.js +91 -0
  191. package/src/constants/colors.d.ts +42 -0
  192. package/src/constants/colors.js +42 -0
  193. package/src/constants/commonStyles.d.ts +66 -0
  194. package/src/constants/commonStyles.js +45 -0
  195. package/src/constants/design.d.ts +168 -0
  196. package/src/constants/design.js +564 -0
  197. package/src/constants/insets.d.ts +10 -0
  198. package/src/constants/insets.js +22 -0
  199. package/src/constants/typography.d.ts +26 -0
  200. package/src/constants/typography.js +54 -0
  201. package/src/hooks/useAnimatedValue.d.ts +2 -0
  202. package/src/hooks/useAnimatedValue.js +3 -0
  203. package/src/hooks/useBodyClassName.d.ts +3 -0
  204. package/src/hooks/useBodyClassName.js +14 -0
  205. package/src/hooks/useBoolean.d.ts +8 -0
  206. package/src/hooks/useBoolean.js +12 -0
  207. package/src/hooks/useComputedColors.d.ts +10 -0
  208. package/src/hooks/useComputedColors.js +42 -0
  209. package/src/hooks/useDebounce.d.ts +1 -0
  210. package/src/hooks/useDebounce.js +12 -0
  211. package/src/hooks/useDisclosure.d.ts +8 -0
  212. package/src/hooks/useDisclosure.js +12 -0
  213. package/src/hooks/useFirstMountState.d.ts +1 -0
  214. package/src/hooks/useFirstMountState.js +9 -0
  215. package/src/hooks/useForceableState.d.ts +1 -0
  216. package/src/hooks/useForceableState.js +6 -0
  217. package/src/hooks/useHover.d.ts +11 -0
  218. package/src/hooks/useHover.js +4 -0
  219. package/src/hooks/useInterval.d.ts +1 -0
  220. package/src/hooks/useInterval.js +11 -0
  221. package/src/hooks/useLazyRef.d.ts +2 -0
  222. package/src/hooks/useLazyRef.js +9 -0
  223. package/src/hooks/useMergeRefs.d.ts +2 -0
  224. package/src/hooks/useMergeRefs.js +5 -0
  225. package/src/hooks/useNativeProp.d.ts +2 -0
  226. package/src/hooks/useNativeProp.js +9 -0
  227. package/src/hooks/useOutsideClick.d.ts +8 -0
  228. package/src/hooks/useOutsideClick.js +54 -0
  229. package/src/hooks/usePersistedState.d.ts +1 -0
  230. package/src/hooks/usePersistedState.js +21 -0
  231. package/src/hooks/usePressEvents.d.ts +31 -0
  232. package/src/hooks/usePressEvents.js +4 -0
  233. package/src/hooks/usePreviousValue.d.ts +1 -0
  234. package/src/hooks/usePreviousValue.js +8 -0
  235. package/src/hooks/useResponsive.d.ts +7 -0
  236. package/src/hooks/useResponsive.js +20 -0
  237. package/src/hooks/useUpdateEffect.d.ts +2 -0
  238. package/src/hooks/useUpdateEffect.js +10 -0
  239. package/src/hooks/useUrqlMutation.d.ts +4 -0
  240. package/src/hooks/useUrqlMutation.js +30 -0
  241. package/src/hooks/useUrqlQuery.d.ts +19 -0
  242. package/src/hooks/useUrqlQuery.js +73 -0
  243. package/src/state/toasts.d.ts +21 -0
  244. package/src/state/toasts.js +61 -0
  245. package/src/utils/__tests__/array.test.d.ts +1 -0
  246. package/src/utils/__tests__/array.test.js +127 -0
  247. package/src/utils/__tests__/base64.test.d.ts +1 -0
  248. package/src/utils/__tests__/base64.test.js +27 -0
  249. package/src/utils/__tests__/function.test.d.ts +1 -0
  250. package/src/utils/__tests__/function.test.js +36 -0
  251. package/src/utils/__tests__/object.test.d.ts +1 -0
  252. package/src/utils/__tests__/object.test.js +17 -0
  253. package/src/utils/__tests__/rifm.test.d.ts +1 -0
  254. package/src/utils/__tests__/rifm.test.js +124 -0
  255. package/src/utils/__tests__/string.test.d.ts +1 -0
  256. package/src/utils/__tests__/string.test.js +16 -0
  257. package/src/utils/a11y.d.ts +1 -0
  258. package/src/utils/a11y.js +18 -0
  259. package/src/utils/array.d.ts +6 -0
  260. package/src/utils/array.js +71 -0
  261. package/src/utils/base64.d.ts +2 -0
  262. package/src/utils/base64.js +20 -0
  263. package/src/utils/file.d.ts +2 -0
  264. package/src/utils/file.js +10 -0
  265. package/src/utils/flagCountry.d.ts +1 -0
  266. package/src/utils/flagCountry.js +1 -0
  267. package/src/utils/function.d.ts +4 -0
  268. package/src/utils/function.js +19 -0
  269. package/src/utils/math.d.ts +16 -0
  270. package/src/utils/math.js +47 -0
  271. package/src/utils/nullish.d.ts +10 -0
  272. package/src/utils/nullish.js +8 -0
  273. package/src/utils/object.d.ts +2 -0
  274. package/src/utils/object.js +7 -0
  275. package/src/utils/popper.d.ts +3 -0
  276. package/src/utils/popper.js +30 -0
  277. package/src/utils/rifm.d.ts +14 -0
  278. package/src/utils/rifm.js +53 -0
  279. package/src/utils/string.d.ts +4 -0
  280. package/src/utils/string.js +233 -0
  281. package/src/utils/timer.d.ts +11 -0
  282. package/src/utils/timer.js +46 -0
  283. package/src/utils/types.d.ts +8 -0
  284. package/src/utils/types.js +1 -0
  285. package/src/utils/userAgent.d.ts +4 -0
  286. package/src/utils/userAgent.js +9 -0
  287. package/src/utils/viewport.d.ts +1 -0
  288. package/src/utils/viewport.js +12 -0
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ type Props<T extends string> = {
3
+ steps: T[];
4
+ currentStep: T;
5
+ };
6
+ export declare const StepDots: <T extends string>({ steps, currentStep }: Props<T>) => JSX.Element;
7
+ export {};
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Fragment } from "react";
3
+ import { StyleSheet, View } from "react-native";
4
+ import { colors } from "../constants/design";
5
+ import { Box } from "./Box";
6
+ import { Space } from "./Space";
7
+ const styles = StyleSheet.create({
8
+ dot: {
9
+ width: 6,
10
+ height: 6,
11
+ borderRadius: 3,
12
+ backgroundColor: colors.gray[200],
13
+ },
14
+ dotActive: {
15
+ backgroundColor: colors.gray[500],
16
+ },
17
+ });
18
+ export const StepDots = ({ steps, currentStep }) => {
19
+ return (_jsx(Box, { direction: "row", alignItems: "center", justifyContent: "center", children: steps.map((step, index) => {
20
+ const isCurrent = step === currentStep;
21
+ const isLast = index === steps.length - 1;
22
+ return (_jsxs(Fragment, { children: [_jsx(View, { style: [styles.dot, isCurrent && styles.dotActive] }), !isLast && _jsx(Space, { width: 12 })] }, step));
23
+ }) }));
24
+ };
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ type Props = {
3
+ steps: {
4
+ label: string;
5
+ }[];
6
+ activeStep: number;
7
+ };
8
+ export declare const Stepper: ({ steps, activeStep }: Props) => JSX.Element;
9
+ export {};
@@ -0,0 +1,67 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Fragment } from "react";
3
+ import { StyleSheet, View } from "react-native";
4
+ import { colors, spacings } from "../constants/design";
5
+ import { Box } from "./Box";
6
+ import { Icon } from "./Icon";
7
+ import { LakeHeading } from "./LakeHeading";
8
+ import { LakeText } from "./LakeText";
9
+ const styles = StyleSheet.create({
10
+ container: {
11
+ paddingBottom: spacings[24],
12
+ },
13
+ circle: {
14
+ width: spacings[32],
15
+ height: spacings[32],
16
+ borderColor: colors.gray[100],
17
+ borderWidth: 1,
18
+ borderRadius: 16,
19
+ color: colors.gray[400],
20
+ alignItems: "center",
21
+ justifyContent: "center",
22
+ },
23
+ activeCircle: {
24
+ width: spacings[32],
25
+ height: spacings[32],
26
+ borderColor: colors.current[500],
27
+ backgroundColor: colors.current[500],
28
+ borderWidth: 1,
29
+ borderRadius: 16,
30
+ color: colors.current.contrast,
31
+ alignItems: "center",
32
+ justifyContent: "center",
33
+ },
34
+ counter: {
35
+ lineHeight: 0.8,
36
+ },
37
+ item: {
38
+ paddingHorizontal: spacings[12],
39
+ },
40
+ textContainer: {
41
+ position: "absolute",
42
+ top: "100%",
43
+ left: "50%",
44
+ transform: [{ translateX: "-50%" }, { translateY: 5 }],
45
+ },
46
+ text: {
47
+ whiteSpace: "nowrap",
48
+ },
49
+ separator: {
50
+ height: spacings[4],
51
+ borderRadius: 2,
52
+ backgroundColor: colors.gray[100],
53
+ flexGrow: 1,
54
+ },
55
+ doneSeparator: {
56
+ backgroundColor: colors.current[500],
57
+ },
58
+ });
59
+ export const Stepper = ({ steps, activeStep }) => {
60
+ return (_jsx(Box, { direction: "row", alignItems: "center", style: styles.container, children: steps.map((item, index) => {
61
+ const isActive = index === activeStep;
62
+ const isDone = index < activeStep;
63
+ const color = isActive || isDone ? colors.current.contrast : colors.gray[300];
64
+ const textColor = isActive || isDone ? colors.current[500] : colors.gray[300];
65
+ return (_jsxs(Fragment, { children: [index > 0 ? (_jsx(View, { style: [styles.separator, (isActive || isDone) && styles.doneSeparator] })) : null, _jsxs(View, { style: styles.item, children: [_jsx(View, { style: isActive || isDone ? styles.activeCircle : styles.circle, children: isDone ? (_jsx(Icon, { size: 20, name: "checkmark-filled", color: color })) : (_jsx(LakeHeading, { level: 3, variant: "h3", color: color, style: styles.counter, children: String(index + 1) })) }), _jsx(View, { style: styles.textContainer, children: _jsx(LakeText, { style: styles.text, color: textColor, variant: isDone || isActive ? "semibold" : "regular", children: item.label }) })] })] }, index));
66
+ }) }));
67
+ };
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ type Props = {
4
+ size: number;
5
+ style?: StyleProp<ViewStyle>;
6
+ };
7
+ export declare const SuccessIcon: ({ size, style }: Props) => JSX.Element;
8
+ export {};
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { colors } from "../constants/colors";
3
+ import { Path, Svg } from "./Svg";
4
+ export const SuccessIcon = ({ size, style }) => (_jsx(Svg, { viewBox: "0 0 24 24", style: [{ height: size, width: size }, style], children: _jsx(Path, { d: "M12 2a10 10 0 110 20 10 10 0 010-20zm3.22 6.97l-4.47 4.47-1.97-1.97a.75.75 0 00-1.06 1.06l2.5 2.5c.3.3.77.3 1.06 0l5-5a.75.75 0 10-1.06-1.06z", fill: colors.green[100] }) }));
@@ -0,0 +1,145 @@
1
+ import { ReactNode } from "react";
2
+ import { ViewProps } from "react-native";
3
+ type ChildrenProp = {
4
+ children?: ReactNode;
5
+ };
6
+ type FillRule = "evenodd" | "nonzero";
7
+ type CommonProps = Pick<ViewProps, "accessibilityRole" | "focusable" | "nativeID" | "pointerEvents" | "style" | "testID"> & ChildrenProp;
8
+ type SvgProps = CommonProps & {
9
+ height?: number;
10
+ title?: string;
11
+ viewBox?: string;
12
+ width?: number;
13
+ };
14
+ type CircleProps = CommonProps & {
15
+ fill?: string;
16
+ fillRule?: FillRule;
17
+ opacity?: number;
18
+ stroke?: string;
19
+ strokeWidth?: number;
20
+ cx?: number;
21
+ cy?: number;
22
+ r?: number;
23
+ };
24
+ type GProps = CommonProps & {
25
+ clipPath?: string;
26
+ fill?: string;
27
+ fillRule?: FillRule;
28
+ opacity?: number;
29
+ stroke?: string;
30
+ strokeWidth?: number;
31
+ transform?: string;
32
+ mask?: string;
33
+ };
34
+ type RadialGradientProps = CommonProps & {
35
+ id?: string;
36
+ cx?: string;
37
+ cy?: string;
38
+ fx?: string;
39
+ fy?: string;
40
+ r?: string;
41
+ gradientTransform?: string;
42
+ };
43
+ type ImageProps = CommonProps & {
44
+ x?: number;
45
+ y?: number;
46
+ width: number;
47
+ height: number;
48
+ xlinkHref: string;
49
+ preserveAspectRatio?: string;
50
+ };
51
+ type PathProps = CommonProps & {
52
+ d?: string;
53
+ fill?: string;
54
+ fillOpacity?: number;
55
+ fillRule?: "nonzero" | "evenodd";
56
+ opacity?: number;
57
+ stroke?: string;
58
+ strokeLinecap?: "round";
59
+ strokeLinejoin?: "round";
60
+ strokeWidth?: number;
61
+ transform?: string;
62
+ strokeDasharray?: string;
63
+ strokeDashoffset?: string;
64
+ };
65
+ type RectProps = CommonProps & {
66
+ x?: number;
67
+ y?: number;
68
+ fill?: string;
69
+ height?: number;
70
+ rx?: number;
71
+ width?: number;
72
+ strokeWidth?: number;
73
+ stroke?: string;
74
+ fillRule?: string;
75
+ strokeOpacity?: number;
76
+ };
77
+ type StopProps = CommonProps & {
78
+ offset?: string;
79
+ stopColor?: string;
80
+ };
81
+ type UseProps = CommonProps & {
82
+ xlinkHref?: string;
83
+ };
84
+ type AnimateProps = CommonProps & {
85
+ attributeName: string;
86
+ values: string;
87
+ dur: string;
88
+ begin: string;
89
+ repeatCount?: string;
90
+ fill?: string;
91
+ };
92
+ type LineProps = CommonProps & {
93
+ x1: string;
94
+ x2: string;
95
+ y1: string;
96
+ y2: string;
97
+ strokeLinecap?: "round";
98
+ strokeLinejoin?: "round";
99
+ strokeWidth?: number;
100
+ stroke?: string;
101
+ };
102
+ type TextProps = CommonProps & {
103
+ fontFamily?: string;
104
+ fontSize?: string;
105
+ fontWeight?: string;
106
+ fill?: string;
107
+ transform?: string;
108
+ };
109
+ type TspanProps = CommonProps & {
110
+ x?: number;
111
+ y?: number;
112
+ };
113
+ export declare const Svg: ({ style, ...props }: SvgProps) => import("react").ReactElement<{
114
+ style: (import("react-native").StyleProp<import("react-native").ViewStyle> | {
115
+ display: "flex";
116
+ flexBasis: string;
117
+ flexGrow: number;
118
+ flexShrink: number;
119
+ })[];
120
+ testID?: string | undefined;
121
+ pointerEvents?: "auto" | "none" | "box-none" | "box-only" | undefined;
122
+ nativeID?: string | undefined;
123
+ accessibilityRole?: import("react-native").WebAccessibilityRole | undefined;
124
+ focusable?: boolean | undefined;
125
+ children?: ReactNode;
126
+ height?: number | undefined;
127
+ title?: string | undefined;
128
+ viewBox?: string | undefined;
129
+ width?: number | undefined;
130
+ }, string | import("react").JSXElementConstructor<any>>;
131
+ export declare const Circle: (props: CircleProps) => import("react").ReactElement<CircleProps, string | import("react").JSXElementConstructor<any>>;
132
+ export declare const Defs: (props: ChildrenProp) => import("react").ReactElement<ChildrenProp, string | import("react").JSXElementConstructor<any>>;
133
+ export declare const G: (props: GProps) => import("react").ReactElement<GProps, string | import("react").JSXElementConstructor<any>>;
134
+ export declare const Use: (props: UseProps) => import("react").ReactElement<UseProps, string | import("react").JSXElementConstructor<any>>;
135
+ export declare const Mask: (props: CommonProps) => import("react").ReactElement<CommonProps, string | import("react").JSXElementConstructor<any>>;
136
+ export declare const Text: (props: TextProps) => import("react").ReactElement<TextProps, string | import("react").JSXElementConstructor<any>>;
137
+ export declare const Tspan: (props: TspanProps) => import("react").ReactElement<TspanProps, string | import("react").JSXElementConstructor<any>>;
138
+ export declare const Image: (props: ImageProps) => import("react").ReactElement<ImageProps, string | import("react").JSXElementConstructor<any>>;
139
+ export declare const RadialGradient: (props: RadialGradientProps) => import("react").ReactElement<RadialGradientProps, string | import("react").JSXElementConstructor<any>>;
140
+ export declare const Path: (props: PathProps) => import("react").ReactElement<PathProps, string | import("react").JSXElementConstructor<any>>;
141
+ export declare const Line: (props: LineProps) => import("react").ReactElement<LineProps, string | import("react").JSXElementConstructor<any>>;
142
+ export declare const Rect: (props: RectProps) => import("react").ReactElement<RectProps, string | import("react").JSXElementConstructor<any>>;
143
+ export declare const Stop: (props: StopProps) => import("react").ReactElement<StopProps, string | import("react").JSXElementConstructor<any>>;
144
+ export declare const Animate: (props: AnimateProps) => import("react").ReactElement<AnimateProps, string | import("react").JSXElementConstructor<any>>;
145
+ export {};
@@ -0,0 +1,24 @@
1
+ import { StyleSheet, unstable_createElement as createElement } from "react-native";
2
+ const styles = StyleSheet.create({
3
+ svg: {
4
+ display: "flex",
5
+ flexBasis: "auto",
6
+ flexGrow: 0,
7
+ flexShrink: 0,
8
+ },
9
+ });
10
+ export const Svg = ({ style, ...props }) => createElement("svg", { ...props, style: [styles.svg, style] });
11
+ export const Circle = (props) => createElement("circle", props);
12
+ export const Defs = (props) => createElement("defs", props);
13
+ export const G = (props) => createElement("g", props);
14
+ export const Use = (props) => createElement("use", props);
15
+ export const Mask = (props) => createElement("mask", props);
16
+ export const Text = (props) => createElement("text", props);
17
+ export const Tspan = (props) => createElement("tspan", props);
18
+ export const Image = (props) => createElement("image", props);
19
+ export const RadialGradient = (props) => createElement("radialGradient", props);
20
+ export const Path = (props) => createElement("path", props);
21
+ export const Line = (props) => createElement("line", props);
22
+ export const Rect = (props) => createElement("rect", props);
23
+ export const Stop = (props) => createElement("stop", props);
24
+ export const Animate = (props) => createElement("animate", props);
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ type Props = {
4
+ color?: string;
5
+ style?: StyleProp<ViewStyle>;
6
+ };
7
+ export declare const SwanLogo: ({ color, style }: Props) => JSX.Element;
8
+ export {};
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { StyleSheet } from "react-native";
3
+ import { colors } from "../constants/colors";
4
+ import { Path, Svg } from "./Svg";
5
+ const styles = StyleSheet.create({
6
+ base: {
7
+ height: 10,
8
+ width: 45,
9
+ },
10
+ });
11
+ export const SwanLogo = ({ color = colors.gray[100], style }) => (_jsxs(Svg, { viewBox: "0 0 45 10", style: [styles.base, style], children: [_jsx("title", { children: "Swan" }), _jsx(Path, { d: "M41.01 0c2.2 0 3.66 1.6 3.66 3.82v5.95H42.9V3.9c0-1.28-1-2.19-2.23-2.19a2.33 2.33 0 00-2.37 2.4v5.65h-1.83V.27h1.83v.92A3.4 3.4 0 0141 0zM30.77 9.73H29.2c-2.65 0-4.53-2.27-4.53-4.86A4.81 4.81 0 0129.44 0c2.92 0 4.93 1.74 4.93 4.45v5.32h-1.71V4.45c0-1.72-1.2-2.76-3.22-2.76a3.11 3.11 0 00-3.06 3.18c0 1.72 1.2 3.17 2.82 3.17h1.57v1.7zm-14.37-7l-2.25 7.04h-2.1L9.07.27h1.96l2.11 7.16L15.45.27h1.9l2.3 7.16L21.76.27h1.96l-3 9.5h-2.1zM4.14 10C1.94 10 .54 8.82.36 6.93L.33 6.7h1.79l.02.18c.15.98.84 1.48 2.07 1.48s1.93-.54 1.93-1.38c0-.82-.5-1.1-2.15-1.42l-.43-.09C1.54 5.05.64 4.41.64 2.76.64 1.1 2.1 0 4.18 0 6.06 0 7.5 1.12 7.65 2.83l.02.23H5.9l-.02-.19c-.12-.79-.72-1.25-1.79-1.25-1.03 0-1.68.47-1.68 1.14 0 .68.47.92 1.99 1.2l.6.12c2 .4 2.93 1.1 2.93 2.83C7.93 8.76 6.4 10 4.14 10z", fill: color })] }));
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { View } from "react-native";
3
+ type Props = {
4
+ value: boolean;
5
+ onValueChange?: (value: boolean) => void;
6
+ disabled?: boolean;
7
+ };
8
+ export declare const Switch: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<View>>>;
9
+ export {};
@@ -0,0 +1,74 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, memo, useEffect } from "react";
3
+ import { Animated, Pressable, StyleSheet, View } from "react-native";
4
+ import { backgroundColor, colors, shadows } from "../constants/design";
5
+ import { useAnimatedValue } from "../hooks/useAnimatedValue";
6
+ import { Icon } from "./Icon";
7
+ const WIDTH = 36;
8
+ const BUTTON_SIZE = 16;
9
+ const PADDING = 2;
10
+ const styles = StyleSheet.create({
11
+ base: {
12
+ backgroundColor: colors.gray[300],
13
+ borderRadius: 10,
14
+ height: 20,
15
+ width: WIDTH,
16
+ boxSizing: "content-box",
17
+ transitionProperty: "background-color",
18
+ transitionDuration: "300ms",
19
+ boxShadow: "inset 0 0 0 1px rgba(0, 0, 0, 0.2)",
20
+ },
21
+ active: {
22
+ backgroundColor: colors.positive[500],
23
+ },
24
+ disabled: {
25
+ opacity: 0.5,
26
+ },
27
+ opaque: {
28
+ opacity: 1,
29
+ },
30
+ button: {
31
+ alignItems: "center",
32
+ backgroundColor: backgroundColor.accented,
33
+ borderRadius: 8,
34
+ boxShadow: shadows.tile,
35
+ height: 16,
36
+ justifyContent: "center",
37
+ left: 0,
38
+ position: "absolute",
39
+ top: PADDING,
40
+ width: BUTTON_SIZE,
41
+ },
42
+ icon: {
43
+ opacity: 0,
44
+ transitionProperty: "opacity",
45
+ transitionDuration: "300ms",
46
+ },
47
+ shadow: {
48
+ position: "absolute",
49
+ width: "100%",
50
+ height: "100%",
51
+ borderRadius: 10,
52
+ boxShadow: shadows.tile,
53
+ opacity: 0,
54
+ transitionProperty: "opacity",
55
+ transitionDuration: "300ms",
56
+ },
57
+ });
58
+ export const Switch = memo(forwardRef(({ value, disabled = false, onValueChange }, ref) => {
59
+ const animatedValue = value ? 1 : 0;
60
+ const animation = useAnimatedValue(animatedValue);
61
+ useEffect(() => {
62
+ Animated.spring(animation, {
63
+ bounciness: 6,
64
+ speed: 25,
65
+ toValue: animatedValue,
66
+ useNativeDriver: false,
67
+ }).start();
68
+ }, [animation, animatedValue]);
69
+ const translateX = animation.interpolate({
70
+ inputRange: [0, 1],
71
+ outputRange: [PADDING, WIDTH - BUTTON_SIZE - PADDING],
72
+ });
73
+ return (_jsx(Pressable, { ref: ref, accessibilityRole: "switch", disabled: disabled, onPress: () => onValueChange?.(!value), children: ({ hovered }) => (_jsxs(_Fragment, { children: [_jsx(View, { style: [styles.shadow, hovered && styles.opaque] }), _jsx(View, { style: [styles.base, value && styles.active, disabled && styles.disabled], children: _jsx(Animated.View, { style: [styles.button, { transform: [{ translateX }] }], children: _jsx(Icon, { color: colors.positive[400], name: "checkmark-filled", size: 10, style: [styles.icon, value && styles.opaque] }) }) })] })) }));
74
+ }));
@@ -0,0 +1,16 @@
1
+ /// <reference types="react" />
2
+ import { IconName } from "@swan-io/lake/src/components/Icon";
3
+ type Tab = {
4
+ label: string;
5
+ url: string;
6
+ icon?: IconName;
7
+ withSeparator?: boolean;
8
+ count?: number;
9
+ };
10
+ type Props = {
11
+ tabs: Tab[];
12
+ otherLabel: string;
13
+ hideIfSingleItem?: boolean;
14
+ };
15
+ export declare const TabView: ({ tabs, otherLabel, hideIfSingleItem }: Props) => JSX.Element | null;
16
+ export {};