@gustavo-valsechi/client 1.4.318 → 1.4.320

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.
@@ -37,7 +37,13 @@ var import_jsx_runtime = require("react/jsx-runtime");
37
37
  var import_styles = require("./styles");
38
38
  var import_lodash = __toESM(require("lodash"));
39
39
  function Badge(props) {
40
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.Container, { color: props.color || "t3", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "content", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: import_lodash.default.lowerCase(props.value) }) }) });
40
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.Container, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "badge-container", children: [
41
+ (!!props.icon || !!props.img) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "badge-identifier", children: [
42
+ !!props.icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { "aria-hidden": true, className: props.icon }),
43
+ !props.icon && !!props.img && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "badge-image" })
44
+ ] }),
45
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: import_lodash.default.lowerCase(props.value) })
46
+ ] }) });
41
47
  }
42
48
  // Annotate the CommonJS export names for ESM import in node:
43
49
  0 && (module.exports = {
@@ -1,10 +1,16 @@
1
1
  "use client";
2
2
  "use client";
3
- import { jsx } from "react/jsx-runtime";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
4
  import { Container } from "./styles";
5
5
  import _ from "lodash";
6
6
  function Badge(props) {
7
- return /* @__PURE__ */ jsx(Container, { color: props.color || "t3", children: /* @__PURE__ */ jsx("div", { className: "content", children: /* @__PURE__ */ jsx("div", { children: _.lowerCase(props.value) }) }) });
7
+ return /* @__PURE__ */ jsx(Container, { ...props, children: /* @__PURE__ */ jsxs("div", { className: "badge-container", children: [
8
+ (!!props.icon || !!props.img) && /* @__PURE__ */ jsxs("div", { className: "badge-identifier", children: [
9
+ !!props.icon && /* @__PURE__ */ jsx("i", { "aria-hidden": true, className: props.icon }),
10
+ !props.icon && !!props.img && /* @__PURE__ */ jsx("div", { className: "badge-image" })
11
+ ] }),
12
+ /* @__PURE__ */ jsx("span", { children: _.lowerCase(props.value) })
13
+ ] }) });
8
14
  }
9
15
  export {
10
16
  Badge
@@ -35,35 +35,60 @@ __export(styles_exports, {
35
35
  module.exports = __toCommonJS(styles_exports);
36
36
  var import_styled_components = __toESM(require("styled-components"));
37
37
  const Container = import_styled_components.default.div`
38
- .content {
39
- display: inline-flex;
40
- align-items: center;
41
- justify-content: center;
42
- height: 1.8rem;
43
- padding: 0 2rem;
44
- position: relative;
45
-
46
- div {
47
- position: relative;
48
- z-index: 1;
49
- color: ${({ theme, color }) => theme[color]};
50
- font-size: .8rem;
51
- font-weight: 500;
52
- text-transform: capitalize;
38
+ .badge-container {
39
+ display: inline-flex;
40
+ align-items: center;
41
+ justify-content: center;
42
+ height: 1.8rem;
43
+ padding: ${(props) => props.icon || props.img ? "0 .8rem 0 .3rem" : "0 .8rem"};
44
+ position: relative;
45
+ gap: .7rem;
46
+
47
+ .badge-identifier {
48
+ width: 1.3rem;
49
+ height: 1.3rem;
50
+ border-radius: 5px;
51
+ background: ${(props) => props.theme.t05};
52
+ display: flex;
53
+ align-items: center;
54
+ justify-content: center;
55
+
56
+ i {
57
+ font-size: .7rem;
58
+ color: ${({ theme, textColor = "t6", color }) => theme[color || textColor]};
59
+ }
60
+
61
+ .badge-image {
62
+ width: .8rem;
63
+ height: .8rem;
64
+ background-image: url(${(props) => props.img});
65
+ background-size: contain;
66
+ background-repeat: no-repeat;
67
+ background-position: center;
68
+ }
69
+ }
70
+
71
+ span {
72
+ position: relative;
73
+ z-index: 1;
74
+ color: ${({ theme, textColor = "t6", color }) => theme[color || textColor]};
75
+ font-size: .8rem;
76
+ font-weight: 500;
77
+ text-transform: capitalize;
78
+ }
79
+
80
+ &:before {
81
+ content: "";
82
+ position: absolute;
83
+ top: 0;
84
+ left: 0;
85
+ width: 100%;
86
+ height: 100%;
87
+ border-radius: 5px;
88
+ background: ${({ theme, backgroundColor = "t2", color }) => theme[color || backgroundColor]};
89
+ opacity: .2;
90
+ }
53
91
  }
54
-
55
- &:before {
56
- content: "";
57
- position: absolute;
58
- top: 0;
59
- left: 0;
60
- width: 100%;
61
- height: 100%;
62
- border-radius: 5px;
63
- background: ${({ theme, color }) => theme[color]};
64
- opacity: .2;
65
- }
66
- }
67
92
  `;
68
93
  // Annotate the CommonJS export names for ESM import in node:
69
94
  0 && (module.exports = {
@@ -2,35 +2,60 @@
2
2
  "use client";
3
3
  import styled from "styled-components";
4
4
  const Container = styled.div`
5
- .content {
6
- display: inline-flex;
7
- align-items: center;
8
- justify-content: center;
9
- height: 1.8rem;
10
- padding: 0 2rem;
11
- position: relative;
12
-
13
- div {
14
- position: relative;
15
- z-index: 1;
16
- color: ${({ theme, color }) => theme[color]};
17
- font-size: .8rem;
18
- font-weight: 500;
19
- text-transform: capitalize;
5
+ .badge-container {
6
+ display: inline-flex;
7
+ align-items: center;
8
+ justify-content: center;
9
+ height: 1.8rem;
10
+ padding: ${(props) => props.icon || props.img ? "0 .8rem 0 .3rem" : "0 .8rem"};
11
+ position: relative;
12
+ gap: .7rem;
13
+
14
+ .badge-identifier {
15
+ width: 1.3rem;
16
+ height: 1.3rem;
17
+ border-radius: 5px;
18
+ background: ${(props) => props.theme.t05};
19
+ display: flex;
20
+ align-items: center;
21
+ justify-content: center;
22
+
23
+ i {
24
+ font-size: .7rem;
25
+ color: ${({ theme, textColor = "t6", color }) => theme[color || textColor]};
26
+ }
27
+
28
+ .badge-image {
29
+ width: .8rem;
30
+ height: .8rem;
31
+ background-image: url(${(props) => props.img});
32
+ background-size: contain;
33
+ background-repeat: no-repeat;
34
+ background-position: center;
35
+ }
36
+ }
37
+
38
+ span {
39
+ position: relative;
40
+ z-index: 1;
41
+ color: ${({ theme, textColor = "t6", color }) => theme[color || textColor]};
42
+ font-size: .8rem;
43
+ font-weight: 500;
44
+ text-transform: capitalize;
45
+ }
46
+
47
+ &:before {
48
+ content: "";
49
+ position: absolute;
50
+ top: 0;
51
+ left: 0;
52
+ width: 100%;
53
+ height: 100%;
54
+ border-radius: 5px;
55
+ background: ${({ theme, backgroundColor = "t2", color }) => theme[color || backgroundColor]};
56
+ opacity: .2;
57
+ }
20
58
  }
21
-
22
- &:before {
23
- content: "";
24
- position: absolute;
25
- top: 0;
26
- left: 0;
27
- width: 100%;
28
- height: 100%;
29
- border-radius: 5px;
30
- background: ${({ theme, color }) => theme[color]};
31
- opacity: .2;
32
- }
33
- }
34
59
  `;
35
60
  export {
36
61
  Container
@@ -65,17 +65,20 @@ function Table(props) {
65
65
  modal.setProps("table", { content });
66
66
  };
67
67
  const renderRowContainer = (data, option) => {
68
- var _a2, _b2, _c2, _d2, _e2, _f2, _g;
68
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i;
69
+ const style = import_lodash.default.isFunction((_a2 = option.row) == null ? void 0 : _a2.style) ? option.row.style(data, option) : (_b2 = option.row) == null ? void 0 : _b2.style;
70
+ const color = import_lodash.default.isFunction((_c2 = option.row) == null ? void 0 : _c2.color) ? option.row.color(data, option) : (_d2 = option.row) == null ? void 0 : _d2.color;
71
+ if (color) style.color = theme.content[color] || color;
69
72
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
70
73
  "div",
71
74
  {
72
75
  className: `
73
76
  table-content item
74
- ${((_a2 = option.row) == null ? void 0 : _a2.actions) ? "table-action" : ""}
75
- ${((_b2 = option.row) == null ? void 0 : _b2.icon) ? "table-identifier" : ""}
77
+ ${((_e2 = option.row) == null ? void 0 : _e2.actions) ? "table-action" : ""}
78
+ ${((_f2 = option.row) == null ? void 0 : _f2.icon) ? "table-identifier" : ""}
76
79
  `,
77
- style: import_lodash.default.isFunction((_c2 = option.row) == null ? void 0 : _c2.style) ? option.row.style(data, option) : (_d2 = option.row) == null ? void 0 : _d2.style,
78
- "data-tooltip": !((_e2 = option.row) == null ? void 0 : _e2.actions) ? import_lodash.default.isFunction((_f2 = option.row) == null ? void 0 : _f2.info) ? option.row.info(data, option) : (_g = option.row) == null ? void 0 : _g.info : "",
80
+ style,
81
+ "data-tooltip": !((_g = option.row) == null ? void 0 : _g.actions) ? import_lodash.default.isFunction((_h = option.row) == null ? void 0 : _h.info) ? option.row.info(data, option) : (_i = option.row) == null ? void 0 : _i.info : "",
79
82
  "data-tooltip-props": '{"position":"bottom"}',
80
83
  children: renderRowContent(data, option)
81
84
  }
@@ -31,17 +31,20 @@ function Table(props) {
31
31
  modal.setProps("table", { content });
32
32
  };
33
33
  const renderRowContainer = (data, option) => {
34
- var _a2, _b2, _c2, _d2, _e2, _f2, _g;
34
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i;
35
+ const style = _.isFunction((_a2 = option.row) == null ? void 0 : _a2.style) ? option.row.style(data, option) : (_b2 = option.row) == null ? void 0 : _b2.style;
36
+ const color = _.isFunction((_c2 = option.row) == null ? void 0 : _c2.color) ? option.row.color(data, option) : (_d2 = option.row) == null ? void 0 : _d2.color;
37
+ if (color) style.color = theme.content[color] || color;
35
38
  return /* @__PURE__ */ jsx(
36
39
  "div",
37
40
  {
38
41
  className: `
39
42
  table-content item
40
- ${((_a2 = option.row) == null ? void 0 : _a2.actions) ? "table-action" : ""}
41
- ${((_b2 = option.row) == null ? void 0 : _b2.icon) ? "table-identifier" : ""}
43
+ ${((_e2 = option.row) == null ? void 0 : _e2.actions) ? "table-action" : ""}
44
+ ${((_f2 = option.row) == null ? void 0 : _f2.icon) ? "table-identifier" : ""}
42
45
  `,
43
- style: _.isFunction((_c2 = option.row) == null ? void 0 : _c2.style) ? option.row.style(data, option) : (_d2 = option.row) == null ? void 0 : _d2.style,
44
- "data-tooltip": !((_e2 = option.row) == null ? void 0 : _e2.actions) ? _.isFunction((_f2 = option.row) == null ? void 0 : _f2.info) ? option.row.info(data, option) : (_g = option.row) == null ? void 0 : _g.info : "",
46
+ style,
47
+ "data-tooltip": !((_g = option.row) == null ? void 0 : _g.actions) ? _.isFunction((_h = option.row) == null ? void 0 : _h.info) ? option.row.info(data, option) : (_i = option.row) == null ? void 0 : _i.info : "",
45
48
  "data-tooltip-props": '{"position":"bottom"}',
46
49
  children: renderRowContent(data, option)
47
50
  }
@@ -1,5 +1,9 @@
1
1
  import { IThemeContent } from "../../contexts";
2
2
  export interface IBadge {
3
3
  value: string;
4
+ icon?: string;
5
+ img?: string;
4
6
  color?: keyof IThemeContent;
7
+ backgroundColor?: keyof IThemeContent;
8
+ textColor?: keyof IThemeContent;
5
9
  }
@@ -17,6 +17,7 @@ export interface ITableRow {
17
17
  image?: any;
18
18
  icon?: any;
19
19
  style?: any;
20
+ color?: any;
20
21
  mask?: any;
21
22
  custom?: (data: any) => React.ReactNode;
22
23
  name?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/client",
3
- "version": "1.4.318",
3
+ "version": "1.4.320",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",