sapo-components-ui-rn 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/README.md +69 -0
- package/dist/assets/error.png +0 -0
- package/dist/assets/icon-checkbox-active.svg +4 -0
- package/dist/assets/icon-checkbox.svg +3 -0
- package/dist/assets/image_default.png +0 -0
- package/dist/assets/images/error.png +0 -0
- package/dist/assets/images/image_default.png +0 -0
- package/dist/assets/images/info.png +0 -0
- package/dist/assets/images/success.png +0 -0
- package/dist/assets/images/warning.png +0 -0
- package/dist/assets/info.png +0 -0
- package/dist/assets/success.png +0 -0
- package/dist/assets/svg/icon-checkbox-active.svg +4 -0
- package/dist/assets/svg/icon-checkbox.svg +3 -0
- package/dist/assets/warning.png +0 -0
- package/dist/components/ActivityIndicator.d.ts +28 -0
- package/dist/components/Avatar/index.d.ts +17 -0
- package/dist/components/Badge/index.d.ts +13 -0
- package/dist/components/Button/index.d.ts +23 -0
- package/dist/components/ButtonIcon/index.d.ts +18 -0
- package/dist/components/Checkbox/index.d.ts +14 -0
- package/dist/components/ChipBar/index.d.ts +16 -0
- package/dist/components/CountingDot/index.d.ts +13 -0
- package/dist/components/FloatingButton/index.d.ts +17 -0
- package/dist/components/Icon/index.d.ts +17 -0
- package/dist/components/IconSvg/index.d.ts +12 -0
- package/dist/components/Image/index.d.ts +14 -0
- package/dist/components/ProgressBar.d.ts +42 -0
- package/dist/components/RadioButton/index.d.ts +13 -0
- package/dist/components/ScaleButton/index.d.ts +4 -0
- package/dist/components/SelectionField/index.d.ts +24 -0
- package/dist/components/Spacer/index.d.ts +9 -0
- package/dist/components/Switch/Switch.d.ts +47 -0
- package/dist/components/Switch/utils.d.ts +14 -0
- package/dist/components/Text/index.d.ts +14 -0
- package/dist/components/TextInput/Addons/Outline.d.ts +15 -0
- package/dist/components/TextInput/Addons/Underline.d.ts +19 -0
- package/dist/components/TextInput/Adornment/TextInputAdornment.d.ts +43 -0
- package/dist/components/TextInput/Adornment/TextInputAffix.d.ts +72 -0
- package/dist/components/TextInput/Adornment/enums.d.ts +12 -0
- package/dist/components/TextInput/Adornment/types.d.ts +11 -0
- package/dist/components/TextInput/Adornment/utils.d.ts +11 -0
- package/dist/components/TextInput/Label/InputLabel.d.ts +4 -0
- package/dist/components/TextInput/Label/LabelBackground.d.ts +4 -0
- package/dist/components/TextInput/TextInput.d.ts +171 -0
- package/dist/components/TextInput/TextInputDefault.d.ts +4 -0
- package/dist/components/TextInput/TextInputFlat.d.ts +4 -0
- package/dist/components/TextInput/constants.d.ts +31 -0
- package/dist/components/TextInput/helpers.d.ts +95 -0
- package/dist/components/TextInput/types.d.ts +154 -0
- package/dist/components/Toast/ToastProvider.d.ts +21 -0
- package/dist/components/Toast/index.d.ts +3 -0
- package/dist/components/Typography/AnimatedText.d.ts +34 -0
- package/dist/components/Typography/StyledText.d.ts +12 -0
- package/dist/components/Typography/Text.d.ts +35 -0
- package/dist/components/Typography/types.d.ts +2 -0
- package/dist/components/View/index.d.ts +38 -0
- package/dist/components/ViewVisibleAnimated/index.d.ts +25 -0
- package/dist/constants.d.ts +1 -0
- package/dist/core/theming.d.ts +43 -0
- package/dist/icons/IconArrowDown.d.ts +4 -0
- package/dist/icons/IconCheckbox.d.ts +4 -0
- package/dist/icons/IconCheckboxActive.d.ts +4 -0
- package/dist/icons/IconClearText.d.ts +4 -0
- package/dist/icons/IconRadio.d.ts +4 -0
- package/dist/icons/IconRadioActive.d.ts +4 -0
- package/dist/icons/IconRadioDisable.d.ts +4 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.esm.js +6758 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +6823 -0
- package/dist/index.js.map +1 -0
- package/dist/styles/fonts.d.ts +78 -0
- package/dist/styles/overlay.d.ts +3 -0
- package/dist/styles/shadow.d.ts +18 -0
- package/dist/styles/themes/DarkTheme.d.ts +2 -0
- package/dist/styles/themes/LightTheme.d.ts +2 -0
- package/dist/styles/themes/index.d.ts +2 -0
- package/dist/styles/themes/tokens.d.ts +830 -0
- package/dist/theme/blue.d.ts +14 -0
- package/dist/theme/colors.d.ts +99 -0
- package/dist/theme/container-styles.d.ts +124 -0
- package/dist/theme/dimensions.d.ts +36 -0
- package/dist/theme/green.d.ts +15 -0
- package/dist/theme/icon.d.ts +5 -0
- package/dist/theme/ink.d.ts +11 -0
- package/dist/theme/orange.d.ts +14 -0
- package/dist/theme/purple.d.ts +6 -0
- package/dist/theme/red.d.ts +15 -0
- package/dist/theme/themes.d.ts +277 -0
- package/dist/theme/white.d.ts +10 -0
- package/dist/theme/yellow.d.ts +15 -0
- package/dist/types/index.d.ts +65 -0
- package/dist/types.d.ts +220 -0
- package/dist/utils/BackHandler/BackHandler.d.ts +9 -0
- package/dist/utils/BackHandler/BackHandler.native.d.ts +2 -0
- package/dist/utils/addEventListener.d.ts +12 -0
- package/dist/utils/forwardRef.d.ts +11 -0
- package/dist/utils/function-utils.d.ts +12 -0
- package/dist/utils/getContrastingColor.d.ts +2 -0
- package/dist/utils/hasTouchHandler.d.ts +5 -0
- package/dist/utils/roundLayoutSize.d.ts +1 -0
- package/dist/utils/splitStyles.d.ts +19 -0
- package/dist/utils/toast-manager.d.ts +21 -0
- package/dist/utils/useAnimatedValue.d.ts +2 -0
- package/dist/utils/useAnimatedValueArray.d.ts +2 -0
- package/dist/utils/useIsKeyboardShown.d.ts +6 -0
- package/dist/utils/useLayout.d.ts +6 -0
- package/dist/utils/useLazyRef.d.ts +2 -0
- package/package.json +104 -0
- package/src/.DS_Store +0 -0
- package/src/assets/images/error.png +0 -0
- package/src/assets/images/image_default.png +0 -0
- package/src/assets/images/info.png +0 -0
- package/src/assets/images/success.png +0 -0
- package/src/assets/images/warning.png +0 -0
- package/src/assets/svg/icon-checkbox-active.svg +4 -0
- package/src/assets/svg/icon-checkbox.svg +3 -0
- package/src/babel/.eslintrc +7 -0
- package/src/babel/index.js +63 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/ActivityIndicator.tsx +238 -0
- package/src/components/Avatar/index.tsx +102 -0
- package/src/components/Badge/index.tsx +55 -0
- package/src/components/Button/index.tsx +162 -0
- package/src/components/ButtonIcon/index.tsx +98 -0
- package/src/components/Checkbox/index.tsx +107 -0
- package/src/components/ChipBar/index.tsx +112 -0
- package/src/components/CountingDot/index.tsx +63 -0
- package/src/components/FloatingButton/index.tsx +99 -0
- package/src/components/Icon/index.tsx +135 -0
- package/src/components/IconSvg/index.tsx +42 -0
- package/src/components/Image/index.tsx +127 -0
- package/src/components/ProgressBar.tsx +272 -0
- package/src/components/RadioButton/index.tsx +105 -0
- package/src/components/ScaleButton/index.tsx +17 -0
- package/src/components/SelectionField/index.tsx +166 -0
- package/src/components/Spacer/index.tsx +19 -0
- package/src/components/Switch/Switch.tsx +110 -0
- package/src/components/Switch/utils.ts +96 -0
- package/src/components/Text/index.tsx +69 -0
- package/src/components/TextInput/.DS_Store +0 -0
- package/src/components/TextInput/Addons/Outline.tsx +62 -0
- package/src/components/TextInput/Addons/Underline.tsx +71 -0
- package/src/components/TextInput/Adornment/TextInputAdornment.tsx +191 -0
- package/src/components/TextInput/Adornment/TextInputAffix.tsx +212 -0
- package/src/components/TextInput/Adornment/enums.tsx +12 -0
- package/src/components/TextInput/Adornment/types.tsx +11 -0
- package/src/components/TextInput/Adornment/utils.ts +39 -0
- package/src/components/TextInput/Label/InputLabel.tsx +216 -0
- package/src/components/TextInput/Label/LabelBackground.tsx +100 -0
- package/src/components/TextInput/TextInput.tsx +564 -0
- package/src/components/TextInput/TextInputDefault.tsx +187 -0
- package/src/components/TextInput/TextInputFlat.tsx +452 -0
- package/src/components/TextInput/constants.tsx +48 -0
- package/src/components/TextInput/helpers.tsx +546 -0
- package/src/components/TextInput/types.tsx +155 -0
- package/src/components/Toast/ToastProvider.tsx +69 -0
- package/src/components/Toast/index.tsx +239 -0
- package/src/components/Typography/AnimatedText.tsx +84 -0
- package/src/components/Typography/StyledText.tsx +53 -0
- package/src/components/Typography/Text.tsx +189 -0
- package/src/components/Typography/types.tsx +5 -0
- package/src/components/View/index.tsx +175 -0
- package/src/components/ViewVisibleAnimated/index.tsx +199 -0
- package/src/constants.tsx +16 -0
- package/src/core/theming.tsx +144 -0
- package/src/icons/IconArrowDown.tsx +14 -0
- package/src/icons/IconCheckbox.tsx +20 -0
- package/src/icons/IconCheckboxActive.tsx +18 -0
- package/src/icons/IconClearText.tsx +14 -0
- package/src/icons/IconRadio.tsx +11 -0
- package/src/icons/IconRadioActive.tsx +12 -0
- package/src/icons/IconRadioDisable.tsx +12 -0
- package/src/index.ts +51 -0
- package/src/index.tsx +50 -0
- package/src/styles/fonts.tsx +89 -0
- package/src/styles/overlay.tsx +69 -0
- package/src/styles/shadow.tsx +47 -0
- package/src/styles/themes/DarkTheme.tsx +157 -0
- package/src/styles/themes/LightTheme.tsx +160 -0
- package/src/styles/themes/index.ts +3 -0
- package/src/styles/themes/tokens.tsx +481 -0
- package/src/theme/blue.ts +25 -0
- package/src/theme/colors.ts +21 -0
- package/src/theme/container-styles.tsx +126 -0
- package/src/theme/dimensions.ts +44 -0
- package/src/theme/green.ts +27 -0
- package/src/theme/icon.ts +7 -0
- package/src/theme/ink.ts +18 -0
- package/src/theme/orange.ts +24 -0
- package/src/theme/purple.ts +8 -0
- package/src/theme/red.ts +26 -0
- package/src/theme/themes.tsx +287 -0
- package/src/theme/white.ts +16 -0
- package/src/theme/yellow.ts +26 -0
- package/src/types/index.ts +71 -0
- package/src/types/svg.d.ts +5 -0
- package/src/types.ts +259 -0
- package/src/types.tsx +284 -0
- package/src/utils/BackHandler/BackHandler.native.tsx +3 -0
- package/src/utils/BackHandler/BackHandler.tsx +11 -0
- package/src/utils/addEventListener.tsx +56 -0
- package/src/utils/forwardRef.tsx +23 -0
- package/src/utils/function-utils.tsx +108 -0
- package/src/utils/getContrastingColor.tsx +15 -0
- package/src/utils/hasTouchHandler.tsx +23 -0
- package/src/utils/roundLayoutSize.ts +2 -0
- package/src/utils/splitStyles.ts +60 -0
- package/src/utils/toast-manager.tsx +46 -0
- package/src/utils/useAnimatedValue.tsx +9 -0
- package/src/utils/useAnimatedValueArray.tsx +13 -0
- package/src/utils/useIsKeyboardShown.tsx +55 -0
- package/src/utils/useLayout.tsx +29 -0
- package/src/utils/useLazyRef.tsx +11 -0
package/src/index.tsx
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export { ThemeColors } from "./styles/themes/tokens";
|
|
2
|
+
export { CONSTANTS } from "./styles/themes/tokens";
|
|
3
|
+
export {
|
|
4
|
+
useTheme,
|
|
5
|
+
ThemeProvider,
|
|
6
|
+
DefaultTheme,
|
|
7
|
+
adaptNavigationTheme,
|
|
8
|
+
} from "./core/theming";
|
|
9
|
+
export * from "./styles/themes";
|
|
10
|
+
|
|
11
|
+
export { default as shadow } from "./styles/shadow";
|
|
12
|
+
export { default as overlay } from "./styles/overlay";
|
|
13
|
+
export { default as configureFonts } from "./styles/fonts";
|
|
14
|
+
export { default as ActivityIndicator } from "./components/ActivityIndicator";
|
|
15
|
+
export { default as ProgressBar } from "./components/ProgressBar";
|
|
16
|
+
export { default as Switch } from "./components/Switch/Switch";
|
|
17
|
+
export { default as TextInput } from "./components/TextInput/TextInput";
|
|
18
|
+
export { default as Button } from "./components/Button";
|
|
19
|
+
export { default as ButtonIcon } from "./components/ButtonIcon";
|
|
20
|
+
export { default as FloatingButton } from "./components/FloatingButton";
|
|
21
|
+
export { default as Text } from "./components/Text";
|
|
22
|
+
export { default as Toast } from "./components/Toast";
|
|
23
|
+
export { default as View } from "./components/View";
|
|
24
|
+
export { default as Spacer } from "./components/Spacer";
|
|
25
|
+
export { default as Image } from "./components/Image";
|
|
26
|
+
export { default as Badge } from "./components/Badge";
|
|
27
|
+
export { default as CountingDot } from "./components/CountingDot";
|
|
28
|
+
export { default as ChipBar } from "./components/ChipBar";
|
|
29
|
+
export { default as Checkbox } from "./components/Checkbox";
|
|
30
|
+
export { default as RadioButton } from "./components/RadioButton";
|
|
31
|
+
export { default as Avatar } from "./components/Avatar";
|
|
32
|
+
export { default as SelectionField } from "./components/SelectionField";
|
|
33
|
+
// Types
|
|
34
|
+
export type { Props as ActivityIndicatorProps } from "./components/ActivityIndicator";
|
|
35
|
+
export type { Props as SwitchProps } from "./components/Switch/Switch";
|
|
36
|
+
export type { Props as TextInputProps } from "./components/TextInput/TextInput";
|
|
37
|
+
export type { Props as TextInputAffixProps } from "./components/TextInput/Adornment/TextInputAffix";
|
|
38
|
+
|
|
39
|
+
export type {
|
|
40
|
+
AppTheme,
|
|
41
|
+
ThemeBase,
|
|
42
|
+
MD3Elevation,
|
|
43
|
+
MD3TypescaleKey,
|
|
44
|
+
} from "./types";
|
|
45
|
+
|
|
46
|
+
// Toast Manager
|
|
47
|
+
export * from "./utils/toast-manager";
|
|
48
|
+
|
|
49
|
+
// Toast Provider
|
|
50
|
+
export { default as ToastProvider } from "./components/Toast/ToastProvider";
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { typescale } from "./themes/tokens";
|
|
2
|
+
import type { MD3Type, MD3Typescale, MD3TypescaleKey } from "../types";
|
|
3
|
+
|
|
4
|
+
export const fontConfig = {
|
|
5
|
+
ios: {
|
|
6
|
+
regular: {
|
|
7
|
+
fontFamily: "System",
|
|
8
|
+
fontWeight: "400" as "400",
|
|
9
|
+
},
|
|
10
|
+
medium: {
|
|
11
|
+
fontFamily: "System",
|
|
12
|
+
fontWeight: "500" as "500",
|
|
13
|
+
},
|
|
14
|
+
light: {
|
|
15
|
+
fontFamily: "System",
|
|
16
|
+
fontWeight: "300" as "300",
|
|
17
|
+
},
|
|
18
|
+
thin: {
|
|
19
|
+
fontFamily: "System",
|
|
20
|
+
fontWeight: "100" as "100",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
default: {
|
|
24
|
+
regular: {
|
|
25
|
+
fontFamily: "sans-serif",
|
|
26
|
+
fontWeight: "normal" as "normal",
|
|
27
|
+
},
|
|
28
|
+
medium: {
|
|
29
|
+
fontFamily: "sans-serif-medium",
|
|
30
|
+
fontWeight: "normal" as "normal",
|
|
31
|
+
},
|
|
32
|
+
light: {
|
|
33
|
+
fontFamily: "sans-serif-light",
|
|
34
|
+
fontWeight: "normal" as "normal",
|
|
35
|
+
},
|
|
36
|
+
thin: {
|
|
37
|
+
fontFamily: "sans-serif-thin",
|
|
38
|
+
fontWeight: "normal" as "normal",
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
type MD3FontsConfig =
|
|
44
|
+
| {
|
|
45
|
+
[key in MD3TypescaleKey]: Partial<MD3Type>;
|
|
46
|
+
}
|
|
47
|
+
| {
|
|
48
|
+
[key: string]: MD3Type;
|
|
49
|
+
}
|
|
50
|
+
| Partial<MD3Type>;
|
|
51
|
+
|
|
52
|
+
function configureV3Fonts(
|
|
53
|
+
config: MD3FontsConfig
|
|
54
|
+
): MD3Typescale | (MD3Typescale & { [key: string]: MD3Type }) {
|
|
55
|
+
if (!config) {
|
|
56
|
+
return typescale;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const isFlatConfig = Object.keys(config).every(
|
|
60
|
+
(key) => typeof config[key as keyof typeof config] !== "object"
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
if (isFlatConfig) {
|
|
64
|
+
return Object.fromEntries(
|
|
65
|
+
Object.entries(typescale).map(([variantName, variantProperties]) => [
|
|
66
|
+
variantName,
|
|
67
|
+
{ ...variantProperties, ...config },
|
|
68
|
+
])
|
|
69
|
+
) as MD3Typescale;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return Object.assign(
|
|
73
|
+
{},
|
|
74
|
+
typescale,
|
|
75
|
+
...Object.entries(config).map(([variantName, variantProperties]) => ({
|
|
76
|
+
[variantName]: {
|
|
77
|
+
...typescale[variantName as MD3TypescaleKey],
|
|
78
|
+
...variantProperties,
|
|
79
|
+
},
|
|
80
|
+
}))
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// eslint-disable-next-line no-redeclare
|
|
85
|
+
export default function configureFonts(params?: any) {
|
|
86
|
+
const { config } = params || {};
|
|
87
|
+
|
|
88
|
+
return configureV3Fonts(config);
|
|
89
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Animated } from "react-native";
|
|
2
|
+
|
|
3
|
+
import color from "color";
|
|
4
|
+
import { DarkTheme } from "./themes";
|
|
5
|
+
|
|
6
|
+
export const isAnimatedValue = (
|
|
7
|
+
it: number | string | Animated.AnimatedInterpolation<number | string>
|
|
8
|
+
): it is Animated.Value => it instanceof Animated.Value;
|
|
9
|
+
|
|
10
|
+
export default function overlay<T extends Animated.Value | number>(
|
|
11
|
+
elevation: T,
|
|
12
|
+
surfaceColor: string = DarkTheme.colors?.backgroundPrimary
|
|
13
|
+
): T extends number ? string : Animated.AnimatedInterpolation<number | string> {
|
|
14
|
+
if (isAnimatedValue(elevation)) {
|
|
15
|
+
const inputRange = [0, 1, 2, 3, 8, 24];
|
|
16
|
+
|
|
17
|
+
// @ts-expect-error: TS doesn't seem to refine the type correctly
|
|
18
|
+
return elevation.interpolate({
|
|
19
|
+
inputRange,
|
|
20
|
+
outputRange: inputRange.map((elevation) => {
|
|
21
|
+
return calculateColor(surfaceColor, elevation);
|
|
22
|
+
}),
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// @ts-expect-error: TS doesn't seem to refine the type correctly
|
|
27
|
+
return calculateColor(surfaceColor, elevation);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function calculateColor(surfaceColor: string, elevation: number = 1) {
|
|
31
|
+
let overlayTransparency: number;
|
|
32
|
+
if (elevation >= 1 && elevation <= 24) {
|
|
33
|
+
overlayTransparency = elevationOverlayTransparency[elevation];
|
|
34
|
+
} else if (elevation > 24) {
|
|
35
|
+
overlayTransparency = elevationOverlayTransparency[24];
|
|
36
|
+
} else {
|
|
37
|
+
overlayTransparency = elevationOverlayTransparency[1];
|
|
38
|
+
}
|
|
39
|
+
return color(surfaceColor)
|
|
40
|
+
.mix(color("white"), overlayTransparency * 0.01)
|
|
41
|
+
.hex();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const elevationOverlayTransparency: Record<string, number> = {
|
|
45
|
+
1: 5,
|
|
46
|
+
2: 7,
|
|
47
|
+
3: 8,
|
|
48
|
+
4: 9,
|
|
49
|
+
5: 10,
|
|
50
|
+
6: 11,
|
|
51
|
+
7: 11.5,
|
|
52
|
+
8: 12,
|
|
53
|
+
9: 12.5,
|
|
54
|
+
10: 13,
|
|
55
|
+
11: 13.5,
|
|
56
|
+
12: 14,
|
|
57
|
+
13: 14.25,
|
|
58
|
+
14: 14.5,
|
|
59
|
+
15: 14.75,
|
|
60
|
+
16: 15,
|
|
61
|
+
17: 15.12,
|
|
62
|
+
18: 15.24,
|
|
63
|
+
19: 15.36,
|
|
64
|
+
20: 15.48,
|
|
65
|
+
21: 15.6,
|
|
66
|
+
22: 15.72,
|
|
67
|
+
23: 15.84,
|
|
68
|
+
24: 16,
|
|
69
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Animated } from "react-native";
|
|
2
|
+
import colors from "../theme/colors";
|
|
3
|
+
|
|
4
|
+
const MD3_SHADOW_OPACITY = 0.3;
|
|
5
|
+
const MD3_SHADOW_COLOR = colors.ink.INK80;
|
|
6
|
+
|
|
7
|
+
export default function shadow(elevation: number | Animated.Value = 0) {
|
|
8
|
+
return v3Shadow(elevation);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function v3Shadow(elevation: number | Animated.Value = 0) {
|
|
12
|
+
const inputRange = [0, 1, 2, 3, 4, 5];
|
|
13
|
+
const shadowHeight = [0, 1, 2, 4, 6, 8];
|
|
14
|
+
const shadowRadius = [0, 3, 6, 8, 10, 12];
|
|
15
|
+
|
|
16
|
+
if (elevation instanceof Animated.Value) {
|
|
17
|
+
return {
|
|
18
|
+
shadowColor: MD3_SHADOW_COLOR,
|
|
19
|
+
shadowOffset: {
|
|
20
|
+
width: new Animated.Value(0),
|
|
21
|
+
height: elevation.interpolate({
|
|
22
|
+
inputRange,
|
|
23
|
+
outputRange: shadowHeight,
|
|
24
|
+
}),
|
|
25
|
+
},
|
|
26
|
+
shadowOpacity: elevation.interpolate({
|
|
27
|
+
inputRange: [0, 1],
|
|
28
|
+
outputRange: [0, MD3_SHADOW_OPACITY],
|
|
29
|
+
extrapolate: "clamp",
|
|
30
|
+
}),
|
|
31
|
+
shadowRadius: elevation.interpolate({
|
|
32
|
+
inputRange,
|
|
33
|
+
outputRange: shadowRadius,
|
|
34
|
+
}),
|
|
35
|
+
};
|
|
36
|
+
} else {
|
|
37
|
+
return {
|
|
38
|
+
shadowColor: MD3_SHADOW_COLOR,
|
|
39
|
+
shadowOpacity: elevation ? MD3_SHADOW_OPACITY : 0,
|
|
40
|
+
shadowOffset: {
|
|
41
|
+
width: 0,
|
|
42
|
+
height: shadowHeight[elevation],
|
|
43
|
+
},
|
|
44
|
+
shadowRadius: shadowRadius[elevation],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import type { AppTheme } from "../../types";
|
|
2
|
+
import { LightTheme } from "./LightTheme";
|
|
3
|
+
import ink from "../../theme/ink";
|
|
4
|
+
import white from "../../theme/white";
|
|
5
|
+
import blue from "../../theme/blue";
|
|
6
|
+
import red from "../../theme/red";
|
|
7
|
+
import green from "../../theme/green";
|
|
8
|
+
import yellow from "../../theme/yellow";
|
|
9
|
+
import purple from "../../theme/purple";
|
|
10
|
+
|
|
11
|
+
export const DarkTheme: AppTheme = {
|
|
12
|
+
...LightTheme,
|
|
13
|
+
dark: true,
|
|
14
|
+
mode: "adaptive",
|
|
15
|
+
version: 3,
|
|
16
|
+
colors: {
|
|
17
|
+
elevation: {
|
|
18
|
+
level0: "transparent",
|
|
19
|
+
level1: "rgb(37, 35, 42)",
|
|
20
|
+
level2: "rgb(44, 40, 49)",
|
|
21
|
+
level3: "rgb(49, 44, 56)",
|
|
22
|
+
level4: "rgb(51, 46, 58)",
|
|
23
|
+
level5: "rgb(52, 49, 63)",
|
|
24
|
+
},
|
|
25
|
+
//new theme colors
|
|
26
|
+
backgroundPrimary: ink.INK100,
|
|
27
|
+
backgroundSecondary: white.WHITE100,
|
|
28
|
+
borderBrandDefault: blue.BLUE100,
|
|
29
|
+
borderCriticalDefault: red.RED100,
|
|
30
|
+
borderCriticalHover: red.RED80,
|
|
31
|
+
borderCriticalPressed: red.RED120,
|
|
32
|
+
borderErrorDefault: red.RED100,
|
|
33
|
+
borderInfoDefault: blue.BLUE100,
|
|
34
|
+
borderPrimaryDefault: ink.INK10,
|
|
35
|
+
borderPrimaryDisabled: ink.INK10,
|
|
36
|
+
borderPrimaryHovered: ink.INK20,
|
|
37
|
+
borderPrimaryInverseDefault: blue.BLUE100,
|
|
38
|
+
borderPrimaryPressed: ink.INK20,
|
|
39
|
+
borderSuccessDefault: green.GREEN100,
|
|
40
|
+
borderWarningDefault: yellow.YELLOW100,
|
|
41
|
+
iconBrandDefault: blue.BLUE100,
|
|
42
|
+
iconCriticalDefault: red.RED100,
|
|
43
|
+
iconErrorDefault: red.RED100,
|
|
44
|
+
iconInfoDefault: blue.BLUE100,
|
|
45
|
+
iconPrimaryDefault: ink.INK40,
|
|
46
|
+
iconPrimaryHover: ink.INK60,
|
|
47
|
+
iconPrimaryDisabled: ink.INK60,
|
|
48
|
+
iconPrimaryInverseDefault: white.WHITE100,
|
|
49
|
+
iconPrimaryInverseHover: white.WHITE80,
|
|
50
|
+
iconPrimaryInversePressed: white.WHITE80,
|
|
51
|
+
iconPrimaryPressed: ink.INK60,
|
|
52
|
+
iconSuccessDefault: green.GREEN100,
|
|
53
|
+
iconWarningDefault: yellow.YELLOW100,
|
|
54
|
+
surfaceBrandDefault: blue.BLUE100,
|
|
55
|
+
surfaceBrandDisabled: ink.INK10,
|
|
56
|
+
surfaceBrandHover: blue.BLUE80,
|
|
57
|
+
surfaceBrandInverseDefault: blue.BLUE10,
|
|
58
|
+
surfaceBrandInverseHover: blue.BLUE20,
|
|
59
|
+
surfaceBrandInversePressed: blue.BLUE40,
|
|
60
|
+
surfaceBrandPressed: blue.BLUE120,
|
|
61
|
+
surfaceCriticalDefault: red.RED100,
|
|
62
|
+
surfaceCriticalDisabled: ink.INK10,
|
|
63
|
+
surfaceCriticalHover: red.RED80,
|
|
64
|
+
surfaceCriticalInverseDefault: red.RED10,
|
|
65
|
+
surfaceCriticalInverseHover: red.RED20,
|
|
66
|
+
surfaceCriticalInversePressed: red.RED40,
|
|
67
|
+
surfaceCriticalPressed: red.RED120,
|
|
68
|
+
surfaceErrorDefault: red.RED100,
|
|
69
|
+
surfaceErrorDisabled: ink.INK10,
|
|
70
|
+
surfaceErrorHover: red.RED80,
|
|
71
|
+
surfaceErrorInverseDefault: red.RED10,
|
|
72
|
+
surfaceErrorInverseHover: red.RED20,
|
|
73
|
+
surfaceErrorInversePressed: red.RED40,
|
|
74
|
+
surfaceErrorPressed: red.RED_STATUS,
|
|
75
|
+
surfaceInfoDefault: blue.BLUE100,
|
|
76
|
+
surfaceInfoDisabled: ink.INK10,
|
|
77
|
+
surfaceInfoHover: blue.BLUE80,
|
|
78
|
+
surfaceInfoInverseDefault: blue.BLUE10,
|
|
79
|
+
surfaceInfoInverseHover: blue.BLUE20,
|
|
80
|
+
surfaceInfoInversePressed: blue.BLUE40,
|
|
81
|
+
surfaceInfoPressed: blue.BLUE120,
|
|
82
|
+
surfacePrimaryDefault: white.WHITE100,
|
|
83
|
+
surfacePrimaryDisabled: ink.INK5,
|
|
84
|
+
surfacePrimaryHover: ink.INK5,
|
|
85
|
+
surfacePrimaryInverseDefault: ink.INK80,
|
|
86
|
+
surfacePrimaryInverseHover: ink.INK60,
|
|
87
|
+
surfacePrimaryInversePressed: ink.INK40,
|
|
88
|
+
surfacePrimaryPressed: ink.INK10,
|
|
89
|
+
surfaceSecondaryDefault: ink.INK5,
|
|
90
|
+
surfaceSecondaryDisabled: ink.INK5,
|
|
91
|
+
surfaceSecondaryHover: ink.INK10,
|
|
92
|
+
surfaceSecondaryPressed: ink.INK20,
|
|
93
|
+
surfaceSuccessDefault: green.GREEN100,
|
|
94
|
+
surfaceSuccessDisabled: ink.INK10,
|
|
95
|
+
surfaceSuccessHover: green.GREEN80,
|
|
96
|
+
surfaceSuccessInverseDefault: green.GREEN10,
|
|
97
|
+
surfaceSuccessInverseHover: green.GREEN20,
|
|
98
|
+
surfaceSuccessInversePressed: green.GREEN40,
|
|
99
|
+
surfaceSuccessPressed: green.GREEN_STATUS,
|
|
100
|
+
surfaceWarningDefault: yellow.YELLOW100,
|
|
101
|
+
surfaceWarningDisabled: ink.INK10,
|
|
102
|
+
surfaceWarningHover: yellow.YELLOW80,
|
|
103
|
+
surfaceWarningInverseDefault: yellow.YELLOW10,
|
|
104
|
+
surfaceWarningInverseHover: yellow.YELLOW20,
|
|
105
|
+
surfaceWarningInversePressed: yellow.YELLOW40,
|
|
106
|
+
surfaceWarningPressed: yellow.YELLOW120,
|
|
107
|
+
textDefault: ink.INK5,
|
|
108
|
+
textDisabled: ink.INK20,
|
|
109
|
+
textPlaceholder: ink.INK40,
|
|
110
|
+
textSecondary: ink.INK60,
|
|
111
|
+
textBrandDefault: blue.BLUE100,
|
|
112
|
+
textBrandDisabled: ink.INK20,
|
|
113
|
+
textBrandHovered: blue.BLUE80,
|
|
114
|
+
textBrandPressed: blue.BLUE120,
|
|
115
|
+
textCriticalDefault: red.RED100,
|
|
116
|
+
textCriticalDisabled: ink.INK20,
|
|
117
|
+
textCriticalHovered: red.RED80,
|
|
118
|
+
textCriticalPressed: red.RED_STATUS,
|
|
119
|
+
textErrorDefault: red.RED100,
|
|
120
|
+
textErrorDisabled: ink.INK20,
|
|
121
|
+
textErrorHovered: red.RED80,
|
|
122
|
+
textErrorPressed: red.RED_STATUS,
|
|
123
|
+
textInfoDefault: blue.BLUE100,
|
|
124
|
+
textInfoDisabled: ink.INK20,
|
|
125
|
+
textInfoHovered: blue.BLUE80,
|
|
126
|
+
textInfoPressed: blue.BLUE120,
|
|
127
|
+
textLinkDefault: blue.BLUE100,
|
|
128
|
+
textLinkDisabled: ink.INK20,
|
|
129
|
+
textLinkHovered: blue.BLUE80,
|
|
130
|
+
textLinkPressed: blue.BLUE120,
|
|
131
|
+
textLinkVisitedDefault: purple.PURPLE100,
|
|
132
|
+
textLinkVisitedDisabled: purple.PURPLE_BG,
|
|
133
|
+
textLinkVisitedHovered: purple.PURPLE_BG,
|
|
134
|
+
textLinkVisitedPressed: purple.PURPLE_BG,
|
|
135
|
+
textOnFillDefault: white.WHITE100,
|
|
136
|
+
textOnFillDisabled: white.WHITE20,
|
|
137
|
+
textOnFillHovered: white.WHITE80,
|
|
138
|
+
textOnFillPressed: white.WHITE80,
|
|
139
|
+
textSuccessDefault: green.GREEN100,
|
|
140
|
+
textSuccessDisabled: ink.INK20,
|
|
141
|
+
textSuccessHovered: green.GREEN80,
|
|
142
|
+
textSuccessPressed: green.GREEN_STATUS,
|
|
143
|
+
textWarningDefault: yellow.YELLOW100,
|
|
144
|
+
textWarningDisabled: ink.INK20,
|
|
145
|
+
textWarningHovered: yellow.YELLOW80,
|
|
146
|
+
textWarningPressed: yellow.YELLOW_STATUS,
|
|
147
|
+
selectBackgroundDisabled: white.WHITE40,
|
|
148
|
+
selectIconDisabled: white.WHITE40,
|
|
149
|
+
borderCriticalInverseDefault: red.RED40,
|
|
150
|
+
borderCriticalInverseHover: red.RED20,
|
|
151
|
+
borderCriticalInversePressed: red.RED60,
|
|
152
|
+
borderErrorInverseDefault: red.RED40,
|
|
153
|
+
borderPrimaryFocused: blue.BLUE100,
|
|
154
|
+
borderWarningInverseDefault: yellow.YELLOW40,
|
|
155
|
+
borderSuccessInverseDefault: green.GREEN40,
|
|
156
|
+
},
|
|
157
|
+
};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import type { AppTheme } from "../../types";
|
|
2
|
+
import configureFonts from "../fonts";
|
|
3
|
+
import ink from "../../theme/ink";
|
|
4
|
+
import white from "../../theme/white";
|
|
5
|
+
import blue from "../../theme/blue";
|
|
6
|
+
import red from "../../theme/red";
|
|
7
|
+
import green from "../../theme/green";
|
|
8
|
+
import yellow from "../../theme/yellow";
|
|
9
|
+
import purple from "../../theme/purple";
|
|
10
|
+
|
|
11
|
+
export const LightTheme: AppTheme = {
|
|
12
|
+
dark: false,
|
|
13
|
+
roundness: 8,
|
|
14
|
+
version: 3,
|
|
15
|
+
colors: {
|
|
16
|
+
elevation: {
|
|
17
|
+
level0: "transparent",
|
|
18
|
+
level1: "rgb(247, 243, 249)",
|
|
19
|
+
level2: "rgb(243, 237, 246)",
|
|
20
|
+
level3: "rgb(238, 232, 244)",
|
|
21
|
+
level4: "rgb(236, 230, 243)",
|
|
22
|
+
level5: "rgb(233, 227, 241)",
|
|
23
|
+
},
|
|
24
|
+
//new theme colors
|
|
25
|
+
backgroundPrimary: ink.INK5,
|
|
26
|
+
backgroundSecondary: white.WHITE100,
|
|
27
|
+
borderBrandDefault: blue.BLUE100,
|
|
28
|
+
borderCriticalDefault: red.RED100,
|
|
29
|
+
borderCriticalHover: red.RED80,
|
|
30
|
+
borderCriticalPressed: red.RED120,
|
|
31
|
+
borderErrorDefault: red.RED100,
|
|
32
|
+
borderInfoDefault: blue.BLUE100,
|
|
33
|
+
borderPrimaryDefault: ink.INK10,
|
|
34
|
+
borderPrimaryDisabled: ink.INK10,
|
|
35
|
+
borderPrimaryHovered: ink.INK20,
|
|
36
|
+
borderPrimaryInverseDefault: blue.BLUE100,
|
|
37
|
+
borderPrimaryPressed: ink.INK20,
|
|
38
|
+
borderSuccessDefault: green.GREEN100,
|
|
39
|
+
borderWarningDefault: yellow.YELLOW100,
|
|
40
|
+
iconBrandDefault: blue.BLUE100,
|
|
41
|
+
iconCriticalDefault: red.RED100,
|
|
42
|
+
iconErrorDefault: red.RED100,
|
|
43
|
+
iconInfoDefault: blue.BLUE100,
|
|
44
|
+
iconPrimaryDefault: ink.INK40,
|
|
45
|
+
iconPrimaryHover: ink.INK60,
|
|
46
|
+
iconPrimaryDisabled: ink.INK60,
|
|
47
|
+
iconPrimaryInverseDefault: white.WHITE100,
|
|
48
|
+
iconPrimaryInverseHover: white.WHITE80,
|
|
49
|
+
iconPrimaryInversePressed: white.WHITE80,
|
|
50
|
+
iconPrimaryPressed: ink.INK60,
|
|
51
|
+
iconSuccessDefault: green.GREEN100,
|
|
52
|
+
iconWarningDefault: yellow.YELLOW100,
|
|
53
|
+
surfaceBrandDefault: blue.BLUE100,
|
|
54
|
+
surfaceBrandDisabled: ink.INK10,
|
|
55
|
+
surfaceBrandHover: blue.BLUE80,
|
|
56
|
+
surfaceBrandInverseDefault: blue.BLUE10,
|
|
57
|
+
surfaceBrandInverseHover: blue.BLUE20,
|
|
58
|
+
surfaceBrandInversePressed: blue.BLUE40,
|
|
59
|
+
surfaceBrandPressed: blue.BLUE120,
|
|
60
|
+
surfaceCriticalDefault: red.RED100,
|
|
61
|
+
surfaceCriticalDisabled: ink.INK10,
|
|
62
|
+
surfaceCriticalHover: red.RED80,
|
|
63
|
+
surfaceCriticalInverseDefault: red.RED10,
|
|
64
|
+
surfaceCriticalInverseHover: red.RED20,
|
|
65
|
+
surfaceCriticalInversePressed: red.RED40,
|
|
66
|
+
surfaceCriticalPressed: red.RED120,
|
|
67
|
+
surfaceErrorDefault: red.RED100,
|
|
68
|
+
surfaceErrorDisabled: ink.INK10,
|
|
69
|
+
surfaceErrorHover: red.RED80,
|
|
70
|
+
surfaceErrorInverseDefault: red.RED10,
|
|
71
|
+
surfaceErrorInverseHover: red.RED20,
|
|
72
|
+
surfaceErrorInversePressed: red.RED40,
|
|
73
|
+
surfaceErrorPressed: red.RED_STATUS,
|
|
74
|
+
surfaceInfoDefault: blue.BLUE100,
|
|
75
|
+
surfaceInfoDisabled: ink.INK10,
|
|
76
|
+
surfaceInfoHover: blue.BLUE80,
|
|
77
|
+
surfaceInfoInverseDefault: blue.BLUE10,
|
|
78
|
+
surfaceInfoInverseHover: blue.BLUE20,
|
|
79
|
+
surfaceInfoInversePressed: blue.BLUE40,
|
|
80
|
+
surfaceInfoPressed: blue.BLUE120,
|
|
81
|
+
surfacePrimaryDefault: white.WHITE100,
|
|
82
|
+
surfacePrimaryDisabled: ink.INK5,
|
|
83
|
+
surfacePrimaryHover: ink.INK5,
|
|
84
|
+
surfacePrimaryInverseDefault: ink.INK80,
|
|
85
|
+
surfacePrimaryInverseHover: ink.INK60,
|
|
86
|
+
surfacePrimaryInversePressed: ink.INK40,
|
|
87
|
+
surfacePrimaryPressed: ink.INK10,
|
|
88
|
+
surfaceSecondaryDefault: ink.INK5,
|
|
89
|
+
surfaceSecondaryDisabled: ink.INK5,
|
|
90
|
+
surfaceSecondaryHover: ink.INK10,
|
|
91
|
+
surfaceSecondaryPressed: ink.INK20,
|
|
92
|
+
surfaceSuccessDefault: green.GREEN100,
|
|
93
|
+
surfaceSuccessDisabled: ink.INK10,
|
|
94
|
+
surfaceSuccessHover: green.GREEN80,
|
|
95
|
+
surfaceSuccessInverseDefault: green.GREEN10,
|
|
96
|
+
surfaceSuccessInverseHover: green.GREEN20,
|
|
97
|
+
surfaceSuccessInversePressed: green.GREEN40,
|
|
98
|
+
surfaceSuccessPressed: green.GREEN_STATUS,
|
|
99
|
+
surfaceWarningDefault: yellow.YELLOW100,
|
|
100
|
+
surfaceWarningDisabled: ink.INK10,
|
|
101
|
+
surfaceWarningHover: yellow.YELLOW80,
|
|
102
|
+
surfaceWarningInverseDefault: yellow.YELLOW10,
|
|
103
|
+
surfaceWarningInverseHover: yellow.YELLOW20,
|
|
104
|
+
surfaceWarningInversePressed: yellow.YELLOW40,
|
|
105
|
+
surfaceWarningPressed: yellow.YELLOW120,
|
|
106
|
+
textDefault: ink.INK100,
|
|
107
|
+
textDisabled: ink.INK20,
|
|
108
|
+
textPlaceholder: ink.INK40,
|
|
109
|
+
textSecondary: ink.INK60,
|
|
110
|
+
textBrandDefault: blue.BLUE100,
|
|
111
|
+
textBrandDisabled: ink.INK20,
|
|
112
|
+
textBrandHovered: blue.BLUE80,
|
|
113
|
+
textBrandPressed: blue.BLUE120,
|
|
114
|
+
textCriticalDefault: red.RED100,
|
|
115
|
+
textCriticalDisabled: ink.INK20,
|
|
116
|
+
textCriticalHovered: red.RED80,
|
|
117
|
+
textCriticalPressed: red.RED_STATUS,
|
|
118
|
+
textErrorDefault: red.RED100,
|
|
119
|
+
textErrorDisabled: ink.INK20,
|
|
120
|
+
textErrorHovered: red.RED80,
|
|
121
|
+
textErrorPressed: red.RED_STATUS,
|
|
122
|
+
textInfoDefault: blue.BLUE100,
|
|
123
|
+
textInfoDisabled: ink.INK20,
|
|
124
|
+
textInfoHovered: blue.BLUE80,
|
|
125
|
+
textInfoPressed: blue.BLUE120,
|
|
126
|
+
textLinkDefault: blue.BLUE100,
|
|
127
|
+
textLinkDisabled: ink.INK20,
|
|
128
|
+
textLinkHovered: blue.BLUE80,
|
|
129
|
+
textLinkPressed: blue.BLUE120,
|
|
130
|
+
textLinkVisitedDefault: purple.PURPLE100,
|
|
131
|
+
textLinkVisitedDisabled: purple.PURPLE_BG,
|
|
132
|
+
textLinkVisitedHovered: purple.PURPLE_BG,
|
|
133
|
+
textLinkVisitedPressed: purple.PURPLE_BG,
|
|
134
|
+
textOnFillDefault: white.WHITE100,
|
|
135
|
+
textOnFillDisabled: white.WHITE20,
|
|
136
|
+
textOnFillHovered: white.WHITE80,
|
|
137
|
+
textOnFillPressed: white.WHITE80,
|
|
138
|
+
textSuccessDefault: green.GREEN100,
|
|
139
|
+
textSuccessDisabled: ink.INK20,
|
|
140
|
+
textSuccessHovered: green.GREEN80,
|
|
141
|
+
textSuccessPressed: green.GREEN_STATUS,
|
|
142
|
+
textWarningDefault: yellow.YELLOW100,
|
|
143
|
+
textWarningDisabled: ink.INK20,
|
|
144
|
+
textWarningHovered: yellow.YELLOW80,
|
|
145
|
+
textWarningPressed: yellow.YELLOW_STATUS,
|
|
146
|
+
selectBackgroundDisabled: white.WHITE40,
|
|
147
|
+
selectIconDisabled: white.WHITE40,
|
|
148
|
+
borderCriticalInverseDefault: red.RED40,
|
|
149
|
+
borderCriticalInverseHover: red.RED20,
|
|
150
|
+
borderCriticalInversePressed: red.RED60,
|
|
151
|
+
borderErrorInverseDefault: red.RED40,
|
|
152
|
+
borderPrimaryFocused: blue.BLUE100,
|
|
153
|
+
borderWarningInverseDefault: yellow.YELLOW40,
|
|
154
|
+
borderSuccessInverseDefault: green.GREEN40,
|
|
155
|
+
},
|
|
156
|
+
fonts: configureFonts(),
|
|
157
|
+
animation: {
|
|
158
|
+
scale: 1.0,
|
|
159
|
+
},
|
|
160
|
+
};
|