@primer/react-brand 0.1.0-rc.c341bbe → 0.2.0-rc.c749f63

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.
Files changed (89) hide show
  1. package/CHANGELOG.md +116 -3
  2. package/fonts/alliance-1.woff2 +0 -0
  3. package/fonts/alliance-2.woff2 +0 -0
  4. package/lib/Button/Button.d.ts +7 -0
  5. package/lib/Button/index.d.ts +1 -0
  6. package/lib/Heading/Heading.d.ts +1 -1
  7. package/lib/Hero/Hero.d.ts +2 -2
  8. package/lib/Link/Link.d.ts +9 -0
  9. package/lib/Link/index.d.ts +1 -0
  10. package/lib/River/River.d.ts +69 -0
  11. package/lib/River/index.d.ts +1 -0
  12. package/lib/Text/Text.d.ts +1 -1
  13. package/lib/component-helpers.d.ts +7 -0
  14. package/lib/css/main.css +1112 -1064
  15. package/lib/css/stylesheets.d.ts +2 -1
  16. package/lib/design-tokens/css/tokens/base/colors/color-scales-with-modes.css +805 -0
  17. package/lib/design-tokens/css/tokens/base/colors/color-scales.css +139 -0
  18. package/lib/design-tokens/css/tokens/base/size/size.css +1 -1
  19. package/lib/design-tokens/css/tokens/base/typography/typography.css +1 -1
  20. package/lib/design-tokens/css/tokens/functional/colors/global-with-modes.css +58 -0
  21. package/lib/design-tokens/css/tokens/functional/colors/global.css +22 -0
  22. package/lib/design-tokens/css/tokens/functional/components/button/colors-with-modes.css +28 -0
  23. package/lib/design-tokens/css/tokens/functional/components/hero/base.css +9 -0
  24. package/lib/design-tokens/css/tokens/functional/components/river/base.css +12 -0
  25. package/lib/design-tokens/css/tokens/functional/size/border.css +1 -1
  26. package/lib/design-tokens/css/tokens/functional/size/breakpoints.css +1 -1
  27. package/lib/design-tokens/css/tokens/functional/size/size-coarse.css +1 -1
  28. package/lib/design-tokens/css/tokens/functional/size/size-fine.css +1 -1
  29. package/lib/design-tokens/css/tokens/functional/size/size.css +1 -1
  30. package/lib/design-tokens/css/tokens/functional/typography/typography-responsive.css +1 -1
  31. package/lib/design-tokens/css/tokens/functional/typography/typography.css +1 -1
  32. package/lib/design-tokens/js/module/tokens/base/colors/color-scales.js +2551 -0
  33. package/lib/design-tokens/js/module/tokens/base/size/size.js +1 -1
  34. package/lib/design-tokens/js/module/tokens/base/typography/typography.js +1 -1
  35. package/lib/design-tokens/js/module/tokens/functional/colors/global.js +289 -0
  36. package/lib/design-tokens/js/module/tokens/functional/components/hero/base.js +47 -0
  37. package/lib/design-tokens/js/module/tokens/functional/components/river/base.js +107 -0
  38. package/lib/design-tokens/js/module/tokens/functional/size/border.js +1 -1
  39. package/lib/design-tokens/js/module/tokens/functional/size/breakpoints.js +1 -1
  40. package/lib/design-tokens/js/module/tokens/functional/size/size-coarse.js +1 -1
  41. package/lib/design-tokens/js/module/tokens/functional/size/size-fine.js +1 -1
  42. package/lib/design-tokens/js/module/tokens/functional/size/size.js +1 -1
  43. package/lib/design-tokens/js/module/tokens/functional/size/viewport.js +1 -1
  44. package/lib/design-tokens/js/module/tokens/functional/typography/typography.js +1 -1
  45. package/lib/design-tokens/js/tokens/base/colors/color-scales.js +137 -0
  46. package/lib/design-tokens/js/tokens/base/size/size.js +1 -1
  47. package/lib/design-tokens/js/tokens/base/typography/typography.js +1 -1
  48. package/lib/design-tokens/js/tokens/functional/colors/global.js +20 -0
  49. package/lib/design-tokens/js/tokens/functional/components/hero/base.js +7 -0
  50. package/lib/design-tokens/js/tokens/functional/components/river/base.js +10 -0
  51. package/lib/design-tokens/js/tokens/functional/size/border.js +1 -1
  52. package/lib/design-tokens/js/tokens/functional/size/breakpoints.js +1 -1
  53. package/lib/design-tokens/js/tokens/functional/size/size-coarse.js +1 -1
  54. package/lib/design-tokens/js/tokens/functional/size/size-fine.js +1 -1
  55. package/lib/design-tokens/js/tokens/functional/size/size.js +1 -1
  56. package/lib/design-tokens/js/tokens/functional/size/viewport.js +1 -1
  57. package/lib/design-tokens/js/tokens/functional/typography/typography.js +1 -1
  58. package/lib/design-tokens/ts/tokens/base/colors/color-scales.d.ts +176 -0
  59. package/lib/design-tokens/ts/tokens/base/colors/color-scales.js +175 -0
  60. package/lib/design-tokens/ts/tokens/base/size/size.d.ts +1 -1
  61. package/lib/design-tokens/ts/tokens/base/size/size.js +1 -1
  62. package/lib/design-tokens/ts/tokens/base/typography/typography.d.ts +1 -1
  63. package/lib/design-tokens/ts/tokens/base/typography/typography.js +1 -1
  64. package/lib/design-tokens/ts/tokens/functional/colors/global.d.ts +35 -0
  65. package/lib/design-tokens/ts/tokens/functional/colors/global.js +34 -0
  66. package/lib/design-tokens/ts/tokens/functional/components/hero/base.d.ts +18 -0
  67. package/lib/design-tokens/ts/tokens/functional/components/hero/base.js +17 -0
  68. package/lib/design-tokens/ts/tokens/functional/components/river/base.d.ts +29 -0
  69. package/lib/design-tokens/ts/tokens/functional/components/river/base.js +28 -0
  70. package/lib/design-tokens/ts/tokens/functional/size/border.d.ts +1 -1
  71. package/lib/design-tokens/ts/tokens/functional/size/border.js +1 -1
  72. package/lib/design-tokens/ts/tokens/functional/size/breakpoints.d.ts +1 -1
  73. package/lib/design-tokens/ts/tokens/functional/size/breakpoints.js +1 -1
  74. package/lib/design-tokens/ts/tokens/functional/size/size-coarse.d.ts +1 -1
  75. package/lib/design-tokens/ts/tokens/functional/size/size-coarse.js +1 -1
  76. package/lib/design-tokens/ts/tokens/functional/size/size-fine.d.ts +1 -1
  77. package/lib/design-tokens/ts/tokens/functional/size/size-fine.js +1 -1
  78. package/lib/design-tokens/ts/tokens/functional/size/size.d.ts +1 -1
  79. package/lib/design-tokens/ts/tokens/functional/size/size.js +1 -1
  80. package/lib/design-tokens/ts/tokens/functional/size/viewport.d.ts +1 -1
  81. package/lib/design-tokens/ts/tokens/functional/size/viewport.js +1 -1
  82. package/lib/design-tokens/ts/tokens/functional/typography/typography.d.ts +1 -1
  83. package/lib/design-tokens/ts/tokens/functional/typography/typography.js +1 -1
  84. package/lib/index.d.ts +3 -0
  85. package/lib/index.js +1 -1
  86. package/package.json +14 -14
  87. package/lib/LinkButton/LinkButton.d.ts +0 -6
  88. package/lib/LinkButton/index.d.ts +0 -1
  89. package/lib/css/gh-variables.color.css +0 -1049
package/CHANGELOG.md CHANGED
@@ -1,5 +1,104 @@
1
1
  # @primer/react-brand
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#33](https://github.com/primer/react-brand/pull/33) [`662fcfc`](https://github.com/primer/react-brand/commit/662fcfc6d123460730317b7ddd3d3a4622d30dce) Thanks [@rezrah](https://github.com/rezrah)! - - Adds `River` component
8
+
9
+ - Renames `LinkButton` to `Button` :warning: (see below)
10
+ - Button supports polymorphism and can be used `as` either `a` or `button`
11
+
12
+ ### `River`
13
+
14
+ **NEW** Component :sparkles:
15
+
16
+ <table>
17
+ <tr>
18
+ <th> Before</th> <th> After</th>
19
+ </tr>
20
+ <tr>
21
+ <td valign="top">❌</td>
22
+ <td valign="top">
23
+
24
+ ```jsx
25
+ import {River} from '@primer/react-brand'
26
+
27
+ ;<River>
28
+ <River.Visual>
29
+ <img
30
+ src="https://via.placeholder.com/600x400/f5f5f5/f5f5f5.png"
31
+ alt="placeholder, blank area with an off-white background color"
32
+ />
33
+ </River.Visual>
34
+ <River.Content>
35
+ <Heading>Heading</Heading>
36
+ <Text>
37
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sapien sit ullamcorper id. Aliquam luctus sed turpis
38
+ felis nam pulvinar risus elementum.
39
+ </Text>
40
+ <Link href="#">Call to action</Link>
41
+ </River.Content>
42
+ </River>
43
+ ```
44
+
45
+ </td>
46
+ </tr>
47
+ </table>
48
+
49
+ See more examples in our documentation.
50
+ https://primer.style/react-brand/components/River
51
+
52
+ ### `LinkButton`
53
+
54
+ > **Warning**
55
+ > The changes below should be considered a breaking change for anyone relying on `LinkButton`, but as we are shipping a pre-v1 library, this has been marked as a `minor` release rather than `major`. Please remember to update your usage per the below example.
56
+
57
+ <table>
58
+ <tr>
59
+ <th> Before</th> <th> After</th>
60
+ </tr>
61
+ <tr>
62
+ <td valign="top">
63
+
64
+ ```jsx
65
+ //import { LinkButton } from '@primer/react-brand';
66
+
67
+ <LinkButton href="#">Sign up</LinkButton>
68
+ ```
69
+
70
+ </td>
71
+ <td valign="top">
72
+
73
+ ```jsx
74
+ //import { Button } from '@primer/react-brand';
75
+
76
+ <Button as="a" href="#">
77
+ Sign up
78
+ </Button>
79
+ ```
80
+
81
+ </td>
82
+ </tr>
83
+ <tr>
84
+ <td valign="top">
85
+
86
+ ❌
87
+
88
+ </td>
89
+ <td valign="top">
90
+
91
+ ```jsx
92
+ //import { Button } from '@primer/react-brand';
93
+
94
+ <Button onClick={handler}>Sign Up</Button>
95
+ ```
96
+
97
+ </td>
98
+ </tr>
99
+
100
+ </table>
101
+
3
102
  ## 0.1.0
4
103
 
5
104
  ### Minor Changes
@@ -10,11 +109,25 @@
10
109
 
11
110
  - [#23](https://github.com/primer/react-brand/pull/23) [`77abf53`](https://github.com/primer/react-brand/commit/77abf535e77ef26fa29fb09d6d2dfb746f4bc383) Thanks [@rezrah](https://github.com/rezrah)! - add Text and Heading components
12
111
 
13
- * [#23](https://github.com/primer/react-brand/pull/23) [`77abf53`](https://github.com/primer/react-brand/commit/77abf535e77ef26fa29fb09d6d2dfb746f4bc383) Thanks [@rezrah](https://github.com/rezrah)! - forward className in Hero
112
+ * [#29](https://github.com/primer/react-brand/pull/29) [`144c7d7`](https://github.com/primer/react-brand/commit/144c7d762a91cb691699e4f8923ab08385c77966) Thanks [@rezrah](https://github.com/rezrah)! - Removed `gh-variables.css` from package as Brand variables are now surfaced in main.css
113
+
114
+ **To upgrade:**
115
+
116
+ - _Remove_ `import "@primer/react-brand/lib/css/gh-variables.css"`
117
+
118
+ - _Add_ `import "@primer/react-brand/lib/css/main.css"`
119
+
120
+ - [#23](https://github.com/primer/react-brand/pull/23) [`77abf53`](https://github.com/primer/react-brand/commit/77abf535e77ef26fa29fb09d6d2dfb746f4bc383) Thanks [@rezrah](https://github.com/rezrah)! - forward className in Hero
121
+
122
+ * [#25](https://github.com/primer/react-brand/pull/25) [`4b00b72`](https://github.com/primer/react-brand/commit/4b00b72f5dbf5e578351ea77e1e74cddc69833e7) Thanks [@rezrah](https://github.com/rezrah)! - adds baseline tokens
123
+
124
+ - [#21](https://github.com/primer/react-brand/pull/21) [`ab06cce`](https://github.com/primer/react-brand/commit/ab06cceb6ed3b2eaca70f9738b9708343b4e6db9) Thanks [@rezrah](https://github.com/rezrah)! - Remove fixed background color from `Hero` to allow underlying customisation to be surfaced.
14
125
 
15
- - [#25](https://github.com/primer/react-brand/pull/25) [`4b00b72`](https://github.com/primer/react-brand/commit/4b00b72f5dbf5e578351ea77e1e74cddc69833e7) Thanks [@rezrah](https://github.com/rezrah)! - adds baseline tokens
126
+ * [#27](https://github.com/primer/react-brand/pull/27) [`ca2d300`](https://github.com/primer/react-brand/commit/ca2d3002ba6f7ca9c719f80077c4d95246f33410) Thanks [@rezrah](https://github.com/rezrah)! - Updated Hero text appearance
16
127
 
17
- * [#21](https://github.com/primer/react-brand/pull/21) [`ab06cce`](https://github.com/primer/react-brand/commit/ab06cceb6ed3b2eaca70f9738b9708343b4e6db9) Thanks [@rezrah](https://github.com/rezrah)! - Remove fixed background color from `Hero` to allow underlying customisation to be surfaced.
128
+ - **updated** Hero description text size from `500` to `400`
129
+ - **updated** button alignment to not stretch on mobile viewports
130
+ - **removed** `size` prop. Now only one responsive size available.
18
131
 
19
132
  ## 0.0.3
20
133
 
Binary file
Binary file
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import '../../lib/design-tokens/css/tokens/functional/components/button/colors-with-modes.css';
3
+ export declare type ButtonProps<C extends React.ElementType> = {
4
+ as?: C;
5
+ variant?: 'primary' | 'secondary';
6
+ } & React.ComponentPropsWithoutRef<C>;
7
+ export declare function Button<C extends React.ElementType>({ as, variant, className, children, onMouseEnter, onMouseLeave, onFocus, onBlur, ...props }: ButtonProps<C>): JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './Button';
@@ -13,7 +13,7 @@ export declare const classMap: {
13
13
  declare type HeadingTags = {
14
14
  as?: typeof HeadingTags[number];
15
15
  } & React.HTMLAttributes<HTMLHeadingElement>;
16
- declare type HeadingProps = {
16
+ export declare type HeadingProps = {
17
17
  className?: string;
18
18
  } & HeadingTags;
19
19
  export declare function Heading({ className, children, as, ...rest }: PropsWithChildren<HeadingProps>): JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import '../../lib/design-tokens/css/tokens/functional/components/hero/base.css';
2
3
  declare type Action = {
3
4
  text: string;
4
5
  href: string;
@@ -10,7 +11,6 @@ export declare type HeroProps = {
10
11
  primaryAction: Action;
11
12
  secondaryAction?: Action;
12
13
  align?: 'start' | 'center';
13
- size?: 'small' | 'large';
14
14
  };
15
- export declare function Hero({ className, heading, description, primaryAction, secondaryAction, align, size }: HeroProps): JSX.Element;
15
+ export declare function Hero({ className, heading, description, primaryAction, secondaryAction, align }: HeroProps): JSX.Element;
16
16
  export {};
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ export declare type LinkProps = {
3
+ size?: 'medium' | 'large';
4
+ } & React.ComponentPropsWithoutRef<'a'>;
5
+ /**
6
+ * Links connect users to related content.
7
+ * These are not intended to be used as a call-to-action.
8
+ */
9
+ export declare function Link({ size, className, children, onMouseEnter, onMouseLeave, onFocus, onBlur, ...props }: LinkProps): JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './Link';
@@ -0,0 +1,69 @@
1
+ import React from 'react';
2
+ import { HeadingTags, LinkProps, HeadingProps, TextProps } from '../';
3
+ import '../../lib/design-tokens/css/tokens/functional/components/river/base.css';
4
+ export declare type RiverProps = {
5
+ /**
6
+ * Only specific children are valid.
7
+ * These include: `River.Visual` and `River.Content`.
8
+ * The declarative order of the children will be ignored in the rendered output
9
+ * to enforce correct HTML semantics.
10
+ */
11
+ 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
+ /**
17
+ * Apply an alternative image to text column ratio. The default is `50:50`.
18
+ */
19
+ imageTextRatio?: '60:40' | '50:50';
20
+ /**
21
+ * Adjust the order of the `Content` column. The default is `left`.
22
+ */
23
+ align?: 'left' | 'right' | 'center';
24
+ };
25
+ export declare const defaultRiverImageTextRatio = "50:50";
26
+ export declare const defaultRiverAlign = "left";
27
+ declare function Root({ imageTextRatio, align, className, children, ...rest }: RiverProps): JSX.Element;
28
+ declare type RiverContentProps = {
29
+ /**
30
+ * Escape-hatch for inserting custom React components.
31
+ * Warning:
32
+ * This prop isn't advertised in our docs but remains part of the public API for edge-cases.
33
+ * Need to use this prop? Please check in with #primer-brand first to confirm correct usage.
34
+ */
35
+ trailingComponent?: React.FunctionComponent;
36
+ /**
37
+ * Escape-hatch for inserting custom React components.
38
+ * Warning:
39
+ * This prop isn't advertised in our docs but remains part of the public API for edge-cases.
40
+ * Need to use this prop? Please check in with #primer-brand first to confirm correct usage.
41
+ */
42
+ leadingComponent?: React.FunctionComponent;
43
+ /**
44
+ * Only valid children are allowed.
45
+ * These include: `Heading`, `Text` and `Link`.
46
+ * The declarative order of the children will be ignored in the rendered output
47
+ * to enforce correct HTML semantics.
48
+ */
49
+ children: React.ReactElement<TextProps> | React.ReactElement<HeadingProps | TextProps | LinkProps>[];
50
+ };
51
+ export declare const getHeadingWarning: (size: (typeof HeadingTags)[number]) => string;
52
+ declare function Content({ children, leadingComponent: LeadingComponent, trailingComponent: TrailingComponent }: RiverContentProps): JSX.Element;
53
+ declare type RiverVisualProps = {
54
+ className?: string;
55
+ /**
56
+ * `img` and `video` elements will apply a shadow by default.
57
+ * This can be disabled by setting this prop to `false`.
58
+ */
59
+ hasShadow?: boolean;
60
+ };
61
+ declare function Visual({ children, className, hasShadow }: React.PropsWithChildren<RiverVisualProps>): JSX.Element;
62
+ /**
63
+ * Alternating text and image pairs.
64
+ */
65
+ export declare const River: typeof Root & {
66
+ Visual: typeof Visual;
67
+ Content: typeof Content;
68
+ };
69
+ export {};
@@ -0,0 +1 @@
1
+ export * from './River';
@@ -18,7 +18,7 @@ declare type TextTags = {
18
18
  */
19
19
  as?: typeof TextTags[number];
20
20
  } & RestrictedPolymorphism;
21
- declare type TextProps = {
21
+ export declare type TextProps = {
22
22
  /**
23
23
  * Forward a custom HTML class attribute
24
24
  */
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * Layout
4
+ */
5
+ export declare const Container: ({ children }: {
6
+ children: any;
7
+ }) => JSX.Element;