@primer/components 0.0.0-2021927182835 → 0.0.0-2021927184113

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,10 +1,12 @@
1
1
  # @primer/components
2
2
 
3
- ## 0.0.0-2021927182835
3
+ ## 0.0.0-2021927184113
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - Fake entry to force publishing
7
+ - [#1529](https://github.com/primer/react/pull/1529) [`d229b809`](https://github.com/primer/react/commit/d229b8096a26b2d69eaad50eaa219408a0f4bf93) Thanks [@mperrotti](https://github.com/mperrotti)! - Fixes a bug in `TextInputWithTokens` where the next token would not receive focus after the user deleted the first token using the keyboard
8
+
9
+ * Fake entry to force publishing
8
10
 
9
11
  ## 31.0.1
10
12
 
@@ -1904,7 +1904,7 @@ import e,{useState as t,useRef as r,useCallback as o,useEffect as a,useMemo as n
1904
1904
  `,zd=f("span")`
1905
1905
  flex-shrink: 0;
1906
1906
  line-height: 0;
1907
- `,Nd=i(((t,r)=>{const{as:o,onRemove:a,id:n,leadingVisual:i,text:l,size:d,hideRemoveButton:s,href:c,onClick:f,...g}=t,u=vd(t)&&Boolean(a)&&!s,p={as:o,href:c,onClick:f};return e.createElement(Cd,Pt({onRemove:a,hideRemoveButton:s||!a,id:null==n?void 0:n.toString(),text:l,size:d,isTokenInteractive:vd(t)},u?{}:p,g,{ref:r}),i?e.createElement(zd,null,e.createElement(i,null)):null,e.createElement(Ed,u?p:{},l),!s&&a?e.createElement(Sd,{borderOffset:1,onClick:e=>{e.stopPropagation(),a&&a()},size:d,isParentInteractive:vd(t),"aria-hidden":u?"true":"false",sx:u?{position:"relative",zIndex:"1"}:{}}):null)}));Nd.displayName="Token",Nd.defaultProps={size:"medium"};var Id=Nd;function Ad({icon:o,contrast:a,className:n,block:i,disabled:l,theme:d,sx:s,tokens:c,onTokenRemove:f,tokenComponent:g,preventTokenWrapping:u,size:p,hideTokenRemoveButtons:b,maxHeight:h,width:m,minWidth:v,maxWidth:x,variant:y,...w},B){const{onFocus:$,onKeyDown:k,...T}=function(e){var t={};for(var r in e)hd.test(r)||(t[r]=e[r]);return t}(w),S=zr(B),E=Do(r(null),S),[C,z]=t(),{containerRef:N}=Oo({focusOutBehavior:"wrap",bindKeys:Mr.ArrowHorizontal|Mr.HomeAndEnd,focusableElementFilter:e=>!e.getAttributeNames().includes("aria-hidden"),getNextFocusable:e=>{var t;if(!C&&0!==C)return;let r=C+1;return"next"===e&&(r+=1),"previous"===e&&(r-=1),r>c.length||r<1?E.current||void 0:null===(t=N.current)||void 0===t?void 0:t.children[r]}},[C]),I=e=>{if(f(e),C){var t;(null===(t=N.current)||void 0===t?void 0:t.children[C]).focus()}},A=()=>{z(void 0)},R=e=>{var t;"Escape"===e.key&&(null===(t=S.current)||void 0===t||t.focus())};return e.createElement(on,{block:i,className:n,contrast:a,disabled:l,hasIcon:!!o,theme:d,width:m,minWidth:v,maxWidth:x,variant:y,ref:N,sx:{alignItems:"center",flexWrap:u?"nowrap":"wrap",gap:"0.25rem","> *":{flexShrink:0},...i?{display:"flex",width:"100%"}:{},...h?{maxHeight:h,overflow:"auto"}:{},...u?{overflow:"auto"}:{},...s}},e.createElement(or,{sx:{order:1,flexGrow:1}},o&&e.createElement(o,{className:"TextInput-icon"}),e.createElement(tn,Pt({ref:E,disabled:l,onFocus:e=>{$&&$(e),z(void 0)},onKeyDown:e=>{var t;if(k&&k(e),null!==(t=S.current)&&void 0!==t&&t.value)return;const r=c[c.length-1];"Backspace"===e.key&&r&&(I(r.id),S.current&&(S.current.value=`${r.text} `),setTimeout((()=>{var e;null===(e=S.current)||void 0===e||e.select()}),0))},type:"text",sx:{height:"100%"}},T))),c.length&&g?c.map((({id:t,...r},o)=>{return e.createElement(g,Pt({key:t,onFocus:(a=o,()=>{z(a)}),onBlur:A,onKeyUp:R,isSelected:C===o,onRemove:()=>{I(t)},hideRemoveButton:b,size:p,tabIndex:0},r));var a})):null)}Ad.displayName="TextInputWithTokensInnerComponent";const Rd=e.forwardRef(Ad);Rd.defaultProps={tokenComponent:Id,size:"extralarge",hideTokenRemoveButtons:!1,preventTokenWrapping:!1},Rd.displayName="TextInputWithTokens";var Ld=Rd;const Od=f(or)`
1907
+ `,Nd=i(((t,r)=>{const{as:o,onRemove:a,id:n,leadingVisual:i,text:l,size:d,hideRemoveButton:s,href:c,onClick:f,...g}=t,u=vd(t)&&Boolean(a)&&!s,p={as:o,href:c,onClick:f};return e.createElement(Cd,Pt({onRemove:a,hideRemoveButton:s||!a,id:null==n?void 0:n.toString(),text:l,size:d,isTokenInteractive:vd(t)},u?{}:p,g,{ref:r}),i?e.createElement(zd,null,e.createElement(i,null)):null,e.createElement(Ed,u?p:{},l),!s&&a?e.createElement(Sd,{borderOffset:1,onClick:e=>{e.stopPropagation(),a&&a()},size:d,isParentInteractive:vd(t),"aria-hidden":u?"true":"false",sx:u?{position:"relative",zIndex:"1"}:{}}):null)}));Nd.displayName="Token",Nd.defaultProps={size:"medium"};var Id=Nd;function Ad({icon:o,contrast:a,className:n,block:i,disabled:l,theme:d,sx:s,tokens:c,onTokenRemove:f,tokenComponent:g,preventTokenWrapping:u,size:p,hideTokenRemoveButtons:b,maxHeight:h,width:m,minWidth:v,maxWidth:x,variant:y,...w},B){const{onFocus:$,onKeyDown:k,...T}=function(e){var t={};for(var r in e)hd.test(r)||(t[r]=e[r]);return t}(w),S=zr(B),E=Do(r(null),S),[C,z]=t(),{containerRef:N}=Oo({focusOutBehavior:"wrap",bindKeys:Mr.ArrowHorizontal|Mr.HomeAndEnd,focusableElementFilter:e=>!e.getAttributeNames().includes("aria-hidden"),getNextFocusable:e=>{var t;if(!C&&0!==C)return;let r=C+1;return"next"===e&&(r+=1),"previous"===e&&(r-=1),r>c.length||r<1?E.current||void 0:null===(t=N.current)||void 0===t?void 0:t.children[r]}},[C]),I=e=>{f(e),setTimeout((()=>{var e,t;const r=null===(e=N.current)||void 0===e?void 0:e.children[C||0],o=r&&$r(r)?r:Array.from((null===(t=N.current)||void 0===t?void 0:t.children)||[]).find((e=>$r(e)));var a;o?o.focus():null===(a=S.current)||void 0===a||a.focus()}),0)},A=()=>{z(void 0)},R=e=>{var t;"Escape"===e.key&&(null===(t=S.current)||void 0===t||t.focus())};return e.createElement(on,{block:i,className:n,contrast:a,disabled:l,hasIcon:!!o,theme:d,width:m,minWidth:v,maxWidth:x,variant:y,ref:N,sx:{alignItems:"center",flexWrap:u?"nowrap":"wrap",gap:"0.25rem","> *":{flexShrink:0},...i?{display:"flex",width:"100%"}:{},...h?{maxHeight:h,overflow:"auto"}:{},...u?{overflow:"auto"}:{},...s}},e.createElement(or,{sx:{order:1,flexGrow:1}},o&&e.createElement(o,{className:"TextInput-icon"}),e.createElement(tn,Pt({ref:E,disabled:l,onFocus:e=>{$&&$(e),z(void 0)},onKeyDown:e=>{var t;if(k&&k(e),null!==(t=S.current)&&void 0!==t&&t.value)return;const r=c[c.length-1];"Backspace"===e.key&&r&&(I(r.id),S.current&&(S.current.value=`${r.text} `),setTimeout((()=>{var e;null===(e=S.current)||void 0===e||e.select()}),0))},type:"text",sx:{height:"100%"}},T))),c.length&&g?c.map((({id:t,...r},o)=>{return e.createElement(g,Pt({key:t,onFocus:(a=o,()=>{z(a)}),onBlur:A,onKeyUp:R,isSelected:C===o,onRemove:()=>{I(t)},hideRemoveButton:b,size:p,tabIndex:0},r));var a})):null)}Ad.displayName="TextInputWithTokensInnerComponent";const Rd=e.forwardRef(Ad);Rd.defaultProps={tokenComponent:Id,size:"extralarge",hideTokenRemoveButtons:!1,preventTokenWrapping:!1},Rd.displayName="TextInputWithTokens";var Ld=Rd;const Od=f(or)`
1908
1908
  display: flex;
1909
1909
  flex-direction: column;
1910
1910
  ${e=>e.clipSidebar&&p([".Timeline-Item:first-child{padding-top:0;}.Timeline-Item:last-child{padding-bottom:0;}"])}