@primer/react-brand 0.0.4-rc.f3728d0 → 0.1.0-rc.0c7d40e
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 +8 -2
- package/lib/Hero/Hero.d.ts +2 -1
- package/lib/css/gh-variables.color.css +32 -8
- package/lib/css/main.css +23 -4
- package/lib/design-tokens/css/tokens/base/size/size.css +24 -0
- package/lib/design-tokens/css/tokens/base/typography/typography.css +11 -0
- package/lib/design-tokens/css/tokens/functional/size/border.css +17 -0
- package/lib/design-tokens/css/tokens/functional/size/breakpoints.css +13 -0
- package/lib/design-tokens/css/tokens/functional/size/size-coarse.css +10 -0
- package/lib/design-tokens/css/tokens/functional/size/size-fine.css +10 -0
- package/lib/design-tokens/css/tokens/functional/size/size.css +54 -0
- package/lib/design-tokens/css/tokens/functional/size/viewport.css +6 -0
- package/lib/design-tokens/css/tokens/functional/typography/typography.css +8 -0
- package/lib/design-tokens/js/module/tokens/base/size/size.js +266 -0
- package/lib/design-tokens/js/module/tokens/base/typography/typography.js +77 -0
- package/lib/design-tokens/js/module/tokens/functional/size/border.js +165 -0
- package/lib/design-tokens/js/module/tokens/functional/size/breakpoints.js +101 -0
- package/lib/design-tokens/js/module/tokens/functional/size/size-coarse.js +73 -0
- package/lib/design-tokens/js/module/tokens/functional/size/size-fine.js +73 -0
- package/lib/design-tokens/js/module/tokens/functional/size/size.js +824 -0
- package/lib/design-tokens/js/module/tokens/functional/size/viewport.js +101 -0
- package/lib/design-tokens/js/module/tokens/functional/typography/typography.js +26 -0
- package/lib/design-tokens/js/tokens/base/size/size.js +22 -0
- package/lib/design-tokens/js/tokens/base/typography/typography.js +9 -0
- package/lib/design-tokens/js/tokens/functional/size/border.js +15 -0
- package/lib/design-tokens/js/tokens/functional/size/breakpoints.js +11 -0
- package/lib/design-tokens/js/tokens/functional/size/size-coarse.js +8 -0
- package/lib/design-tokens/js/tokens/functional/size/size-fine.js +8 -0
- package/lib/design-tokens/js/tokens/functional/size/size.js +52 -0
- package/lib/design-tokens/js/tokens/functional/size/viewport.js +11 -0
- package/lib/design-tokens/js/tokens/functional/typography/typography.js +6 -0
- package/lib/design-tokens/ts/tokens/base/size/size.d.ts +29 -0
- package/lib/design-tokens/ts/tokens/base/size/size.js +28 -0
- package/lib/design-tokens/ts/tokens/base/typography/typography.d.ts +18 -0
- package/lib/design-tokens/ts/tokens/base/typography/typography.js +17 -0
- package/lib/design-tokens/ts/tokens/functional/size/border.d.ts +26 -0
- package/lib/design-tokens/ts/tokens/functional/size/border.js +25 -0
- package/lib/design-tokens/ts/tokens/functional/size/breakpoints.d.ts +18 -0
- package/lib/design-tokens/ts/tokens/functional/size/breakpoints.js +17 -0
- package/lib/design-tokens/ts/tokens/functional/size/size-coarse.d.ts +27 -0
- package/lib/design-tokens/ts/tokens/functional/size/size-coarse.js +26 -0
- package/lib/design-tokens/ts/tokens/functional/size/size-fine.d.ts +27 -0
- package/lib/design-tokens/ts/tokens/functional/size/size-fine.js +26 -0
- package/lib/design-tokens/ts/tokens/functional/size/size.d.ts +101 -0
- package/lib/design-tokens/ts/tokens/functional/size/size.js +100 -0
- package/lib/design-tokens/ts/tokens/functional/size/viewport.d.ts +18 -0
- package/lib/design-tokens/ts/tokens/functional/size/viewport.js +17 -0
- package/lib/design-tokens/ts/tokens/functional/typography/typography.d.ts +13 -0
- package/lib/design-tokens/ts/tokens/functional/typography/typography.js +12 -0
- package/lib/index.js +1 -1
- package/package.json +11 -7
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Do not edit directly
|
|
3
|
+
* Generated on Thu, 28 Apr 2022 09:17:16 GMT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
declare const tokens: {
|
|
7
|
+
"brand": {
|
|
8
|
+
"control": {
|
|
9
|
+
"minTarget": {
|
|
10
|
+
"fine": string,
|
|
11
|
+
"coarse": string
|
|
12
|
+
},
|
|
13
|
+
"xsmall": {
|
|
14
|
+
"size": string,
|
|
15
|
+
"lineBoxHeight": string,
|
|
16
|
+
"paddingBlock": string,
|
|
17
|
+
"paddingInline": {
|
|
18
|
+
"condensed": string,
|
|
19
|
+
"normal": string,
|
|
20
|
+
"spacious": string
|
|
21
|
+
},
|
|
22
|
+
"gap": string
|
|
23
|
+
},
|
|
24
|
+
"small": {
|
|
25
|
+
"size": string,
|
|
26
|
+
"lineBoxHeight": string,
|
|
27
|
+
"paddingBlock": string,
|
|
28
|
+
"paddingInline": {
|
|
29
|
+
"condensed": string,
|
|
30
|
+
"normal": string
|
|
31
|
+
},
|
|
32
|
+
"gap": string
|
|
33
|
+
},
|
|
34
|
+
"medium": {
|
|
35
|
+
"size": string,
|
|
36
|
+
"lineBoxHeight": string,
|
|
37
|
+
"paddingBlock": string,
|
|
38
|
+
"paddingInline": {
|
|
39
|
+
"condensed": string,
|
|
40
|
+
"normal": string,
|
|
41
|
+
"spacious": string
|
|
42
|
+
},
|
|
43
|
+
"gap": string
|
|
44
|
+
},
|
|
45
|
+
"large": {
|
|
46
|
+
"size": string,
|
|
47
|
+
"lineBoxHeight": string,
|
|
48
|
+
"paddingBlock": string,
|
|
49
|
+
"paddingInline": {
|
|
50
|
+
"normal": string,
|
|
51
|
+
"spacious": string
|
|
52
|
+
},
|
|
53
|
+
"gap": string
|
|
54
|
+
},
|
|
55
|
+
"xlarge": {
|
|
56
|
+
"size": string,
|
|
57
|
+
"lineBoxHeight": string,
|
|
58
|
+
"paddingBlock": string,
|
|
59
|
+
"paddingInline": {
|
|
60
|
+
"normal": string,
|
|
61
|
+
"spacious": string
|
|
62
|
+
},
|
|
63
|
+
"gap": string
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"stack": {
|
|
67
|
+
"padding": {
|
|
68
|
+
"condensed": string,
|
|
69
|
+
"normal": string,
|
|
70
|
+
"spacious": string
|
|
71
|
+
},
|
|
72
|
+
"gap": {
|
|
73
|
+
"condensed": string,
|
|
74
|
+
"normal": string,
|
|
75
|
+
"spacious": string
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"controlStack": {
|
|
79
|
+
"small": {
|
|
80
|
+
"gap": {
|
|
81
|
+
"condensed": string,
|
|
82
|
+
"spacious": string
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"medium": {
|
|
86
|
+
"gap": {
|
|
87
|
+
"condensed": string,
|
|
88
|
+
"spacious": string
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"large": {
|
|
92
|
+
"gap": {
|
|
93
|
+
"auto": string,
|
|
94
|
+
"condensed": string,
|
|
95
|
+
"spacious": string
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
export default tokens;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Do not edit directly
|
|
3
|
+
* Generated on Thu, 28 Apr 2022 09:17:16 GMT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
"brand": {
|
|
8
|
+
"control": {
|
|
9
|
+
"minTarget": {
|
|
10
|
+
"fine": "1rem",
|
|
11
|
+
"coarse": "2.75rem"
|
|
12
|
+
},
|
|
13
|
+
"xsmall": {
|
|
14
|
+
"size": "1.5rem",
|
|
15
|
+
"lineBoxHeight": "1.25rem",
|
|
16
|
+
"paddingBlock": "calc((1.5rem - 1.25rem) / 2)",
|
|
17
|
+
"paddingInline": {
|
|
18
|
+
"condensed": "0.25rem",
|
|
19
|
+
"normal": "0.5rem",
|
|
20
|
+
"spacious": "0.75rem"
|
|
21
|
+
},
|
|
22
|
+
"gap": "0.25rem"
|
|
23
|
+
},
|
|
24
|
+
"small": {
|
|
25
|
+
"size": "1.75rem",
|
|
26
|
+
"lineBoxHeight": "1.25rem",
|
|
27
|
+
"paddingBlock": "calc((1.75rem - 1.25rem) / 2)",
|
|
28
|
+
"paddingInline": {
|
|
29
|
+
"condensed": "0.5rem",
|
|
30
|
+
"normal": "0.75rem"
|
|
31
|
+
},
|
|
32
|
+
"gap": "0.25rem"
|
|
33
|
+
},
|
|
34
|
+
"medium": {
|
|
35
|
+
"size": "2rem",
|
|
36
|
+
"lineBoxHeight": "1.25rem",
|
|
37
|
+
"paddingBlock": "calc((2rem - 1.25rem) / 2)",
|
|
38
|
+
"paddingInline": {
|
|
39
|
+
"condensed": "0.5rem",
|
|
40
|
+
"normal": "0.75rem",
|
|
41
|
+
"spacious": "1rem"
|
|
42
|
+
},
|
|
43
|
+
"gap": "0.5rem"
|
|
44
|
+
},
|
|
45
|
+
"large": {
|
|
46
|
+
"size": "2.5rem",
|
|
47
|
+
"lineBoxHeight": "1.25rem",
|
|
48
|
+
"paddingBlock": "calc((2.5rem - 1.25rem) / 2)",
|
|
49
|
+
"paddingInline": {
|
|
50
|
+
"normal": "0.75rem",
|
|
51
|
+
"spacious": "1rem"
|
|
52
|
+
},
|
|
53
|
+
"gap": "0.5rem"
|
|
54
|
+
},
|
|
55
|
+
"xlarge": {
|
|
56
|
+
"size": "3rem",
|
|
57
|
+
"lineBoxHeight": "1.25rem",
|
|
58
|
+
"paddingBlock": "calc((3rem - 1.25rem) / 2)",
|
|
59
|
+
"paddingInline": {
|
|
60
|
+
"normal": "0.75rem",
|
|
61
|
+
"spacious": "1rem"
|
|
62
|
+
},
|
|
63
|
+
"gap": "0.5rem"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"stack": {
|
|
67
|
+
"padding": {
|
|
68
|
+
"condensed": "0.5rem",
|
|
69
|
+
"normal": "1rem",
|
|
70
|
+
"spacious": "1.5rem"
|
|
71
|
+
},
|
|
72
|
+
"gap": {
|
|
73
|
+
"condensed": "0.5rem",
|
|
74
|
+
"normal": "1rem",
|
|
75
|
+
"spacious": "1.5rem"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"controlStack": {
|
|
79
|
+
"small": {
|
|
80
|
+
"gap": {
|
|
81
|
+
"condensed": "0.5rem",
|
|
82
|
+
"spacious": "1rem"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"medium": {
|
|
86
|
+
"gap": {
|
|
87
|
+
"condensed": "0.5rem",
|
|
88
|
+
"spacious": "0.75rem"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"large": {
|
|
92
|
+
"gap": {
|
|
93
|
+
"auto": "0.5rem",
|
|
94
|
+
"condensed": "0.5rem",
|
|
95
|
+
"spacious": "0.75rem"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Do not edit directly
|
|
3
|
+
* Generated on Thu, 28 Apr 2022 09:17:16 GMT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
declare const tokens: {
|
|
7
|
+
"brand": {
|
|
8
|
+
"viewportRange": {
|
|
9
|
+
"narrow": string,
|
|
10
|
+
"narrowLandscape": string,
|
|
11
|
+
"regular": string,
|
|
12
|
+
"wide": string,
|
|
13
|
+
"portrait": string,
|
|
14
|
+
"landscape": string
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export default tokens;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Do not edit directly
|
|
3
|
+
* Generated on Thu, 28 Apr 2022 09:17:16 GMT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
"brand": {
|
|
8
|
+
"viewportRange": {
|
|
9
|
+
"narrow": "(max-width: calc(48rem - 0.02px))",
|
|
10
|
+
"narrowLandscape": "(max-width: calc(63.25rem - 0.02px) and (max-height: calc(34rem - 0.02px)) and (orientation: landscape))",
|
|
11
|
+
"regular": "(min-width: 48rem)",
|
|
12
|
+
"wide": "(min-width: 90rem)",
|
|
13
|
+
"portrait": "(orientation: portrait)",
|
|
14
|
+
"landscape": "(orientation: landscape)"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Do not edit directly
|
|
3
|
+
* Generated on Thu, 28 Apr 2022 09:17:16 GMT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
"brand": {
|
|
8
|
+
"fontStack": {
|
|
9
|
+
"sansSerif": "Alliance No.1,-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
package/lib/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("react")):"function"==typeof define&&define.amd?define("@primer/react-brand",[],r):"object"==typeof exports?exports["@primer/react-brand"]=r(require("react")):e["@primer/react-brand"]=r(e.React)}(this,(function(e){return(()=>{"use strict";var r={418:e=>{var r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,t=Object.prototype.propertyIsEnumerable;function n(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var r={},o=0;o<10;o++)r["_"+String.fromCharCode(o)]=o;if("0123456789"!==Object.getOwnPropertyNames(r).map((function(e){return r[e]})).join(""))return!1;var t={};return"abcdefghijklmnopqrst".split("").forEach((function(e){t[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},t)).join("")}catch(e){return!1}}()?Object.assign:function(e,a){for(var i,s,
|
|
2
|
+
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("react")):"function"==typeof define&&define.amd?define("@primer/react-brand",[],r):"object"==typeof exports?exports["@primer/react-brand"]=r(require("react")):e["@primer/react-brand"]=r(e.React)}(this,(function(e){return(()=>{"use strict";var r={418:e=>{var r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,t=Object.prototype.propertyIsEnumerable;function n(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var r={},o=0;o<10;o++)r["_"+String.fromCharCode(o)]=o;if("0123456789"!==Object.getOwnPropertyNames(r).map((function(e){return r[e]})).join(""))return!1;var t={};return"abcdefghijklmnopqrst".split("").forEach((function(e){t[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},t)).join("")}catch(e){return!1}}()?Object.assign:function(e,a){for(var i,s,l=n(e),c=1;c<arguments.length;c++){for(var u in i=Object(arguments[c]))o.call(i,u)&&(l[u]=i[u]);if(r){s=r(i);for(var d=0;d<s.length;d++)t.call(i,s[d])&&(l[s[d]]=i[s[d]])}}return l}},251:(e,r,o)=>{o(418);var t=o(697),n=60103;if("function"==typeof Symbol&&Symbol.for){var a=Symbol.for;n=a("react.element"),a("react.fragment")}var i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s=Object.prototype.hasOwnProperty,l={key:!0,ref:!0,__self:!0,__source:!0};function c(e,r,o){var t,a={},c=null,u=null;for(t in void 0!==o&&(c=""+o),void 0!==r.key&&(c=""+r.key),void 0!==r.ref&&(u=r.ref),r)s.call(r,t)&&!l.hasOwnProperty(t)&&(a[t]=r[t]);if(e&&e.defaultProps)for(t in r=e.defaultProps)void 0===a[t]&&(a[t]=r[t]);return{$$typeof:n,type:e,key:c,ref:u,props:a,_owner:i.current}}r.jsx=c,r.jsxs=c},893:(e,r,o)=>{e.exports=o(251)},697:r=>{r.exports=e}},o={};function t(e){var n=o[e];if(void 0!==n)return n.exports;var a=o[e]={exports:{}};return r[e](a,a.exports,t),a.exports}t.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},t.d=(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{t.r(n),t.d(n,{ColorModesEnum:()=>_,Hero:()=>d,ThemeContext:()=>p,ThemeProvider:()=>m,useTheme:()=>v});var e=t(893);function r(e){var o,t,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(o=0;o<e.length;o++)e[o]&&(t=r(e[o]))&&(n&&(n+=" "),n+=t);else for(o in e)e[o]&&(n&&(n+=" "),n+=o);return n}function o(){for(var e,o,t=0,n="";t<arguments.length;)(e=arguments[t++])&&(o=r(e))&&(n&&(n+=" "),n+=o);return n}const a={Hero:"Hero-module__Hero___-LIGB","Hero--align-start":"Hero-module__Hero--align-start___+ux3o","Hero--align-center":"Hero-module__Hero--align-center___L5ing","Hero-heading":"Hero-module__Hero-heading___Ns+oe","Hero--size-small":"Hero-module__Hero--size-small___lTdu6","Hero--size-large":"Hero-module__Hero--size-large___LjSYu","Hero-description":"Hero-module__Hero-description___5DYuI","Hero-actions":"Hero-module__Hero-actions___TSUhJ"};var i=t(697),s=t.n(i);function l({className:r,expanded:t=!1}){return(0,e.jsxs)("svg",{className:o("ExpandableArrow-module__ExpandableArrow___Zzb6R",t&&"ExpandableArrow-module__ExpandableArrow--expanded___02I33",r),width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[(0,e.jsx)("path",{fill:"currentColor",d:"M7.28033 3.21967C6.98744 2.92678 6.51256 2.92678 6.21967 3.21967C5.92678 3.51256 5.92678 3.98744 6.21967 4.28033L7.28033 3.21967ZM11 8L11.5303 8.53033C11.8232 8.23744 11.8232 7.76256 11.5303 7.46967L11 8ZM6.21967 11.7197C5.92678 12.0126 5.92678 12.4874 6.21967 12.7803C6.51256 13.0732 6.98744 13.0732 7.28033 12.7803L6.21967 11.7197ZM6.21967 4.28033L10.4697 8.53033L11.5303 7.46967L7.28033 3.21967L6.21967 4.28033ZM10.4697 7.46967L6.21967 11.7197L7.28033 12.7803L11.5303 8.53033L10.4697 7.46967Z"}),(0,e.jsx)("path",{className:o("ExpandableArrow-module__ExpandableArrow-stem___o-Z1H",t&&"ExpandableArrow-module__ExpandableArrow-stem--expanded___omLNO"),stroke:"currentColor",d:"M1.75 8H11",strokeWidth:"1.5",strokeLinecap:"round"})]})}const c={LinkButton:"LinkButton-module__LinkButton___73d6V","LinkButton-arrow":"LinkButton-module__LinkButton-arrow___bd7ZC","LinkButton--primary":"LinkButton-module__LinkButton--primary___5T51r","LinkButton--secondary":"LinkButton-module__LinkButton--secondary___Oc3L1"};function u({variant:r="secondary",className:t,children:n,onMouseEnter:a,onMouseLeave:i,onFocus:u,onBlur:d,..._}){const[f,p]=s().useState(!1),[m,h]=s().useState(!1);return(0,e.jsxs)("a",{className:o(c.LinkButton,c[`LinkButton--${r}`],t),onMouseEnter:e=>{p(!0),a?.(e)},onMouseLeave:e=>{p(!1),i?.(e)},onFocus:e=>{h(!0),u?.(e)},onBlur:e=>{h(!1),d?.(e)},..._,children:[n,(0,e.jsx)(l,{className:c["LinkButton-arrow"],expanded:f||m})]})}function d({heading:r,description:t,primaryAction:n,secondaryAction:i,align:s="start",size:l="large"}){return(0,e.jsxs)("div",{className:o(a.Hero,a[`Hero--align-${s}`],a[`Hero--size-${l}`]),children:[(0,e.jsx)("h1",{className:a["Hero-heading"],children:r}),t?(0,e.jsx)("p",{className:a["Hero-description"],children:t}):null,(0,e.jsxs)("div",{className:a["Hero-actions"],children:[(0,e.jsx)(u,{variant:"primary",href:n.href,children:n.text}),i?(0,e.jsx)(u,{variant:"secondary",href:i.href,children:i.text}):null]})]})}var _;!function(e){e.LIGHT="light",e.DARK="dark",e.AUTO="auto"}(_||(_={}));const f=_.LIGHT,p=(0,i.createContext)({colorMode:f,availableColorModes:Object.values(_)});function m({colorMode:r=f,children:o,...t}){const[n,a]=(0,i.useState)(r),s=(0,i.useMemo)((()=>Object.values(_)),[]);return(0,i.useEffect)((()=>(r===_.AUTO?a(b()):n!==r&&a(r),y(a))),[r,n,a]),(0,e.jsx)(p.Provider,{value:{colorMode:n,availableColorModes:s},children:(0,e.jsx)("div",{"data-color-mode":n,...t,children:o})})}const h=()=>window.matchMedia(`(prefers-color-scheme: ${_.DARK})`),b=()=>h().matches?_.DARK:_.LIGHT,y=e=>{const r=h(),o=r=>e(r.matches?_.DARK:_.LIGHT);return r.addEventListener("change",o),()=>r.removeEventListener("change",o)},v=()=>(0,i.useContext)(p)})(),n})()}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/react-brand",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0-rc.0c7d40e",
|
|
4
4
|
"author": "GitHub, Inc.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bugs": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"engines": {
|
|
15
15
|
"npm": ">=8.0.0",
|
|
16
|
-
"node": ">=
|
|
16
|
+
"node": ">=16.0.0"
|
|
17
17
|
},
|
|
18
18
|
"main": "lib/index.js",
|
|
19
19
|
"types": "lib/index.d.ts",
|
|
@@ -21,12 +21,14 @@
|
|
|
21
21
|
"lib"
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
|
-
"build": "npm run clean && npm run build:css-types && npm run build:
|
|
24
|
+
"build": "npm run clean && npm run build:css-types && npm run build:tokens && webpack",
|
|
25
|
+
"build:css-types": "tcm -p 'src/**/*.css' .",
|
|
25
26
|
"build:css-vars": "ts-node --skipIgnore ./scripts/build-css-variables.ts",
|
|
26
27
|
"build:types": "tsc --project tsconfig.build.json",
|
|
27
28
|
"build:storybook": "scripts/build-storybook",
|
|
28
29
|
"build:docs": "scripts/build-docs",
|
|
29
|
-
"build:
|
|
30
|
+
"build:docs:preview": "scripts/build-docs preview",
|
|
31
|
+
"build:tokens": "node scripts/build-tokens.js && npm run build:css-vars",
|
|
30
32
|
"check": "tsc --noEmit",
|
|
31
33
|
"clean": "rm -rf lib",
|
|
32
34
|
"format": "prettier --check '**/*.{js,jsx,ts,tsx,md,mdx,css,json}'",
|
|
@@ -51,7 +53,7 @@
|
|
|
51
53
|
"@changesets/cli": "^2.21.0",
|
|
52
54
|
"@github/prettier-config": "^0.0.4",
|
|
53
55
|
"@primer/octicons-react": "^17.0.0",
|
|
54
|
-
"@primer/primitives": "^7.
|
|
56
|
+
"@primer/primitives": "^7.8.2",
|
|
55
57
|
"@storybook/addon-actions": "^6.4.19",
|
|
56
58
|
"@storybook/addon-essentials": "^6.4.19",
|
|
57
59
|
"@storybook/addon-interactions": "^6.4.19",
|
|
@@ -72,16 +74,17 @@
|
|
|
72
74
|
"@typescript-eslint/eslint-plugin": "^5.17.0",
|
|
73
75
|
"@typescript-eslint/parser": "^5.17.0",
|
|
74
76
|
"autoprefixer": "^9.8.8",
|
|
75
|
-
"css-loader": "^5.2.7",
|
|
76
77
|
"cross-env": "7.0.2",
|
|
78
|
+
"css-loader": "^5.2.7",
|
|
77
79
|
"eslint": "^8.12.0",
|
|
80
|
+
"eslint-import-resolver-typescript": "^2.7.0",
|
|
78
81
|
"eslint-plugin-github": "^4.3.6",
|
|
79
82
|
"eslint-plugin-jsx-a11y": "^6.5.1",
|
|
80
83
|
"eslint-plugin-mdx": "^1.17.0",
|
|
81
84
|
"eslint-plugin-primer-react": "^0.7.4",
|
|
82
85
|
"eslint-plugin-react": "^7.29.4",
|
|
83
86
|
"eslint-plugin-react-hooks": "^4.4.0",
|
|
84
|
-
"
|
|
87
|
+
"fast-glob": "^3.2.11",
|
|
85
88
|
"identity-obj-proxy": "^3.0.0",
|
|
86
89
|
"jest": "^27.5.1",
|
|
87
90
|
"jest-axe": "^6.0.0",
|
|
@@ -93,6 +96,7 @@
|
|
|
93
96
|
"react": "^17.0.2",
|
|
94
97
|
"react-dom": "^17.0.2",
|
|
95
98
|
"storybook-css-modules-preset": "^1.1.1",
|
|
99
|
+
"style-dictionary": "^3.7.0",
|
|
96
100
|
"style-loader": "^3.3.1",
|
|
97
101
|
"ts-jest": "^27.1.3",
|
|
98
102
|
"ts-loader": "^9.2.7",
|