@cyberkaidev/ui 0.1.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/LICENSE +20 -0
- package/README.md +721 -0
- package/lib/module/ThemeProvider.js +84 -0
- package/lib/module/ThemeProvider.js.map +1 -0
- package/lib/module/components/AppBar.js +185 -0
- package/lib/module/components/AppBar.js.map +1 -0
- package/lib/module/components/BounceEffect.js +50 -0
- package/lib/module/components/BounceEffect.js.map +1 -0
- package/lib/module/components/Button.js +48 -0
- package/lib/module/components/Button.js.map +1 -0
- package/lib/module/components/Chips.js +94 -0
- package/lib/module/components/Chips.js.map +1 -0
- package/lib/module/components/IconButton.js +71 -0
- package/lib/module/components/IconButton.js.map +1 -0
- package/lib/module/components/InforList.js +92 -0
- package/lib/module/components/InforList.js.map +1 -0
- package/lib/module/components/LoadingApp.js +58 -0
- package/lib/module/components/LoadingApp.js.map +1 -0
- package/lib/module/components/Overlays.js +20 -0
- package/lib/module/components/Overlays.js.map +1 -0
- package/lib/module/components/RippleEffect.js +178 -0
- package/lib/module/components/RippleEffect.js.map +1 -0
- package/lib/module/components/Scaffold.js +172 -0
- package/lib/module/components/Scaffold.js.map +1 -0
- package/lib/module/components/SearchBar.js +161 -0
- package/lib/module/components/SearchBar.js.map +1 -0
- package/lib/module/components/SegmentedButton.js +151 -0
- package/lib/module/components/SegmentedButton.js.map +1 -0
- package/lib/module/components/ShapedButton.js +58 -0
- package/lib/module/components/ShapedButton.js.map +1 -0
- package/lib/module/components/SlideModal.js +196 -0
- package/lib/module/components/SlideModal.js.map +1 -0
- package/lib/module/components/TabBar.js +107 -0
- package/lib/module/components/TabBar.js.map +1 -0
- package/lib/module/components/Text.js +47 -0
- package/lib/module/components/Text.js.map +1 -0
- package/lib/module/components/TextButton.js +53 -0
- package/lib/module/components/TextButton.js.map +1 -0
- package/lib/module/components/TextInput.js +83 -0
- package/lib/module/components/TextInput.js.map +1 -0
- package/lib/module/components/Toast.js +101 -0
- package/lib/module/components/Toast.js.map +1 -0
- package/lib/module/hooks/useAppBarScroll.js +20 -0
- package/lib/module/hooks/useAppBarScroll.js.map +1 -0
- package/lib/module/hooks/usePressAndHoldRepeat.js +71 -0
- package/lib/module/hooks/usePressAndHoldRepeat.js.map +1 -0
- package/lib/module/icons/Icon.js +85 -0
- package/lib/module/icons/Icon.js.map +1 -0
- package/lib/module/index.js +42 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/responsive.js +28 -0
- package/lib/module/responsive.js.map +1 -0
- package/lib/module/stores/useLoadingApp.js +14 -0
- package/lib/module/stores/useLoadingApp.js.map +1 -0
- package/lib/module/stores/useToast.js +24 -0
- package/lib/module/stores/useToast.js.map +1 -0
- package/lib/module/theme.js +86 -0
- package/lib/module/theme.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/jest.setup.d.ts +2 -0
- package/lib/typescript/jest.setup.d.ts.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/ThemeProvider.d.ts +39 -0
- package/lib/typescript/src/ThemeProvider.d.ts.map +1 -0
- package/lib/typescript/src/components/AppBar.d.ts +33 -0
- package/lib/typescript/src/components/AppBar.d.ts.map +1 -0
- package/lib/typescript/src/components/BounceEffect.d.ts +12 -0
- package/lib/typescript/src/components/BounceEffect.d.ts.map +1 -0
- package/lib/typescript/src/components/Button.d.ts +24 -0
- package/lib/typescript/src/components/Button.d.ts.map +1 -0
- package/lib/typescript/src/components/Chips.d.ts +23 -0
- package/lib/typescript/src/components/Chips.d.ts.map +1 -0
- package/lib/typescript/src/components/IconButton.d.ts +14 -0
- package/lib/typescript/src/components/IconButton.d.ts.map +1 -0
- package/lib/typescript/src/components/InforList.d.ts +28 -0
- package/lib/typescript/src/components/InforList.d.ts.map +1 -0
- package/lib/typescript/src/components/LoadingApp.d.ts +8 -0
- package/lib/typescript/src/components/LoadingApp.d.ts.map +1 -0
- package/lib/typescript/src/components/Overlays.d.ts +12 -0
- package/lib/typescript/src/components/Overlays.d.ts.map +1 -0
- package/lib/typescript/src/components/RippleEffect.d.ts +18 -0
- package/lib/typescript/src/components/RippleEffect.d.ts.map +1 -0
- package/lib/typescript/src/components/Scaffold.d.ts +62 -0
- package/lib/typescript/src/components/Scaffold.d.ts.map +1 -0
- package/lib/typescript/src/components/SearchBar.d.ts +20 -0
- package/lib/typescript/src/components/SearchBar.d.ts.map +1 -0
- package/lib/typescript/src/components/SegmentedButton.d.ts +37 -0
- package/lib/typescript/src/components/SegmentedButton.d.ts.map +1 -0
- package/lib/typescript/src/components/ShapedButton.d.ts +18 -0
- package/lib/typescript/src/components/ShapedButton.d.ts.map +1 -0
- package/lib/typescript/src/components/SlideModal.d.ts +15 -0
- package/lib/typescript/src/components/SlideModal.d.ts.map +1 -0
- package/lib/typescript/src/components/TabBar.d.ts +20 -0
- package/lib/typescript/src/components/TabBar.d.ts.map +1 -0
- package/lib/typescript/src/components/Text.d.ts +26 -0
- package/lib/typescript/src/components/Text.d.ts.map +1 -0
- package/lib/typescript/src/components/TextButton.d.ts +15 -0
- package/lib/typescript/src/components/TextButton.d.ts.map +1 -0
- package/lib/typescript/src/components/TextInput.d.ts +22 -0
- package/lib/typescript/src/components/TextInput.d.ts.map +1 -0
- package/lib/typescript/src/components/Toast.d.ts +4 -0
- package/lib/typescript/src/components/Toast.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useAppBarScroll.d.ts +10 -0
- package/lib/typescript/src/hooks/useAppBarScroll.d.ts.map +1 -0
- package/lib/typescript/src/hooks/usePressAndHoldRepeat.d.ts +21 -0
- package/lib/typescript/src/hooks/usePressAndHoldRepeat.d.ts.map +1 -0
- package/lib/typescript/src/icons/Icon.d.ts +64 -0
- package/lib/typescript/src/icons/Icon.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +30 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/responsive.d.ts +15 -0
- package/lib/typescript/src/responsive.d.ts.map +1 -0
- package/lib/typescript/src/stores/useLoadingApp.d.ts +14 -0
- package/lib/typescript/src/stores/useLoadingApp.d.ts.map +1 -0
- package/lib/typescript/src/stores/useToast.d.ts +25 -0
- package/lib/typescript/src/stores/useToast.d.ts.map +1 -0
- package/lib/typescript/src/theme.d.ts +51 -0
- package/lib/typescript/src/theme.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +26 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/package.json +189 -0
- package/src/ThemeProvider.tsx +108 -0
- package/src/components/AppBar.tsx +226 -0
- package/src/components/BounceEffect.tsx +53 -0
- package/src/components/Button.tsx +70 -0
- package/src/components/Chips.tsx +115 -0
- package/src/components/IconButton.tsx +84 -0
- package/src/components/InforList.tsx +110 -0
- package/src/components/LoadingApp.tsx +55 -0
- package/src/components/Overlays.tsx +21 -0
- package/src/components/RippleEffect.tsx +244 -0
- package/src/components/Scaffold.tsx +219 -0
- package/src/components/SearchBar.tsx +166 -0
- package/src/components/SegmentedButton.tsx +206 -0
- package/src/components/ShapedButton.tsx +74 -0
- package/src/components/SlideModal.tsx +232 -0
- package/src/components/TabBar.tsx +122 -0
- package/src/components/Text.tsx +70 -0
- package/src/components/TextButton.tsx +57 -0
- package/src/components/TextInput.tsx +108 -0
- package/src/components/Toast.tsx +95 -0
- package/src/hooks/useAppBarScroll.ts +19 -0
- package/src/hooks/usePressAndHoldRepeat.ts +85 -0
- package/src/icons/Icon.tsx +51 -0
- package/src/index.tsx +64 -0
- package/src/responsive.ts +32 -0
- package/src/stores/useLoadingApp.ts +19 -0
- package/src/stores/useToast.ts +36 -0
- package/src/theme.ts +125 -0
- package/src/types.ts +27 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { StyleSheet, TextInput as RNTextInput, View } from 'react-native';
|
|
5
|
+
import { useTheme, useThemedStyles } from "../ThemeProvider.js";
|
|
6
|
+
import { heightDP } from "../responsive.js";
|
|
7
|
+
import { Text } from "./Text.js";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
/** Single-line text field with a supporting message and error state. */
|
|
10
|
+
export function TextInput({
|
|
11
|
+
value,
|
|
12
|
+
placeholder,
|
|
13
|
+
supportingText,
|
|
14
|
+
isError = false,
|
|
15
|
+
autoFocus,
|
|
16
|
+
autoCapitalize,
|
|
17
|
+
autoCorrect,
|
|
18
|
+
autoComplete,
|
|
19
|
+
inputMode,
|
|
20
|
+
onEnter,
|
|
21
|
+
onChangeText,
|
|
22
|
+
onBlur
|
|
23
|
+
}) {
|
|
24
|
+
const {
|
|
25
|
+
colors,
|
|
26
|
+
spaces
|
|
27
|
+
} = useTheme();
|
|
28
|
+
const styles = useThemedStyles(makeStyles);
|
|
29
|
+
const [isFocused, setIsFocused] = React.useState(false);
|
|
30
|
+
const borderColor = isError ? colors.red : isFocused ? colors.primary : colors.border;
|
|
31
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
32
|
+
style: styles.container,
|
|
33
|
+
children: [/*#__PURE__*/_jsx(RNTextInput, {
|
|
34
|
+
testID: "text-input-field",
|
|
35
|
+
style: [styles.input, {
|
|
36
|
+
backgroundColor: colors.on_surface,
|
|
37
|
+
color: colors.text,
|
|
38
|
+
borderColor
|
|
39
|
+
}],
|
|
40
|
+
placeholder: placeholder,
|
|
41
|
+
autoFocus: autoFocus,
|
|
42
|
+
autoCapitalize: autoCapitalize,
|
|
43
|
+
autoCorrect: autoCorrect,
|
|
44
|
+
autoComplete: autoComplete,
|
|
45
|
+
inputMode: inputMode,
|
|
46
|
+
cursorColor: colors.primary,
|
|
47
|
+
placeholderTextColor: colors.text,
|
|
48
|
+
onChangeText: onChangeText,
|
|
49
|
+
onFocus: () => setIsFocused(true),
|
|
50
|
+
onBlur: event => {
|
|
51
|
+
setIsFocused(false);
|
|
52
|
+
onBlur?.(event);
|
|
53
|
+
},
|
|
54
|
+
value: value,
|
|
55
|
+
onSubmitEditing: () => {
|
|
56
|
+
if (value.trim().length > 0) onEnter?.();
|
|
57
|
+
},
|
|
58
|
+
returnKeyType: "done"
|
|
59
|
+
}), supportingText ? /*#__PURE__*/_jsx(Text, {
|
|
60
|
+
color: colors.red,
|
|
61
|
+
size: "xs",
|
|
62
|
+
marginL: spaces.horizontal.s,
|
|
63
|
+
children: supportingText
|
|
64
|
+
}) : null]
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function makeStyles(t) {
|
|
68
|
+
return StyleSheet.create({
|
|
69
|
+
container: {
|
|
70
|
+
width: '100%',
|
|
71
|
+
gap: t.spaces.vertical.xs
|
|
72
|
+
},
|
|
73
|
+
input: {
|
|
74
|
+
width: '100%',
|
|
75
|
+
height: heightDP(7),
|
|
76
|
+
borderWidth: 1,
|
|
77
|
+
borderRadius: t.borderRadius.radius_15,
|
|
78
|
+
paddingHorizontal: t.spaces.horizontal.l,
|
|
79
|
+
fontSize: t.fontSizes.s
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=TextInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","StyleSheet","TextInput","RNTextInput","View","useTheme","useThemedStyles","heightDP","Text","jsx","_jsx","jsxs","_jsxs","value","placeholder","supportingText","isError","autoFocus","autoCapitalize","autoCorrect","autoComplete","inputMode","onEnter","onChangeText","onBlur","colors","spaces","styles","makeStyles","isFocused","setIsFocused","useState","borderColor","red","primary","border","style","container","children","testID","input","backgroundColor","on_surface","color","text","cursorColor","placeholderTextColor","onFocus","event","onSubmitEditing","trim","length","returnKeyType","size","marginL","horizontal","s","t","create","width","gap","vertical","xs","height","borderWidth","borderRadius","radius_15","paddingHorizontal","l","fontSize","fontSizes"],"sourceRoot":"../../../src","sources":["components/TextInput.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,EAAEC,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
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Animated, StyleSheet, View } from 'react-native';
|
|
5
|
+
import { Icon } from "../icons/Icon.js";
|
|
6
|
+
import { useTheme, useThemedStyles } from "../ThemeProvider.js";
|
|
7
|
+
import { useToast } from "../stores/useToast.js";
|
|
8
|
+
import { Text } from "./Text.js";
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
const VISIBLE_MS = 3000;
|
|
11
|
+
const FADE_MS = 300;
|
|
12
|
+
const iconByVariant = {
|
|
13
|
+
error: 'error',
|
|
14
|
+
success: 'check',
|
|
15
|
+
info: null
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** Transient centered notice. Drive it with `useToast().showToast(...)`. */
|
|
19
|
+
export function Toast() {
|
|
20
|
+
const {
|
|
21
|
+
colors
|
|
22
|
+
} = useTheme();
|
|
23
|
+
const styles = useThemedStyles(makeStyles);
|
|
24
|
+
const {
|
|
25
|
+
visible,
|
|
26
|
+
variant,
|
|
27
|
+
message,
|
|
28
|
+
hideToast
|
|
29
|
+
} = useToast();
|
|
30
|
+
const opacity = React.useRef(new Animated.Value(0)).current;
|
|
31
|
+
React.useEffect(() => {
|
|
32
|
+
if (!visible) return;
|
|
33
|
+
let hideTimer;
|
|
34
|
+
const enter = Animated.timing(opacity, {
|
|
35
|
+
toValue: 1,
|
|
36
|
+
duration: FADE_MS,
|
|
37
|
+
useNativeDriver: true
|
|
38
|
+
});
|
|
39
|
+
enter.start(() => {
|
|
40
|
+
hideTimer = setTimeout(() => {
|
|
41
|
+
Animated.timing(opacity, {
|
|
42
|
+
toValue: 0,
|
|
43
|
+
duration: FADE_MS,
|
|
44
|
+
useNativeDriver: true
|
|
45
|
+
}).start(() => hideToast());
|
|
46
|
+
}, VISIBLE_MS);
|
|
47
|
+
});
|
|
48
|
+
return () => {
|
|
49
|
+
enter.stop();
|
|
50
|
+
clearTimeout(hideTimer);
|
|
51
|
+
};
|
|
52
|
+
// `message`/`variant` restart the fade + auto-hide cycle when a new toast is
|
|
53
|
+
// shown while one is already visible.
|
|
54
|
+
}, [visible, message, variant, opacity, hideToast]);
|
|
55
|
+
if (!visible) return null;
|
|
56
|
+
const iconName = iconByVariant[variant];
|
|
57
|
+
const iconColor = variant === 'error' ? colors.red : colors.green;
|
|
58
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
59
|
+
style: [styles.background, {
|
|
60
|
+
opacity
|
|
61
|
+
}],
|
|
62
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
63
|
+
style: [styles.content, {
|
|
64
|
+
backgroundColor: colors.background
|
|
65
|
+
}],
|
|
66
|
+
children: [iconName && /*#__PURE__*/_jsx(Icon, {
|
|
67
|
+
name: iconName,
|
|
68
|
+
color: iconColor
|
|
69
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
70
|
+
weight: "medium",
|
|
71
|
+
size: "xs",
|
|
72
|
+
textAlign: "center",
|
|
73
|
+
children: message
|
|
74
|
+
})]
|
|
75
|
+
})
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function makeStyles(t) {
|
|
79
|
+
return StyleSheet.create({
|
|
80
|
+
background: {
|
|
81
|
+
position: 'absolute',
|
|
82
|
+
top: 0,
|
|
83
|
+
left: 0,
|
|
84
|
+
right: 0,
|
|
85
|
+
bottom: 0,
|
|
86
|
+
justifyContent: 'center',
|
|
87
|
+
alignItems: 'center',
|
|
88
|
+
pointerEvents: 'none'
|
|
89
|
+
},
|
|
90
|
+
content: {
|
|
91
|
+
flexDirection: 'row',
|
|
92
|
+
alignItems: 'center',
|
|
93
|
+
gap: t.spaces.horizontal.s,
|
|
94
|
+
borderRadius: t.borderRadius.radius_20,
|
|
95
|
+
paddingVertical: t.spaces.vertical.s,
|
|
96
|
+
paddingHorizontal: t.spaces.horizontal.l,
|
|
97
|
+
pointerEvents: 'none'
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=Toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Animated","StyleSheet","View","Icon","useTheme","useThemedStyles","useToast","Text","jsx","_jsx","jsxs","_jsxs","VISIBLE_MS","FADE_MS","iconByVariant","error","success","info","Toast","colors","styles","makeStyles","visible","variant","message","hideToast","opacity","useRef","Value","current","useEffect","hideTimer","enter","timing","toValue","duration","useNativeDriver","start","setTimeout","stop","clearTimeout","iconName","iconColor","red","green","style","background","children","content","backgroundColor","name","color","weight","size","textAlign","t","create","position","top","left","right","bottom","justifyContent","alignItems","pointerEvents","flexDirection","gap","spaces","horizontal","s","borderRadius","radius_20","paddingVertical","vertical","paddingHorizontal","l"],"sourceRoot":"../../../src","sources":["components/Toast.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAEzD,SAASC,IAAI,QAAQ,kBAAe;AAEpC,SAASC,QAAQ,EAAEC,eAAe,QAAQ,qBAAkB;AAC5D,SAASC,QAAQ,QAAQ,uBAAoB;AAG7C,SAASC,IAAI,QAAQ,WAAQ;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE9B,MAAMC,UAAU,GAAG,IAAI;AACvB,MAAMC,OAAO,GAAG,GAAG;AAEnB,MAAMC,aAA4D,GAAG;EACnEC,KAAK,EAAE,OAAO;EACdC,OAAO,EAAE,OAAO;EAChBC,IAAI,EAAE;AACR,CAAC;;AAED;AACA,OAAO,SAASC,KAAKA,CAAA,EAAG;EACtB,MAAM;IAAEC;EAAO,CAAC,GAAGf,QAAQ,CAAC,CAAC;EAC7B,MAAMgB,MAAM,GAAGf,eAAe,CAACgB,UAAU,CAAC;EAC1C,MAAM;IAAEC,OAAO;IAAEC,OAAO;IAAEC,OAAO;IAAEC;EAAU,CAA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andler, useSharedValue } from 'react-native-reanimated';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Tracks vertical scroll offset for the collapsing `AppBar`. Spread
|
|
7
|
+
* `scrollHandler` onto an `Animated.ScrollView`/`Scaffold` `onScroll` and pass
|
|
8
|
+
* `scrollY` to `<AppBar scrollY={...} />`.
|
|
9
|
+
*/
|
|
10
|
+
export function useAppBarScroll() {
|
|
11
|
+
const scrollY = useSharedValue(0);
|
|
12
|
+
const scrollHandler = useAnimatedScrollHandler(event => {
|
|
13
|
+
scrollY.value = event.contentOffset.y;
|
|
14
|
+
});
|
|
15
|
+
return {
|
|
16
|
+
scrollY,
|
|
17
|
+
scrollHandler
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=useAppBarScroll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useAnimatedScrollHandler","useSharedValue","useAppBarScroll","scrollY","scrollHandler","event","value","contentOffset","y"],"sourceRoot":"../../../src","sources":["hooks/useAppBarScroll.ts"],"mappings":";;AAAA,SACEA,wBAAwB,EACxBC,cAAc,QACT,yBAAyB;;AAEhC;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAAA,EAAG;EAChC,MAAMC,OAAO,GAAGF,cAAc,CAAC,CAAC,CAAC;EAEjC,MAAMG,aAAa,GAAGJ,wBAAwB,CAAEK,KAAK,IAAK;IACxDF,OAAO,CAACG,KAAK,GAAGD,KAAK,CAACE,aAAa,CAACC,CAAC;EACvC,CAAC,CAAC;EAEF,OAAO;IAAEL,OAAO;IAAEC;EAAc,CAAC;AACnC","ignoreList":[]}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
// Delay after the initial press before the automatic repeat kicks in.
|
|
5
|
+
const HOLD_START_DELAY_MS = 350;
|
|
6
|
+
// Interval between the first few repeats.
|
|
7
|
+
const INITIAL_REPEAT_INTERVAL_MS = 250;
|
|
8
|
+
// Fastest the repeat is allowed to get.
|
|
9
|
+
const MIN_REPEAT_INTERVAL_MS = 40;
|
|
10
|
+
// Each repeat multiplies the interval by this, so the value accelerates while held.
|
|
11
|
+
const ACCELERATION_FACTOR = 0.82;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Press-and-hold with acceleration, decoupled from any domain.
|
|
15
|
+
*
|
|
16
|
+
* Wire the returned handlers to a pressable: `onPressIn` fires `onTrigger` once
|
|
17
|
+
* immediately (so a quick tap steps by one) and, if the press is held past
|
|
18
|
+
* `HOLD_START_DELAY_MS`, keeps firing it on a shrinking interval until `onPressOut`
|
|
19
|
+
* (or unmount). Clamping / bounds are the caller's concern — firing `onTrigger`
|
|
20
|
+
* when the value is already at a limit is expected to be a no-op.
|
|
21
|
+
*/
|
|
22
|
+
export function usePressAndHoldRepeat({
|
|
23
|
+
onTrigger,
|
|
24
|
+
disabled
|
|
25
|
+
}) {
|
|
26
|
+
const onTriggerRef = React.useRef(onTrigger);
|
|
27
|
+
const startTimeoutRef = React.useRef(null);
|
|
28
|
+
const repeatTimeoutRef = React.useRef(null);
|
|
29
|
+
React.useEffect(() => {
|
|
30
|
+
onTriggerRef.current = onTrigger;
|
|
31
|
+
});
|
|
32
|
+
const clearTimers = React.useCallback(() => {
|
|
33
|
+
if (startTimeoutRef.current !== null) {
|
|
34
|
+
clearTimeout(startTimeoutRef.current);
|
|
35
|
+
startTimeoutRef.current = null;
|
|
36
|
+
}
|
|
37
|
+
if (repeatTimeoutRef.current !== null) {
|
|
38
|
+
clearTimeout(repeatTimeoutRef.current);
|
|
39
|
+
repeatTimeoutRef.current = null;
|
|
40
|
+
}
|
|
41
|
+
}, []);
|
|
42
|
+
React.useEffect(() => clearTimers, [clearTimers]);
|
|
43
|
+
|
|
44
|
+
// Stop an in-flight repeat the moment the consumer disables the control.
|
|
45
|
+
React.useEffect(() => {
|
|
46
|
+
if (disabled) clearTimers();
|
|
47
|
+
}, [disabled, clearTimers]);
|
|
48
|
+
const onPressIn = React.useCallback(() => {
|
|
49
|
+
if (disabled) return;
|
|
50
|
+
clearTimers();
|
|
51
|
+
onTriggerRef.current();
|
|
52
|
+
function scheduleRepeat(interval) {
|
|
53
|
+
repeatTimeoutRef.current = setTimeout(() => {
|
|
54
|
+
onTriggerRef.current();
|
|
55
|
+
scheduleRepeat(Math.max(MIN_REPEAT_INTERVAL_MS, interval * ACCELERATION_FACTOR));
|
|
56
|
+
}, interval);
|
|
57
|
+
}
|
|
58
|
+
startTimeoutRef.current = setTimeout(() => {
|
|
59
|
+
startTimeoutRef.current = null;
|
|
60
|
+
scheduleRepeat(INITIAL_REPEAT_INTERVAL_MS);
|
|
61
|
+
}, HOLD_START_DELAY_MS);
|
|
62
|
+
}, [disabled, clearTimers]);
|
|
63
|
+
const onPressOut = React.useCallback(() => {
|
|
64
|
+
clearTimers();
|
|
65
|
+
}, [clearTimers]);
|
|
66
|
+
return {
|
|
67
|
+
onPressIn,
|
|
68
|
+
onPressOut
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=usePressAndHoldRepeat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","HOLD_START_DELAY_MS","INITIAL_REPEAT_INTERVAL_MS","MIN_REPEAT_INTERVAL_MS","ACCELERATION_FACTOR","usePressAndHoldRepeat","onTrigger","disabled","onTriggerRef","useRef","startTimeoutRef","repeatTimeoutRef","useEffect","current","clearTimers","useCallback","clearTimeout","onPressIn","scheduleRepeat","interval","setTimeout","Math","max","onPressOut"],"sourceRoot":"../../../src","sources":["hooks/usePressAndHoldRepeat.ts"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AASzB;AACA,MAAMC,mBAAmB,GAAG,GAAG;AAC/B;AACA,MAAMC,0BAA0B,GAAG,GAAG;AACtC;AACA,MAAMC,sBAAsB,GAAG,EAAE;AACjC;AACA,MAAMC,mBAAmB,GAAG,IAAI;;AAE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AAY,CAACK,OAAO,CAAC,CAAC;QACtBK,cAAc,CACZG,IAAI,CAACC,GAAG,CAACnB,sBAAsB,EAAEgB,QAAQ,GAAGf,mBAAmB,CACjE,CAAC;MACH,CAAC,EAAEe,QAAQ,CAAC;IACd;IAEAT,eAAe,CAACG,OAAO,GAAGO,UAAU,CAAC,MAAM;MACzCV,eAAe,CAACG,OAAO,GAAG,IAAI;MAC9BK,cAAc,CAAChB,0BAA0B,CAAC;IAC5C,CAAC,EAAED,mBAAmB,CAAC;EACzB,CAAC,EAAE,CAACM,QAAQ,EAAEO,WAAW,CAAC,CAAC;EAE3B,MAAMS,UAAU,GAAGvB,KAAK,CAACe,WAAW,CAAC,MAAM;IACzCD,WAAW,CAAC,CAAC;EACf,CAAC,EAAE,CAACA,WAAW,CAAC,CAAC;EAEjB,OAAO;IAAEG,SAAS;IAAEM;EAAW,CAAC;AAClC","ignoreList":[]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { SymbolView } from 'expo-symbols';
|
|
4
|
+
import { useTheme } from "../ThemeProvider.js";
|
|
5
|
+
|
|
6
|
+
// Curated set of generic UI icons. Each entry maps a public name to a
|
|
7
|
+
// per-platform SF Symbol / Android symbol.
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
const names = {
|
|
10
|
+
check: {
|
|
11
|
+
ios: 'checkmark',
|
|
12
|
+
android: 'check'
|
|
13
|
+
},
|
|
14
|
+
remove: {
|
|
15
|
+
ios: 'minus',
|
|
16
|
+
android: 'remove'
|
|
17
|
+
},
|
|
18
|
+
add: {
|
|
19
|
+
ios: 'plus',
|
|
20
|
+
android: 'add'
|
|
21
|
+
},
|
|
22
|
+
settings: {
|
|
23
|
+
ios: 'gear',
|
|
24
|
+
android: 'settings'
|
|
25
|
+
},
|
|
26
|
+
arrow_back: {
|
|
27
|
+
ios: 'chevron.left',
|
|
28
|
+
android: 'arrow_back'
|
|
29
|
+
},
|
|
30
|
+
search: {
|
|
31
|
+
ios: 'magnifyingglass',
|
|
32
|
+
android: 'search'
|
|
33
|
+
},
|
|
34
|
+
edit: {
|
|
35
|
+
ios: 'pencil',
|
|
36
|
+
android: 'edit'
|
|
37
|
+
},
|
|
38
|
+
error: {
|
|
39
|
+
ios: 'x.circle',
|
|
40
|
+
android: 'error'
|
|
41
|
+
},
|
|
42
|
+
close: {
|
|
43
|
+
ios: 'xmark',
|
|
44
|
+
android: 'close'
|
|
45
|
+
},
|
|
46
|
+
folder: {
|
|
47
|
+
ios: 'folder',
|
|
48
|
+
android: 'folder'
|
|
49
|
+
},
|
|
50
|
+
question: {
|
|
51
|
+
ios: 'questionmark',
|
|
52
|
+
android: 'question_mark'
|
|
53
|
+
},
|
|
54
|
+
filter: {
|
|
55
|
+
ios: 'line.3.horizontal.decrease',
|
|
56
|
+
android: 'filter_list'
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
/** Renders a curated UI icon via `expo-symbols` (`SymbolView`). */
|
|
60
|
+
export function Icon({
|
|
61
|
+
name,
|
|
62
|
+
color,
|
|
63
|
+
size,
|
|
64
|
+
testID
|
|
65
|
+
}) {
|
|
66
|
+
const {
|
|
67
|
+
colors,
|
|
68
|
+
iconSize
|
|
69
|
+
} = useTheme();
|
|
70
|
+
|
|
71
|
+
// Built as an object and spread: under the react-native-strict-api types,
|
|
72
|
+
// `SymbolViewProps` doesn't surface the inherited `ViewProps` members
|
|
73
|
+
// (`testID`, a11y props) to JSX excess-property checks, so a literal
|
|
74
|
+
// `testID=` attribute fails to typecheck even though it's forwarded natively.
|
|
75
|
+
const props = {
|
|
76
|
+
testID: testID ?? `icon-${name}`,
|
|
77
|
+
name: names[name],
|
|
78
|
+
tintColor: color ?? colors.primary,
|
|
79
|
+
size: size ?? iconSize.m
|
|
80
|
+
};
|
|
81
|
+
return /*#__PURE__*/_jsx(SymbolView, {
|
|
82
|
+
...props
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=Icon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SymbolView","useTheme","jsx","_jsx","names","check","ios","android","remove","add","settings","arrow_back","search","edit","error","close","folder","question","filter","Icon","name","color","size","testID","colors","iconSize","props","tintColor","primary","m"],"sourceRoot":"../../../src","sources":["icons/Icon.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;AAGzC,SAASC,QAAQ,QAAQ,qBAAkB;;AAE3C;AACA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AACA,MAAMC,KAAK,GAAG;EACZC,KAAK,EAAE;IAAEC,GAAG,EAAE,WAAW;IAAEC,OAAO,EAAE;EAAQ,CAAC;EAC7CC,MAAM,EAAE;IAAEF,GAAG,EAAE,OAAO;IAAEC,OAAO,EAAE;EAAS,CAAC;EAC3CE,GAAG,EAAE;IAAEH,GAAG,EAAE,MAAM;IAAEC,OAAO,EAAE;EAAM,CAAC;EACpCG,QAAQ,EAAE;IAAEJ,GAAG,EAAE,MAAM;IAAEC,OAAO,EAAE;EAAW,CAAC;EAC9CI,UAAU,EAAE;IAAEL,GAAG,EAAE,cAAc;IAAEC,OAAO,EAAE;EAAa,CAAC;EAC1DK,MAAM,EAAE;IAAEN,GAAG,EAAE,iBAAiB;IAAEC,OAAO,EAAE;EAAS,CAAC;EACrDM,IAAI,EAAE;IAAEP,GAAG,EAAE,QAAQ;IAAEC,OAAO,EAAE;EAAO,CAAC;EACxCO,KAAK,EAAE;IAAER,GAAG,EAAE,UAAU;IAAEC,OAAO,EAAE;EAAQ,CAAC;EAC5CQ,KAAK,EAAE;IAAET,GAAG,EAAE,OAAO;IAAEC,OAAO,EAAE;EAAQ,CAAC;EACzCS,MAAM,EAAE;IAAEV,GAAG,EAAE,QAAQ;IAAEC,OAAO,EAAE;EAAS,CAAC;EAC5CU,QAAQ,EAAE;IAAEX,GAAG,EAAE,cAAc;IAAEC,OAAO,EAAE;EAAgB,CAAC;EAC3DW,MAAM,EAAE;IAAEZ,GAAG,EAAE,4BAA4B;IAAEC,OAAO,EAAE;EAAc;AACtE,CAAqE;AAcrE;AACA,OAAO,SAASY,IAAIA,CAAC;EAAEC,IAAI;EAAEC,KAAK;EAAEC,IAAI;EAAEC;AAAc,CAAC,EAAE;EACzD,MAAM;IAAEC,MAAM;IAAEC;EAAS,CAAC,GAAGxB,QAAQ,CAAC,CAAC;;EAEvC;EACA;EACA;EACA;EACA,MAAMyB,KAAK,GAAG;IACZH,MAAM,EAAEA,MAAM,IAAI,QAAQH,IAAI,EAAE;IAChCA,IAAI,EAAEhB,KAAK,CAACgB,IAAI,CAAC;IACjBO,SAAS,EAAEN,KAAK,IAAIG,MAAM,CAACI,OAAO;IAClCN,IAAI,EAAEA,IAAI,IAAIG,QAAQ,CAACI;EACzB,CAAC;EAED,oBAAO1B,IAAA,CAACH,UAAU;IAAA,GAAK0B;EAAK,CAAG,CAAC;AAClC","ignoreList":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// components
|
|
4
|
+
export * from "./components/AppBar.js";
|
|
5
|
+
export * from "./components/BounceEffect.js";
|
|
6
|
+
export * from "./components/Button.js";
|
|
7
|
+
export * from "./components/Chips.js";
|
|
8
|
+
export * from "./components/IconButton.js";
|
|
9
|
+
export * from "./components/InforList.js";
|
|
10
|
+
export * from "./components/LoadingApp.js";
|
|
11
|
+
export * from "./components/Overlays.js";
|
|
12
|
+
export * from "./components/RippleEffect.js";
|
|
13
|
+
export * from "./components/Scaffold.js";
|
|
14
|
+
export * from "./components/SearchBar.js";
|
|
15
|
+
export * from "./components/SegmentedButton.js";
|
|
16
|
+
export * from "./components/ShapedButton.js";
|
|
17
|
+
export * from "./components/SlideModal.js";
|
|
18
|
+
export * from "./components/TabBar.js";
|
|
19
|
+
export * from "./components/Text.js";
|
|
20
|
+
export * from "./components/TextButton.js";
|
|
21
|
+
export * from "./components/TextInput.js";
|
|
22
|
+
export * from "./components/Toast.js";
|
|
23
|
+
|
|
24
|
+
// icons
|
|
25
|
+
export * from "./icons/Icon.js";
|
|
26
|
+
|
|
27
|
+
// theme + provider
|
|
28
|
+
export { ThemeProvider, useTheme, useColors, useThemedStyles } from "./ThemeProvider.js";
|
|
29
|
+
export { colors, fontSizes, iconSize, spaces, borderRadius, pageSpacing, defaultTokens } from "./theme.js";
|
|
30
|
+
// responsive helpers
|
|
31
|
+
export { widthDP, heightDP } from "./responsive.js";
|
|
32
|
+
|
|
33
|
+
// hooks
|
|
34
|
+
export * from "./hooks/useAppBarScroll.js";
|
|
35
|
+
export * from "./hooks/usePressAndHoldRepeat.js";
|
|
36
|
+
|
|
37
|
+
// global state
|
|
38
|
+
export { useToast } from "./stores/useToast.js";
|
|
39
|
+
export { useLoadingApp } from "./stores/useLoadingApp.js";
|
|
40
|
+
|
|
41
|
+
// shared style types
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ThemeProvider","useTheme","useColors","useThemedStyles","colors","fontSizes","iconSize","spaces","borderRadius","pageSpacing","defaultTokens","widthDP","heightDP","useToast","useLoadingApp"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA;AACA,cAAc,wBAAqB;AACnC,cAAc,8BAA2B;AACzC,cAAc,wBAAqB;AACnC,cAAc,uBAAoB;AAClC,cAAc,4BAAyB;AACvC,cAAc,2BAAwB;AACtC,cAAc,4BAAyB;AACvC,cAAc,0BAAuB;AACrC,cAAc,8BAA2B;AACzC,cAAc,0BAAuB;AACrC,cAAc,2BAAwB;AACtC,cAAc,iCAA8B;AAC5C,cAAc,8BAA2B;AACzC,cAAc,4BAAyB;AACvC,cAAc,wBAAqB;AACnC,cAAc,sBAAmB;AACjC,cAAc,4BAAyB;AACvC,cAAc,2BAAwB;AACtC,cAAc,uBAAoB;;AAElC;AACA,cAAc,iBAAc;;AAE5B;AACA,SACEA,aAAa,EACbC,QAAQ,EACRC,SAAS,EACTC,eAAe,QACV,oBAAiB;AACxB,SACEC,MAAM,EACNC,SAAS,EACTC,QAAQ,EACRC,MAAM,EACNC,YAAY,EACZC,WAAW,EACXC,aAAa,QACR,YAAS;AAYhB;AACA,SAASC,OAAO,EAAEC,QAAQ,QAAQ,iBAAc;;AAEhD;AACA,cAAc,4BAAyB;AACvC,cAAc,kCAA+B;;AAE7C;AACA,SAASC,QAAQ,QAAQ,sBAAmB;AAC5C,SAASC,aAAa,QAAQ,2BAAwB;;AAEtD","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Dimensions, PixelRatio } from 'react-native';
|
|
4
|
+
const screenWidth = Dimensions.get('window').width;
|
|
5
|
+
const screenHeight = Dimensions.get('window').height;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Convert a percentage of the screen width to a density-independent pixel value.
|
|
9
|
+
*
|
|
10
|
+
* @param widthPercent Percentage of the screen width (number, or numeric string).
|
|
11
|
+
* @returns The value in dp, rounded to the nearest physical pixel.
|
|
12
|
+
*/
|
|
13
|
+
export function widthDP(widthPercent) {
|
|
14
|
+
const elemWidth = typeof widthPercent === 'number' ? widthPercent : parseFloat(widthPercent);
|
|
15
|
+
return PixelRatio.roundToNearestPixel(screenWidth * elemWidth / 100);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Convert a percentage of the screen height to a density-independent pixel value.
|
|
20
|
+
*
|
|
21
|
+
* @param heightPercent Percentage of the screen height (number, or numeric string).
|
|
22
|
+
* @returns The value in dp, rounded to the nearest physical pixel.
|
|
23
|
+
*/
|
|
24
|
+
export function heightDP(heightPercent) {
|
|
25
|
+
const elemHeight = typeof heightPercent === 'number' ? heightPercent : parseFloat(heightPercent);
|
|
26
|
+
return PixelRatio.roundToNearestPixel(screenHeight * elemHeight / 100);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=responsive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Dimensions","PixelRatio","screenWidth","get","width","screenHeight","height","widthDP","widthPercent","elemWidth","parseFloat","roundToNearestPixel","heightDP","heightPercent","elemHeight"],"sourceRoot":"../../src","sources":["responsive.ts"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,UAAU,QAAQ,cAAc;AAErD,MAAMC,WAAW,GAAGF,UAAU,CAACG,GAAG,CAAC,QAAQ,CAAC,CAACC,KAAK;AAClD,MAAMC,YAAY,GAAGL,UAAU,CAACG,GAAG,CAAC,QAAQ,CAAC,CAACG,MAAM;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,OAAOA,CAACC,YAA6B,EAAU;EAC7D,MAAMC,SAAS,GACb,OAAOD,YAAY,KAAK,QAAQ,GAAGA,YAAY,GAAGE,UAAU,CAACF,YAAY,CAAC;EAE5E,OAAOP,UAAU,CAACU,mBAAmB,CAAET,WAAW,GAAGO,SAAS,GAAI,GAAG,CAAC;AACxE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,QAAQA,CAACC,aAA8B,EAAU;EAC/D,MAAMC,UAAU,GACd,OAAOD,aAAa,KAAK,QAAQ,GAC7BA,aAAa,GACbH,UAAU,CAACG,aAAa,CAAC;EAE/B,OAAOZ,UAAU,CAACU,mBAAmB,CAAEN,YAAY,GAAGS,UAAU,GAAI,GAAG,CAAC;AAC1E","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { create } from 'zustand';
|
|
4
|
+
/**
|
|
5
|
+
* Global state for the blocking `<LoadingApp />` overlay. Render it once near
|
|
6
|
+
* the root and drive it with `useLoadingApp.getState().setLoadingVisible(...)`.
|
|
7
|
+
*/
|
|
8
|
+
export const useLoadingApp = create(set => ({
|
|
9
|
+
visible: false,
|
|
10
|
+
setLoadingVisible: visible => set({
|
|
11
|
+
visible
|
|
12
|
+
})
|
|
13
|
+
}));
|
|
14
|
+
//# sourceMappingURL=useLoadingApp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["create","useLoadingApp","set","visible","setLoadingVisible"],"sourceRoot":"../../../src","sources":["stores/useLoadingApp.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,SAAS;AAWhC;AACA;AACA;AACA;AACA,OAAO,MAAMC,aAAa,GAAGD,MAAM,CAAmBE,GAAG,KAAM;EAC7DC,OAAO,EAAE,KAAK;EACdC,iBAAiB,EAAGD,OAAO,IAAKD,GAAG,CAAC;IAAEC;EAAQ,CAAC;AACjD,CAAC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { create } from 'zustand';
|
|
4
|
+
/**
|
|
5
|
+
* Global toast state. Render `<Toast />` once near the root; call
|
|
6
|
+
* `useToast.getState().showToast(...)` (or the hook) from anywhere.
|
|
7
|
+
*/
|
|
8
|
+
export const useToast = create(set => ({
|
|
9
|
+
visible: false,
|
|
10
|
+
variant: 'info',
|
|
11
|
+
message: '',
|
|
12
|
+
showToast: ({
|
|
13
|
+
message,
|
|
14
|
+
variant = 'info'
|
|
15
|
+
}) => set({
|
|
16
|
+
message,
|
|
17
|
+
variant,
|
|
18
|
+
visible: true
|
|
19
|
+
}),
|
|
20
|
+
hideToast: () => set({
|
|
21
|
+
visible: false
|
|
22
|
+
})
|
|
23
|
+
}));
|
|
24
|
+
//# sourceMappingURL=useToast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["create","useToast","set","visible","variant","message","showToast","hideToast"],"sourceRoot":"../../../src","sources":["stores/useToast.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,SAAS;AAwBhC;AACA;AACA;AACA;AACA,OAAO,MAAMC,QAAQ,GAAGD,MAAM,CAAmBE,GAAG,KAAM;EACxDC,OAAO,EAAE,KAAK;EACdC,OAAO,EAAE,MAAM;EACfC,OAAO,EAAE,EAAE;EACXC,SAAS,EAAEA,CAAC;IAAED,OAAO;IAAED,OAAO,GAAG;EAAO,CAAC,KACvCF,GAAG,CAAC;IAAEG,OAAO;IAAED,OAAO;IAAED,OAAO,EAAE;EAAK,CAAC,CAAC;EAC1CI,SAAS,EAAEA,CAAA,KAAML,GAAG,CAAC;IAAEC,OAAO,EAAE;EAAM,CAAC;AACzC,CAAC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { heightDP, widthDP } from "./responsive.js";
|
|
4
|
+
/**
|
|
5
|
+
* A ready-made color palette. `ThemeProvider` **requires** a `colors` prop — pass
|
|
6
|
+
* this, spread from it, or provide your own `ColorsType`.
|
|
7
|
+
*/
|
|
8
|
+
export const colors = {
|
|
9
|
+
background: 'black',
|
|
10
|
+
background_60: 'rgba(0,0,0,0.6)',
|
|
11
|
+
on_surface: '#1A191E',
|
|
12
|
+
surface: '#100e12',
|
|
13
|
+
surface_90: 'rgba(16, 14, 18, 0.9)',
|
|
14
|
+
border: '#3D3B40',
|
|
15
|
+
text: '#f6f1ff',
|
|
16
|
+
primary: '#4284ff',
|
|
17
|
+
red: '#ff0004',
|
|
18
|
+
green: '#00ff2a',
|
|
19
|
+
amber: '#FFC107',
|
|
20
|
+
transparent: 'transparent'
|
|
21
|
+
};
|
|
22
|
+
/** Default font sizes, in dp. */
|
|
23
|
+
export const fontSizes = {
|
|
24
|
+
xxxl: heightDP(4.3),
|
|
25
|
+
xxl: heightDP(3.8),
|
|
26
|
+
xl: heightDP(3.2),
|
|
27
|
+
l: heightDP(2.8),
|
|
28
|
+
m: heightDP(2.3),
|
|
29
|
+
s: heightDP(2),
|
|
30
|
+
xs: heightDP(1.5)
|
|
31
|
+
};
|
|
32
|
+
/** Default icon sizes, in dp. */
|
|
33
|
+
export const iconSize = {
|
|
34
|
+
xl: heightDP(5),
|
|
35
|
+
l: heightDP(4),
|
|
36
|
+
m: heightDP(3.4),
|
|
37
|
+
s: heightDP(2.3)
|
|
38
|
+
};
|
|
39
|
+
/** Default spacing scale, in dp. */
|
|
40
|
+
export const spaces = {
|
|
41
|
+
horizontal: {
|
|
42
|
+
xs: heightDP(1),
|
|
43
|
+
s: widthDP(2),
|
|
44
|
+
m: widthDP(3),
|
|
45
|
+
l: widthDP(4),
|
|
46
|
+
xl: widthDP(5),
|
|
47
|
+
xxl: widthDP(8)
|
|
48
|
+
},
|
|
49
|
+
vertical: {
|
|
50
|
+
xs: heightDP(0.7),
|
|
51
|
+
s: heightDP(1),
|
|
52
|
+
m: heightDP(2),
|
|
53
|
+
l: heightDP(3),
|
|
54
|
+
xl: heightDP(4),
|
|
55
|
+
xxl: heightDP(7)
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
/** Default border radius scale. */
|
|
59
|
+
export const borderRadius = {
|
|
60
|
+
radius_5: 5,
|
|
61
|
+
radius_10: 10,
|
|
62
|
+
radius_15: 15,
|
|
63
|
+
radius_20: 20,
|
|
64
|
+
radius_100: '100%'
|
|
65
|
+
};
|
|
66
|
+
/** Default page insets used by `Scaffold` and the fixed bars. */
|
|
67
|
+
export const pageSpacing = {
|
|
68
|
+
horizontal: spaces.horizontal.l,
|
|
69
|
+
top: spaces.vertical.l,
|
|
70
|
+
bottom: spaces.horizontal.l
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/** Everything in `ThemeType` except `colors`. */
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Defaults for the non-color token groups. `ThemeProvider` merges any override
|
|
77
|
+
* on top of these (there is no default palette — `colors` is required).
|
|
78
|
+
*/
|
|
79
|
+
export const defaultTokens = {
|
|
80
|
+
fontSizes,
|
|
81
|
+
iconSize,
|
|
82
|
+
spaces,
|
|
83
|
+
borderRadius,
|
|
84
|
+
pageSpacing
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["heightDP","widthDP","colors","background","background_60","on_surface","surface","surface_90","border","text","primary","red","green","amber","transparent","fontSizes","xxxl","xxl","xl","l","m","s","xs","iconSize","spaces","horizontal","vertical","borderRadius","radius_5","radius_10","radius_15","radius_20","radius_100","pageSpacing","top","bottom","defaultTokens"],"sourceRoot":"../../src","sources":["theme.ts"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,OAAO,QAAQ,iBAAc;AAGhD;AACA;AACA;AACA;AACA,OAAO,MAAMC,MAAkB,GAAG;EAChCC,UAAU,EAAE,OAAO;EACnBC,aAAa,EAAE,iBAAiB;EAChCC,UAAU,EAAE,SAAS;EACrBC,OAAO,EAAE,SAAS;EAClBC,UAAU,EAAE,uBAAuB;EACnCC,MAAM,EAAE,SAAS;EACjBC,IAAI,EAAE,SAAS;EACfC,OAAO,EAAE,SAAS;EAClBC,GAAG,EAAE,SAAS;EACdC,KAAK,EAAE,SAAS;EAChBC,KAAK,EAAE,SAAS;EAChBC,WAAW,EAAE;AACf,CAAC;AAID;AACA,OAAO,MAAMC,SAAwB,GAAG;EACtCC,IAAI,EAAEhB,QAAQ,CAAC,GAAG,CAAC;EACnBiB,GAAG,EAAEjB,QAAQ,CAAC,GAAG,CAAC;EAClBkB,EAAE,EAAElB,QAAQ,CAAC,GAAG,CAAC;EACjBmB,CAAC,EAAEnB,QAAQ,CAAC,GAAG,CAAC;EAChBoB,CAAC,EAAEpB,QAAQ,CAAC,GAAG,CAAC;EAChBqB,CAAC,EAAErB,QAAQ,CAAC,CAAC,CAAC;EACdsB,EAAE,EAAEtB,QAAQ,CAAC,GAAG;AAClB,CAAC;AAID;AACA,OAAO,MAAMuB,QAAuB,GAAG;EACrCL,EAAE,EAAElB,QAAQ,CAAC,CAAC,CAAC;EACfmB,CAAC,EAAEnB,QAAQ,CAAC,CAAC,CAAC;EACdoB,CAAC,EAAEpB,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[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jest.setup.d.ts","sourceRoot":"","sources":["../../jest.setup.ts"],"names":[],"mappings":"AAAA,OAAO,+BAA+B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|