@pismo/marola 1.0.0-beta.25 → 1.0.0-beta.27

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.
@@ -1,3 +1,5 @@
1
+ import { UsePaginationProps } from './usePagination';
2
+
1
3
  export type PaginationParams = {
2
4
  /** Total number of items to paginate */
3
5
  totalItems: number;
@@ -53,9 +55,11 @@ export type PaginationProps = {
53
55
  language?: PaginationLanguages;
54
56
  /** Custom translation object to be used for texts. */
55
57
  t?: Partial<PaginationTranslations>;
58
+ /** usePagination hook props */
59
+ usePaginationProps?: UsePaginationProps;
56
60
  } & PaginationParams & PaginationCommonProps;
57
61
  export declare const paginationDefaultTranslations: {
58
62
  [key in PaginationLanguages]: PaginationTranslations;
59
63
  };
60
- export declare const Pagination: ({ perPageOptions, language, ...props }: PaginationProps) => import("react/jsx-runtime").JSX.Element;
64
+ export declare const Pagination: ({ perPageOptions, language, usePaginationProps, ...props }: PaginationProps) => import("react/jsx-runtime").JSX.Element;
61
65
  export {};
@@ -2,8 +2,8 @@ import '../../assets/Pagination.css';
2
2
  import { jsxs as s, Fragment as p, jsx as t } from "react/jsx-runtime";
3
3
  import { c as _ } from "../../clsx-DB4S2d7J.js";
4
4
  import { Select as d } from "../Select/Select.js";
5
- import I from "./usePagination.js";
6
- const C = "_pagination_2n0nk_43", a = {
5
+ import C from "./usePagination.js";
6
+ const w = "_pagination_2n0nk_43", a = {
7
7
  "u-typography-h1": "_u-typography-h1_2n0nk_1",
8
8
  "u-typography-h2": "_u-typography-h2_2n0nk_8",
9
9
  "u-typography-h3": "_u-typography-h3_2n0nk_15",
@@ -11,7 +11,7 @@ const C = "_pagination_2n0nk_43", a = {
11
11
  "u-typography-h5": "_u-typography-h5_2n0nk_29",
12
12
  "u-typography-h6": "_u-typography-h6_2n0nk_36",
13
13
  "u-typography-base": "_u-typography-base_2n0nk_43",
14
- pagination: C,
14
+ pagination: w,
15
15
  "per-page-container": "_per-page-container_2n0nk_43",
16
16
  "u-typography-base--xxl": "_u-typography-base--xxl_2n0nk_49",
17
17
  "u-typography-base--xl": "_u-typography-base--xl_2n0nk_53",
@@ -27,7 +27,7 @@ const C = "_pagination_2n0nk_43", a = {
27
27
  "page-number__btn": "_page-number__btn_2n0nk_115",
28
28
  "pages-navigator-container__previous-next-btn": "_pages-navigator-container__previous-next-btn_2n0nk_134",
29
29
  "page-number__btn--selected": "_page-number__btn--selected_2n0nk_159"
30
- }, w = {
30
+ }, B = {
31
31
  pt: {
32
32
  showing: "Exibindo",
33
33
  of: "de",
@@ -44,15 +44,21 @@ const C = "_pagination_2n0nk_43", a = {
44
44
  next: "Next",
45
45
  perPage: "Items per page"
46
46
  }
47
- }, j = ({ perPageOptions: o = [5, 10, 25, 50, 100], language: y = "en", ...e }) => {
48
- const l = Math.ceil(e.totalItems / e.perPage), b = e.currentPage <= 1, m = e.currentPage >= l, k = { ...w[y], ...e.t || {} }, i = (n) => k[n], { items: v } = I({
47
+ }, $ = ({
48
+ perPageOptions: o = [5, 10, 25, 50, 100],
49
+ language: y = "en",
50
+ usePaginationProps: b = {},
51
+ ...e
52
+ }) => {
53
+ const l = Math.ceil(e.totalItems / e.perPage), m = e.currentPage <= 1, k = e.currentPage >= l, v = { ...B[y], ...e.t || {} }, i = (n) => v[n], { items: x } = C({
49
54
  count: l,
55
+ page: e.currentPage,
50
56
  hideNextButton: !0,
51
57
  hidePrevButton: !0,
52
- page: e.currentPage,
53
58
  siblingCount: 1,
54
- boundaryCount: 2
55
- }), c = e.perPage * (e.currentPage - 1) + 1, u = c + e.perPage - 1, x = u > e.totalItems ? u - e.totalItems : 0, P = u - x;
59
+ boundaryCount: 2,
60
+ ...b
61
+ }), c = e.perPage * (e.currentPage - 1) + 1, u = c + e.perPage - 1, P = u > e.totalItems ? u - e.totalItems : 0, N = u - P;
56
62
  return /* @__PURE__ */ s("div", { className: _(a.pagination, e.className), "data-testid": e["data-testid"], children: [
57
63
  /* @__PURE__ */ s(
58
64
  "div",
@@ -86,7 +92,7 @@ const C = "_pagination_2n0nk_43", a = {
86
92
  /* @__PURE__ */ s("span", { children: [
87
93
  c,
88
94
  " - ",
89
- P
95
+ N
90
96
  ] }),
91
97
  " ",
92
98
  /* @__PURE__ */ s("span", { children: [
@@ -110,31 +116,31 @@ const C = "_pagination_2n0nk_43", a = {
110
116
  "button",
111
117
  {
112
118
  className: a["pages-navigator-container__previous-next-btn"],
113
- disabled: b,
119
+ disabled: m,
114
120
  onClick: () => e.onPageChange(e.currentPage - 1),
115
121
  type: "button",
116
122
  children: i`previous`
117
123
  },
118
124
  "page__previous"
119
125
  ),
120
- /* @__PURE__ */ t("ul", { children: v.map(({ page: n, type: r, selected: N, ...f }, h) => {
126
+ /* @__PURE__ */ t("ul", { children: x.map(({ page: n, type: r, selected: f, ...I }, h) => {
121
127
  let g = /* @__PURE__ */ t(p, {});
122
128
  return r === "start-ellipsis" || r === "end-ellipsis" ? g = /* @__PURE__ */ t("span", { className: a["page-item"], children: "..." }) : r === "page" ? g = /* @__PURE__ */ t(
123
129
  "button",
124
130
  {
125
- className: _(a["page-number__btn"], N && a["page-number__btn--selected"]),
131
+ className: _(a["page-number__btn"], f && a["page-number__btn--selected"]),
126
132
  onClick: () => e.onPageChange(n || 0),
127
133
  type: "button",
128
134
  children: n
129
135
  },
130
136
  `page__${h}`
131
- ) : g = /* @__PURE__ */ t("button", { type: "button", ...f, children: r }), /* @__PURE__ */ t("li", { children: g }, h);
137
+ ) : g = /* @__PURE__ */ t("button", { type: "button", ...I, children: r }), /* @__PURE__ */ t("li", { children: g }, h);
132
138
  }) }),
133
139
  /* @__PURE__ */ t(
134
140
  "button",
135
141
  {
136
142
  className: a["pages-navigator-container__previous-next-btn"],
137
- disabled: m,
143
+ disabled: k,
138
144
  onClick: () => e.onPageChange(e.currentPage + 1),
139
145
  type: "button",
140
146
  children: i`next`
@@ -147,6 +153,6 @@ const C = "_pagination_2n0nk_43", a = {
147
153
  ] });
148
154
  };
149
155
  export {
150
- j as Pagination,
151
- w as paginationDefaultTranslations
156
+ $ as Pagination,
157
+ B as paginationDefaultTranslations
152
158
  };
@@ -3,7 +3,7 @@ import { StoryObj } from '@storybook/react';
3
3
 
4
4
  declare const meta: {
5
5
  title: string;
6
- component: ({ perPageOptions, language, ...props }: PaginationProps) => import("react/jsx-runtime").JSX.Element;
6
+ component: ({ perPageOptions, language, usePaginationProps, ...props }: PaginationProps) => import("react/jsx-runtime").JSX.Element;
7
7
  tags: string[];
8
8
  parameters: {
9
9
  layout: string;
@@ -2,8 +2,12 @@ import { VariantType } from '../Typography/Typography.tsx';
2
2
  import { default as React } from 'react';
3
3
 
4
4
  type OptionsProps = {
5
+ /** Text variant */
5
6
  variant?: VariantType;
7
+ /** Text color */
6
8
  color?: string;
9
+ /** Text weight */
10
+ bold?: boolean;
7
11
  };
8
12
  export interface TextDisplayProps {
9
13
  /** TextDisplay label */
@@ -12,8 +16,8 @@ export interface TextDisplayProps {
12
16
  value: React.ReactNode;
13
17
  /** Renders skeleton when true */
14
18
  isLoading?: boolean;
15
- /** Sets the testId prefix for label, value and skeletons */
16
- testId?: string;
19
+ /** Sets the data-testid prefix for label, value and skeletons */
20
+ 'data-testid'?: string;
17
21
  /** Sets the label options */
18
22
  labelOptions?: OptionsProps;
19
23
  /** Sets the value options */
@@ -21,5 +25,5 @@ export interface TextDisplayProps {
21
25
  /** Sets the label and value onto the same line */
22
26
  inline?: boolean;
23
27
  }
24
- export declare const TextDisplay: ({ label, value, isLoading, testId, labelOptions, valueOptions, inline, }: TextDisplayProps) => import("react/jsx-runtime").JSX.Element;
28
+ export declare const TextDisplay: ({ label, value, isLoading, "data-testid": dataTestId, labelOptions, valueOptions, inline, }: TextDisplayProps) => import("react/jsx-runtime").JSX.Element;
25
29
  export {};
@@ -1,45 +1,45 @@
1
1
  import '../../assets/TextDisplay.css';
2
- import { jsxs as x, jsx as o } from "react/jsx-runtime";
3
- import { c as _ } from "../../clsx-DB4S2d7J.js";
4
- import { Skeleton as d } from "../Skeleton/Skeleton.js";
5
- import { Typography as m } from "../Typography/Typography.js";
6
- const f = "_container_ia8vu_1", n = {
7
- container: f,
2
+ import { jsxs as f, jsx as d } from "react/jsx-runtime";
3
+ import { c as $ } from "../../clsx-DB4S2d7J.js";
4
+ import { Skeleton as m } from "../Skeleton/Skeleton.js";
5
+ import { Typography as y } from "../Typography/Typography.js";
6
+ const g = "_container_ia8vu_1", e = {
7
+ container: g,
8
8
  "container--inline": "_container--inline_ia8vu_5"
9
- }, T = ({
10
- label: i,
11
- value: y,
12
- isLoading: e = !1,
13
- testId: c = "TextDisplay",
9
+ }, i = ({
10
+ label: h,
11
+ value: x,
12
+ isLoading: o = !1,
13
+ "data-testid": t = "TextDisplay",
14
14
  labelOptions: r,
15
- valueOptions: a,
16
- inline: t
15
+ valueOptions: c,
16
+ inline: a
17
17
  }) => {
18
- const h = r != null && r.color || t ? "var(--black-100)" : "var(--gray-90)";
19
- return /* @__PURE__ */ x(
18
+ const _ = (r == null ? void 0 : r.color) || (a ? "var(--black-100)" : "var(--gray-90)");
19
+ return /* @__PURE__ */ f(
20
20
  "div",
21
21
  {
22
- className: _([n.container, { [n["container--inline"]]: t }]),
23
- "data-testid": `${c}-container`,
22
+ className: $([e.container, { [e["container--inline"]]: a }]),
23
+ "data-testid": `${t}-container`,
24
24
  children: [
25
- /* @__PURE__ */ o(
26
- m,
25
+ /* @__PURE__ */ d(
26
+ y,
27
27
  {
28
- color: h,
28
+ color: _,
29
29
  variant: (r == null ? void 0 : r.variant) || "base",
30
- "data-testid": `${c}-label`,
31
- bold: t,
32
- children: e ? /* @__PURE__ */ o(d, { style: { width: 70, marginBottom: 2 }, "data-testid": `${c}-skeletonLabel` }) : i
30
+ "data-testid": `${t}-label`,
31
+ bold: (r == null ? void 0 : r.bold) ?? a,
32
+ children: o ? /* @__PURE__ */ d(m, { style: { width: 70, marginBottom: 2 }, "data-testid": `${t}-skeletonLabel` }) : h
33
33
  }
34
34
  ),
35
- /* @__PURE__ */ o(
36
- m,
35
+ /* @__PURE__ */ d(
36
+ y,
37
37
  {
38
- bold: !t,
39
- color: (a == null ? void 0 : a.color) || "var(--gray-90)",
40
- variant: a != null && a.variant || t ? "base" : "base-lg",
41
- "data-testid": `${c}-value`,
42
- children: e ? /* @__PURE__ */ o(d, { style: { width: 100 }, "data-testid": `${c}-skeletonValue` }) : y || "-"
38
+ bold: (c == null ? void 0 : c.bold) ?? !a,
39
+ color: (c == null ? void 0 : c.color) || "var(--gray-90)",
40
+ variant: (c == null ? void 0 : c.variant) || (a ? "base" : "base-lg"),
41
+ "data-testid": `${t}-value`,
42
+ children: o ? /* @__PURE__ */ d(m, { style: { width: 100 }, "data-testid": `${t}-skeletonValue` }) : x || "-"
43
43
  }
44
44
  )
45
45
  ]
@@ -47,5 +47,5 @@ const f = "_container_ia8vu_1", n = {
47
47
  );
48
48
  };
49
49
  export {
50
- T as TextDisplay
50
+ i as TextDisplay
51
51
  };
@@ -2,7 +2,7 @@ import { StoryObj } from '@storybook/react';
2
2
 
3
3
  declare const meta: {
4
4
  title: string;
5
- component: ({ label, value, isLoading, testId, labelOptions, valueOptions, inline, }: import('./TextDisplay').TextDisplayProps) => import("react/jsx-runtime").JSX.Element;
5
+ component: ({ label, value, isLoading, "data-testid": dataTestId, labelOptions, valueOptions, inline, }: import('./TextDisplay').TextDisplayProps) => import("react/jsx-runtime").JSX.Element;
6
6
  tags: string[];
7
7
  };
8
8
  export default meta;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pismo/marola",
3
3
  "description": "CDX tribe component library",
4
- "version": "1.0.0-beta.25",
4
+ "version": "1.0.0-beta.27",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
7
7
  "types": "dist/main.d.ts",