@swan-io/lake 4.10.1 → 5.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 (37) hide show
  1. package/package.json +2 -2
  2. package/src/components/Box.d.ts +27 -12
  3. package/src/components/Box.js +18 -8
  4. package/src/components/Filters.d.ts +1 -1
  5. package/src/components/Filters.js +11 -9
  6. package/src/components/LakeSelect.d.ts +5 -2
  7. package/src/components/LakeSelect.js +5 -5
  8. package/src/components/LakeSlider.d.ts +6 -6
  9. package/src/components/LakeSlider.js +7 -28
  10. package/src/components/Stack.d.ts +3 -1
  11. package/src/components/Stack.js +3 -9
  12. package/src/utils/function.d.ts +0 -2
  13. package/src/utils/function.js +0 -5
  14. package/src/components/BorderedButton.d.ts +0 -16
  15. package/src/components/BorderedButton.js +0 -100
  16. package/src/components/Caption.d.ts +0 -6
  17. package/src/components/Caption.js +0 -11
  18. package/src/components/FailureIcon.d.ts +0 -7
  19. package/src/components/FailureIcon.js +0 -4
  20. package/src/components/Heading.d.ts +0 -158
  21. package/src/components/Heading.js +0 -27
  22. package/src/components/Input.d.ts +0 -34
  23. package/src/components/Input.js +0 -110
  24. package/src/components/Label.d.ts +0 -10
  25. package/src/components/Label.js +0 -19
  26. package/src/components/Modal.d.ts +0 -12
  27. package/src/components/Modal.js +0 -90
  28. package/src/components/Slider.d.ts +0 -11
  29. package/src/components/Slider.js +0 -136
  30. package/src/components/SuccessIcon.d.ts +0 -7
  31. package/src/components/SuccessIcon.js +0 -4
  32. package/src/components/Tooltip.d.ts +0 -18
  33. package/src/components/Tooltip.js +0 -160
  34. package/src/constants/colors.d.ts +0 -42
  35. package/src/constants/colors.js +0 -42
  36. package/src/constants/typography.d.ts +0 -26
  37. package/src/constants/typography.js +0 -54
@@ -1,158 +0,0 @@
1
- import { ReactNode } from "react";
2
- import { Text } from "react-native";
3
- declare const sizes: {
4
- 40: {
5
- fontSize: number;
6
- color: string;
7
- fontWeight: "600";
8
- lineHeight: number;
9
- fontFamily: string;
10
- letterSpacing: number;
11
- };
12
- 32: {
13
- fontSize: number;
14
- color: string;
15
- fontWeight: "600";
16
- lineHeight: number;
17
- fontFamily: string;
18
- letterSpacing: number;
19
- };
20
- 28: {
21
- fontSize: number;
22
- color: string;
23
- fontWeight: "600";
24
- lineHeight: number;
25
- fontFamily: string;
26
- letterSpacing: number;
27
- };
28
- 24: {
29
- fontSize: number;
30
- color: string;
31
- fontWeight: "600";
32
- lineHeight: number;
33
- fontFamily: string;
34
- letterSpacing: number;
35
- };
36
- 20: {
37
- fontSize: number;
38
- color: string;
39
- fontWeight: "600";
40
- lineHeight: number;
41
- fontFamily: string;
42
- letterSpacing: number;
43
- };
44
- 16: {
45
- fontSize: number;
46
- color: string;
47
- fontWeight: "600";
48
- lineHeight: number;
49
- fontFamily: string;
50
- letterSpacing: number;
51
- };
52
- };
53
- type HeadingSize = keyof typeof sizes;
54
- export declare const Heading: import("react").ForwardRefExoticComponent<{
55
- allowFontScaling?: boolean | undefined;
56
- children?: ReactNode;
57
- ellipsizeMode?: "clip" | "middle" | "head" | "tail" | undefined;
58
- id?: string | undefined;
59
- lineBreakMode?: "clip" | "middle" | "head" | "tail" | undefined;
60
- numberOfLines?: number | undefined;
61
- onLayout?: ((event: import("react-native").LayoutChangeEvent) => void) | undefined;
62
- onTextLayout?: ((event: import("react-native").NativeSyntheticEvent<import("react-native").TextLayoutEventData>) => void) | undefined;
63
- onPress?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
64
- onPressIn?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
65
- onPressOut?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
66
- onLongPress?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
67
- style?: import("react-native").StyleProp<import("react-native").TextStyle>;
68
- testID?: string | undefined;
69
- nativeID?: string | undefined;
70
- maxFontSizeMultiplier?: number | null | undefined;
71
- href?: string | undefined;
72
- hrefAttrs?: import("react-native").HrefAttrs | undefined;
73
- lang?: string | undefined;
74
- adjustsFontSizeToFit?: boolean | undefined;
75
- dynamicTypeRamp?: "body" | "caption2" | "caption1" | "footnote" | "subheadline" | "callout" | "headline" | "title3" | "title2" | "title1" | "largeTitle" | undefined;
76
- minimumFontScale?: number | undefined;
77
- suppressHighlighting?: boolean | undefined;
78
- lineBreakStrategyIOS?: "none" | "standard" | "hangul-word" | "push-out" | undefined;
79
- disabled?: boolean | undefined;
80
- selectable?: boolean | undefined;
81
- selectionColor?: import("react-native").ColorValue | undefined;
82
- textBreakStrategy?: "simple" | "highQuality" | "balanced" | undefined;
83
- dataDetectorType?: "none" | "all" | "link" | "phoneNumber" | "email" | null | undefined;
84
- android_hyphenationFrequency?: "normal" | "none" | "full" | undefined;
85
- accessible?: boolean | undefined;
86
- accessibilityActions?: readonly Readonly<{
87
- name: string;
88
- label?: string | undefined;
89
- }>[] | undefined;
90
- accessibilityLabel?: string | undefined;
91
- "aria-label"?: string | undefined;
92
- accessibilityRole?: import("react-native").AccessibilityRole | undefined;
93
- accessibilityState?: import("react-native").AccessibilityState | undefined;
94
- "aria-busy"?: boolean | undefined;
95
- "aria-checked"?: boolean | "mixed" | undefined;
96
- "aria-disabled"?: boolean | undefined;
97
- "aria-expanded"?: boolean | undefined;
98
- "aria-selected"?: boolean | undefined;
99
- "aria-labelledby"?: string | undefined;
100
- accessibilityHint?: string | undefined;
101
- accessibilityValue?: import("react-native").AccessibilityValue | undefined;
102
- "aria-valuemax"?: number | undefined;
103
- "aria-valuemin"?: number | undefined;
104
- "aria-valuenow"?: number | undefined;
105
- "aria-valuetext"?: string | undefined;
106
- onAccessibilityAction?: ((event: import("react-native").AccessibilityActionEvent) => void) | undefined;
107
- importantForAccessibility?: "auto" | "yes" | "no" | "no-hide-descendants" | undefined;
108
- "aria-hidden"?: boolean | undefined;
109
- "aria-live"?: "polite" | "assertive" | "off" | undefined;
110
- "aria-modal"?: boolean | undefined;
111
- accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined;
112
- accessibilityLabelledBy?: string | string[] | undefined;
113
- accessibilityElementsHidden?: boolean | undefined;
114
- accessibilityViewIsModal?: boolean | undefined;
115
- onAccessibilityEscape?: (() => void) | undefined;
116
- onAccessibilityTap?: (() => void) | undefined;
117
- onMagicTap?: (() => void) | undefined;
118
- accessibilityIgnoresInvertColors?: boolean | undefined;
119
- accessibilityLanguage?: string | undefined;
120
- tabIndex?: 0 | -1 | undefined;
121
- "aria-activedescendant"?: string | undefined;
122
- "aria-atomic"?: boolean | undefined;
123
- "aria-autocomplete"?: string | undefined;
124
- "aria-colcount"?: number | undefined;
125
- "aria-colindex"?: number | undefined;
126
- "aria-colspan"?: number | undefined;
127
- "aria-controls"?: string | undefined;
128
- "aria-current"?: boolean | "time" | "page" | "step" | "location" | "date" | undefined;
129
- "aria-describedby"?: string | undefined;
130
- "aria-details"?: string | undefined;
131
- "aria-errormessage"?: string | undefined;
132
- "aria-flowto"?: string | undefined;
133
- "aria-haspopup"?: string | undefined;
134
- "aria-invalid"?: boolean | undefined;
135
- "aria-keyshortcuts"?: string | undefined;
136
- "aria-level"?: number | undefined;
137
- "aria-multiline"?: boolean | undefined;
138
- "aria-multiselectable"?: boolean | undefined;
139
- "aria-orientation"?: "horizontal" | "vertical" | undefined;
140
- "aria-owns"?: string | undefined;
141
- "aria-placeholder"?: string | undefined;
142
- "aria-posinset"?: number | undefined;
143
- "aria-pressed"?: boolean | undefined;
144
- "aria-readonly"?: boolean | undefined;
145
- "aria-required"?: boolean | undefined;
146
- "aria-roledescription"?: string | undefined;
147
- "aria-rowcount"?: number | undefined;
148
- "aria-rowindex"?: number | undefined;
149
- "aria-rowspan"?: number | undefined;
150
- "aria-setsize"?: number | undefined;
151
- "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
152
- } & {
153
- level: 1 | 2 | 3 | 4 | 5 | 6;
154
- align?: "left" | "right" | "center" | undefined;
155
- size: HeadingSize;
156
- children: ReactNode;
157
- } & import("react").RefAttributes<Text>>;
158
- export {};
@@ -1,27 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
- import { StyleSheet, Text } from "react-native";
4
- import { colors } from "../constants/colors";
5
- import { typography } from "../constants/typography";
6
- const baseStyle = {
7
- ...typography.interFont,
8
- color: colors.gray[100],
9
- fontWeight: typography.fontWeights.demi,
10
- lineHeight: typography.lineHeights.title,
11
- };
12
- /* eslint-disable react-native/no-unused-styles */
13
- const alignments = StyleSheet.create({
14
- center: { textAlign: "center" },
15
- left: { textAlign: "left" },
16
- right: { textAlign: "right" },
17
- });
18
- const sizes = StyleSheet.create({
19
- 40: { ...baseStyle, fontSize: 40 },
20
- 32: { ...baseStyle, fontSize: 32 },
21
- 28: { ...baseStyle, fontSize: 28 },
22
- 24: { ...baseStyle, fontSize: 24 },
23
- 20: { ...baseStyle, fontSize: 20 },
24
- 16: { ...baseStyle, fontSize: 16 },
25
- /* eslint-enable react-native/no-unused-styles */
26
- });
27
- export const Heading = forwardRef(({ children, align = "left", size, level, style, ...props }, forwardedRef) => (_jsx(Text, { ref: forwardedRef, role: "heading", "aria-level": level, style: [sizes[size], alignments[align], style], ...props, children: children })));
@@ -1,34 +0,0 @@
1
- import { ChangeEventHandler, ReactNode } from "react";
2
- import { NativeSyntheticEvent, StyleProp, TextInput, TextInputProps, TextStyle, ViewStyle, WebRole } from "react-native";
3
- import { IconName } from "./Icon";
4
- type Props = {
5
- ariaControls?: string;
6
- ariaExpanded?: boolean;
7
- disabled?: boolean;
8
- error?: string;
9
- icon?: IconName;
10
- inputContainerStyle?: StyleProp<ViewStyle>;
11
- role?: WebRole;
12
- inputMode?: TextInputProps["inputMode"];
13
- enterKeyHint?: TextInputProps["enterKeyHint"];
14
- maxLength?: number;
15
- label?: string;
16
- onFocus?: (event: NativeSyntheticEvent<React.FocusEvent>) => void;
17
- onBlur?: (event: NativeSyntheticEvent<React.FocusEvent>) => void;
18
- onSubmitEditing?: TextInputProps["onSubmitEditing"];
19
- onChange?: ChangeEventHandler<HTMLInputElement>;
20
- onValueChange?: TextInputProps["onChangeText"];
21
- onKeyPress?: TextInputProps["onKeyPress"];
22
- placeholder?: string;
23
- readOnly?: boolean;
24
- size?: "large" | "small";
25
- successful?: boolean;
26
- suffix?: string;
27
- value?: string;
28
- style?: StyleProp<ViewStyle>;
29
- inputStyle?: StyleProp<TextStyle>;
30
- RightComponent?: ReactNode;
31
- hideErrorMessage?: boolean;
32
- };
33
- export declare const Input: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<TextInput>>>;
34
- export {};
@@ -1,110 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef, memo, useId, useRef } from "react";
3
- import { StyleSheet, Text, View, } from "react-native";
4
- import { colors } from "../constants/colors";
5
- import { commonStyles } from "../constants/commonStyles";
6
- import { shadows } from "../constants/design";
7
- import { typography } from "../constants/typography";
8
- import { useMergeRefs } from "../hooks/useMergeRefs";
9
- import { isNotNullish } from "../utils/nullish";
10
- import { Box } from "./Box";
11
- import { Icon } from "./Icon";
12
- import { InputError } from "./InputError";
13
- import { Label } from "./Label";
14
- import { PressableTextInput } from "./Pressable";
15
- import { Space } from "./Space";
16
- const styles = StyleSheet.create({
17
- base: {
18
- ...typography.bodyLarge,
19
- lineHeight: typography.bodyLarge.fontSize,
20
- backgroundColor: colors.white,
21
- borderColor: colors.gray[10],
22
- borderRadius: 4,
23
- borderWidth: 1,
24
- flexGrow: 1,
25
- flexShrink: 1,
26
- height: 48,
27
- maxWidth: "100%",
28
- outlineStyle: "none",
29
- paddingHorizontal: 16,
30
- placeholderTextColor: colors.gray[30],
31
- textOverflow: "ellipsis",
32
- transitionDuration: "150ms",
33
- transitionProperty: "border-color, box-shadow",
34
- whiteSpace: "nowrap",
35
- wordBreak: "keep-all",
36
- },
37
- small: {
38
- height: 40,
39
- },
40
- focused: {
41
- borderColor: colors.gray[20],
42
- boxShadow: shadows.tile,
43
- },
44
- disabled: {
45
- backgroundColor: colors.gray[3],
46
- borderColor: colors.gray[3],
47
- cursor: "not-allowed",
48
- },
49
- hovered: {
50
- boxShadow: shadows.tile,
51
- },
52
- leftIcon: {
53
- position: "absolute",
54
- left: 16,
55
- },
56
- withLeftIcon: {
57
- paddingLeft: 48,
58
- },
59
- withSuffix: {
60
- borderBottomRightRadius: 0,
61
- borderTopRightRadius: 0,
62
- },
63
- rightIcon: {
64
- position: "absolute",
65
- right: 16,
66
- },
67
- errored: {
68
- borderColor: colors.red[100],
69
- paddingRight: 48,
70
- },
71
- successful: {
72
- borderColor: colors.green[100],
73
- paddingRight: 48,
74
- },
75
- suffix: {
76
- alignItems: "center",
77
- backgroundColor: colors.gray[3],
78
- borderBottomRightRadius: 4,
79
- borderTopRightRadius: 4,
80
- borderColor: colors.gray[10],
81
- borderLeftWidth: 0,
82
- borderWidth: 1,
83
- justifyContent: "center",
84
- paddingHorizontal: 16,
85
- },
86
- suffixDisabled: {
87
- borderWidth: 0,
88
- },
89
- suffixText: {
90
- ...typography.bodyLarge,
91
- },
92
- });
93
- export const Input = memo(forwardRef(({ ariaControls, ariaExpanded, disabled = false, error, icon, inputContainerStyle, role, inputMode, enterKeyHint, maxLength, label = "", onFocus, onBlur, onSubmitEditing, onChange, onValueChange, onKeyPress, placeholder, readOnly = false, size = "large", successful = false, suffix = "", value = "", style, inputStyle, RightComponent = null, hideErrorMessage = false, }, forwardedRef) => {
94
- const ref = useRef(null);
95
- const mergedRef = useMergeRefs(ref, forwardedRef);
96
- const labelId = `label-${useId()}`;
97
- const id = `input-${useId()}`;
98
- const errored = isNotNullish(error);
99
- return (_jsxs(View, { style: style, children: [label !== "" && (_jsxs(_Fragment, { children: [_jsx(Label, { id: labelId, htmlFor: id, children: label }), _jsx(Space, { height: 8 })] })), _jsxs(Box, { direction: "row", style: inputContainerStyle, children: [_jsxs(Box, { direction: "row", alignItems: "center", style: commonStyles.fill, children: [_jsx(PressableTextInput, { ref: mergedRef, "aria-controls": ariaControls, "aria-expanded": ariaExpanded, "aria-labelledby": labelId, id: id, allowFontScaling: false, autoComplete: "off", role: role, readOnly: readOnly || disabled, inputMode: inputMode, enterKeyHint: enterKeyHint, multiline: false, rows: 1, maxLength: maxLength, onFocus: onFocus, onBlur: onBlur, onChange: onChange, onChangeText: onValueChange, onSubmitEditing: onSubmitEditing, onKeyPress: onKeyPress, placeholder: placeholder, value: value, style: ({ hovered, focused }) => [
100
- styles.base,
101
- size === "small" && styles.small,
102
- isNotNullish(icon) && styles.withLeftIcon,
103
- suffix !== "" && styles.withSuffix,
104
- disabled ? styles.disabled : focused ? styles.focused : hovered && styles.hovered,
105
- errored && styles.errored,
106
- successful && styles.successful,
107
- inputStyle,
108
- ] }), icon && (_jsx(Icon, { name: icon, color: colors.gray[50], size: 20, style: styles.leftIcon })), successful ? (_jsx(Icon, { name: "checkmark-filled", color: colors.green[100], size: 20, style: styles.rightIcon })) : errored ? (_jsx(Icon, { name: "error-circle-regular", size: 20, color: colors.red[100], style: styles.rightIcon })) : null] }), suffix !== "" && (_jsx(View, { style: [styles.suffix, disabled && styles.suffixDisabled], children: _jsx(Text, { numberOfLines: 1, style: styles.suffixText, children: suffix }) })), Boolean(RightComponent) && (_jsxs(_Fragment, { children: [_jsx(Space, { width: 8 }), RightComponent] }))] }), !hideErrorMessage && _jsx(InputError, { message: error })] }));
109
- }));
110
- Input.displayName = "Input";
@@ -1,10 +0,0 @@
1
- import { ReactNode } from "react";
2
- import { TextProps } from "react-native";
3
- import { Except } from "type-fest";
4
- type Props = Except<TextProps, "role"> & {
5
- children?: ReactNode;
6
- htmlFor?: string;
7
- id?: string;
8
- };
9
- export declare const Label: ({ htmlFor, id, style, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
10
- export {};
@@ -1,19 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useRef } from "react";
3
- import { StyleSheet, Text } from "react-native";
4
- import { colors } from "../constants/colors";
5
- import { typography } from "../constants/typography";
6
- import { useNativeProp } from "../hooks/useNativeProp";
7
- const styles = StyleSheet.create({
8
- base: {
9
- ...typography.bodyLarge,
10
- color: colors.gray[60],
11
- lineHeight: typography.lineHeights.title,
12
- paddingHorizontal: 3, // borderRadius / 2
13
- },
14
- });
15
- export const Label = ({ htmlFor, id, style, ...props }) => {
16
- const ref = useRef(null);
17
- useNativeProp(ref, "for", htmlFor);
18
- return _jsx(Text, { ref: ref, id: id, role: "label", style: [styles.base, style], ...props });
19
- };
@@ -1,12 +0,0 @@
1
- import { ReactNode, ReactText } from "react";
2
- import { Modal as BaseModal, StyleProp, ViewStyle } from "react-native";
3
- type Props = {
4
- children?: ReactNode;
5
- onDismiss?: () => void;
6
- title?: ReactText;
7
- style?: StyleProp<ViewStyle>;
8
- visible?: boolean;
9
- wrapContent?: boolean;
10
- };
11
- export declare const Modal: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<BaseModal>>>;
12
- export {};
@@ -1,90 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef, memo } from "react";
3
- import { Modal as BaseModal, Pressable, ScrollView, StyleSheet, View, } from "react-native";
4
- import { backgroundColor, colors, radii } from "../constants/design";
5
- import { useResponsive } from "../hooks/useResponsive";
6
- import { Box } from "./Box";
7
- import { Fill } from "./Fill";
8
- import { Heading } from "./Heading";
9
- import { Icon } from "./Icon";
10
- import { Separator } from "./Separator";
11
- const styles = StyleSheet.create({
12
- // eslint-disable-next-line react-native/no-color-literals
13
- blanket: {
14
- ...StyleSheet.absoluteFillObject,
15
- backgroundColor: "rgba(0,0,0,0.5)",
16
- cursor: "default",
17
- flexGrow: 1,
18
- flexShrink: 1,
19
- },
20
- outbox: {
21
- margin: 16,
22
- pointerEvents: "box-none",
23
- flexGrow: 1,
24
- flexShrink: 1,
25
- },
26
- desktopOutbox: {
27
- margin: 32,
28
- },
29
- modal: {
30
- backgroundColor: backgroundColor.accented,
31
- borderRadius: radii[8],
32
- flexGrow: 1,
33
- flexShrink: 1,
34
- overflow: "hidden",
35
- },
36
- wrapped: {
37
- flexGrow: 0,
38
- margin: "auto",
39
- },
40
- desktopModal: {
41
- flexGrow: 0,
42
- margin: "auto",
43
- width: 800,
44
- maxWidth: "100%",
45
- },
46
- content: {
47
- minHeight: "100%",
48
- padding: 20,
49
- },
50
- contentDesktop: {
51
- padding: 40,
52
- },
53
- title: {
54
- flexGrow: 1,
55
- flexShrink: 1,
56
- paddingLeft: 20,
57
- paddingVertical: 20,
58
- },
59
- titleHeader: {
60
- paddingLeft: 40,
61
- paddingVertical: 32,
62
- },
63
- dismissButton: {
64
- padding: 20,
65
- right: 0,
66
- transitionProperty: "opacity",
67
- transitionDuration: "150ms",
68
- },
69
- dismissButtonPressed: {
70
- opacity: 0.5,
71
- },
72
- dismissButtonDesktop: {
73
- marginVertical: 12,
74
- marginRight: 20,
75
- },
76
- });
77
- export const Modal = memo(forwardRef(({ children, onDismiss, title = "", style, visible = false, wrapContent = false }, forwardedRef) => {
78
- const { desktop, media } = useResponsive();
79
- return (_jsxs(BaseModal, { ref: forwardedRef, animationType: "fade", visible: visible, transparent: true, onDismiss: onDismiss, onRequestClose: onDismiss, children: [_jsx(Pressable, { role: "none", tabIndex: -1, onPress: onDismiss, style: styles.blanket }), _jsx(View, { style: [styles.outbox, desktop && styles.desktopOutbox], children: _jsxs(View, { style: [
80
- styles.modal,
81
- desktop && styles.desktopModal,
82
- wrapContent && styles.wrapped,
83
- style,
84
- ], children: [_jsxs(Box, { direction: "row", role: "banner", alignItems: "center", children: [title !== "" ? (_jsx(Heading, { size: media({ mobile: 20, desktop: 24 }), level: 2, style: [styles.title, desktop && styles.titleHeader], children: title })) : (_jsx(Fill, {})), onDismiss && (_jsx(Pressable, { role: "button", onPress: onDismiss, style: ({ pressed }) => [
85
- styles.dismissButton,
86
- desktop && styles.dismissButtonDesktop,
87
- pressed && styles.dismissButtonPressed,
88
- ], children: _jsx(Icon, { name: "dismiss-filled", size: 18, color: colors.gray[500] }) }))] }), title !== "" && _jsx(Separator, {}), _jsx(ScrollView, { contentContainerStyle: desktop ? styles.contentDesktop : styles.content, children: children })] }) })] }));
89
- }));
90
- Modal.displayName = "Modal";
@@ -1,11 +0,0 @@
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) => import("react/jsx-runtime").JSX.Element>;
11
- export {};
@@ -1,136 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { memo, useEffect, useRef } from "react";
3
- import { 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 animation = useAnimatedValue(value);
55
- const barRef = useRef(null);
56
- const buttonRef = useRef(null);
57
- useEffect(() => {
58
- const interpolateValue = interpolate({
59
- inputRange: [minimum, maximum],
60
- clamp: true,
61
- outputRange: [0, 100],
62
- });
63
- const id = animation.addListener(({ value }) => {
64
- const interpolated = interpolateValue(value);
65
- if (barRef.current instanceof HTMLElement) {
66
- barRef.current.style.transform = `scaleX(${interpolated})`;
67
- }
68
- if (buttonRef.current instanceof HTMLElement) {
69
- buttonRef.current.style.left = `${interpolated}%`;
70
- }
71
- });
72
- return () => {
73
- animation.removeListener(id);
74
- };
75
- }, [animation, minimum, maximum]);
76
- // Update position on value change
77
- useEffect(() => {
78
- !interacting.current && animation.setValue(value);
79
- }, [animation, value]);
80
- // Update disabled ref for pan responder
81
- useEffect(() => {
82
- disabledRef.current = disabled;
83
- }, [disabled]);
84
- const handleLayout = ({ nativeEvent: { layout } }) => {
85
- var _a;
86
- left.current = (_a = layout.left) !== null && _a !== void 0 ? _a : 0;
87
- width.current = layout.width;
88
- };
89
- const handleKeyDown = ({ nativeEvent }) => {
90
- if (!onValueChange || disabled) {
91
- return;
92
- }
93
- match(nativeEvent.key)
94
- .with("ArrowUp", "ArrowRight", () => onValueChange(Math.min(value + step, maximum)))
95
- .with("ArrowDown", "ArrowLeft", () => onValueChange(Math.max(value - step, minimum)))
96
- .otherwise(() => { });
97
- };
98
- const panResponder = useRef(PanResponder.create({
99
- onMoveShouldSetPanResponder: () => true,
100
- onPanResponderGrant: () => {
101
- interacting.current = true;
102
- document.body.style.userSelect = "none";
103
- },
104
- onPanResponderMove: event => {
105
- if (onValueChange && !disabledRef.current) {
106
- const nextValue = computeValue({
107
- minimum,
108
- maximum,
109
- step,
110
- position: event.nativeEvent.pageX,
111
- origin: left.current,
112
- width: width.current,
113
- });
114
- onValueChange(nextValue);
115
- animation.setValue(nextValue);
116
- }
117
- },
118
- onPanResponderRelease: event => {
119
- interacting.current = false;
120
- document.body.style.userSelect = "";
121
- if (onValueChange && !disabledRef.current) {
122
- const nextValue = computeValue({
123
- minimum,
124
- maximum,
125
- step,
126
- position: event.nativeEvent.pageX,
127
- origin: left.current,
128
- width: width.current,
129
- });
130
- onValueChange(nextValue);
131
- animation.setValue(nextValue);
132
- }
133
- },
134
- })).current;
135
- return (_jsxs(View, { tabIndex: disabled ? -1 : 0, style: [styles.container, disabled && styles.disabled], onLayout: handleLayout, onKeyDown: handleKeyDown, ...panResponder.panHandlers, children: [_jsx(View, { style: styles.bar, children: _jsx(View, { ref: barRef, style: styles.barFill }) }), _jsx(View, { ref: buttonRef, style: styles.button })] }));
136
- });
@@ -1,7 +0,0 @@
1
- import { StyleProp, ViewStyle } from "react-native";
2
- type Props = {
3
- size: number;
4
- style?: StyleProp<ViewStyle>;
5
- };
6
- export declare const SuccessIcon: ({ size, style }: Props) => import("react/jsx-runtime").JSX.Element;
7
- export {};
@@ -1,4 +0,0 @@
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] }) }));
@@ -1,18 +0,0 @@
1
- import { ReactNode, RefObject } from "react";
2
- type Props = {
3
- children: ReactNode;
4
- describedBy?: string;
5
- matchReferenceWidth?: boolean;
6
- onHide?: () => void;
7
- onShow?: () => void;
8
- placement: "top" | "bottom";
9
- referenceRef: RefObject<unknown>;
10
- width?: number;
11
- togglableOnFocus?: boolean;
12
- };
13
- export type TooltipRef = {
14
- show: () => void;
15
- hide: () => void;
16
- };
17
- export declare const Tooltip: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<TooltipRef>>>;
18
- export {};