@situaction/traq-ui-ste 1.2.29 → 1.2.30

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.
@@ -4,8 +4,12 @@ import { Color, Size } from '../interface';
4
4
  export interface TagProps {
5
5
  /** The text label for the tag. This will be displayed if provided. */
6
6
  label?: string;
7
- /** The color of the tag, must be one of the defined valid colors. */
7
+ /** The design-system color name (uses --color-<name>-* tokens). */
8
8
  color?: Color;
9
+ /** Custom background color (hex/rgb/hsl/var(...)). Overrides `color` if provided. */
10
+ backgroundColor?: string;
11
+ /** Custom text color (hex/rgb/hsl/var(...)). If omitted, a default is used. */
12
+ textColor?: string;
9
13
  /** Indicates if the tag can be deleted; when true, a delete icon is shown. */
10
14
  deletable?: boolean;
11
15
  /** The size of the tag, which affects its styling. */
@@ -15,8 +19,4 @@ export interface TagProps {
15
19
  /** A callback function to be called when the tag is clicked. */
16
20
  onClick?: () => void;
17
21
  }
18
- /**
19
- * Tag component to display a label with customizable color, size, and content.
20
- * It can also display a delete icon if `deletable` is true.
21
- */
22
22
  export declare const Tag: FC<TagProps>;
@@ -1,67 +1,76 @@
1
- import { jsxs as g, jsx as a } from "react/jsx-runtime";
2
- import { useEffect as c } from "react";
3
- import '../../styles/Tag.css';const d = "_tag_qjzpb_6", u = "_icon_qjzpb_15", b = "_label_qjzpb_70", p = "_flexHorizontalCenter_qjzpb_74", x = "_flexHorizontal_qjzpb_74", t = {
4
- tag: d,
5
- icon: u,
6
- "tag-children": "_tag-children_qjzpb_20",
7
- "tag-size-xl": "_tag-size-xl_qjzpb_30",
8
- "tag-size-xl-round": "_tag-size-xl-round_qjzpb_34",
9
- "tag-size-l": "_tag-size-l_qjzpb_40",
10
- "tag-size-l-round": "_tag-size-l-round_qjzpb_44",
11
- "tag-size-m": "_tag-size-m_qjzpb_50",
12
- "tag-size-m-round": "_tag-size-m-round_qjzpb_54",
13
- "tag-size-s": "_tag-size-s_qjzpb_60",
14
- "tag-size-s-round": "_tag-size-s-round_qjzpb_64",
15
- label: b,
16
- flexHorizontalCenter: p,
17
- flexHorizontal: x
18
- }, s = ["light", "dark", "gray", "blue-gray", "blue", "blue-situaction", "purple", "pink", "gold", "brown", "emerald"], f = ({
19
- label: n,
20
- color: e,
21
- deletable: r = !1,
22
- size: o = "m",
23
- children: i,
24
- onClick: l
1
+ import { jsxs as z, jsx as e } from "react/jsx-runtime";
2
+ import { useMemo as b } from "react";
3
+ import '../../styles/Tag.css';const u = "_tag_1k5bo_6", m = "_icon_1k5bo_15", x = "_label_1k5bo_74", f = "_flexHorizontalCenter_1k5bo_78", k = "_flexHorizontal_1k5bo_78", t = {
4
+ tag: u,
5
+ icon: m,
6
+ "tag-children": "_tag-children_1k5bo_24",
7
+ "tag-size-xl": "_tag-size-xl_1k5bo_34",
8
+ "tag-size-xl-round": "_tag-size-xl-round_1k5bo_38",
9
+ "tag-size-l": "_tag-size-l_1k5bo_44",
10
+ "tag-size-l-round": "_tag-size-l-round_1k5bo_48",
11
+ "tag-size-m": "_tag-size-m_1k5bo_54",
12
+ "tag-size-m-round": "_tag-size-m-round_1k5bo_58",
13
+ "tag-size-s": "_tag-size-s_1k5bo_64",
14
+ "tag-size-s-round": "_tag-size-s-round_1k5bo_68",
15
+ label: x,
16
+ flexHorizontalCenter: f,
17
+ flexHorizontal: k
18
+ }, h = [
19
+ "light",
20
+ "dark",
21
+ "gray",
22
+ "blue-gray",
23
+ "blue",
24
+ "blue-situaction",
25
+ "purple",
26
+ "pink",
27
+ "gold",
28
+ "brown",
29
+ "emerald"
30
+ ], p = "blue-situaction", H = ({
31
+ label: s,
32
+ color: o,
33
+ backgroundColor: l,
34
+ textColor: r,
35
+ deletable: g = !1,
36
+ size: _ = "m",
37
+ children: n,
38
+ onClick: i
25
39
  }) => {
26
- c(() => {
27
- e && !s.includes(e) && console.warn(`Warning: The color "${e}" is not a valid option. Expected one of: ${s.join(", ")}.`);
28
- }, [e]);
29
- const _ = [
40
+ const c = [
30
41
  t.tag,
31
- i && !n && t[`tag-size-${o}-round`],
32
- t[`tag-size-${o}`],
42
+ n && !s ? t[`tag-size-${_}-round`] : "",
43
+ t[`tag-size-${_}`],
33
44
  t.flexHorizontalCenter
34
- ].join(" "), z = {
35
- "--dynamic-background": e && s.includes(e) ? `var(--color-${e}-200)` : "var(--color-blue-situaction-200)",
36
- "--dynamic-color-text": e && s.includes(e) ? `var(--color-${e}-950)` : "var(--color-blue-situaction-950)"
37
- };
38
- return /* @__PURE__ */ g(
39
- "div",
40
- {
41
- className: _,
42
- style: z,
43
- children: [
44
- i && /* @__PURE__ */ a("div", { className: `${t.flexHorizontalCenter} ${t["tag-children"]}`, children: i }),
45
- n && /* @__PURE__ */ a("label", { className: `${t.flexHorizontal} ${t.label}`, children: n }),
46
- r && /* @__PURE__ */ a("div", { className: t.icon, onClick: () => l == null ? void 0 : l(), children: /* @__PURE__ */ a(
47
- "svg",
48
- {
49
- xmlns: "http://www.w3.org/2000/svg",
50
- width: "10",
51
- height: "10",
52
- viewBox: "0 0 256 256",
53
- children: /* @__PURE__ */ a(
54
- "path",
55
- {
56
- d: "M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"
57
- }
58
- )
59
- }
60
- ) })
61
- ]
62
- }
63
- );
45
+ ].filter(Boolean).join(" "), d = b(() => {
46
+ if (l)
47
+ return {
48
+ "--dynamic-background": l,
49
+ "--dynamic-color-text": r ?? "var(--color-blue-situaction-950)"
50
+ };
51
+ const a = o && h.includes(o) ? o : p;
52
+ return {
53
+ "--dynamic-background": `var(--color-${a}-200)`,
54
+ "--dynamic-color-text": `var(--color-${a}-950)`
55
+ };
56
+ }, [l, r, o]);
57
+ return /* @__PURE__ */ z("div", { className: c, style: d, children: [
58
+ n && /* @__PURE__ */ e("div", { className: `${t.flexHorizontalCenter} ${t["tag-children"]}`, children: n }),
59
+ s && /* @__PURE__ */ e("label", { className: `${t.flexHorizontal} ${t.label}`, children: s }),
60
+ g && /* @__PURE__ */ e(
61
+ "div",
62
+ {
63
+ className: t.icon,
64
+ onClick: (a) => {
65
+ a.stopPropagation(), i == null || i();
66
+ },
67
+ role: "button",
68
+ "aria-label": "Delete tag",
69
+ children: /* @__PURE__ */ e("svg", { xmlns: "http://www.w3.org/2000/svg", width: "10", height: "10", viewBox: "0 0 256 256", children: /* @__PURE__ */ e("path", { d: "M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z" }) })
70
+ }
71
+ )
72
+ ] });
64
73
  };
65
74
  export {
66
- f as Tag
75
+ H as Tag
67
76
  };
@@ -1 +1 @@
1
- ._tag_qjzpb_6{color:var(--dynamic-color-text);background-color:var(--dynamic-background);border-radius:50px;line-height:normal;gap:.25rem;font-weight:600;letter-spacing:.84px}._tag_qjzpb_6 ._icon_qjzpb_15{display:flex;cursor:pointer;fill:var(--dynamic-color-text)!important}._tag-children_qjzpb_20{color:var(--dynamic-color-text);border-radius:50px;min-width:16px;min-height:16px;aspect-ratio:1/1}._tag-size-xl_qjzpb_30{padding:.5rem .75rem;font-size:1.125em}._tag-size-xl-round_qjzpb_34{padding:.5rem;min-width:12px;min-height:12px;aspect-ratio:1/1}._tag-size-l_qjzpb_40{padding:.375rem .625rem;font-size:1em}._tag-size-l-round_qjzpb_44{padding:.375rem;min-width:12px;min-height:12px;aspect-ratio:1/1}._tag-size-m_qjzpb_50{padding:.25rem .5rem;font-size:.875em}._tag-size-m-round_qjzpb_54{padding:.25rem;min-width:12px;min-height:12px;aspect-ratio:1/1}._tag-size-s_qjzpb_60{padding:.1875rem .5rem;font-size:.75em}._tag-size-s-round_qjzpb_64{padding:.125rem;min-width:12px;min-height:12px;aspect-ratio:1/1}._tag_qjzpb_6 ._label_qjzpb_70{white-space:nowrap}._flexHorizontalCenter_qjzpb_74{display:flex;justify-content:center;align-items:center;flex-direction:row}._flexHorizontal_qjzpb_74{display:flex;justify-content:flex-start;align-items:center;flex-direction:row}
1
+ ._tag_1k5bo_6{color:var(--dynamic-color-text);background-color:var(--dynamic-background);border-radius:50px;line-height:normal;gap:.25rem;font-weight:600;letter-spacing:.84px}._tag_1k5bo_6 ._icon_1k5bo_15{display:flex;cursor:pointer;fill:var(--dynamic-color-text)!important}._tag_1k5bo_6 ._icon_1k5bo_15 svg,._tag_1k5bo_6 ._icon_1k5bo_15 svg path{fill:var(--dynamic-color-text)!important}._tag-children_1k5bo_24{color:var(--dynamic-color-text);border-radius:50px;min-width:16px;min-height:16px;aspect-ratio:1/1}._tag-size-xl_1k5bo_34{padding:.5rem .75rem;font-size:1.125em}._tag-size-xl-round_1k5bo_38{padding:.5rem;min-width:12px;min-height:12px;aspect-ratio:1/1}._tag-size-l_1k5bo_44{padding:.375rem .625rem;font-size:1em}._tag-size-l-round_1k5bo_48{padding:.375rem;min-width:12px;min-height:12px;aspect-ratio:1/1}._tag-size-m_1k5bo_54{padding:.25rem .5rem;font-size:.875em}._tag-size-m-round_1k5bo_58{padding:.25rem;min-width:12px;min-height:12px;aspect-ratio:1/1}._tag-size-s_1k5bo_64{padding:.1875rem .5rem;font-size:.75em}._tag-size-s-round_1k5bo_68{padding:.125rem;min-width:12px;min-height:12px;aspect-ratio:1/1}._tag_1k5bo_6 ._label_1k5bo_74{white-space:nowrap}._flexHorizontalCenter_1k5bo_78{display:flex;justify-content:center;align-items:center;flex-direction:row}._flexHorizontal_1k5bo_78{display:flex;justify-content:flex-start;align-items:center;flex-direction:row}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@situaction/traq-ui-ste",
3
- "version": "1.2.29",
3
+ "version": "1.2.30",
4
4
  "description": "library react component Situaction",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",