@apple-pie/slice-native 0.1.4 → 0.1.6
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 +196 -6
- package/dist/cjs/components.js +15 -0
- package/dist/cjs/hooks.js +7 -0
- package/dist/cjs/index.js +18 -812
- package/dist/cjs/providers.js +9 -0
- package/dist/cjs/src/components/SliceButton/SliceButton.js +119 -0
- package/dist/cjs/src/components/SliceIcon/SliceIcon.js +20 -0
- package/dist/cjs/src/components/SliceIcon/iconRegistry.js +668 -0
- package/dist/cjs/src/components/SliceIcon/icons.js +144 -0
- package/dist/cjs/src/components/SliceText/SliceText.js +21 -0
- package/dist/cjs/src/components/SliceTextInput/SliceTextInput.js +87 -0
- package/dist/cjs/src/hooks/useCreateThemedStyles/useCreateThemedStyles.js +13 -0
- package/dist/cjs/src/providers/SliceThemeProvider.js +37 -0
- package/dist/cjs/src/theme/colors/colors.js +253 -0
- package/dist/cjs/src/theme/corners/corners.js +14 -0
- package/dist/cjs/src/theme/elevations/elevations.js +17 -0
- package/dist/cjs/src/theme/motion/motion.js +15 -0
- package/dist/cjs/src/theme/motion.js +47 -0
- package/dist/cjs/src/theme/spacing/spacing.js +14 -0
- package/dist/cjs/src/theme/type/type.js +190 -0
- package/dist/cjs/src/utils/typography/typography.js +17 -0
- package/dist/cjs/theme.js +23 -538
- package/dist/cjs/utils.js +7 -0
- package/dist/esm/components.mjs +5 -0
- package/dist/esm/hooks.mjs +1 -0
- package/dist/esm/index.mjs +8 -813
- package/dist/esm/providers.mjs +1 -0
- package/dist/esm/src/components/SliceButton/SliceButton.mjs +117 -0
- package/dist/esm/src/components/SliceIcon/SliceIcon.mjs +18 -0
- package/dist/esm/src/components/SliceIcon/iconRegistry.mjs +666 -0
- package/dist/esm/src/components/SliceIcon/icons.mjs +142 -0
- package/dist/esm/src/components/SliceText/SliceText.mjs +19 -0
- package/dist/esm/src/components/SliceTextInput/SliceTextInput.mjs +85 -0
- package/dist/esm/src/hooks/useCreateThemedStyles/useCreateThemedStyles.mjs +11 -0
- package/dist/esm/src/providers/SliceThemeProvider.mjs +33 -0
- package/dist/esm/src/theme/colors/colors.mjs +249 -0
- package/dist/esm/src/theme/corners/corners.mjs +12 -0
- package/dist/esm/src/theme/elevations/elevations.mjs +15 -0
- package/dist/esm/src/theme/motion/motion.mjs +13 -0
- package/dist/esm/src/theme/motion.mjs +45 -0
- package/dist/esm/src/theme/spacing/spacing.mjs +12 -0
- package/dist/esm/src/theme/type/type.mjs +184 -0
- package/dist/esm/src/utils/typography/typography.mjs +15 -0
- package/dist/esm/theme.mjs +7 -522
- package/dist/esm/utils.mjs +1 -0
- package/dist/types/native/index.d.ts +8 -4
- package/dist/types/native/src/components/SliceButton/SliceButton.d.ts +5 -0
- package/dist/types/native/src/components/SliceButton/_types.d.ts +47 -0
- package/dist/types/native/src/components/SliceButton/index.d.ts +2 -0
- package/dist/types/native/src/components/SliceIcon/SliceIcon.d.ts +2 -0
- package/dist/types/native/{components/Icon → src/components/SliceIcon}/icons.d.ts +1 -0
- package/dist/types/native/src/components/SliceIcon/index.d.ts +3 -0
- package/dist/types/native/src/components/SliceText/SliceText.d.ts +5 -0
- package/dist/types/native/src/components/SliceText/_types.d.ts +17 -0
- package/dist/types/native/src/components/SliceText/index.d.ts +2 -0
- package/dist/types/native/src/components/SliceTextInput/SliceTextInput.d.ts +2 -0
- package/dist/types/native/src/components/SliceTextInput/_types.d.ts +36 -0
- package/dist/types/native/src/components/SliceTextInput/index.d.ts +2 -0
- package/dist/types/native/src/components/index.d.ts +8 -0
- package/dist/types/native/src/hooks/index.d.ts +1 -0
- package/dist/types/native/src/hooks/useCreateThemedStyles/index.d.ts +1 -0
- package/dist/types/native/src/hooks/useCreateThemedStyles/useCreateThemedStyles.d.ts +7 -0
- package/dist/types/native/src/providers/SliceThemeProvider.d.ts +16 -0
- package/dist/types/native/src/providers/index.d.ts +2 -0
- package/dist/types/native/{theme → src/theme}/index.d.ts +5 -5
- package/dist/types/native/src/utils/index.d.ts +1 -0
- package/dist/types/native/src/utils/typography/index.d.ts +1 -0
- package/dist/types/native/src/utils/typography/typography.d.ts +7 -0
- package/package.json +32 -3
- package/dist/types/native/components/Icon/NativeIcon.d.ts +0 -2
- package/dist/types/native/components/Icon/index.d.ts +0 -3
- /package/dist/types/native/{components/Icon → src/components/SliceIcon}/_types.d.ts +0 -0
- /package/dist/types/native/{components/Icon → src/components/SliceIcon}/iconRegistry.d.ts +0 -0
- /package/dist/types/native/{theme → src/theme}/motion.d.ts +0 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
// Generated by native/scripts/generate-icons.mjs from src/components/Icon. Do not edit directly.
|
|
2
|
+
const SliceIcons = {
|
|
3
|
+
arrows: {
|
|
4
|
+
arrowLeft: 'arrow left',
|
|
5
|
+
arrowRight: 'arrow right',
|
|
6
|
+
arrowUp: 'arrow up',
|
|
7
|
+
arrowDown: 'arrow down',
|
|
8
|
+
chevronDown: 'chevron down',
|
|
9
|
+
chevronUp: 'chevron up',
|
|
10
|
+
navigateRight: 'navigate right',
|
|
11
|
+
navigateLeft: 'navigate left',
|
|
12
|
+
share: 'share',
|
|
13
|
+
},
|
|
14
|
+
selection: {
|
|
15
|
+
check: 'check',
|
|
16
|
+
checkCircle: 'check circle',
|
|
17
|
+
checkbox: 'checkbox',
|
|
18
|
+
checkboxChecked: 'checkbox checked',
|
|
19
|
+
checkboxPartial: 'checkbox partial',
|
|
20
|
+
circle: 'circle',
|
|
21
|
+
circleFill: 'circle fill',
|
|
22
|
+
plus: 'plus',
|
|
23
|
+
plusCircle: 'plus circle',
|
|
24
|
+
},
|
|
25
|
+
Messaging: {
|
|
26
|
+
chat: 'chat',
|
|
27
|
+
mail: 'mail',
|
|
28
|
+
notification: 'notification',
|
|
29
|
+
inbox: 'inbox',
|
|
30
|
+
like: 'like',
|
|
31
|
+
unlike: 'unlike',
|
|
32
|
+
at: '@',
|
|
33
|
+
},
|
|
34
|
+
media: {
|
|
35
|
+
camera: 'camera',
|
|
36
|
+
focus: 'focus',
|
|
37
|
+
mic: 'mic',
|
|
38
|
+
micMuted: 'mic muted',
|
|
39
|
+
video: 'video',
|
|
40
|
+
videoOff: 'video off',
|
|
41
|
+
download: 'download',
|
|
42
|
+
upload: 'upload',
|
|
43
|
+
speaker: 'speaker',
|
|
44
|
+
speakerMuted: 'speaker muted',
|
|
45
|
+
speakerHigh: 'speaker high',
|
|
46
|
+
speakerLow: 'speaker low',
|
|
47
|
+
play: 'play',
|
|
48
|
+
playCircle: 'play circle',
|
|
49
|
+
pause: 'pause',
|
|
50
|
+
pauseCircle: 'pause circle',
|
|
51
|
+
},
|
|
52
|
+
files: {
|
|
53
|
+
document: 'document',
|
|
54
|
+
documentEditor: 'document editor',
|
|
55
|
+
textDocument: 'text document',
|
|
56
|
+
},
|
|
57
|
+
people: {
|
|
58
|
+
people: 'people',
|
|
59
|
+
person: 'person',
|
|
60
|
+
talk: 'talk',
|
|
61
|
+
},
|
|
62
|
+
business: {
|
|
63
|
+
briefcase: 'briefcase',
|
|
64
|
+
dollar: 'dollar',
|
|
65
|
+
invoice: 'invoice',
|
|
66
|
+
payment: 'payment',
|
|
67
|
+
wallet: 'wallet',
|
|
68
|
+
laptop: 'laptop',
|
|
69
|
+
},
|
|
70
|
+
charts: {
|
|
71
|
+
barChart: 'bar chart',
|
|
72
|
+
chart: 'chart',
|
|
73
|
+
chartArrow: 'chart arrow',
|
|
74
|
+
},
|
|
75
|
+
status: {
|
|
76
|
+
alert: 'alert',
|
|
77
|
+
exclamation: 'exclamation',
|
|
78
|
+
help: 'help',
|
|
79
|
+
info: 'info',
|
|
80
|
+
issue: 'issue',
|
|
81
|
+
lightBulb: 'light bulb',
|
|
82
|
+
target: 'target',
|
|
83
|
+
openCircle: 'open circle',
|
|
84
|
+
},
|
|
85
|
+
brands: {
|
|
86
|
+
apple: 'apple',
|
|
87
|
+
google: 'google',
|
|
88
|
+
googleMono: 'google mono',
|
|
89
|
+
linkedin: 'linkedin',
|
|
90
|
+
github: 'github',
|
|
91
|
+
npm: 'npm',
|
|
92
|
+
openAI: 'openAI',
|
|
93
|
+
android: 'android',
|
|
94
|
+
},
|
|
95
|
+
edit: {
|
|
96
|
+
edit: 'edit',
|
|
97
|
+
trashBin: 'trash bin',
|
|
98
|
+
copy: 'copy',
|
|
99
|
+
filter: 'filter',
|
|
100
|
+
highlight: 'highlight',
|
|
101
|
+
undo: 'undo',
|
|
102
|
+
concise: 'concise',
|
|
103
|
+
expanded: 'expanded',
|
|
104
|
+
moderate: 'moderate',
|
|
105
|
+
recent: 'recent',
|
|
106
|
+
},
|
|
107
|
+
typography: {
|
|
108
|
+
fontLarger: 'font larger',
|
|
109
|
+
fontSmaller: 'font smaller',
|
|
110
|
+
characterBeam: 'character beam',
|
|
111
|
+
},
|
|
112
|
+
weather: {
|
|
113
|
+
sun: 'sun',
|
|
114
|
+
moonFull: 'moon full',
|
|
115
|
+
},
|
|
116
|
+
ai: {
|
|
117
|
+
sparkle: 'sparkle',
|
|
118
|
+
wand: 'wand',
|
|
119
|
+
},
|
|
120
|
+
ui: {
|
|
121
|
+
attach: 'attach',
|
|
122
|
+
blank: 'blank',
|
|
123
|
+
book: 'book',
|
|
124
|
+
globeLocation: 'globe location',
|
|
125
|
+
heart: 'heart',
|
|
126
|
+
stop: 'stop',
|
|
127
|
+
search: 'search',
|
|
128
|
+
settings: 'settings',
|
|
129
|
+
view: 'view',
|
|
130
|
+
refresh: 'refresh',
|
|
131
|
+
home: 'home',
|
|
132
|
+
menu: 'menu',
|
|
133
|
+
more: 'more',
|
|
134
|
+
sidebar: 'sidebar',
|
|
135
|
+
sidebarSplit: 'sidebar split',
|
|
136
|
+
keyboard: 'keyboard',
|
|
137
|
+
x: 'x',
|
|
138
|
+
fullscreen: 'fullscreen',
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export { SliceIcons };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Text } from 'react-native';
|
|
3
|
+
import { useSliceTheme } from '../../providers/SliceThemeProvider.mjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Utility wrapper around text component for easier styling of text using slice theme
|
|
7
|
+
*/
|
|
8
|
+
function StyledText(props) {
|
|
9
|
+
const { textStyle, textColor, style, singleLine, children, ...rest } = props;
|
|
10
|
+
const { type, colors } = useSliceTheme();
|
|
11
|
+
const textStyles = textStyle ? type[textStyle] : undefined;
|
|
12
|
+
const color = { color: textColor ? colors[textColor] : colors['core-text-primary'] };
|
|
13
|
+
const fontSize = textStyles?.fontSize ?? 16;
|
|
14
|
+
const height = typeof singleLine === 'number' ? singleLine : 1.2;
|
|
15
|
+
const lineHeight = { lineHeight: singleLine ? height * fontSize : textStyles?.lineHeight };
|
|
16
|
+
return (jsx(Text, { ...rest, numberOfLines: singleLine ? 1 : rest.numberOfLines, style: [textStyles, color, lineHeight, style], children: children }));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { StyledText };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useRef, useState, useEffect, useMemo } from 'react';
|
|
3
|
+
import { StyleSheet, View, TextInput } from 'react-native';
|
|
4
|
+
import Reanimated from 'react-native-reanimated';
|
|
5
|
+
import { useCreateThemedStyles } from '../../hooks/useCreateThemedStyles/useCreateThemedStyles.mjs';
|
|
6
|
+
import { lineHeightTextStyle } from '../../utils/typography/typography.mjs';
|
|
7
|
+
import { SliceIcon } from '../SliceIcon/SliceIcon.mjs';
|
|
8
|
+
|
|
9
|
+
function SliceTextInput(props) {
|
|
10
|
+
const themedStyles = useCreateThemedStyles(styles);
|
|
11
|
+
const { didFocus, layout, icon, focused, blurClears = false, iconColor, iconSize = 24, placeholderTextColor = themedStyles.placeHolder.color, hideIconOnFocus = true, style, onFocus, onBlur, onChangeText, accessibilityState, ...rest } = props;
|
|
12
|
+
const inputRef = useRef(null);
|
|
13
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
14
|
+
// Only drive native focus when the caller explicitly supplies a preference.
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (focused === undefined || !inputRef.current)
|
|
17
|
+
return;
|
|
18
|
+
if (focused && !inputRef.current.isFocused())
|
|
19
|
+
inputRef.current.focus();
|
|
20
|
+
else if (!focused && inputRef.current.isFocused())
|
|
21
|
+
inputRef.current.blur();
|
|
22
|
+
}, [focused]);
|
|
23
|
+
const iconColorComputed = useMemo(() => {
|
|
24
|
+
if (iconColor)
|
|
25
|
+
return iconColor;
|
|
26
|
+
return isFocused ? themedStyles.icon.color : placeholderTextColor;
|
|
27
|
+
}, [themedStyles, isFocused, iconColor, placeholderTextColor]);
|
|
28
|
+
const showIcon = useMemo(() => {
|
|
29
|
+
if (!icon)
|
|
30
|
+
return false;
|
|
31
|
+
return !(isFocused && hideIconOnFocus);
|
|
32
|
+
}, [isFocused, hideIconOnFocus, icon]);
|
|
33
|
+
const padding = useMemo(() => {
|
|
34
|
+
return StyleSheet.create({
|
|
35
|
+
padding: { paddingRight: 18, paddingLeft: showIcon ? 0 : 18 },
|
|
36
|
+
});
|
|
37
|
+
}, [showIcon]);
|
|
38
|
+
return (jsxs(Reanimated.View, { style: themedStyles.inputWrapper, layout: layout, children: [showIcon && (jsx(View, { style: [themedStyles.icon, { height: iconSize, width: iconSize }], children: jsx(SliceIcon, { name: icon, strokeColor: iconColorComputed, size: iconSize, accessible: false, pointerEvents: "none" }) })), jsx(TextInput, { ...rest, ref: inputRef, style: [themedStyles.inputFieldView, padding.padding, style], accessibilityState: {
|
|
39
|
+
...accessibilityState,
|
|
40
|
+
disabled: rest.editable === false || accessibilityState?.disabled,
|
|
41
|
+
}, onChangeText: onChangeText, placeholderTextColor: placeholderTextColor, onFocus: (event) => {
|
|
42
|
+
setIsFocused(true);
|
|
43
|
+
didFocus?.(true);
|
|
44
|
+
onFocus?.(event);
|
|
45
|
+
}, onBlur: (event) => {
|
|
46
|
+
setIsFocused(false);
|
|
47
|
+
if (blurClears) {
|
|
48
|
+
inputRef.current?.clear();
|
|
49
|
+
onChangeText?.('');
|
|
50
|
+
}
|
|
51
|
+
didFocus?.(false);
|
|
52
|
+
onBlur?.(event);
|
|
53
|
+
} })] }));
|
|
54
|
+
}
|
|
55
|
+
const styles = (theme) => StyleSheet.create({
|
|
56
|
+
icon: {
|
|
57
|
+
marginLeft: 16,
|
|
58
|
+
color: theme.name === 'lightMode' ? theme.colors['core-icon-primary'] : theme.colors['core-link-primary'],
|
|
59
|
+
},
|
|
60
|
+
inputWrapper: {
|
|
61
|
+
flex: 1,
|
|
62
|
+
flexDirection: 'row',
|
|
63
|
+
alignItems: 'center',
|
|
64
|
+
justifyContent: 'flex-start',
|
|
65
|
+
gap: 8,
|
|
66
|
+
borderWidth: 1,
|
|
67
|
+
borderColor: theme.colors['core-outline-secondary'],
|
|
68
|
+
borderRadius: 100,
|
|
69
|
+
minHeight: 48,
|
|
70
|
+
backgroundColor: theme.colors['core-surface-primary'],
|
|
71
|
+
zIndex: 2,
|
|
72
|
+
},
|
|
73
|
+
inputFieldView: {
|
|
74
|
+
...lineHeightTextStyle(theme.type['body-xl-bold']),
|
|
75
|
+
color: theme.colors['core-text-primary'],
|
|
76
|
+
flex: 1,
|
|
77
|
+
zIndex: 2,
|
|
78
|
+
minHeight: 48,
|
|
79
|
+
},
|
|
80
|
+
placeHolder: {
|
|
81
|
+
color: theme.colors['core-text-secondary'],
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export { SliceTextInput };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { useSliceTheme } from '../../providers/SliceThemeProvider.mjs';
|
|
3
|
+
|
|
4
|
+
/** Resolve native styles using the current provider theme. Keep the factory stable
|
|
5
|
+
* (outside the component, or with useCallback) to reuse styles across renders. */
|
|
6
|
+
function useCreateThemedStyles(styles) {
|
|
7
|
+
const sliceTheme = useSliceTheme();
|
|
8
|
+
return useMemo(() => styles(sliceTheme), [sliceTheme, styles]);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { useCreateThemedStyles };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { createContext, useMemo, useContext } from 'react';
|
|
3
|
+
import { useColorScheme } from 'react-native';
|
|
4
|
+
import { darkTheme, lightTheme } from '../../theme.mjs';
|
|
5
|
+
|
|
6
|
+
const ThemeContext = createContext(undefined);
|
|
7
|
+
function SliceThemeProvider({ preference = 'system', onPreferenceChange = undefined, children, }) {
|
|
8
|
+
const deviceMode = useColorScheme();
|
|
9
|
+
const mode = preference === 'system' ? (deviceMode === 'dark' ? 'dark' : 'light') : preference;
|
|
10
|
+
const value = useMemo(() => ({
|
|
11
|
+
theme: mode === 'dark' ? darkTheme : lightTheme,
|
|
12
|
+
mode,
|
|
13
|
+
preference,
|
|
14
|
+
setPreference: onPreferenceChange,
|
|
15
|
+
}), [mode, preference, onPreferenceChange]);
|
|
16
|
+
return jsx(ThemeContext.Provider, { value: value, children: children });
|
|
17
|
+
}
|
|
18
|
+
function useSliceContext() {
|
|
19
|
+
const context = useContext(ThemeContext);
|
|
20
|
+
if (!context) {
|
|
21
|
+
throw new Error('useSliceContext must be used within SliceThemeProvider');
|
|
22
|
+
}
|
|
23
|
+
return context;
|
|
24
|
+
}
|
|
25
|
+
function useSliceTheme() {
|
|
26
|
+
const context = useContext(ThemeContext);
|
|
27
|
+
if (!context) {
|
|
28
|
+
throw new Error('useSliceTheme must be used within SliceThemeProvider');
|
|
29
|
+
}
|
|
30
|
+
return context.theme;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { SliceThemeProvider, useSliceContext, useSliceTheme };
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
const coreColors = {
|
|
2
|
+
'brand-grey-50': '#f4f7fa',
|
|
3
|
+
'brand-grey-100': '#e5ecf3',
|
|
4
|
+
'brand-grey-200': '#d5e0ea',
|
|
5
|
+
'brand-grey-300': '#98acbf',
|
|
6
|
+
'brand-grey-400': '#7f96a9',
|
|
7
|
+
'brand-grey-500': '#657d91',
|
|
8
|
+
'brand-grey-600': '#4c6273',
|
|
9
|
+
'brand-grey-700': '#405261',
|
|
10
|
+
'brand-grey-800': '#37434e',
|
|
11
|
+
'brand-grey-900': '#2d353d',
|
|
12
|
+
'brand-grey-950': '#1f262d',
|
|
13
|
+
'brand-sea-50': '#e8f1ff',
|
|
14
|
+
'brand-sea-100': '#c7defe',
|
|
15
|
+
'brand-sea-200': '#a5c9ff',
|
|
16
|
+
'brand-sea-300': '#7ab3ff',
|
|
17
|
+
'brand-sea-400': '#4084ff',
|
|
18
|
+
'brand-sea-500': '#2f45ff',
|
|
19
|
+
'brand-sea-600': '#2d2fff',
|
|
20
|
+
'brand-sea-700': '#0000ff',
|
|
21
|
+
'brand-sea-800': '#0609cd',
|
|
22
|
+
'brand-sea-900': '#001699',
|
|
23
|
+
'brand-sea-950': '#0a0b5c',
|
|
24
|
+
'brand-sky-50': '#eafffe',
|
|
25
|
+
'brand-sky-100': '#cdfffb',
|
|
26
|
+
'brand-sky-200': '#a3f8ff',
|
|
27
|
+
'brand-sky-300': '#6af5ff',
|
|
28
|
+
'brand-sky-400': '#00edff',
|
|
29
|
+
'brand-sky-500': '#00c8e0',
|
|
30
|
+
'brand-sky-600': '#00a6c0',
|
|
31
|
+
'brand-sky-700': '#03839b',
|
|
32
|
+
'brand-sky-800': '#0d697d',
|
|
33
|
+
'brand-sky-900': '#105669',
|
|
34
|
+
'brand-sky-950': '#033949',
|
|
35
|
+
'brand-land-50': '#f4ffe5',
|
|
36
|
+
'brand-land-100': '#e0ffb7',
|
|
37
|
+
'brand-land-200': '#caff95',
|
|
38
|
+
'brand-land-300': '#b7fe59',
|
|
39
|
+
'brand-land-400': '#9cf820',
|
|
40
|
+
'brand-land-500': '#71e618',
|
|
41
|
+
'brand-land-600': '#56c900',
|
|
42
|
+
'brand-land-700': '#2d8c00',
|
|
43
|
+
'brand-land-800': '#31690b',
|
|
44
|
+
'brand-land-900': '#2a580f',
|
|
45
|
+
'brand-land-950': '#123201',
|
|
46
|
+
'brand-orange-50': '#fff8ec',
|
|
47
|
+
'brand-orange-100': '#ffebd7',
|
|
48
|
+
'brand-orange-200': '#ffe3c6',
|
|
49
|
+
'brand-orange-300': '#ffc182',
|
|
50
|
+
'brand-orange-400': '#ff972e',
|
|
51
|
+
'brand-orange-500': '#ff800a',
|
|
52
|
+
'brand-orange-600': '#ff6700',
|
|
53
|
+
'brand-orange-700': '#ff3700',
|
|
54
|
+
'brand-orange-800': '#a02b0b',
|
|
55
|
+
'brand-orange-900': '#80250b',
|
|
56
|
+
'brand-orange-950': '#461604',
|
|
57
|
+
'brand-yellow-50': '#ffffea',
|
|
58
|
+
'brand-yellow-100': '#fffdca',
|
|
59
|
+
'brand-yellow-200': '#fff2a0',
|
|
60
|
+
'brand-yellow-300': '#ffeb72',
|
|
61
|
+
'brand-yellow-400': '#ffd333',
|
|
62
|
+
'brand-yellow-500': '#ffc200',
|
|
63
|
+
'brand-yellow-600': '#ffad00',
|
|
64
|
+
'brand-yellow-700': '#c68601',
|
|
65
|
+
'brand-yellow-800': '#8f6307',
|
|
66
|
+
'brand-yellow-900': '#5f430a',
|
|
67
|
+
'brand-yellow-950': '#442e00',
|
|
68
|
+
'brand-purple-50': '#faf0ff',
|
|
69
|
+
'brand-purple-100': '#f4ddff',
|
|
70
|
+
'brand-purple-200': '#e5cdff',
|
|
71
|
+
'brand-purple-300': '#ccafff',
|
|
72
|
+
'brand-purple-400': '#b891ff',
|
|
73
|
+
'brand-purple-500': '#7d48ff',
|
|
74
|
+
'brand-purple-600': '#6a14ff',
|
|
75
|
+
'brand-purple-700': '#5600f1',
|
|
76
|
+
'brand-purple-800': '#4d01d6',
|
|
77
|
+
'brand-purple-900': '#4003af',
|
|
78
|
+
'brand-purple-950': '#1e007c',
|
|
79
|
+
'brand-magenta-50': '#fef1fc',
|
|
80
|
+
'brand-magenta-100': '#ffdcef',
|
|
81
|
+
'brand-magenta-200': '#ffcae6',
|
|
82
|
+
'brand-magenta-300': '#ff90cb',
|
|
83
|
+
'brand-magenta-400': '#ff61ca',
|
|
84
|
+
'brand-magenta-500': '#ff3ac2',
|
|
85
|
+
'brand-magenta-600': '#f012aa',
|
|
86
|
+
'brand-magenta-700': '#df059b',
|
|
87
|
+
'brand-magenta-800': '#9b0069',
|
|
88
|
+
'brand-magenta-900': '#790a55',
|
|
89
|
+
'brand-magenta-950': '#58003a',
|
|
90
|
+
'brand-white-0': '#ffffff',
|
|
91
|
+
'product-red-400': '#ff474a',
|
|
92
|
+
'product-red-500': '#df0529',
|
|
93
|
+
'core-drop-shadow-light': '#0339491a',
|
|
94
|
+
'core-drop-shadow-dark': '#0000007a',
|
|
95
|
+
'core-surface-coverup-translucent-light': '#1f262d52',
|
|
96
|
+
'core-surface-coverup-translucent-dark': '#0000007a',
|
|
97
|
+
'core-surface-overlay-translucent-light': '#ffffffcc',
|
|
98
|
+
'core-surface-overlay-translucent-dark': '#1f262dcc',
|
|
99
|
+
'surface-primary-tint-light': '#fcfcfc',
|
|
100
|
+
'surface-primary-tint-dark': '#191e24',
|
|
101
|
+
'scroll-bar-light': '#e3e8ef',
|
|
102
|
+
'scroll-bar-dark': 'rgba(255, 255, 255, 0.1)',
|
|
103
|
+
'scroll-bar-hover-light': '#cdd5df',
|
|
104
|
+
'scroll-bar-hover-dark': 'rgba(255, 255, 255, 0.15)',
|
|
105
|
+
'surface-shadow-soft-light': '0px 4px 24px #0339491a',
|
|
106
|
+
'surface-shadow-soft-dark': '0px 4px 24px #0000007a',
|
|
107
|
+
'surface-shadow-strong-light': '0px 4px 64px #0339491a',
|
|
108
|
+
'surface-shadow-strong-dark': '0px 4px 64px #0000007a',
|
|
109
|
+
};
|
|
110
|
+
const light = {
|
|
111
|
+
'array-land': coreColors['brand-land-100'],
|
|
112
|
+
'array-land-label': coreColors['brand-land-600'],
|
|
113
|
+
'array-magenta': coreColors['brand-magenta-100'],
|
|
114
|
+
'array-magenta-label': coreColors['brand-magenta-600'],
|
|
115
|
+
'array-orange': coreColors['brand-orange-100'],
|
|
116
|
+
'array-orange-label': coreColors['brand-orange-600'],
|
|
117
|
+
'array-purple': coreColors['brand-purple-100'],
|
|
118
|
+
'array-purple-label': coreColors['brand-purple-600'],
|
|
119
|
+
'array-sea': coreColors['brand-sea-100'],
|
|
120
|
+
'array-sea-label': coreColors['brand-sea-600'],
|
|
121
|
+
'array-sky': coreColors['brand-sky-100'],
|
|
122
|
+
'array-sky-label': coreColors['brand-sky-600'],
|
|
123
|
+
'array-yellow': coreColors['brand-yellow-100'],
|
|
124
|
+
'array-yellow-label': coreColors['brand-yellow-600'],
|
|
125
|
+
'core-badge-primary': coreColors['brand-sea-500'],
|
|
126
|
+
'core-badge-secondary': coreColors['brand-grey-100'],
|
|
127
|
+
'core-button-disabled': coreColors['brand-grey-50'],
|
|
128
|
+
'core-button-primary': coreColors['brand-sea-500'],
|
|
129
|
+
'core-drop-shadow': coreColors['core-drop-shadow-light'],
|
|
130
|
+
'core-gp-logo-primary': coreColors['brand-sea-700'],
|
|
131
|
+
'core-gp-logo-secondary': coreColors['brand-grey-950'],
|
|
132
|
+
'core-icon-dark': coreColors['brand-grey-950'],
|
|
133
|
+
'core-icon-disabled': coreColors['brand-grey-300'],
|
|
134
|
+
'core-icon-error': coreColors['product-red-500'],
|
|
135
|
+
'core-icon-light': coreColors['brand-white-0'],
|
|
136
|
+
'core-icon-primary': coreColors['brand-grey-950'],
|
|
137
|
+
'core-icon-secondary': coreColors['brand-grey-700'],
|
|
138
|
+
'core-icon-tertiary': coreColors['brand-sea-500'],
|
|
139
|
+
'core-outline-secondary': coreColors['brand-grey-100'],
|
|
140
|
+
'core-outline-primary': coreColors['brand-grey-100'],
|
|
141
|
+
'core-outline-special': coreColors['brand-sea-100'],
|
|
142
|
+
'core-outline-tertiary': coreColors['brand-sea-500'],
|
|
143
|
+
'core-surface-coverup-translucent': coreColors['core-surface-coverup-translucent-light'],
|
|
144
|
+
'core-surface-overlay-translucent': coreColors['core-surface-overlay-translucent-light'],
|
|
145
|
+
'core-surface-primary': coreColors['brand-white-0'],
|
|
146
|
+
'core-surface-primary-tint': coreColors['surface-primary-tint-light'],
|
|
147
|
+
'core-surface-secondary': coreColors['brand-grey-50'],
|
|
148
|
+
'core-surface-special': coreColors['brand-sea-50'],
|
|
149
|
+
'core-text-dark': coreColors['brand-grey-950'],
|
|
150
|
+
'core-text-disabled': coreColors['brand-grey-300'],
|
|
151
|
+
'core-text-error': coreColors['product-red-500'],
|
|
152
|
+
'core-text-light': coreColors['brand-white-0'],
|
|
153
|
+
'core-text-primary': coreColors['brand-grey-950'],
|
|
154
|
+
'core-text-secondary': coreColors['brand-grey-700'],
|
|
155
|
+
'core-text-tertiary': coreColors['brand-grey-600'],
|
|
156
|
+
'core-text-special': coreColors['brand-sea-500'],
|
|
157
|
+
'core-text-accent': coreColors['brand-sky-500'],
|
|
158
|
+
'core-link-primary': coreColors['brand-sea-500'],
|
|
159
|
+
'eor-tag-employee': coreColors['brand-sky-700'],
|
|
160
|
+
'eor-tag-overdue': coreColors['product-red-500'],
|
|
161
|
+
'eor-tag-paid': coreColors['brand-land-700'],
|
|
162
|
+
'eor-tag-pending': coreColors['brand-orange-500'],
|
|
163
|
+
'eor-tag-professional': coreColors['brand-sea-500'],
|
|
164
|
+
'feedback-attention': coreColors['brand-yellow-500'],
|
|
165
|
+
'feedback-informative': coreColors['brand-sky-700'],
|
|
166
|
+
'feedback-positive': coreColors['brand-land-700'],
|
|
167
|
+
'feedback-urgency': coreColors['brand-orange-500'],
|
|
168
|
+
'feedback-warning': coreColors['product-red-500'],
|
|
169
|
+
'gia-tag-risk-high': coreColors['product-red-500'],
|
|
170
|
+
'gia-tag-risk-low': coreColors['brand-sky-700'],
|
|
171
|
+
'gia-tag-risk-moderate': coreColors['brand-orange-500'],
|
|
172
|
+
'gia-text-excerpt-highlight': coreColors['brand-orange-100'],
|
|
173
|
+
'gia-text-selection': coreColors['brand-sea-100'],
|
|
174
|
+
'scroll-bar': coreColors['scroll-bar-light'],
|
|
175
|
+
'scroll-bar-hover': coreColors['scroll-bar-hover-light'],
|
|
176
|
+
'surface-shadow-soft': coreColors['surface-shadow-soft-light'],
|
|
177
|
+
'surface-shadow-strong': coreColors['surface-shadow-strong-light'],
|
|
178
|
+
};
|
|
179
|
+
const dark = {
|
|
180
|
+
'array-land': coreColors['brand-land-100'],
|
|
181
|
+
'array-land-label': coreColors['brand-land-600'],
|
|
182
|
+
'array-magenta': coreColors['brand-magenta-100'],
|
|
183
|
+
'array-magenta-label': coreColors['brand-magenta-600'],
|
|
184
|
+
'array-orange': coreColors['brand-orange-100'],
|
|
185
|
+
'array-orange-label': coreColors['brand-orange-600'],
|
|
186
|
+
'array-purple': coreColors['brand-purple-100'],
|
|
187
|
+
'array-purple-label': coreColors['brand-purple-600'],
|
|
188
|
+
'array-sea': coreColors['brand-sea-100'],
|
|
189
|
+
'array-sea-label': coreColors['brand-sea-600'],
|
|
190
|
+
'array-sky': coreColors['brand-sky-100'],
|
|
191
|
+
'array-sky-label': coreColors['brand-sky-600'],
|
|
192
|
+
'array-yellow': coreColors['brand-yellow-100'],
|
|
193
|
+
'array-yellow-label': coreColors['brand-yellow-600'],
|
|
194
|
+
'core-badge-primary': coreColors['brand-sea-500'],
|
|
195
|
+
'core-badge-secondary': coreColors['brand-grey-700'],
|
|
196
|
+
'core-button-disabled': coreColors['brand-grey-900'],
|
|
197
|
+
'core-button-primary': coreColors['brand-sea-500'],
|
|
198
|
+
'core-drop-shadow': coreColors['core-drop-shadow-dark'],
|
|
199
|
+
'core-gp-logo-primary': coreColors['brand-sea-500'],
|
|
200
|
+
'core-gp-logo-secondary': coreColors['brand-white-0'],
|
|
201
|
+
'core-icon-dark': coreColors['brand-grey-950'],
|
|
202
|
+
'core-icon-disabled': coreColors['brand-grey-500'],
|
|
203
|
+
'core-icon-error': coreColors['product-red-400'],
|
|
204
|
+
'core-icon-light': coreColors['brand-white-0'],
|
|
205
|
+
'core-icon-primary': coreColors['brand-white-0'],
|
|
206
|
+
'core-icon-secondary': coreColors['brand-grey-200'],
|
|
207
|
+
'core-icon-tertiary': coreColors['brand-sky-300'],
|
|
208
|
+
'core-outline-secondary': coreColors['brand-grey-900'],
|
|
209
|
+
'core-outline-primary': coreColors['brand-grey-700'],
|
|
210
|
+
'core-outline-special': coreColors['brand-sky-900'],
|
|
211
|
+
'core-outline-tertiary': coreColors['brand-sky-300'],
|
|
212
|
+
'core-surface-coverup-translucent': coreColors['core-surface-coverup-translucent-dark'],
|
|
213
|
+
'core-surface-overlay-translucent': coreColors['core-surface-overlay-translucent-dark'],
|
|
214
|
+
'core-surface-primary': coreColors['brand-grey-950'],
|
|
215
|
+
'core-surface-primary-tint': coreColors['surface-primary-tint-dark'],
|
|
216
|
+
'core-surface-secondary': coreColors['brand-grey-900'],
|
|
217
|
+
'core-surface-special': coreColors['brand-sky-950'],
|
|
218
|
+
'core-text-dark': coreColors['brand-grey-950'],
|
|
219
|
+
'core-text-disabled': coreColors['brand-grey-500'],
|
|
220
|
+
'core-text-error': coreColors['product-red-400'],
|
|
221
|
+
'core-text-light': coreColors['brand-white-0'],
|
|
222
|
+
'core-text-primary': coreColors['brand-white-0'],
|
|
223
|
+
'core-text-secondary': coreColors['brand-grey-200'],
|
|
224
|
+
'core-text-tertiary': coreColors['brand-grey-400'],
|
|
225
|
+
'core-text-special': coreColors['brand-sky-300'],
|
|
226
|
+
'core-text-accent': coreColors['brand-sky-300'],
|
|
227
|
+
'core-link-primary': coreColors['brand-sky-300'],
|
|
228
|
+
'eor-tag-employee': coreColors['brand-sky-700'],
|
|
229
|
+
'eor-tag-overdue': coreColors['product-red-400'],
|
|
230
|
+
'eor-tag-paid': coreColors['brand-land-700'],
|
|
231
|
+
'eor-tag-pending': coreColors['brand-orange-500'],
|
|
232
|
+
'eor-tag-professional': coreColors['brand-sea-500'],
|
|
233
|
+
'feedback-attention': coreColors['brand-yellow-400'],
|
|
234
|
+
'feedback-informative': coreColors['brand-sky-600'],
|
|
235
|
+
'feedback-positive': coreColors['brand-land-700'],
|
|
236
|
+
'feedback-urgency': coreColors['brand-orange-500'],
|
|
237
|
+
'feedback-warning': coreColors['product-red-400'],
|
|
238
|
+
'gia-tag-risk-high': coreColors['product-red-400'],
|
|
239
|
+
'gia-tag-risk-low': coreColors['brand-sky-600'],
|
|
240
|
+
'gia-tag-risk-moderate': coreColors['brand-orange-500'],
|
|
241
|
+
'gia-text-excerpt-highlight': coreColors['brand-orange-100'],
|
|
242
|
+
'gia-text-selection': coreColors['brand-sea-900'],
|
|
243
|
+
'scroll-bar': coreColors['scroll-bar-dark'],
|
|
244
|
+
'scroll-bar-hover': coreColors['scroll-bar-hover-dark'],
|
|
245
|
+
'surface-shadow-soft': coreColors['surface-shadow-soft-dark'],
|
|
246
|
+
'surface-shadow-strong': coreColors['surface-shadow-strong-dark'],
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
export { coreColors, dark, light };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Elevation levels for UI component types
|
|
3
|
+
*/
|
|
4
|
+
const elevations = {
|
|
5
|
+
'elevation-below-surface': -100, // items hidden from view
|
|
6
|
+
'elevation-surface': 0, // default
|
|
7
|
+
'elevation-float': 100, // toolbars, fab buttons, etc.
|
|
8
|
+
'elevation-describe': 200, // tooltips, info, etc.
|
|
9
|
+
'elevation-status': 300, // status bars, toasts, etc.
|
|
10
|
+
'elevation-notify': 400, // alerts, and other critical status, etc.
|
|
11
|
+
'elevation-overlay': 500, // overlay covers, etc.
|
|
12
|
+
'elevation-confirm': 600, // conformation dialogs, etc. requiring action to dismiss
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { elevations };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Motion for Slice UI
|
|
3
|
+
*/
|
|
4
|
+
const motion = {
|
|
5
|
+
'motion-magnet': 'cubic-bezier(0.352, 0.003, 0.993, -0.052)',
|
|
6
|
+
'motion-water': 'cubic-bezier(0.36, 0, 0.64, 1)',
|
|
7
|
+
'motion-spring': 'linear(0, 0.001 0.3%, 0.008 0.7%, 0.034 1.5%, 0.076 2.3%, 0.138 3.2%, 0.275 4.8%, 0.713 9.4%, 0.836 10.9%, 0.933 12.3%, 1.011 13.7%, 1.074 15.2%, 1.096 15.9%, 1.116 16.7%, 1.132 17.5%, 1.142 18.3%, 1.148 19.1%, 1.15 20%, 1.148 21%, 1.142 22%, 1.133 22.9%, 1.12 24%, 1.048 29.1%, 1.015 31.8%, 1.002 33.3%, 0.991 34.9%, 0.983 36.5%, 0.979 38.1%, 0.977 39.9%, 0.979 42%, 0.997 51.7%, 1.003 57.7%, 1 77%, 1)',
|
|
8
|
+
'motion-magnet-duration': '0.5s',
|
|
9
|
+
'motion-water-duration': '0.25s',
|
|
10
|
+
'motion-spring-duration': '1s',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { motion };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** Convert Slice's explicit CSS curves without importing the React Native runtime. */
|
|
2
|
+
function easing(css) {
|
|
3
|
+
if (css.startsWith('cubic-bezier(')) {
|
|
4
|
+
const [x1, y1, x2, y2] = css.slice(13, -1).split(',').map(Number);
|
|
5
|
+
const sample = (t, a, b) => 3 * (1 - t) ** 2 * t * a + 3 * (1 - t) * t ** 2 * b + t ** 3;
|
|
6
|
+
return (progress) => {
|
|
7
|
+
if (progress <= 0)
|
|
8
|
+
return 0;
|
|
9
|
+
if (progress >= 1)
|
|
10
|
+
return 1;
|
|
11
|
+
let low = 0;
|
|
12
|
+
let high = 1;
|
|
13
|
+
for (let i = 0; i < 30; i++) {
|
|
14
|
+
const middle = (low + high) / 2;
|
|
15
|
+
if (sample(middle, x1, x2) < progress)
|
|
16
|
+
low = middle;
|
|
17
|
+
else
|
|
18
|
+
high = middle;
|
|
19
|
+
}
|
|
20
|
+
return sample((low + high) / 2, y1, y2);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
if (!css.startsWith('linear('))
|
|
24
|
+
throw new Error(`Unsupported Slice easing: ${css}`);
|
|
25
|
+
const points = css
|
|
26
|
+
.slice(7, -1)
|
|
27
|
+
.split(',')
|
|
28
|
+
.map((entry, index, entries) => {
|
|
29
|
+
const [value, percent] = entry.trim().split(/\s+/).map(Number.parseFloat);
|
|
30
|
+
return { value, position: percent === undefined ? index / (entries.length - 1) : percent / 100 };
|
|
31
|
+
});
|
|
32
|
+
return (progress) => {
|
|
33
|
+
if (progress <= 0)
|
|
34
|
+
return points[0].value;
|
|
35
|
+
for (let i = 1; i < points.length; i++) {
|
|
36
|
+
const left = points[i - 1];
|
|
37
|
+
const right = points[i];
|
|
38
|
+
if (progress <= right.position)
|
|
39
|
+
return (left.value + ((right.value - left.value) * (progress - left.position)) / (right.position - left.position));
|
|
40
|
+
}
|
|
41
|
+
return points[points.length - 1].value;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { easing };
|