@primer/components 0.0.0-20211010195439 → 0.0.0-2021101022627

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 CHANGED
@@ -1,6 +1,10 @@
1
1
  # @primer/components
2
2
 
3
- ## 0.0.0-20211010195439
3
+ ## 0.0.0-2021101022627
4
+
5
+ ### Major Changes
6
+
7
+ - [#1567](https://github.com/primer/react/pull/1567) [`375ef1d9`](https://github.com/primer/react/commit/375ef1d9c98caa155ed032385dbd0998288dc462) Thanks [@jfuchs](https://github.com/jfuchs)! - Overlay no longer accepts styled-system props. Please use the `sx` prop to extend Primer component styling instead. See also https://primer.style/react/overriding-styles for information about `sx` and https://primer.style/react/system-props for context on the removal.
4
8
 
5
9
  ### Minor Changes
6
10
 
@@ -12,9 +16,7 @@
12
16
 
13
17
  * Fake entry to force publishing
14
18
 
15
- - [#1596](https://github.com/primer/react/pull/1596) [`38a352f5`](https://github.com/primer/react/commit/38a352f53babe7f11f6c67960a61cddd26bebcc0) Thanks [@dmarcey](https://github.com/dmarcey)! - Fix alignment of items in ActionList (single-select) if some of the items have wrapping text.
16
-
17
- * [#1549](https://github.com/primer/react/pull/1549) [`f565840f`](https://github.com/primer/react/commit/f565840f2d879b987ef9df7cd046e146214ed5f5) Thanks [@michael-lefebvre](https://github.com/michael-lefebvre)! - Fix `auxiliaryText` in ActionList Group header
19
+ - [#1549](https://github.com/primer/react/pull/1549) [`f565840f`](https://github.com/primer/react/commit/f565840f2d879b987ef9df7cd046e146214ed5f5) Thanks [@michael-lefebvre](https://github.com/michael-lefebvre)! - Fix `auxiliaryText` in ActionList Group header
18
20
 
19
21
  ## 31.1.0
20
22
 
@@ -517,13 +517,13 @@ import e,{useState as t,useRef as r,useCallback as o,useEffect as a,useMemo as n
517
517
  height: 20px;
518
518
  width: ${Nt("space.3")};
519
519
  margin-right: ${Nt("space.2")};
520
- flex-shrink: 0;
521
520
  `,Ra=f(Aa)`
522
521
  svg {
523
522
  fill: ${({variant:e,disabled:t})=>Ea(e,t).iconColor};
524
523
  font-size: ${Nt("fontSizes.0")};
525
524
  }
526
525
  `,La=f(Ra)`
526
+ flex-shrink: 0;
527
527
  display: flex;
528
528
  flex-direction: column;
529
529
  justify-content: center;
@@ -585,9 +585,8 @@ import e,{useState as t,useRef as r,useCallback as o,useEffect as a,useMemo as n
585
585
  :focus {
586
586
  outline: none;
587
587
  }
588
- ${It};
589
588
  ${rr};
590
- `,Ga=e.forwardRef((({onClickOutside:t,role:o="none",initialFocusRef:n,returnFocusRef:i,ignoreClickRefs:l,onEscape:d,visibility:s="visible",height:c,top:f,left:g,anchorSide:u,portalContainerName:p,preventFocusOnOpen:b,...m},h)=>{const v=r(null),x=Wo(v,h),{theme:y}=Zt(),w=parseInt(Nt("space.2")(y).replace("px","")),B=Nt("animation.easeOutCubic")(y);return Nr({overlayRef:v,returnFocusRef:i,onEscape:d,ignoreClickRefs:l,onClickOutside:t,initialFocusRef:n,preventFocusOnOpen:b}),a((()=>{var e;"initial"===c&&null!==(e=x.current)&&void 0!==e&&e.clientHeight&&(x.current.style.height=`${x.current.clientHeight}px`)}),[c,x]),So((()=>{var e;const{x:t,y:r}=function(e){return null!=e&&e.endsWith("bottom")?{x:0,y:-1}:null!=e&&e.endsWith("top")?{x:0,y:1}:null!=e&&e.endsWith("right")?{x:-1,y:0}:null!=e&&e.endsWith("left")?{x:1,y:0}:{x:0,y:0}}(u);(t||r)&&null!==(e=v.current)&&void 0!==e&&e.animate&&"hidden"!==s&&v.current.animate({transform:[`translate(${w*t}px, ${w*r}px)`,"translate(0, 0)"]},{duration:200,easing:B})}),[u,w,B,s]),e.createElement(Do,{containerName:p},e.createElement(Ua,Pt({height:c,role:o},m,{ref:x,style:{top:`${f||0}px`,left:`${g||0}px`,...m.style,"--styled-overlay-visibility":s}})))}));Ga.defaultProps={height:"auto",width:"auto"};var Va=Ga;const Ka=({renderAnchor:n,anchorRef:i,children:l,open:d,onOpen:s,onClose:c,height:f,width:g,overlayProps:u,focusTrapSettings:p,focusZoneSettings:b,side:m,align:h})=>{const v=zr(i),[x,y]=function(){const[e,a]=t(null),n=r(null);n.current=e;const i=o((e=>{n.current=e,a(e)}),[n]);return[n,i]}(),w=Go(),B=o((()=>null==c?void 0:c("click-outside")),[c]),$=o((()=>null==c?void 0:c("escape")),[c]),k=o((e=>{e.defaultPrevented||!d&&["ArrowDown","ArrowUp"," ","Enter"].includes(e.key)&&(null==s||s("anchor-key-press"),e.preventDefault())}),[d,s]),T=o((e=>{e.defaultPrevented||0!==e.button||(d?null==c||c("anchor-click"):null==s||s("anchor-click"))}),[d,s,c]),{position:S}=Eo({anchorElementRef:v,floatingElementRef:x,side:m,align:h},[x.current]);return a((()=>{!d&&x.current&&y(null)}),[d,x,y]),Mo({containerRef:x,disabled:!d||!S,...b}),Ao({containerRef:x,disabled:!d||!S,...p}),e.createElement(e.Fragment,null,n&&n({ref:v,id:w,"aria-labelledby":w,"aria-haspopup":"true",tabIndex:0,onClick:T,onKeyDown:k}),d?e.createElement(Va,Pt({returnFocusRef:v,onClickOutside:B,ignoreClickRefs:[v],onEscape:$,ref:y,role:"none",visibility:S?"visible":"hidden",height:f,width:g,top:(null==S?void 0:S.top)||0,left:(null==S?void 0:S.left)||0,anchorSide:null==S?void 0:S.anchorSide},u),l):null)};function qa(e,r,a){const[n,i]=t(a);return[null!=e?e:n,o((e=>{i(e),r&&r(e)}),[r])]}Ka.displayName="AnchoredOverlay",Ka.defaultProps={side:"outside-bottom",align:"start"};const Xa=t=>e.createElement(Ha,Pt({role:"menuitem"},t));Xa.displayName="ActionMenuItem",Xa.displayName="ActionMenu.Item";const Ya=({anchorContent:t,renderAnchor:r=(t=>e.createElement(qr,t)),anchorRef:a,onAction:i,open:l,setOpen:d,overlayProps:s,items:c,...f})=>{const[g,u]=qa(l,d,!1),p=zr(a),b=o((()=>u(!0)),[u]),m=o((()=>u(!1)),[u]),h=n((()=>null===r?null:e=>r({"aria-label":"menu",children:t,...e})),[t,r]),v=n((()=>c.map((e=>({...e,role:"menuitem",onAction:(t,r)=>{var o;const a=null!==(o=e.onAction)&&void 0!==o?o:i;null==a||a(t,r),r.defaultPrevented||m()}})))),[c,i,m]);return e.createElement(Ka,{renderAnchor:h,anchorRef:p,open:g,onOpen:b,onClose:m,overlayProps:s},e.createElement(Wa,Pt({},f,{role:"menu",items:v})))};Ya.displayName="ActionMenuBase",Ya.displayName="ActionMenu";const Ja=Object.assign(Ya,{Divider:Ta,Item:Xa}),Za=s(null);var Qa,en={exports:{}};
589
+ `,Ga=e.forwardRef((({onClickOutside:t,role:o="none",initialFocusRef:n,returnFocusRef:i,ignoreClickRefs:l,onEscape:d,visibility:s="visible",height:c,top:f,left:g,anchorSide:u,portalContainerName:p,preventFocusOnOpen:b,...m},h)=>{const v=r(null),x=Wo(v,h),{theme:y}=Zt(),w=parseInt(Nt("space.2")(y).replace("px","")),B=Nt("animation.easeOutCubic")(y);return Nr({overlayRef:v,returnFocusRef:i,onEscape:d,ignoreClickRefs:l,onClickOutside:t,initialFocusRef:n,preventFocusOnOpen:b}),a((()=>{var e;"initial"===c&&null!==(e=x.current)&&void 0!==e&&e.clientHeight&&(x.current.style.height=`${x.current.clientHeight}px`)}),[c,x]),So((()=>{var e;const{x:t,y:r}=function(e){return null!=e&&e.endsWith("bottom")?{x:0,y:-1}:null!=e&&e.endsWith("top")?{x:0,y:1}:null!=e&&e.endsWith("right")?{x:-1,y:0}:null!=e&&e.endsWith("left")?{x:1,y:0}:{x:0,y:0}}(u);(t||r)&&null!==(e=v.current)&&void 0!==e&&e.animate&&"hidden"!==s&&v.current.animate({transform:[`translate(${w*t}px, ${w*r}px)`,"translate(0, 0)"]},{duration:200,easing:B})}),[u,w,B,s]),e.createElement(Do,{containerName:p},e.createElement(Ua,Pt({height:c,role:o},m,{ref:x,style:{top:`${f||0}px`,left:`${g||0}px`,"--styled-overlay-visibility":s}})))}));Ga.defaultProps={height:"auto",width:"auto"};var Va=Ga;const Ka=({renderAnchor:n,anchorRef:i,children:l,open:d,onOpen:s,onClose:c,height:f,width:g,overlayProps:u,focusTrapSettings:p,focusZoneSettings:b,side:m,align:h})=>{const v=zr(i),[x,y]=function(){const[e,a]=t(null),n=r(null);n.current=e;const i=o((e=>{n.current=e,a(e)}),[n]);return[n,i]}(),w=Go(),B=o((()=>null==c?void 0:c("click-outside")),[c]),$=o((()=>null==c?void 0:c("escape")),[c]),k=o((e=>{e.defaultPrevented||!d&&["ArrowDown","ArrowUp"," ","Enter"].includes(e.key)&&(null==s||s("anchor-key-press"),e.preventDefault())}),[d,s]),T=o((e=>{e.defaultPrevented||0!==e.button||(d?null==c||c("anchor-click"):null==s||s("anchor-click"))}),[d,s,c]),{position:S}=Eo({anchorElementRef:v,floatingElementRef:x,side:m,align:h},[x.current]);return a((()=>{!d&&x.current&&y(null)}),[d,x,y]),Mo({containerRef:x,disabled:!d||!S,...b}),Ao({containerRef:x,disabled:!d||!S,...p}),e.createElement(e.Fragment,null,n&&n({ref:v,id:w,"aria-labelledby":w,"aria-haspopup":"true",tabIndex:0,onClick:T,onKeyDown:k}),d?e.createElement(Va,Pt({returnFocusRef:v,onClickOutside:B,ignoreClickRefs:[v],onEscape:$,ref:y,role:"none",visibility:S?"visible":"hidden",height:f,width:g,top:(null==S?void 0:S.top)||0,left:(null==S?void 0:S.left)||0,anchorSide:null==S?void 0:S.anchorSide},u),l):null)};function qa(e,r,a){const[n,i]=t(a);return[null!=e?e:n,o((e=>{i(e),r&&r(e)}),[r])]}Ka.displayName="AnchoredOverlay",Ka.defaultProps={side:"outside-bottom",align:"start"};const Xa=t=>e.createElement(Ha,Pt({role:"menuitem"},t));Xa.displayName="ActionMenuItem",Xa.displayName="ActionMenu.Item";const Ya=({anchorContent:t,renderAnchor:r=(t=>e.createElement(qr,t)),anchorRef:a,onAction:i,open:l,setOpen:d,overlayProps:s,items:c,...f})=>{const[g,u]=qa(l,d,!1),p=zr(a),b=o((()=>u(!0)),[u]),m=o((()=>u(!1)),[u]),h=n((()=>null===r?null:e=>r({"aria-label":"menu",children:t,...e})),[t,r]),v=n((()=>c.map((e=>({...e,role:"menuitem",onAction:(t,r)=>{var o;const a=null!==(o=e.onAction)&&void 0!==o?o:i;null==a||a(t,r),r.defaultPrevented||m()}})))),[c,i,m]);return e.createElement(Ka,{renderAnchor:h,anchorRef:p,open:g,onOpen:b,onClose:m,overlayProps:s},e.createElement(Wa,Pt({},f,{role:"menu",items:v})))};Ya.displayName="ActionMenuBase",Ya.displayName="ActionMenu";const Ja=Object.assign(Ya,{Divider:Ta,Item:Xa}),Za=s(null);var Qa,en={exports:{}};
591
590
  /*!
592
591
  Copyright (c) 2018 Jed Watson.
593
592
  Licensed under the MIT License (MIT), see