@primer/components 0.0.0-2021827223713 → 0.0.0-2021828162730
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 +7 -3
- package/dist/browser.esm.js +8 -4
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +8 -4
- package/dist/browser.umd.js.map +1 -1
- package/lib/ActionList/Item.d.ts +17 -4
- package/lib/ActionList/Item.js +9 -7
- package/lib/ActionList/List.d.ts +11 -7
- package/lib/ActionList/List.js +2 -2
- package/lib/ActionList/index.d.ts +1 -2
- package/lib/Breadcrumbs.d.ts +7 -8
- package/lib/Breadcrumbs.js +12 -7
- package/lib-esm/ActionList/Item.d.ts +17 -4
- package/lib-esm/ActionList/Item.js +9 -6
- package/lib-esm/ActionList/List.d.ts +11 -7
- package/lib-esm/ActionList/List.js +2 -2
- package/lib-esm/ActionList/index.d.ts +1 -2
- package/lib-esm/Breadcrumbs.d.ts +7 -8
- package/lib-esm/Breadcrumbs.js +13 -8
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
# @primer/components
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-2021828162730
|
|
4
4
|
|
|
5
5
|
### Major Changes
|
|
6
6
|
|
|
7
|
-
- [#
|
|
7
|
+
- [#1448](https://github.com/primer/react/pull/1448) [`1a39fb02`](https://github.com/primer/react/commit/1a39fb0284c5e19324d378629d09a343be4cde05) Thanks [@SferaDev](https://github.com/SferaDev)! - Remove `.Breadcrumb` classname from the root element of the `Breadcrumbs` component. This change shouldn't break anything unless you have styles, scripts, or tests that reference the `.Breadcrumb` classname.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- [#1463](https://github.com/primer/react/pull/1463) [`c6291814`](https://github.com/primer/react/commit/c629181409a60f5b191d663a39568e0fc3ba9e1e) Thanks [@jfuchs](https://github.com/jfuchs)! - `ActionList.item` accepts an `as` prop, allowing it to be a link, or (in combination with the renderItem prop) a Next.js or React Router link
|
|
10
12
|
|
|
11
13
|
### Patch Changes
|
|
12
14
|
|
|
@@ -14,6 +16,8 @@
|
|
|
14
16
|
|
|
15
17
|
* [#1448](https://github.com/primer/react/pull/1448) [`1a39fb02`](https://github.com/primer/react/commit/1a39fb0284c5e19324d378629d09a343be4cde05) Thanks [@SferaDev](https://github.com/SferaDev)! - Rename `Breadcrumb` component to `Breadcrumbs`
|
|
16
18
|
|
|
19
|
+
- [#1470](https://github.com/primer/react/pull/1470) [`f2e29a08`](https://github.com/primer/react/commit/f2e29a08e2aab9e98a460eb073229933f6ae050b) Thanks [@pksjce](https://github.com/pksjce)! - Fix ActionList.Item color
|
|
20
|
+
|
|
17
21
|
## 29.1.1
|
|
18
22
|
|
|
19
23
|
### Patch Changes
|
package/dist/browser.esm.js
CHANGED
|
@@ -413,7 +413,7 @@ import e,{useState as r,useRef as t,useCallback as o,useEffect as a,useMemo as n
|
|
|
413
413
|
background: ${Cr("colors.border.muted")};
|
|
414
414
|
margin-top: calc(${Cr("space.2")} - 1px);
|
|
415
415
|
margin-bottom: ${Cr("space.2")};
|
|
416
|
-
`;function wa(){return e.createElement(ya,null)}wa.displayName="Divider",wa.renderItem=wa;const Ba={default:{hover:{light:"rgba(46, 77, 108, 0.06)",dark:"rgba(201, 206, 212, 0.12)",dark_dimmed:"rgba(201, 206, 212, 0.12)"},focus:{light:"rgba(54, 77, 100, 0.16)",dark:"rgba(201, 206, 212, 0.24)",dark_dimmed:"rgba(201, 206, 212, 0.24)"}},danger:{hover:{light:"rgba(234, 74, 90, 0.08)",dark:"rgba(248, 81, 73, 0.16)",dark_dimmed:"rgba(248, 81, 73, 0.16)"},focus:{light:"rgba(234, 74, 90, 0.14)",dark:"rgba(248, 81, 73, 0.24)",dark_dimmed:"rgba(248, 81, 73, 0.24)"}}},$a=(e="default",r)=>{if(r)return{color:Cr("colors.fg.muted"),iconColor:Cr("colors.fg.muted"),annotationColor:Cr("colors.fg.muted"),hoverCursor:"default"};switch(e){case"danger":return{color:Cr("colors.danger.fg"),iconColor:Cr("colors.danger.fg"),annotationColor:Cr("colors.fg.muted"),hoverCursor:"pointer"};default:return{color:"
|
|
416
|
+
`;function wa(){return e.createElement(ya,null)}wa.displayName="Divider",wa.renderItem=wa;const Ba={default:{hover:{light:"rgba(46, 77, 108, 0.06)",dark:"rgba(201, 206, 212, 0.12)",dark_dimmed:"rgba(201, 206, 212, 0.12)"},focus:{light:"rgba(54, 77, 100, 0.16)",dark:"rgba(201, 206, 212, 0.24)",dark_dimmed:"rgba(201, 206, 212, 0.24)"}},danger:{hover:{light:"rgba(234, 74, 90, 0.08)",dark:"rgba(248, 81, 73, 0.16)",dark_dimmed:"rgba(248, 81, 73, 0.16)"},focus:{light:"rgba(234, 74, 90, 0.14)",dark:"rgba(248, 81, 73, 0.24)",dark_dimmed:"rgba(248, 81, 73, 0.24)"}}},$a=(e="default",r)=>{if(r)return{color:Cr("colors.fg.muted"),iconColor:Cr("colors.fg.muted"),annotationColor:Cr("colors.fg.muted"),hoverCursor:"default"};switch(e){case"danger":return{color:Cr("colors.danger.fg"),iconColor:Cr("colors.danger.fg"),annotationColor:Cr("colors.fg.muted"),hoverCursor:"pointer"};default:return{color:Cr("colors.fg.default"),iconColor:Cr("colors.fg.muted"),annotationColor:Cr("colors.fg.muted"),hoverCursor:"pointer"}}},ka=s.div`
|
|
417
417
|
display: flex;
|
|
418
418
|
min-width: 0;
|
|
419
419
|
|
|
@@ -438,6 +438,7 @@ import e,{useState as r,useRef as t,useCallback as o,useEffect as a,useMemo as n
|
|
|
438
438
|
color: ${({variant:e,item:r})=>$a(e,null==r?void 0:r.disabled).color};
|
|
439
439
|
// 2 frames on a 60hz monitor
|
|
440
440
|
transition: background 33.333ms linear;
|
|
441
|
+
text-decoration: none;
|
|
441
442
|
|
|
442
443
|
@media (hover: hover) and (pointer: fine) {
|
|
443
444
|
:hover {
|
|
@@ -541,7 +542,7 @@ import e,{useState as r,useRef as t,useCallback as o,useEffect as a,useMemo as n
|
|
|
541
542
|
flex-basis: var(--description-container-flex-basis);
|
|
542
543
|
`,La=s.input`
|
|
543
544
|
pointer-events: none;
|
|
544
|
-
|
|
545
|
+
`,Ra=e.forwardRef(((r,t)=>{const{as:a,text:n,description:i,descriptionVariant:d="inline",selected:l,selectionVariant:c,leadingVisual:s,trailingIcon:f,trailingText:g,variant:b="default",showDivider:p,disabled:u,onAction:m,onKeyPress:h,children:x,onClick:v,id:y,...w}=r,B=Wo(),$=Wo(),k=o((e=>{if(u)return;null==h||h(e);e.target instanceof HTMLInputElement&&"checkbox"===e.target.type&&" "===e.key||!e.defaultPrevented&&[" ","Enter"].includes(e.key)&&(null==m||m(r,e))}),[m,u,r,h]),S=o((e=>{u||(null==v||v(e),e.defaultPrevented||null==m||m(r,e))}),[m,u,r,v]),T=Ba[b],E=Zr(T.hover,"inherit"),I=Zr(T.focus,"inherit"),{theme:C}=Jr();return e.createElement(Ta,Or({ref:t,as:a,tabIndex:u?void 0:-1,variant:b,showDivider:p,"aria-selected":l,"aria-labelledby":n?B:void 0,"aria-describedby":i?$:void 0},w,{"data-id":y,onKeyPress:k,onClick:S,hoverBackground:u?"inherit":E,focusBackground:u?"inherit":I}),!!l===l&&e.createElement(Ia,null,"multiple"===c?e.createElement(e.Fragment,null,e.createElement(La,{disabled:u,tabIndex:-1,type:"checkbox",checked:l,"aria-label":n,readOnly:!0,"aria-readonly":"false"})):l&&e.createElement(oo,{fill:null==C?void 0:C.colors.text.primary})),s&&e.createElement(Na,{variant:b,disabled:u},e.createElement(s,null)),e.createElement(ka,null,e.createElement(Sa,{style:{"--main-content-flex-direction":"inline"===d?"row":"column"}},x,n?e.createElement(Ea,{id:B},n):null,i?e.createElement(za,{id:$,style:{"--description-container-margin-left":"inline"===d?Cr("space.2")(C):0,"--description-container-flex-basis":"inline"===d?0:"auto"}},"block"===d?i:e.createElement(va,{title:i,inline:!0,maxWidth:"100%"},i)):null),f||g?e.createElement(Aa,{variant:b,disabled:u},g,f&&e.createElement(f,null)):null))}));const Ha=s.div`
|
|
545
546
|
font-size: ${Cr("fontSizes.1")};
|
|
546
547
|
/* 14px font-size * 1.428571429 = 20px line height
|
|
547
548
|
*
|
|
@@ -554,7 +555,7 @@ import e,{useState as r,useRef as t,useCallback as o,useEffect as a,useMemo as n
|
|
|
554
555
|
--item-hover-bg-override: none;
|
|
555
556
|
--item-hover-divider-border-color-override: ${Cr("colors.border.muted")};
|
|
556
557
|
}
|
|
557
|
-
`;const Oa=e.forwardRef(((r,t)=>{const{firstGroupStyle:o,lastGroupStyle:a,headerStyle:n,itemStyle:i}=function(e="inset"){switch(e){case"full":return{headerStyle:{paddingX:Cr("space.2")},itemStyle:{borderRadius:0}};default:return{firstGroupStyle:{marginTop:Cr("space.2")},lastGroupStyle:{marginBottom:Cr("space.2")},itemStyle:{marginX:Cr("space.2")}}}}(r.variant),d=(t,o,a)=>{var n,d,l;const c="renderItem"in t&&t.renderItem||r.renderItem||Ra,s=null!==(n=null!==(d=t.key)&&void 0!==d?d:null===(l=t.id)||void 0===l?void 0:l.toString())&&void 0!==n?n:a.toString();return e.createElement(c,Or({showDivider:r.showItemDividers,selectionVariant:r.selectionVariant},t,{key:s,sx:{...i,...t.sx},item:o}))};let l=[];if(function(e){return"groupMetadata"in e}(r)){const e=r.groupMetadata.reduce(((e,r)=>e.set(r.groupId,r)),new Map);for(const t of r.items){var c,s,f;const r=e.get(t.groupId),o=null!==(c=null==r||null===(s=r.items)||void 0===s?void 0:s.length)&&void 0!==c?c:0;e.set(t.groupId,{...r,items:[...null!==(f=null==r?void 0:r.items)&&void 0!==f?f:[],d({showDivider:null==r?void 0:r.showItemDividers,...r&&"renderItem"in r&&{renderItem:r.renderItem},...t},t,o)]})}l=[...e.values()]}else l=[{items:r.items.map(((e,r)=>d(e,e,r))),groupId:"0"}];return e.createElement(Ha,Or({},r,{ref:t}),l.map((({header:t,...i},d)=>{const c="filled"===(null==t?void 0:t.variant),s=d>0&&!c;return e.createElement(e.Fragment,{key:i.groupId},s?e.createElement(wa,{key:`${i.groupId}-divider`}):null,(t=>{var o;const a=(null!==(o="renderGroup"in t&&t.renderGroup)&&void 0!==o?o:r.renderGroup)||ha;return e.createElement(a,Or({},t,{key:t.groupId}))})({sx:{...0===d&&o,...d===l.length-1&&a,...d>0&&!s&&{mt:2}},...t&&{header:{...t,sx:{...n,...t.sx}}},...i}))})))}));Oa.displayName="ActionList";const Pa=Object.assign(Oa,{Group:ha,Item:Ra,Divider:wa}),Ma={xsmall:"192px",small:"256px",medium:"320px",large:"432px",xlarge:"600px",auto:"auto",initial:"auto"},Da={small:"256px",medium:"320px",large:"480px",xlarge:"640px",xxlarge:"960px",auto:"auto"};const Fa=s.div`
|
|
558
|
+
`;const Oa=e.forwardRef(((r,t)=>{const{firstGroupStyle:o,lastGroupStyle:a,headerStyle:n,itemStyle:i}=function(e="inset"){switch(e){case"full":return{headerStyle:{paddingX:Cr("space.2")},itemStyle:{borderRadius:0}};default:return{firstGroupStyle:{marginTop:Cr("space.2")},lastGroupStyle:{marginBottom:Cr("space.2")},itemStyle:{marginX:Cr("space.2")}}}}(r.variant),d=(t,o,a)=>{var n,d,l;const c="renderItem"in t&&t.renderItem||r.renderItem||Ra,s=null!==(n=null!==(d="key"in t?t.key:void 0)&&void 0!==d?d:null===(l=t.id)||void 0===l?void 0:l.toString())&&void 0!==n?n:a.toString();return e.createElement(c,Or({showDivider:r.showItemDividers,selectionVariant:r.selectionVariant},t,{key:s,sx:{...i,...t.sx},item:o}))};let l=[];if(function(e){return"groupMetadata"in e}(r)){const e=r.groupMetadata.reduce(((e,r)=>e.set(r.groupId,r)),new Map);for(const t of r.items){var c,s,f;const r=e.get(t.groupId),o=null!==(c=null==r||null===(s=r.items)||void 0===s?void 0:s.length)&&void 0!==c?c:0;e.set(t.groupId,{...r,items:[...null!==(f=null==r?void 0:r.items)&&void 0!==f?f:[],d({showDivider:null==r?void 0:r.showItemDividers,...r&&"renderItem"in r&&{renderItem:r.renderItem},...t},t,o)]})}l=[...e.values()]}else l=[{items:r.items.map(((e,r)=>d(e,e,r))),groupId:"0"}];return e.createElement(Ha,Or({},r,{ref:t}),l.map((({header:t,...i},d)=>{const c="filled"===(null==t?void 0:t.variant),s=d>0&&!c;return e.createElement(e.Fragment,{key:i.groupId},s?e.createElement(wa,{key:`${i.groupId}-divider`}):null,(t=>{var o;const a=(null!==(o="renderGroup"in t&&t.renderGroup)&&void 0!==o?o:r.renderGroup)||ha;return e.createElement(a,Or({},t,{key:t.groupId}))})({sx:{...0===d&&o,...d===l.length-1&&a,...d>0&&!s&&{mt:2}},...t&&{header:{...t,sx:{...n,...t.sx}}},...i}))})))}));Oa.displayName="ActionList";const Pa=Object.assign(Oa,{Group:ha,Item:Ra,Divider:wa}),Ma={xsmall:"192px",small:"256px",medium:"320px",large:"432px",xlarge:"600px",auto:"auto",initial:"auto"},Da={small:"256px",medium:"320px",large:"480px",xlarge:"640px",xxlarge:"960px",auto:"auto"};const Fa=s.div`
|
|
558
559
|
background-color: ${Cr("colors.canvas.overlay")};
|
|
559
560
|
box-shadow: ${Cr("shadows.overlay.shadow")};
|
|
560
561
|
position: absolute;
|
|
@@ -748,8 +749,10 @@ Za=en,function(){var e={}.hasOwnProperty;function r(){for(var t=[],o=0;o<argumen
|
|
|
748
749
|
`,ln=s.nav`
|
|
749
750
|
display: flex;
|
|
750
751
|
justify-content: space-between;
|
|
752
|
+
${Nr};
|
|
753
|
+
${Hr};
|
|
751
754
|
${rt};
|
|
752
|
-
`;function cn({className:r,children:t,
|
|
755
|
+
`;function cn({className:r,children:t,theme:o,...a}){const n=e.Children.map(t,(r=>e.createElement(dn,{theme:o},r)));return e.createElement(ln,Or({className:r,"aria-label":"Breadcrumbs",theme:o},a),e.createElement(tt,{as:"ol",my:0,pl:0},n))}cn.displayName="Breadcrumbs";const sn=s.a.attrs((e=>({activeClassName:"string"==typeof e.to?"selected":"",className:rn(e.selected&&"selected",e.className),"aria-current":e.selected?"page":null})))`
|
|
753
756
|
color: ${Cr("colors.accent.fg")};
|
|
754
757
|
display: inline-block;
|
|
755
758
|
font-size: ${Cr("fontSizes.1")};
|
|
@@ -761,6 +764,7 @@ Za=en,function(){var e={}.hasOwnProperty;function r(){for(var t=[],o=0;o<argumen
|
|
|
761
764
|
color: ${Cr("colors.fg.default")};
|
|
762
765
|
pointer-events: none;
|
|
763
766
|
}
|
|
767
|
+
${Nr}
|
|
764
768
|
${rt};
|
|
765
769
|
`;cn.displayName="Breadcrumbs",sn.displayName="Breadcrumbs.Item";var fn=Object.assign(cn,{Item:sn});const gn=Object.assign(cn,{Item:sn}),bn={top:"Bottom",right:"Left",bottom:"Top",left:"Right"},pn={top:"Left",right:"Top",bottom:"Left",left:"Top"};function un(e,r,t){const o=bn[e].toLowerCase(),a=pn[e].toLowerCase();return{[o]:"100%",[r||a]:r?t:"50%"}}const mn=kr({prop:"bg",key:"colors"}),hn=kr({prop:"borderColor",key:"colors"}),xn=kr({prop:"borderWidth",key:"borderWidths",scale:[0,1]});function vn(r){var t;const o=e.useContext(p),a={...r,theme:null!==(t=r.theme)&&void 0!==t?t:o},{bg:n}=mn(a),{borderColor:i}=hn(a),{borderWidth:d}=xn(a),{size:l=8,location:c="bottom"}=r,[s,f]=function(e){const[r,t]=e.split("-");return[r,t]}(c),g=pn[s],b=[-l,0],u=[0,l],m=[l,0],h=`M${b}L${u}L${m}L${b}Z`,x=`M${b}L${u}L${m}`,v={top:`translate(${[l,2*l]}) rotate(180)`,right:`translate(${[0,l]}) rotate(-90)`,bottom:`translate(${[l,0]})`,left:`translate(${[2*l,l]}) rotate(90)`}[s];return e.createElement("svg",{width:2*l,height:2*l,style:{pointerEvents:"none",position:"absolute",...un(s,f,l),[`margin${g}`]:f?null:-l}},e.createElement("g",{transform:v},e.createElement("path",{d:h,fill:n}),e.createElement("path",{d:x,fill:"none",stroke:i,strokeWidth:d})))}vn.displayName="Caret",vn.locations=["top","top-left","top-right","right","right-top","right-bottom","bottom","bottom-left","bottom-right","left","left-top","left-bottom"],vn.defaultProps={bg:"bg.canvas",borderColor:"border.primary",borderWidth:1};const yn={small:56,medium:96,large:128},wn=s.div`
|
|
766
770
|
display: ${e=>e.inline?"inline-flex":"flex"};
|