@storybook/react-native-theming 8.0.0-alpha.2 → 8.0.0-alpha.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/dist/index.d.ts +116 -5
- package/dist/index.js +359 -27
- package/package.json +7 -5
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,98 @@ import * as RN from 'react-native';
|
|
|
2
2
|
import { TextStyle, ShadowStyleIOS, ViewStyle } from 'react-native';
|
|
3
3
|
import * as React$1 from 'react';
|
|
4
4
|
|
|
5
|
+
declare const color: {
|
|
6
|
+
primary: string;
|
|
7
|
+
secondary: string;
|
|
8
|
+
secondaryLighter: string;
|
|
9
|
+
tertiary: string;
|
|
10
|
+
ancillary: string;
|
|
11
|
+
orange: string;
|
|
12
|
+
gold: string;
|
|
13
|
+
green: string;
|
|
14
|
+
seafoam: string;
|
|
15
|
+
purple: string;
|
|
16
|
+
ultraviolet: string;
|
|
17
|
+
lightest: string;
|
|
18
|
+
lighter: string;
|
|
19
|
+
light: string;
|
|
20
|
+
mediumlight: string;
|
|
21
|
+
medium: string;
|
|
22
|
+
mediumdark: string;
|
|
23
|
+
dark: string;
|
|
24
|
+
darker: string;
|
|
25
|
+
darkest: string;
|
|
26
|
+
border: string;
|
|
27
|
+
positive: string;
|
|
28
|
+
negative: string;
|
|
29
|
+
warning: string;
|
|
30
|
+
critical: string;
|
|
31
|
+
defaultText: string;
|
|
32
|
+
inverseText: string;
|
|
33
|
+
positiveText: string;
|
|
34
|
+
negativeText: string;
|
|
35
|
+
warningText: string;
|
|
36
|
+
};
|
|
37
|
+
declare const background: {
|
|
38
|
+
app: string;
|
|
39
|
+
bar: string;
|
|
40
|
+
content: string;
|
|
41
|
+
preview: string;
|
|
42
|
+
gridCellSize: number;
|
|
43
|
+
hoverable: string;
|
|
44
|
+
positive: string;
|
|
45
|
+
negative: string;
|
|
46
|
+
warning: string;
|
|
47
|
+
critical: string;
|
|
48
|
+
};
|
|
49
|
+
declare const typography: {
|
|
50
|
+
weight: {
|
|
51
|
+
regular: "400" | "normal" | "bold" | "100" | "200" | "300" | "500" | "600" | "700" | "800" | "900";
|
|
52
|
+
bold: "400" | "normal" | "bold" | "100" | "200" | "300" | "500" | "600" | "700" | "800" | "900";
|
|
53
|
+
};
|
|
54
|
+
size: {
|
|
55
|
+
s1: number;
|
|
56
|
+
s2: number;
|
|
57
|
+
s3: number;
|
|
58
|
+
m1: number;
|
|
59
|
+
m2: number;
|
|
60
|
+
m3: number;
|
|
61
|
+
l1: number;
|
|
62
|
+
l2: number;
|
|
63
|
+
l3: number;
|
|
64
|
+
code: number;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
type Color = typeof color;
|
|
68
|
+
type Background = typeof background;
|
|
69
|
+
type Typography = typeof typography;
|
|
70
|
+
interface Brand {
|
|
71
|
+
title: string | undefined;
|
|
72
|
+
url: string | null | undefined;
|
|
73
|
+
image: string | null | undefined;
|
|
74
|
+
target: string | null | undefined;
|
|
75
|
+
}
|
|
76
|
+
interface StorybookThemeWeb {
|
|
77
|
+
color: Color;
|
|
78
|
+
background: Background;
|
|
79
|
+
typography: Typography;
|
|
80
|
+
input: {
|
|
81
|
+
border: string;
|
|
82
|
+
background: string;
|
|
83
|
+
color: string;
|
|
84
|
+
borderRadius: number;
|
|
85
|
+
};
|
|
86
|
+
layoutMargin: number;
|
|
87
|
+
appBorderColor: string;
|
|
88
|
+
appBorderRadius: number;
|
|
89
|
+
barTextColor: string;
|
|
90
|
+
barHoverColor: string;
|
|
91
|
+
barSelectedColor: string;
|
|
92
|
+
barBg: string;
|
|
93
|
+
brand: Brand;
|
|
94
|
+
[key: string]: any;
|
|
95
|
+
}
|
|
96
|
+
|
|
5
97
|
type ShadowStyle = ShadowStyleIOS | Pick<ViewStyle, 'elevation'>;
|
|
6
98
|
type FontWeight = TextStyle['fontWeight'];
|
|
7
99
|
/**
|
|
@@ -58,7 +150,7 @@ interface ThemeButton {
|
|
|
58
150
|
borderWidth: number;
|
|
59
151
|
borderRadius: number;
|
|
60
152
|
}
|
|
61
|
-
interface StorybookTheme {
|
|
153
|
+
interface StorybookTheme extends StorybookThemeWeb {
|
|
62
154
|
tokens: ThemeTokens;
|
|
63
155
|
backgroundColor: string;
|
|
64
156
|
text: {
|
|
@@ -190,6 +282,19 @@ interface StorybookTheme {
|
|
|
190
282
|
declare const theme: StorybookTheme;
|
|
191
283
|
declare const darkTheme: StorybookTheme;
|
|
192
284
|
|
|
285
|
+
/**
|
|
286
|
+
* @desc Utility type for getting props type of React component.
|
|
287
|
+
* It takes `defaultProps` into an account - making props with defaults optional.
|
|
288
|
+
*/
|
|
289
|
+
type PropsOf<
|
|
290
|
+
C extends keyof JSX.IntrinsicElements | React$1.JSXElementConstructor<any>
|
|
291
|
+
> = JSX.LibraryManagedAttributes<C, React$1.ComponentProps<C>>
|
|
292
|
+
|
|
293
|
+
// We need to use this version of Omit as it's distributive (Will preserve unions)
|
|
294
|
+
type DistributiveOmit<T, U> = T extends any
|
|
295
|
+
? Pick<T, Exclude<keyof T, U>>
|
|
296
|
+
: never
|
|
297
|
+
|
|
193
298
|
// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun>
|
|
194
299
|
// TypeScript Version: 3.1
|
|
195
300
|
|
|
@@ -208,13 +313,21 @@ interface ThemeProvider {
|
|
|
208
313
|
|
|
209
314
|
declare const ThemeProvider: ThemeProvider
|
|
210
315
|
|
|
316
|
+
type withTheme = <
|
|
317
|
+
C extends React$1.ComponentType<React$1.ComponentProps<C>>
|
|
318
|
+
>(
|
|
319
|
+
component: C
|
|
320
|
+
) => React$1.FC<DistributiveOmit<PropsOf<C>, 'theme'> & { theme?: Theme }>
|
|
321
|
+
|
|
322
|
+
declare const withTheme: withTheme
|
|
323
|
+
|
|
211
324
|
// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun>
|
|
212
325
|
// TypeScript Version: 3.4
|
|
213
326
|
|
|
214
327
|
|
|
215
328
|
|
|
216
329
|
// tslint:disable-next-line: no-empty-interface
|
|
217
|
-
interface Theme {}
|
|
330
|
+
export interface Theme extends StorybookTheme {}
|
|
218
331
|
|
|
219
332
|
// Definitions by: Pat Sissons <https://github.com/patsissons>
|
|
220
333
|
// TypeScript Version: 3.4
|
|
@@ -483,6 +596,4 @@ interface CreateStyled extends CreateStyled$1, StyledComponents {}
|
|
|
483
596
|
|
|
484
597
|
declare const styled: CreateStyled
|
|
485
598
|
|
|
486
|
-
export { StorybookTheme, StyledComponent, ThemeProvider, darkTheme, styled, theme, useTheme };
|
|
487
|
-
|
|
488
|
-
export interface Theme extends StorybookTheme {}
|
|
599
|
+
export { StorybookTheme, StyledComponent, ThemeProvider, darkTheme, styled, theme, useTheme, withTheme };
|
package/dist/index.js
CHANGED
|
@@ -862,7 +862,7 @@ var require_css_to_react_native = __commonJS({
|
|
|
862
862
|
var offsetX;
|
|
863
863
|
var offsetY;
|
|
864
864
|
var radius;
|
|
865
|
-
var
|
|
865
|
+
var color2;
|
|
866
866
|
if (tokenStream.matches(NONE)) {
|
|
867
867
|
tokenStream.expectEmpty();
|
|
868
868
|
return {
|
|
@@ -888,8 +888,8 @@ var require_css_to_react_native = __commonJS({
|
|
|
888
888
|
} else {
|
|
889
889
|
tokenStream.rewind();
|
|
890
890
|
}
|
|
891
|
-
} else if (
|
|
892
|
-
|
|
891
|
+
} else if (color2 === void 0 && tokenStream.matches(COLOR)) {
|
|
892
|
+
color2 = tokenStream.lastValue;
|
|
893
893
|
} else {
|
|
894
894
|
tokenStream["throw"]();
|
|
895
895
|
}
|
|
@@ -903,15 +903,15 @@ var require_css_to_react_native = __commonJS({
|
|
|
903
903
|
height: offsetY
|
|
904
904
|
},
|
|
905
905
|
radius: radius !== void 0 ? radius : 0,
|
|
906
|
-
color:
|
|
906
|
+
color: color2 !== void 0 ? color2 : "black"
|
|
907
907
|
};
|
|
908
908
|
};
|
|
909
909
|
var boxShadow = function boxShadow2(tokenStream) {
|
|
910
|
-
var _parseShadow = parseShadow(tokenStream), offset = _parseShadow.offset, radius = _parseShadow.radius,
|
|
910
|
+
var _parseShadow = parseShadow(tokenStream), offset = _parseShadow.offset, radius = _parseShadow.radius, color2 = _parseShadow.color;
|
|
911
911
|
return {
|
|
912
912
|
shadowOffset: offset,
|
|
913
913
|
shadowRadius: radius,
|
|
914
|
-
shadowColor:
|
|
914
|
+
shadowColor: color2,
|
|
915
915
|
shadowOpacity: 1
|
|
916
916
|
};
|
|
917
917
|
};
|
|
@@ -1105,7 +1105,7 @@ var require_css_to_react_native = __commonJS({
|
|
|
1105
1105
|
var textDecoration = function textDecoration2(tokenStream) {
|
|
1106
1106
|
var line2;
|
|
1107
1107
|
var style;
|
|
1108
|
-
var
|
|
1108
|
+
var color2;
|
|
1109
1109
|
var didParseFirst = false;
|
|
1110
1110
|
while (tokenStream.hasTokens()) {
|
|
1111
1111
|
if (didParseFirst)
|
|
@@ -1122,8 +1122,8 @@ var require_css_to_react_native = __commonJS({
|
|
|
1122
1122
|
line2 = lines.join(" ");
|
|
1123
1123
|
} else if (style === void 0 && tokenStream.matches(STYLE$1)) {
|
|
1124
1124
|
style = tokenStream.lastValue;
|
|
1125
|
-
} else if (
|
|
1126
|
-
|
|
1125
|
+
} else if (color2 === void 0 && tokenStream.matches(COLOR)) {
|
|
1126
|
+
color2 = tokenStream.lastValue;
|
|
1127
1127
|
} else {
|
|
1128
1128
|
tokenStream["throw"]();
|
|
1129
1129
|
}
|
|
@@ -1131,7 +1131,7 @@ var require_css_to_react_native = __commonJS({
|
|
|
1131
1131
|
}
|
|
1132
1132
|
return {
|
|
1133
1133
|
textDecorationLine: line2 !== void 0 ? line2 : defaultTextDecorationLine,
|
|
1134
|
-
textDecorationColor:
|
|
1134
|
+
textDecorationColor: color2 !== void 0 ? color2 : defaultTextDecorationColor,
|
|
1135
1135
|
textDecorationStyle: style !== void 0 ? style : defaultTextDecorationStyle
|
|
1136
1136
|
};
|
|
1137
1137
|
};
|
|
@@ -1150,11 +1150,11 @@ var require_css_to_react_native = __commonJS({
|
|
|
1150
1150
|
};
|
|
1151
1151
|
};
|
|
1152
1152
|
var textShadow = function textShadow2(tokenStream) {
|
|
1153
|
-
var _parseShadow2 = parseShadow(tokenStream), offset = _parseShadow2.offset, radius = _parseShadow2.radius,
|
|
1153
|
+
var _parseShadow2 = parseShadow(tokenStream), offset = _parseShadow2.offset, radius = _parseShadow2.radius, color2 = _parseShadow2.color;
|
|
1154
1154
|
return {
|
|
1155
1155
|
textShadowOffset: offset,
|
|
1156
1156
|
textShadowRadius: radius,
|
|
1157
|
-
textShadowColor:
|
|
1157
|
+
textShadowColor: color2
|
|
1158
1158
|
};
|
|
1159
1159
|
};
|
|
1160
1160
|
var oneOfType = function oneOfType2(tokenType) {
|
|
@@ -1225,7 +1225,7 @@ var require_css_to_react_native = __commonJS({
|
|
|
1225
1225
|
transform: transforms2
|
|
1226
1226
|
};
|
|
1227
1227
|
};
|
|
1228
|
-
var
|
|
1228
|
+
var background2 = function background3(tokenStream) {
|
|
1229
1229
|
return {
|
|
1230
1230
|
backgroundColor: tokenStream.expect(COLOR)
|
|
1231
1231
|
};
|
|
@@ -1269,7 +1269,7 @@ var require_css_to_react_native = __commonJS({
|
|
|
1269
1269
|
};
|
|
1270
1270
|
var transforms = {
|
|
1271
1271
|
aspectRatio,
|
|
1272
|
-
background,
|
|
1272
|
+
background: background2,
|
|
1273
1273
|
border,
|
|
1274
1274
|
borderColor,
|
|
1275
1275
|
borderRadius,
|
|
@@ -1773,12 +1773,12 @@ var require_hoist_non_react_statics_cjs = __commonJS({
|
|
|
1773
1773
|
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
1774
1774
|
var getPrototypeOf = Object.getPrototypeOf;
|
|
1775
1775
|
var objectPrototype = Object.prototype;
|
|
1776
|
-
function
|
|
1776
|
+
function hoistNonReactStatics2(targetComponent, sourceComponent, blacklist) {
|
|
1777
1777
|
if (typeof sourceComponent !== "string") {
|
|
1778
1778
|
if (objectPrototype) {
|
|
1779
1779
|
var inheritedComponent = getPrototypeOf(sourceComponent);
|
|
1780
1780
|
if (inheritedComponent && inheritedComponent !== objectPrototype) {
|
|
1781
|
-
|
|
1781
|
+
hoistNonReactStatics2(targetComponent, inheritedComponent, blacklist);
|
|
1782
1782
|
}
|
|
1783
1783
|
}
|
|
1784
1784
|
var keys = getOwnPropertyNames(sourceComponent);
|
|
@@ -1800,7 +1800,7 @@ var require_hoist_non_react_statics_cjs = __commonJS({
|
|
|
1800
1800
|
}
|
|
1801
1801
|
return targetComponent;
|
|
1802
1802
|
}
|
|
1803
|
-
module2.exports =
|
|
1803
|
+
module2.exports = hoistNonReactStatics2;
|
|
1804
1804
|
}
|
|
1805
1805
|
});
|
|
1806
1806
|
|
|
@@ -1832,10 +1832,134 @@ __export(src_exports, {
|
|
|
1832
1832
|
darkTheme: () => darkTheme,
|
|
1833
1833
|
styled: () => index,
|
|
1834
1834
|
theme: () => theme,
|
|
1835
|
-
useTheme: () => useTheme
|
|
1835
|
+
useTheme: () => useTheme,
|
|
1836
|
+
withTheme: () => withTheme
|
|
1836
1837
|
});
|
|
1837
1838
|
module.exports = __toCommonJS(src_exports);
|
|
1838
1839
|
|
|
1840
|
+
// src/newTheme.ts
|
|
1841
|
+
var import_polished = require("polished");
|
|
1842
|
+
var color = {
|
|
1843
|
+
// Official color palette
|
|
1844
|
+
primary: "#FF4785",
|
|
1845
|
+
// coral
|
|
1846
|
+
secondary: "#029CFD",
|
|
1847
|
+
// ocean
|
|
1848
|
+
secondaryLighter: "rgba(2, 157, 253, 0.9)",
|
|
1849
|
+
// ocean
|
|
1850
|
+
tertiary: "#FAFBFC",
|
|
1851
|
+
ancillary: "#22a699",
|
|
1852
|
+
// Complimentary
|
|
1853
|
+
orange: "#FC521F",
|
|
1854
|
+
gold: "#FFAE00",
|
|
1855
|
+
green: "#66BF3C",
|
|
1856
|
+
seafoam: "#37D5D3",
|
|
1857
|
+
purple: "#6F2CAC",
|
|
1858
|
+
ultraviolet: "#2A0481",
|
|
1859
|
+
// Monochrome
|
|
1860
|
+
lightest: "#FFFFFF",
|
|
1861
|
+
lighter: "#F7FAFC",
|
|
1862
|
+
light: "#EEF3F6",
|
|
1863
|
+
mediumlight: "#ECF4F9",
|
|
1864
|
+
medium: "#D9E8F2",
|
|
1865
|
+
mediumdark: "#73828C",
|
|
1866
|
+
dark: "#5C6870",
|
|
1867
|
+
darker: "#454E54",
|
|
1868
|
+
darkest: "#2E3438",
|
|
1869
|
+
// For borders
|
|
1870
|
+
border: "hsla(203, 50%, 30%, 0.15)",
|
|
1871
|
+
// Status
|
|
1872
|
+
positive: "#66BF3C",
|
|
1873
|
+
negative: "#FF4400",
|
|
1874
|
+
warning: "#E69D00",
|
|
1875
|
+
critical: "#FFFFFF",
|
|
1876
|
+
// Text
|
|
1877
|
+
defaultText: "#2E3438",
|
|
1878
|
+
inverseText: "#FFFFFF",
|
|
1879
|
+
positiveText: "#448028",
|
|
1880
|
+
negativeText: "#D43900",
|
|
1881
|
+
warningText: "#A15C20"
|
|
1882
|
+
};
|
|
1883
|
+
var background = {
|
|
1884
|
+
app: "#F6F9FC",
|
|
1885
|
+
bar: color.lightest,
|
|
1886
|
+
content: color.lightest,
|
|
1887
|
+
preview: color.lightest,
|
|
1888
|
+
gridCellSize: 10,
|
|
1889
|
+
hoverable: (0, import_polished.transparentize)(0.9, color.secondary),
|
|
1890
|
+
// hover state for items in a list
|
|
1891
|
+
// Notification, error, and warning backgrounds
|
|
1892
|
+
positive: "#E1FFD4",
|
|
1893
|
+
negative: "#FEDED2",
|
|
1894
|
+
warning: "#FFF5CF",
|
|
1895
|
+
critical: "#FF4400"
|
|
1896
|
+
};
|
|
1897
|
+
var light = {
|
|
1898
|
+
base: "light",
|
|
1899
|
+
// Storybook-specific color palette
|
|
1900
|
+
colorPrimary: "#FF4785",
|
|
1901
|
+
// coral
|
|
1902
|
+
colorSecondary: "#029CFD",
|
|
1903
|
+
// ocean
|
|
1904
|
+
// UI
|
|
1905
|
+
appBg: background.app,
|
|
1906
|
+
appContentBg: color.lightest,
|
|
1907
|
+
appPreviewBg: color.lightest,
|
|
1908
|
+
appBorderColor: color.border,
|
|
1909
|
+
appBorderRadius: 4,
|
|
1910
|
+
// Fonts
|
|
1911
|
+
// Text colors
|
|
1912
|
+
textColor: color.darkest,
|
|
1913
|
+
textInverseColor: color.lightest,
|
|
1914
|
+
textMutedColor: color.dark,
|
|
1915
|
+
// Toolbar default and active colors
|
|
1916
|
+
barTextColor: color.mediumdark,
|
|
1917
|
+
barHoverColor: color.secondary,
|
|
1918
|
+
barSelectedColor: color.secondary,
|
|
1919
|
+
barBg: color.lightest,
|
|
1920
|
+
// Form colors
|
|
1921
|
+
buttonBg: background.app,
|
|
1922
|
+
buttonBorder: color.medium,
|
|
1923
|
+
booleanBg: color.mediumlight,
|
|
1924
|
+
booleanSelectedBg: color.lightest,
|
|
1925
|
+
inputBg: color.lightest,
|
|
1926
|
+
inputBorder: color.border,
|
|
1927
|
+
inputTextColor: color.darkest,
|
|
1928
|
+
inputBorderRadius: 4
|
|
1929
|
+
};
|
|
1930
|
+
var dark = {
|
|
1931
|
+
base: "dark",
|
|
1932
|
+
// Storybook-specific color palette
|
|
1933
|
+
colorPrimary: "#FF4785",
|
|
1934
|
+
// coral
|
|
1935
|
+
colorSecondary: "#029CFD",
|
|
1936
|
+
// ocean
|
|
1937
|
+
// UI
|
|
1938
|
+
appBg: "#222425",
|
|
1939
|
+
appContentBg: "#1B1C1D",
|
|
1940
|
+
appPreviewBg: color.lightest,
|
|
1941
|
+
appBorderColor: "rgba(255,255,255,.1)",
|
|
1942
|
+
appBorderRadius: 4,
|
|
1943
|
+
// Text colors
|
|
1944
|
+
textColor: "#C9CDCF",
|
|
1945
|
+
textInverseColor: "#222425",
|
|
1946
|
+
textMutedColor: "#798186",
|
|
1947
|
+
// Toolbar default and active colors
|
|
1948
|
+
barTextColor: "#798186",
|
|
1949
|
+
barHoverColor: color.secondary,
|
|
1950
|
+
barSelectedColor: color.secondary,
|
|
1951
|
+
barBg: "#292C2E",
|
|
1952
|
+
// Form colors
|
|
1953
|
+
buttonBg: "#222425",
|
|
1954
|
+
buttonBorder: "rgba(255,255,255,.1)",
|
|
1955
|
+
booleanBg: "#222425",
|
|
1956
|
+
booleanSelectedBg: "#2E3438",
|
|
1957
|
+
inputBg: "#1B1C1D",
|
|
1958
|
+
inputBorder: "rgba(255,255,255,.1)",
|
|
1959
|
+
inputTextColor: color.lightest,
|
|
1960
|
+
inputBorderRadius: 4
|
|
1961
|
+
};
|
|
1962
|
+
|
|
1839
1963
|
// src/theme.ts
|
|
1840
1964
|
var tokens = {
|
|
1841
1965
|
spacing1: 4,
|
|
@@ -1893,7 +2017,110 @@ var textOnDark = {
|
|
|
1893
2017
|
secondaryColor: tokens.color.grey200,
|
|
1894
2018
|
linkColor: tokens.color.blue600
|
|
1895
2019
|
};
|
|
2020
|
+
var typography = {
|
|
2021
|
+
weight: {
|
|
2022
|
+
regular: "400",
|
|
2023
|
+
bold: "700"
|
|
2024
|
+
},
|
|
2025
|
+
size: {
|
|
2026
|
+
s1: 12,
|
|
2027
|
+
s2: 14,
|
|
2028
|
+
s3: 16,
|
|
2029
|
+
m1: 20,
|
|
2030
|
+
m2: 24,
|
|
2031
|
+
m3: 28,
|
|
2032
|
+
l1: 32,
|
|
2033
|
+
l2: 40,
|
|
2034
|
+
l3: 48,
|
|
2035
|
+
code: 90
|
|
2036
|
+
}
|
|
2037
|
+
};
|
|
1896
2038
|
var theme = {
|
|
2039
|
+
base: "light",
|
|
2040
|
+
textMutedColor: color.dark,
|
|
2041
|
+
color: {
|
|
2042
|
+
primary: light.colorPrimary,
|
|
2043
|
+
secondary: light.colorSecondary,
|
|
2044
|
+
secondaryLighter: color.secondaryLighter,
|
|
2045
|
+
tertiary: color.tertiary,
|
|
2046
|
+
ancillary: color.ancillary,
|
|
2047
|
+
// Complimentary
|
|
2048
|
+
orange: color.orange,
|
|
2049
|
+
gold: color.gold,
|
|
2050
|
+
green: color.green,
|
|
2051
|
+
seafoam: color.seafoam,
|
|
2052
|
+
purple: color.purple,
|
|
2053
|
+
ultraviolet: color.ultraviolet,
|
|
2054
|
+
// Monochrome
|
|
2055
|
+
lightest: color.lightest,
|
|
2056
|
+
lighter: color.lighter,
|
|
2057
|
+
light: color.light,
|
|
2058
|
+
mediumlight: color.mediumlight,
|
|
2059
|
+
medium: color.medium,
|
|
2060
|
+
mediumdark: color.mediumdark,
|
|
2061
|
+
dark: color.dark,
|
|
2062
|
+
darker: color.darker,
|
|
2063
|
+
darkest: color.darkest,
|
|
2064
|
+
// For borders
|
|
2065
|
+
border: color.border,
|
|
2066
|
+
// Status
|
|
2067
|
+
positive: color.positive,
|
|
2068
|
+
negative: color.negative,
|
|
2069
|
+
warning: color.warning,
|
|
2070
|
+
critical: color.critical,
|
|
2071
|
+
defaultText: light.textColor || color.darkest,
|
|
2072
|
+
inverseText: light.textInverseColor || color.lightest,
|
|
2073
|
+
positiveText: color.positiveText,
|
|
2074
|
+
negativeText: color.negativeText,
|
|
2075
|
+
warningText: color.warningText
|
|
2076
|
+
},
|
|
2077
|
+
background: {
|
|
2078
|
+
app: light.appBg,
|
|
2079
|
+
bar: light.barBg,
|
|
2080
|
+
content: light.appContentBg,
|
|
2081
|
+
preview: light.appPreviewBg,
|
|
2082
|
+
gridCellSize: light.gridCellSize || background.gridCellSize,
|
|
2083
|
+
hoverable: background.hoverable,
|
|
2084
|
+
positive: background.positive,
|
|
2085
|
+
negative: background.negative,
|
|
2086
|
+
warning: background.warning,
|
|
2087
|
+
critical: background.critical
|
|
2088
|
+
},
|
|
2089
|
+
typography: {
|
|
2090
|
+
weight: typography.weight,
|
|
2091
|
+
size: typography.size
|
|
2092
|
+
},
|
|
2093
|
+
input: {
|
|
2094
|
+
background: light.inputBg,
|
|
2095
|
+
border: light.inputBorder,
|
|
2096
|
+
borderRadius: light.inputBorderRadius,
|
|
2097
|
+
color: light.inputTextColor
|
|
2098
|
+
},
|
|
2099
|
+
button$: {
|
|
2100
|
+
background: light.buttonBg || light.inputBg,
|
|
2101
|
+
border: light.buttonBorder || light.inputBorder
|
|
2102
|
+
},
|
|
2103
|
+
boolean: {
|
|
2104
|
+
background: light.booleanBg || light.inputBorder,
|
|
2105
|
+
selectedBackground: light.booleanSelectedBg || light.inputBg
|
|
2106
|
+
},
|
|
2107
|
+
// UI
|
|
2108
|
+
layoutMargin: 10,
|
|
2109
|
+
appBorderColor: light.appBorderColor,
|
|
2110
|
+
appBorderRadius: light.appBorderRadius,
|
|
2111
|
+
// Toolbar default/active colors
|
|
2112
|
+
barTextColor: light.barTextColor,
|
|
2113
|
+
barHoverColor: light.barHoverColor || light.colorSecondary,
|
|
2114
|
+
barSelectedColor: light.barSelectedColor || light.colorSecondary,
|
|
2115
|
+
barBg: light.barBg,
|
|
2116
|
+
// Brand logo/text
|
|
2117
|
+
brand: {
|
|
2118
|
+
title: light.brandTitle,
|
|
2119
|
+
url: light.brandUrl,
|
|
2120
|
+
image: light.brandImage || (light.brandTitle ? null : void 0),
|
|
2121
|
+
target: light.brandTarget
|
|
2122
|
+
},
|
|
2123
|
+
// ONDEVICE
|
|
1897
2124
|
tokens,
|
|
1898
2125
|
text,
|
|
1899
2126
|
backgroundColor: tokens.color.white,
|
|
@@ -2025,6 +2252,91 @@ var theme = {
|
|
|
2025
2252
|
}
|
|
2026
2253
|
};
|
|
2027
2254
|
var darkTheme = {
|
|
2255
|
+
base: "dark",
|
|
2256
|
+
textMutedColor: "#798186",
|
|
2257
|
+
color: {
|
|
2258
|
+
primary: dark.colorPrimary,
|
|
2259
|
+
secondary: dark.colorSecondary,
|
|
2260
|
+
secondaryLighter: color.secondaryLighter,
|
|
2261
|
+
tertiary: color.tertiary,
|
|
2262
|
+
ancillary: color.ancillary,
|
|
2263
|
+
// Complimentary
|
|
2264
|
+
orange: color.orange,
|
|
2265
|
+
gold: color.gold,
|
|
2266
|
+
green: color.green,
|
|
2267
|
+
seafoam: color.seafoam,
|
|
2268
|
+
purple: color.purple,
|
|
2269
|
+
ultraviolet: color.ultraviolet,
|
|
2270
|
+
// Monochrome
|
|
2271
|
+
lightest: color.lightest,
|
|
2272
|
+
lighter: color.lighter,
|
|
2273
|
+
light: color.light,
|
|
2274
|
+
mediumlight: color.mediumlight,
|
|
2275
|
+
medium: color.medium,
|
|
2276
|
+
mediumdark: color.mediumdark,
|
|
2277
|
+
dark: color.dark,
|
|
2278
|
+
darker: color.darker,
|
|
2279
|
+
darkest: color.darkest,
|
|
2280
|
+
// For borders
|
|
2281
|
+
border: color.border,
|
|
2282
|
+
// Status
|
|
2283
|
+
positive: color.positive,
|
|
2284
|
+
negative: color.negative,
|
|
2285
|
+
warning: color.warning,
|
|
2286
|
+
critical: color.critical,
|
|
2287
|
+
defaultText: dark.textColor || color.darkest,
|
|
2288
|
+
inverseText: dark.textInverseColor || color.lightest,
|
|
2289
|
+
positiveText: color.positiveText,
|
|
2290
|
+
negativeText: color.negativeText,
|
|
2291
|
+
warningText: color.warningText
|
|
2292
|
+
},
|
|
2293
|
+
background: {
|
|
2294
|
+
app: dark.appBg,
|
|
2295
|
+
bar: dark.barBg,
|
|
2296
|
+
content: dark.appContentBg,
|
|
2297
|
+
preview: dark.appPreviewBg,
|
|
2298
|
+
gridCellSize: dark.gridCellSize || background.gridCellSize,
|
|
2299
|
+
hoverable: background.hoverable,
|
|
2300
|
+
positive: background.positive,
|
|
2301
|
+
negative: background.negative,
|
|
2302
|
+
warning: background.warning,
|
|
2303
|
+
critical: background.critical
|
|
2304
|
+
},
|
|
2305
|
+
typography: {
|
|
2306
|
+
weight: typography.weight,
|
|
2307
|
+
size: typography.size
|
|
2308
|
+
},
|
|
2309
|
+
input: {
|
|
2310
|
+
background: dark.inputBg,
|
|
2311
|
+
border: dark.inputBorder,
|
|
2312
|
+
borderRadius: dark.inputBorderRadius,
|
|
2313
|
+
color: dark.inputTextColor
|
|
2314
|
+
},
|
|
2315
|
+
button$: {
|
|
2316
|
+
background: dark.buttonBg || dark.inputBg,
|
|
2317
|
+
border: dark.buttonBorder || dark.inputBorder
|
|
2318
|
+
},
|
|
2319
|
+
boolean: {
|
|
2320
|
+
background: dark.booleanBg || dark.inputBorder,
|
|
2321
|
+
selectedBackground: dark.booleanSelectedBg || dark.inputBg
|
|
2322
|
+
},
|
|
2323
|
+
// UI
|
|
2324
|
+
layoutMargin: 10,
|
|
2325
|
+
appBorderColor: dark.appBorderColor,
|
|
2326
|
+
appBorderRadius: dark.appBorderRadius,
|
|
2327
|
+
// Toolbar default/active colors
|
|
2328
|
+
barTextColor: dark.barTextColor,
|
|
2329
|
+
barHoverColor: dark.barHoverColor || dark.colorSecondary,
|
|
2330
|
+
barSelectedColor: dark.barSelectedColor || dark.colorSecondary,
|
|
2331
|
+
barBg: dark.barBg,
|
|
2332
|
+
// Brand logo/text
|
|
2333
|
+
brand: {
|
|
2334
|
+
title: dark.brandTitle,
|
|
2335
|
+
url: dark.brandUrl,
|
|
2336
|
+
image: dark.brandImage || (dark.brandTitle ? null : void 0),
|
|
2337
|
+
target: dark.brandTarget
|
|
2338
|
+
},
|
|
2339
|
+
// ondevice
|
|
2028
2340
|
tokens,
|
|
2029
2341
|
text: textOnDark,
|
|
2030
2342
|
backgroundColor: tokens.color.offBlack,
|
|
@@ -2167,7 +2479,7 @@ var import_react_native = require("react-native");
|
|
|
2167
2479
|
var import_css_to_react_native = __toESM(require_css_to_react_native());
|
|
2168
2480
|
var React4 = __toESM(require("react"));
|
|
2169
2481
|
|
|
2170
|
-
// ../../node_modules/@emotion/react/dist/emotion-element-
|
|
2482
|
+
// ../../node_modules/@emotion/react/dist/emotion-element-c16c303e.esm.js
|
|
2171
2483
|
var React2 = __toESM(require("react"));
|
|
2172
2484
|
var import_react = require("react");
|
|
2173
2485
|
|
|
@@ -3103,6 +3415,12 @@ function _extends() {
|
|
|
3103
3415
|
return _extends.apply(this, arguments);
|
|
3104
3416
|
}
|
|
3105
3417
|
|
|
3418
|
+
// ../../node_modules/@emotion/react/_isolated-hnrs/dist/emotion-react-_isolated-hnrs.esm.js
|
|
3419
|
+
var import_hoist_non_react_statics = __toESM(require_hoist_non_react_statics_cjs());
|
|
3420
|
+
var hoistNonReactStatics = function(targetComponent, sourceComponent) {
|
|
3421
|
+
return (0, import_hoist_non_react_statics.default)(targetComponent, sourceComponent);
|
|
3422
|
+
};
|
|
3423
|
+
|
|
3106
3424
|
// ../../node_modules/@emotion/utils/dist/emotion-utils.esm.js
|
|
3107
3425
|
var isBrowser2 = typeof document !== "undefined";
|
|
3108
3426
|
function getRegisteredStyles(registered, registeredStyles, classNames) {
|
|
@@ -3496,9 +3814,9 @@ var useInsertionEffect2 = React["useInsertionEffect"] ? React["useInsertionEffec
|
|
|
3496
3814
|
var useInsertionEffectAlwaysWithSyncFallback = !isBrowser3 ? syncFallback : useInsertionEffect2 || syncFallback;
|
|
3497
3815
|
var useInsertionEffectWithLayoutFallback = useInsertionEffect2 || React.useLayoutEffect;
|
|
3498
3816
|
|
|
3499
|
-
// ../../node_modules/@emotion/react/dist/emotion-element-
|
|
3817
|
+
// ../../node_modules/@emotion/react/dist/emotion-element-c16c303e.esm.js
|
|
3500
3818
|
var isBrowser4 = typeof document !== "undefined";
|
|
3501
|
-
var
|
|
3819
|
+
var hasOwn = {}.hasOwnProperty;
|
|
3502
3820
|
var EmotionCacheContext = /* @__PURE__ */ React2.createContext(
|
|
3503
3821
|
// we're doing this to avoid preconstruct's dead code elimination in this one case
|
|
3504
3822
|
// because this module is primarily intended for the browser and node
|
|
@@ -3571,6 +3889,19 @@ var ThemeProvider = function ThemeProvider2(props) {
|
|
|
3571
3889
|
value: theme2
|
|
3572
3890
|
}, props.children);
|
|
3573
3891
|
};
|
|
3892
|
+
function withTheme(Component) {
|
|
3893
|
+
var componentName = Component.displayName || Component.name || "Component";
|
|
3894
|
+
var render = function render2(props, ref) {
|
|
3895
|
+
var theme2 = React2.useContext(ThemeContext);
|
|
3896
|
+
return /* @__PURE__ */ React2.createElement(Component, _extends({
|
|
3897
|
+
theme: theme2,
|
|
3898
|
+
ref
|
|
3899
|
+
}, props));
|
|
3900
|
+
};
|
|
3901
|
+
var WithTheme = /* @__PURE__ */ React2.forwardRef(render);
|
|
3902
|
+
WithTheme.displayName = "WithTheme(" + componentName + ")";
|
|
3903
|
+
return hoistNonReactStatics(WithTheme, Component);
|
|
3904
|
+
}
|
|
3574
3905
|
var typePropName = "__EMOTION_TYPE_PLEASE_DO_NOT_USE__";
|
|
3575
3906
|
var labelPropName = "__EMOTION_LABEL_PLEASE_DO_NOT_USE__";
|
|
3576
3907
|
var Insertion = function Insertion2(_ref) {
|
|
@@ -3616,7 +3947,7 @@ var Emotion = /* @__PURE__ */ withEmotionCache(function(props, cache, ref) {
|
|
|
3616
3947
|
className += cache.key + "-" + serialized.name;
|
|
3617
3948
|
var newProps = {};
|
|
3618
3949
|
for (var key in props) {
|
|
3619
|
-
if (
|
|
3950
|
+
if (hasOwn.call(props, key) && key !== "css" && key !== typePropName && (process.env.NODE_ENV === "production" || key !== labelPropName)) {
|
|
3620
3951
|
newProps[key] = props[key];
|
|
3621
3952
|
}
|
|
3622
3953
|
}
|
|
@@ -3635,10 +3966,10 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
3635
3966
|
// ../../node_modules/@emotion/react/dist/emotion-react.esm.js
|
|
3636
3967
|
var React3 = __toESM(require("react"));
|
|
3637
3968
|
var import_extends2 = __toESM(require_extends());
|
|
3638
|
-
var
|
|
3969
|
+
var import_hoist_non_react_statics2 = __toESM(require_hoist_non_react_statics_cjs());
|
|
3639
3970
|
var pkg = {
|
|
3640
3971
|
name: "@emotion/react",
|
|
3641
|
-
version: "11.11.
|
|
3972
|
+
version: "11.11.4",
|
|
3642
3973
|
main: "dist/emotion-react.cjs.js",
|
|
3643
3974
|
module: "dist/emotion-react.esm.js",
|
|
3644
3975
|
browser: {
|
|
@@ -3711,7 +4042,7 @@ var pkg = {
|
|
|
3711
4042
|
"@babel/runtime": "^7.18.3",
|
|
3712
4043
|
"@emotion/babel-plugin": "^11.11.0",
|
|
3713
4044
|
"@emotion/cache": "^11.11.0",
|
|
3714
|
-
"@emotion/serialize": "^1.1.
|
|
4045
|
+
"@emotion/serialize": "^1.1.3",
|
|
3715
4046
|
"@emotion/use-insertion-effect-with-fallbacks": "^1.0.1",
|
|
3716
4047
|
"@emotion/utils": "^1.2.1",
|
|
3717
4048
|
"@emotion/weak-memoize": "^0.3.1",
|
|
@@ -3727,7 +4058,7 @@ var pkg = {
|
|
|
3727
4058
|
},
|
|
3728
4059
|
devDependencies: {
|
|
3729
4060
|
"@definitelytyped/dtslint": "0.0.112",
|
|
3730
|
-
"@emotion/css": "11.11.
|
|
4061
|
+
"@emotion/css": "11.11.2",
|
|
3731
4062
|
"@emotion/css-prettifier": "1.1.3",
|
|
3732
4063
|
"@emotion/server": "11.11.0",
|
|
3733
4064
|
"@emotion/styled": "11.11.0",
|
|
@@ -4171,7 +4502,8 @@ var index = components.reduce(function(acc, comp) {
|
|
|
4171
4502
|
darkTheme,
|
|
4172
4503
|
styled,
|
|
4173
4504
|
theme,
|
|
4174
|
-
useTheme
|
|
4505
|
+
useTheme,
|
|
4506
|
+
withTheme
|
|
4175
4507
|
});
|
|
4176
4508
|
/*! Bundled license information:
|
|
4177
4509
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react-native-theming",
|
|
3
|
-
"version": "8.0.0-alpha.
|
|
3
|
+
"version": "8.0.0-alpha.3",
|
|
4
4
|
"description": "A wrapper library around emotion 11 to provide theming support for react-native storybook",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -21,13 +21,15 @@
|
|
|
21
21
|
"main": "dist/index.js",
|
|
22
22
|
"types": "dist/index.d.ts",
|
|
23
23
|
"scripts": {
|
|
24
|
-
"dev": "
|
|
25
|
-
"prepare": "tsup &&
|
|
24
|
+
"dev": "npx tsx ./scripts/gendtsdev.ts && tsup --watch",
|
|
25
|
+
"prepare": "tsup && npx tsx ./scripts/patchdts.ts"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"polished": "^4.3.1"
|
|
26
29
|
},
|
|
27
30
|
"devDependencies": {
|
|
28
31
|
"@emotion/native": "^11.11.0",
|
|
29
32
|
"@emotion/react": "^11.11.1",
|
|
30
|
-
"ts-node": "^10.9.1",
|
|
31
33
|
"tsup": "^7.2.0"
|
|
32
34
|
},
|
|
33
35
|
"peerDependencies": {
|
|
@@ -41,5 +43,5 @@
|
|
|
41
43
|
"dist/**/*",
|
|
42
44
|
"README.md"
|
|
43
45
|
],
|
|
44
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "b7c2a24d21c0a38bd5e31349b3ba370af7c3d863"
|
|
45
47
|
}
|