@storybook/react-native-theming 8.2.0-alpha.0 → 8.3.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +87 -190
- package/dist/index.js +58 -1284
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as RN from 'react-native';
|
|
2
|
-
import { TextStyle
|
|
2
|
+
import { TextStyle } from 'react-native';
|
|
3
3
|
import * as React$1 from 'react';
|
|
4
4
|
|
|
5
5
|
declare const color: {
|
|
@@ -74,14 +74,26 @@ interface Brand {
|
|
|
74
74
|
target: string | null | undefined;
|
|
75
75
|
}
|
|
76
76
|
interface StorybookThemeWeb {
|
|
77
|
+
base: 'light' | 'dark';
|
|
77
78
|
color: Color;
|
|
78
79
|
background: Background;
|
|
79
80
|
typography: Typography;
|
|
81
|
+
textMutedColor: string;
|
|
80
82
|
input: {
|
|
81
83
|
border: string;
|
|
82
84
|
background: string;
|
|
83
85
|
color: string;
|
|
84
86
|
borderRadius: number;
|
|
87
|
+
paddingHorizontal: number;
|
|
88
|
+
paddingVertical: number;
|
|
89
|
+
};
|
|
90
|
+
button: {
|
|
91
|
+
background: string;
|
|
92
|
+
border: string;
|
|
93
|
+
};
|
|
94
|
+
boolean: {
|
|
95
|
+
background: string;
|
|
96
|
+
selectedBackground: string;
|
|
85
97
|
};
|
|
86
98
|
layoutMargin: number;
|
|
87
99
|
appBorderColor: string;
|
|
@@ -91,204 +103,89 @@ interface StorybookThemeWeb {
|
|
|
91
103
|
barSelectedColor: string;
|
|
92
104
|
barBg: string;
|
|
93
105
|
brand: Brand;
|
|
94
|
-
[key: string]: any;
|
|
95
106
|
}
|
|
96
107
|
|
|
97
|
-
type
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
borderWidth: number;
|
|
170
|
-
visibilityBorderRadius: number;
|
|
171
|
-
visibilityInnerBorderColor: string;
|
|
172
|
-
visibilityOuterBorderColor: string;
|
|
173
|
-
};
|
|
174
|
-
/** Side panels (Story list, addons) */
|
|
175
|
-
panel: {
|
|
176
|
-
backgroundColor: string;
|
|
177
|
-
borderWidth: number;
|
|
178
|
-
borderColor: string;
|
|
179
|
-
paddingVertical: number;
|
|
180
|
-
paddingHorizontal: number;
|
|
181
|
-
};
|
|
182
|
-
/** Story list and list items */
|
|
183
|
-
storyList: {
|
|
184
|
-
fontSize: number;
|
|
185
|
-
headerPaddingHorizontal: number;
|
|
186
|
-
headerPaddingVertical: number;
|
|
187
|
-
headerTextColor: string;
|
|
188
|
-
headerFontWeight: FontWeight;
|
|
189
|
-
storyPaddingHorizontal: number;
|
|
190
|
-
storyPaddingVertical: number;
|
|
191
|
-
storyIndent: number;
|
|
192
|
-
storyTextColor: string;
|
|
193
|
-
storyFontWeight: FontWeight;
|
|
194
|
-
storySelectedBackgroundColor: string;
|
|
195
|
-
storySelectedTextColor: string;
|
|
196
|
-
storySelectedFontWeight: FontWeight;
|
|
197
|
-
sectionSpacing: number;
|
|
198
|
-
sectionActiveBackgroundColor: string;
|
|
199
|
-
sectionBorderRadius: number;
|
|
200
|
-
search: {
|
|
201
|
-
fontSize: number;
|
|
202
|
-
textColor: string;
|
|
203
|
-
placeholderTextColor: string;
|
|
204
|
-
borderRadius: number;
|
|
205
|
-
borderColor: string;
|
|
206
|
-
borderWidth: number;
|
|
207
|
-
backgroundColor: string;
|
|
208
|
-
paddingVertical: number;
|
|
209
|
-
paddingHorizontal: number;
|
|
210
|
-
};
|
|
211
|
-
};
|
|
212
|
-
/** Buttons */
|
|
213
|
-
button: {
|
|
214
|
-
fontSize: number;
|
|
215
|
-
fontWeight: FontWeight;
|
|
216
|
-
paddingVertical: number;
|
|
217
|
-
paddingHorizontal: number;
|
|
218
|
-
primary: ThemeButton;
|
|
219
|
-
secondary: ThemeButton;
|
|
220
|
-
};
|
|
221
|
-
/** Tabs (navigation and addons) */
|
|
222
|
-
tabs: {
|
|
223
|
-
fontSize: number;
|
|
224
|
-
fontWeight: FontWeight;
|
|
225
|
-
paddingVertical: number;
|
|
226
|
-
paddingHorizontal: number;
|
|
227
|
-
borderWidth: number;
|
|
228
|
-
borderRadius: number;
|
|
229
|
-
activeBorderColor: string;
|
|
230
|
-
activeBackgroundColor: string;
|
|
231
|
-
activeTextColor: string;
|
|
232
|
-
inactiveBorderColor: string;
|
|
233
|
-
inactiveBackgroundColor: string;
|
|
234
|
-
inactiveTextColor: string;
|
|
235
|
-
};
|
|
236
|
-
/** Inputs (text, radio, slider, etc.) */
|
|
237
|
-
inputs: {
|
|
238
|
-
errorTextColor: string;
|
|
239
|
-
labelFontSize: number;
|
|
240
|
-
labelTextColor: string;
|
|
241
|
-
text: {
|
|
242
|
-
fontSize: number;
|
|
243
|
-
textColor: string;
|
|
244
|
-
borderWidth: number;
|
|
245
|
-
borderColor: string;
|
|
246
|
-
backgroundColor: string;
|
|
247
|
-
borderRadius: number;
|
|
248
|
-
paddingVertical: number;
|
|
249
|
-
paddingHorizontal: number;
|
|
250
|
-
};
|
|
251
|
-
radio: {
|
|
252
|
-
fontSize: number;
|
|
253
|
-
height: number;
|
|
254
|
-
borderWidth: number;
|
|
255
|
-
borderColor: string;
|
|
256
|
-
backgroundColor: string;
|
|
257
|
-
paddingVertical: number;
|
|
258
|
-
paddingHorizontal: number;
|
|
259
|
-
activeBackgroundColor: string;
|
|
260
|
-
itemSpacing: number;
|
|
261
|
-
labelSpacing: number;
|
|
262
|
-
};
|
|
263
|
-
swatch: {
|
|
264
|
-
fontSize: number;
|
|
265
|
-
height: number;
|
|
266
|
-
borderWidth: number;
|
|
267
|
-
borderColor: string;
|
|
268
|
-
backgroundColor: string;
|
|
269
|
-
outerBorderRadius: number;
|
|
270
|
-
innerBorderRadius: number;
|
|
271
|
-
paddingVertical: number;
|
|
272
|
-
paddingHorizontal: number;
|
|
273
|
-
nameTextWeight: FontWeight;
|
|
274
|
-
};
|
|
275
|
-
slider: {
|
|
276
|
-
fontSize: number;
|
|
277
|
-
labelTextColor: string;
|
|
278
|
-
valueTextColor: string;
|
|
279
|
-
};
|
|
280
|
-
};
|
|
108
|
+
type StorybookTheme = StorybookThemeWeb;
|
|
109
|
+
declare const theme: StorybookThemeWeb;
|
|
110
|
+
declare const darkTheme: StorybookThemeWeb;
|
|
111
|
+
|
|
112
|
+
type IsPreReact19 = 2 extends Parameters<React.FunctionComponent<any>>['length']
|
|
113
|
+
? true
|
|
114
|
+
: false
|
|
115
|
+
|
|
116
|
+
// unpack all here to avoid infinite self-referencing when defining our own JSX namespace for the pre-React 19 case
|
|
117
|
+
type ReactJSXElement = true extends IsPreReact19
|
|
118
|
+
? /** @ts-ignore */
|
|
119
|
+
JSX.Element
|
|
120
|
+
: /** @ts-ignore */
|
|
121
|
+
React.JSX.Element
|
|
122
|
+
type ReactJSXElementClass = true extends IsPreReact19
|
|
123
|
+
? /** @ts-ignore */
|
|
124
|
+
JSX.ElementClass
|
|
125
|
+
: /** @ts-ignore */
|
|
126
|
+
React.JSX.ElementClass
|
|
127
|
+
type ReactJSXElementAttributesProperty = true extends IsPreReact19
|
|
128
|
+
? /** @ts-ignore */
|
|
129
|
+
JSX.ElementAttributesProperty
|
|
130
|
+
: /** @ts-ignore */
|
|
131
|
+
React.JSX.ElementAttributesProperty
|
|
132
|
+
type ReactJSXElementChildrenAttribute = true extends IsPreReact19
|
|
133
|
+
? /** @ts-ignore */
|
|
134
|
+
JSX.ElementChildrenAttribute
|
|
135
|
+
: /** @ts-ignore */
|
|
136
|
+
React.JSX.ElementChildrenAttribute
|
|
137
|
+
type ReactJSXLibraryManagedAttributes<C, P> = true extends IsPreReact19
|
|
138
|
+
? /** @ts-ignore */
|
|
139
|
+
JSX.LibraryManagedAttributes<C, P>
|
|
140
|
+
: /** @ts-ignore */
|
|
141
|
+
React.JSX.LibraryManagedAttributes<C, P>
|
|
142
|
+
type ReactJSXIntrinsicAttributes = true extends IsPreReact19
|
|
143
|
+
? /** @ts-ignore */
|
|
144
|
+
JSX.IntrinsicAttributes
|
|
145
|
+
: /** @ts-ignore */
|
|
146
|
+
React.JSX.IntrinsicAttributes
|
|
147
|
+
type ReactJSXIntrinsicClassAttributes<T> = true extends IsPreReact19
|
|
148
|
+
? /** @ts-ignore */
|
|
149
|
+
JSX.IntrinsicClassAttributes<T>
|
|
150
|
+
: /** @ts-ignore */
|
|
151
|
+
React.JSX.IntrinsicClassAttributes<T>
|
|
152
|
+
type ReactJSXIntrinsicElements = true extends IsPreReact19
|
|
153
|
+
? /** @ts-ignore */
|
|
154
|
+
JSX.IntrinsicElements
|
|
155
|
+
: /** @ts-ignore */
|
|
156
|
+
React.JSX.IntrinsicElements
|
|
157
|
+
|
|
158
|
+
type ReactJSXElementType = true extends IsPreReact19
|
|
159
|
+
? // based on the code from @types/react@18.2.8
|
|
160
|
+
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/3197efc097d522c4bf02b94e1a0766d007d6cdeb/types/react/index.d.ts#LL3204C13-L3204C13
|
|
161
|
+
string | React.JSXElementConstructor<any>
|
|
162
|
+
: /** @ts-ignore */
|
|
163
|
+
React.JSX.ElementType
|
|
164
|
+
|
|
165
|
+
declare namespace ReactJSX {
|
|
166
|
+
type ElementType = ReactJSXElementType
|
|
167
|
+
interface Element extends ReactJSXElement {}
|
|
168
|
+
interface ElementClass extends ReactJSXElementClass {}
|
|
169
|
+
interface ElementAttributesProperty
|
|
170
|
+
extends ReactJSXElementAttributesProperty {}
|
|
171
|
+
interface ElementChildrenAttribute extends ReactJSXElementChildrenAttribute {}
|
|
172
|
+
|
|
173
|
+
type LibraryManagedAttributes<C, P> = ReactJSXLibraryManagedAttributes<C, P>
|
|
174
|
+
|
|
175
|
+
interface IntrinsicAttributes extends ReactJSXIntrinsicAttributes {}
|
|
176
|
+
interface IntrinsicClassAttributes<T>
|
|
177
|
+
extends ReactJSXIntrinsicClassAttributes<T> {}
|
|
178
|
+
|
|
179
|
+
type IntrinsicElements = ReactJSXIntrinsicElements
|
|
281
180
|
}
|
|
282
|
-
declare const theme: StorybookTheme;
|
|
283
|
-
declare const darkTheme: StorybookTheme;
|
|
284
181
|
|
|
285
182
|
/**
|
|
286
183
|
* @desc Utility type for getting props type of React component.
|
|
287
184
|
* It takes `defaultProps` into an account - making props with defaults optional.
|
|
288
185
|
*/
|
|
289
186
|
type PropsOf<
|
|
290
|
-
C extends keyof
|
|
291
|
-
> =
|
|
187
|
+
C extends keyof ReactJSX.IntrinsicElements | React.JSXElementConstructor<any>
|
|
188
|
+
> = ReactJSX.LibraryManagedAttributes<C, React.ComponentProps<C>>
|
|
292
189
|
|
|
293
190
|
// We need to use this version of Omit as it's distributive (Will preserve unions)
|
|
294
191
|
type DistributiveOmit<T, U> = T extends any
|