@primer/components 0.0.0-202110320949 → 0.0.0-2021103211532
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 +2 -2
- package/dist/browser.esm.js +3 -2
- package/dist/browser.esm.js.map +1 -1
- package/dist/browser.umd.js +3 -2
- package/dist/browser.umd.js.map +1 -1
- package/lib/Dropdown.d.ts +5 -4
- package/lib/Dropdown.js +3 -3
- package/lib/Pagination/Pagination.js +1 -1
- package/lib-esm/Dropdown.d.ts +5 -4
- package/lib-esm/Dropdown.js +4 -4
- package/lib-esm/Pagination/Pagination.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# @primer/components
|
2
2
|
|
3
|
-
## 0.0.0-
|
3
|
+
## 0.0.0-2021103211532
|
4
4
|
|
5
5
|
### Major Changes
|
6
6
|
|
7
|
-
- [
|
7
|
+
- [`a1c9f550`](https://github.com/primer/react/commit/a1c9f550650e72809f08a488baa3cbfd496c9861) Thanks [@jfuchs](https://github.com/jfuchs)! - Pagination 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.
|
8
8
|
|
9
9
|
### Minor Changes
|
10
10
|
|
package/dist/browser.esm.js
CHANGED
@@ -932,6 +932,7 @@ import e,{useState as t,useRef as r,useCallback as o,useEffect as a,useMemo as n
|
|
932
932
|
height: 0;
|
933
933
|
vertical-align: middle;
|
934
934
|
width: 0;
|
935
|
+
${It};
|
935
936
|
${rr};
|
936
937
|
`,li=f.ul`
|
937
938
|
background-clip: padding-box;
|
@@ -975,6 +976,7 @@ import e,{useState as t,useRef as r,useCallback as o,useEffect as a,useMemo as n
|
|
975
976
|
list-style: none;
|
976
977
|
}
|
977
978
|
${e=>e.direction?ri(e.theme,e.direction):""};
|
979
|
+
${It};
|
978
980
|
${rr};
|
979
981
|
`,di=f.li`
|
980
982
|
display: block;
|
@@ -1007,6 +1009,7 @@ import e,{useState as t,useRef as r,useCallback as o,useEffect as a,useMemo as n
|
|
1007
1009
|
background-color: ${Nt("colors.accent.emphasis")};
|
1008
1010
|
outline: none;
|
1009
1011
|
}
|
1012
|
+
${It};
|
1010
1013
|
${rr};
|
1011
1014
|
`;li.defaultProps={direction:"sw"},li.displayName="Dropdown.Menu",di.displayName="Dropdown.Item",ni.defaultProps=qr.defaultProps,ni.displayName="Dropdown.Button",ii.displayName="Dropdown.Caret",ai.defaultProps=Gn.defaultProps;var si=Object.assign(ai,{Caret:ii,Menu:li,Item:di,Button:ni});const ci=e.forwardRef((({children:t,...r},o)=>e.createElement(qr,Pt({ref:o,type:"button"},r),t,e.createElement(Lo,{icon:uo,ml:1}))));function fi({renderAnchor:t=(t=>e.createElement(ci,t)),anchorRef:r,placeholder:a,selectedItem:i,onChange:l,overlayProps:d,items:s,open:c,onOpenChange:f,...g}){const[u,p]=Ka(c,f,!1),b=o((()=>p(!0)),[p]),m=o((()=>p(!1)),[p]),h=zr(r),v=n((()=>null===t?null:e=>{var r;return t({...e,children:null!==(r=null==i?void 0:i.text)&&void 0!==r?r:a})}),[a,t,null==i?void 0:i.text]),x=n((()=>s.map((e=>({...e,role:"option",selected:e===i,onAction:(t,r)=>{var o;null===(o=e.onAction)||void 0===o||o.call(e,t,r),r.defaultPrevented||(m(),null==l||l(e===i?void 0:e))}})))),[s,l,m,i]);return e.createElement(Va,{renderAnchor:v,anchorRef:h,open:u,onOpen:b,onClose:m,overlayProps:d},e.createElement(Da,Pt({},g,{role:"listbox",items:x})))}fi.displayName="DropdownMenu",fi.displayName="DropdownMenu";var gi=f.div`
|
1012
1015
|
${It};
|
@@ -1294,8 +1297,6 @@ import e,{useState as t,useRef as r,useCallback as o,useEffect as a,useMemo as n
|
|
1294
1297
|
);
|
1295
1298
|
}
|
1296
1299
|
}
|
1297
|
-
|
1298
|
-
${It};
|
1299
1300
|
`;function Di({theme:t,pageCount:r,currentPage:o,onPageChange:a,hrefBuilder:n,marginPageCount:i,showPages:l,surroundingPageCount:d}){const s=e.useCallback((e=>t=>a(t,e)),[a]),c=e.useMemo((()=>function(e,t,r,o,a){const n=[];if(r){const r=[],i=t=>{t>=1&&t<=e&&r.push(t)};let l=t-a,d=t+a;if(l<1&&d>e)l=1,d=e;else if(l<1)for(;l<1;)l++,d++;else if(d>e)for(;d>e;)l--,d--;for(let t=1;t<=o;t++){const r=t,o=e-(t-1);r>=l?d++:i(r),o<=d?l--:i(o)}for(let e=l;e<=d;e++)i(e);const s=r.slice().sort(((e,t)=>e-t)).filter(((e,t,r)=>!t||e!==r[t-1]));for(let e=0;e<s.length;e++){const r=s[e],o=r===t;0===e?(1!==r&&n.push({type:"BREAK",num:1}),n.push({type:"NUM",num:r,selected:o})):(1==r-s[e-1]||n.push({type:"BREAK",num:r-1}),n.push({type:"NUM",num:r,selected:o}))}const c=n[n.length-1];"NUM"===c.type&&c.num!==e&&n.push({type:"BREAK",num:e})}const i={type:"NEXT",num:t+1,disabled:t===e};return[{type:"PREV",num:t-1,disabled:1===t},...n,i]}(r,o,!!l,i,d)),[r,o,l,i,d]);return e.useMemo((()=>c.map((r=>{const{props:o,key:a,content:i}=function(e,t,r){const o={};let a="",n="";switch(e.type){case"PREV":n="page-prev",a="Previous",e.disabled?Object.assign(o,{as:"span","aria-disabled":"true"}):Object.assign(o,{rel:"prev",href:t(e.num),"aria-label":"Previous Page",onClick:r});break;case"NEXT":n="page-next",a="Next",e.disabled?Object.assign(o,{as:"span","aria-disabled":"true"}):Object.assign(o,{rel:"next",href:t(e.num),"aria-label":"Next Page",onClick:r});break;case"NUM":n=`page-${e.num}`,a=String(e.num),e.selected?Object.assign(o,{as:"em","aria-current":"page"}):Object.assign(o,{href:t(e.num),"aria-label":`Page ${e.num}`,onClick:r});break;case"BREAK":n=`page-${e.num}-break`,a="…",Object.assign(o,{as:"span","aria-disabled":!0})}return{props:o,key:n,content:a}}(r,n,s(r.num));return e.createElement(Hi,Pt({},o,{key:a,theme:t}),i)}))),[c,n,s,t])}const Wi=f.nav`
|
1300
1301
|
margin-top: 20px;
|
1301
1302
|
margin-bottom: 15px;
|