@charlesgomes/leafcode-shared-lib-react 1.0.9 → 1.0.11

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/index.d.mts CHANGED
@@ -4,12 +4,16 @@ export { FilterMatchMode, FilterOperator } from 'primereact/api';
4
4
  export { DataTableProps } from 'primereact/datatable';
5
5
  export { ColumnProps } from 'primereact/column';
6
6
 
7
- type BotaoProps = {
8
- label: string;
9
- onClick?: () => void;
7
+ interface ButtonProps {
10
8
  disabled?: boolean;
11
- };
12
- declare function Botao({ label, onClick, disabled }: BotaoProps): react_jsx_runtime.JSX.Element;
9
+ loading?: boolean;
10
+ className?: string;
11
+ title: string;
12
+ type?: "button" | "reset" | "submit";
13
+ color?: "danger";
14
+ onClick?: () => void;
15
+ }
16
+ declare function Button({ disabled, loading, color, type, onClick, title, ...rest }: ButtonProps): react_jsx_runtime.JSX.Element;
13
17
 
14
18
  type IDataTableProps<T extends object> = {
15
19
  queryKey: string;
@@ -86,4 +90,4 @@ declare const getDefaultFilterMatchOptionsDate: (isLanguagePtBr: boolean) => {
86
90
  value: FilterMatchMode;
87
91
  }[];
88
92
 
89
- export { Botao, type BotaoProps, type ColumnCustom, DataTableAdvancedFilter, DateFilterTemplate, DateTimeFilterTemplate, type IDataTableProps, type IItemProps, SelectFilterTemplate, ValueFilterTemplate, getDefaultFilterMatchOptionsDate, getDefaultFilterMatchOptionsString };
93
+ export { Button, type ColumnCustom, DataTableAdvancedFilter, DateFilterTemplate, DateTimeFilterTemplate, type IDataTableProps, type IItemProps, SelectFilterTemplate, ValueFilterTemplate, getDefaultFilterMatchOptionsDate, getDefaultFilterMatchOptionsString };
package/dist/index.d.ts CHANGED
@@ -4,12 +4,16 @@ export { FilterMatchMode, FilterOperator } from 'primereact/api';
4
4
  export { DataTableProps } from 'primereact/datatable';
5
5
  export { ColumnProps } from 'primereact/column';
6
6
 
7
- type BotaoProps = {
8
- label: string;
9
- onClick?: () => void;
7
+ interface ButtonProps {
10
8
  disabled?: boolean;
11
- };
12
- declare function Botao({ label, onClick, disabled }: BotaoProps): react_jsx_runtime.JSX.Element;
9
+ loading?: boolean;
10
+ className?: string;
11
+ title: string;
12
+ type?: "button" | "reset" | "submit";
13
+ color?: "danger";
14
+ onClick?: () => void;
15
+ }
16
+ declare function Button({ disabled, loading, color, type, onClick, title, ...rest }: ButtonProps): react_jsx_runtime.JSX.Element;
13
17
 
14
18
  type IDataTableProps<T extends object> = {
15
19
  queryKey: string;
@@ -86,4 +90,4 @@ declare const getDefaultFilterMatchOptionsDate: (isLanguagePtBr: boolean) => {
86
90
  value: FilterMatchMode;
87
91
  }[];
88
92
 
89
- export { Botao, type BotaoProps, type ColumnCustom, DataTableAdvancedFilter, DateFilterTemplate, DateTimeFilterTemplate, type IDataTableProps, type IItemProps, SelectFilterTemplate, ValueFilterTemplate, getDefaultFilterMatchOptionsDate, getDefaultFilterMatchOptionsString };
93
+ export { Button, type ColumnCustom, DataTableAdvancedFilter, DateFilterTemplate, DateTimeFilterTemplate, type IDataTableProps, type IItemProps, SelectFilterTemplate, ValueFilterTemplate, getDefaultFilterMatchOptionsDate, getDefaultFilterMatchOptionsString };
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.tsx
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
- Botao: () => Botao,
33
+ Button: () => Button,
34
34
  DataTableAdvancedFilter: () => DataTableAdvancedFilter,
35
35
  DateFilterTemplate: () => DateFilterTemplate,
36
36
  DateTimeFilterTemplate: () => DateTimeFilterTemplate,
@@ -43,24 +43,55 @@ __export(index_exports, {
43
43
  });
44
44
  module.exports = __toCommonJS(index_exports);
45
45
 
46
- // src/components/Botao/Botao.tsx
46
+ // src/components/Button/Button.tsx
47
47
  var import_jsx_runtime = require("react/jsx-runtime");
48
- function Botao({ label, onClick, disabled }) {
48
+ function Button({
49
+ disabled,
50
+ loading,
51
+ color,
52
+ type,
53
+ onClick,
54
+ title,
55
+ ...rest
56
+ }) {
49
57
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
50
58
  "button",
51
59
  {
52
- onClick,
53
- disabled,
54
- style: {
55
- backgroundColor: disabled ? "#9ca3af" : "#0070f3",
56
- color: "#fff",
57
- padding: "10px 16px",
58
- borderRadius: 8,
59
- border: "none",
60
- cursor: disabled ? "not-allowed" : "pointer",
61
- fontWeight: 600
62
- },
63
- children: label
60
+ type,
61
+ className: `box-button ${disabled || loading ? "button-primary-disabled" : color === "danger" ? "button-secundary" : "button-primary"}`,
62
+ onClick: !loading ? onClick : void 0,
63
+ disabled: disabled || loading,
64
+ ...rest,
65
+ children: loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "box-loading", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
66
+ "svg",
67
+ {
68
+ className: "animate-spin",
69
+ xmlns: "http://www.w3.org/2000/svg",
70
+ fill: "none",
71
+ viewBox: "0 0 24 24",
72
+ children: [
73
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
74
+ "circle",
75
+ {
76
+ className: "opacity-01",
77
+ cx: "12",
78
+ cy: "12",
79
+ r: "10",
80
+ stroke: "currentColor",
81
+ strokeWidth: "4"
82
+ }
83
+ ),
84
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
85
+ "path",
86
+ {
87
+ className: "opacity-02",
88
+ fill: "currentColor",
89
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.373A8 8 0 0112 4v4a4 4 0 00-4 4H6zM20 12a8 8 0 01-8 8v-4a4 4 0 004-4h4z"
90
+ }
91
+ )
92
+ ]
93
+ }
94
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: title })
64
95
  }
65
96
  );
66
97
  }
@@ -1050,7 +1081,7 @@ var getDefaultFilterMatchOptionsDate = (isLanguagePtBr) => [
1050
1081
  var import_api4 = require("primereact/api");
1051
1082
  // Annotate the CommonJS export names for ESM import in node:
1052
1083
  0 && (module.exports = {
1053
- Botao,
1084
+ Button,
1054
1085
  DataTableAdvancedFilter,
1055
1086
  DateFilterTemplate,
1056
1087
  DateTimeFilterTemplate,
package/dist/index.mjs CHANGED
@@ -1,21 +1,52 @@
1
- // src/components/Botao/Botao.tsx
2
- import { jsx } from "react/jsx-runtime";
3
- function Botao({ label, onClick, disabled }) {
1
+ // src/components/Button/Button.tsx
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ function Button({
4
+ disabled,
5
+ loading,
6
+ color,
7
+ type,
8
+ onClick,
9
+ title,
10
+ ...rest
11
+ }) {
4
12
  return /* @__PURE__ */ jsx(
5
13
  "button",
6
14
  {
7
- onClick,
8
- disabled,
9
- style: {
10
- backgroundColor: disabled ? "#9ca3af" : "#0070f3",
11
- color: "#fff",
12
- padding: "10px 16px",
13
- borderRadius: 8,
14
- border: "none",
15
- cursor: disabled ? "not-allowed" : "pointer",
16
- fontWeight: 600
17
- },
18
- children: label
15
+ type,
16
+ className: `box-button ${disabled || loading ? "button-primary-disabled" : color === "danger" ? "button-secundary" : "button-primary"}`,
17
+ onClick: !loading ? onClick : void 0,
18
+ disabled: disabled || loading,
19
+ ...rest,
20
+ children: loading ? /* @__PURE__ */ jsx("span", { className: "box-loading", children: /* @__PURE__ */ jsxs(
21
+ "svg",
22
+ {
23
+ className: "animate-spin",
24
+ xmlns: "http://www.w3.org/2000/svg",
25
+ fill: "none",
26
+ viewBox: "0 0 24 24",
27
+ children: [
28
+ /* @__PURE__ */ jsx(
29
+ "circle",
30
+ {
31
+ className: "opacity-01",
32
+ cx: "12",
33
+ cy: "12",
34
+ r: "10",
35
+ stroke: "currentColor",
36
+ strokeWidth: "4"
37
+ }
38
+ ),
39
+ /* @__PURE__ */ jsx(
40
+ "path",
41
+ {
42
+ className: "opacity-02",
43
+ fill: "currentColor",
44
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.373A8 8 0 0112 4v4a4 4 0 00-4 4H6zM20 12a8 8 0 01-8 8v-4a4 4 0 004-4h4z"
45
+ }
46
+ )
47
+ ]
48
+ }
49
+ ) }) : /* @__PURE__ */ jsx("span", { children: title })
19
50
  }
20
51
  );
21
52
  }
@@ -96,7 +127,7 @@ function TooltipCustom({ label, id }) {
96
127
  }
97
128
 
98
129
  // src/components/DataTableAdvancedFilter/TableActions.tsx
99
- import { Fragment, jsx as jsx4, jsxs } from "react/jsx-runtime";
130
+ import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
100
131
  function TableActions({
101
132
  onNew,
102
133
  onEdit,
@@ -108,8 +139,8 @@ function TableActions({
108
139
  const disableButtonsNotMultiplesSelecteds = selectedRows?.length !== 1 ? true : false;
109
140
  const enableButtonsNotMultiplesSelecteds = selectedRows?.length > 0 ? true : false;
110
141
  const resolvedCustomActions = typeof customActions === "function" ? customActions(selectedRows) : customActions;
111
- return /* @__PURE__ */ jsxs("div", { className: "box-icones-table-actions", children: [
112
- onNew && /* @__PURE__ */ jsxs(Fragment, { children: [
142
+ return /* @__PURE__ */ jsxs2("div", { className: "box-icones-table-actions", children: [
143
+ onNew && /* @__PURE__ */ jsxs2(Fragment, { children: [
113
144
  /* @__PURE__ */ jsx4(
114
145
  "button",
115
146
  {
@@ -131,7 +162,7 @@ function TableActions({
131
162
  }
132
163
  )
133
164
  ] }),
134
- onEdit && /* @__PURE__ */ jsx4(Fragment, { children: /* @__PURE__ */ jsxs(
165
+ onEdit && /* @__PURE__ */ jsx4(Fragment, { children: /* @__PURE__ */ jsxs2(
135
166
  "button",
136
167
  {
137
168
  id: "edit",
@@ -153,7 +184,7 @@ function TableActions({
153
184
  ]
154
185
  }
155
186
  ) }),
156
- onDelete && /* @__PURE__ */ jsx4(Fragment, { children: /* @__PURE__ */ jsxs(
187
+ onDelete && /* @__PURE__ */ jsx4(Fragment, { children: /* @__PURE__ */ jsxs2(
157
188
  "button",
158
189
  {
159
190
  id: "delete",
@@ -177,7 +208,7 @@ function TableActions({
177
208
  ) }),
178
209
  resolvedCustomActions?.map((action) => {
179
210
  const id = `action-table${phraseToId(action.label)}`;
180
- return /* @__PURE__ */ jsxs(
211
+ return /* @__PURE__ */ jsxs2(
181
212
  "button",
182
213
  {
183
214
  id,
@@ -196,7 +227,7 @@ function TableActions({
196
227
 
197
228
  // src/components/DataTableAdvancedFilter/ActionsColumn.tsx
198
229
  import { PencilSimple as PencilSimple2, Trash as Trash2 } from "@phosphor-icons/react";
199
- import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
230
+ import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
200
231
  function ActionsColumn({
201
232
  row,
202
233
  onEdit,
@@ -205,8 +236,8 @@ function ActionsColumn({
205
236
  isLanguagePtBr
206
237
  }) {
207
238
  const resolvedCustomActions = typeof customActionsColums === "function" ? customActionsColums(row) : customActionsColums;
208
- return /* @__PURE__ */ jsxs2("div", { className: "box-icones-actions-column", children: [
209
- onEdit && /* @__PURE__ */ jsx5(Fragment2, { children: /* @__PURE__ */ jsxs2(
239
+ return /* @__PURE__ */ jsxs3("div", { className: "box-icones-actions-column", children: [
240
+ onEdit && /* @__PURE__ */ jsx5(Fragment2, { children: /* @__PURE__ */ jsxs3(
210
241
  "button",
211
242
  {
212
243
  id: "edit-column",
@@ -226,7 +257,7 @@ function ActionsColumn({
226
257
  ]
227
258
  }
228
259
  ) }),
229
- onDelete && /* @__PURE__ */ jsx5(Fragment2, { children: /* @__PURE__ */ jsxs2(
260
+ onDelete && /* @__PURE__ */ jsx5(Fragment2, { children: /* @__PURE__ */ jsxs3(
230
261
  "button",
231
262
  {
232
263
  id: "delete-column",
@@ -248,7 +279,7 @@ function ActionsColumn({
248
279
  ) }),
249
280
  resolvedCustomActions?.map((action) => {
250
281
  const id = `action-colunm-${phraseToId(action.label)}`;
251
- return /* @__PURE__ */ jsxs2(
282
+ return /* @__PURE__ */ jsxs3(
252
283
  "button",
253
284
  {
254
285
  id,
@@ -360,7 +391,7 @@ var useDebounce = (value, delay) => {
360
391
  };
361
392
 
362
393
  // src/components/DataTableAdvancedFilter/DataTableAdvancedFilterWrapper.tsx
363
- import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
394
+ import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
364
395
  function DataTableAdvancedFilterWrapper({
365
396
  queryKey,
366
397
  mutationFn,
@@ -479,7 +510,7 @@ function DataTableAdvancedFilterWrapper({
479
510
  }
480
511
  }, [customers?.items, selectedRowsData]);
481
512
  const TableHeaderAndTableActions = useMemo(
482
- () => /* @__PURE__ */ jsxs3(Fragment3, { children: [
513
+ () => /* @__PURE__ */ jsxs4(Fragment3, { children: [
483
514
  /* @__PURE__ */ jsx7(
484
515
  TableHeader_default,
485
516
  {
@@ -510,9 +541,9 @@ function DataTableAdvancedFilterWrapper({
510
541
  customActions
511
542
  ]
512
543
  );
513
- return /* @__PURE__ */ jsx7(Fragment3, { children: isClient && /* @__PURE__ */ jsxs3("div", { children: [
544
+ return /* @__PURE__ */ jsx7(Fragment3, { children: isClient && /* @__PURE__ */ jsxs4("div", { children: [
514
545
  disablePagination && /* @__PURE__ */ jsx7("div", { className: "disablePagination", children: globalFilterFields.length > 0 && TableHeaderAndTableActions }),
515
- /* @__PURE__ */ jsxs3(
546
+ /* @__PURE__ */ jsxs4(
516
547
  DataTable,
517
548
  {
518
549
  value: customers?.items ?? [],
@@ -559,7 +590,7 @@ function DataTableAdvancedFilterWrapper({
559
590
  children: /* @__PURE__ */ jsx7(CaretLeft, { size: 18, color: "#fff" })
560
591
  }
561
592
  ),
562
- CurrentPageReport: (options) => /* @__PURE__ */ jsxs3("span", { className: "pageReport", children: [
593
+ CurrentPageReport: (options) => /* @__PURE__ */ jsxs4("span", { className: "pageReport", children: [
563
594
  isLanguagePtBr ? "Mostrando" : "Showing",
564
595
  " ",
565
596
  options.first,
@@ -1004,7 +1035,7 @@ var getDefaultFilterMatchOptionsDate = (isLanguagePtBr) => [
1004
1035
  // src/index.tsx
1005
1036
  import { FilterMatchMode as FilterMatchMode4, FilterOperator } from "primereact/api";
1006
1037
  export {
1007
- Botao,
1038
+ Button,
1008
1039
  DataTableAdvancedFilter,
1009
1040
  DateFilterTemplate,
1010
1041
  DateTimeFilterTemplate,
@@ -0,0 +1,107 @@
1
+ .box-button {
2
+ display: flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+ position: relative;
6
+ }
7
+
8
+ .button-primary {
9
+ font-size: 14px;
10
+ cursor: pointer;
11
+ font-family: sans-serif;
12
+ font-weight: 600;
13
+ color: #fff;
14
+ transition: all 300ms ease-in-out;
15
+ background-color: #175dbf;
16
+ border-radius: 0.375rem;
17
+ padding-left: 1.5rem;
18
+ padding-right: 1.5rem;
19
+ height: 2.5rem;
20
+ width: 100%;
21
+ min-width: 8rem;
22
+ border: none;
23
+ }
24
+
25
+ .button-primary:hover {
26
+ background-color: #70a3ff;
27
+ color: #fff;
28
+ }
29
+
30
+ .button-secundary {
31
+ font-size: 14px;
32
+ cursor: pointer;
33
+ font-family: sans-serif;
34
+ font-weight: 600;
35
+ color: #fff;
36
+ transition: all 300ms ease-in-out;
37
+ background-color: #bf1717;
38
+ border-radius: 0.375rem;
39
+ padding-left: 1.5rem;
40
+ padding-right: 1.5rem;
41
+ height: 2.5rem;
42
+ width: 100%;
43
+ min-width: 8rem;
44
+ border: none;
45
+ }
46
+
47
+ .button-secundary:hover {
48
+ background-color: #f35353;
49
+ color: #fff;
50
+ }
51
+
52
+ .button-primary-disabled {
53
+ font-size: 14px;
54
+ font-family: sans-serif;
55
+ font-weight: 600;
56
+ color: #fff;
57
+ transition: all 300ms ease-in-out;
58
+ border: 1px solid #b6b9d3;
59
+ background-color: #b6b9d3;
60
+ cursor: not-allowed;
61
+ border-radius: 0.375rem;
62
+ padding-left: 1.5rem;
63
+ padding-right: 1.5rem;
64
+ padding-top: 0.375rem;
65
+ padding-bottom: 0.5rem;
66
+ height: 2.5rem;
67
+ width: 100%;
68
+ min-width: 8rem;
69
+ line-height: normal;
70
+ border: none;
71
+ }
72
+
73
+ .box-loading {
74
+ position: absolute;
75
+ display: flex;
76
+ align-items: center;
77
+ justify-content: center;
78
+ inset: 0;
79
+ }
80
+
81
+ .animate-spin {
82
+ height: 1.25rem;
83
+ width: 1.25rem;
84
+ color: #fff;
85
+ }
86
+
87
+ .opacity-01 {
88
+ opacity: 0.25;
89
+ }
90
+
91
+ .opacity-02 {
92
+ opacity: 0.75;
93
+ }
94
+
95
+ @media (min-width: 640px) {
96
+ .button-primary {
97
+ width: fit-content;
98
+ }
99
+
100
+ .button-secundary {
101
+ width: fit-content;
102
+ }
103
+
104
+ .button-primary-disabled {
105
+ width: fit-content;
106
+ }
107
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@charlesgomes/leafcode-shared-lib-react",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "Lib de componentes react",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -11,7 +11,8 @@
11
11
  "import": "./dist/index.mjs",
12
12
  "require": "./dist/index.cjs"
13
13
  },
14
- "./table.css": "./dist/styles/table.css"
14
+ "./table.css": "./dist/styles/table.css",
15
+ "./button.css": "./dist/styles/button.css"
15
16
  },
16
17
  "files": [
17
18
  "dist"
@@ -31,14 +32,14 @@
31
32
  "access": "public"
32
33
  },
33
34
  "peerDependencies": {
34
- "primereact": "^10.9.7",
35
35
  "@tanstack/react-query": "^5.85.9",
36
+ "primereact": "^10.9.7",
36
37
  "react": ">=17",
37
38
  "react-dom": ">=17"
38
39
  },
39
40
  "devDependencies": {
40
- "@tanstack/react-query": "^5.85.9",
41
41
  "@tailwindcss/postcss": "^4.1.12",
42
+ "@tanstack/react-query": "^5.85.9",
42
43
  "@types/react": "^19.1.12",
43
44
  "@types/react-dom": "^19.1.9",
44
45
  "@vitejs/plugin-react": "^5.0.2",
@@ -51,9 +52,11 @@
51
52
  "dependencies": {
52
53
  "@phosphor-icons/react": "^2.1.10",
53
54
  "clsx": "^2.1.1",
55
+ "primereact": "^10.9.7",
56
+ "react": "^19.1.1",
57
+ "react-dom": "^19.1.1",
54
58
  "react-select": "^5.10.2",
55
59
  "react-tooltip": "^5.29.1",
56
- "tailwind-merge": "^3.3.1",
57
- "primereact": "^10.9.7"
60
+ "tailwind-merge": "^3.3.1"
58
61
  }
59
62
  }