@atom-learning/components 2.66.8 → 2.66.10
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 -6
- package/dist/components/button/Button.d.ts +9 -7
- package/dist/components/button/Button.js +1 -1
- package/dist/components/button/Button.js.map +1 -1
- package/dist/components/link/Link.d.ts +6 -7
- package/dist/components/link/Link.js +1 -1
- package/dist/components/link/Link.js.map +1 -1
- package/dist/components/pagination/PaginationPages.js +1 -1
- package/dist/components/pagination/PaginationPages.js.map +1 -1
- package/dist/components/pagination/pagination.constants.d.ts +0 -1
- package/dist/components/pagination/pagination.constants.js +1 -1
- package/dist/components/pagination/pagination.constants.js.map +1 -1
- package/dist/components/pagination/pagination.helper.js +1 -1
- package/dist/components/pagination/pagination.helper.js.map +1 -1
- package/dist/docgen.json +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
## [2.66.
|
|
1
|
+
## [2.66.10](https://github.com/Atom-Learning/components/compare/v2.66.9...v2.66.10) (2023-09-01)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
5
5
|
|
|
6
|
-
*
|
|
7
|
-
* more improvements, fix for rendering glitch ([5ece055](https://github.com/Atom-Learning/components/commit/5ece055b57b23132a56dac59a909ef1796a6e463))
|
|
8
|
-
* revert no arrows change ([a7922cf](https://github.com/Atom-Learning/components/commit/a7922cf4e6d080040267c9c2abca60eeaca0a39d))
|
|
9
|
-
* tests ([7dcb4c0](https://github.com/Atom-Learning/components/commit/7dcb4c0524d542aa5e6aec80ef32e0b55bffcf45))
|
|
10
|
-
* types, paginationItems with more visible items ([57b3dc9](https://github.com/Atom-Learning/components/commit/57b3dc954c031f074f2f885af86d3f6f619fa4fc))
|
|
6
|
+
* revert button & link types ([fafce83](https://github.com/Atom-Learning/components/commit/fafce83a5dd2f4258670b0bb2d030943b29bae10))
|
|
11
7
|
|
|
12
8
|
# [1.4.0](https://github.com/Atom-Learning/components/compare/v1.3.0...v1.4.0) (2022-04-11)
|
|
13
9
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { VariantProps } from '@stitches/react';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { NavigatorActions } from '../../types';
|
|
4
|
+
import { Override } from '../../utilities';
|
|
4
5
|
export declare const StyledButton: import("@stitches/react/types/styled-component").StyledComponent<"button", {
|
|
5
6
|
theme?: "primary" | "secondary" | "success" | "danger" | "warning" | "neutral" | undefined;
|
|
6
7
|
appearance?: "outline" | "solid" | undefined;
|
|
@@ -326,10 +327,11 @@ export declare const StyledButton: import("@stitches/react/types/styled-componen
|
|
|
326
327
|
marginBottom: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">;
|
|
327
328
|
};
|
|
328
329
|
}>>;
|
|
329
|
-
declare type ButtonProps
|
|
330
|
-
|
|
331
|
-
|
|
330
|
+
declare type ButtonProps = Override<React.ComponentProps<typeof StyledButton>, VariantProps<typeof StyledButton> & {
|
|
331
|
+
as?: React.ComponentType | React.ElementType;
|
|
332
|
+
children: React.ReactNode;
|
|
333
|
+
href?: string;
|
|
332
334
|
isLoading?: boolean;
|
|
333
|
-
}>;
|
|
334
|
-
export declare const Button:
|
|
335
|
+
} & NavigatorActions>;
|
|
336
|
+
export declare const Button: React.FC<ButtonProps>;
|
|
335
337
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{darken as n,opacify as s}from"color2k";import*as t from"react";import{StyledIcon as c}from"../icon/Icon.js";import{Loader as
|
|
1
|
+
import{darken as n,opacify as s}from"color2k";import*as t from"react";import{StyledIcon as c}from"../icon/Icon.js";import{Loader as f}from"../loader/Loader.js";import{styled as m,theme as l}from"../../stitches.js";import{isExternalLink as b}from"../../utilities/uri/index.js";const d=(e,a,r)=>({border:"1px solid",borderColor:"currentColor",color:e,"&[disabled]":{borderColor:"$tonal400",color:"$tonal400",cursor:"not-allowed"},"&:not([disabled]):hover, &:not([disabled]):focus":{textDecoration:"none",color:a},"&:not([disabled]):active":{color:r}}),i=(e,a,r,o="white")=>({bg:e,color:o,"&[disabled]":{bg:"$tonal100",color:"$tonal400",cursor:"not-allowed"},"&:not([disabled]):hover, &:not([disabled]):focus":{bg:a,color:o},"&:not([disabled]):active":{bg:r}}),u=m("button",{alignItems:"center",bg:"unset",border:"unset",borderRadius:"$0",cursor:"pointer",display:"flex",fontFamily:"$body",fontWeight:600,justifyContent:"center",p:"unset",textDecoration:"none",transition:"all 100ms ease-out",whiteSpace:"nowrap",width:"max-content",variants:{theme:{primary:{},secondary:{},success:{},warning:{},danger:{},neutral:{}},appearance:{solid:{},outline:{}},size:{sm:{fontSize:"$sm",lineHeight:1.53,height:"$3",px:"$4",gap:"$2",[`& ${c}`]:{size:16}},md:{fontSize:"$md",lineHeight:1.5,height:"$4",px:"$5",gap:"$3",[`& ${c}`]:{size:20}},lg:{fontSize:"$lg",lineHeight:1.5,height:"$5",px:"$5",gap:"$3",[`& ${c}`]:{size:22}}},isLoading:{true:{cursor:"not-allowed",opacity:.6,pointerEvents:"none"}},fullWidth:{false:{width:"max-content"},true:{width:"100%"}}},compoundVariants:[{theme:"primary",appearance:"solid",css:i("$primary","$primaryMid","$primaryDark")},{theme:"secondary",appearance:"solid",css:i("$primaryDark",n(l.colors.primaryDark.value,.1),n(l.colors.primaryDark.value,.15))},{theme:"success",appearance:"solid",css:i("$success","$successMid","$successDark")},{theme:"warning",appearance:"solid",css:i("$warning","$warningMid","$warningDark","$tonal500")},{theme:"danger",appearance:"solid",css:i("$danger","$dangerMid","$dangerDark")},{theme:"neutral",appearance:"solid",css:i("white",s("white",-.1),s("white",-.25),"$primary")},{theme:"primary",appearance:"outline",css:d("$primary","$primaryMid","$primaryDark")},{theme:"neutral",appearance:"outline",css:d("white",s("white",-.2),s("white",-.35))},{theme:"secondary",appearance:"outline",css:d("$primaryDark",n(l.colors.primaryDark.value,.1),n(l.colors.primaryDark.value,.15))}],defaultVariants:{appearance:"solid",size:"md",theme:"primary"}}),w=m("span",{alignItems:"center",display:"flex",justifyContent:"center",visibility:"hidden",variants:{size:{sm:{gap:"$2"},md:{gap:"$3"},lg:{gap:"$3"}}},defaultVariants:{size:"md"}}),k=({size:e,children:a})=>t.createElement(t.Fragment,null,t.createElement(f,{css:{position:"absolute"}}),t.createElement(w,{size:e},a)),$=t.forwardRef(({children:e,as:a,href:r,isLoading:o=!1,onClick:h,...p},g)=>{const y=b(r)?{target:"_blank",rel:"noopener noreferrer"}:{};return t.createElement(u,{as:a||(r?"a":void 0),href:r,isLoading:o,onClick:o?void 0:h,type:r?void 0:"button",...p,...y,ref:g},o?t.createElement(k,{size:p.size},e):e)});$.displayName="Button";export{$ as Button,u as StyledButton};
|
|
2
2
|
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../src/components/button/Button.tsx"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../src/components/button/Button.tsx"],"sourcesContent":["import type { VariantProps } from '@stitches/react'\nimport { darken, opacify } from 'color2k'\nimport * as React from 'react'\n\nimport { Box } from '~/components/box'\nimport { StyledIcon } from '~/components/icon'\nimport { Loader } from '~/components/loader'\nimport { styled, theme } from '~/stitches'\nimport { NavigatorActions } from '~/types'\nimport { Override } from '~/utilities'\nimport { isExternalLink } from '~/utilities/uri'\n\nconst getButtonOutlineVariant = (\n base: string,\n interact: string,\n active: string\n) => ({\n border: '1px solid',\n borderColor: 'currentColor',\n color: base,\n '&[disabled]': {\n borderColor: '$tonal400',\n color: '$tonal400',\n cursor: 'not-allowed'\n },\n '&:not([disabled]):hover, &:not([disabled]):focus': {\n textDecoration: 'none',\n color: interact\n },\n '&:not([disabled]):active': {\n color: active\n }\n})\n\nconst getButtonSolidVariant = (\n base: string,\n interact: string,\n active: string,\n text = 'white'\n) => ({\n bg: base,\n color: text,\n '&[disabled]': {\n bg: '$tonal100',\n color: '$tonal400',\n cursor: 'not-allowed'\n },\n '&:not([disabled]):hover, &:not([disabled]):focus': {\n bg: interact,\n color: text\n },\n '&:not([disabled]):active': {\n bg: active\n }\n})\n\nexport const StyledButton = styled('button', {\n alignItems: 'center',\n bg: 'unset',\n border: 'unset',\n borderRadius: '$0',\n cursor: 'pointer',\n display: 'flex',\n fontFamily: '$body',\n fontWeight: 600,\n justifyContent: 'center',\n p: 'unset',\n textDecoration: 'none',\n transition: 'all 100ms ease-out',\n whiteSpace: 'nowrap',\n width: 'max-content',\n variants: {\n theme: {\n primary: {},\n secondary: {},\n success: {},\n warning: {},\n danger: {},\n neutral: {}\n },\n appearance: {\n solid: {},\n outline: {}\n },\n size: {\n sm: {\n fontSize: '$sm',\n lineHeight: 1.53,\n height: '$3',\n px: '$4',\n gap: '$2',\n [`& ${StyledIcon}`]: { size: 16 }\n },\n md: {\n fontSize: '$md',\n lineHeight: 1.5,\n height: '$4',\n px: '$5',\n gap: '$3',\n [`& ${StyledIcon}`]: { size: 20 }\n },\n lg: {\n fontSize: '$lg',\n lineHeight: 1.5,\n height: '$5',\n px: '$5',\n gap: '$3',\n [`& ${StyledIcon}`]: { size: 22 }\n }\n },\n isLoading: {\n true: {\n cursor: 'not-allowed',\n opacity: 0.6,\n pointerEvents: 'none'\n }\n },\n fullWidth: {\n false: {\n width: 'max-content'\n },\n true: {\n width: '100%'\n }\n }\n },\n\n compoundVariants: [\n {\n theme: 'primary',\n appearance: 'solid',\n css: getButtonSolidVariant('$primary', '$primaryMid', '$primaryDark')\n },\n {\n theme: 'secondary',\n appearance: 'solid',\n css: getButtonSolidVariant(\n '$primaryDark',\n darken(theme.colors.primaryDark.value, 0.1),\n darken(theme.colors.primaryDark.value, 0.15)\n )\n },\n {\n theme: 'success',\n appearance: 'solid',\n css: getButtonSolidVariant('$success', '$successMid', '$successDark')\n },\n {\n theme: 'warning',\n appearance: 'solid',\n css: getButtonSolidVariant(\n '$warning',\n '$warningMid',\n '$warningDark',\n '$tonal500'\n )\n },\n {\n theme: 'danger',\n appearance: 'solid',\n css: getButtonSolidVariant('$danger', '$dangerMid', '$dangerDark')\n },\n {\n theme: 'neutral',\n appearance: 'solid',\n css: getButtonSolidVariant(\n 'white',\n opacify('white', -0.1),\n opacify('white', -0.25),\n '$primary'\n )\n },\n {\n theme: 'primary',\n appearance: 'outline',\n css: getButtonOutlineVariant('$primary', '$primaryMid', '$primaryDark')\n },\n {\n theme: 'neutral',\n appearance: 'outline',\n css: getButtonOutlineVariant(\n 'white',\n opacify('white', -0.2),\n opacify('white', -0.35)\n )\n },\n {\n theme: 'secondary',\n appearance: 'outline',\n css: getButtonOutlineVariant(\n '$primaryDark',\n darken(theme.colors.primaryDark.value, 0.1),\n darken(theme.colors.primaryDark.value, 0.15)\n )\n }\n ],\n\n defaultVariants: {\n appearance: 'solid',\n size: 'md',\n theme: 'primary'\n }\n})\n\nconst LoaderContentsWrapper = styled('span', {\n alignItems: 'center',\n display: 'flex',\n justifyContent: 'center',\n visibility: 'hidden',\n variants: {\n size: {\n sm: { gap: '$2' },\n md: { gap: '$3' },\n lg: { gap: '$3' }\n }\n },\n defaultVariants: {\n size: 'md'\n }\n})\n\nconst WithLoader = ({\n size,\n children\n}: React.ComponentProps<typeof LoaderContentsWrapper>) => (\n <>\n <Loader css={{ position: 'absolute' }} />\n <LoaderContentsWrapper size={size}>{children}</LoaderContentsWrapper>\n </>\n)\n\ntype ButtonProps = Override<\n React.ComponentProps<typeof StyledButton>,\n VariantProps<typeof StyledButton> & {\n as?: React.ComponentType | React.ElementType\n children: React.ReactNode\n href?: string\n isLoading?: boolean\n } & NavigatorActions\n>\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ children, as, href, isLoading = false, onClick, ...rest }, ref) => {\n const externalLinkProps = isExternalLink(href)\n ? { target: '_blank', rel: 'noopener noreferrer' }\n : {}\n\n return (\n <StyledButton\n as={as || (href ? 'a' : undefined)}\n href={href}\n isLoading={isLoading}\n onClick={!isLoading ? onClick : undefined}\n type={!href ? 'button' : undefined}\n {...rest}\n {...externalLinkProps}\n ref={ref}\n >\n {isLoading ? (\n <WithLoader size={rest.size}>{children}</WithLoader>\n ) : (\n children\n )}\n </StyledButton>\n )\n }\n) as React.FC<ButtonProps>\n\nButton.displayName = 'Button'\n"],"names":["getButtonOutlineVariant","base","interact","active","getButtonSolidVariant","text","StyledButton","styled","StyledIcon","darken","theme","opacify","LoaderContentsWrapper","WithLoader","size","children","React","Loader","Button","as","href","isLoading","onClick","rest","ref","externalLinkProps","isExternalLink"],"mappings":"oRAYA,MAAMA,EAA0B,CAC9BC,EACAC,EACAC,KACI,CACJ,OAAQ,YACR,YAAa,eACb,MAAOF,EACP,cAAe,CACb,YAAa,YACb,MAAO,YACP,OAAQ,aACV,EACA,mDAAoD,CAClD,eAAgB,OAChB,MAAOC,CACT,EACA,2BAA4B,CAC1B,MAAOC,CACT,CACF,GAEMC,EAAwB,CAC5BH,EACAC,EACAC,EACAE,EAAO,WACH,CACJ,GAAIJ,EACJ,MAAOI,EACP,cAAe,CACb,GAAI,YACJ,MAAO,YACP,OAAQ,aACV,EACA,mDAAoD,CAClD,GAAIH,EACJ,MAAOG,CACT,EACA,2BAA4B,CAC1B,GAAIF,CACN,CACF,GAEaG,EAAeC,EAAO,SAAU,CAC3C,WAAY,SACZ,GAAI,QACJ,OAAQ,QACR,aAAc,KACd,OAAQ,UACR,QAAS,OACT,WAAY,QACZ,WAAY,IACZ,eAAgB,SAChB,EAAG,QACH,eAAgB,OAChB,WAAY,qBACZ,WAAY,SACZ,MAAO,cACP,SAAU,CACR,MAAO,CACL,QAAS,CAAC,EACV,UAAW,CAAC,EACZ,QAAS,CACT,EAAA,QAAS,CAAA,EACT,OAAQ,CAAA,EACR,QAAS,CAAA,CACX,EACA,WAAY,CACV,MAAO,CACP,EAAA,QAAS,CACX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,6 @@
|
|
|
1
|
-
import type { CSS, VariantProps } from '@stitches/react';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
2
|
+
import { NavigatorActions } from '../../types';
|
|
3
|
+
import { Override } from '../../utilities';
|
|
4
4
|
export declare const StyledLink: import("@stitches/react/types/styled-component").StyledComponent<"a", {
|
|
5
5
|
size?: "sm" | "md" | "lg" | "xl" | "xs" | undefined;
|
|
6
6
|
noCapsize?: boolean | "true" | undefined;
|
|
@@ -323,9 +323,8 @@ export declare const StyledLink: import("@stitches/react/types/styled-component"
|
|
|
323
323
|
marginBottom: string | number | import("@stitches/react/types/css-util").WithScaleValue<"space">;
|
|
324
324
|
};
|
|
325
325
|
}>>;
|
|
326
|
-
declare type LinkProps
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
export declare const Link: <H extends string | undefined = undefined, C extends React.ElementType = H extends string ? typeof StyledLink : 'button'>(props: LinkProps<H, C>) => React.ReactElement | null;
|
|
326
|
+
declare type LinkProps = Override<React.ComponentProps<typeof StyledLink>, {
|
|
327
|
+
as?: React.ComponentType | React.ElementType;
|
|
328
|
+
} & NavigatorActions>;
|
|
329
|
+
export declare const Link: React.FC<LinkProps>;
|
|
331
330
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as o from"react";import{styled as
|
|
1
|
+
import*as o from"react";import{styled as p}from"../../stitches.js";import{isExternalLink as s}from"../../utilities/uri/index.js";import{StyledHeading as f}from"../heading/Heading.js";import{StyledLi as d}from"../list/List.js";import"../markdown-content/components/MarkdownCode.js";import{StyledMarkdownEmphasis as l}from"../markdown-content/components/MarkdownEmphasis.js";import"../markdown-content/components/MarkdownInlineCode.js";import"../image/Image.js";import{StyledText as c,textVariants as y}from"../text/Text.js";import"../markdown-content/components/MarkdownStrong.js";import"../divider/Divider.js";const t=p("a",{bg:"unset",border:"unset",p:"unset",color:"$primary",cursor:"pointer",fontFamily:"$body",textDecoration:"none","&:focus, &:hover":{color:"$primaryMid",textDecoration:"underline"},"&:active":{color:"$primaryDark"},[`${c} > &, ${f} > &, ${d} > &, ${l} > &`]:{fontSize:"100%",lineHeight:1,"&::before, &::after":{content:"none"}},variants:y,defaultVariants:{size:"md"}}),e=o.forwardRef(({as:i,href:r,...n},a)=>{const m=s(r)?{target:"_blank",rel:"noopener noreferrer"}:{};return o.createElement(t,{as:i||(r?void 0:"button"),noCapsize:r?void 0:!0,href:r,...n,...m,ref:a})});e.displayName="Link";export{e as Link,t as StyledLink};
|
|
2
2
|
//# sourceMappingURL=Link.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.js","sources":["../../../src/components/link/Link.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Link.js","sources":["../../../src/components/link/Link.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '~/stitches'\nimport { NavigatorActions } from '~/types'\nimport { Override } from '~/utilities'\nimport { isExternalLink } from '~/utilities/uri'\n\nimport { StyledHeading } from '../heading/Heading'\nimport { StyledLi } from '../list/List'\nimport { StyledMarkdownEmphasis } from '../markdown-content/components'\nimport { StyledText, textVariants } from '../text/Text'\n\nexport const StyledLink = styled('a', {\n bg: 'unset',\n border: 'unset',\n p: 'unset',\n color: '$primary',\n cursor: 'pointer',\n fontFamily: '$body',\n textDecoration: 'none',\n '&:focus, &:hover': {\n color: '$primaryMid',\n textDecoration: 'underline'\n },\n '&:active': {\n color: '$primaryDark'\n },\n [`${StyledText} > &, ${StyledHeading} > &, ${StyledLi} > &, ${StyledMarkdownEmphasis} > &`]:\n {\n fontSize: '100%',\n lineHeight: 1,\n '&::before, &::after': {\n content: 'none'\n }\n },\n variants: textVariants,\n defaultVariants: {\n size: 'md'\n }\n})\n\ntype LinkProps = Override<\n React.ComponentProps<typeof StyledLink>,\n {\n as?: React.ComponentType | React.ElementType\n } & NavigatorActions\n>\n\nexport const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(\n ({ as, href, ...rest }, ref) => {\n const externalLinkProps = isExternalLink(href)\n ? { target: '_blank', rel: 'noopener noreferrer' }\n : {}\n\n return (\n <StyledLink\n as={as || (!href ? 'button' : undefined)}\n noCapsize={!href ? true : undefined}\n href={href}\n {...rest}\n {...externalLinkProps}\n ref={ref}\n />\n )\n }\n) as React.FC<LinkProps>\n\nLink.displayName = 'Link'\n"],"names":["StyledLink","styled","StyledText","StyledHeading","StyledLi","StyledMarkdownEmphasis","textVariants","Link","React","as","href","rest","ref","externalLinkProps","isExternalLink"],"mappings":"kmBAYa,MAAAA,EAAaC,EAAO,IAAK,CACpC,GAAI,QACJ,OAAQ,QACR,EAAG,QACH,MAAO,WACP,OAAQ,UACR,WAAY,QACZ,eAAgB,OAChB,mBAAoB,CAClB,MAAO,cACP,eAAgB,WAClB,EACA,WAAY,CACV,MAAO,cACT,EACA,CAAC,GAAGC,UAAmBC,UAAsBC,UAAiBC,SAC5D,CACE,SAAU,OACV,WAAY,EACZ,sBAAuB,CACrB,QAAS,MACX,CACF,EACF,SAAUC,EACV,gBAAiB,CACf,KAAM,IACR,CACF,CAAC,EASYC,EAAOC,EAAM,WACxB,CAAC,CAAE,GAAAC,EAAI,KAAAC,KAASC,CAAK,EAAGC,IAAQ,CAC9B,MAAMC,EAAoBC,EAAeJ,CAAI,EACzC,CAAE,OAAQ,SAAU,IAAK,qBAAsB,EAC/C,CAAA,EAEJ,OACEF,EAAA,cAACR,EAAA,CACC,GAAIS,IAAQC,EAAkB,OAAX,UACnB,UAAYA,EAAc,OAAP,GACnB,KAAMA,EACL,GAAGC,EACH,GAAGE,EACJ,IAAKD,CACP,CAAA,CAEJ,CACF,EAEAL,EAAK,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as e from"react";import{Flex as
|
|
1
|
+
import*as e from"react";import{Flex as i}from"../flex/Flex.js";import{PaginationItem as n}from"./PaginationItem.js";import{PaginationPopover as l}from"./PaginationPopover.js";import{usePagination as p}from"./usePagination.js";const g=()=>{const{pagesCount:a,paginationItems:t,paginationAlignment:m}=p(),r=a>t.length;return e.createElement(i,{gap:1},r&&m==="start"&&e.createElement(e.Fragment,null,e.createElement(n,{pageNumber:1}),e.createElement(l,null)),t==null?void 0:t.map(o=>e.createElement(n,{key:o,pageNumber:o})),r&&m==="end"&&e.createElement(e.Fragment,null,e.createElement(l,null),e.createElement(n,{pageNumber:a})))};export{g as PaginationPages};
|
|
2
2
|
//# sourceMappingURL=PaginationPages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaginationPages.js","sources":["../../../src/components/pagination/PaginationPages.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Flex } from '../flex'\nimport {
|
|
1
|
+
{"version":3,"file":"PaginationPages.js","sources":["../../../src/components/pagination/PaginationPages.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Flex } from '../flex'\nimport { PaginationItem } from './PaginationItem'\nimport { PaginationPopover } from './PaginationPopover'\nimport { usePagination } from './usePagination'\n\nexport const PaginationPages = () => {\n const { pagesCount, paginationItems, paginationAlignment } = usePagination()\n\n const isTruncated = pagesCount > paginationItems.length\n\n return (\n <Flex gap={1}>\n {isTruncated && paginationAlignment === 'start' && (\n <>\n <PaginationItem pageNumber={1} />\n <PaginationPopover />\n </>\n )}\n {paginationItems?.map((pageNumber) => (\n <PaginationItem key={pageNumber} pageNumber={pageNumber} />\n ))}\n {isTruncated && paginationAlignment === 'end' && (\n <>\n <PaginationPopover />\n <PaginationItem pageNumber={pagesCount} />\n </>\n )}\n </Flex>\n )\n}\n"],"names":["PaginationPages","pagesCount","paginationItems","paginationAlignment","usePagination","isTruncated","React","Flex","PaginationItem","PaginationPopover","pageNumber"],"mappings":"kOAOO,MAAMA,EAAkB,IAAM,CACnC,KAAM,CAAE,WAAAC,EAAY,gBAAAC,EAAiB,oBAAAC,CAAoB,EAAIC,EAAAA,EAEvDC,EAAcJ,EAAaC,EAAgB,OAEjD,OACEI,EAAA,cAACC,EAAA,CAAK,IAAK,CACRF,EAAAA,GAAeF,IAAwB,SACtCG,EAAA,cAAAA,EAAA,SACEA,KAAAA,EAAA,cAACE,EAAA,CAAe,WAAY,CAAG,CAAA,EAC/BF,EAAA,cAACG,EAAA,IAAkB,CACrB,EAEDP,GAAA,KAAAA,OAAAA,EAAiB,IAAKQ,GACrBJ,EAAA,cAACE,EAAA,CAAe,IAAKE,EAAY,WAAYA,CAAAA,CAAY,GAE1DL,GAAeF,IAAwB,OACtCG,EAAA,cAAAA,EAAA,SAAA,KACEA,EAAA,cAACG,EAAA,IAAkB,EACnBH,EAAA,cAACE,EAAA,CAAe,WAAYP,CAAAA,CAAY,CAC1C,CAEJ,CAEJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
var e=(E=>(E[E.LESS=6]="LESS",E[E.MORE=8]="MORE",E))(e||{});export{e as VisibleElementsAmount};
|
|
2
2
|
//# sourceMappingURL=pagination.constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.constants.js","sources":["../../../src/components/pagination/pagination.constants.ts"],"sourcesContent":["export
|
|
1
|
+
{"version":3,"file":"pagination.constants.js","sources":["../../../src/components/pagination/pagination.constants.ts"],"sourcesContent":["export enum VisibleElementsAmount {\n LESS = 6,\n MORE = 8\n}\n"],"names":["VisibleElementsAmount","S"],"mappings":"AAAY,IAAAA,GAAAA,IACVA,EAAAA,EAAA,KAAO,GAAP,OACAA,EAAAC,EAAA,KAAO,GAAP,OAFUD,IAAAA,GAAA,CAAA,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{VisibleElementsAmount as r}from"./pagination.constants.js";const s=e=>e===r.MORE?4:2,a=(e,i,t)=>e>i-s(t)?"start":"end",c=(e,i,t=r.LESS)=>{const n=s(t),l=Array.from({length:i},(g,o)=>o+1);return i<=t-2?l:(t===r.MORE?[1,2,3].includes(e):[1,2].includes(e))?l.slice(0,n):e>i-n?l.slice(-n):l.slice(t===r.MORE?e-3:e-2,t===r.MORE?e+1:e)},u=(e,i)=>{let t=e;for(;i.includes(t);)t++;return t},d=(e,i)=>{let t=e;for(;i.includes(t);)t--;return t};export{u as findNextAvailablePage,d as findPreviousAvailablePage,a as getPaginationAlignment,c as getPaginationItemsToRender};
|
|
2
2
|
//# sourceMappingURL=pagination.helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.helper.js","sources":["../../../src/components/pagination/pagination.helper.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"pagination.helper.js","sources":["../../../src/components/pagination/pagination.helper.ts"],"sourcesContent":["import { VisibleElementsAmount } from './pagination.constants'\nimport { IPaginationAlignment } from './types'\n\n/**\n * Return the maximum number of pagination items required, dependent\n * on the total visible elements.\n *\n * Excludes the 1st and last page as they are rendered separately.\n *\n * So if `visibleElementsCount` is `MORE` (`8`), when we exclude the following 4 buttons,\n * previous, next, popup, and _either_ 1st/last page items, we'll get `4` remaining to render.\n */\nconst getPaginationItemsLimit = (visibleElementsCount: VisibleElementsAmount) =>\n visibleElementsCount === VisibleElementsAmount.MORE ? 4 : 2\n\nexport const getPaginationAlignment = (\n currentPage: number,\n pagesCount: number,\n visibleElementsCount: VisibleElementsAmount\n): IPaginationAlignment =>\n currentPage > pagesCount - getPaginationItemsLimit(visibleElementsCount)\n ? 'start'\n : 'end'\n\nexport const getPaginationItemsToRender = (\n currentPage: number,\n pagesCount: number,\n visibleElementsCount = VisibleElementsAmount.LESS\n): number[] => {\n const paginationItemsLimit = getPaginationItemsLimit(visibleElementsCount)\n const paginationItems = Array.from(\n { length: pagesCount },\n (_, index) => index + 1\n )\n\n /**\n * If there are fewer pages than our threshold for truncating,\n * render the entire page list.\n *\n * We need to remove `2` from `visibleElementsCount` to account\n * for the previous & next buttons\n *\n * pagesCount: 4\n * visibleElementsCount: 6 // VisibleElementsAmount.LESS\n * returns [1, 2, 3, 4]\n * +---+ +---+ +---+ +---+ +---+ +---+\n * | < | | 1 | | 2 | | 3 | | 4 | | > |\n * +---+ +---+ +---+ +---+ +---+ +---+\n *\n * pagesCount: 6\n * visibleElementsCount:8 // VisibleElementsAmount.MORE\n * returns [1, 2, 3, 4, 5, 6]\n * +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+\n * | < | | 1 | | 2 | | 3 | | 4 | | 5 | | 6 | | > |\n * +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+\n */\n if (pagesCount <= visibleElementsCount - 2) {\n return paginationItems\n }\n\n /**\n * If we're truncating and current page is at the start of the page list,\n * render the initial truncated page list, e.g.\n *\n * currentPage: 1/2\n * visibleElementsCount: 6 // VisibleElementsAmount.LESS\n * returns [1, 2]\n * +---+ +---+ +---+ +---+ +---+ +---+\n * | < | | 1 | | 2 | | … | | 6 | | > |\n * +---+ +---+ +---+ +---+ +---+ +---+\n *\n * currentPage: 1/2/3\n * visibleElementsCount: 8 // VisibleElementsAmount.MORE\n * returns [1, 2, 3, 4]\n * +---+ +---+ +---+ +---+ +---+ +---+ +----+ +---+\n * | < | | 1 | | 2 | | 3 | | 4 | | … | | 10 | | > |\n * +---+ +---+ +---+ +---+ +---+ +---+ +----+ +---+\n */\n if (\n visibleElementsCount === VisibleElementsAmount.MORE\n ? [1, 2, 3].includes(currentPage)\n : [1, 2].includes(currentPage)\n ) {\n return paginationItems.slice(0, paginationItemsLimit)\n }\n\n /**\n * If we're truncating and the current page is towards the end of the\n * page list (depending on visibleElementsCount),\n * render a truncated page list from the end, e.g.\n *\n * currentPage: 7\n * visibleElementsCount: 6 // VisibleElementsAmount.LESS\n * returns [7, 8]\n * +---+ +---+ +---+ +---+ +---+ +---+\n * | < | | 1 | | … | | 7 | | 8 | | > |\n * +---+ +---+ +---+ +---+ +---+ +---+\n *\n * currentPage: 7\n * visibleElementsCount: 8 // VisibleElementsAmount.MORE\n * returns [7, 8, 9, 10]\n * +---+ +---+ +---+ +---+ +---+ +---+ +----+ +---+\n * | < | | 1 | | … | | 7 | | 8 | | 9 | | 10 | | > |\n * +---+ +---+ +---+ +---+ +---+ +---+ +----+ +---+\n */\n if (currentPage > pagesCount - paginationItemsLimit) {\n return paginationItems.slice(-paginationItemsLimit)\n }\n\n /**\n * If we're truncating and the current page doesn't meet either previous condition\n * (we're in the middle)\n * render a truncated page list from a specific index relative to `currentPage`, e.g.\n *\n * currentPage: 4\n * visibleElementsCount: 6 // VisibleElementsAmount.LESS\n * returns [3, 4]\n * +---+ +---+ +---+ +---+ +---+ +---+\n * | < | | 3 | | 4 | | … | | 6 | | > |\n * +---+ +---+ +---+ +---+ +---+ +---+\n *\n * currentPage: 6\n * visibleElementsCount: 8 // VisibleElementsAmount.MORE\n * returns [4, 5, 6, 7]\n * +---+ +---+ +---+ +---+ +---+ +---+ +----+ +---+\n * | < | | 4 | | 5 | | 6 | | 7 | | … | | 10 | | > |\n * +---+ +---+ +---+ +---+ +---+ +---+ +----+ +---+\n */\n return paginationItems.slice(\n visibleElementsCount === VisibleElementsAmount.MORE\n ? currentPage - 3\n : currentPage - 2,\n visibleElementsCount === VisibleElementsAmount.MORE\n ? currentPage + 1\n : currentPage\n )\n}\n\nexport const findNextAvailablePage = (\n startPage: number,\n disabledPages: number[]\n): number => {\n let nextPage = startPage\n while (disabledPages.includes(nextPage)) {\n nextPage++\n }\n return nextPage\n}\n\nexport const findPreviousAvailablePage = (\n startPage: number,\n disabledPages: number[]\n): number => {\n let previousPage = startPage\n while (disabledPages.includes(previousPage)) {\n previousPage--\n }\n return previousPage\n}\n"],"names":["getPaginationItemsLimit","visibleElementsCount","VisibleElementsAmount","getPaginationAlignment","currentPage","pagesCount","getPaginationItemsToRender","paginationItemsLimit","paginationItems","_","index","findNextAvailablePage","startPage","disabledPages","nextPage","findPreviousAvailablePage","previousPage"],"mappings":"kEAYA,MAAMA,EAA2BC,GAC/BA,IAAyBC,EAAsB,KAAO,EAAI,EAE/CC,EAAyB,CACpCC,EACAC,EACAJ,IAEAG,EAAcC,EAAaL,EAAwBC,CAAoB,EACnE,QACA,MAEOK,EAA6B,CACxCF,EACAC,EACAJ,EAAuBC,EAAsB,OAChC,CACb,MAAMK,EAAuBP,EAAwBC,CAAoB,EACnEO,EAAkB,MAAM,KAC5B,CAAE,OAAQH,CAAW,EACrB,CAACI,EAAGC,IAAUA,EAAQ,CACxB,EAuBA,OAAIL,GAAcJ,EAAuB,EAChCO,GAsBPP,IAAyBC,EAAsB,KAC3C,CAAC,EAAG,EAAG,CAAC,EAAE,SAASE,CAAW,EAC9B,CAAC,EAAG,CAAC,EAAE,SAASA,CAAW,GAExBI,EAAgB,MAAM,EAAGD,CAAoB,EAsBlDH,EAAcC,EAAaE,EACtBC,EAAgB,MAAM,CAACD,CAAoB,EAsB7CC,EAAgB,MACrBP,IAAyBC,EAAsB,KAC3CE,EAAc,EACdA,EAAc,EAClBH,IAAyBC,EAAsB,KAC3CE,EAAc,EACdA,CACN,CACF,EAEaO,EAAwB,CACnCC,EACAC,IACW,CACX,IAAIC,EAAWF,EACf,KAAOC,EAAc,SAASC,CAAQ,GACpCA,IAEF,OAAOA,CACT,EAEaC,EAA4B,CACvCH,EACAC,IACW,CACX,IAAIG,EAAeJ,EACnB,KAAOC,EAAc,SAASG,CAAY,GACxCA,IAEF,OAAOA,CACT"}
|