@caspeco/casper-ui-library 8.2.2 → 8.3.0
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/dist/components/paginator/paginator.composition.d.ts +1 -0
- package/dist/components/paginator/paginator.composition.d.ts.map +1 -1
- package/dist/components/paginator/paginator.d.ts +3 -1
- package/dist/components/paginator/paginator.d.ts.map +1 -1
- package/dist/components/paginator/paginator.js +12 -11
- package/dist/theme/theme-config/components/paginator-theme.d.ts +5 -19
- package/dist/theme/theme-config/components/paginator-theme.d.ts.map +1 -1
- package/dist/theme/theme-config/components/paginator-theme.js +34 -18
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paginator.composition.d.ts","sourceRoot":"","sources":["../../../lib/components/paginator/paginator.composition.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"paginator.composition.d.ts","sourceRoot":"","sources":["../../../lib/components/paginator/paginator.composition.tsx"],"names":[],"mappings":"AA4BA,eAAO,MAAM,cAAc,+CAAqD,CAAC;AAEjF,eAAO,MAAM,gBAAgB,+CAAuD,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ThemeStyleProps } from '../../theme/index.js';
|
|
2
|
+
import { PaginatorVariant } from '../../theme/theme-config/components/paginator-theme.js';
|
|
2
3
|
import { Locale } from './translations.js';
|
|
3
4
|
export type PaginatorProps = ThemeStyleProps & {
|
|
5
|
+
variant?: PaginatorVariant;
|
|
4
6
|
/** Which locale to use for translations */
|
|
5
7
|
locale: Locale;
|
|
6
8
|
/** The size of each page */
|
|
@@ -12,5 +14,5 @@ export type PaginatorProps = ThemeStyleProps & {
|
|
|
12
14
|
/** Invoked when the page index changes */
|
|
13
15
|
onPageChange?: (newPageIndex: number) => void;
|
|
14
16
|
};
|
|
15
|
-
export declare function Paginator({ locale, pageSize, itemCount, pageIndex: _pageIndex, onPageChange, ...rest }: PaginatorProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare function Paginator({ locale, pageSize, itemCount, pageIndex: _pageIndex, onPageChange, variant, ...rest }: PaginatorProps): import("react/jsx-runtime").JSX.Element;
|
|
16
18
|
//# sourceMappingURL=paginator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paginator.d.ts","sourceRoot":"","sources":["../../../lib/components/paginator/paginator.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"paginator.d.ts","sourceRoot":"","sources":["../../../lib/components/paginator/paginator.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iDAAiD,CAAC;AAExF,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,gBAAgB,CAAC;AAE3D,MAAM,MAAM,cAAc,GAAG,eAAe,GAAG;IAC9C,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAE3B,2CAA2C;IAC3C,MAAM,EAAE,MAAM,CAAC;IAEf,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,gCAAgC;IAChC,SAAS,EAAE,MAAM,CAAC;IAElB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,0CAA0C;IAC1C,YAAY,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C,CAAC;AAEF,wBAAgB,SAAS,CAAC,EACzB,MAAM,EACN,QAAa,EACb,SAAS,EACT,SAAS,EAAE,UAAU,EACrB,YAAY,EACZ,OAAiB,EACjB,GAAG,IAAI,EACP,EAAE,cAAc,2CA6ChB"}
|
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
import { jsxs as i, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { useControllableState as C, useStyleConfig as
|
|
3
|
-
import { translations as
|
|
2
|
+
import { useControllableState as C, useStyleConfig as k, Box as s } from "@chakra-ui/react";
|
|
3
|
+
import { translations as B } from "./translations.js";
|
|
4
4
|
import { IconButton as c } from "../icon-button/icon-button.js";
|
|
5
5
|
import { Icons as l } from "../icon/types.js";
|
|
6
|
-
function
|
|
6
|
+
function _({
|
|
7
7
|
locale: g,
|
|
8
8
|
pageSize: n = 10,
|
|
9
9
|
itemCount: o,
|
|
10
10
|
pageIndex: m,
|
|
11
11
|
onPageChange: d,
|
|
12
|
-
|
|
12
|
+
variant: P = "ghost",
|
|
13
|
+
...u
|
|
13
14
|
}) {
|
|
14
15
|
const [a, r] = C({
|
|
15
16
|
value: m,
|
|
16
17
|
defaultValue: 0,
|
|
17
18
|
onChange: d
|
|
18
|
-
}), x =
|
|
19
|
+
}), x = k("Paginator", { variant: P }), t = B[g], h = a > 0, f = n > 0 && a < Math.ceil(o / n) - 1, p = a * n + 1, I = Math.max(Math.min(n * (a + 1), o), 1), b = () => {
|
|
19
20
|
r(a - 1);
|
|
20
21
|
}, v = () => {
|
|
21
22
|
r(a + 1);
|
|
22
23
|
};
|
|
23
|
-
return /* @__PURE__ */ i(s, { __css: x, ...
|
|
24
|
-
/* @__PURE__ */ e(s, { children: t.currentPage(
|
|
25
|
-
/* @__PURE__ */ i(s, { children: [
|
|
24
|
+
return /* @__PURE__ */ i(s, { __css: x, ...u, children: [
|
|
25
|
+
/* @__PURE__ */ e(s, { children: t.currentPage(p, I, o) }),
|
|
26
|
+
/* @__PURE__ */ i(s, { className: "paginator-buttons-container", children: [
|
|
26
27
|
/* @__PURE__ */ e(
|
|
27
28
|
c,
|
|
28
29
|
{
|
|
@@ -30,8 +31,8 @@ function N({
|
|
|
30
31
|
size: "md",
|
|
31
32
|
variant: "ghost",
|
|
32
33
|
"aria-label": t.previousPage,
|
|
33
|
-
onClick:
|
|
34
|
-
isDisabled: !
|
|
34
|
+
onClick: b,
|
|
35
|
+
isDisabled: !h
|
|
35
36
|
}
|
|
36
37
|
),
|
|
37
38
|
/* @__PURE__ */ e(
|
|
@@ -49,5 +50,5 @@ function N({
|
|
|
49
50
|
] });
|
|
50
51
|
}
|
|
51
52
|
export {
|
|
52
|
-
|
|
53
|
+
_ as Paginator
|
|
53
54
|
};
|
|
@@ -1,31 +1,17 @@
|
|
|
1
|
-
import { ThemeColorVariable, ThemeFontSizeVariable, ThemeFontVariable, ThemeSpaceVariable } from '../../theme-types.js';
|
|
2
1
|
export declare const paginatorConfig: {
|
|
3
|
-
baseStyle?:
|
|
4
|
-
width: string;
|
|
5
|
-
fontFamily: ThemeFontVariable;
|
|
6
|
-
color: ThemeColorVariable;
|
|
7
|
-
display: string;
|
|
8
|
-
justifyContent: string;
|
|
9
|
-
alignItems: string;
|
|
10
|
-
fontVariant: string;
|
|
11
|
-
padding: ThemeSpaceVariable;
|
|
12
|
-
gap: ThemeSpaceVariable;
|
|
13
|
-
div: {
|
|
14
|
-
button: {
|
|
15
|
-
fontSize: ThemeFontSizeVariable;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
} | undefined;
|
|
2
|
+
baseStyle?: (import('@chakra-ui/styled-system').CSSWithMultiValues & import('@chakra-ui/styled-system').RecursiveCSSSelector<import('@chakra-ui/styled-system').CSSWithMultiValues>) | undefined;
|
|
19
3
|
sizes?: {
|
|
20
4
|
[key: string]: import('@chakra-ui/styled-system').SystemStyleInterpolation;
|
|
21
5
|
} | undefined;
|
|
22
6
|
variants?: {
|
|
23
|
-
|
|
7
|
+
ghost: import('@chakra-ui/styled-system').CSSWithMultiValues | (import('@chakra-ui/styled-system').CSSWithMultiValues & import('@chakra-ui/styled-system').RecursiveCSSSelector<import('@chakra-ui/styled-system').CSSWithMultiValues>);
|
|
8
|
+
outline: import('@chakra-ui/styled-system').CSSWithMultiValues & import('@chakra-ui/styled-system').RecursiveCSSSelector<import('@chakra-ui/styled-system').CSSWithMultiValues>;
|
|
24
9
|
} | undefined;
|
|
25
10
|
defaultProps?: {
|
|
26
11
|
size?: string | number | undefined;
|
|
27
|
-
variant?:
|
|
12
|
+
variant?: "outline" | "ghost" | undefined;
|
|
28
13
|
colorScheme?: string | undefined;
|
|
29
14
|
} | undefined;
|
|
30
15
|
};
|
|
16
|
+
export type PaginatorVariant = keyof Exclude<typeof paginatorConfig.variants, undefined>;
|
|
31
17
|
//# sourceMappingURL=paginator-theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paginator-theme.d.ts","sourceRoot":"","sources":["../../../../lib/theme/theme-config/components/paginator-theme.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"paginator-theme.d.ts","sourceRoot":"","sources":["../../../../lib/theme/theme-config/components/paginator-theme.ts"],"names":[],"mappings":"AA4CA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;CAM1B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,MAAM,OAAO,CAAC,OAAO,eAAe,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC"}
|
|
@@ -1,23 +1,39 @@
|
|
|
1
|
-
import { defineStyleConfig as
|
|
2
|
-
import {
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
div: {
|
|
15
|
-
button: {
|
|
16
|
-
fontSize: o.Large
|
|
17
|
-
}
|
|
1
|
+
import { defineStyleConfig as t } from "@chakra-ui/react";
|
|
2
|
+
import { ThemeSpaceVariable as a, ThemeColorVariable as o, ThemeFontSizeVariable as e, ThemeFontVariable as n } from "../../theme-types.js";
|
|
3
|
+
const i = {
|
|
4
|
+
fontFamily: n.Body,
|
|
5
|
+
color: o.OnBackground,
|
|
6
|
+
fontVariant: "tabular-nums",
|
|
7
|
+
display: "flex",
|
|
8
|
+
alignItems: "center",
|
|
9
|
+
gap: a.Medium,
|
|
10
|
+
".paginator-buttons-container": {
|
|
11
|
+
display: "inline-flex",
|
|
12
|
+
button: {
|
|
13
|
+
fontSize: e.Large
|
|
18
14
|
}
|
|
19
15
|
}
|
|
16
|
+
}, r = {
|
|
17
|
+
width: "100%",
|
|
18
|
+
justifyContent: "flex-end",
|
|
19
|
+
padding: a.Small
|
|
20
|
+
}, l = {
|
|
21
|
+
width: "fit-content",
|
|
22
|
+
padding: `${a.XSmall} ${a.Medium}`,
|
|
23
|
+
borderRadius: a.Small,
|
|
24
|
+
border: `1px solid ${o.OnSurfaceBorder}`,
|
|
25
|
+
backgroundColor: o.Surface,
|
|
26
|
+
boxShadow: `0 4px 12px 0 ${o.ShadowCard}`,
|
|
27
|
+
".paginator-buttons-container": {
|
|
28
|
+
gap: a.Small
|
|
29
|
+
}
|
|
30
|
+
}, s = t({
|
|
31
|
+
baseStyle: i,
|
|
32
|
+
variants: {
|
|
33
|
+
ghost: r,
|
|
34
|
+
outline: l
|
|
35
|
+
}
|
|
20
36
|
});
|
|
21
37
|
export {
|
|
22
|
-
|
|
38
|
+
s as paginatorConfig
|
|
23
39
|
};
|