@primer/react-brand 0.3.0 → 0.4.0-rc.420e2e9
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/CHANGELOG.md +198 -0
- package/README.md +25 -9
- package/lib/Accordion/Accordion.d.ts +9 -9
- package/lib/Accordion/Accordion.visual.spec.d.ts +1 -0
- package/lib/Button/Button.d.ts +6 -2
- package/lib/Button/Button.visual.spec.d.ts +1 -0
- package/lib/ExpandableArrow/ExpandableArrow.visual.spec.d.ts +1 -0
- package/lib/FAQ/FAQ.d.ts +14 -15
- package/lib/FAQ/FAQ.visual.spec.d.ts +1 -0
- package/lib/Heading/Heading.d.ts +4 -3
- package/lib/Heading/Heading.visual.spec.d.ts +1 -0
- package/lib/Hero/Hero.d.ts +3 -3
- package/lib/Hero/Hero.visual.spec.d.ts +1 -0
- package/lib/InlineLink/InlineLink.d.ts +4 -7
- package/lib/InlineLink/InlineLink.visual.spec.d.ts +1 -0
- package/lib/Link/Link.visual.spec.d.ts +1 -0
- package/lib/MonaSans/MonaSans.visual.spec.d.ts +1 -0
- package/lib/River/River.d.ts +52 -16
- package/lib/River/River.visual.spec.d.ts +1 -0
- package/lib/Text/Text.visual.spec.d.ts +1 -0
- package/lib/ThemeProvider/ThemeProvider.visual.spec.d.ts +1 -0
- package/lib/component-helpers.d.ts +21 -3
- package/lib/css/main.css +788 -19
- package/lib/css/stylesheets.d.ts +1 -0
- package/lib/design-tokens/css/tokens/base/colors/color-scales-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/base/colors/color-scales.css +1 -1
- package/lib/design-tokens/css/tokens/base/size/size.css +1 -1
- package/lib/design-tokens/css/tokens/base/typography/typography.css +1 -1
- package/lib/design-tokens/css/tokens/functional/colors/global-with-modes.css +25 -1
- package/lib/design-tokens/css/tokens/functional/colors/global.css +9 -1
- package/lib/design-tokens/css/tokens/functional/components/accordion/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/button/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/control/base.css +18 -0
- package/lib/design-tokens/css/tokens/functional/components/control/colors-with-modes.css +55 -0
- package/lib/design-tokens/css/tokens/functional/components/faq/base.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/faq/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/faq/colors.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/hero/base.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/inline-link/colors-with-modes.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/inline-link/colors.css +1 -1
- package/lib/design-tokens/css/tokens/functional/components/river/base.css +1 -1
- package/lib/design-tokens/css/tokens/functional/size/border.css +1 -1
- package/lib/design-tokens/css/tokens/functional/size/breakpoints.css +1 -1
- package/lib/design-tokens/css/tokens/functional/size/size-coarse.css +1 -1
- package/lib/design-tokens/css/tokens/functional/size/size-fine.css +1 -1
- package/lib/design-tokens/css/tokens/functional/size/size.css +3 -5
- package/lib/design-tokens/css/tokens/functional/typography/typography-responsive.css +1 -1
- package/lib/design-tokens/css/tokens/functional/typography/typography.css +1 -1
- package/lib/design-tokens/js/module/tokens/base/colors/color-scales.js +1 -1
- package/lib/design-tokens/js/module/tokens/base/size/size.js +1 -1
- package/lib/design-tokens/js/module/tokens/base/typography/typography.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/colors/global.js +149 -1
- package/lib/design-tokens/js/module/tokens/functional/components/control/base.js +195 -0
- package/lib/design-tokens/js/module/tokens/functional/components/faq/base.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/faq/colors.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/hero/base.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/inline-link/colors.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/components/river/base.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/size/border.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/size/breakpoints.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/size/size-coarse.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/size/size-fine.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/size/size.js +3 -35
- package/lib/design-tokens/js/module/tokens/functional/size/viewport.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/typography/typography-responsive.js +1 -1
- package/lib/design-tokens/js/module/tokens/functional/typography/typography.js +1 -1
- package/lib/design-tokens/js/tokens/base/colors/color-scales.js +1 -1
- package/lib/design-tokens/js/tokens/base/size/size.js +1 -1
- package/lib/design-tokens/js/tokens/base/typography/typography.js +1 -1
- package/lib/design-tokens/js/tokens/functional/colors/global.js +9 -1
- package/lib/design-tokens/js/tokens/functional/components/control/base.js +16 -0
- package/lib/design-tokens/js/tokens/functional/components/faq/base.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/faq/colors.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/hero/base.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/inline-link/colors.js +1 -1
- package/lib/design-tokens/js/tokens/functional/components/river/base.js +1 -1
- package/lib/design-tokens/js/tokens/functional/size/border.js +1 -1
- package/lib/design-tokens/js/tokens/functional/size/breakpoints.js +1 -1
- package/lib/design-tokens/js/tokens/functional/size/size-coarse.js +1 -1
- package/lib/design-tokens/js/tokens/functional/size/size-fine.js +1 -1
- package/lib/design-tokens/js/tokens/functional/size/size.js +3 -5
- package/lib/design-tokens/js/tokens/functional/size/viewport.js +1 -1
- package/lib/design-tokens/js/tokens/functional/typography/typography-responsive.js +1 -1
- package/lib/design-tokens/js/tokens/functional/typography/typography.js +1 -1
- package/lib/design-tokens/ts/tokens/base/colors/color-scales.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/base/colors/color-scales.js +1 -1
- package/lib/design-tokens/ts/tokens/base/size/size.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/base/size/size.js +1 -1
- package/lib/design-tokens/ts/tokens/base/typography/typography.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/base/typography/typography.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/colors/global.d.ts +13 -1
- package/lib/design-tokens/ts/tokens/functional/colors/global.js +13 -1
- package/lib/design-tokens/ts/tokens/functional/components/control/base.d.ts +31 -0
- package/lib/design-tokens/ts/tokens/functional/components/control/base.js +30 -0
- package/lib/design-tokens/ts/tokens/functional/components/faq/base.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/faq/base.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/faq/colors.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/faq/colors.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/hero/base.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/hero/base.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/inline-link/colors.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/inline-link/colors.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/river/base.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/components/river/base.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/size/border.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/size/border.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/size/breakpoints.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/size/breakpoints.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/size/size-coarse.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/size/size-coarse.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/size/size-fine.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/size/size-fine.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/size/size.d.ts +1 -3
- package/lib/design-tokens/ts/tokens/functional/size/size.js +3 -5
- package/lib/design-tokens/ts/tokens/functional/size/viewport.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/size/viewport.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/typography/typography-responsive.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/typography/typography-responsive.js +1 -1
- package/lib/design-tokens/ts/tokens/functional/typography/typography.d.ts +1 -1
- package/lib/design-tokens/ts/tokens/functional/typography/typography.js +1 -1
- package/lib/forms/Checkbox/Checkbox.d.ts +57 -0
- package/lib/forms/Checkbox/forms.visual.spec.d.ts +1 -0
- package/lib/forms/Checkbox/index.d.ts +1 -0
- package/lib/forms/FormControl/FormControl.d.ts +57 -0
- package/lib/forms/FormControl/forms.visual.spec.d.ts +1 -0
- package/lib/forms/FormControl/index.d.ts +1 -0
- package/lib/forms/Select/Select.d.ts +58 -0
- package/lib/forms/Select/index.d.ts +1 -0
- package/lib/forms/TextInput/TextInput.d.ts +87 -0
- package/lib/forms/TextInput/index.d.ts +1 -0
- package/lib/forms/form-types.d.ts +2 -0
- package/lib/forms/index.d.ts +10 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -1
- package/package.json +26 -9
package/lib/River/River.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
2
|
import { HeadingTags, LinkProps, HeadingProps, TextProps } from '../';
|
|
3
|
+
import type { BaseProps } from '../component-helpers';
|
|
3
4
|
import '../../lib/design-tokens/css/tokens/functional/components/river/base.css';
|
|
4
|
-
export declare type RiverProps = {
|
|
5
|
+
export declare type RiverProps = BaseProps<HTMLElement> & {
|
|
5
6
|
/**
|
|
6
7
|
* Only specific children are valid.
|
|
7
8
|
* These include: `River.Visual` and `River.Content`.
|
|
@@ -9,10 +10,6 @@ export declare type RiverProps = {
|
|
|
9
10
|
* to enforce correct HTML semantics.
|
|
10
11
|
*/
|
|
11
12
|
children: React.ReactElement<RiverVisualProps | RiverContentProps>[];
|
|
12
|
-
/**
|
|
13
|
-
* Apply a custom classname that will be forwarded to the root River element.
|
|
14
|
-
*/
|
|
15
|
-
className?: string;
|
|
16
13
|
/**
|
|
17
14
|
* Apply an alternative image to text column ratio. The default is `50:50`.
|
|
18
15
|
*/
|
|
@@ -24,8 +21,7 @@ export declare type RiverProps = {
|
|
|
24
21
|
};
|
|
25
22
|
export declare const defaultRiverImageTextRatio = "50:50";
|
|
26
23
|
export declare const defaultRiverAlign = "start";
|
|
27
|
-
declare
|
|
28
|
-
declare type RiverContentProps = {
|
|
24
|
+
declare type RiverContentProps = BaseProps<HTMLDivElement> & {
|
|
29
25
|
/**
|
|
30
26
|
* Escape-hatch for inserting custom React components.
|
|
31
27
|
* Warning:
|
|
@@ -49,21 +45,61 @@ declare type RiverContentProps = {
|
|
|
49
45
|
children: React.ReactElement<TextProps> | React.ReactElement<HeadingProps | TextProps | LinkProps>[];
|
|
50
46
|
};
|
|
51
47
|
export declare const getHeadingWarning: (size: (typeof HeadingTags)[number]) => string;
|
|
52
|
-
declare
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
declare type RiverVisualProps = BaseProps<HTMLDivElement> & PropsWithChildren<{
|
|
49
|
+
/**
|
|
50
|
+
* Applies automatic size constraints to child images and video.
|
|
51
|
+
* This can be disabled by setting this prop to `false`.
|
|
52
|
+
*/
|
|
53
|
+
fillMedia?: boolean;
|
|
55
54
|
/**
|
|
56
55
|
* `img` and `video` elements will apply a shadow by default.
|
|
57
56
|
* This can be disabled by setting this prop to `false`.
|
|
58
57
|
*/
|
|
59
58
|
hasShadow?: boolean;
|
|
60
|
-
}
|
|
61
|
-
declare function Visual({ children, className, hasShadow }: React.PropsWithChildren<RiverVisualProps>): JSX.Element;
|
|
59
|
+
}>;
|
|
62
60
|
/**
|
|
63
61
|
* Alternating text and image pairs.
|
|
64
62
|
*/
|
|
65
|
-
export declare const River:
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
export declare const River: React.ForwardRefExoticComponent<Pick<BaseProps<HTMLElement> & {
|
|
64
|
+
/**
|
|
65
|
+
* Only specific children are valid.
|
|
66
|
+
* These include: `River.Visual` and `River.Content`.
|
|
67
|
+
* The declarative order of the children will be ignored in the rendered output
|
|
68
|
+
* to enforce correct HTML semantics.
|
|
69
|
+
*/
|
|
70
|
+
children: React.ReactElement<RiverVisualProps | RiverContentProps>[];
|
|
71
|
+
/**
|
|
72
|
+
* Apply an alternative image to text column ratio. The default is `50:50`.
|
|
73
|
+
*/
|
|
74
|
+
imageTextRatio?: "60:40" | "50:50" | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Adjust the order of the `Content` column. The default is `start`.
|
|
77
|
+
*/
|
|
78
|
+
align?: "start" | "center" | "end" | undefined;
|
|
79
|
+
}, "children" | "className" | "align" | "id" | "imageTextRatio"> & React.RefAttributes<HTMLElement>> & {
|
|
80
|
+
Visual: React.ForwardRefExoticComponent<Pick<RiverVisualProps, "children" | "className" | "id" | "fillMedia" | "hasShadow"> & React.RefAttributes<HTMLDivElement>>;
|
|
81
|
+
Content: React.ForwardRefExoticComponent<Pick<BaseProps<HTMLDivElement> & {
|
|
82
|
+
/**
|
|
83
|
+
* Escape-hatch for inserting custom React components.
|
|
84
|
+
* Warning:
|
|
85
|
+
* This prop isn't advertised in our docs but remains part of the public API for edge-cases.
|
|
86
|
+
* Need to use this prop? Please check in with #primer-brand first to confirm correct usage.
|
|
87
|
+
*/
|
|
88
|
+
trailingComponent?: React.FunctionComponent<{}> | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* Escape-hatch for inserting custom React components.
|
|
91
|
+
* Warning:
|
|
92
|
+
* This prop isn't advertised in our docs but remains part of the public API for edge-cases.
|
|
93
|
+
* Need to use this prop? Please check in with #primer-brand first to confirm correct usage.
|
|
94
|
+
*/
|
|
95
|
+
leadingComponent?: React.FunctionComponent<{}> | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Only valid children are allowed.
|
|
98
|
+
* These include: `Heading`, `Text` and `Link`.
|
|
99
|
+
* The declarative order of the children will be ignored in the rendered output
|
|
100
|
+
* to enforce correct HTML semantics.
|
|
101
|
+
*/
|
|
102
|
+
children: React.ReactElement<TextProps> | React.ReactElement<HeadingProps | TextProps | LinkProps>[];
|
|
103
|
+
}, "children" | "className" | "id" | "leadingComponent" | "trailingComponent"> & React.RefAttributes<HTMLDivElement>>;
|
|
68
104
|
};
|
|
69
105
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
import React, { Ref } from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* Layout
|
|
4
4
|
*/
|
|
5
|
-
export declare const Container: ({ children }: {
|
|
6
|
-
children:
|
|
5
|
+
export declare const Container: ({ children, style }: {
|
|
6
|
+
children: React.ReactElement[] | React.ReactElement;
|
|
7
|
+
style?: React.CSSProperties | undefined;
|
|
7
8
|
}) => JSX.Element;
|
|
9
|
+
/**
|
|
10
|
+
* Base Types
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Component helper type to be extended by component types, e.g.:
|
|
14
|
+
* type CustomComponentProps = BaseProps<HTMLDivElement> & { ... }
|
|
15
|
+
*
|
|
16
|
+
* Example use:
|
|
17
|
+
* const CustomComponent = forwardRef<HTMLDivElement, CustomComponentProps>(({className, ...props}, ref) => { ... })
|
|
18
|
+
* // OR:
|
|
19
|
+
* const CustomComponent = forwardRef(({className: CustomComponentProps, ...props}, ref: Ref<HTMLDivElement>) => { ... })
|
|
20
|
+
*/
|
|
21
|
+
export declare type BaseProps<T> = {
|
|
22
|
+
className?: string;
|
|
23
|
+
id?: string;
|
|
24
|
+
ref?: Ref<T>;
|
|
25
|
+
};
|