@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,13 @@
1
+ import { ReactNode } from "react";
2
+ import { ViewProps } from "react-native";
3
+ export type Context = {
4
+ small: boolean;
5
+ large: boolean;
6
+ };
7
+ type Props = {
8
+ children: (context: Context) => ReactNode;
9
+ style?: ViewProps["style"];
10
+ breakpoint?: number;
11
+ };
12
+ export declare const ResponsiveContainer: ({ children, style, breakpoint }: Props) => JSX.Element;
13
+ export {};
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useCallback, useLayoutEffect, useRef, useState } from "react";
3
+ import { StyleSheet, View } from "react-native";
4
+ const styles = StyleSheet.create({
5
+ hidden: {
6
+ opacity: 0,
7
+ },
8
+ });
9
+ export const ResponsiveContainer = ({ children, style, breakpoint = 1000 }) => {
10
+ const [isSmall, setIsSmall] = useState(null);
11
+ const containerRef = useRef(null);
12
+ const onLayout = useCallback(({ nativeEvent: { layout: { width }, }, }) => {
13
+ setIsSmall(() => width < breakpoint);
14
+ }, [breakpoint]);
15
+ useLayoutEffect(() => {
16
+ if (containerRef.current != null) {
17
+ const element = containerRef.current;
18
+ setIsSmall(() => element.offsetWidth < breakpoint);
19
+ }
20
+ }, [breakpoint]);
21
+ const isSmallWithDefault = isSmall ?? false;
22
+ return (_jsx(View, { ref: containerRef, onLayout: onLayout, style: [style, isSmall == null ? styles.hidden : null], children: children({ small: isSmallWithDefault, large: !isSmallWithDefault }) }));
23
+ };
@@ -0,0 +1,10 @@
1
+ import { FocusTrapRef } from "@swan-io/lake/src/components/FocusTrap";
2
+ import { ReactNode } from "react";
3
+ import { Context } from "./ResponsiveContainer";
4
+ type Props = {
5
+ visible: boolean;
6
+ children: ReactNode | ((context: Context) => ReactNode);
7
+ onPressClose?: () => void;
8
+ };
9
+ export declare const RightPanel: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<FocusTrapRef>>;
10
+ export {};
@@ -0,0 +1,102 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { FocusTrap } from "@swan-io/lake/src/components/FocusTrap";
3
+ import { TransitionView } from "@swan-io/lake/src/components/TransitionView";
4
+ import { backgroundColor, breakpoints } from "@swan-io/lake/src/constants/design";
5
+ import { forwardRef, Suspense, useEffect, useState } from "react";
6
+ import { StyleSheet, View } from "react-native";
7
+ import { useBodyClassName } from "../hooks/useBodyClassName";
8
+ import { LoadingView } from "./LoadingView";
9
+ import { Portal } from "./Portal";
10
+ import { Pressable } from "./Pressable";
11
+ import { ResponsiveContainer } from "./ResponsiveContainer";
12
+ const BACKGROUND_COLOR = "rgba(0, 0, 0, 0.6)";
13
+ const styles = StyleSheet.create({
14
+ root: {
15
+ ...StyleSheet.absoluteFillObject,
16
+ },
17
+ fill: {
18
+ ...StyleSheet.absoluteFillObject,
19
+ },
20
+ overlayEnter: {
21
+ animationKeyframes: {
22
+ "0%": { opacity: 0 },
23
+ },
24
+ animationDuration: "200ms",
25
+ animationTimingFunction: "ease-in-out",
26
+ },
27
+ overlayLeave: {
28
+ animationKeyframes: {
29
+ "100%": { opacity: 0 },
30
+ },
31
+ animationDuration: "200ms",
32
+ animationTimingFunction: "ease-in-out",
33
+ },
34
+ containerEnter: {
35
+ animationKeyframes: {
36
+ "0%": { opacity: 0, transform: [{ translateZ: 0 }, { translateX: 100 }] },
37
+ },
38
+ animationDuration: "500ms",
39
+ animationTimingFunction: "ease-in-out",
40
+ },
41
+ containerLeave: {
42
+ animationKeyframes: {
43
+ "100%": { opacity: 0, transform: [{ translateZ: 0 }, { translateX: 100 }] },
44
+ },
45
+ animationDuration: "500ms",
46
+ animationTimingFunction: "ease-in-out",
47
+ },
48
+ overlay: {
49
+ ...StyleSheet.absoluteFillObject,
50
+ backgroundColor: BACKGROUND_COLOR,
51
+ },
52
+ container: {
53
+ ...StyleSheet.absoluteFillObject,
54
+ transform: [{ translateZ: 0 }],
55
+ flexDirection: "row",
56
+ alignItems: "stretch",
57
+ backgroundColor: backgroundColor.default,
58
+ },
59
+ fillMax: {
60
+ position: "absolute",
61
+ top: 0,
62
+ bottom: 0,
63
+ right: 0,
64
+ width: "100%",
65
+ },
66
+ fillMaxLarge: { maxWidth: 700 },
67
+ contentsEnter: {
68
+ animationKeyframes: {
69
+ "0%": { transform: [{ translateZ: 0 }, { translateX: 25 }] },
70
+ },
71
+ animationDuration: "500ms",
72
+ animationTimingFunction: "ease-in-out",
73
+ },
74
+ contentsLeave: {
75
+ animationKeyframes: {
76
+ "100%": { transform: [{ translateZ: 0 }, { translateX: 25 }] },
77
+ },
78
+ animationDuration: "500ms",
79
+ animationTimingFunction: "ease-in-out",
80
+ },
81
+ contentsContainer: {
82
+ ...StyleSheet.absoluteFillObject,
83
+ zIndex: 2,
84
+ transform: [{ translateZ: 0 }],
85
+ maxWidth: "100%",
86
+ flexGrow: 1,
87
+ },
88
+ contents: {
89
+ ...StyleSheet.absoluteFillObject,
90
+ maxWidth: "100%",
91
+ flexGrow: 1,
92
+ },
93
+ });
94
+ const rootNode = document.querySelector("#full-page-layer-root");
95
+ export const RightPanel = forwardRef(({ visible, children, onPressClose }, ref) => {
96
+ const [delayedVisible, setDelayedVisible] = useState(visible);
97
+ useEffect(() => {
98
+ setDelayedVisible(visible);
99
+ }, [visible]);
100
+ useBodyClassName("RightPanelOpen", { enabled: visible });
101
+ return (_jsx(Portal, { container: rootNode, children: _jsx(View, { style: styles.root, pointerEvents: visible ? "auto" : "none", children: _jsx(ResponsiveContainer, { style: styles.root, breakpoint: breakpoints.small, children: ({ large }) => (_jsxs(_Fragment, { children: [_jsx(TransitionView, { style: styles.fill, enter: styles.overlayEnter, leave: styles.overlayLeave, children: visible ? (onPressClose != null ? (_jsx(Pressable, { style: styles.overlay, onPress: onPressClose })) : (_jsx(View, { style: styles.overlay }))) : null }), _jsx(Suspense, { fallback: _jsx(LoadingView, { color: backgroundColor.accented, delay: 0 }), children: _jsx(TransitionView, { style: [styles.fillMax, large && styles.fillMaxLarge], enter: styles.containerEnter, leave: styles.containerLeave, children: delayedVisible ? (_jsx(FocusTrap, { onEscapeKey: onPressClose, focusLock: true, autoFocus: true, returnFocus: true, ref: ref, style: styles.container, children: _jsx(TransitionView, { style: styles.contentsContainer, enter: styles.contentsEnter, leave: styles.contentsLeave, children: _jsx(View, { style: styles.contents, children: _jsx(View, { style: styles.contentsContainer, children: typeof children == "function" ? (_jsx(ResponsiveContainer, { style: styles.root, breakpoint: breakpoints.small, children: children })) : (children) }) }) }) })) : null }) })] })) }) }) }));
102
+ });
@@ -0,0 +1,19 @@
1
+ import { ReactNode } from "react";
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ type Props<V, I extends {
4
+ value: V;
5
+ }> = {
6
+ value: V;
7
+ items: I[];
8
+ onValueChange: (value: V) => void;
9
+ renderItem: (item: I) => ReactNode | null;
10
+ horizontal?: boolean;
11
+ label: string;
12
+ style?: StyleProp<ViewStyle>;
13
+ };
14
+ export declare const SegmentedControl: (<V, I extends {
15
+ value: V;
16
+ }>(props: Props<V, I>) => JSX.Element | null) & {
17
+ displayName?: string | undefined;
18
+ };
19
+ export {};
@@ -0,0 +1,74 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { memo as reactMemo } from "react";
3
+ import isEqual from "react-fast-compare";
4
+ import { Pressable, StyleSheet, Text, View } from "react-native";
5
+ import { colors } from "../constants/colors";
6
+ import { typography } from "../constants/typography";
7
+ import { Fill } from "./Fill";
8
+ import { Icon } from "./Icon";
9
+ import { Label } from "./Label";
10
+ import { Space } from "./Space";
11
+ const styles = StyleSheet.create({
12
+ base: {
13
+ backgroundColor: colors.white,
14
+ borderWidth: 1,
15
+ borderColor: colors.gray[10],
16
+ borderRadius: 4,
17
+ overflow: "hidden",
18
+ },
19
+ horizontalBase: {
20
+ flexDirection: "row",
21
+ },
22
+ item: {
23
+ alignItems: "center",
24
+ flexDirection: "row",
25
+ flexGrow: 1,
26
+ flexShrink: 1,
27
+ minHeight: 48,
28
+ overflow: "hidden",
29
+ paddingHorizontal: 16,
30
+ transitionProperty: "background-color",
31
+ transitionDuration: "200ms",
32
+ },
33
+ horizontalItem: {
34
+ flexBasis: "0%",
35
+ flexDirection: "column",
36
+ flexGrow: 1,
37
+ flexShrink: 1,
38
+ justifyContent: "center",
39
+ },
40
+ hoveredItem: {
41
+ backgroundColor: colors.gray[3],
42
+ },
43
+ pressedItem: {
44
+ backgroundColor: colors.gray[10],
45
+ },
46
+ rightBorder: {
47
+ borderRightColor: colors.gray[10],
48
+ borderRightWidth: 1,
49
+ },
50
+ bottomBorder: {
51
+ borderBottomColor: colors.gray[10],
52
+ borderBottomWidth: 1,
53
+ },
54
+ itemText: {
55
+ ...typography.bodyLarge,
56
+ },
57
+ });
58
+ const isReactText = (node) => ["string", "number"].includes(typeof node);
59
+ const memo = reactMemo;
60
+ export const SegmentedControl = memo(({ items, horizontal = false, label, onValueChange, renderItem, style, value }) => {
61
+ const lastIndex = items.length - 1;
62
+ return (_jsxs(View, { children: [_jsx(Label, { children: label }), _jsx(Space, { height: 8 }), _jsx(View, { accessibilityRole: "radiogroup", style: [styles.base, horizontal && styles.horizontalBase, style], children: items.map((item, index) => {
63
+ const selected = item.value === value;
64
+ const rendered = renderItem(item);
65
+ return (_jsx(Pressable, { accessibilitySelected: selected, accessibilityRole: "radio", onPress: () => onValueChange(item.value), style: ({ hovered, pressed }) => [
66
+ styles.item,
67
+ horizontal && styles.horizontalItem,
68
+ (hovered || selected) && styles.hoveredItem,
69
+ pressed && styles.pressedItem,
70
+ index !== lastIndex && (horizontal ? styles.rightBorder : styles.bottomBorder),
71
+ ], children: _jsxs(_Fragment, { children: [isReactText(rendered) ? (_jsx(Text, { style: styles.itemText, children: rendered })) : (rendered), !horizontal && selected ? (_jsxs(_Fragment, { children: [_jsx(Fill, { minWidth: 16 }), _jsx(Icon, { name: "checkmark-filled", color: colors.green[100], size: 20 })] })) : null] }) }, `option-${item.value}`));
72
+ }) })] }));
73
+ }, isEqual);
74
+ SegmentedControl.displayName = "SegmentedControl";
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ import { SpacingValue } from "./Space";
4
+ type Props = {
5
+ horizontal?: boolean;
6
+ space?: SpacingValue;
7
+ style?: StyleProp<ViewStyle>;
8
+ };
9
+ export declare const Separator: ({ horizontal, space, style }: Props) => JSX.Element;
10
+ export {};
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { StyleSheet, View } from "react-native";
3
+ import { colors } from "../constants/design";
4
+ import { isNotNullish } from "../utils/nullish";
5
+ const styles = StyleSheet.create({
6
+ horizontal: {
7
+ backgroundColor: colors.gray[100],
8
+ width: 1,
9
+ alignSelf: "stretch",
10
+ },
11
+ vertical: {
12
+ backgroundColor: colors.gray[100],
13
+ height: 1,
14
+ alignSelf: "stretch",
15
+ },
16
+ });
17
+ export const Separator = ({ horizontal = false, space, style }) => (_jsx(View, { accessibilityRole: "none", style: horizontal
18
+ ? [styles.horizontal, isNotNullish(space) && { marginHorizontal: space }, style]
19
+ : [styles.vertical, isNotNullish(space) && { marginVertical: space }, style] }));
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ import { ScrollViewProps } from "react-native";
3
+ type Props = {
4
+ style?: ScrollViewProps["style"];
5
+ contentContainerStyle?: ScrollViewProps["style"];
6
+ children: ScrollViewProps["children"];
7
+ };
8
+ export declare const SidebarNavigationTracker: ({ style, contentContainerStyle, children }: Props) => JSX.Element;
9
+ type MarkerProps = {
10
+ color: string;
11
+ };
12
+ export declare const SidebarNavigationTrackerActiveMarker: ({ color }: MarkerProps) => JSX.Element;
13
+ export {};
@@ -0,0 +1,93 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createContext, useCallback, useContext, useEffect, useRef, useState } from "react";
3
+ import { ScrollView, StyleSheet, View } from "react-native";
4
+ const styles = StyleSheet.create({
5
+ track: {
6
+ position: "absolute",
7
+ top: 0,
8
+ right: 0,
9
+ bottom: 0,
10
+ width: 3,
11
+ },
12
+ marker: {
13
+ position: "absolute",
14
+ top: 0,
15
+ right: 0,
16
+ bottom: 0,
17
+ width: 3,
18
+ },
19
+ trackIndicator: {
20
+ width: 3,
21
+ height: 1,
22
+ position: "absolute",
23
+ right: 0,
24
+ transformOrigin: "right top",
25
+ transition: "150ms ease-in-out",
26
+ transitionProperty: ["transform", "background-color"],
27
+ },
28
+ });
29
+ const Context = createContext((_) => { });
30
+ // using `offsetTop` and `offsetHeight` here to avoid calculations
31
+ // being wrong when ancestor has as CSS transform applied
32
+ const getCoordinates = (element, guide) => {
33
+ const offsetHeight = element.offsetHeight;
34
+ const guideParent = guide.parentElement;
35
+ if (guideParent == null || !guideParent.contains(element)) {
36
+ return { top: 0, height: offsetHeight };
37
+ }
38
+ let offsetTop = 0;
39
+ let currentElement = element;
40
+ while (currentElement != null && currentElement != guideParent) {
41
+ offsetTop += currentElement.offsetTop;
42
+ currentElement = currentElement.offsetParent;
43
+ }
44
+ return { top: offsetTop, height: offsetHeight };
45
+ };
46
+ export const SidebarNavigationTracker = ({ style, contentContainerStyle, children }) => {
47
+ const [track, setTrackRaw] = useState(null);
48
+ const trackRef = useRef(null);
49
+ const lastElementRef = useRef(null);
50
+ const setTrack = useCallback(({ color, element }) => {
51
+ if (trackRef.current != null) {
52
+ lastElementRef.current = element;
53
+ const { top, height } = getCoordinates(element, trackRef.current);
54
+ setTrackRaw({
55
+ color,
56
+ top,
57
+ height,
58
+ });
59
+ }
60
+ }, []);
61
+ const onLayout = useCallback(() => {
62
+ if (lastElementRef.current != null && track?.color != null) {
63
+ const { top, height } = getCoordinates(lastElementRef.current, trackRef.current);
64
+ setTrackRaw({
65
+ color: track?.color,
66
+ top,
67
+ height,
68
+ });
69
+ }
70
+ }, [track]);
71
+ return (_jsx(Context.Provider, { value: setTrack, children: _jsxs(ScrollView, { scrollEventThrottle: 30, onLayout: onLayout, style: style, contentContainerStyle: contentContainerStyle, accessibilityRole: "banner", children: [children, _jsx(View, { style: styles.track, ref: trackRef, children: track != null ? (_jsx(View, { style: [
72
+ styles.trackIndicator,
73
+ {
74
+ transform: [{ translateY: track.top }, { scaleY: track.height }],
75
+ backgroundColor: track.color,
76
+ },
77
+ ] })) : null })] }) }));
78
+ };
79
+ export const SidebarNavigationTrackerActiveMarker = ({ color }) => {
80
+ const setLayoutReference = useContext(Context);
81
+ const elementRef = useRef(null);
82
+ const onLayout = useCallback(() => {
83
+ if (elementRef.current != null) {
84
+ setLayoutReference({ color, element: elementRef.current });
85
+ }
86
+ }, [setLayoutReference, color]);
87
+ useEffect(() => {
88
+ if (elementRef.current != null) {
89
+ setLayoutReference({ color, element: elementRef.current });
90
+ }
91
+ }, [setLayoutReference, color]);
92
+ return _jsx(View, { ref: elementRef, onLayout: onLayout, style: styles.marker, pointerEvents: "none" });
93
+ };
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ type Props = {
3
+ value: number;
4
+ step: number;
5
+ minimum: number;
6
+ maximum: number;
7
+ disabled?: boolean;
8
+ onValueChange?: (value: number) => void;
9
+ };
10
+ export declare const Slider: import("react").MemoExoticComponent<({ value, step, minimum, maximum, disabled, onValueChange }: Props) => JSX.Element>;
11
+ export {};
@@ -0,0 +1,119 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { memo, useEffect, useRef } from "react";
3
+ import { Animated, PanResponder, StyleSheet, View } from "react-native";
4
+ import { match } from "ts-pattern";
5
+ import { colors } from "../constants/colors";
6
+ import { useAnimatedValue } from "../hooks/useAnimatedValue";
7
+ import { interpolate } from "../utils/math";
8
+ const BUTTON_SIZE = 20;
9
+ const styles = StyleSheet.create({
10
+ container: {
11
+ height: BUTTON_SIZE,
12
+ },
13
+ disabled: {
14
+ cursor: "not-allowed",
15
+ opacity: 0.5,
16
+ },
17
+ bar: {
18
+ ...StyleSheet.absoluteFillObject,
19
+ height: 4,
20
+ marginVertical: "auto",
21
+ borderRadius: 2,
22
+ backgroundColor: colors.gray[10],
23
+ overflow: "hidden",
24
+ },
25
+ barFill: {
26
+ ...StyleSheet.absoluteFillObject,
27
+ transformOrigin: "0 0",
28
+ backgroundColor: colors.gray[100],
29
+ },
30
+ button: {
31
+ position: "absolute",
32
+ height: BUTTON_SIZE,
33
+ width: BUTTON_SIZE,
34
+ backgroundColor: colors.gray[100],
35
+ borderRadius: BUTTON_SIZE / 2,
36
+ marginLeft: -(BUTTON_SIZE / 2),
37
+ willChange: "left", // because we animate left directly
38
+ },
39
+ });
40
+ const computeValue = ({ minimum, maximum, step, origin, position, width, }) => {
41
+ const value = interpolate({
42
+ inputRange: [0, width],
43
+ outputRange: [minimum, maximum],
44
+ clamp: true,
45
+ })(position - origin);
46
+ // round value based on step size
47
+ return Math.round(value / step) * step;
48
+ };
49
+ export const Slider = memo(({ value, step, minimum, maximum, disabled = false, onValueChange }) => {
50
+ const disabledRef = useRef(disabled);
51
+ const interacting = useRef(false);
52
+ const left = useRef(0);
53
+ const width = useRef(0);
54
+ const valueAnim = useAnimatedValue(value);
55
+ const barAnim = valueAnim.interpolate({
56
+ inputRange: [minimum, maximum],
57
+ outputRange: ["0%", "100%"],
58
+ extrapolate: "clamp",
59
+ });
60
+ // Update position on value change
61
+ useEffect(() => {
62
+ !interacting.current && valueAnim.setValue(value);
63
+ }, [valueAnim, value]);
64
+ // Update disabled ref for pan responder
65
+ useEffect(() => {
66
+ disabledRef.current = disabled;
67
+ }, [disabled]);
68
+ const handleLayout = ({ nativeEvent: { layout } }) => {
69
+ left.current = layout.left ?? 0;
70
+ width.current = layout.width;
71
+ };
72
+ const handleKeyDown = ({ nativeEvent }) => {
73
+ if (!onValueChange || disabled) {
74
+ return;
75
+ }
76
+ match(nativeEvent.key)
77
+ .with("ArrowUp", "ArrowRight", () => onValueChange(Math.min(value + step, maximum)))
78
+ .with("ArrowDown", "ArrowLeft", () => onValueChange(Math.max(value - step, minimum)))
79
+ .otherwise(() => { });
80
+ };
81
+ const panResponder = useRef(PanResponder.create({
82
+ onMoveShouldSetPanResponder: () => true,
83
+ onPanResponderGrant: () => {
84
+ interacting.current = true;
85
+ document.body.style.userSelect = "none";
86
+ },
87
+ onPanResponderMove: event => {
88
+ if (onValueChange && !disabledRef.current) {
89
+ const nextValue = computeValue({
90
+ minimum,
91
+ maximum,
92
+ step,
93
+ position: event.nativeEvent.pageX,
94
+ origin: left.current,
95
+ width: width.current,
96
+ });
97
+ onValueChange(nextValue);
98
+ valueAnim.setValue(nextValue);
99
+ }
100
+ },
101
+ onPanResponderRelease: event => {
102
+ interacting.current = false;
103
+ document.body.style.userSelect = "";
104
+ if (onValueChange && !disabledRef.current) {
105
+ const nextValue = computeValue({
106
+ minimum,
107
+ maximum,
108
+ step,
109
+ position: event.nativeEvent.pageX,
110
+ origin: left.current,
111
+ width: width.current,
112
+ });
113
+ onValueChange(nextValue);
114
+ valueAnim.setValue(nextValue);
115
+ }
116
+ },
117
+ })).current;
118
+ return (_jsxs(View, { focusable: !disabled, style: [styles.container, disabled && styles.disabled], onLayout: handleLayout, onKeyDown: handleKeyDown, ...panResponder.panHandlers, children: [_jsx(View, { style: styles.bar, children: _jsx(Animated.View, { style: [styles.barFill, { transform: [{ scaleX: barAnim }] }] }) }), _jsx(Animated.View, { style: [styles.button, { left: barAnim }] })] }));
119
+ });
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ type Props = {
4
+ playing?: boolean;
5
+ style?: StyleProp<ViewStyle>;
6
+ };
7
+ export declare const SmsOpeningAnimation: ({ playing, style }: Props) => JSX.Element;
8
+ export {};
@@ -0,0 +1,52 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo } from "react";
3
+ import { StyleSheet } from "react-native";
4
+ import { backgroundColor, colors } from "../constants/design";
5
+ import { Circle, G, Mask, Path, Rect, Svg } from "./Svg";
6
+ const styles = StyleSheet.create({
7
+ circle: {
8
+ opacity: 0,
9
+ animationKeyframes: {
10
+ "0%": { opacity: 0, transform: [{ scale: 0.4 }] },
11
+ "30%": { opacity: 0, transform: [{ scale: 0.4 }] },
12
+ "40%": { opacity: 1 },
13
+ "75%": { opacity: 0, transform: [{ scale: 1.5 }] },
14
+ "100%": { opacity: 0, transform: [{ scale: 1.5 }] },
15
+ },
16
+ animationDuration: "5000ms",
17
+ animationTimingFunction: "ease-in-out",
18
+ animationIterationCount: "infinite",
19
+ },
20
+ icon: {
21
+ animationKeyframes: {
22
+ "0%": { opacity: 0, transform: [{ translateY: -20 }, { scale: 1 }] },
23
+ "10%": { opacity: 1, transform: [{ scale: 1 }] },
24
+ "25%": { transform: [{ scale: 1 }] },
25
+ "35%": { transform: [{ translateY: 60 }, { scale: 10 }] },
26
+ "100%": { opacity: 1, transform: [{ translateY: 60 }, { scale: 10 }] },
27
+ },
28
+ animationDuration: "5000ms",
29
+ animationTimingFunction: "ease-in-out",
30
+ animationIterationCount: "infinite",
31
+ },
32
+ logo: {
33
+ animationKeyframes: {
34
+ "0%": { opacity: 0, transform: [{ translateY: -20 }, { scale: 1 }] },
35
+ "10%": { opacity: 1, transform: [{ translateY: 0 }, { scale: 1 }] },
36
+ "25%": { transform: [{ translateY: 0 }, { scale: 1 }] },
37
+ "35%": { transform: [{ translateY: 270 }, { scale: 2 }] },
38
+ "100%": { opacity: 1, transform: [{ translateY: 270 }, { scale: 2 }] },
39
+ },
40
+ animationDuration: "5000ms",
41
+ animationTimingFunction: "ease-in-out",
42
+ animationIterationCount: "infinite",
43
+ },
44
+ });
45
+ export const SmsOpeningAnimation = ({ playing = true, style }) => {
46
+ const animationStyle = useMemo(() => {
47
+ return {
48
+ animationPlayState: playing ? "running" : "paused",
49
+ };
50
+ }, [playing]);
51
+ return (_jsxs(Svg, { viewBox: "0 0 442 860", style: style, children: [_jsxs(Mask, { nativeID: "phoneScreen", children: [_jsx(Rect, { x: 0, y: 0, width: 442, height: 860, fill: "#000" }), _jsx(Rect, { fill: "#fff", x: 25, y: 21, width: 392, height: 817, rx: 45 })] }), _jsxs(G, { children: [_jsx(Rect, { fill: colors.swan[400], x: 25, y: 21, width: 392, height: 817, rx: 45 }), _jsx(G, { mask: "url(#phoneScreen)", children: _jsx(Rect, { fill: backgroundColor.default, fillRule: "nonzero", x: 43, y: 80, width: 355, height: 149, rx: 32, style: [styles.icon, animationStyle], "transform-origin": "221.2 150" }) }), _jsx(Path, { d: "M221.000028,125 C237.569013,125 251,138.429348 251,154.996311 C251,171.563274 237.569013,184.992622 221.000028,184.992622 C216.146713,184.999037 211.364882,183.823286 207.068041,181.567043 L194.198053,184.917631 C193.323041,185.145499 192.392776,184.893009 191.7531,184.254027 C191.113423,183.615046 190.860005,182.685139 191.087056,181.810013 L194.435053,168.944596 C192.172455,164.643731 190.993369,159.855888 191.000028,154.996311 C191.000028,138.429348 204.431044,125 221.000028,125 Z M224.756025,157.995942 L211.250037,157.995942 L210.944038,158.01694 C209.830402,158.170147 209.00073,159.121675 209.00073,160.245665 C209.00073,161.369656 209.830402,162.321184 210.944038,162.474391 L211.250037,162.495389 L224.756025,162.495389 L225.059024,162.474391 C226.17266,162.321184 227.002332,161.369656 227.002332,160.245665 C227.002332,159.121675 226.17266,158.170147 225.059024,158.01694 L224.756025,157.995942 Z M230.750019,147.497233 L211.250037,147.497233 L210.944038,147.518231 C209.830402,147.671438 209.00073,148.622966 209.00073,149.746957 C209.00073,150.870947 209.830402,151.822475 210.944038,151.975683 L211.250037,151.99668 L230.750019,151.99668 L231.056019,151.975683 C232.169654,151.822475 232.999327,150.870947 232.999327,149.746957 C232.999327,148.622966 232.169654,147.671438 231.056019,147.518231 L230.750019,147.497233 Z", fill: colors.swan[400], fillRule: "nonzero", style: [styles.logo, animationStyle], "transform-origin": "221.2 150" }), _jsx(Circle, { stroke: colors.swan[100], strokeWidth: 2, cx: 219.5, cy: 439.5, r: 157.5, fill: "none", style: [styles.circle, animationStyle], "transform-origin": "219.5 439.5" }), _jsx(Path, { d: "M369 0a67.998 67.998 0 0168 68v177c1.326 0 2.598.527 3.536 1.464A5.004 5.004 0 01442 250v96a5.004 5.004 0 01-1.464 3.536A5.004 5.004 0 01437 351v441a67.996 67.996 0 01-19.917 48.083A67.996 67.996 0 01369 860H71a67.998 67.998 0 01-68-68V365.6a5 5 0 01-3-4.6v-58a5.002 5.002 0 013-4.6v-16.8a5 5 0 01-3-4.6v-58a5.002 5.002 0 013-4.6v-30.8a5 5 0 01-3-4.6v-24a5.002 5.002 0 013-4.6V68A68 68 0 0171 0h298zm0 21H71a46 46 0 00-46 45.2V792a45.999 45.999 0 0045.2 46H369a46 46 0 0046-45.2V67a45.998 45.998 0 00-46-46z", fill: "#000" })] })] }));
52
+ };
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ export declare const spacingValues: readonly [4, 8, 12, 16, 20, 24, 32, 40, 48, 72, 96];
3
+ export type SpacingValue = (typeof spacingValues)[number];
4
+ type Props = {
5
+ height?: SpacingValue;
6
+ width?: SpacingValue;
7
+ flexGrow?: number;
8
+ };
9
+ export declare const Space: ({ height, width, flexGrow }: Props) => JSX.Element;
10
+ export {};
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { StyleSheet, View } from "react-native";
3
+ import { isNotNullish } from "../utils/nullish";
4
+ export const spacingValues = [4, 8, 12, 16, 20, 24, 32, 40, 48, 72, 96];
5
+ const rawHeightStyles = {};
6
+ const rawWidthStyles = {};
7
+ spacingValues.forEach(value => {
8
+ rawHeightStyles[value] = { height: value };
9
+ rawWidthStyles[value] = { width: value };
10
+ });
11
+ const heightStyles = StyleSheet.create(rawHeightStyles);
12
+ const widthStyles = StyleSheet.create(rawWidthStyles);
13
+ const styles = StyleSheet.create({
14
+ noShrink: {
15
+ flexShrink: 0,
16
+ },
17
+ });
18
+ export const Space = ({ height, width, flexGrow }) => (_jsx(View, { style: [
19
+ styles.noShrink,
20
+ isNotNullish(height) && heightStyles[height],
21
+ isNotNullish(width) && widthStyles[width],
22
+ { flexGrow },
23
+ ] }));
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { View } from "react-native";
3
+ export declare const Stack: import("react").ForwardRefExoticComponent<import("react-native").ViewProps & {
4
+ alignItems?: ("stretch" | "center" | "end" | "start" | "baseline") | undefined;
5
+ children?: import("react").ReactNode;
6
+ direction?: ("column" | "row" | "columnReverse" | "rowReverse") | undefined;
7
+ justifyContent?: ("center" | "end" | "start" | "normal" | "spaceBetween" | "spaceAround" | "spaceEvenly") | undefined;
8
+ style?: import("react-native").StyleProp<import("react-native").ViewStyle>;
9
+ } & {
10
+ space?: 4 | 8 | 12 | 16 | 20 | 24 | 32 | 40 | 48 | 72 | 96 | undefined;
11
+ wrap?: boolean | undefined;
12
+ } & import("react").RefAttributes<View>>;
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Children, forwardRef, Fragment } from "react";
3
+ import { StyleSheet } from "react-native";
4
+ import { isNullish } from "../utils/nullish";
5
+ import { Box } from "./Box";
6
+ import { Space } from "./Space";
7
+ const styles = StyleSheet.create({
8
+ wrap: {
9
+ flexWrap: "wrap",
10
+ },
11
+ });
12
+ export const Stack = forwardRef(
13
+ // Default <View /> styles https://github.com/necolas/react-native-web/blob/0.17.5/packages/react-native-web/src/exports/View/index.js#L133
14
+ ({ children, space, wrap = false, ...props }, forwardedRef) => {
15
+ const { direction = "column" } = props;
16
+ const horizontal = direction === "row" || direction === "rowReverse";
17
+ return (_jsx(Box, { style: wrap && styles.wrap, ref: forwardedRef, ...props, children: Children.map(children, (child, index) => {
18
+ if (isNullish(child)) {
19
+ return child;
20
+ }
21
+ return (_jsxs(Fragment, { children: [index !== 0 && (horizontal ? _jsx(Space, { width: space }) : _jsx(Space, { height: space })), child] }));
22
+ }) }));
23
+ });