@apple-pie/slice-native 0.1.2 → 0.1.3
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 +50 -5
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/theme.js +595 -0
- package/dist/esm/index.mjs +1 -0
- package/dist/esm/theme.mjs +585 -0
- package/dist/types/native/index.d.ts +4 -0
- package/dist/types/native/theme/index.d.ts +287 -0
- package/dist/types/native/theme/motion.d.ts +2 -0
- package/dist/types/src/theme/colors/colors.d.ts +6 -0
- package/dist/types/src/theme/colors/types.d.ts +178 -0
- package/dist/types/src/theme/corners/corners.d.ts +2 -0
- package/dist/types/src/theme/corners/types.d.ts +10 -0
- package/dist/types/src/theme/elevations/_types.d.ts +10 -0
- package/dist/types/src/theme/elevations/elevations.d.ts +5 -0
- package/dist/types/src/theme/motion/_types.d.ts +8 -0
- package/dist/types/src/theme/motion/motion.d.ts +5 -0
- package/dist/types/src/theme/spacing/_types.d.ts +10 -0
- package/dist/types/src/theme/spacing/spacing.d.ts +2 -0
- package/dist/types/src/theme/type/type.d.ts +39 -0
- package/dist/types/src/theme/type/types.d.ts +23 -0
- package/package.json +11 -5
- package/dist/types/index.d.ts +0 -2
- /package/dist/types/{components → native/components}/Icon/NativeIcon.d.ts +0 -0
- /package/dist/types/{components → native/components}/Icon/_types.d.ts +0 -0
- /package/dist/types/{components → native/components}/Icon/iconRegistry.d.ts +0 -0
- /package/dist/types/{components → native/components}/Icon/icons.d.ts +0 -0
- /package/dist/types/{components → native/components}/Icon/index.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @apple-pie/slice-native
|
|
2
2
|
|
|
3
3
|
Experimental React Native SVG icons, with the same names and artwork as the web UIKit.
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
Includes native light/dark theme tokens; other Slice components and a theme provider
|
|
5
|
+
are not included. It is built and published independently
|
|
6
6
|
of `@apple-pie/slice` and does not require that package at runtime.
|
|
7
7
|
|
|
8
8
|
```tsx
|
|
@@ -70,6 +70,51 @@ Run `npm pack --dry-run` from `native/` to inspect the publishable files, or
|
|
|
70
70
|
`npm pack` to create a tarball. The `prepack` hook builds automatically. Build and
|
|
71
71
|
pack from this repository: generation uses the web artwork in `src/components/Icon`.
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
## Theme tokens
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
import { Text, View, useColorScheme } from 'react-native';
|
|
77
|
+
import { lightTheme, darkTheme } from '@apple-pie/slice-native/theme';
|
|
78
|
+
|
|
79
|
+
function Card() {
|
|
80
|
+
const theme = useColorScheme() === 'dark' ? darkTheme : lightTheme;
|
|
81
|
+
return (
|
|
82
|
+
<View style={{
|
|
83
|
+
backgroundColor: theme.colors['core-surface-primary'],
|
|
84
|
+
padding: theme.spacing.m,
|
|
85
|
+
borderRadius: theme.corners['corner-m'],
|
|
86
|
+
...theme.shadows['surface-shadow-soft'],
|
|
87
|
+
}}>
|
|
88
|
+
<Text style={{ ...theme.type['body-m-regular'], color: theme.colors['core-text-primary'] }}>
|
|
89
|
+
Hello Slice
|
|
90
|
+
</Text>
|
|
91
|
+
</View>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
`lightTheme`, `darkTheme`, `createTypography`, and the `SliceNativeTheme` type are
|
|
97
|
+
also available from the package root. `SliceTheme` aliases the native theme type.
|
|
98
|
+
The dedicated `/theme` entry has no runtime React Native, React, or SVG imports.
|
|
99
|
+
It also exports `coreColors`, `corners`, `spacing`, `elevations`, `type`, and `motion`.
|
|
100
|
+
|
|
101
|
+
Colors, spacing, corners, and stacking levels are sourced from the web tokens at
|
|
102
|
+
build time and bundled into this package. No web package is needed in an app.
|
|
103
|
+
CSS shadow strings are removed from `colors` and `coreColors`; use `theme.shadows`
|
|
104
|
+
instead. Shadows use native `boxShadow` arrays, which require the New Architecture
|
|
105
|
+
and supported Android versions (outset shadows require Android 9+).
|
|
106
|
+
|
|
107
|
+
Typography uses a fixed 16dp base for rem conversion and numeric line heights and
|
|
108
|
+
letter spacing. Load Funnel Sans in your app, or replace `theme.type` with
|
|
109
|
+
`createTypography('YourLoadedFontName')`. Exact font weights depend on the font
|
|
110
|
+
and platform; test your loaded font on devices. This package does not load fonts.
|
|
111
|
+
|
|
112
|
+
Motion durations are milliseconds. Curve tokens are easing functions suitable for
|
|
113
|
+
`Animated.timing`'s `easing` option; the CSS spring is interpolated from its original
|
|
114
|
+
samples, preserving overshoot. They are ordinary JavaScript functions, not Reanimated
|
|
115
|
+
worklets. `elevations` retains the web stacking levels for `zIndex`; do not pass these
|
|
116
|
+
values to Android's `elevation` property.
|
|
117
|
+
|
|
118
|
+
Build from the repository so shared source tokens are available. All generated
|
|
119
|
+
JavaScript and declarations are included under `dist/`, including declarations for
|
|
120
|
+
shared source types. Changes to web tokens are picked up by the next native build.
|
package/dist/cjs/index.js
CHANGED
|
@@ -4,6 +4,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var reactNative = require('react-native');
|
|
6
6
|
var Svg = require('react-native-svg');
|
|
7
|
+
var theme = require('./theme.js');
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Static icon registry created once at module load.
|
|
@@ -805,6 +806,9 @@ const SliceIcons = {
|
|
|
805
806
|
},
|
|
806
807
|
};
|
|
807
808
|
|
|
809
|
+
exports.createTypography = theme.createTypography;
|
|
810
|
+
exports.darkTheme = theme.darkTheme;
|
|
811
|
+
exports.lightTheme = theme.lightTheme;
|
|
808
812
|
exports.Icon = NativeIcon;
|
|
809
813
|
exports.NativeIcon = NativeIcon;
|
|
810
814
|
exports.SliceIcons = SliceIcons;
|
|
@@ -0,0 +1,595 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const coreColors$1 = {
|
|
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$1['brand-land-100'],
|
|
114
|
+
'array-land-label': coreColors$1['brand-land-600'],
|
|
115
|
+
'array-magenta': coreColors$1['brand-magenta-100'],
|
|
116
|
+
'array-magenta-label': coreColors$1['brand-magenta-600'],
|
|
117
|
+
'array-orange': coreColors$1['brand-orange-100'],
|
|
118
|
+
'array-orange-label': coreColors$1['brand-orange-600'],
|
|
119
|
+
'array-purple': coreColors$1['brand-purple-100'],
|
|
120
|
+
'array-purple-label': coreColors$1['brand-purple-600'],
|
|
121
|
+
'array-sea': coreColors$1['brand-sea-100'],
|
|
122
|
+
'array-sea-label': coreColors$1['brand-sea-600'],
|
|
123
|
+
'array-sky': coreColors$1['brand-sky-100'],
|
|
124
|
+
'array-sky-label': coreColors$1['brand-sky-600'],
|
|
125
|
+
'array-yellow': coreColors$1['brand-yellow-100'],
|
|
126
|
+
'array-yellow-label': coreColors$1['brand-yellow-600'],
|
|
127
|
+
'core-badge-primary': coreColors$1['brand-sea-500'],
|
|
128
|
+
'core-badge-secondary': coreColors$1['brand-grey-100'],
|
|
129
|
+
'core-button-disabled': coreColors$1['brand-grey-50'],
|
|
130
|
+
'core-button-primary': coreColors$1['brand-sea-500'],
|
|
131
|
+
'core-drop-shadow': coreColors$1['core-drop-shadow-light'],
|
|
132
|
+
'core-gp-logo-primary': coreColors$1['brand-sea-700'],
|
|
133
|
+
'core-gp-logo-secondary': coreColors$1['brand-grey-950'],
|
|
134
|
+
'core-icon-dark': coreColors$1['brand-grey-950'],
|
|
135
|
+
'core-icon-disabled': coreColors$1['brand-grey-300'],
|
|
136
|
+
'core-icon-error': coreColors$1['product-red-500'],
|
|
137
|
+
'core-icon-light': coreColors$1['brand-white-0'],
|
|
138
|
+
'core-icon-primary': coreColors$1['brand-grey-950'],
|
|
139
|
+
'core-icon-secondary': coreColors$1['brand-grey-700'],
|
|
140
|
+
'core-icon-tertiary': coreColors$1['brand-sea-500'],
|
|
141
|
+
'core-outline-secondary': coreColors$1['brand-grey-100'],
|
|
142
|
+
'core-outline-primary': coreColors$1['brand-grey-100'],
|
|
143
|
+
'core-outline-special': coreColors$1['brand-sea-100'],
|
|
144
|
+
'core-outline-tertiary': coreColors$1['brand-sea-500'],
|
|
145
|
+
'core-surface-coverup-translucent': coreColors$1['core-surface-coverup-translucent-light'],
|
|
146
|
+
'core-surface-overlay-translucent': coreColors$1['core-surface-overlay-translucent-light'],
|
|
147
|
+
'core-surface-primary': coreColors$1['brand-white-0'],
|
|
148
|
+
'core-surface-primary-tint': coreColors$1['surface-primary-tint-light'],
|
|
149
|
+
'core-surface-secondary': coreColors$1['brand-grey-50'],
|
|
150
|
+
'core-surface-special': coreColors$1['brand-sea-50'],
|
|
151
|
+
'core-text-dark': coreColors$1['brand-grey-950'],
|
|
152
|
+
'core-text-disabled': coreColors$1['brand-grey-300'],
|
|
153
|
+
'core-text-error': coreColors$1['product-red-500'],
|
|
154
|
+
'core-text-light': coreColors$1['brand-white-0'],
|
|
155
|
+
'core-text-primary': coreColors$1['brand-grey-950'],
|
|
156
|
+
'core-text-secondary': coreColors$1['brand-grey-700'],
|
|
157
|
+
'core-text-tertiary': coreColors$1['brand-grey-600'],
|
|
158
|
+
'core-text-special': coreColors$1['brand-sea-500'],
|
|
159
|
+
'core-text-accent': coreColors$1['brand-sky-500'],
|
|
160
|
+
'core-link-primary': coreColors$1['brand-sea-500'],
|
|
161
|
+
'eor-tag-employee': coreColors$1['brand-sky-700'],
|
|
162
|
+
'eor-tag-overdue': coreColors$1['product-red-500'],
|
|
163
|
+
'eor-tag-paid': coreColors$1['brand-land-700'],
|
|
164
|
+
'eor-tag-pending': coreColors$1['brand-orange-500'],
|
|
165
|
+
'eor-tag-professional': coreColors$1['brand-sea-500'],
|
|
166
|
+
'feedback-attention': coreColors$1['brand-yellow-500'],
|
|
167
|
+
'feedback-informative': coreColors$1['brand-sky-700'],
|
|
168
|
+
'feedback-positive': coreColors$1['brand-land-700'],
|
|
169
|
+
'feedback-urgency': coreColors$1['brand-orange-500'],
|
|
170
|
+
'feedback-warning': coreColors$1['product-red-500'],
|
|
171
|
+
'gia-tag-risk-high': coreColors$1['product-red-500'],
|
|
172
|
+
'gia-tag-risk-low': coreColors$1['brand-sky-700'],
|
|
173
|
+
'gia-tag-risk-moderate': coreColors$1['brand-orange-500'],
|
|
174
|
+
'gia-text-excerpt-highlight': coreColors$1['brand-orange-100'],
|
|
175
|
+
'gia-text-selection': coreColors$1['brand-sea-100'],
|
|
176
|
+
'scroll-bar': coreColors$1['scroll-bar-light'],
|
|
177
|
+
'scroll-bar-hover': coreColors$1['scroll-bar-hover-light'],
|
|
178
|
+
'surface-shadow-soft': coreColors$1['surface-shadow-soft-light'],
|
|
179
|
+
'surface-shadow-strong': coreColors$1['surface-shadow-strong-light'],
|
|
180
|
+
};
|
|
181
|
+
const dark = {
|
|
182
|
+
'array-land': coreColors$1['brand-land-100'],
|
|
183
|
+
'array-land-label': coreColors$1['brand-land-600'],
|
|
184
|
+
'array-magenta': coreColors$1['brand-magenta-100'],
|
|
185
|
+
'array-magenta-label': coreColors$1['brand-magenta-600'],
|
|
186
|
+
'array-orange': coreColors$1['brand-orange-100'],
|
|
187
|
+
'array-orange-label': coreColors$1['brand-orange-600'],
|
|
188
|
+
'array-purple': coreColors$1['brand-purple-100'],
|
|
189
|
+
'array-purple-label': coreColors$1['brand-purple-600'],
|
|
190
|
+
'array-sea': coreColors$1['brand-sea-100'],
|
|
191
|
+
'array-sea-label': coreColors$1['brand-sea-600'],
|
|
192
|
+
'array-sky': coreColors$1['brand-sky-100'],
|
|
193
|
+
'array-sky-label': coreColors$1['brand-sky-600'],
|
|
194
|
+
'array-yellow': coreColors$1['brand-yellow-100'],
|
|
195
|
+
'array-yellow-label': coreColors$1['brand-yellow-600'],
|
|
196
|
+
'core-badge-primary': coreColors$1['brand-sea-500'],
|
|
197
|
+
'core-badge-secondary': coreColors$1['brand-grey-700'],
|
|
198
|
+
'core-button-disabled': coreColors$1['brand-grey-900'],
|
|
199
|
+
'core-button-primary': coreColors$1['brand-sea-500'],
|
|
200
|
+
'core-drop-shadow': coreColors$1['core-drop-shadow-dark'],
|
|
201
|
+
'core-gp-logo-primary': coreColors$1['brand-sea-500'],
|
|
202
|
+
'core-gp-logo-secondary': coreColors$1['brand-white-0'],
|
|
203
|
+
'core-icon-dark': coreColors$1['brand-grey-950'],
|
|
204
|
+
'core-icon-disabled': coreColors$1['brand-grey-500'],
|
|
205
|
+
'core-icon-error': coreColors$1['product-red-400'],
|
|
206
|
+
'core-icon-light': coreColors$1['brand-white-0'],
|
|
207
|
+
'core-icon-primary': coreColors$1['brand-white-0'],
|
|
208
|
+
'core-icon-secondary': coreColors$1['brand-grey-200'],
|
|
209
|
+
'core-icon-tertiary': coreColors$1['brand-sky-300'],
|
|
210
|
+
'core-outline-secondary': coreColors$1['brand-grey-900'],
|
|
211
|
+
'core-outline-primary': coreColors$1['brand-grey-700'],
|
|
212
|
+
'core-outline-special': coreColors$1['brand-sky-900'],
|
|
213
|
+
'core-outline-tertiary': coreColors$1['brand-sky-300'],
|
|
214
|
+
'core-surface-coverup-translucent': coreColors$1['core-surface-coverup-translucent-dark'],
|
|
215
|
+
'core-surface-overlay-translucent': coreColors$1['core-surface-overlay-translucent-dark'],
|
|
216
|
+
'core-surface-primary': coreColors$1['brand-grey-950'],
|
|
217
|
+
'core-surface-primary-tint': coreColors$1['surface-primary-tint-dark'],
|
|
218
|
+
'core-surface-secondary': coreColors$1['brand-grey-900'],
|
|
219
|
+
'core-surface-special': coreColors$1['brand-sky-950'],
|
|
220
|
+
'core-text-dark': coreColors$1['brand-grey-950'],
|
|
221
|
+
'core-text-disabled': coreColors$1['brand-grey-500'],
|
|
222
|
+
'core-text-error': coreColors$1['product-red-400'],
|
|
223
|
+
'core-text-light': coreColors$1['brand-white-0'],
|
|
224
|
+
'core-text-primary': coreColors$1['brand-white-0'],
|
|
225
|
+
'core-text-secondary': coreColors$1['brand-grey-200'],
|
|
226
|
+
'core-text-tertiary': coreColors$1['brand-grey-400'],
|
|
227
|
+
'core-text-special': coreColors$1['brand-sky-300'],
|
|
228
|
+
'core-text-accent': coreColors$1['brand-sky-300'],
|
|
229
|
+
'core-link-primary': coreColors$1['brand-sky-300'],
|
|
230
|
+
'eor-tag-employee': coreColors$1['brand-sky-700'],
|
|
231
|
+
'eor-tag-overdue': coreColors$1['product-red-400'],
|
|
232
|
+
'eor-tag-paid': coreColors$1['brand-land-700'],
|
|
233
|
+
'eor-tag-pending': coreColors$1['brand-orange-500'],
|
|
234
|
+
'eor-tag-professional': coreColors$1['brand-sea-500'],
|
|
235
|
+
'feedback-attention': coreColors$1['brand-yellow-400'],
|
|
236
|
+
'feedback-informative': coreColors$1['brand-sky-600'],
|
|
237
|
+
'feedback-positive': coreColors$1['brand-land-700'],
|
|
238
|
+
'feedback-urgency': coreColors$1['brand-orange-500'],
|
|
239
|
+
'feedback-warning': coreColors$1['product-red-400'],
|
|
240
|
+
'gia-tag-risk-high': coreColors$1['product-red-400'],
|
|
241
|
+
'gia-tag-risk-low': coreColors$1['brand-sky-600'],
|
|
242
|
+
'gia-tag-risk-moderate': coreColors$1['brand-orange-500'],
|
|
243
|
+
'gia-text-excerpt-highlight': coreColors$1['brand-orange-100'],
|
|
244
|
+
'gia-text-selection': coreColors$1['brand-sea-900'],
|
|
245
|
+
'scroll-bar': coreColors$1['scroll-bar-dark'],
|
|
246
|
+
'scroll-bar-hover': coreColors$1['scroll-bar-hover-dark'],
|
|
247
|
+
'surface-shadow-soft': coreColors$1['surface-shadow-soft-dark'],
|
|
248
|
+
'surface-shadow-strong': coreColors$1['surface-shadow-strong-dark'],
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
const corners = {
|
|
252
|
+
'corner-none': 0,
|
|
253
|
+
'corner-xs': 4,
|
|
254
|
+
'corner-s': 6,
|
|
255
|
+
'corner-m': 8,
|
|
256
|
+
'corner-l': 12,
|
|
257
|
+
'corner-xl': 16,
|
|
258
|
+
'corner-xxl': 32,
|
|
259
|
+
'corner-round': 1000,
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Elevation levels for UI component types
|
|
264
|
+
*/
|
|
265
|
+
const elevations = {
|
|
266
|
+
'elevation-below-surface': -100, // items hidden from view
|
|
267
|
+
'elevation-surface': 0, // default
|
|
268
|
+
'elevation-float': 100, // toolbars, fab buttons, etc.
|
|
269
|
+
'elevation-describe': 200, // tooltips, info, etc.
|
|
270
|
+
'elevation-status': 300, // status bars, toasts, etc.
|
|
271
|
+
'elevation-notify': 400, // alerts, and other critical status, etc.
|
|
272
|
+
'elevation-overlay': 500, // overlay covers, etc.
|
|
273
|
+
'elevation-confirm': 600, // conformation dialogs, etc. requiring action to dismiss
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Motion for Slice UI
|
|
278
|
+
*/
|
|
279
|
+
const motion$1 = {
|
|
280
|
+
'motion-magnet': 'cubic-bezier(0.352, 0.003, 0.993, -0.052)',
|
|
281
|
+
'motion-water': 'cubic-bezier(0.36, 0, 0.64, 1)',
|
|
282
|
+
'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)',
|
|
283
|
+
'motion-magnet-duration': '0.5s',
|
|
284
|
+
'motion-water-duration': '0.25s',
|
|
285
|
+
'motion-spring-duration': '1s',
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
const spacing = {
|
|
289
|
+
xxs: 2,
|
|
290
|
+
xs: 4,
|
|
291
|
+
s: 8,
|
|
292
|
+
m: 16,
|
|
293
|
+
l: 24,
|
|
294
|
+
xl: 32,
|
|
295
|
+
xxl: 64,
|
|
296
|
+
h: 128,
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
// base family
|
|
300
|
+
const fontFamily = `var(--slice-font-family, "Funnel Sans")`;
|
|
301
|
+
// base weights
|
|
302
|
+
const fontWeights = {
|
|
303
|
+
regular: 360,
|
|
304
|
+
medium: 420,
|
|
305
|
+
bold: 500,
|
|
306
|
+
extra: 560,
|
|
307
|
+
};
|
|
308
|
+
// base sizes
|
|
309
|
+
const fontSizes = {
|
|
310
|
+
xs: '0.75rem',
|
|
311
|
+
s: '0.875rem',
|
|
312
|
+
m: '0.9375rem',
|
|
313
|
+
l: '1rem',
|
|
314
|
+
xl: '1.0625rem',
|
|
315
|
+
h1: '4.25rem',
|
|
316
|
+
h2: '3.5rem',
|
|
317
|
+
h3: '2.75rem',
|
|
318
|
+
h4: '2rem',
|
|
319
|
+
h5: '1.5rem',
|
|
320
|
+
h6: '1.0625rem',
|
|
321
|
+
};
|
|
322
|
+
// base line heights
|
|
323
|
+
const lineHeights = {
|
|
324
|
+
xs: '116.67%',
|
|
325
|
+
m: '133.33%',
|
|
326
|
+
l: '140%',
|
|
327
|
+
xl: '142.86%',
|
|
328
|
+
xxl: '162.5%',
|
|
329
|
+
};
|
|
330
|
+
// base letter spacing
|
|
331
|
+
const letterSpacings = {
|
|
332
|
+
xs: '0.00625em',
|
|
333
|
+
s: '0.009375em',
|
|
334
|
+
m: '0.0125em',
|
|
335
|
+
l: '0.015625em',
|
|
336
|
+
};
|
|
337
|
+
// ** new styles aligned to lyra */
|
|
338
|
+
const type$1 = {
|
|
339
|
+
'body-xs-regular': `
|
|
340
|
+
font-family: ${fontFamily};
|
|
341
|
+
font-weight: ${fontWeights.regular};
|
|
342
|
+
font-size: ${fontSizes.xs};
|
|
343
|
+
line-height: ${lineHeights.m};
|
|
344
|
+
text-decoration: none;
|
|
345
|
+
letter-spacing: ${letterSpacings.m}`,
|
|
346
|
+
'body-xs-medium': `
|
|
347
|
+
font-family: ${fontFamily};
|
|
348
|
+
font-weight: ${fontWeights.medium};
|
|
349
|
+
font-size: ${fontSizes.xs};
|
|
350
|
+
line-height: ${lineHeights.m};
|
|
351
|
+
text-decoration: none;
|
|
352
|
+
letter-spacing: ${letterSpacings.m}`,
|
|
353
|
+
'body-xs-bold': `
|
|
354
|
+
font-family: ${fontFamily};
|
|
355
|
+
font-weight: ${fontWeights.bold};
|
|
356
|
+
font-size: ${fontSizes.xs};
|
|
357
|
+
line-height: ${lineHeights.m};
|
|
358
|
+
text-decoration: none;
|
|
359
|
+
letter-spacing: ${letterSpacings.l}`,
|
|
360
|
+
'body-s-regular': `
|
|
361
|
+
font-family: ${fontFamily};
|
|
362
|
+
font-weight: ${fontWeights.regular};
|
|
363
|
+
font-size: ${fontSizes.s};
|
|
364
|
+
line-height: ${lineHeights.xl};
|
|
365
|
+
text-decoration: none;
|
|
366
|
+
letter-spacing: ${letterSpacings.s}`,
|
|
367
|
+
'body-s-medium': `
|
|
368
|
+
font-family: ${fontFamily};
|
|
369
|
+
font-weight: ${fontWeights.medium};
|
|
370
|
+
font-size: ${fontSizes.s};
|
|
371
|
+
line-height: ${lineHeights.xl};
|
|
372
|
+
text-decoration: none;
|
|
373
|
+
letter-spacing: ${letterSpacings.s}`,
|
|
374
|
+
'body-s-bold': `
|
|
375
|
+
font-family: ${fontFamily};
|
|
376
|
+
font-weight: ${fontWeights.bold};
|
|
377
|
+
font-size: ${fontSizes.s};
|
|
378
|
+
line-height: ${lineHeights.xl};
|
|
379
|
+
text-decoration: none;
|
|
380
|
+
letter-spacing: ${letterSpacings.m}`,
|
|
381
|
+
'body-m-regular': `
|
|
382
|
+
font-family: ${fontFamily};
|
|
383
|
+
font-weight: ${fontWeights.regular};
|
|
384
|
+
font-size: ${fontSizes.m};
|
|
385
|
+
line-height: ${lineHeights.l};
|
|
386
|
+
text-decoration: none;
|
|
387
|
+
letter-spacing: ${letterSpacings.s}`,
|
|
388
|
+
'body-m-medium': `
|
|
389
|
+
font-family: ${fontFamily};
|
|
390
|
+
font-weight: ${fontWeights.medium};
|
|
391
|
+
font-size: ${fontSizes.m};
|
|
392
|
+
line-height: ${lineHeights.l};
|
|
393
|
+
text-decoration: none;
|
|
394
|
+
letter-spacing: ${letterSpacings.s}`,
|
|
395
|
+
'body-m-bold': `
|
|
396
|
+
font-family: ${fontFamily};
|
|
397
|
+
font-weight: ${fontWeights.bold};
|
|
398
|
+
font-size: ${fontSizes.m};
|
|
399
|
+
line-height: ${lineHeights.l};
|
|
400
|
+
text-decoration: none;
|
|
401
|
+
letter-spacing: ${letterSpacings.m}`,
|
|
402
|
+
'body-l-regular': `
|
|
403
|
+
font-family: ${fontFamily};
|
|
404
|
+
font-weight: ${fontWeights.regular};
|
|
405
|
+
font-size: ${fontSizes.l};
|
|
406
|
+
line-height: ${lineHeights.xxl};
|
|
407
|
+
text-decoration: none;
|
|
408
|
+
letter-spacing: ${letterSpacings.xs}`,
|
|
409
|
+
'body-l-medium': `
|
|
410
|
+
font-family: ${fontFamily};
|
|
411
|
+
font-weight: ${fontWeights.medium};
|
|
412
|
+
font-size: ${fontSizes.l};
|
|
413
|
+
line-height: ${lineHeights.xxl};
|
|
414
|
+
text-decoration: none;
|
|
415
|
+
letter-spacing: ${letterSpacings.xs}`,
|
|
416
|
+
'body-l-bold': `
|
|
417
|
+
font-family: ${fontFamily};
|
|
418
|
+
font-weight: ${fontWeights.bold};
|
|
419
|
+
font-size: ${fontSizes.l};
|
|
420
|
+
line-height: ${lineHeights.xxl};
|
|
421
|
+
text-decoration: none;
|
|
422
|
+
letter-spacing: ${letterSpacings.s}`,
|
|
423
|
+
'body-xl-regular': `
|
|
424
|
+
font-family: ${fontFamily};
|
|
425
|
+
font-weight: ${fontWeights.regular};
|
|
426
|
+
font-size: ${fontSizes.xl};
|
|
427
|
+
line-height: ${lineHeights.xxl};
|
|
428
|
+
text-decoration: none;
|
|
429
|
+
letter-spacing: ${letterSpacings.xs}`,
|
|
430
|
+
'body-xl-medium': `
|
|
431
|
+
font-family: ${fontFamily};
|
|
432
|
+
font-weight: ${fontWeights.medium};
|
|
433
|
+
font-size: ${fontSizes.xl};
|
|
434
|
+
line-height: ${lineHeights.xxl};
|
|
435
|
+
text-decoration: none;
|
|
436
|
+
letter-spacing: ${letterSpacings.xs}`,
|
|
437
|
+
'body-xl-bold': `
|
|
438
|
+
font-family: ${fontFamily};
|
|
439
|
+
font-weight: ${fontWeights.bold};
|
|
440
|
+
font-size: ${fontSizes.xl};
|
|
441
|
+
line-height: ${lineHeights.xxl};
|
|
442
|
+
text-decoration: none;
|
|
443
|
+
letter-spacing: ${letterSpacings.s}`,
|
|
444
|
+
h1: `
|
|
445
|
+
font-family: ${fontFamily};
|
|
446
|
+
font-weight: ${fontWeights.extra};
|
|
447
|
+
font-size: ${fontSizes.h1};
|
|
448
|
+
line-height: ${lineHeights.xs};
|
|
449
|
+
letter-spacing: ${letterSpacings.m}`,
|
|
450
|
+
h2: `
|
|
451
|
+
font-family: ${fontFamily};
|
|
452
|
+
font-weight: ${fontWeights.extra};
|
|
453
|
+
font-size: ${fontSizes.h2};
|
|
454
|
+
line-height: ${lineHeights.xs};
|
|
455
|
+
letter-spacing: ${letterSpacings.m}`,
|
|
456
|
+
h3: `
|
|
457
|
+
font-family: ${fontFamily};
|
|
458
|
+
font-weight: ${fontWeights.extra};
|
|
459
|
+
font-size: ${fontSizes.h3};
|
|
460
|
+
line-height: ${lineHeights.xs};
|
|
461
|
+
letter-spacing: ${letterSpacings.m}`,
|
|
462
|
+
h4: `
|
|
463
|
+
font-family: ${fontFamily};
|
|
464
|
+
font-weight: ${fontWeights.extra};
|
|
465
|
+
font-size: ${fontSizes.h4};
|
|
466
|
+
line-height: ${lineHeights.xs};
|
|
467
|
+
letter-spacing: ${letterSpacings.m}`,
|
|
468
|
+
h5: `
|
|
469
|
+
font-family: ${fontFamily};
|
|
470
|
+
font-weight: ${fontWeights.extra};
|
|
471
|
+
font-size: ${fontSizes.h5};
|
|
472
|
+
line-height: ${lineHeights.xs};
|
|
473
|
+
letter-spacing: ${letterSpacings.m}`,
|
|
474
|
+
h6: `
|
|
475
|
+
font-family: ${fontFamily};
|
|
476
|
+
font-weight: ${fontWeights.extra};
|
|
477
|
+
font-size: ${fontSizes.h6};
|
|
478
|
+
line-height: ${lineHeights.xs};
|
|
479
|
+
letter-spacing: ${letterSpacings.m}`,
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
/** Convert Slice's explicit CSS curves without importing the React Native runtime. */
|
|
483
|
+
function easing(css) {
|
|
484
|
+
if (css.startsWith('cubic-bezier(')) {
|
|
485
|
+
const [x1, y1, x2, y2] = css.slice(13, -1).split(',').map(Number);
|
|
486
|
+
const sample = (t, a, b) => 3 * (1 - t) ** 2 * t * a + 3 * (1 - t) * t ** 2 * b + t ** 3;
|
|
487
|
+
return (progress) => {
|
|
488
|
+
if (progress <= 0)
|
|
489
|
+
return 0;
|
|
490
|
+
if (progress >= 1)
|
|
491
|
+
return 1;
|
|
492
|
+
let low = 0;
|
|
493
|
+
let high = 1;
|
|
494
|
+
for (let i = 0; i < 30; i++) {
|
|
495
|
+
const middle = (low + high) / 2;
|
|
496
|
+
if (sample(middle, x1, x2) < progress)
|
|
497
|
+
low = middle;
|
|
498
|
+
else
|
|
499
|
+
high = middle;
|
|
500
|
+
}
|
|
501
|
+
return sample((low + high) / 2, y1, y2);
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
if (!css.startsWith('linear('))
|
|
505
|
+
throw new Error(`Unsupported Slice easing: ${css}`);
|
|
506
|
+
const points = css
|
|
507
|
+
.slice(7, -1)
|
|
508
|
+
.split(',')
|
|
509
|
+
.map((entry, index, entries) => {
|
|
510
|
+
const [value, percent] = entry.trim().split(/\s+/).map(Number.parseFloat);
|
|
511
|
+
return { value, position: percent === undefined ? index / (entries.length - 1) : percent / 100 };
|
|
512
|
+
});
|
|
513
|
+
return (progress) => {
|
|
514
|
+
if (progress <= 0)
|
|
515
|
+
return points[0].value;
|
|
516
|
+
for (let i = 1; i < points.length; i++) {
|
|
517
|
+
const left = points[i - 1];
|
|
518
|
+
const right = points[i];
|
|
519
|
+
if (progress <= right.position)
|
|
520
|
+
return (left.value + ((right.value - left.value) * (progress - left.position)) / (right.position - left.position));
|
|
521
|
+
}
|
|
522
|
+
return points[points.length - 1].value;
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
const { 'surface-shadow-soft-light': _sl, 'surface-shadow-soft-dark': _sd, 'surface-shadow-strong-light': _hl, 'surface-shadow-strong-dark': _hd, ...palette } = coreColors$1;
|
|
527
|
+
const coreColors = palette;
|
|
528
|
+
/** Uses a 16dp base for the web rem scale. Load this font in the consuming app. */
|
|
529
|
+
function createTypography(fontFamily = 'Funnel Sans') {
|
|
530
|
+
return Object.fromEntries(Object.entries(type$1).map(([key, css]) => {
|
|
531
|
+
const read = (property) => {
|
|
532
|
+
const value = css.match(new RegExp(`(?:^|;)\\s*${property}:\\s*([^;]+)`))?.[1];
|
|
533
|
+
if (!value)
|
|
534
|
+
throw new Error(`Missing typography property: ${property}`);
|
|
535
|
+
return Number.parseFloat(value);
|
|
536
|
+
};
|
|
537
|
+
const fontSize = read('font-size') * 16;
|
|
538
|
+
return [
|
|
539
|
+
key,
|
|
540
|
+
{
|
|
541
|
+
fontFamily,
|
|
542
|
+
fontSize,
|
|
543
|
+
fontWeight: read('font-weight'),
|
|
544
|
+
lineHeight: (fontSize * read('line-height')) / 100,
|
|
545
|
+
letterSpacing: fontSize * read('letter-spacing'),
|
|
546
|
+
textDecorationLine: 'none',
|
|
547
|
+
},
|
|
548
|
+
];
|
|
549
|
+
}));
|
|
550
|
+
}
|
|
551
|
+
const type = createTypography();
|
|
552
|
+
const motion = {
|
|
553
|
+
'motion-magnet': easing(motion$1['motion-magnet']),
|
|
554
|
+
'motion-water': easing(motion$1['motion-water']),
|
|
555
|
+
'motion-spring': easing(motion$1['motion-spring']),
|
|
556
|
+
'motion-magnet-duration': Number.parseFloat(motion$1['motion-magnet-duration']) * 1000,
|
|
557
|
+
'motion-water-duration': Number.parseFloat(motion$1['motion-water-duration']) * 1000,
|
|
558
|
+
'motion-spring-duration': Number.parseFloat(motion$1['motion-spring-duration']) * 1000,
|
|
559
|
+
};
|
|
560
|
+
function shadow(value) {
|
|
561
|
+
const match = value.match(/^([\d.]+)px ([\d.]+)px ([\d.]+)px (.+)$/);
|
|
562
|
+
if (!match)
|
|
563
|
+
throw new Error(`Unsupported Slice shadow: ${value}`);
|
|
564
|
+
return {
|
|
565
|
+
boxShadow: [
|
|
566
|
+
{ offsetX: Number(match[1]), offsetY: Number(match[2]), blurRadius: Number(match[3]), color: match[4] },
|
|
567
|
+
],
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
function createTheme(name, palette) {
|
|
571
|
+
const { 'surface-shadow-soft': soft, 'surface-shadow-strong': strong, ...colors } = palette;
|
|
572
|
+
return {
|
|
573
|
+
name,
|
|
574
|
+
coreColors,
|
|
575
|
+
colors,
|
|
576
|
+
corners,
|
|
577
|
+
spacing,
|
|
578
|
+
elevations,
|
|
579
|
+
type,
|
|
580
|
+
motion,
|
|
581
|
+
shadows: { 'surface-shadow-soft': shadow(soft), 'surface-shadow-strong': shadow(strong) },
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
const lightTheme = createTheme('lightMode', light);
|
|
585
|
+
const darkTheme = createTheme('darkMode', dark);
|
|
586
|
+
|
|
587
|
+
exports.coreColors = coreColors;
|
|
588
|
+
exports.corners = corners;
|
|
589
|
+
exports.createTypography = createTypography;
|
|
590
|
+
exports.darkTheme = darkTheme;
|
|
591
|
+
exports.elevations = elevations;
|
|
592
|
+
exports.lightTheme = lightTheme;
|
|
593
|
+
exports.motion = motion;
|
|
594
|
+
exports.spacing = spacing;
|
|
595
|
+
exports.type = type;
|