react-native-molecules 0.5.0-beta.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/components/Accordion/Accordion.tsx +89 -0
- package/components/Accordion/AccordionItem.tsx +94 -0
- package/components/Accordion/AccordionItemContent.tsx +17 -0
- package/components/Accordion/AccordionItemHeader.tsx +122 -0
- package/components/Accordion/index.tsx +36 -0
- package/components/Accordion/utils.ts +62 -0
- package/components/ActivityIndicator/ActivityIndicator.ios.tsx +1 -0
- package/components/ActivityIndicator/ActivityIndicator.tsx +200 -0
- package/components/ActivityIndicator/AnimatedSpinner.tsx +121 -0
- package/components/ActivityIndicator/index.tsx +17 -0
- package/components/Appbar/AppbarActions.tsx +13 -0
- package/components/Appbar/AppbarBase.tsx +60 -0
- package/components/Appbar/AppbarCenterAligned.tsx +13 -0
- package/components/Appbar/AppbarLarge.tsx +13 -0
- package/components/Appbar/AppbarLeft.tsx +26 -0
- package/components/Appbar/AppbarMedium.tsx +13 -0
- package/components/Appbar/AppbarRight.tsx +40 -0
- package/components/Appbar/AppbarSmall.tsx +13 -0
- package/components/Appbar/AppbarTitle.tsx +49 -0
- package/components/Appbar/index.tsx +46 -0
- package/components/Appbar/types.ts +19 -0
- package/components/Appbar/utils.ts +127 -0
- package/components/Avatar/Avatar.tsx +189 -0
- package/components/Avatar/index.tsx +11 -0
- package/components/Avatar/utils.ts +35 -0
- package/components/Backdrop/Backdrop.tsx +18 -0
- package/components/Backdrop/index.tsx +11 -0
- package/components/Backdrop/types.ts +3 -0
- package/components/Backdrop/utils.ts +21 -0
- package/components/Badge/Badge.tsx +29 -0
- package/components/Badge/index.tsx +11 -0
- package/components/Badge/utils.ts +38 -0
- package/components/Button/Button.tsx +349 -0
- package/components/Button/index.tsx +11 -0
- package/components/Button/types.ts +5 -0
- package/components/Button/utils.ts +416 -0
- package/components/Card/Card.tsx +160 -0
- package/components/Card/CardActions.tsx +18 -0
- package/components/Card/CardContent.tsx +29 -0
- package/components/Card/CardHeader.tsx +31 -0
- package/components/Card/CardHeadline.tsx +15 -0
- package/components/Card/CardMedia.tsx +36 -0
- package/components/Card/CardSubhead.tsx +15 -0
- package/components/Card/CardText.tsx +13 -0
- package/components/Card/CardTypography.tsx +113 -0
- package/components/Card/index.tsx +38 -0
- package/components/Card/types.ts +1 -0
- package/components/Card/utils.ts +23 -0
- package/components/Checkbox/Checkbox.tsx +123 -0
- package/components/Checkbox/CheckboxBase.ios.tsx +86 -0
- package/components/Checkbox/CheckboxBase.tsx +216 -0
- package/components/Checkbox/index.tsx +11 -0
- package/components/Checkbox/types.ts +72 -0
- package/components/Checkbox/utils.ts +210 -0
- package/components/Chip/Chip.tsx +416 -0
- package/components/Chip/index.tsx +51 -0
- package/components/Chip/utils.ts +100 -0
- package/components/DatePickerDocked/DatePickerDocked.tsx +30 -0
- package/components/DatePickerDocked/DatePickerDockedHeader.tsx +129 -0
- package/components/DatePickerDocked/index.tsx +21 -0
- package/components/DatePickerDocked/types.ts +11 -0
- package/components/DatePickerDocked/utils.ts +155 -0
- package/components/DatePickerInline/AutoSizer.tsx +46 -0
- package/components/DatePickerInline/DatePickerContext.tsx +21 -0
- package/components/DatePickerInline/DatePickerInline.tsx +82 -0
- package/components/DatePickerInline/DatePickerInlineBase.tsx +181 -0
- package/components/DatePickerInline/DatePickerInlineHeader.tsx +108 -0
- package/components/DatePickerInline/Day.tsx +88 -0
- package/components/DatePickerInline/DayName.tsx +17 -0
- package/components/DatePickerInline/DayNames.tsx +32 -0
- package/components/DatePickerInline/DayRange.tsx +48 -0
- package/components/DatePickerInline/HeaderItem.tsx +111 -0
- package/components/DatePickerInline/Month.tsx +233 -0
- package/components/DatePickerInline/MonthPicker.tsx +174 -0
- package/components/DatePickerInline/Swiper.native.tsx +172 -0
- package/components/DatePickerInline/Swiper.tsx +172 -0
- package/components/DatePickerInline/SwiperUtils.ts +40 -0
- package/components/DatePickerInline/Week.tsx +67 -0
- package/components/DatePickerInline/YearPicker.tsx +139 -0
- package/components/DatePickerInline/dateUtils.tsx +334 -0
- package/components/DatePickerInline/index.tsx +41 -0
- package/components/DatePickerInline/types.ts +104 -0
- package/components/DatePickerInline/utils.ts +367 -0
- package/components/DatePickerInput/DatePickerInput.tsx +139 -0
- package/components/DatePickerInput/DatePickerInputModal.tsx +48 -0
- package/components/DatePickerInput/DatePickerInputWithoutModal.tsx +77 -0
- package/components/DatePickerInput/DateRangeInput.tsx +88 -0
- package/components/DatePickerInput/index.tsx +14 -0
- package/components/DatePickerInput/inputUtils.ts +138 -0
- package/components/DatePickerInput/types.ts +28 -0
- package/components/DatePickerInput/utils.ts +16 -0
- package/components/DatePickerModal/AnimatedCrossView.tsx +94 -0
- package/components/DatePickerModal/CalendarEdit.tsx +139 -0
- package/components/DatePickerModal/DatePickerModal.tsx +85 -0
- package/components/DatePickerModal/DatePickerModalContent.tsx +155 -0
- package/components/DatePickerModal/DatePickerModalContentHeader.tsx +213 -0
- package/components/DatePickerModal/DatePickerModalHeader.tsx +74 -0
- package/components/DatePickerModal/DatePickerModalHeaderBackground.tsx +13 -0
- package/components/DatePickerModal/index.tsx +20 -0
- package/components/DatePickerModal/types.ts +92 -0
- package/components/DatePickerModal/utils.ts +121 -0
- package/components/DateTimePicker/DateTimePicker.tsx +172 -0
- package/components/DateTimePicker/index.tsx +14 -0
- package/components/DateTimePicker/utils.ts +13 -0
- package/components/Dialog/Dialog.tsx +66 -0
- package/components/Dialog/DialogActions.tsx +89 -0
- package/components/Dialog/DialogContent.tsx +37 -0
- package/components/Dialog/DialogIcon.tsx +69 -0
- package/components/Dialog/DialogTitle.tsx +68 -0
- package/components/Dialog/index.tsx +37 -0
- package/components/Dialog/utils.ts +80 -0
- package/components/Drawer/Collapsible/DrawerCollapsible.tsx +22 -0
- package/components/Drawer/Collapsible/DrawerCollapsibleItem.tsx +38 -0
- package/components/Drawer/Collapsible/DrawerCollapsibleItemContent.tsx +16 -0
- package/components/Drawer/Collapsible/DrawerCollapsibleItemHeader.tsx +48 -0
- package/components/Drawer/Collapsible/index.tsx +23 -0
- package/components/Drawer/Collapsible/utils.ts +49 -0
- package/components/Drawer/Drawer.tsx +43 -0
- package/components/Drawer/DrawerContent.tsx +35 -0
- package/components/Drawer/DrawerFooter.tsx +27 -0
- package/components/Drawer/DrawerHeader.tsx +27 -0
- package/components/Drawer/DrawerItem.tsx +206 -0
- package/components/Drawer/DrawerItemGroup.tsx +82 -0
- package/components/Drawer/index.tsx +47 -0
- package/components/Drawer/types.ts +3 -0
- package/components/Drawer/utils.ts +8 -0
- package/components/ElementGroup/ElementGroup.tsx +139 -0
- package/components/ElementGroup/index.tsx +11 -0
- package/components/ElementGroup/utils.ts +25 -0
- package/components/FAB/FAB.tsx +176 -0
- package/components/FAB/index.tsx +12 -0
- package/components/FAB/types.ts +1 -0
- package/components/FAB/utils.ts +221 -0
- package/components/FilePicker/FilePicker.tsx +133 -0
- package/components/FilePicker/index.tsx +11 -0
- package/components/FilePicker/utils.ts +13 -0
- package/components/HelperText/HelperText.tsx +139 -0
- package/components/HelperText/index.tsx +11 -0
- package/components/HelperText/utils.ts +29 -0
- package/components/HorizontalDivider/HorizontalDivider.tsx +101 -0
- package/components/HorizontalDivider/index.tsx +13 -0
- package/components/Icon/CrossFadeIcon.tsx +116 -0
- package/components/Icon/Icon.tsx +41 -0
- package/components/Icon/iconFactory.tsx +23 -0
- package/components/Icon/index.tsx +11 -0
- package/components/Icon/types.ts +35 -0
- package/components/IconButton/IconButton.tsx +218 -0
- package/components/IconButton/index.tsx +11 -0
- package/components/IconButton/types.ts +1 -0
- package/components/IconButton/utils.ts +325 -0
- package/components/If/index.tsx +13 -0
- package/components/InputAddon/InputAddon.tsx +27 -0
- package/components/InputAddon/index.tsx +11 -0
- package/components/InputAddon/utils.ts +33 -0
- package/components/Link/Link.tsx +48 -0
- package/components/Link/index.tsx +11 -0
- package/components/Link/utils.ts +37 -0
- package/components/ListItem/ListItem.tsx +136 -0
- package/components/ListItem/ListItemDescription.tsx +25 -0
- package/components/ListItem/ListItemTitle.tsx +25 -0
- package/components/ListItem/index.tsx +18 -0
- package/components/ListItem/utils.ts +113 -0
- package/components/Menu/Menu.tsx +69 -0
- package/components/Menu/MenuDivider.tsx +13 -0
- package/components/Menu/MenuItem.tsx +128 -0
- package/components/Menu/index.tsx +19 -0
- package/components/Menu/utils.ts +92 -0
- package/components/Modal/Modal.tsx +261 -0
- package/components/Modal/index.tsx +11 -0
- package/components/Modal/utils.ts +45 -0
- package/components/NavigationRail/NavigationRail.tsx +32 -0
- package/components/NavigationRail/NavigationRailContent.tsx +25 -0
- package/components/NavigationRail/NavigationRailFooter.tsx +18 -0
- package/components/NavigationRail/NavigationRailHeader.tsx +18 -0
- package/components/NavigationRail/NavigationRailItem.tsx +226 -0
- package/components/NavigationRail/index.tsx +35 -0
- package/components/NavigationRail/utils.ts +170 -0
- package/components/NavigationStack/NavigationStack.tsx +85 -0
- package/components/NavigationStack/NavigationStackItem.tsx +60 -0
- package/components/NavigationStack/index.tsx +20 -0
- package/components/NavigationStack/utils.tsx +16 -0
- package/components/Popover/Popover.native.tsx +185 -0
- package/components/Popover/Popover.tsx +198 -0
- package/components/Popover/common.ts +459 -0
- package/components/Popover/index.ts +2 -0
- package/components/Portal/Portal.tsx +13 -0
- package/components/Portal/index.tsx +12 -0
- package/components/RadioButton/RadioButton.tsx +138 -0
- package/components/RadioButton/RadioButtonAndroid.tsx +188 -0
- package/components/RadioButton/RadioButtonGroup.tsx +98 -0
- package/components/RadioButton/RadioButtonIOS.tsx +106 -0
- package/components/RadioButton/RadioButtonItem.tsx +232 -0
- package/components/RadioButton/index.ts +27 -0
- package/components/RadioButton/utils.ts +164 -0
- package/components/Rating/Rating.tsx +149 -0
- package/components/Rating/RatingItem.tsx +125 -0
- package/components/Rating/index.tsx +13 -0
- package/components/Rating/utils.ts +38 -0
- package/components/Select/Select.tsx +1038 -0
- package/components/Select/index.ts +14 -0
- package/components/Select/types.ts +115 -0
- package/components/StateLayer/StateLayer.tsx +12 -0
- package/components/StateLayer/index.tsx +11 -0
- package/components/StateLayer/utils.ts +17 -0
- package/components/Surface/BackgroundContextWrapper.tsx +27 -0
- package/components/Surface/Surface.android.tsx +62 -0
- package/components/Surface/Surface.ios.tsx +123 -0
- package/components/Surface/Surface.tsx +48 -0
- package/components/Surface/index.tsx +12 -0
- package/components/Surface/utils.ts +106 -0
- package/components/Switch/Switch.ios.tsx +67 -0
- package/components/Switch/Switch.tsx +278 -0
- package/components/Switch/index.tsx +11 -0
- package/components/Switch/utils.ts +283 -0
- package/components/Tabs/TabItem.tsx +150 -0
- package/components/Tabs/TabLabel.tsx +84 -0
- package/components/Tabs/Tabs.tsx +398 -0
- package/components/Tabs/index.tsx +21 -0
- package/components/Tabs/utils.ts +126 -0
- package/components/Text/Text.tsx +23 -0
- package/components/Text/index.tsx +2 -0
- package/components/Text/textFactory.tsx +33 -0
- package/components/TextInput/InputLabel.tsx +181 -0
- package/components/TextInput/TextInput.tsx +693 -0
- package/components/TextInput/index.tsx +16 -0
- package/components/TextInput/types.ts +96 -0
- package/components/TextInput/utils.ts +544 -0
- package/components/TextInputWithMask/TextInputMask.tsx +57 -0
- package/components/TextInputWithMask/index.tsx +11 -0
- package/components/TextInputWithMask/utils.ts +56 -0
- package/components/TimePicker/AmPmSwitcher.tsx +99 -0
- package/components/TimePicker/AnalogClock.tsx +165 -0
- package/components/TimePicker/AnalogClockHours.tsx +163 -0
- package/components/TimePicker/AnalogClockMinutes.tsx +68 -0
- package/components/TimePicker/AnimatedClockSwitcher.tsx +72 -0
- package/components/TimePicker/DisplayModeContext.tsx +6 -0
- package/components/TimePicker/TimeInput.tsx +112 -0
- package/components/TimePicker/TimeInputs.tsx +148 -0
- package/components/TimePicker/TimePicker.tsx +130 -0
- package/components/TimePicker/index.tsx +19 -0
- package/components/TimePicker/timeUtils.ts +159 -0
- package/components/TimePicker/utils.ts +285 -0
- package/components/TimePickerField/TimePickerField.tsx +152 -0
- package/components/TimePickerField/index.tsx +14 -0
- package/components/TimePickerField/sanitizeTime.ts +85 -0
- package/components/TimePickerField/utils.ts +95 -0
- package/components/TimePickerModal/TimePickerModal.tsx +115 -0
- package/components/TimePickerModal/index.tsx +14 -0
- package/components/TimePickerModal/utils.ts +48 -0
- package/components/Tooltip/Tooltip.tsx +137 -0
- package/components/Tooltip/TooltipContent.tsx +12 -0
- package/components/Tooltip/TooltipTrigger.tsx +94 -0
- package/components/Tooltip/index.tsx +20 -0
- package/components/Tooltip/utils.ts +21 -0
- package/components/TouchableRipple/TouchableRipple.native.tsx +105 -0
- package/components/TouchableRipple/TouchableRipple.tsx +286 -0
- package/components/TouchableRipple/index.tsx +14 -0
- package/components/TouchableRipple/utils.ts +15 -0
- package/components/VerticalDivider/VerticalDivider.tsx +99 -0
- package/components/VerticalDivider/index.tsx +13 -0
- package/context-bridge/index.tsx +87 -0
- package/core/componentsRegistry.ts +164 -0
- package/core/index.tsx +2 -0
- package/fast-context/index.tsx +190 -0
- package/hocs/index.tsx +5 -0
- package/hocs/typedMemo.tsx +5 -0
- package/hocs/withKeyboardAccessibility.tsx +231 -0
- package/hocs/withPortal.tsx +16 -0
- package/hooks/createPsuedoHook.tsx +50 -0
- package/hooks/index.tsx +29 -0
- package/hooks/useActionState.native.tsx +22 -0
- package/hooks/useActionState.tsx +34 -0
- package/hooks/useActive.tsx +5 -0
- package/hooks/useBreakpoints.tsx +7 -0
- package/hooks/useColorMode.tsx +17 -0
- package/hooks/useContrastColor.ts +15 -0
- package/hooks/useControlledValue.tsx +68 -0
- package/hooks/useFilePicker.tsx +48 -0
- package/hooks/useFocus.tsx +5 -0
- package/hooks/useHandleNumberFormat.tsx +106 -0
- package/hooks/useHover.tsx +5 -0
- package/hooks/useKeyboardDismissable.ts +66 -0
- package/hooks/useLatest.tsx +9 -0
- package/hooks/useMediaQuery.tsx +64 -0
- package/hooks/useMergedRefs.ts +14 -0
- package/hooks/usePrevious.ts +13 -0
- package/hooks/useQueryFilter.tsx +35 -0
- package/hooks/useSearchable.tsx +74 -0
- package/hooks/useSubcomponents.tsx +59 -0
- package/hooks/useTheme.ts +3 -0
- package/hooks/useToggle.tsx +24 -0
- package/package.json +114 -0
- package/shortcuts-manager/EventsManager.tsx +121 -0
- package/shortcuts-manager/ShortcutsManager/ShortcutsManager.native.tsx +9 -0
- package/shortcuts-manager/ShortcutsManager/ShortcutsManager.tsx +58 -0
- package/shortcuts-manager/ShortcutsManager/index.tsx +2 -0
- package/shortcuts-manager/ShortcutsManager/utils.tsx +30 -0
- package/shortcuts-manager/index.tsx +6 -0
- package/shortcuts-manager/types.ts +24 -0
- package/shortcuts-manager/useIsKeyPressed/index.tsx +1 -0
- package/shortcuts-manager/useIsKeyPressed/useIsKeyPress.tsx +9 -0
- package/shortcuts-manager/useSetScopes/index.tsx +1 -0
- package/shortcuts-manager/useSetScopes/useSetScopes.native.tsx +9 -0
- package/shortcuts-manager/useSetScopes/useSetScopes.tsx +25 -0
- package/shortcuts-manager/useShortcut/index.tsx +2 -0
- package/shortcuts-manager/useShortcut/types.ts +3 -0
- package/shortcuts-manager/useShortcut/useShortcut.native.tsx +9 -0
- package/shortcuts-manager/useShortcut/useShortcut.tsx +61 -0
- package/shortcuts-manager/utils.ts +105 -0
- package/styles/index.ts +4 -0
- package/styles/overlay.ts +69 -0
- package/styles/shadow.ts +21 -0
- package/styles/themes/DarkTheme.tsx +98 -0
- package/styles/themes/LightTheme.tsx +212 -0
- package/styles/themes/tokens.ts +248 -0
- package/styles/utils.ts +11 -0
- package/types/index.ts +129 -0
- package/types/theme.ts +159 -0
- package/utils/DocumentPicker/documentPicker.native.ts +10 -0
- package/utils/DocumentPicker/documentPicker.ts +76 -0
- package/utils/DocumentPicker/index.ts +2 -0
- package/utils/DocumentPicker/types.ts +28 -0
- package/utils/addEventListener.tsx +51 -0
- package/utils/backgroundContext.ts +9 -0
- package/utils/color.ts +22 -0
- package/utils/compare/index.ts +54 -0
- package/utils/composeEventHandlers.ts +9 -0
- package/utils/createNumberMask/createNumberMask.ts +98 -0
- package/utils/createNumberMask/index.ts +5 -0
- package/utils/createSyntheticEvent.ts +31 -0
- package/utils/date-fns.ts +7 -0
- package/utils/dateTimePicker.ts +5 -0
- package/utils/escapeRegex.ts +9 -0
- package/utils/extractTextStyles.ts +52 -0
- package/utils/formatNumberWithMask/formatNumberWithMask.ts +26 -0
- package/utils/formatNumberWithMask/formatWithMask.ts +119 -0
- package/utils/formatNumberWithMask/index.ts +6 -0
- package/utils/getCursorStyle/getCursorStyle.native.ts +1 -0
- package/utils/getCursorStyle/getCursorStyle.ts +1 -0
- package/utils/getCursorStyle/index.ts +1 -0
- package/utils/getOS/getOS.native.ts +7 -0
- package/utils/getOS/getOS.ts +24 -0
- package/utils/getOS/index.ts +1 -0
- package/utils/getyearRange.ts +5 -0
- package/utils/index.ts +20 -0
- package/utils/lodash.ts +50 -0
- package/utils/mergeRefs.ts +13 -0
- package/utils/normalizeBorderRadiuses.ts +24 -0
- package/utils/normalizeSpacings.ts +110 -0
- package/utils/normalizeToNumberString/index.ts +4 -0
- package/utils/normalizeToNumberString/normalizeToNumberString.ts +48 -0
- package/utils/repository.ts +103 -0
- package/utils/resolveColorMode.ts +9 -0
- package/utils/resolveStateVariant.ts +26 -0
- package/utils/tokenStylesParser.ts +7 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import color from 'color';
|
|
2
|
+
import { Animated } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { MD3DarkTheme } from './themes/DarkTheme';
|
|
5
|
+
|
|
6
|
+
export const isAnimatedValue = (
|
|
7
|
+
it: number | string | Animated.AnimatedInterpolation<any>,
|
|
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 = MD3DarkTheme.colors.surface,
|
|
13
|
+
): T extends number ? string : Animated.AnimatedInterpolation<any> {
|
|
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(el => {
|
|
21
|
+
return calculateColor(surfaceColor, el);
|
|
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
|
+
};
|
package/styles/shadow.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { MD3Elevation } from '../types/theme';
|
|
2
|
+
import { MD3Colors } from './themes/tokens';
|
|
3
|
+
|
|
4
|
+
const MD3_SHADOW_OPACITY = 0.3;
|
|
5
|
+
const MD3_SHADOW_COLOR = MD3Colors.primary0;
|
|
6
|
+
|
|
7
|
+
export const inputRange: MD3Elevation[] = [0, 1, 2, 3, 4, 5];
|
|
8
|
+
export const shadowHeight = [0, 1, 2, 4, 6, 8];
|
|
9
|
+
export const shadowRadius = [0, 3, 6, 8, 10, 12];
|
|
10
|
+
|
|
11
|
+
export default function shadow(elevation: number) {
|
|
12
|
+
return {
|
|
13
|
+
shadowColor: MD3_SHADOW_COLOR,
|
|
14
|
+
shadowOpacity: elevation ? MD3_SHADOW_OPACITY : 0,
|
|
15
|
+
shadowOffset: {
|
|
16
|
+
width: 0,
|
|
17
|
+
height: shadowHeight[elevation],
|
|
18
|
+
},
|
|
19
|
+
shadowRadius: shadowRadius[elevation],
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import color from 'color';
|
|
2
|
+
|
|
3
|
+
import { MD3LightTheme } from './LightTheme';
|
|
4
|
+
import { tokens } from './tokens';
|
|
5
|
+
|
|
6
|
+
const ref = tokens.md.ref;
|
|
7
|
+
|
|
8
|
+
export const generateDarkThemeColors = (
|
|
9
|
+
palette: typeof ref.palette,
|
|
10
|
+
opacity: typeof ref.opacity,
|
|
11
|
+
) => {
|
|
12
|
+
return {
|
|
13
|
+
primary: palette.primary70,
|
|
14
|
+
primaryContainer: palette.primary30,
|
|
15
|
+
primaryOnHover: color(palette.primary80).darken(0.12).rgb().string(),
|
|
16
|
+
primaryContainerOnHover: color(palette.primary80).darken(0.9).rgb().string(),
|
|
17
|
+
secondary: palette.secondary80,
|
|
18
|
+
secondaryContainer: palette.secondary30,
|
|
19
|
+
secondaryContainerOnHover: color(palette.secondary30).darken(0.25).rgb().string(),
|
|
20
|
+
tertiary: palette.tertiary80,
|
|
21
|
+
tertiaryContainer: palette.tertiary30,
|
|
22
|
+
surface: palette.neutral10,
|
|
23
|
+
surfaceVariant: palette.neutralVariant30,
|
|
24
|
+
surfaceDisabled: color(palette.neutral90).alpha(opacity.level2).rgb().string(),
|
|
25
|
+
background: palette.neutral10,
|
|
26
|
+
error: palette.error80,
|
|
27
|
+
errorContainer: palette.error30,
|
|
28
|
+
onPrimary: palette.primary20,
|
|
29
|
+
onPrimaryContainer: palette.primary90,
|
|
30
|
+
onSecondary: palette.secondary20,
|
|
31
|
+
onSecondaryContainer: palette.secondary90,
|
|
32
|
+
onTertiary: palette.tertiary20,
|
|
33
|
+
onTertiaryContainer: palette.tertiary90,
|
|
34
|
+
onSurface: palette.neutral90,
|
|
35
|
+
onSurfaceVariant: palette.neutralVariant80,
|
|
36
|
+
onSurfaceDisabled: color(palette.neutral90).alpha(opacity.level4).hexa(),
|
|
37
|
+
onSurfaceRipple: color(palette.neutral90).alpha(0.12).rgb().string(),
|
|
38
|
+
onError: palette.error20,
|
|
39
|
+
onErrorContainer: palette.error80,
|
|
40
|
+
onBackground: palette.neutral90,
|
|
41
|
+
outline: palette.neutralVariant60,
|
|
42
|
+
outlineVariant: palette.neutralVariant30,
|
|
43
|
+
inverseSurface: palette.neutral90,
|
|
44
|
+
inverseOnSurface: palette.neutral20,
|
|
45
|
+
inversePrimary: palette.primary40,
|
|
46
|
+
backdrop: color(palette.neutralVariant20).alpha(0.4).hexa(),
|
|
47
|
+
disabled: palette.neutral40,
|
|
48
|
+
disabledOnBackground: color(palette.neutral100).alpha(0.1).rgb().string(),
|
|
49
|
+
neutral1: palette.neutral70,
|
|
50
|
+
lines: palette.neutral90, // #E4E1E6
|
|
51
|
+
onNeutral1: palette.neutral40,
|
|
52
|
+
surfaceContainerHighest: palette.neutral22,
|
|
53
|
+
elevation: {
|
|
54
|
+
level0: 'transparent',
|
|
55
|
+
// Note: Color values with transparency cause RN to transfer shadows to children nodes
|
|
56
|
+
// instead of View component in Surface. Providing solid background fixes the issue.
|
|
57
|
+
// Opaque color values generated with `palette.primary80` used as background
|
|
58
|
+
level1: color(palette.primary80).alpha(0.05).rgb().string(), // palette.primary80, alpha 0.05
|
|
59
|
+
level2: color(palette.primary80).alpha(0.08).rgb().string(), // palette.primary80, alpha 0.08
|
|
60
|
+
level3: color(palette.primary80).alpha(0.11).rgb().string(), // palette.primary80, alpha 0.11
|
|
61
|
+
level4: color(palette.primary80).alpha(0.12).rgb().string(), // palette.primary80, alpha 0.12
|
|
62
|
+
level5: color(palette.primary80).alpha(0.14).rgb().string(), // palette.primary80, alpha 0.14
|
|
63
|
+
},
|
|
64
|
+
stateLayer: {
|
|
65
|
+
hover: {
|
|
66
|
+
onSurface: color(palette.neutral90).alpha(opacity.level1).rgb().string(),
|
|
67
|
+
onSurfaceVariant: color(palette.neutralVariant80).alpha(opacity.level1).hexa(),
|
|
68
|
+
primary: color(palette.primary70).alpha(opacity.level1).hexa(),
|
|
69
|
+
onPrimary: color(palette.primary20).alpha(opacity.level1).hexa(),
|
|
70
|
+
onPrimaryContainer: color(palette.primary90).alpha(opacity.level1).hexa(),
|
|
71
|
+
onSecondaryContainer: color(palette.secondary90).alpha(opacity.level1).hexa(),
|
|
72
|
+
onTertiaryContainer: color(palette.tertiary90).alpha(opacity.level1).hexa(),
|
|
73
|
+
inverseOnSurface: color(palette.neutral20).alpha(opacity.level1).hexa(),
|
|
74
|
+
},
|
|
75
|
+
disabled: {
|
|
76
|
+
onSurface: color(palette.neutral90).alpha(opacity.level2).hexa(),
|
|
77
|
+
onSurface_Level4: color(palette.neutral90).alpha(opacity.level4).hexa(),
|
|
78
|
+
},
|
|
79
|
+
pressed: {
|
|
80
|
+
primary: color(palette.primary40).alpha(opacity.level2).hexa(),
|
|
81
|
+
onSurface: color(palette.neutral10).alpha(opacity.level2).hexa(),
|
|
82
|
+
},
|
|
83
|
+
focussed: {
|
|
84
|
+
primary: color(palette.primary40).alpha(opacity.level2).hexa(),
|
|
85
|
+
onSurface: color(palette.neutral10).alpha(opacity.level2).hexa(),
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
palette,
|
|
89
|
+
opacity,
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const MD3DarkTheme = {
|
|
94
|
+
...MD3LightTheme,
|
|
95
|
+
themeName: 'MD3DarkTheme',
|
|
96
|
+
dark: true,
|
|
97
|
+
colors: generateDarkThemeColors(ref.palette, ref.opacity),
|
|
98
|
+
};
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import color from 'color';
|
|
2
|
+
|
|
3
|
+
import { MD3Colors, tokens, typescale } from './tokens';
|
|
4
|
+
|
|
5
|
+
const ref = tokens.md.ref;
|
|
6
|
+
|
|
7
|
+
export const generateLightThemeColors = (
|
|
8
|
+
palette: typeof ref.palette,
|
|
9
|
+
opacity: typeof ref.opacity,
|
|
10
|
+
) => {
|
|
11
|
+
return {
|
|
12
|
+
primary: palette.primary40,
|
|
13
|
+
primaryContainer: palette.primary90,
|
|
14
|
+
primaryOnHover: color(palette.primary40).darken(0.05).rgb().string(),
|
|
15
|
+
primaryContainerOnHover: color(palette.primary40).lighten(0.99).rgb().string(),
|
|
16
|
+
secondary: palette.secondary40,
|
|
17
|
+
secondaryContainer: palette.secondary90,
|
|
18
|
+
secondaryContainerOnHover: color(palette.secondary40).lighten(0.99).rgb().string(),
|
|
19
|
+
tertiary: palette.tertiary40,
|
|
20
|
+
tertiaryContainer: palette.tertiary90,
|
|
21
|
+
surface: palette.neutral99,
|
|
22
|
+
surfaceVariant: palette.neutralVariant90,
|
|
23
|
+
surfaceDisabled: color(palette.neutral10).alpha(opacity.level2).rgb().string(),
|
|
24
|
+
background: palette.neutral99,
|
|
25
|
+
error: palette.error40,
|
|
26
|
+
errorContainer: palette.error90,
|
|
27
|
+
onPrimary: palette.primary100,
|
|
28
|
+
onPrimaryContainer: palette.primary10,
|
|
29
|
+
onSecondary: palette.secondary100,
|
|
30
|
+
onSecondaryContainer: palette.secondary10,
|
|
31
|
+
onTertiary: palette.tertiary100,
|
|
32
|
+
onTertiaryContainer: palette.tertiary10,
|
|
33
|
+
onSurface: palette.neutral10,
|
|
34
|
+
onSurfaceVariant: palette.neutralVariant30,
|
|
35
|
+
onSurfaceDisabled: color(palette.neutral10).alpha(opacity.level4).hexa(),
|
|
36
|
+
onSurfaceRipple: color(palette.neutral10).alpha(0.12).rgb().string(),
|
|
37
|
+
onError: palette.error100,
|
|
38
|
+
onErrorContainer: palette.error10,
|
|
39
|
+
onBackground: palette.neutral10,
|
|
40
|
+
outline: palette.neutralVariant50,
|
|
41
|
+
outlineVariant: palette.neutralVariant80,
|
|
42
|
+
inverseSurface: palette.neutral20,
|
|
43
|
+
inverseOnSurface: palette.neutral95,
|
|
44
|
+
inversePrimary: palette.primary80,
|
|
45
|
+
backdrop: color(MD3Colors.neutralVariant20).alpha(0.4).hexa(),
|
|
46
|
+
disabled: palette.neutral70,
|
|
47
|
+
disabledOnBackground: color(palette.neutral0).alpha(0.12).rgb().string(),
|
|
48
|
+
neutral1: palette.neutral100,
|
|
49
|
+
onNeutral1: palette.neutral70,
|
|
50
|
+
lines: palette.neutral90, // #E4E1E6
|
|
51
|
+
surfaceContainerHighest: palette.neutral90,
|
|
52
|
+
scrim: palette.neutral0,
|
|
53
|
+
elevation: {
|
|
54
|
+
level0: 'transparent',
|
|
55
|
+
// Note: Color values with transparency cause RN to transfer shadows to children nodes
|
|
56
|
+
// instead of View component in Surface. Providing solid background fixes the issue.
|
|
57
|
+
// Opaque color values generated with `palette.primary99` used as background
|
|
58
|
+
level1: color(palette.primary40).alpha(0.05).hexa(), // palette.primary40, alpha 0.05
|
|
59
|
+
level2: color(palette.primary40).alpha(0.08).hexa(), // palette.primary40, alpha 0.08
|
|
60
|
+
level3: color(palette.primary40).alpha(0.11).hexa(), // palette.primary40, alpha 0.11
|
|
61
|
+
level4: color(palette.primary40).alpha(0.12).hexa(), // palette.primary40, alpha 0.12
|
|
62
|
+
level5: color(palette.primary40).alpha(0.14).hexa(), // palette.primary40, alpha 0.14
|
|
63
|
+
},
|
|
64
|
+
stateLayer: {
|
|
65
|
+
hover: {
|
|
66
|
+
onSurface: color(palette.neutral10).alpha(opacity.level1).hexa(),
|
|
67
|
+
onSurfaceVariant: color(palette.neutralVariant30).alpha(opacity.level1).hexa(),
|
|
68
|
+
primary: color(palette.primary40).alpha(opacity.level1).hexa(),
|
|
69
|
+
onPrimary: color(palette.primary100).alpha(opacity.level1).hexa(),
|
|
70
|
+
onPrimaryContainer: color(palette.primary10).alpha(opacity.level1).hexa(),
|
|
71
|
+
onSecondaryContainer: color(palette.secondary10).alpha(opacity.level1).hexa(),
|
|
72
|
+
onTertiaryContainer: color(palette.tertiary10).alpha(opacity.level1).hexa(),
|
|
73
|
+
inverseOnSurface: color(palette.neutral95).alpha(opacity.level1).hexa(),
|
|
74
|
+
},
|
|
75
|
+
disabled: {
|
|
76
|
+
onSurface: color(palette.neutral10).alpha(opacity.level2).hexa(),
|
|
77
|
+
onSurface_Level4: color(palette.neutral10).alpha(opacity.level4).hexa(),
|
|
78
|
+
},
|
|
79
|
+
pressed: {
|
|
80
|
+
primary: color(palette.primary40).alpha(opacity.level2).hexa(),
|
|
81
|
+
onSurface: color(palette.neutral10).alpha(opacity.level2).hexa(),
|
|
82
|
+
},
|
|
83
|
+
focussed: {
|
|
84
|
+
primary: color(palette.primary40).alpha(opacity.level2).hexa(),
|
|
85
|
+
onSurface: color(palette.neutral10).alpha(opacity.level2).hexa(),
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
palette,
|
|
89
|
+
opacity,
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const MD3LightTheme = {
|
|
94
|
+
dark: false,
|
|
95
|
+
themeName: 'MD3LightTheme',
|
|
96
|
+
colors: generateLightThemeColors(ref.palette, ref.opacity),
|
|
97
|
+
typescale,
|
|
98
|
+
shapes: ref.shapes,
|
|
99
|
+
animation: {
|
|
100
|
+
scale: 1.0,
|
|
101
|
+
durations: {
|
|
102
|
+
'0': 0,
|
|
103
|
+
'1': 100,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
letterSpacings: {
|
|
107
|
+
xxs: -1.5,
|
|
108
|
+
xs: -0.5,
|
|
109
|
+
sm: 0,
|
|
110
|
+
md: 0.1,
|
|
111
|
+
lg: 0.15,
|
|
112
|
+
xl: 0.25,
|
|
113
|
+
'2xl': 0.4,
|
|
114
|
+
'3xl': 0.5,
|
|
115
|
+
'4xl': 1.25,
|
|
116
|
+
'5xl': 1.5,
|
|
117
|
+
},
|
|
118
|
+
lineHeights: {
|
|
119
|
+
xs: 1.25,
|
|
120
|
+
sm: 1.375,
|
|
121
|
+
md: 1.5,
|
|
122
|
+
lg: 1.625,
|
|
123
|
+
xl: 2,
|
|
124
|
+
},
|
|
125
|
+
fontWeights: {
|
|
126
|
+
hairline: 100,
|
|
127
|
+
thin: 200,
|
|
128
|
+
light: 300,
|
|
129
|
+
normal: 400,
|
|
130
|
+
medium: 500,
|
|
131
|
+
semibold: 600,
|
|
132
|
+
bold: 700,
|
|
133
|
+
extrabold: 800,
|
|
134
|
+
black: 900,
|
|
135
|
+
},
|
|
136
|
+
fontSizes: {
|
|
137
|
+
xxs: 10,
|
|
138
|
+
xs: 12,
|
|
139
|
+
sm: 14,
|
|
140
|
+
md: 16,
|
|
141
|
+
lg: 18,
|
|
142
|
+
xl: 20,
|
|
143
|
+
'2xl': 24,
|
|
144
|
+
'3xl': 30,
|
|
145
|
+
'4xl': 36,
|
|
146
|
+
'5xl': 48,
|
|
147
|
+
'6xl': 60,
|
|
148
|
+
'7xl': 72,
|
|
149
|
+
'8xl': 96,
|
|
150
|
+
'9xl': 128,
|
|
151
|
+
},
|
|
152
|
+
spacings: {
|
|
153
|
+
'0': 0,
|
|
154
|
+
'1': 4,
|
|
155
|
+
'2': 8,
|
|
156
|
+
'3': 12,
|
|
157
|
+
'4': 16,
|
|
158
|
+
'5': 20,
|
|
159
|
+
'6': 24,
|
|
160
|
+
'7': 28,
|
|
161
|
+
'8': 32,
|
|
162
|
+
'9': 36,
|
|
163
|
+
'10': 40,
|
|
164
|
+
'12': 48,
|
|
165
|
+
'16': 64,
|
|
166
|
+
'20': 80,
|
|
167
|
+
'24': 96,
|
|
168
|
+
'32': 128,
|
|
169
|
+
'40': 160,
|
|
170
|
+
'48': 192,
|
|
171
|
+
'56': 224,
|
|
172
|
+
'64': 256,
|
|
173
|
+
'72': 288,
|
|
174
|
+
'80': 320,
|
|
175
|
+
'96': 384,
|
|
176
|
+
px: 1,
|
|
177
|
+
'1l': 6,
|
|
178
|
+
'2l': 10,
|
|
179
|
+
_0: -0,
|
|
180
|
+
_1: -4,
|
|
181
|
+
_2: -8,
|
|
182
|
+
_3: -12,
|
|
183
|
+
_4: -16,
|
|
184
|
+
_5: -20,
|
|
185
|
+
_6: -24,
|
|
186
|
+
_7: -28,
|
|
187
|
+
_8: -32,
|
|
188
|
+
_9: -36,
|
|
189
|
+
_10: -40,
|
|
190
|
+
_12: -48,
|
|
191
|
+
_16: -64,
|
|
192
|
+
_20: -80,
|
|
193
|
+
_24: -96,
|
|
194
|
+
_32: -128,
|
|
195
|
+
_40: -160,
|
|
196
|
+
_48: -192,
|
|
197
|
+
_56: -224,
|
|
198
|
+
_64: -256,
|
|
199
|
+
_72: -288,
|
|
200
|
+
_80: -320,
|
|
201
|
+
_96: -384,
|
|
202
|
+
_px: -1,
|
|
203
|
+
},
|
|
204
|
+
elevations: {
|
|
205
|
+
level0: 0,
|
|
206
|
+
level1: 1,
|
|
207
|
+
level2: 2,
|
|
208
|
+
level3: 3,
|
|
209
|
+
level4: 4,
|
|
210
|
+
level5: 5,
|
|
211
|
+
},
|
|
212
|
+
};
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
// import { Dimensions, Platform } from 'react-native';
|
|
2
|
+
import type { Font } from '../../types/theme';
|
|
3
|
+
|
|
4
|
+
const ref = {
|
|
5
|
+
palette: {
|
|
6
|
+
primary100: 'rgba(255, 255, 255, 1)',
|
|
7
|
+
primary99: 'rgba(255, 251, 254, 1)',
|
|
8
|
+
primary95: 'rgba(246, 237, 255, 1)',
|
|
9
|
+
primary90: 'rgba(234, 221, 255, 1)',
|
|
10
|
+
primary80: 'rgba(208, 188, 255, 1)',
|
|
11
|
+
primary70: 'rgba(182, 157, 248, 1)',
|
|
12
|
+
primary60: 'rgba(154, 130, 219, 1)',
|
|
13
|
+
primary50: 'rgba(127, 103, 190, 1)',
|
|
14
|
+
primary40: 'rgba(103, 80, 164, 1)',
|
|
15
|
+
primary30: 'rgba(79, 55, 139, 1)',
|
|
16
|
+
primary20: 'rgba(56, 30, 114, 1)',
|
|
17
|
+
primary10: 'rgba(33, 0, 93, 1)',
|
|
18
|
+
primary0: 'rgba(0, 0, 0, 1)',
|
|
19
|
+
secondary100: 'rgba(255, 255, 255, 1)',
|
|
20
|
+
secondary99: 'rgba(255, 251, 254, 1)',
|
|
21
|
+
secondary95: 'rgba(246, 237, 255, 1)',
|
|
22
|
+
secondary90: 'rgba(232, 222, 248, 1)',
|
|
23
|
+
secondary80: 'rgba(204, 194, 220, 1)',
|
|
24
|
+
secondary70: 'rgba(176, 167, 192, 1)',
|
|
25
|
+
secondary60: 'rgba(149, 141, 165, 1)',
|
|
26
|
+
secondary50: 'rgba(122, 114, 137, 1)',
|
|
27
|
+
secondary40: 'rgba(98, 91, 113, 1)',
|
|
28
|
+
secondary30: 'rgba(74, 68, 88, 1)',
|
|
29
|
+
secondary20: 'rgba(51, 45, 65, 1)',
|
|
30
|
+
secondary10: 'rgba(29, 25, 43, 1)',
|
|
31
|
+
secondary0: 'rgba(0, 0, 0, 1)',
|
|
32
|
+
tertiary100: 'rgba(255, 255, 255, 1)',
|
|
33
|
+
tertiary99: 'rgba(255, 251, 250, 1)',
|
|
34
|
+
tertiary95: 'rgba(255, 236, 241, 1)',
|
|
35
|
+
tertiary90: 'rgba(255, 216, 228, 1)',
|
|
36
|
+
tertiary80: 'rgba(239, 184, 200, 1)',
|
|
37
|
+
tertiary70: 'rgba(210, 157, 172, 1)',
|
|
38
|
+
tertiary60: 'rgba(181, 131, 146, 1)',
|
|
39
|
+
tertiary50: 'rgba(152, 105, 119, 1)',
|
|
40
|
+
tertiary40: 'rgba(125, 82, 96, 1)',
|
|
41
|
+
tertiary30: 'rgba(99, 59, 72, 1)',
|
|
42
|
+
tertiary20: 'rgba(73, 37, 50, 1)',
|
|
43
|
+
tertiary10: 'rgba(49, 17, 29, 1)',
|
|
44
|
+
tertiary0: 'rgba(0, 0, 0, 1)',
|
|
45
|
+
neutral100: 'rgba(255, 255, 255, 1)',
|
|
46
|
+
neutral99: 'rgba(255, 251, 254, 1)',
|
|
47
|
+
neutral95: 'rgba(244, 239, 244, 1)',
|
|
48
|
+
neutral90: 'rgba(230, 225, 229, 1)',
|
|
49
|
+
neutral80: 'rgba(201, 197, 202, 1)',
|
|
50
|
+
neutral70: 'rgba(174, 170, 174, 1)',
|
|
51
|
+
neutral60: 'rgba(147, 144, 148, 1)',
|
|
52
|
+
neutral50: 'rgba(120, 117, 121, 1)',
|
|
53
|
+
neutral40: 'rgba(96, 93, 98, 1)',
|
|
54
|
+
neutral30: 'rgba(72, 70, 73, 1)',
|
|
55
|
+
neutral22: 'rgba(54,52,59,1)',
|
|
56
|
+
neutral20: 'rgba(49, 48, 51, 1)',
|
|
57
|
+
neutral10: 'rgba(28, 27, 31, 1)',
|
|
58
|
+
neutral0: 'rgba(0, 0, 0, 1)',
|
|
59
|
+
neutralVariant100: 'rgba(255, 255, 255, 1)',
|
|
60
|
+
neutralVariant99: 'rgba(255, 251, 254, 1)',
|
|
61
|
+
neutralVariant95: 'rgba(245, 238, 250, 1)',
|
|
62
|
+
neutralVariant90: 'rgba(231, 224, 236, 1)',
|
|
63
|
+
neutralVariant80: 'rgba(202, 196, 208, 1)',
|
|
64
|
+
neutralVariant70: 'rgba(174, 169, 180, 1)',
|
|
65
|
+
neutralVariant60: 'rgba(147, 143, 153, 1)',
|
|
66
|
+
neutralVariant50: 'rgba(121, 116, 126, 1)',
|
|
67
|
+
neutralVariant40: 'rgba(96, 93, 102, 1)',
|
|
68
|
+
neutralVariant30: 'rgba(73, 69, 79, 1)',
|
|
69
|
+
neutralVariant20: 'rgba(50, 47, 55, 1)',
|
|
70
|
+
neutralVariant10: 'rgba(29, 26, 34, 1)',
|
|
71
|
+
neutralVariant0: 'rgba(0, 0, 0, 1)',
|
|
72
|
+
error100: 'rgba(255, 255, 255, 1)',
|
|
73
|
+
error99: 'rgba(255, 251, 249, 1)',
|
|
74
|
+
error95: 'rgba(252, 238, 238, 1)',
|
|
75
|
+
error90: 'rgba(249, 222, 220, 1)',
|
|
76
|
+
error80: 'rgba(242, 184, 181, 1)',
|
|
77
|
+
error70: 'rgba(236, 146, 142, 1)',
|
|
78
|
+
error60: 'rgba(228, 105, 98, 1)',
|
|
79
|
+
error50: 'rgba(220, 54, 46, 1)',
|
|
80
|
+
error40: 'rgba(179, 38, 30, 1)',
|
|
81
|
+
error30: 'rgba(140, 29, 24, 1)',
|
|
82
|
+
error20: 'rgba(96, 20, 16, 1)',
|
|
83
|
+
error10: 'rgba(65, 14, 11, 1)',
|
|
84
|
+
error0: 'rgba(0, 0, 0, 1)',
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
typeface: {
|
|
88
|
+
brandRegular: 'Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif',
|
|
89
|
+
// brandRegular: Platform.select({
|
|
90
|
+
// web: 'Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif',
|
|
91
|
+
// ios: 'System',
|
|
92
|
+
// default: 'sans-serif',
|
|
93
|
+
// }),
|
|
94
|
+
weightRegular: '400' as Font['fontWeight'],
|
|
95
|
+
|
|
96
|
+
plainMedium: 'Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif',
|
|
97
|
+
// plainMedium: Platform.select({
|
|
98
|
+
// web: 'Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif',
|
|
99
|
+
// ios: 'System',
|
|
100
|
+
// default: 'sans-serif-medium',
|
|
101
|
+
// }),
|
|
102
|
+
weightMedium: '500' as Font['fontWeight'],
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
opacity: {
|
|
106
|
+
level1: 0.08,
|
|
107
|
+
level2: 0.12,
|
|
108
|
+
level3: 0.16,
|
|
109
|
+
level4: 0.38,
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
shapes: {
|
|
113
|
+
corner: {
|
|
114
|
+
none: 0,
|
|
115
|
+
extraSmall: 4,
|
|
116
|
+
small: 8,
|
|
117
|
+
medium: 12,
|
|
118
|
+
large: 16,
|
|
119
|
+
extraLarge: 28,
|
|
120
|
+
full: 500,
|
|
121
|
+
// full: Dimensions.get('window').width,
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const regularType = {
|
|
127
|
+
fontFamily: ref.typeface.brandRegular,
|
|
128
|
+
letterSpacing: 0,
|
|
129
|
+
fontWeight: ref.typeface.weightRegular,
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const mediumType = {
|
|
133
|
+
fontFamily: ref.typeface.plainMedium,
|
|
134
|
+
letterSpacing: 0.15,
|
|
135
|
+
fontWeight: ref.typeface.weightMedium,
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export const typescale = {
|
|
139
|
+
displayLarge: {
|
|
140
|
+
...regularType,
|
|
141
|
+
lineHeight: 64,
|
|
142
|
+
fontSize: 57,
|
|
143
|
+
},
|
|
144
|
+
displayMedium: {
|
|
145
|
+
...regularType,
|
|
146
|
+
lineHeight: 52,
|
|
147
|
+
fontSize: 45,
|
|
148
|
+
},
|
|
149
|
+
displaySmall: {
|
|
150
|
+
...regularType,
|
|
151
|
+
lineHeight: 44,
|
|
152
|
+
fontSize: 36,
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
headlineLarge: {
|
|
156
|
+
...regularType,
|
|
157
|
+
lineHeight: 40,
|
|
158
|
+
fontSize: 32,
|
|
159
|
+
},
|
|
160
|
+
headlineMedium: {
|
|
161
|
+
...regularType,
|
|
162
|
+
lineHeight: 36,
|
|
163
|
+
fontSize: 28,
|
|
164
|
+
},
|
|
165
|
+
headlineSmall: {
|
|
166
|
+
...regularType,
|
|
167
|
+
lineHeight: 32,
|
|
168
|
+
fontSize: 24,
|
|
169
|
+
},
|
|
170
|
+
|
|
171
|
+
titleLarge: {
|
|
172
|
+
...regularType,
|
|
173
|
+
lineHeight: 28,
|
|
174
|
+
fontSize: 22,
|
|
175
|
+
},
|
|
176
|
+
titleMedium: {
|
|
177
|
+
...mediumType,
|
|
178
|
+
lineHeight: 24,
|
|
179
|
+
fontSize: 16,
|
|
180
|
+
},
|
|
181
|
+
titleSmall: {
|
|
182
|
+
...mediumType,
|
|
183
|
+
letterSpacing: 0.1,
|
|
184
|
+
lineHeight: 20,
|
|
185
|
+
fontSize: 14,
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
labelLarge: {
|
|
189
|
+
...mediumType,
|
|
190
|
+
letterSpacing: 0.1,
|
|
191
|
+
lineHeight: 20,
|
|
192
|
+
fontSize: 14,
|
|
193
|
+
},
|
|
194
|
+
labelMedium: {
|
|
195
|
+
...mediumType,
|
|
196
|
+
letterSpacing: 0.5,
|
|
197
|
+
lineHeight: 16,
|
|
198
|
+
fontSize: 12,
|
|
199
|
+
},
|
|
200
|
+
labelSmall: {
|
|
201
|
+
...mediumType,
|
|
202
|
+
letterSpacing: 0.5,
|
|
203
|
+
lineHeight: 16,
|
|
204
|
+
fontSize: 11,
|
|
205
|
+
},
|
|
206
|
+
|
|
207
|
+
bodyExtraLarge: {
|
|
208
|
+
...mediumType,
|
|
209
|
+
fontWeight: ref.typeface.weightRegular,
|
|
210
|
+
fontFamily: ref.typeface.brandRegular,
|
|
211
|
+
lineHeight: 28,
|
|
212
|
+
fontSize: 18,
|
|
213
|
+
},
|
|
214
|
+
bodyLarge: {
|
|
215
|
+
...mediumType,
|
|
216
|
+
fontWeight: ref.typeface.weightRegular,
|
|
217
|
+
fontFamily: ref.typeface.brandRegular,
|
|
218
|
+
lineHeight: 24,
|
|
219
|
+
fontSize: 16,
|
|
220
|
+
},
|
|
221
|
+
bodyMedium: {
|
|
222
|
+
...mediumType,
|
|
223
|
+
fontWeight: ref.typeface.weightRegular,
|
|
224
|
+
fontFamily: ref.typeface.brandRegular,
|
|
225
|
+
letterSpacing: 0.25,
|
|
226
|
+
lineHeight: 20,
|
|
227
|
+
fontSize: 14,
|
|
228
|
+
},
|
|
229
|
+
bodySmall: {
|
|
230
|
+
...mediumType,
|
|
231
|
+
fontWeight: ref.typeface.weightRegular,
|
|
232
|
+
fontFamily: ref.typeface.brandRegular,
|
|
233
|
+
letterSpacing: 0.4,
|
|
234
|
+
lineHeight: 16,
|
|
235
|
+
fontSize: 12,
|
|
236
|
+
},
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
export const tokens = {
|
|
240
|
+
md: {
|
|
241
|
+
ref,
|
|
242
|
+
sys: {
|
|
243
|
+
typescale,
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
export const MD3Colors = ref.palette;
|
package/styles/utils.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type Color from 'color';
|
|
2
|
+
|
|
3
|
+
export function lightenBy(color: Color, ratio: number) {
|
|
4
|
+
const lightness = color.lightness();
|
|
5
|
+
return color.lightness(lightness + (100 - lightness) * ratio);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function darkenBy(color: Color, ratio: number) {
|
|
9
|
+
const lightness = color.lightness();
|
|
10
|
+
return color.lightness(lightness - lightness * ratio);
|
|
11
|
+
}
|