@primer/react-brand 0.1.0-rc.c341bbe → 0.1.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.
Files changed (71) hide show
  1. package/lib/Hero/Hero.d.ts +2 -2
  2. package/lib/LinkButton/LinkButton.d.ts +1 -0
  3. package/lib/css/main.css +921 -1057
  4. package/lib/css/stylesheets.d.ts +2 -1
  5. package/lib/design-tokens/css/tokens/base/colors/color-scales-with-modes.css +805 -0
  6. package/lib/design-tokens/css/tokens/base/colors/color-scales.css +139 -0
  7. package/lib/design-tokens/css/tokens/base/size/size.css +1 -1
  8. package/lib/design-tokens/css/tokens/base/typography/typography.css +1 -1
  9. package/lib/design-tokens/css/tokens/functional/colors/global-with-modes.css +58 -0
  10. package/lib/design-tokens/css/tokens/functional/colors/global.css +22 -0
  11. package/lib/design-tokens/css/tokens/functional/components/button/colors-with-modes.css +28 -0
  12. package/lib/design-tokens/css/tokens/functional/components/hero/base.css +9 -0
  13. package/lib/design-tokens/css/tokens/functional/size/border.css +1 -1
  14. package/lib/design-tokens/css/tokens/functional/size/breakpoints.css +1 -1
  15. package/lib/design-tokens/css/tokens/functional/size/size-coarse.css +1 -1
  16. package/lib/design-tokens/css/tokens/functional/size/size-fine.css +1 -1
  17. package/lib/design-tokens/css/tokens/functional/size/size.css +1 -1
  18. package/lib/design-tokens/css/tokens/functional/typography/typography-responsive.css +1 -1
  19. package/lib/design-tokens/css/tokens/functional/typography/typography.css +1 -1
  20. package/lib/design-tokens/js/module/tokens/base/colors/color-scales.js +2551 -0
  21. package/lib/design-tokens/js/module/tokens/base/size/size.js +1 -1
  22. package/lib/design-tokens/js/module/tokens/base/typography/typography.js +1 -1
  23. package/lib/design-tokens/js/module/tokens/functional/colors/global.js +289 -0
  24. package/lib/design-tokens/js/module/tokens/functional/components/hero/base.js +47 -0
  25. package/lib/design-tokens/js/module/tokens/functional/size/border.js +1 -1
  26. package/lib/design-tokens/js/module/tokens/functional/size/breakpoints.js +1 -1
  27. package/lib/design-tokens/js/module/tokens/functional/size/size-coarse.js +1 -1
  28. package/lib/design-tokens/js/module/tokens/functional/size/size-fine.js +1 -1
  29. package/lib/design-tokens/js/module/tokens/functional/size/size.js +1 -1
  30. package/lib/design-tokens/js/module/tokens/functional/size/viewport.js +1 -1
  31. package/lib/design-tokens/js/module/tokens/functional/typography/typography.js +1 -1
  32. package/lib/design-tokens/js/tokens/base/colors/color-scales.js +137 -0
  33. package/lib/design-tokens/js/tokens/base/size/size.js +1 -1
  34. package/lib/design-tokens/js/tokens/base/typography/typography.js +1 -1
  35. package/lib/design-tokens/js/tokens/functional/colors/global.js +20 -0
  36. package/lib/design-tokens/js/tokens/functional/components/hero/base.js +7 -0
  37. package/lib/design-tokens/js/tokens/functional/size/border.js +1 -1
  38. package/lib/design-tokens/js/tokens/functional/size/breakpoints.js +1 -1
  39. package/lib/design-tokens/js/tokens/functional/size/size-coarse.js +1 -1
  40. package/lib/design-tokens/js/tokens/functional/size/size-fine.js +1 -1
  41. package/lib/design-tokens/js/tokens/functional/size/size.js +1 -1
  42. package/lib/design-tokens/js/tokens/functional/size/viewport.js +1 -1
  43. package/lib/design-tokens/js/tokens/functional/typography/typography.js +1 -1
  44. package/lib/design-tokens/ts/tokens/base/colors/color-scales.d.ts +176 -0
  45. package/lib/design-tokens/ts/tokens/base/colors/color-scales.js +175 -0
  46. package/lib/design-tokens/ts/tokens/base/size/size.d.ts +1 -1
  47. package/lib/design-tokens/ts/tokens/base/size/size.js +1 -1
  48. package/lib/design-tokens/ts/tokens/base/typography/typography.d.ts +1 -1
  49. package/lib/design-tokens/ts/tokens/base/typography/typography.js +1 -1
  50. package/lib/design-tokens/ts/tokens/functional/colors/global.d.ts +35 -0
  51. package/lib/design-tokens/ts/tokens/functional/colors/global.js +34 -0
  52. package/lib/design-tokens/ts/tokens/functional/components/hero/base.d.ts +18 -0
  53. package/lib/design-tokens/ts/tokens/functional/components/hero/base.js +17 -0
  54. package/lib/design-tokens/ts/tokens/functional/size/border.d.ts +1 -1
  55. package/lib/design-tokens/ts/tokens/functional/size/border.js +1 -1
  56. package/lib/design-tokens/ts/tokens/functional/size/breakpoints.d.ts +1 -1
  57. package/lib/design-tokens/ts/tokens/functional/size/breakpoints.js +1 -1
  58. package/lib/design-tokens/ts/tokens/functional/size/size-coarse.d.ts +1 -1
  59. package/lib/design-tokens/ts/tokens/functional/size/size-coarse.js +1 -1
  60. package/lib/design-tokens/ts/tokens/functional/size/size-fine.d.ts +1 -1
  61. package/lib/design-tokens/ts/tokens/functional/size/size-fine.js +1 -1
  62. package/lib/design-tokens/ts/tokens/functional/size/size.d.ts +1 -1
  63. package/lib/design-tokens/ts/tokens/functional/size/size.js +1 -1
  64. package/lib/design-tokens/ts/tokens/functional/size/viewport.d.ts +1 -1
  65. package/lib/design-tokens/ts/tokens/functional/size/viewport.js +1 -1
  66. package/lib/design-tokens/ts/tokens/functional/typography/typography.d.ts +1 -1
  67. package/lib/design-tokens/ts/tokens/functional/typography/typography.js +1 -1
  68. package/lib/index.js +1 -1
  69. package/package.json +11 -13
  70. package/CHANGELOG.md +0 -29
  71. package/lib/css/gh-variables.color.css +0 -1049
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,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function o(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={},t=0;t<10;t++)r["_"+String.fromCharCode(t)]=t;if("0123456789"!==Object.getOwnPropertyNames(r).map((function(e){return r[e]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(e){n[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(e,a){for(var i,l,s=o(e),_=1;_<arguments.length;_++){for(var d in i=Object(arguments[_]))t.call(i,d)&&(s[d]=i[d]);if(r){l=r(i);for(var u=0;u<l.length;u++)n.call(i,l[u])&&(s[l[u]]=i[l[u]])}}return s}},251:(e,r,t)=>{t(418);var n=t(697),o=60103;if("function"==typeof Symbol&&Symbol.for){var a=Symbol.for;o=a("react.element"),a("react.fragment")}var i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l=Object.prototype.hasOwnProperty,s={key:!0,ref:!0,__self:!0,__source:!0};function _(e,r,t){var n,a={},_=null,d=null;for(n in void 0!==t&&(_=""+t),void 0!==r.key&&(_=""+r.key),void 0!==r.ref&&(d=r.ref),r)l.call(r,n)&&!s.hasOwnProperty(n)&&(a[n]=r[n]);if(e&&e.defaultProps)for(n in r=e.defaultProps)void 0===a[n]&&(a[n]=r[n]);return{$$typeof:o,type:e,key:_,ref:d,props:a,_owner:i.current}}r.jsx=_,r.jsxs=_},893:(e,r,t)=>{e.exports=t(251)},697:r=>{r.exports=e}},t={};function n(e){var o=t[e];if(void 0!==o)return o.exports;var a=t[e]={exports:{}};return r[e](a,a.exports,n),a.exports}n.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return n.d(r,{a:r}),r},n.d=(e,r)=>{for(var t in r)n.o(r,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{n.r(o),n.d(o,{ColorModesEnum:()=>O,Heading:()=>L,HeadingSizes:()=>b,HeadingTags:()=>H,Hero:()=>j,Text:()=>x,TextSizes:()=>d,TextTags:()=>u,TextVariants:()=>c,ThemeContext:()=>w,ThemeProvider:()=>B,classMap:()=>v,defaultHeadingTag:()=>y,defaultTextSize:()=>p,defaultTextTag:()=>m,defaultTextVariant:()=>f,useTheme:()=>S});var e=n(893);function r(e){var t,n,o="";if("string"==typeof e||"number"==typeof e)o+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=r(e[t]))&&(o&&(o+=" "),o+=n);else for(t in e)e[t]&&(o&&(o+=" "),o+=t);return o}function t(){for(var e,t,n=0,o="";n<arguments.length;)(e=arguments[n++])&&(t=r(e))&&(o&&(o+=" "),o+=t);return o}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-description":"Hero-module__Hero-description___5DYuI","Hero-actions":"Hero-module__Hero-actions___TSUhJ"};var i=n(697),l=n.n(i);function s({className:r,expanded:n=!1}){return(0,e.jsxs)("svg",{className:t("ExpandableArrow-module__ExpandableArrow___Zzb6R",n&&"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:t("ExpandableArrow-module__ExpandableArrow-stem___o-Z1H",n&&"ExpandableArrow-module__ExpandableArrow-stem--expanded___omLNO"),stroke:"currentColor",d:"M1.75 8H11",strokeWidth:"1.5",strokeLinecap:"round"})]})}const _={Text:"Text-module__Text___TZM3g","Text--default":"Text-module__Text--default___cDtXM","Text--muted":"Text-module__Text--muted___+aYSJ","Text--700":"Text-module__Text--700___K4B6u","Text--600":"Text-module__Text--600___GROsL","Text--500":"Text-module__Text--500___ljKQp","Text--400":"Text-module__Text--400___jiw28","Text--300":"Text-module__Text--300___iZZEy","Text--200":"Text-module__Text--200___EUSWb","Text--100":"Text-module__Text--100___kOhhP"},d=["700","600","500","400","300","200","100"],u=["p","span","div"],c=["default","muted"],m=u[1],p=d[3],f=c[0];function x({as:r=m,className:n,children:o,size:a=p,variant:i=f,...l}){const s=t(_.Text,_[`Text--${i}`],_[`Text--${a}`],n);return"p"===r?(0,e.jsx)("p",{className:s,...l,children:o}):"div"===r?(0,e.jsx)("div",{className:s,...l,children:o}):(0,e.jsx)("span",{className:s,...l,children:o})}const h={LinkButton:"LinkButton-module__LinkButton___73d6V","LinkButton--label":"LinkButton-module__LinkButton--label___-NRnw","LinkButton-arrow":"LinkButton-module__LinkButton-arrow___bd7ZC","LinkButton--primary":"LinkButton-module__LinkButton--primary___5T51r","LinkButton--label-primary":"LinkButton-module__LinkButton--label-primary___TSZx+","LinkButton--secondary":"LinkButton-module__LinkButton--secondary___Oc3L1"};function g({variant:r="secondary",className:n,children:o,onMouseEnter:a,onMouseLeave:i,onFocus:_,onBlur:d,...u}){const[c,m]=l().useState(!1),[p,f]=l().useState(!1);return(0,e.jsxs)("a",{className:t(h.LinkButton,h[`LinkButton--${r}`],n),onMouseEnter:e=>{m(!0),a?.(e)},onMouseLeave:e=>{m(!1),i?.(e)},onFocus:e=>{f(!0),_?.(e)},onBlur:e=>{f(!1),d?.(e)},...u,children:[(0,e.jsx)(x,{as:"span",size:"400",className:t(h["LinkButton--label"],"primary"===r&&h["LinkButton--label-primary"]),children:o}),(0,e.jsx)(s,{className:h["LinkButton-arrow"],expanded:c||p})]})}const T={Heading:"Heading-module__Heading___D-P9Z","Heading--1":"Heading-module__Heading--1___2biru","Heading--2":"Heading-module__Heading--2___7UT78","Heading--3":"Heading-module__Heading--3___zFRZy","Heading--4":"Heading-module__Heading--4___6NI2U","Heading--5":"Heading-module__Heading--5___Wb4zR","Heading--6":"Heading-module__Heading--6___6GNA5"},b=["1","2","3","4","5","6"],H=["h1","h2","h3","h4","h5","h6"],y=H[1],v={h1:b[0],h2:b[1],h3:b[2],h4:b[3],h5:b[4],h6:b[5]};function L({className:r,children:n,as:o=y,...a}){const i=t(r,T.Heading,T[`Heading--${v[o]}`]),s=l().useCallback((({...e})=>H.includes(o)?l().createElement(o,e,n):(console.error(`Heading: 'as' prop must be one of ${H.join(", ")}`),null)),[o,n]);return(0,e.jsx)(s,{className:i,...a,children:n})}function j({className:r,heading:n,description:o,primaryAction:i,secondaryAction:l,align:s="start",size:_="large"}){return(0,e.jsxs)("div",{className:t(a.Hero,a[`Hero--align-${s}`],a[`Hero--size-${_}`],r),children:[(0,e.jsx)(L,{className:a["Hero-heading"],as:"large"===_?"h1":"h2",children:n}),o?(0,e.jsx)(x,{className:a["Hero-description"],as:"p",size:"500",variant:"muted",children:o}):null,(0,e.jsxs)("div",{className:a["Hero-actions"],children:[(0,e.jsx)(g,{variant:"primary",href:i.href,children:i.text}),l?(0,e.jsx)(g,{variant:"secondary",href:l.href,children:l.text}):null]})]})}var O;!function(e){e.LIGHT="light",e.DARK="dark",e.AUTO="auto"}(O||(O={}));const k=O.LIGHT,w=(0,i.createContext)({colorMode:k,availableColorModes:Object.values(O)});function B({colorMode:r=k,children:t,...n}){const[o,a]=(0,i.useState)(r),l=(0,i.useMemo)((()=>Object.values(O)),[]);return(0,i.useEffect)((()=>(r===O.AUTO?a(E()):o!==r&&a(r),M(a))),[r,o,a]),(0,e.jsx)(w.Provider,{value:{colorMode:o,availableColorModes:l},children:(0,e.jsx)("div",{"data-color-mode":o,...n,children:t})})}const N=()=>window.matchMedia(`(prefers-color-scheme: ${O.DARK})`),E=()=>N().matches?O.DARK:O.LIGHT,M=e=>{const r=N(),t=r=>e(r.matches?O.DARK:O.LIGHT);return r.addEventListener("change",t),()=>r.removeEventListener("change",t)},S=()=>(0,i.useContext)(w)})(),o})()}));
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("@primer/react-brand",[],t):"object"==typeof exports?exports["@primer/react-brand"]=t(require("react")):e["@primer/react-brand"]=t(e.React)}(this,(function(e){return(()=>{"use strict";var t={418:e=>{var t=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function o(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 t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(e){n[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(e,a){for(var i,l,s=o(e),_=1;_<arguments.length;_++){for(var d in i=Object(arguments[_]))r.call(i,d)&&(s[d]=i[d]);if(t){l=t(i);for(var u=0;u<l.length;u++)n.call(i,l[u])&&(s[l[u]]=i[l[u]])}}return s}},251:(e,t,r)=>{r(418);var n=r(697),o=60103;if("function"==typeof Symbol&&Symbol.for){var a=Symbol.for;o=a("react.element"),a("react.fragment")}var i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l=Object.prototype.hasOwnProperty,s={key:!0,ref:!0,__self:!0,__source:!0};function _(e,t,r){var n,a={},_=null,d=null;for(n in void 0!==r&&(_=""+r),void 0!==t.key&&(_=""+t.key),void 0!==t.ref&&(d=t.ref),t)l.call(t,n)&&!s.hasOwnProperty(n)&&(a[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===a[n]&&(a[n]=t[n]);return{$$typeof:o,type:e,key:_,ref:d,props:a,_owner:i.current}}t.jsx=_,t.jsxs=_},893:(e,t,r)=>{e.exports=r(251)},697:t=>{t.exports=e}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{n.r(o),n.d(o,{ColorModesEnum:()=>O,Heading:()=>L,HeadingSizes:()=>b,HeadingTags:()=>H,Hero:()=>j,Text:()=>x,TextSizes:()=>d,TextTags:()=>u,TextVariants:()=>c,ThemeContext:()=>w,ThemeProvider:()=>B,classMap:()=>v,defaultHeadingTag:()=>y,defaultTextSize:()=>p,defaultTextTag:()=>m,defaultTextVariant:()=>f,useTheme:()=>S});var e=n(893);function t(e){var r,n,o="";if("string"==typeof e||"number"==typeof e)o+=e;else if("object"==typeof e)if(Array.isArray(e))for(r=0;r<e.length;r++)e[r]&&(n=t(e[r]))&&(o&&(o+=" "),o+=n);else for(r in e)e[r]&&(o&&(o+=" "),o+=r);return o}function r(){for(var e,r,n=0,o="";n<arguments.length;)(e=arguments[n++])&&(r=t(e))&&(o&&(o+=" "),o+=r);return o}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-description":"Hero-module__Hero-description___5DYuI","Hero-actions":"Hero-module__Hero-actions___TSUhJ"};var i=n(697),l=n.n(i);function s({className:t,expanded:n=!1}){return(0,e.jsxs)("svg",{className:r("ExpandableArrow-module__ExpandableArrow___Zzb6R",n&&"ExpandableArrow-module__ExpandableArrow--expanded___02I33",t),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:r("ExpandableArrow-module__ExpandableArrow-stem___o-Z1H",n&&"ExpandableArrow-module__ExpandableArrow-stem--expanded___omLNO"),stroke:"currentColor",d:"M1.75 8H11",strokeWidth:"1.5",strokeLinecap:"round"})]})}const _={Text:"Text-module__Text___TZM3g","Text--default":"Text-module__Text--default___cDtXM","Text--muted":"Text-module__Text--muted___+aYSJ","Text--700":"Text-module__Text--700___K4B6u","Text--600":"Text-module__Text--600___GROsL","Text--500":"Text-module__Text--500___ljKQp","Text--400":"Text-module__Text--400___jiw28","Text--300":"Text-module__Text--300___iZZEy","Text--200":"Text-module__Text--200___EUSWb","Text--100":"Text-module__Text--100___kOhhP"},d=["700","600","500","400","300","200","100"],u=["p","span","div"],c=["default","muted"],m=u[1],p=d[3],f=c[0];function x({as:t=m,className:n,children:o,size:a=p,variant:i=f,...l}){const s=r(_.Text,_[`Text--${i}`],_[`Text--${a}`],n);return"p"===t?(0,e.jsx)("p",{className:s,...l,children:o}):"div"===t?(0,e.jsx)("div",{className:s,...l,children:o}):(0,e.jsx)("span",{className:s,...l,children:o})}const h={LinkButton:"LinkButton-module__LinkButton___73d6V","LinkButton--label":"LinkButton-module__LinkButton--label___-NRnw","LinkButton-arrow":"LinkButton-module__LinkButton-arrow___bd7ZC","LinkButton--primary":"LinkButton-module__LinkButton--primary___5T51r","LinkButton--label-primary":"LinkButton-module__LinkButton--label-primary___TSZx+","LinkButton--secondary":"LinkButton-module__LinkButton--secondary___Oc3L1"};function g({variant:t="secondary",className:n,children:o,onMouseEnter:a,onMouseLeave:i,onFocus:_,onBlur:d,...u}){const[c,m]=l().useState(!1),[p,f]=l().useState(!1);return(0,e.jsxs)("a",{className:r(h.LinkButton,h[`LinkButton--${t}`],n),onMouseEnter:e=>{m(!0),a?.(e)},onMouseLeave:e=>{m(!1),i?.(e)},onFocus:e=>{f(!0),_?.(e)},onBlur:e=>{f(!1),d?.(e)},...u,children:[(0,e.jsx)(x,{as:"span",size:"400",className:r(h["LinkButton--label"],"primary"===t&&h["LinkButton--label-primary"]),children:o}),(0,e.jsx)(s,{className:h["LinkButton-arrow"],expanded:c||p})]})}const T={Heading:"Heading-module__Heading___D-P9Z","Heading--1":"Heading-module__Heading--1___2biru","Heading--2":"Heading-module__Heading--2___7UT78","Heading--3":"Heading-module__Heading--3___zFRZy","Heading--4":"Heading-module__Heading--4___6NI2U","Heading--5":"Heading-module__Heading--5___Wb4zR","Heading--6":"Heading-module__Heading--6___6GNA5"},b=["1","2","3","4","5","6"],H=["h1","h2","h3","h4","h5","h6"],y=H[1],v={h1:b[0],h2:b[1],h3:b[2],h4:b[3],h5:b[4],h6:b[5]};function L({className:t,children:n,as:o=y,...a}){const i=r(t,T.Heading,T[`Heading--${v[o]}`]),s=l().useCallback((({...e})=>H.includes(o)?l().createElement(o,e,n):(console.error(`Heading: 'as' prop must be one of ${H.join(", ")}`),null)),[o,n]);return(0,e.jsx)(s,{className:i,...a,children:n})}function j({className:t,heading:n,description:o,primaryAction:i,secondaryAction:l,align:s="start"}){return(0,e.jsxs)("div",{className:r(a.Hero,a[`Hero--align-${s}`],t),children:[(0,e.jsx)(L,{className:a["Hero-heading"],as:"h1",children:n}),o?(0,e.jsx)(x,{className:a["Hero-description"],as:"p",size:"400",variant:"muted",children:o}):null,(0,e.jsxs)("div",{className:a["Hero-actions"],children:[(0,e.jsx)(g,{variant:"primary",href:i.href,children:i.text}),l?(0,e.jsx)(g,{variant:"secondary",href:l.href,children:l.text}):null]})]})}var O;!function(e){e.LIGHT="light",e.DARK="dark",e.AUTO="auto"}(O||(O={}));const k=O.LIGHT,w=(0,i.createContext)({colorMode:k,availableColorModes:Object.values(O)});function B({colorMode:t=k,children:r,...n}){const[o,a]=(0,i.useState)(t),l=(0,i.useMemo)((()=>Object.values(O)),[]);return(0,i.useEffect)((()=>(t===O.AUTO?a(E()):o!==t&&a(t),M(a))),[t,o,a]),(0,e.jsx)(w.Provider,{value:{colorMode:o,availableColorModes:l},children:(0,e.jsx)("div",{"data-color-mode":o,...n,children:r})})}const N=()=>window.matchMedia(`(prefers-color-scheme: ${O.DARK})`),E=()=>N().matches?O.DARK:O.LIGHT,M=e=>{const t=N(),r=t=>e(t.matches?O.DARK:O.LIGHT);return t.addEventListener("change",r),()=>t.removeEventListener("change",r)},S=()=>(0,i.useContext)(w)})(),o})()}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/react-brand",
3
- "version": "0.1.0-rc.c341bbe",
3
+ "version": "0.1.0",
4
4
  "author": "GitHub, Inc.",
5
5
  "license": "MIT",
6
6
  "bugs": {
@@ -24,19 +24,17 @@
24
24
  "scripts": {
25
25
  "build": "npm run clean && npm run build:css-types && npm run build:tokens && webpack",
26
26
  "build:css-types": "tcm -p 'src/**/*.module.css' .",
27
- "build:css-vars": "ts-node --skipIgnore ./scripts/build-css-variables.ts",
28
27
  "build:types": "tsc --project tsconfig.build.json",
29
28
  "build:storybook": "scripts/build-storybook",
30
29
  "build:docs": "scripts/build-docs",
31
30
  "build:docs:preview": "scripts/build-docs preview",
32
- "build:tokens": "node scripts/build-tokens.js && npm run build:css-vars",
31
+ "build:tokens": "node scripts/build-tokens.js",
33
32
  "check": "tsc --noEmit",
34
33
  "clean": "rm -rf lib",
35
34
  "format": "prettier --check '**/*.{js,jsx,ts,tsx,md,mdx,css,json}'",
36
35
  "format:fix": "prettier --write '**/*.{js,jsx,ts,tsx,md,mdx,css,json}'",
37
36
  "lint": "eslint '**/*.{js,ts,tsx,md,mdx}' --max-warnings=0",
38
37
  "lint:fix": "npm run lint -- --fix",
39
- "postinstall": "cd docs && npm i",
40
38
  "release": "npm run build && changeset publish",
41
39
  "start": "npm run build && npm run start:storybook & npm run start:docs",
42
40
  "start:storybook": "start-storybook -p 6006",
@@ -44,7 +42,6 @@
44
42
  "start:css-types": "tcm -w -p 'src/**/*.css' .",
45
43
  "test": "jest"
46
44
  },
47
- "prettier": "@github/prettier-config",
48
45
  "peerDependencies": {
49
46
  "react": ">=17.0.0 <= 18.0.0",
50
47
  "react-dom": ">=17.0.0 <= 18.0.0"
@@ -54,14 +51,14 @@
54
51
  "@changesets/cli": "^2.21.0",
55
52
  "@github/prettier-config": "^0.0.4",
56
53
  "@primer/octicons-react": "^17.0.0",
57
- "@primer/primitives": "0.0.0-20220428230003",
58
- "@storybook/addon-actions": "^6.4.19",
59
- "@storybook/addon-essentials": "^6.4.19",
60
- "@storybook/addon-interactions": "^6.4.19",
61
- "@storybook/addon-links": "^6.4.19",
62
- "@storybook/builder-webpack5": "^6.4.19",
63
- "@storybook/manager-webpack5": "^6.4.19",
64
- "@storybook/react": "^6.4.19",
54
+ "@primer/primitives": "^7.8.3",
55
+ "@storybook/addon-actions": "^6.5.3",
56
+ "@storybook/addon-essentials": "^6.5.3",
57
+ "@storybook/addon-interactions": "^6.5.3",
58
+ "@storybook/addon-links": "^6.5.3",
59
+ "@storybook/builder-webpack5": "^6.5.3",
60
+ "@storybook/manager-webpack5": "^6.5.3",
61
+ "@storybook/react": "^6.5.3",
65
62
  "@storybook/testing-library": "^0.0.9",
66
63
  "@testing-library/dom": "^8.11.3",
67
64
  "@testing-library/jest-dom": "^5.16.2",
@@ -75,6 +72,7 @@
75
72
  "@typescript-eslint/eslint-plugin": "^5.17.0",
76
73
  "@typescript-eslint/parser": "^5.17.0",
77
74
  "autoprefixer": "^9.8.8",
75
+ "color2k": "^2.0.0",
78
76
  "cross-env": "7.0.2",
79
77
  "css-loader": "^5.2.7",
80
78
  "eslint": "^8.12.0",
package/CHANGELOG.md DELETED
@@ -1,29 +0,0 @@
1
- # @primer/react-brand
2
-
3
- ## 0.1.0
4
-
5
- ### Minor Changes
6
-
7
- - [#19](https://github.com/primer/react-brand/pull/19) [`3b22e9e`](https://github.com/primer/react-brand/commit/3b22e9e0823401104d6e33b3c4f8664b755ea6ba) Thanks [@colebemis](https://github.com/colebemis)! - Add `size` prop to `Hero` component
8
-
9
- ### Patch Changes
10
-
11
- - [#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
-
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
14
-
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
16
-
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.
18
-
19
- ## 0.0.3
20
-
21
- ### Patch Changes
22
-
23
- - [#18](https://github.com/primer/react-brand/pull/18) [`0835830`](https://github.com/primer/react-brand/commit/0835830fc15c582e280ac692ff3d578d6bcf282e) Thanks [@rezrah](https://github.com/rezrah)! - Fixes for production bundles
24
-
25
- ## 0.0.2
26
-
27
- ### Patch Changes
28
-
29
- - [#2](https://github.com/primer/react-brand/pull/2) [`ab01a8a`](https://github.com/primer/react-brand/commit/ab01a8ad1dc504f7a2865213b6f41c0b0adba131) Thanks [@colebemis](https://github.com/colebemis)! - Initialize releases with [changesets](https://github.com/changesets/changesets)