@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.
- package/HISTORY.md +3 -0
- package/LICENSE +21 -0
- package/README.md +49 -0
- package/package.json +60 -0
- package/src/components/Alert.d.ts +10 -0
- package/src/components/Alert.js +36 -0
- package/src/components/AppOpeningAnimation.d.ts +10 -0
- package/src/components/AppOpeningAnimation.js +50 -0
- package/src/components/AutoWidthImage.d.ts +8 -0
- package/src/components/AutoWidthImage.js +26 -0
- package/src/components/Avatar.d.ts +7 -0
- package/src/components/Avatar.js +42 -0
- package/src/components/BorderedButton.d.ts +16 -0
- package/src/components/BorderedButton.js +98 -0
- package/src/components/BorderedIcon.d.ts +12 -0
- package/src/components/BorderedIcon.js +25 -0
- package/src/components/BottomPanel.d.ts +9 -0
- package/src/components/BottomPanel.js +94 -0
- package/src/components/Box.d.ts +65 -0
- package/src/components/Box.js +31 -0
- package/src/components/Breadcrumbs.d.ts +18 -0
- package/src/components/Breadcrumbs.js +362 -0
- package/src/components/Button.d.ts +15 -0
- package/src/components/Button.js +83 -0
- package/src/components/Caption.d.ts +6 -0
- package/src/components/Caption.js +11 -0
- package/src/components/Checkbox.d.ts +12 -0
- package/src/components/Checkbox.js +83 -0
- package/src/components/ChoicePicker.d.ts +11 -0
- package/src/components/ChoicePicker.js +99 -0
- package/src/components/Combobox.d.ts +29 -0
- package/src/components/Combobox.js +182 -0
- package/src/components/FailureIcon.d.ts +8 -0
- package/src/components/FailureIcon.js +4 -0
- package/src/components/FileTile.d.ts +11 -0
- package/src/components/FileTile.js +37 -0
- package/src/components/Fill.d.ts +8 -0
- package/src/components/Fill.js +24 -0
- package/src/components/FilterChooser.d.ts +15 -0
- package/src/components/FilterChooser.js +52 -0
- package/src/components/Filters.d.ts +57 -0
- package/src/components/Filters.js +229 -0
- package/src/components/FixedListView.d.ts +104 -0
- package/src/components/FixedListView.js +821 -0
- package/src/components/FixedListViewCells.d.ts +55 -0
- package/src/components/FixedListViewCells.js +157 -0
- package/src/components/Flag.d.ts +8 -0
- package/src/components/Flag.js +36 -0
- package/src/components/FlowPresentation.d.ts +12 -0
- package/src/components/FlowPresentation.js +70 -0
- package/src/components/FocusTrap.d.ts +16 -0
- package/src/components/FocusTrap.js +90 -0
- package/src/components/Form.d.ts +8 -0
- package/src/components/Form.js +17 -0
- package/src/components/FullViewportLayer.d.ts +7 -0
- package/src/components/FullViewportLayer.js +91 -0
- package/src/components/Grid.d.ts +13 -0
- package/src/components/Grid.js +33 -0
- package/src/components/Heading.d.ts +61 -0
- package/src/components/Heading.js +27 -0
- package/src/components/Icon.d.ts +191 -0
- package/src/components/Icon.js +11 -0
- package/src/components/Input.d.ts +34 -0
- package/src/components/Input.js +115 -0
- package/src/components/InputError.d.ts +8 -0
- package/src/components/InputError.js +16 -0
- package/src/components/Label.d.ts +10 -0
- package/src/components/Label.js +19 -0
- package/src/components/LakeAlert.d.ts +14 -0
- package/src/components/LakeAlert.js +75 -0
- package/src/components/LakeButton.d.ts +36 -0
- package/src/components/LakeButton.js +171 -0
- package/src/components/LakeCheckbox.d.ts +16 -0
- package/src/components/LakeCheckbox.js +54 -0
- package/src/components/LakeCombobox.d.ts +28 -0
- package/src/components/LakeCombobox.js +166 -0
- package/src/components/LakeCopyButton.d.ts +10 -0
- package/src/components/LakeCopyButton.js +16 -0
- package/src/components/LakeDownloadButton.d.ts +8 -0
- package/src/components/LakeDownloadButton.js +6 -0
- package/src/components/LakeHeading.d.ts +10 -0
- package/src/components/LakeHeading.js +19 -0
- package/src/components/LakeLabel.d.ts +19 -0
- package/src/components/LakeLabel.js +43 -0
- package/src/components/LakeModal.d.ts +14 -0
- package/src/components/LakeModal.js +132 -0
- package/src/components/LakeRadio.d.ts +9 -0
- package/src/components/LakeRadio.js +44 -0
- package/src/components/LakeScrollView.d.ts +10 -0
- package/src/components/LakeScrollView.js +35 -0
- package/src/components/LakeSearchField.d.ts +10 -0
- package/src/components/LakeSearchField.js +111 -0
- package/src/components/LakeSelect.d.ts +30 -0
- package/src/components/LakeSelect.js +183 -0
- package/src/components/LakeSlider.d.ts +12 -0
- package/src/components/LakeSlider.js +31 -0
- package/src/components/LakeStepper.d.ts +21 -0
- package/src/components/LakeStepper.js +134 -0
- package/src/components/LakeText.d.ts +19 -0
- package/src/components/LakeText.js +20 -0
- package/src/components/LakeTextInput.d.ts +36 -0
- package/src/components/LakeTextInput.js +154 -0
- package/src/components/LakeTooltip.d.ts +24 -0
- package/src/components/LakeTooltip.js +188 -0
- package/src/components/Link.d.ts +138 -0
- package/src/components/Link.js +23 -0
- package/src/components/ListRightPanel.d.ts +17 -0
- package/src/components/ListRightPanel.js +79 -0
- package/src/components/LoadingView.d.ts +9 -0
- package/src/components/LoadingView.js +24 -0
- package/src/components/Modal.d.ts +12 -0
- package/src/components/Modal.js +80 -0
- package/src/components/MultiSelect.d.ts +27 -0
- package/src/components/MultiSelect.js +223 -0
- package/src/components/MultilineInput.d.ts +15 -0
- package/src/components/MultilineInput.js +55 -0
- package/src/components/Picker.d.ts +26 -0
- package/src/components/Picker.js +116 -0
- package/src/components/PlainListView.d.ts +36 -0
- package/src/components/PlainListView.js +208 -0
- package/src/components/Popover.d.ts +23 -0
- package/src/components/Popover.js +147 -0
- package/src/components/PopoverContent.d.ts +8 -0
- package/src/components/PopoverContent.js +9 -0
- package/src/components/Portal.d.ts +7 -0
- package/src/components/Portal.js +9 -0
- package/src/components/Pressable.d.ts +348 -0
- package/src/components/Pressable.js +91 -0
- package/src/components/ProgressBar.d.ts +11 -0
- package/src/components/ProgressBar.js +46 -0
- package/src/components/ProjectEnvTag.d.ts +7 -0
- package/src/components/ProjectEnvTag.js +12 -0
- package/src/components/QuickActions.d.ts +15 -0
- package/src/components/QuickActions.js +38 -0
- package/src/components/RadioGroup.d.ts +16 -0
- package/src/components/RadioGroup.js +34 -0
- package/src/components/ReadOnlyFieldList.d.ts +6 -0
- package/src/components/ReadOnlyFieldList.js +8 -0
- package/src/components/ResponsiveContainer.d.ts +13 -0
- package/src/components/ResponsiveContainer.js +23 -0
- package/src/components/RightPanel.d.ts +10 -0
- package/src/components/RightPanel.js +102 -0
- package/src/components/SegmentedControl.d.ts +19 -0
- package/src/components/SegmentedControl.js +74 -0
- package/src/components/Separator.d.ts +10 -0
- package/src/components/Separator.js +19 -0
- package/src/components/SidebarNavigationTracker.d.ts +13 -0
- package/src/components/SidebarNavigationTracker.js +93 -0
- package/src/components/Slider.d.ts +11 -0
- package/src/components/Slider.js +119 -0
- package/src/components/SmsOpeningAnimation.d.ts +8 -0
- package/src/components/SmsOpeningAnimation.js +52 -0
- package/src/components/Space.d.ts +10 -0
- package/src/components/Space.js +23 -0
- package/src/components/Stack.d.ts +12 -0
- package/src/components/Stack.js +23 -0
- package/src/components/StepDots.d.ts +7 -0
- package/src/components/StepDots.js +24 -0
- package/src/components/Stepper.d.ts +9 -0
- package/src/components/Stepper.js +67 -0
- package/src/components/SuccessIcon.d.ts +8 -0
- package/src/components/SuccessIcon.js +4 -0
- package/src/components/Svg.d.ts +145 -0
- package/src/components/Svg.js +24 -0
- package/src/components/SwanLogo.d.ts +8 -0
- package/src/components/SwanLogo.js +11 -0
- package/src/components/Switch.d.ts +9 -0
- package/src/components/Switch.js +74 -0
- package/src/components/TabView.d.ts +16 -0
- package/src/components/TabView.js +398 -0
- package/src/components/Table.d.ts +34 -0
- package/src/components/Table.js +79 -0
- package/src/components/Tag.d.ts +17 -0
- package/src/components/Tag.js +76 -0
- package/src/components/Tile.d.ts +34 -0
- package/src/components/Tile.js +130 -0
- package/src/components/TilePlaceholder.d.ts +6 -0
- package/src/components/TilePlaceholder.js +51 -0
- package/src/components/ToastStack.d.ts +2 -0
- package/src/components/ToastStack.js +96 -0
- package/src/components/Tooltip.d.ts +18 -0
- package/src/components/Tooltip.js +162 -0
- package/src/components/TransitionGroupView.d.ts +12 -0
- package/src/components/TransitionGroupView.js +43 -0
- package/src/components/TransitionView.d.ts +12 -0
- package/src/components/TransitionView.js +43 -0
- package/src/components/WithCurrentColor.d.ts +12 -0
- package/src/components/WithCurrentColor.js +65 -0
- package/src/components/WithPartnerAccentColor.d.ts +7 -0
- package/src/components/WithPartnerAccentColor.js +91 -0
- package/src/constants/colors.d.ts +42 -0
- package/src/constants/colors.js +42 -0
- package/src/constants/commonStyles.d.ts +66 -0
- package/src/constants/commonStyles.js +45 -0
- package/src/constants/design.d.ts +168 -0
- package/src/constants/design.js +564 -0
- package/src/constants/insets.d.ts +10 -0
- package/src/constants/insets.js +22 -0
- package/src/constants/typography.d.ts +26 -0
- package/src/constants/typography.js +54 -0
- package/src/hooks/useAnimatedValue.d.ts +2 -0
- package/src/hooks/useAnimatedValue.js +3 -0
- package/src/hooks/useBodyClassName.d.ts +3 -0
- package/src/hooks/useBodyClassName.js +14 -0
- package/src/hooks/useBoolean.d.ts +8 -0
- package/src/hooks/useBoolean.js +12 -0
- package/src/hooks/useComputedColors.d.ts +10 -0
- package/src/hooks/useComputedColors.js +42 -0
- package/src/hooks/useDebounce.d.ts +1 -0
- package/src/hooks/useDebounce.js +12 -0
- package/src/hooks/useDisclosure.d.ts +8 -0
- package/src/hooks/useDisclosure.js +12 -0
- package/src/hooks/useFirstMountState.d.ts +1 -0
- package/src/hooks/useFirstMountState.js +9 -0
- package/src/hooks/useForceableState.d.ts +1 -0
- package/src/hooks/useForceableState.js +6 -0
- package/src/hooks/useHover.d.ts +11 -0
- package/src/hooks/useHover.js +4 -0
- package/src/hooks/useInterval.d.ts +1 -0
- package/src/hooks/useInterval.js +11 -0
- package/src/hooks/useLazyRef.d.ts +2 -0
- package/src/hooks/useLazyRef.js +9 -0
- package/src/hooks/useMergeRefs.d.ts +2 -0
- package/src/hooks/useMergeRefs.js +5 -0
- package/src/hooks/useNativeProp.d.ts +2 -0
- package/src/hooks/useNativeProp.js +9 -0
- package/src/hooks/useOutsideClick.d.ts +8 -0
- package/src/hooks/useOutsideClick.js +54 -0
- package/src/hooks/usePersistedState.d.ts +1 -0
- package/src/hooks/usePersistedState.js +21 -0
- package/src/hooks/usePressEvents.d.ts +31 -0
- package/src/hooks/usePressEvents.js +4 -0
- package/src/hooks/usePreviousValue.d.ts +1 -0
- package/src/hooks/usePreviousValue.js +8 -0
- package/src/hooks/useResponsive.d.ts +7 -0
- package/src/hooks/useResponsive.js +20 -0
- package/src/hooks/useUpdateEffect.d.ts +2 -0
- package/src/hooks/useUpdateEffect.js +10 -0
- package/src/hooks/useUrqlMutation.d.ts +4 -0
- package/src/hooks/useUrqlMutation.js +30 -0
- package/src/hooks/useUrqlQuery.d.ts +19 -0
- package/src/hooks/useUrqlQuery.js +73 -0
- package/src/state/toasts.d.ts +21 -0
- package/src/state/toasts.js +61 -0
- package/src/utils/__tests__/array.test.d.ts +1 -0
- package/src/utils/__tests__/array.test.js +127 -0
- package/src/utils/__tests__/base64.test.d.ts +1 -0
- package/src/utils/__tests__/base64.test.js +27 -0
- package/src/utils/__tests__/function.test.d.ts +1 -0
- package/src/utils/__tests__/function.test.js +36 -0
- package/src/utils/__tests__/object.test.d.ts +1 -0
- package/src/utils/__tests__/object.test.js +17 -0
- package/src/utils/__tests__/rifm.test.d.ts +1 -0
- package/src/utils/__tests__/rifm.test.js +124 -0
- package/src/utils/__tests__/string.test.d.ts +1 -0
- package/src/utils/__tests__/string.test.js +16 -0
- package/src/utils/a11y.d.ts +1 -0
- package/src/utils/a11y.js +18 -0
- package/src/utils/array.d.ts +6 -0
- package/src/utils/array.js +71 -0
- package/src/utils/base64.d.ts +2 -0
- package/src/utils/base64.js +20 -0
- package/src/utils/file.d.ts +2 -0
- package/src/utils/file.js +10 -0
- package/src/utils/flagCountry.d.ts +1 -0
- package/src/utils/flagCountry.js +1 -0
- package/src/utils/function.d.ts +4 -0
- package/src/utils/function.js +19 -0
- package/src/utils/math.d.ts +16 -0
- package/src/utils/math.js +47 -0
- package/src/utils/nullish.d.ts +10 -0
- package/src/utils/nullish.js +8 -0
- package/src/utils/object.d.ts +2 -0
- package/src/utils/object.js +7 -0
- package/src/utils/popper.d.ts +3 -0
- package/src/utils/popper.js +30 -0
- package/src/utils/rifm.d.ts +14 -0
- package/src/utils/rifm.js +53 -0
- package/src/utils/string.d.ts +4 -0
- package/src/utils/string.js +233 -0
- package/src/utils/timer.d.ts +11 -0
- package/src/utils/timer.js +46 -0
- package/src/utils/types.d.ts +8 -0
- package/src/utils/types.js +1 -0
- package/src/utils/userAgent.d.ts +4 -0
- package/src/utils/userAgent.js +9 -0
- package/src/utils/viewport.d.ts +1 -0
- 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,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
|
+
});
|