@situaction/traq-ui-ste 1.1.5 → 1.1.7

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.
@@ -0,0 +1,26 @@
1
+ import { FC, ReactNode } from 'react';
2
+
3
+ export interface AccordionProps {
4
+ /** An array of accordion items, each containing a header, content, and optional settings. */
5
+ items: {
6
+ /** The header content of the accordion item. */
7
+ header: ReactNode;
8
+ /** Defines the position of the icon, either on the left or right of the header. */
9
+ iconPosition?: "left" | "right";
10
+ /** Determines whether the accordion item should be open by default (true) or closed (false). */
11
+ defaultOpen?: boolean;
12
+ /** The content displayed when the accordion item is expanded. */
13
+ content: ReactNode;
14
+ }[];
15
+ /** Accordion style if block type the header and the content are in the same block, if it is tile they are separated into 2 blocks */
16
+ type?: 'block' | 'tile';
17
+ }
18
+ /**
19
+ * Accordion component that displays a list of AccordionItem components.
20
+ * Each AccordionItem can be expanded or collapsed.
21
+ * The Accordion takes an array of items to render each item with its header and content.
22
+ *
23
+ * @param {AccordionProps} props - The props for the Accordion component.
24
+ * @returns {JSX.Element} The rendered Accordion component.
25
+ */
26
+ export declare const Accordion: FC<AccordionProps>;
@@ -0,0 +1,18 @@
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import { AccordionItem as i } from "./item/AccordionItem.js";
3
+ import '../../styles/Accordion.css';const t = "_accordion_avh0n_6", a = {
4
+ accordion: t
5
+ }, l = ({ items: n, type: r = "block" }) => /* @__PURE__ */ c("div", { className: a.accordion, children: n.map((o, e) => /* @__PURE__ */ c(
6
+ i,
7
+ {
8
+ header: o.header,
9
+ iconPosition: o.iconPosition ?? "right",
10
+ defaultOpen: o.defaultOpen ?? !1,
11
+ type: r ?? "block",
12
+ children: o.content
13
+ },
14
+ e
15
+ )) });
16
+ export {
17
+ l as Accordion
18
+ };
@@ -0,0 +1,25 @@
1
+ import { FC, ReactNode } from 'react';
2
+
3
+ interface AccordionItemProps {
4
+ /** The header content of the accordion item. */
5
+ header: ReactNode;
6
+ /** The content displayed when the accordion is expanded. */
7
+ children: ReactNode;
8
+ /** Defines the position of the icon, either on the left or right of the header. */
9
+ iconPosition?: "left" | "right";
10
+ /** Determines whether the accordion should be open by default (true) or closed (false). */
11
+ defaultOpen?: boolean;
12
+ /** Accordion style if block type the header and the content are in the same block, if it is tile they are separated into 2 blocks */
13
+ type?: 'block' | 'tile';
14
+ }
15
+ /**
16
+ * AccordionItem component represents an individual item in an accordion.
17
+ * It can be opened and closed, showing or hiding its content.
18
+ * The icon can be positioned either to the left or right of the header.
19
+ * The item can also be set to be open by default.
20
+ *
21
+ * @param {AccordionItemProps} props - The props for the AccordionItem component.
22
+ * @returns {JSX.Element} The rendered AccordionItem component.
23
+ */
24
+ export declare const AccordionItem: FC<AccordionItemProps>;
25
+ export {};
@@ -0,0 +1,48 @@
1
+ import { jsxs as s, jsx as t } from "react/jsx-runtime";
2
+ import { useState as d, useEffect as w } from "react";
3
+ import { IconButton as n } from "../../icon-button/IconButton.js";
4
+ import '../../../styles/AccordionItem.css';const g = "_accordionHeader_e4xbv_7", v = "_title_e4xbv_16", _ = "_accordionContent_e4xbv_21", m = "_fullHeight_e4xbv_26", x = "_block_e4xbv_30", f = "_tile_e4xbv_38", l = {
5
+ accordionHeader: g,
6
+ title: v,
7
+ accordionContent: _,
8
+ fullHeight: m,
9
+ block: x,
10
+ tile: f
11
+ }, H = ({
12
+ header: r,
13
+ children: h,
14
+ iconPosition: c = "right",
15
+ defaultOpen: i = !1,
16
+ type: a = "block"
17
+ }) => {
18
+ const [e, o] = d(!1);
19
+ return w(() => {
20
+ i && o(i);
21
+ }, [i]), /* @__PURE__ */ s("div", { className: `${a === "tile" ? l.tile : l.block}`, children: [
22
+ /* @__PURE__ */ s("div", { className: l.accordionHeader, children: [
23
+ c === "left" && /* @__PURE__ */ t(
24
+ n,
25
+ {
26
+ mode: "ghost",
27
+ size: "s",
28
+ onClick: () => o(!e),
29
+ children: e ? /* @__PURE__ */ t("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "#000000", viewBox: "0 0 256 256", children: /* @__PURE__ */ t("path", { d: "M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z" }) }) : /* @__PURE__ */ t("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "#000000", viewBox: "0 0 256 256", children: /* @__PURE__ */ t("path", { d: "M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z" }) })
30
+ }
31
+ ),
32
+ /* @__PURE__ */ t("div", { className: l.title, children: r }),
33
+ c === "right" && /* @__PURE__ */ t(
34
+ n,
35
+ {
36
+ mode: "ghost",
37
+ size: "s",
38
+ onClick: () => o(!e),
39
+ children: e ? /* @__PURE__ */ t("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "#000000", viewBox: "0 0 256 256", children: /* @__PURE__ */ t("path", { d: "M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z" }) }) : /* @__PURE__ */ t("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "#000000", viewBox: "0 0 256 256", children: /* @__PURE__ */ t("path", { d: "M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z" }) })
40
+ }
41
+ )
42
+ ] }),
43
+ e && /* @__PURE__ */ t("div", { className: l.accordionContent, children: h })
44
+ ] });
45
+ };
46
+ export {
47
+ H as AccordionItem
48
+ };
@@ -0,0 +1,6 @@
1
+ import { FC, ReactNode } from 'react';
2
+
3
+ export interface CardProps {
4
+ children: ReactNode;
5
+ }
6
+ export declare const Card: FC<CardProps>;
@@ -0,0 +1,7 @@
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import '../../styles/Card.css';const s = "_card_12xhq_6", a = {
3
+ card: s
4
+ }, d = ({ children: r }) => /* @__PURE__ */ c("div", { className: a.card, children: r });
5
+ export {
6
+ d as Card
7
+ };
@@ -1,49 +1,44 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
- import { useState as d, useEffect as a } from "react";
3
- import '../../styles/Checkbox.css';const n = "_checkbox_owci7_23", w = "_checked_owci7_31", r = "_disabled_owci7_37", c = {
2
+ import { useState as d, useEffect as m } from "react";
3
+ import '../../styles/Checkbox.css';const n = "_checkbox_10m2o_23", a = "_checked_10m2o_30", r = "_disabled_10m2o_36", e = {
4
4
  checkbox: n,
5
- checked: w,
5
+ checked: a,
6
6
  disabled: r,
7
- "checkbox-size-xs": "_checkbox-size-xs_owci7_45",
8
- "checkbox-size-s": "_checkbox-size-s_owci7_50",
9
- "checkbox-size-m": "_checkbox-size-m_owci7_55",
10
- "checkbox-size-l": "_checkbox-size-l_owci7_60",
11
- "checkbox-size-xl": "_checkbox-size-xl_owci7_65"
12
- }, f = ({
13
- checked: e = !1,
14
- icon: x = /* @__PURE__ */ o("svg", { xmlns: "http://www.w3.org/2000/svg", width: "32", height: "32", viewBox: "0 0 256 256", children: /* @__PURE__ */ o(
15
- "path",
16
- {
17
- d: "M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"
18
- }
19
- ) }),
20
- size: k = "m",
21
- disabled: _ = !1,
7
+ "checkbox-size-xs": "_checkbox-size-xs_10m2o_44",
8
+ "checkbox-size-s": "_checkbox-size-s_10m2o_49",
9
+ "checkbox-size-m": "_checkbox-size-m_10m2o_54",
10
+ "checkbox-size-l": "_checkbox-size-l_10m2o_59",
11
+ "checkbox-size-xl": "_checkbox-size-xl_10m2o_64"
12
+ }, w = ({
13
+ checked: c = !1,
14
+ icon: x = /* @__PURE__ */ o("svg", { xmlns: "http://www.w3.org/2000/svg", width: "8", height: "8", viewBox: "0 0 8 8", fill: "none", children: /* @__PURE__ */ o("path", { d: "M2.66667 6.1L0.666667 4L0 4.7L2.66667 7.5L8 1.2L7.33333 0.5L2.66667 6.1Z", fill: "white" }) }),
15
+ size: l = "m",
16
+ disabled: k = !1,
22
17
  onChange: i
23
18
  }) => {
24
- const [s, h] = d(e);
25
- a(() => {
26
- h(e);
27
- }, [e]);
28
- const l = () => {
19
+ const [s, h] = d(c);
20
+ m(() => {
21
+ h(c);
22
+ }, [c]);
23
+ const _ = () => {
29
24
  const t = !s;
30
25
  h(t), i && i(t);
31
26
  }, b = [
32
- c.checkbox,
33
- c[`checkbox-size-${k}`],
34
- s && c.checked,
35
- _ && c.disabled
27
+ e.checkbox,
28
+ e[`checkbox-size-${l}`],
29
+ s && e.checked,
30
+ k && e.disabled
36
31
  ].filter(Boolean).join(" ");
37
32
  return /* @__PURE__ */ o(
38
33
  "div",
39
34
  {
40
35
  "data-testid": "checkbox",
41
36
  className: b,
42
- onClick: l,
37
+ onClick: _,
43
38
  children: s && x
44
39
  }
45
40
  );
46
41
  };
47
42
  export {
48
- f as Checkbox
43
+ w as Checkbox
49
44
  };
@@ -1,8 +1,8 @@
1
- import { jsxs as H, jsx as a } from "react/jsx-runtime";
2
- import { useState as d, useRef as s, useLayoutEffect as C } from "react";
3
- import { Button as $ } from "../button/Button.js";
4
- import { IconButton as B } from "../icon-button/IconButton.js";
5
- import '../../styles/Tabs.css';const N = "_underline_udv7v_50", n = {
1
+ import { jsxs as H, jsx as r } from "react/jsx-runtime";
2
+ import { useState as f, useRef as u, useLayoutEffect as C, useEffect as $ } from "react";
3
+ import { Button as B } from "../button/Button.js";
4
+ import { IconButton as N } from "../icon-button/IconButton.js";
5
+ import '../../styles/Tabs.css';const p = "_underline_udv7v_50", n = {
6
6
  "tab-container": "_tab-container_udv7v_23",
7
7
  "tab-container-button": "_tab-container-button_udv7v_27",
8
8
  "tab-container-icon": "_tab-container-icon_udv7v_32",
@@ -10,58 +10,61 @@ import '../../styles/Tabs.css';const N = "_underline_udv7v_50", n = {
10
10
  "tab-items": "_tab-items_udv7v_35",
11
11
  "tab-items-button": "_tab-items-button_udv7v_39",
12
12
  "selected-button": "_selected-button_udv7v_44",
13
- underline: N,
13
+ underline: p,
14
14
  "flexHorizontal-center": "_flexHorizontal-center_udv7v_58",
15
15
  "flexHorizontal-left": "_flexHorizontal-left_udv7v_64",
16
16
  "flexHorizontal-right": "_flexHorizontal-right_udv7v_70"
17
- }, w = ({ listItems: r, type: o, onTabSelect: _, defaultActiveTab: f = 0, position: v = "left" }) => {
18
- const [l, m] = d(f), [x, h] = d({}), c = s(null), g = s(null), u = s(new Array(r.length).fill(null)), b = (t) => {
19
- m(t), _(r[t]);
17
+ }, y = ({ listItems: c, type: o, onTabSelect: v, defaultActiveTab: a = 0, position: m = "left" }) => {
18
+ const [l, b] = f(a), [x, h] = f({}), i = u(null), g = u(null), _ = u(new Array(c.length).fill(null)), d = (t) => {
19
+ b(t), v(c[t]);
20
20
  }, z = (t) => {
21
- if (c.current && t) {
22
- const e = t.getBoundingClientRect(), i = c.current.getBoundingClientRect();
21
+ if (i.current && t) {
22
+ const e = t.getBoundingClientRect(), s = i.current.getBoundingClientRect();
23
23
  h({
24
- left: `${e.left - i.left}px`,
24
+ left: `${e.left - s.left}px`,
25
25
  width: `${e.width}px`
26
26
  });
27
27
  }
28
28
  }, R = [
29
- n[`flexHorizontal-${v}`],
29
+ n[`flexHorizontal-${m}`],
30
30
  o === "button" ? n["tab-items-button"] : n["tab-items"]
31
31
  ].filter(Boolean).join(" ");
32
32
  return C(() => {
33
- const t = u.current[l];
33
+ const t = _.current[l];
34
34
  t && z(t);
35
- }, [l]), /* @__PURE__ */ H("div", { className: `tab ${n["tab-container"]} ${n[`tab-container-${o}`]}`, ref: c, children: [
36
- /* @__PURE__ */ a("div", { className: R, children: r.map((t, e) => /* @__PURE__ */ a(
35
+ }, [l]), $(() => {
36
+ b(a);
37
+ }, [a]), /* @__PURE__ */ H("div", { className: `tab ${n["tab-container"]} ${n[`tab-container-${o}`]}`, ref: i, children: [
38
+ /* @__PURE__ */ r("div", { className: R, children: c.map((t, e) => /* @__PURE__ */ r(
37
39
  "div",
38
40
  {
39
- ref: (i) => u.current[e] = i,
41
+ ref: (s) => _.current[e] = s,
40
42
  className: o === "button" && e === l ? n["selected-button"] : "",
41
- children: o === "icon" ? /* @__PURE__ */ a(
42
- B,
43
+ children: o === "icon" ? /* @__PURE__ */ r(
44
+ N,
43
45
  {
44
46
  mode: "icon",
45
47
  size: "s",
46
48
  selected: e === l,
47
- onClick: () => b(e),
49
+ onClick: () => d(e),
48
50
  children: t
49
51
  }
50
- ) : /* @__PURE__ */ a(
51
- $,
52
+ ) : /* @__PURE__ */ r(
53
+ B,
52
54
  {
55
+ size: "s",
53
56
  label: t,
54
57
  mode: o === "text" ? "text" : "ghost",
55
58
  selected: e === l,
56
- onClick: () => b(e)
59
+ onClick: () => d(e)
57
60
  }
58
61
  )
59
62
  },
60
63
  e
61
64
  )) }),
62
- o !== "button" && /* @__PURE__ */ a("div", { ref: g, className: n.underline, style: x })
65
+ o !== "button" && /* @__PURE__ */ r("div", { ref: g, className: n.underline, style: x })
63
66
  ] });
64
67
  };
65
68
  export {
66
- w as Tabs
69
+ y as Tabs
67
70
  };
package/dist/main.d.ts CHANGED
@@ -10,4 +10,7 @@ export { Checkbox } from './components/checkbox/Checkbox.tsx';
10
10
  export { Tooltip } from './components/tooltip/Tooltip.tsx';
11
11
  export { Select } from './components/select/Select.tsx';
12
12
  export { Calendar } from './components/calendar/Calendar';
13
+ export { Accordion } from './components/accordion/Accordion';
14
+ export { AccordionItem } from './components/accordion/item/AccordionItem';
15
+ export { Card } from './components/card/Card';
13
16
  export { ThemeProvider, useTheme } from './components/theme/ThemeContext';
package/dist/main.js CHANGED
@@ -1,27 +1,33 @@
1
1
  import { Button as e } from "./components/button/Button.js";
2
2
  import { Input as m } from "./components/input/Input.js";
3
3
  import { Tabs as x } from "./components/tabs/Tabs.js";
4
- import { IconButton as T } from "./components/icon-button/IconButton.js";
5
- import { Tag as a } from "./components/tag/Tag.js";
6
- import { Title as l } from "./components/title/Title.js";
7
- import { TagCounter as h } from "./components/tag-counter/TagCounter.js";
4
+ import { IconButton as n } from "./components/icon-button/IconButton.js";
5
+ import { Tag as T } from "./components/tag/Tag.js";
6
+ import { Title as d } from "./components/title/Title.js";
7
+ import { TagCounter as u } from "./components/tag-counter/TagCounter.js";
8
8
  import { Checkbox as C } from "./components/checkbox/Checkbox.js";
9
- import { Tooltip as d } from "./components/tooltip/Tooltip.js";
10
- import { Select as s } from "./components/select/Select.js";
11
- import { Calendar as I } from "./components/calendar/Calendar.js";
12
- import { ThemeProvider as v, useTheme as P } from "./components/theme/ThemeContext.js";
9
+ import { Tooltip as I } from "./components/tooltip/Tooltip.js";
10
+ import { Select as g } from "./components/select/Select.js";
11
+ import { Calendar as A } from "./components/calendar/Calendar.js";
12
+ import { Accordion as k } from "./components/accordion/Accordion.js";
13
+ import { AccordionItem as P } from "./components/accordion/item/AccordionItem.js";
14
+ import { Card as j } from "./components/card/Card.js";
15
+ import { ThemeProvider as w, useTheme as y } from "./components/theme/ThemeContext.js";
13
16
  import './styles/main.css';export {
17
+ k as Accordion,
18
+ P as AccordionItem,
14
19
  e as Button,
15
- I as Calendar,
20
+ A as Calendar,
21
+ j as Card,
16
22
  C as Checkbox,
17
- T as IconButton,
23
+ n as IconButton,
18
24
  m as Input,
19
- s as Select,
25
+ g as Select,
20
26
  x as Tabs,
21
- a as Tag,
22
- h as TagCounter,
23
- v as ThemeProvider,
24
- l as Title,
25
- d as Tooltip,
26
- P as useTheme
27
+ T as Tag,
28
+ u as TagCounter,
29
+ w as ThemeProvider,
30
+ d as Title,
31
+ I as Tooltip,
32
+ y as useTheme
27
33
  };
@@ -0,0 +1 @@
1
+ ._accordion_avh0n_6{border-radius:.375rem;width:100%;overflow-y:auto;display:flex;justify-content:flex-start;align-items:stretch;flex-direction:column;gap:.625rem}
@@ -0,0 +1 @@
1
+ @charset "UTF-8";._accordionHeader_e4xbv_7{display:flex;align-items:center;justify-content:space-between;padding:.75rem;border-radius:.375rem;gap:.375rem}._title_e4xbv_16{flex-grow:1;text-align:left}._accordionContent_e4xbv_21{border-radius:0 0 .375rem .375rem;padding:0 .75rem .75rem}._fullHeight_e4xbv_26{height:100%}._block_e4xbv_30{border:1px solid var(--general-border-window);box-shadow:0 4px 5px 0 var(--shadow-color-minimal);background:var(--background-primary);border-radius:.375rem}._tile_e4xbv_38 ._accordionHeader_e4xbv_7{border-radius:.375rem;margin-bottom:.375rem;border:1px solid var(--general-border-window);background:var(--background-primary)}._tile_e4xbv_38 ._accordionContent_e4xbv_21{border-radius:.375rem;box-shadow:0 2px 4px #0000001a}
@@ -0,0 +1 @@
1
+ ._card_12xhq_6{border-radius:.375rem;padding:.75rem;border:1px solid var(--general-border-window)}
@@ -1 +1 @@
1
- ._checkbox_owci7_23{cursor:pointer;display:flex;align-items:center;justify-content:center;border:1px solid var(--checkbox-default-uncoched-default-stroke);padding:.125rem}._checkbox_owci7_23._checked_owci7_31{background-color:var(--checkbox-default-coched-default-background)}._checkbox_owci7_23._checked_owci7_31 *{fill:var(--checkbox-default-coched-default-coche)}._checkbox_owci7_23._disabled_owci7_37{border:1px solid var(--checkbox-disabled-uncoched-default-hover-stroke);pointer-events:none}._checkbox_owci7_23._disabled_owci7_37._checked_owci7_31{border:1px solid transparent;background-color:var(--checkbox-disabled-coched-default-hover-background)}._checkbox-size-xs_owci7_45{width:8px;height:8px;border-radius:.125rem}._checkbox-size-s_owci7_50{width:10px;height:10px;border-radius:.063rem}._checkbox-size-m_owci7_55{width:12px;height:12px;border-radius:.125rem}._checkbox-size-l_owci7_60{width:14px;height:14px;border-radius:.125rem}._checkbox-size-xl_owci7_65{width:16px;height:16px;border-radius:.125rem}
1
+ ._checkbox_10m2o_23{cursor:pointer;display:flex;align-items:center;justify-content:center;border:1px solid var(--checkbox-default-uncoched-default-stroke)}._checkbox_10m2o_23._checked_10m2o_30{background-color:var(--checkbox-default-coched-default-background)}._checkbox_10m2o_23._checked_10m2o_30 *{fill:var(--checkbox-default-coched-default-coche)}._checkbox_10m2o_23._disabled_10m2o_36{border:1px solid var(--checkbox-disabled-uncoched-default-hover-stroke);pointer-events:none}._checkbox_10m2o_23._disabled_10m2o_36._checked_10m2o_30{border:1px solid transparent;background-color:var(--checkbox-disabled-coched-default-hover-background)}._checkbox-size-xs_10m2o_44{width:8px;height:8px;border-radius:.125rem}._checkbox-size-s_10m2o_49{width:10px;height:10px;border-radius:.063rem}._checkbox-size-m_10m2o_54{width:12px;height:12px;border-radius:.125rem}._checkbox-size-l_10m2o_59{width:14px;height:14px;border-radius:.125rem}._checkbox-size-xl_10m2o_64{width:16px;height:16px;border-radius:.125rem}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@situaction/traq-ui-ste",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "description": "library react component Situaction",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",