@spscommerce/ds-react 8.14.2 → 8.15.1

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/lib/index.cjs.js CHANGED
@@ -5695,7 +5695,7 @@ var r=n.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_
5695
5695
  <br />
5696
5696
  {JSON.stringify(formValue)}
5697
5697
  </>
5698
- }`}}}},HN={page:"number",numPages:"number",onPageChange:"(number) => void",disabled:"boolean",unknownPageCount:"boolean",nextPageBtnDisabled:"boolean",onBeforeChange:"(page: number) => boolean | Promise<boolean>"};function yo(e){const{numPages:t=0,onPageChange:n,page:r=1,unsafelyReplaceClassName:o,className:a,"data-testid":l,disabled:c=!1,unknownPageCount:p=!1,nextPageBtnDisabled:m=!1,onBeforeChange:f,...u}=e,{t:h}=s.useContext($e),[S,y]=s.useState(r),[T,E]=s.useState(r);s.useEffect(()=>{E(r),y(r)},[r]);async function w(k){if(f&&!await f(k))return;const F=v.constrain(k,[1,t]);k!==T&&(E(F),y(F),n&&typeof n=="function"&&n(F))}function N(k){y(Number(k.target.value)||"")}const I=W(o||"sps-page-selector",a),x=wn();return s.createElement("div",{className:I,"data-testid":l,...u},!p&&s.createElement(s.Fragment,null,s.createElement("div",{className:"sps-pagination__input-wrapper","data-testid":`${l}__input`},s.createElement("div",{className:"sps-form-control sps-pagination__input-sizer"},S),s.createElement("label",{htmlFor:x.current,className:"sr-only"},h("design-system:pagination.page")),s.createElement(ps,{onSubmit:()=>w(Number(S))},s.createElement("input",{id:x.current,type:"text",value:S,onInput:N,onChange:()=>{},className:"sps-form-control sps-pagination__input",disabled:c,onBlur:()=>w(Number(S))}))),s.createElement("span",{className:"sps-page-selector__total-pages","data-testid":`${l}_page-count`},Number.isNaN(t)?h("design-system:pagination.ofMany"):h("design-system:pagination.ofPageCount",{pageCount:t}))),s.createElement("div",{className:"sps-icon-button-panel","data-testid":`${l}__buttons`},s.createElement("div",{className:W("sps-button","sps-button--icon",(T===1||c)&&"sps-button--disabled")},s.createElement("button",{type:"button",onClick:()=>w(T-1),disabled:T===1||c,title:h("design-system:pagination.prevPage")},s.createElement("i",{className:"sps-icon sps-icon-chevron-left","aria-hidden":"true"}))),s.createElement("div",{className:W("sps-button","sps-button--icon",(T===t||c||m)&&"sps-button--disabled")},s.createElement("button",{type:"button",onClick:()=>w(T+1),disabled:T===t||c||m,title:h("design-system:pagination.nextPage")},s.createElement("i",{className:"sps-icon sps-icon-chevron-right","aria-hidden":"true"})))))}Object.assign(yo,{props:HN,displayName:"SpsPageSelector"});const WN={page:"number",pageSize:"number",pageSizeOptions:"Array<number>",totalResults:"number",onPageChange:"(page: number, pageSize: number, indices: [number, number]) => void",disabled:"boolean",unknownPageCount:"boolean",nextPageBtnDisabled:"boolean",resultsOnPage:"number",onBeforeChange:"(page: number, pageSize: number) => boolean | Promise<boolean>"};function qi(e){const{className:t,onPageChange:n,page:r=1,pageSizeOptions:o=H.DEFAULT_PAGE_SIZE_OPTIONS,pageSize:a=o[0],"data-testid":l,totalResults:c,unsafelyReplaceClassName:p,disabled:m=!1,unknownPageCount:f=!1,nextPageBtnDisabled:u=!1,resultsOnPage:h,onBeforeChange:S,...y}=e,[T,E]=Jt({page:r,pageSize:a,numPages:0,indices:[0,0]});function w(O=T.pageSize){return c!==void 0?Math.ceil(c/O):NaN}function N(O=T.page,R=T.pageSize){const $=w(R),j=O===$&&c!==void 0&&c%R||R,M=h||($===0?0:j),Y=(O-1)*R;return $===0?[0,0]:[Y+1,Y+M]}function I(O){const R={page:O,indices:N(O)};return E(R),R}function x(O,R){const $={page:R,pageSize:O,numPages:w(O),indices:N(R,O)};return E($),$}s.useEffect(()=>{E({numPages:w(),indices:N()})},[c,h]),s.useEffect(()=>{r!==T.page&&I(r)},[r]),s.useEffect(()=>{a!==T.pageSize&&x(a,r!==T.page?r:T.page)},[a]);function k(){return typeof c=="number"?c:"many"}function F(O){const R=x(O.target.value,1);n(R.page,R.pageSize,R.indices)}function L(O){const R=I(O);n(R.page,T.pageSize,R.indices)}const C=W(p||"sps-pagination",t);return s.createElement("div",{className:C,"data-testid":l,...y},s.createElement("div",{"data-testid":`${l}__size-selector`,className:"sps-page-size-selector"},"View",s.createElement(Un,{options:o,onChange:F,notClearable:!0,autoFixWidth:!0,value:T.pageSize,className:"ml-1 mr-1",disabled:m,onBeforeChange:S?O=>S(T.page,Number(O)):void 0}),"Per Page"),f?s.createElement("div",{className:"sps-pagination__details"},`Viewing ${T.indices[0]} - ${T.indices[1]}`):s.createElement("div",{className:"sps-pagination__details"},`Viewing ${T.indices[0]} - ${T.indices[1]} of ${k()}`),s.createElement(yo,{numPages:T.numPages,page:T.page,onPageChange:L,disabled:m,unknownPageCount:f,nextPageBtnDisabled:u,onBeforeChange:S?O=>S(O,T.pageSize):void 0}))}Object.assign(qi,{props:WN,displayName:"SpsPagination"});const Fm={general:{label:"General Usage",description:()=>s.createElement(s.Fragment,null,s.createElement("p",null,"Use the Standard Pagination Bar on a list page (comprised of a Table, Content Rows, or Content Tiles). It should always appear at the bottom of the listed records."),s.createElement("p",null,"Use the Mini Pagination component when a paginated list of results exists inside a smaller Card."))},pagination:{label:"Standard Pagination Bar",description:({Link:e})=>s.createElement(s.Fragment,null,s.createElement("p",null,"The Standard Pagination Bar is comprised of three main sections. The middle section is hidden from view when the width of its container is at the responsive breakpoint of 767 pixels."),s.createElement("ul",null,s.createElement("li",null,s.createElement("p",null,s.createElement("span",{className:"sps-text-semibold"},"Results-per-page Select")," (left): allows the user to adjust the number of records being displayed per page.*")),s.createElement("li",null,s.createElement("p",null,s.createElement("span",{className:"sps-text-semibold"},"Viewing details")," (middle): describes which results are being displayed on the current page.")),s.createElement("li",null,s.createElement("p",null,s.createElement("span",{className:"sps-text-semibold"},"Page Navigator")," (right): allows the user to navigate between pages of results"))),s.createElement("i",null,"*Note: For Tables and Content Rows, per-page options should be 25, 50, and 100. For Content Tiles, per-page options should be 24, 48, and 100."),s.createElement("br",null),s.createElement("p",{className:"mt-2"},"To see an example of the Standard Pagination Bar in context with a Table, view the Table Lists section on the ",s.createElement(e,{to:"/style-and-layout/page-types"},"Page Types")," page.")),examples:{basic:{description:()=>s.createElement("h4",null,"Building the Standard Pagination Bar"),react:v.code`
5698
+ }`}}}},HN={page:"number",numPages:"number",onPageChange:"(number) => void",disabled:"boolean",unknownPageCount:"boolean",nextPageBtnDisabled:"boolean",onBeforeChange:"(page: number) => boolean | Promise<boolean>"};function yo(e){const{numPages:t=0,onPageChange:n,page:r=1,unsafelyReplaceClassName:o,className:a,"data-testid":l,disabled:c=!1,unknownPageCount:p=!1,nextPageBtnDisabled:m=!1,onBeforeChange:f,...u}=e,{t:h}=s.useContext($e),[S,y]=s.useState(r),[T,E]=s.useState(r);s.useEffect(()=>{E(r),y(r)},[r]);async function w(k){if(f&&!await f(k))return;const F=v.constrain(k,[1,t]);k!==T&&(E(F),y(F),n&&typeof n=="function"&&n(F))}function N(k){y(Number(k.target.value)||"")}const I=W(o||"sps-page-selector",a),x=wn();return s.createElement("div",{className:I,"data-testid":l,...u},!p&&s.createElement(s.Fragment,null,s.createElement("div",{className:"sps-pagination__input-wrapper","data-testid":`${l}__input`},s.createElement("div",{className:"sps-form-control sps-pagination__input-sizer"},S),s.createElement("label",{htmlFor:x.current,className:"sr-only"},h("design-system:pagination.page")),s.createElement(ps,{onSubmit:()=>w(Number(S))},s.createElement("input",{id:x.current,type:"text",value:S,onInput:N,onChange:()=>{},className:"sps-form-control sps-pagination__input",disabled:c,onBlur:()=>w(Number(S))}))),s.createElement("span",{className:"sps-page-selector__total-pages","data-testid":`${l}_page-count`},Number.isNaN(t)?h("design-system:pagination.ofMany"):h("design-system:pagination.ofPageCount",{pageCount:t}))),s.createElement("div",{className:"sps-icon-button-panel","data-testid":`${l}__buttons`},s.createElement("div",{className:W("sps-button","sps-button--icon",(T===1||c)&&"sps-button--disabled")},s.createElement("button",{type:"button",onClick:()=>w(T-1),disabled:T===1||c,title:h("design-system:pagination.prevPage")},s.createElement("i",{className:"sps-icon sps-icon-chevron-left","aria-hidden":"true"}))),s.createElement("div",{className:W("sps-button","sps-button--icon",(T===t||c||m)&&"sps-button--disabled")},s.createElement("button",{type:"button",onClick:()=>w(T+1),disabled:T===t||c||m,title:h("design-system:pagination.nextPage")},s.createElement("i",{className:"sps-icon sps-icon-chevron-right","aria-hidden":"true"})))))}Object.assign(yo,{props:HN,displayName:"SpsPageSelector"});const WN={page:"number",pageSize:"number",pageSizeOptions:"Array<number>",totalResults:"number",onPageChange:"(page: number, pageSize: number, indices: [number, number]) => void",disabled:"boolean",unknownPageCount:"boolean",nextPageBtnDisabled:"boolean",resultsOnPage:"number",onBeforeChange:"(page: number, pageSize: number) => boolean | Promise<boolean>"};function qi(e){const{className:t,onPageChange:n,page:r=1,pageSizeOptions:o=H.DEFAULT_PAGE_SIZE_OPTIONS,pageSize:a=o[0],"data-testid":l,totalResults:c,unsafelyReplaceClassName:p,disabled:m=!1,unknownPageCount:f=!1,nextPageBtnDisabled:u=!1,resultsOnPage:h,onBeforeChange:S,...y}=e,[T,E]=Jt({page:r,pageSize:a,numPages:0,indices:[0,0]});function w(O=T.pageSize){return c!==void 0?Math.ceil(c/O):NaN}function N(O=T.page,R=T.pageSize){const $=w(R),j=O===$&&c!==void 0&&c%R||R,M=h||($===0?0:j),Y=(O-1)*R;return $===0?[0,0]:[Y+1,Y+M]}function I(O){const R={page:O,indices:N(O)};return E(R),R}function x(O,R){const $={page:R,pageSize:O,numPages:w(O),indices:N(R,O)};return E($),$}s.useEffect(()=>{E({numPages:w(),indices:N()})},[c,h]),s.useEffect(()=>{r!==T.page&&I(r)},[r]),s.useEffect(()=>{a!==T.pageSize&&x(a,r!==T.page?r:T.page)},[a]);function k(){return typeof c=="number"?c:"many"}function F(O){const R=x(O.target.value,1);n(R.page,R.pageSize,R.indices)}function L(O){const R=I(O);n(R.page,T.pageSize,R.indices)}const C=W(p||"sps-pagination",t);return s.createElement("div",{className:C,"data-testid":l,...y},s.createElement("div",{"data-testid":`${l}__size-selector`,className:"sps-page-size-selector"},"View",s.createElement(Un,{options:o,onChange:F,notClearable:!0,autoFixWidth:!0,value:T.pageSize,className:"ml-1 mr-1",disabled:m,onBeforeChange:S?O=>S(T.page,Number(O)):void 0}),"Per Page"),f?s.createElement("div",{className:"sps-pagination__details"},`Viewing ${T.indices[0]} - ${T.indices[1]} of many`):s.createElement("div",{className:"sps-pagination__details"},`Viewing ${T.indices[0]} - ${T.indices[1]} of ${k()}`),s.createElement(yo,{numPages:T.numPages,page:T.page,onPageChange:L,disabled:m,unknownPageCount:f,nextPageBtnDisabled:u,onBeforeChange:S?O=>S(O,T.pageSize):void 0}))}Object.assign(qi,{props:WN,displayName:"SpsPagination"});const Fm={general:{label:"General Usage",description:()=>s.createElement(s.Fragment,null,s.createElement("p",null,"Use the Standard Pagination Bar on a list page (comprised of a Table, Content Rows, or Content Tiles). It should always appear at the bottom of the listed records."),s.createElement("p",null,"Use the Mini Pagination component when a paginated list of results exists inside a smaller Card."))},pagination:{label:"Standard Pagination Bar",description:({Link:e})=>s.createElement(s.Fragment,null,s.createElement("p",null,"The Standard Pagination Bar is comprised of three main sections. The middle section is hidden from view when the width of its container is at the responsive breakpoint of 767 pixels."),s.createElement("ul",null,s.createElement("li",null,s.createElement("p",null,s.createElement("span",{className:"sps-text-semibold"},"Results-per-page Select")," (left): allows the user to adjust the number of records being displayed per page.*")),s.createElement("li",null,s.createElement("p",null,s.createElement("span",{className:"sps-text-semibold"},"Viewing details")," (middle): describes which results are being displayed on the current page.")),s.createElement("li",null,s.createElement("p",null,s.createElement("span",{className:"sps-text-semibold"},"Page Navigator")," (right): allows the user to navigate between pages of results"))),s.createElement("i",null,"*Note: For Tables and Content Rows, per-page options should be 25, 50, and 100. For Content Tiles, per-page options should be 24, 48, and 100."),s.createElement("br",null),s.createElement("p",{className:"mt-2"},"To see an example of the Standard Pagination Bar in context with a Table, view the Table Lists section on the ",s.createElement(e,{to:"/style-and-layout/page-types"},"Page Types")," page.")),examples:{basic:{description:()=>s.createElement("h4",null,"Building the Standard Pagination Bar"),react:v.code`
5699
5699
  import { SpsPagination } from "@spscommerce/ds-react";
5700
5700
  function Component() {
5701
5701
  const [page, setPage] = React.useState(2);
package/lib/index.es.js CHANGED
@@ -23172,7 +23172,7 @@ function Ku(e) {
23172
23172
  disabled: m,
23173
23173
  onBeforeChange: S ? (O) => S(E.page, Number(O)) : void 0
23174
23174
  }
23175
- ), "Per Page"), f ? /* @__PURE__ */ s.createElement("div", { className: "sps-pagination__details" }, `Viewing ${E.indices[0]} - ${E.indices[1]}`) : /* @__PURE__ */ s.createElement("div", { className: "sps-pagination__details" }, `Viewing ${E.indices[0]} - ${E.indices[1]} of ${k()}`), /* @__PURE__ */ s.createElement(
23175
+ ), "Per Page"), f ? /* @__PURE__ */ s.createElement("div", { className: "sps-pagination__details" }, `Viewing ${E.indices[0]} - ${E.indices[1]} of many`) : /* @__PURE__ */ s.createElement("div", { className: "sps-pagination__details" }, `Viewing ${E.indices[0]} - ${E.indices[1]} of ${k()}`), /* @__PURE__ */ s.createElement(
23176
23176
  Fi,
23177
23177
  {
23178
23178
  numPages: E.numPages,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@spscommerce/ds-react",
3
3
  "description": "SPS Design System React components",
4
- "version": "8.14.2",
4
+ "version": "8.15.1",
5
5
  "author": "SPS Commerce",
6
6
  "license": "UNLICENSED",
7
7
  "repository": "https://github.com/spscommerce/woodland/tree/main/packages/@spscommerce/ds-react",
@@ -46,11 +46,11 @@
46
46
  "moment-timezone": "^0.5.28",
47
47
  "react": "^16.9.0",
48
48
  "react-dom": "^16.9.0",
49
- "@sps-woodland/illustrations": "8.14.2",
50
- "@sps-woodland/tabs": "8.14.2",
51
- "@spscommerce/ds-colors": "8.14.2",
52
- "@spscommerce/ds-shared": "8.14.2",
53
- "@spscommerce/positioning": "8.14.2"
49
+ "@sps-woodland/illustrations": "8.15.1",
50
+ "@sps-woodland/tabs": "8.15.1",
51
+ "@spscommerce/ds-colors": "8.15.1",
52
+ "@spscommerce/ds-shared": "8.15.1",
53
+ "@spscommerce/positioning": "8.15.1"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@react-spectrum/provider": "^3.4.1",
@@ -72,12 +72,12 @@
72
72
  "raf-stub": "^2.0.2",
73
73
  "react": "^16.9.0",
74
74
  "react-dom": "^16.9.0",
75
- "@sps-woodland/illustrations": "8.14.2",
76
- "@sps-woodland/tabs": "8.14.2",
77
- "@spscommerce/ds-colors": "8.14.2",
78
- "@spscommerce/ds-shared": "8.14.2",
79
- "@spscommerce/positioning": "8.14.2",
80
- "test": "8.14.2"
75
+ "@sps-woodland/illustrations": "8.15.1",
76
+ "@sps-woodland/tabs": "8.15.1",
77
+ "@spscommerce/ds-colors": "8.15.1",
78
+ "@spscommerce/ds-shared": "8.15.1",
79
+ "@spscommerce/positioning": "8.15.1",
80
+ "test": "8.15.1"
81
81
  },
82
82
  "scripts": {
83
83
  "build": "pnpm run build:js && pnpm run build:types",