@gustavo-valsechi/client 1.4.318 → 1.4.319

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.jsxs)(import_styles.Container, { ...props, 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__ */ jsxs(Container, { ...props, 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,58 @@ __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
38
  display: inline-flex;
40
39
  align-items: center;
41
40
  justify-content: center;
42
41
  height: 1.8rem;
43
- padding: 0 2rem;
42
+ padding: ${(props) => props.icon || props.img ? "0 .8rem 0 .3rem" : "0 .8rem"};
44
43
  position: relative;
44
+ gap: .7rem;
45
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;
46
+ .badge-identifier {
47
+ width: 1.3rem;
48
+ height: 1.3rem;
49
+ border-radius: 5px;
50
+ background: ${(props) => props.theme.t05};
51
+ display: flex;
52
+ align-items: center;
53
+ justify-content: center;
54
+
55
+ i {
56
+ font-size: .7rem;
57
+ color: ${({ theme, textColor = "t6", color }) => theme[color || textColor]};
58
+ }
59
+
60
+ .badge-image {
61
+ width: .8rem;
62
+ height: .8rem;
63
+ background-image: url(${(props) => props.img});
64
+ background-size: contain;
65
+ background-repeat: no-repeat;
66
+ background-position: center;
67
+ }
68
+ }
69
+
70
+ span {
71
+ position: relative;
72
+ z-index: 1;
73
+ color: ${({ theme, textColor = "t6", color }) => theme[color || textColor]};
74
+ font-size: .8rem;
75
+ font-weight: 500;
76
+ text-transform: capitalize;
53
77
  }
54
78
 
55
79
  &: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;
80
+ content: "";
81
+ position: absolute;
82
+ top: 0;
83
+ left: 0;
84
+ width: 100%;
85
+ height: 100%;
86
+ border-radius: 5px;
87
+ background: ${({ theme, backgroundColor = "t2", color }) => theme[color || backgroundColor]};
88
+ opacity: .2;
65
89
  }
66
- }
67
90
  `;
68
91
  // Annotate the CommonJS export names for ESM import in node:
69
92
  0 && (module.exports = {
@@ -2,35 +2,58 @@
2
2
  "use client";
3
3
  import styled from "styled-components";
4
4
  const Container = styled.div`
5
- .content {
6
5
  display: inline-flex;
7
6
  align-items: center;
8
7
  justify-content: center;
9
8
  height: 1.8rem;
10
- padding: 0 2rem;
9
+ padding: ${(props) => props.icon || props.img ? "0 .8rem 0 .3rem" : "0 .8rem"};
11
10
  position: relative;
11
+ gap: .7rem;
12
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;
13
+ .badge-identifier {
14
+ width: 1.3rem;
15
+ height: 1.3rem;
16
+ border-radius: 5px;
17
+ background: ${(props) => props.theme.t05};
18
+ display: flex;
19
+ align-items: center;
20
+ justify-content: center;
21
+
22
+ i {
23
+ font-size: .7rem;
24
+ color: ${({ theme, textColor = "t6", color }) => theme[color || textColor]};
25
+ }
26
+
27
+ .badge-image {
28
+ width: .8rem;
29
+ height: .8rem;
30
+ background-image: url(${(props) => props.img});
31
+ background-size: contain;
32
+ background-repeat: no-repeat;
33
+ background-position: center;
34
+ }
35
+ }
36
+
37
+ span {
38
+ position: relative;
39
+ z-index: 1;
40
+ color: ${({ theme, textColor = "t6", color }) => theme[color || textColor]};
41
+ font-size: .8rem;
42
+ font-weight: 500;
43
+ text-transform: capitalize;
20
44
  }
21
45
 
22
46
  &: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;
47
+ content: "";
48
+ position: absolute;
49
+ top: 0;
50
+ left: 0;
51
+ width: 100%;
52
+ height: 100%;
53
+ border-radius: 5px;
54
+ background: ${({ theme, backgroundColor = "t2", color }) => theme[color || backgroundColor]};
55
+ opacity: .2;
32
56
  }
33
- }
34
57
  `;
35
58
  export {
36
59
  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.319",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",