|
1 | 1 | /**
|
2 | 2 | * Flowtype definitions for index
|
3 | 3 | * Generated by Flowgen from a Typescript Definition
|
4 |
| - * Flowgen v1.15.0 |
| 4 | + * Flowgen v1.17.0 |
5 | 5 | * @flow
|
6 | 6 | */
|
7 | 7 | import type { Node } from 'react';
|
8 |
| -import type { BasicTemplateInterpolations, CssFunction } from '../types'; |
9 |
| -export type Interpolations = (BasicTemplateInterpolations | CssFunction<> | CssFunction<>[])[]; |
10 |
| -export interface ClassNamesProps { |
| 8 | +import type { CssType, CssFunction } from '../types'; |
| 9 | +export type ObjectInterpolation<TProps> = CssType<TProps> | CssType<TProps>[]; |
| 10 | +export type TemplateStringsInterpolation<TProps> = CssFunction<TProps> | CssFunction<TProps>[]; |
| 11 | +declare interface CssSignature<TProps> { |
| 12 | + (...interpolations: ObjectInterpolation<TProps>[]): string; |
| 13 | + ( |
| 14 | + template: $ReadOnlyArray<string>, |
| 15 | + ...interpolations: TemplateStringsInterpolation<TProps>[] |
| 16 | + ): string; |
| 17 | +} |
| 18 | +export interface ClassNamesProps<TProps> { |
11 | 19 | children: (opts: {
|
12 |
| - css: (css: CssFunction<> | CssFunction<>[], ...interpolations: Interpolations) => string, |
13 |
| - style: { |
14 |
| - [key: string]: string, |
15 |
| - ... |
16 |
| - }, |
| 20 | + css: CssSignature<TProps>, |
| 21 | + style: $Shape<CSSStyleDeclaration>, |
17 | 22 | ...
|
18 | 23 | }) => Node;
|
19 | 24 | }
|
20 | 25 | /**
|
21 |
| - * Use a component where styles are not necessarily tied to an element. |
| 26 | + * ## Class names |
22 | 27 | *
|
23 |
| - * ``` |
24 |
| - * // Object CSS |
| 28 | + * Use a component where styles are not necessarily used on a JSX element. |
| 29 | + * For further details [read the documentation](https://compiledcssinjs.com/docs/api-class-names). |
| 30 | + * |
| 31 | + * ### Style with objects |
| 32 | + * @example ``` |
25 | 33 | * <ClassNames>
|
26 | 34 | * {({ css, style }) => children({ className: css({ fontSize: 12 }) })}
|
27 | 35 | * </ClassNames>
|
| 36 | + * ``` |
28 | 37 | *
|
29 |
| - * // Template literal CSS |
| 38 | + * ### Style with template literals |
| 39 | + * @example ``` |
30 | 40 | * <ClassNames>
|
31 | 41 | * {({ css, style }) => children({ className: css`font-size: 12px;` })}
|
32 | 42 | * </ClassNames>
|
| 43 | + * ``` |
33 | 44 | *
|
34 |
| - * // Array CSS |
| 45 | + * ### Compose styles with arrays |
| 46 | + * @example ``` |
35 | 47 | * <ClassNames>
|
36 | 48 | * {({ css, style }) =>
|
37 |
| - * children({ className: css([{ fontSize: 12 }, `font-size: 12px`]) })} |
| 49 | + * children({ className: css([{ fontSize: 12 }, css`font-size: 12px`]) })} |
38 | 50 | * </ClassNames>
|
39 | 51 | * ```
|
40 |
| - * |
41 |
| - * For more help, read the docs: |
42 |
| - * https://compiledcssinjs.com/docs/api-class-names |
43 |
| - * @param props |
44 | 52 | */
|
45 |
| -declare export function ClassNames(_: ClassNamesProps): React$Node; |
| 53 | +declare export function ClassNames<TProps>(x: ClassNamesProps<TProps>): React$Node; |
| 54 | +declare export {}; |
0 commit comments