@commercelayer/react-components 4.1.0-beta.6 → 4.1.0-beta.7

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.
@@ -41,7 +41,7 @@ interface Props extends Omit<JSX.IntrinsicElements['div'], 'children'> {
41
41
  */
42
42
  navigationButtons?: NavigationButtons;
43
43
  }
44
- export declare function OrderListPaginationButtons({ previousPageButton, nextPageButton, navigationButtons, children, ...props }: Props): JSX.Element;
44
+ export declare function OrderListPaginationButtons({ previousPageButton, nextPageButton, navigationButtons, children, ...props }: Props): JSX.Element | null;
45
45
  export declare namespace OrderListPaginationButtons {
46
46
  var displayName: string;
47
47
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OrderListPaginationButtons=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),OrderListPaginationContext_1=tslib_1.__importDefault(require("../../context/OrderListPaginationContext")),useCustomContext_1=tslib_1.__importDefault(require("../../utils/hooks/useCustomContext")),omit_1=tslib_1.__importDefault(require("../../utils/omit"));function OrderListPaginationButtons({previousPageButton,nextPageButton,navigationButtons,children,...props}){const{...prevButton}={show:!0,...previousPageButton},{...nextButton}={show:!0,...nextPageButton},{...navButton}={show:!0,...navigationButtons},ctx=(0,useCustomContext_1.default)({context:OrderListPaginationContext_1.default,contextComponentName:"OrderList",currentComponentName:"OrderListPaginationButtons"}),PrevButton=prevButton.show?prevButton.hideWhenDisabled===!0&&ctx?.canPreviousPage===!1?null:(0,jsx_runtime_1.jsx)("button",{"data-testid":"prev-button",...(0,omit_1.default)(prevButton,["show"]),disabled:ctx?.canPreviousPage===!1,onClick:()=>ctx?.previousPage(),children:previousPageButton?.label??"<"}):null,NextButton=nextButton.show?nextButton.hideWhenDisabled===!0&&ctx?.canPreviousPage===!1?null:(0,jsx_runtime_1.jsx)("button",{"data-testid":"next-button",...(0,omit_1.default)(nextButton,["show"]),disabled:ctx?.canNextPage===!1,onClick:()=>ctx?.nextPage(),children:nextButton?.label??">"}):null,pagesToShow=ctx?.canPreviousPage===!1?ctx?.pageOptions.slice(0,3).map(v=>v+1):ctx?.canNextPage===!1?ctx?.pageOptions.slice(ctx?.pageOptions.length-3,ctx?.pageOptions.length).map(v=>v+1):ctx?.pageOptions.slice(ctx?.pageIndex-1,ctx?.pageIndex+2).map(v=>v+1),NavButtons=navButton.show?pagesToShow?.map(v=>{const className=(ctx?.pageIndex!=null?ctx?.pageIndex+1:1)===v?`${navButton?.className??""} ${navButton?.activeClassName??""}`:navButton?.className;return(0,jsx_runtime_1.jsx)("button",{"data-testid":`page-${v}`,...(0,omit_1.default)(navButton,["show","activeClassName","className"]),className,onClick:()=>ctx?.gotoPage(v-1),children:v},`page-${v}`)}):null,parentProps={navigationButtons,prevButton,nextButton,...ctx,...props};return children==null?(0,jsx_runtime_1.jsxs)("div",{...props,children:[PrevButton,NavButtons,NextButton]}):(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children})}exports.OrderListPaginationButtons=OrderListPaginationButtons,OrderListPaginationButtons.displayName="OrderListPaginationButtons",exports.default=OrderListPaginationButtons;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OrderListPaginationButtons=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),OrderListPaginationContext_1=tslib_1.__importDefault(require("../../context/OrderListPaginationContext")),useCustomContext_1=tslib_1.__importDefault(require("../../utils/hooks/useCustomContext")),omit_1=tslib_1.__importDefault(require("../../utils/omit"));function OrderListPaginationButtons({previousPageButton,nextPageButton,navigationButtons,children,...props}){const{...prevButton}={show:!0,...previousPageButton},{...nextButton}={show:!0,...nextPageButton},{...navButton}={show:!0,...navigationButtons},ctx=(0,useCustomContext_1.default)({context:OrderListPaginationContext_1.default,contextComponentName:"OrderList",currentComponentName:"OrderListPaginationButtons"}),PrevButton=prevButton.show?prevButton.hideWhenDisabled===!0&&ctx?.canPreviousPage===!1?null:(0,jsx_runtime_1.jsx)("button",{"data-testid":"prev-button",...(0,omit_1.default)(prevButton,["show","hideWhenDisabled"]),disabled:ctx?.canPreviousPage===!1,onClick:()=>ctx?.previousPage(),children:previousPageButton?.label??"<"}):null,NextButton=nextButton.show?nextButton.hideWhenDisabled===!0&&ctx?.canNextPage===!1?null:(0,jsx_runtime_1.jsx)("button",{"data-testid":"next-button",...(0,omit_1.default)(nextButton,["show","hideWhenDisabled"]),disabled:ctx?.canNextPage===!1,onClick:()=>ctx?.nextPage(),children:nextButton?.label??">"}):null,pagesToShow=ctx?.canPreviousPage===!1?ctx?.pageOptions.slice(0,3).map(v=>v+1):ctx?.canNextPage===!1?ctx?.pageOptions.slice(ctx?.pageOptions.length-3,ctx?.pageOptions.length).map(v=>v+1):ctx?.pageOptions.slice(ctx?.pageIndex-1,ctx?.pageIndex+2).map(v=>v+1),NavButtons=navButton.show?pagesToShow?.map(v=>{const className=(ctx?.pageIndex!=null?ctx?.pageIndex+1:1)===v?`${navButton?.className??""} ${navButton?.activeClassName??""}`:navButton?.className;return(0,jsx_runtime_1.jsx)("button",{"data-testid":`page-${v}`,...(0,omit_1.default)(navButton,["show","activeClassName","className"]),className,onClick:()=>ctx?.gotoPage(v-1),children:v},`page-${v}`)}):null,parentProps={navigationButtons,prevButton,nextButton,...ctx,...props};return children==null?ctx?.totalRows===0?null:(0,jsx_runtime_1.jsxs)("div",{...props,children:[PrevButton,NavButtons,NextButton]}):(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children})}exports.OrderListPaginationButtons=OrderListPaginationButtons,OrderListPaginationButtons.displayName="OrderListPaginationButtons",exports.default=OrderListPaginationButtons;
@@ -22,7 +22,7 @@ type Props<A extends TAsComponent> = {
22
22
  */
23
23
  as?: TAsComponent;
24
24
  } & Omit<JSX.IntrinsicElements[A], 'children' | 'ref'>;
25
- export declare function OrderListPaginationInfo<A extends TAsComponent = 'span'>({ as, children, ...props }: Props<A>): JSX.Element;
25
+ export declare function OrderListPaginationInfo<A extends TAsComponent = 'span'>({ as, children, ...props }: Props<A>): JSX.Element | null;
26
26
  export declare namespace OrderListPaginationInfo {
27
27
  var displayName: string;
28
28
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OrderListPaginationInfo=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),OrderListPaginationContext_1=tslib_1.__importDefault(require("../../context/OrderListPaginationContext")),useCustomContext_1=tslib_1.__importDefault(require("../../utils/hooks/useCustomContext"));function OrderListPaginationInfo({as="span",children,...props}){const ctx=(0,useCustomContext_1.default)({context:OrderListPaginationContext_1.default,contextComponentName:"OrderList",currentComponentName:"OrderListPaginationInfo"}),TagElement=as,totRows=ctx?.totalRows??0,pageIndex=ctx?.pageIndex??0,pageSize=ctx?.pageSize??10;let firstRow=pageIndex===0?pageIndex+1:pageIndex,lastRow=firstRow*pageSize;ctx?.canPreviousPage===!0&&(firstRow=Math.floor(firstRow*pageSize)+1,lastRow=Math.floor(firstRow+pageSize-1)),ctx?.canNextPage===!1&&(lastRow=totRows);const parentProps={...props,as,firstRow,lastRow,totRows};return children==null?(0,jsx_runtime_1.jsx)(TagElement,{...props,children:`${firstRow} - ${lastRow} of ${totRows}`}):(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children})}exports.OrderListPaginationInfo=OrderListPaginationInfo,OrderListPaginationInfo.displayName="OrderListPaginationInfo",exports.default=OrderListPaginationInfo;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OrderListPaginationInfo=void 0;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),OrderListPaginationContext_1=tslib_1.__importDefault(require("../../context/OrderListPaginationContext")),useCustomContext_1=tslib_1.__importDefault(require("../../utils/hooks/useCustomContext"));function OrderListPaginationInfo({as="span",children,...props}){const ctx=(0,useCustomContext_1.default)({context:OrderListPaginationContext_1.default,contextComponentName:"OrderList",currentComponentName:"OrderListPaginationInfo"}),TagElement=as,totRows=ctx?.totalRows??0,pageIndex=ctx?.pageIndex??0,pageSize=ctx?.pageSize??10;let firstRow=pageIndex===0?pageIndex+1:pageIndex,lastRow=firstRow*pageSize;ctx?.canPreviousPage===!0&&(firstRow=Math.floor(firstRow*pageSize)+1,lastRow=Math.floor(firstRow+pageSize-1)),ctx?.canNextPage===!1&&(lastRow=totRows);const parentProps={...props,as,firstRow,lastRow,totRows};return children==null?totRows===0?null:(0,jsx_runtime_1.jsx)(TagElement,{...props,children:`${firstRow} - ${lastRow} of ${totRows}`}):(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children})}exports.OrderListPaginationInfo=OrderListPaginationInfo,OrderListPaginationInfo.displayName="OrderListPaginationInfo",exports.default=OrderListPaginationInfo;
@@ -41,7 +41,7 @@ interface Props extends Omit<JSX.IntrinsicElements['div'], 'children'> {
41
41
  */
42
42
  navigationButtons?: NavigationButtons;
43
43
  }
44
- export declare function OrderListPaginationButtons({ previousPageButton, nextPageButton, navigationButtons, children, ...props }: Props): JSX.Element;
44
+ export declare function OrderListPaginationButtons({ previousPageButton, nextPageButton, navigationButtons, children, ...props }: Props): JSX.Element | null;
45
45
  export declare namespace OrderListPaginationButtons {
46
46
  var displayName: string;
47
47
  }
@@ -1 +1 @@
1
- import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import Parent from"../utils/Parent";import OrderListPaginationContext from"../../context/OrderListPaginationContext";import useCustomContext from"../../utils/hooks/useCustomContext";import omit from"../../utils/omit";export function OrderListPaginationButtons({previousPageButton,nextPageButton,navigationButtons,children,...props}){const{...prevButton}={show:!0,...previousPageButton},{...nextButton}={show:!0,...nextPageButton},{...navButton}={show:!0,...navigationButtons},ctx=useCustomContext({context:OrderListPaginationContext,contextComponentName:"OrderList",currentComponentName:"OrderListPaginationButtons"}),PrevButton=prevButton.show?prevButton.hideWhenDisabled===!0&&ctx?.canPreviousPage===!1?null:_jsx("button",{"data-testid":"prev-button",...omit(prevButton,["show"]),disabled:ctx?.canPreviousPage===!1,onClick:()=>ctx?.previousPage(),children:previousPageButton?.label??"<"}):null,NextButton=nextButton.show?nextButton.hideWhenDisabled===!0&&ctx?.canPreviousPage===!1?null:_jsx("button",{"data-testid":"next-button",...omit(nextButton,["show"]),disabled:ctx?.canNextPage===!1,onClick:()=>ctx?.nextPage(),children:nextButton?.label??">"}):null,pagesToShow=ctx?.canPreviousPage===!1?ctx?.pageOptions.slice(0,3).map(v=>v+1):ctx?.canNextPage===!1?ctx?.pageOptions.slice(ctx?.pageOptions.length-3,ctx?.pageOptions.length).map(v=>v+1):ctx?.pageOptions.slice(ctx?.pageIndex-1,ctx?.pageIndex+2).map(v=>v+1),NavButtons=navButton.show?pagesToShow?.map(v=>{const className=(ctx?.pageIndex!=null?ctx?.pageIndex+1:1)===v?`${navButton?.className??""} ${navButton?.activeClassName??""}`:navButton?.className;return _jsx("button",{"data-testid":`page-${v}`,...omit(navButton,["show","activeClassName","className"]),className,onClick:()=>ctx?.gotoPage(v-1),children:v},`page-${v}`)}):null,parentProps={navigationButtons,prevButton,nextButton,...ctx,...props};return children==null?_jsxs("div",{...props,children:[PrevButton,NavButtons,NextButton]}):_jsx(Parent,{...parentProps,children})}OrderListPaginationButtons.displayName="OrderListPaginationButtons";export default OrderListPaginationButtons;
1
+ import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import Parent from"../utils/Parent";import OrderListPaginationContext from"../../context/OrderListPaginationContext";import useCustomContext from"../../utils/hooks/useCustomContext";import omit from"../../utils/omit";export function OrderListPaginationButtons({previousPageButton,nextPageButton,navigationButtons,children,...props}){const{...prevButton}={show:!0,...previousPageButton},{...nextButton}={show:!0,...nextPageButton},{...navButton}={show:!0,...navigationButtons},ctx=useCustomContext({context:OrderListPaginationContext,contextComponentName:"OrderList",currentComponentName:"OrderListPaginationButtons"}),PrevButton=prevButton.show?prevButton.hideWhenDisabled===!0&&ctx?.canPreviousPage===!1?null:_jsx("button",{"data-testid":"prev-button",...omit(prevButton,["show","hideWhenDisabled"]),disabled:ctx?.canPreviousPage===!1,onClick:()=>ctx?.previousPage(),children:previousPageButton?.label??"<"}):null,NextButton=nextButton.show?nextButton.hideWhenDisabled===!0&&ctx?.canNextPage===!1?null:_jsx("button",{"data-testid":"next-button",...omit(nextButton,["show","hideWhenDisabled"]),disabled:ctx?.canNextPage===!1,onClick:()=>ctx?.nextPage(),children:nextButton?.label??">"}):null,pagesToShow=ctx?.canPreviousPage===!1?ctx?.pageOptions.slice(0,3).map(v=>v+1):ctx?.canNextPage===!1?ctx?.pageOptions.slice(ctx?.pageOptions.length-3,ctx?.pageOptions.length).map(v=>v+1):ctx?.pageOptions.slice(ctx?.pageIndex-1,ctx?.pageIndex+2).map(v=>v+1),NavButtons=navButton.show?pagesToShow?.map(v=>{const className=(ctx?.pageIndex!=null?ctx?.pageIndex+1:1)===v?`${navButton?.className??""} ${navButton?.activeClassName??""}`:navButton?.className;return _jsx("button",{"data-testid":`page-${v}`,...omit(navButton,["show","activeClassName","className"]),className,onClick:()=>ctx?.gotoPage(v-1),children:v},`page-${v}`)}):null,parentProps={navigationButtons,prevButton,nextButton,...ctx,...props};return children==null?ctx?.totalRows===0?null:_jsxs("div",{...props,children:[PrevButton,NavButtons,NextButton]}):_jsx(Parent,{...parentProps,children})}OrderListPaginationButtons.displayName="OrderListPaginationButtons";export default OrderListPaginationButtons;
@@ -22,7 +22,7 @@ type Props<A extends TAsComponent> = {
22
22
  */
23
23
  as?: TAsComponent;
24
24
  } & Omit<JSX.IntrinsicElements[A], 'children' | 'ref'>;
25
- export declare function OrderListPaginationInfo<A extends TAsComponent = 'span'>({ as, children, ...props }: Props<A>): JSX.Element;
25
+ export declare function OrderListPaginationInfo<A extends TAsComponent = 'span'>({ as, children, ...props }: Props<A>): JSX.Element | null;
26
26
  export declare namespace OrderListPaginationInfo {
27
27
  var displayName: string;
28
28
  }
@@ -1 +1 @@
1
- import{jsx as _jsx}from"react/jsx-runtime";import Parent from"../utils/Parent";import OrderListPaginationContext from"../../context/OrderListPaginationContext";import useCustomContext from"../../utils/hooks/useCustomContext";export function OrderListPaginationInfo({as="span",children,...props}){const ctx=useCustomContext({context:OrderListPaginationContext,contextComponentName:"OrderList",currentComponentName:"OrderListPaginationInfo"}),TagElement=as,totRows=ctx?.totalRows??0,pageIndex=ctx?.pageIndex??0,pageSize=ctx?.pageSize??10;let firstRow=pageIndex===0?pageIndex+1:pageIndex,lastRow=firstRow*pageSize;ctx?.canPreviousPage===!0&&(firstRow=Math.floor(firstRow*pageSize)+1,lastRow=Math.floor(firstRow+pageSize-1)),ctx?.canNextPage===!1&&(lastRow=totRows);const parentProps={...props,as,firstRow,lastRow,totRows};return children==null?_jsx(TagElement,{...props,children:`${firstRow} - ${lastRow} of ${totRows}`}):_jsx(Parent,{...parentProps,children})}OrderListPaginationInfo.displayName="OrderListPaginationInfo";export default OrderListPaginationInfo;
1
+ import{jsx as _jsx}from"react/jsx-runtime";import Parent from"../utils/Parent";import OrderListPaginationContext from"../../context/OrderListPaginationContext";import useCustomContext from"../../utils/hooks/useCustomContext";export function OrderListPaginationInfo({as="span",children,...props}){const ctx=useCustomContext({context:OrderListPaginationContext,contextComponentName:"OrderList",currentComponentName:"OrderListPaginationInfo"}),TagElement=as,totRows=ctx?.totalRows??0,pageIndex=ctx?.pageIndex??0,pageSize=ctx?.pageSize??10;let firstRow=pageIndex===0?pageIndex+1:pageIndex,lastRow=firstRow*pageSize;ctx?.canPreviousPage===!0&&(firstRow=Math.floor(firstRow*pageSize)+1,lastRow=Math.floor(firstRow+pageSize-1)),ctx?.canNextPage===!1&&(lastRow=totRows);const parentProps={...props,as,firstRow,lastRow,totRows};return children==null?totRows===0?null:_jsx(TagElement,{...props,children:`${firstRow} - ${lastRow} of ${totRows}`}):_jsx(Parent,{...parentProps,children})}OrderListPaginationInfo.displayName="OrderListPaginationInfo";export default OrderListPaginationInfo;