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