@coinloger/dev-ui 0.1.1 → 0.1.4

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.
Files changed (41) hide show
  1. package/dist/cjs/components/Badge/Badge.cjs +1 -1
  2. package/dist/cjs/components/Button/Button.cjs +1 -1
  3. package/dist/cjs/components/Card/Card.cjs +1 -1
  4. package/dist/cjs/components/Checkbox/Checkbox.cjs +1 -1
  5. package/dist/cjs/components/Container/Container.cjs +1 -1
  6. package/dist/cjs/components/Flex/Flex.cjs +1 -1
  7. package/dist/cjs/components/Flex/FlexItem.cjs +1 -1
  8. package/dist/cjs/components/Input/Input.cjs +1 -1
  9. package/dist/cjs/components/Modal/Modal.cjs +1 -1
  10. package/dist/cjs/components/Radio/Radio.cjs +1 -1
  11. package/dist/cjs/components/Select/Select.cjs +1 -1
  12. package/dist/cjs/components/Switch/Switch.cjs +1 -1
  13. package/dist/cjs/components/Table/Table.cjs +1 -1
  14. package/dist/cjs/components/Tabs/Tabs.cjs +1 -1
  15. package/dist/cjs/components/Typography/Heading.cjs +1 -1
  16. package/dist/cjs/components/Typography/Text.cjs +1 -1
  17. package/dist/cjs/dev-ui.css +1 -1
  18. package/dist/cjs/theme.cjs +1 -1
  19. package/dist/esm/components/Badge/Badge.js +14 -22
  20. package/dist/esm/components/Button/Button.js +12 -24
  21. package/dist/esm/components/Card/Card.js +10 -18
  22. package/dist/esm/components/Checkbox/Checkbox.js +17 -33
  23. package/dist/esm/components/Container/Container.js +11 -18
  24. package/dist/esm/components/Flex/Flex.js +26 -44
  25. package/dist/esm/components/Flex/FlexItem.js +24 -38
  26. package/dist/esm/components/Input/Input.js +16 -46
  27. package/dist/esm/components/Modal/Modal.d.ts +0 -35
  28. package/dist/esm/components/Modal/Modal.js +60 -83
  29. package/dist/esm/components/Radio/Radio.js +16 -32
  30. package/dist/esm/components/Select/Select.d.ts +1 -17
  31. package/dist/esm/components/Select/Select.js +62 -79
  32. package/dist/esm/components/Switch/Switch.js +18 -34
  33. package/dist/esm/components/Table/Table.js +13 -22
  34. package/dist/esm/components/Tabs/Tabs.d.ts +0 -25
  35. package/dist/esm/components/Tabs/Tabs.js +45 -70
  36. package/dist/esm/components/Typography/Heading.js +15 -25
  37. package/dist/esm/components/Typography/Text.js +19 -32
  38. package/dist/esm/dev-ui.css +1 -1
  39. package/dist/esm/theme.d.ts +0 -5
  40. package/dist/esm/theme.js +11 -16
  41. package/package.json +15 -5
@@ -1,52 +1,36 @@
1
- import { jsxs as p, jsx as o } from "react/jsx-runtime";
2
- import { forwardRef as t } from "react";
3
- import { clsx as c } from "clsx";
4
- import * as r from "prop-types";
1
+ import { jsxs as t, jsx as i } from "react/jsx-runtime";
2
+ import { forwardRef as p } from "react";
3
+ import { clsx as l } from "clsx";
5
4
  /* empty css */
6
- const e = t(
7
- ({ className: s, label: a, error: u, disabled: i, size: d = "md", variant: n = "primary", ...l }, m) => /* @__PURE__ */ p(
5
+ const u = p(
6
+ ({ className: o, label: a, error: c, disabled: r, size: s = "md", variant: d = "primary", ...e }, m) => /* @__PURE__ */ t(
8
7
  "label",
9
8
  {
10
- className: c(
9
+ className: l(
11
10
  "ui-radio-label",
11
+ `ui-radio-${s}`,
12
12
  `ui-radio-${d}`,
13
- `ui-radio-${n}`,
14
- i && "ui-radio-disabled",
15
- s
13
+ r && "ui-radio-disabled",
14
+ o
16
15
  ),
17
16
  children: [
18
- /* @__PURE__ */ o(
17
+ /* @__PURE__ */ i(
19
18
  "input",
20
19
  {
21
20
  type: "radio",
22
21
  className: "ui-radio-input",
23
- disabled: i,
22
+ disabled: r,
24
23
  ref: m,
25
- ...l
24
+ ...e
26
25
  }
27
26
  ),
28
- /* @__PURE__ */ o("span", { className: "ui-radio-custom", children: /* @__PURE__ */ o("span", { className: "ui-radio-dot" }) }),
29
- a && /* @__PURE__ */ o("span", { className: "ui-radio-text", children: a })
27
+ /* @__PURE__ */ i("span", { className: "ui-radio-custom", children: /* @__PURE__ */ i("span", { className: "ui-radio-dot" }) }),
28
+ a && /* @__PURE__ */ i("span", { className: "ui-radio-text", children: a })
30
29
  ]
31
30
  }
32
31
  )
33
32
  );
34
- e.displayName = "Radio";
35
- e.propTypes = {
36
- label: r.node,
37
- error: r.bool,
38
- size: r.oneOf(["sm", "md", "lg", "xl"]),
39
- variant: r.oneOf(["primary", "success", "warning", "danger"]),
40
- checked: r.bool,
41
- defaultChecked: r.bool,
42
- onChange: r.func,
43
- name: r.string,
44
- value: r.oneOfType([r.string, r.number]),
45
- disabled: r.bool,
46
- required: r.bool,
47
- id: r.string,
48
- className: r.string
49
- };
33
+ u.displayName = "Radio";
50
34
  export {
51
- e as Radio
35
+ u as Radio
52
36
  };
@@ -1,4 +1,4 @@
1
- import * as PropTypes from 'prop-types';
1
+
2
2
  export interface SelectOption {
3
3
  value: string | number;
4
4
  label: string;
@@ -57,20 +57,4 @@ export interface SelectProps {
57
57
  export declare const Select: {
58
58
  ({ options, value, onChange, placeholder, label, error, helperText, disabled, fullWidth, size, className, }: SelectProps): import("react/jsx-runtime").JSX.Element;
59
59
  displayName: string;
60
- propTypes: {
61
- options: PropTypes.Validator<(PropTypes.InferProps<{
62
- value: PropTypes.Validator<NonNullable<NonNullable<string | number | null | undefined>>>;
63
- label: PropTypes.Validator<string>;
64
- }> | null | undefined)[]>;
65
- value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
66
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
67
- placeholder: PropTypes.Requireable<string>;
68
- label: PropTypes.Requireable<string>;
69
- error: PropTypes.Requireable<boolean>;
70
- helperText: PropTypes.Requireable<string>;
71
- disabled: PropTypes.Requireable<boolean>;
72
- fullWidth: PropTypes.Requireable<boolean>;
73
- size: PropTypes.Requireable<string>;
74
- className: PropTypes.Requireable<string>;
75
- };
76
60
  };
@@ -1,129 +1,112 @@
1
- import { jsxs as c, jsx as i } from "react/jsx-runtime";
2
- import { useState as y, useRef as S, useEffect as N } from "react";
3
- import { clsx as l } from "clsx";
4
- import * as e from "prop-types";
1
+ import { jsxs as r, jsx as s } from "react/jsx-runtime";
2
+ import { useState as N, useRef as C, useEffect as g } from "react";
3
+ import { clsx as n } from "clsx";
5
4
  /* empty css */
6
- const x = ({
7
- options: a,
8
- value: u,
9
- onChange: f,
10
- placeholder: k = "Select an option",
11
- label: h,
12
- error: b,
13
- helperText: g,
14
- disabled: d,
15
- fullWidth: v,
16
- size: L = "md",
17
- className: O
5
+ const O = ({
6
+ options: c,
7
+ value: a,
8
+ onChange: p,
9
+ placeholder: x = "Select an option",
10
+ label: f,
11
+ error: h,
12
+ helperText: v,
13
+ disabled: u,
14
+ fullWidth: w,
15
+ size: k = "md",
16
+ className: y
18
17
  }) => {
19
- const [s, p] = y(!1), [E, w] = y("bottom"), n = S(null), m = a.find((t) => t.value === u), r = () => {
20
- if (n.current) {
21
- const t = n.current.getBoundingClientRect(), o = window.innerHeight - t.bottom, C = t.top;
22
- o < 250 && C > o ? w("top") : w("bottom");
18
+ const [t, d] = N(!1), [L, b] = N("bottom"), i = C(null), m = c.find((e) => e.value === a), l = () => {
19
+ if (i.current) {
20
+ const e = i.current.getBoundingClientRect(), o = window.innerHeight - e.bottom, B = e.top;
21
+ o < 250 && B > o ? b("top") : b("bottom");
23
22
  }
24
- }, R = () => {
25
- d || (s || r(), p(!s));
26
- }, T = (t) => {
27
- f && f(t), p(!1);
23
+ }, E = () => {
24
+ u || (t || l(), d(!t));
25
+ }, S = (e) => {
26
+ p && p(e), d(!1);
28
27
  };
29
- return N(() => (s && (window.addEventListener("resize", r), window.addEventListener("scroll", r, { capture: !0 })), () => {
30
- window.removeEventListener("resize", r), window.removeEventListener("scroll", r, { capture: !0 });
31
- }), [s]), N(() => {
32
- const t = (o) => {
33
- n.current && !n.current.contains(o.target) && p(!1);
28
+ return g(() => (t && (window.addEventListener("resize", l), window.addEventListener("scroll", l, { capture: !0 })), () => {
29
+ window.removeEventListener("resize", l), window.removeEventListener("scroll", l, { capture: !0 });
30
+ }), [t]), g(() => {
31
+ const e = (o) => {
32
+ i.current && !i.current.contains(o.target) && d(!1);
34
33
  };
35
- return s && document.addEventListener("mousedown", t), () => {
36
- document.removeEventListener("mousedown", t);
34
+ return t && document.addEventListener("mousedown", e), () => {
35
+ document.removeEventListener("mousedown", e);
37
36
  };
38
- }, [s]), /* @__PURE__ */ c(
37
+ }, [t]), /* @__PURE__ */ r(
39
38
  "div",
40
39
  {
41
- className: l("ui-select-wrapper", v && "ui-w-full", O),
42
- ref: n,
43
- style: { width: v ? "100%" : "auto" },
40
+ className: n("ui-select-wrapper", w && "ui-w-full", y),
41
+ ref: i,
42
+ style: { width: w ? "100%" : "auto" },
44
43
  children: [
45
- h && /* @__PURE__ */ i("label", { className: "ui-label", style: { marginBottom: "0.375rem", display: "block" }, children: h }),
46
- /* @__PURE__ */ c("div", { className: "ui-select-input-container", children: [
47
- /* @__PURE__ */ c(
44
+ f && /* @__PURE__ */ s("label", { className: "ui-label", style: { marginBottom: "0.375rem", display: "block" }, children: f }),
45
+ /* @__PURE__ */ r("div", { className: "ui-select-input-container", children: [
46
+ /* @__PURE__ */ r(
48
47
  "button",
49
48
  {
50
49
  type: "button",
51
- className: l(
50
+ className: n(
52
51
  "ui-select-trigger",
53
- `ui-select-${L}`,
54
- b && "ui-select-error",
55
- d && "ui-select-disabled",
56
- s && "ui-select-open"
52
+ `ui-select-${k}`,
53
+ h && "ui-select-error",
54
+ u && "ui-select-disabled",
55
+ t && "ui-select-open"
57
56
  ),
58
- onClick: R,
59
- disabled: d,
57
+ onClick: E,
58
+ disabled: u,
60
59
  "aria-haspopup": "listbox",
61
- "aria-expanded": s,
60
+ "aria-expanded": t,
62
61
  children: [
63
- /* @__PURE__ */ i("span", { className: l(!m && "ui-select-placeholder"), children: m ? m.label : k }),
64
- /* @__PURE__ */ i(
62
+ /* @__PURE__ */ s("span", { className: n(!m && "ui-select-placeholder"), children: m ? m.label : x }),
63
+ /* @__PURE__ */ s(
65
64
  "svg",
66
65
  {
67
66
  className: "ui-select-icon",
68
67
  fill: "none",
69
68
  stroke: "currentColor",
70
69
  viewBox: "0 0 24 24",
71
- children: /* @__PURE__ */ i("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" })
70
+ children: /* @__PURE__ */ s("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" })
72
71
  }
73
72
  )
74
73
  ]
75
74
  }
76
75
  ),
77
- s && /* @__PURE__ */ c(
76
+ t && /* @__PURE__ */ r(
78
77
  "ul",
79
78
  {
80
- className: l(
79
+ className: n(
81
80
  "ui-select-menu",
82
- E === "top" && "ui-select-menu-top"
81
+ L === "top" && "ui-select-menu-top"
83
82
  ),
84
83
  role: "listbox",
85
84
  children: [
86
- a.map((t) => /* @__PURE__ */ i(
85
+ c.map((e) => /* @__PURE__ */ s(
87
86
  "li",
88
87
  {
89
- className: l(
88
+ className: n(
90
89
  "ui-select-option",
91
- t.value === u && "ui-select-selected"
90
+ e.value === a && "ui-select-selected"
92
91
  ),
93
- onClick: () => T(t.value),
92
+ onClick: () => S(e.value),
94
93
  role: "option",
95
- "aria-selected": t.value === u,
96
- children: t.label
94
+ "aria-selected": e.value === a,
95
+ children: e.label
97
96
  },
98
- t.value
97
+ e.value
99
98
  )),
100
- a.length === 0 && /* @__PURE__ */ i("li", { className: "ui-select-option", style: { color: "var(--ui-text-muted)", cursor: "default" }, children: "No options" })
99
+ c.length === 0 && /* @__PURE__ */ s("li", { className: "ui-select-option", style: { color: "var(--ui-text-muted)", cursor: "default" }, children: "No options" })
101
100
  ]
102
101
  }
103
102
  )
104
103
  ] }),
105
- g && /* @__PURE__ */ i("span", { className: l("ui-helper-text", b && "ui-helper-text-error"), style: { marginTop: "0.375rem", display: "block" }, children: g })
104
+ v && /* @__PURE__ */ s("span", { className: n("ui-helper-text", h && "ui-helper-text-error"), style: { marginTop: "0.375rem", display: "block" }, children: v })
106
105
  ]
107
106
  }
108
107
  );
109
108
  };
110
- x.displayName = "Select";
111
- x.propTypes = {
112
- options: e.arrayOf(e.shape({
113
- value: e.oneOfType([e.string, e.number]).isRequired,
114
- label: e.string.isRequired
115
- })).isRequired,
116
- value: e.oneOfType([e.string, e.number]),
117
- onChange: e.func,
118
- placeholder: e.string,
119
- label: e.string,
120
- error: e.bool,
121
- helperText: e.string,
122
- disabled: e.bool,
123
- fullWidth: e.bool,
124
- size: e.oneOf(["sm", "md", "lg", "xl"]),
125
- className: e.string
126
- };
109
+ O.displayName = "Select";
127
110
  export {
128
- x as Select
111
+ O as Select
129
112
  };
@@ -1,53 +1,37 @@
1
- import { jsxs as m, jsx as s } from "react/jsx-runtime";
2
- import { forwardRef as p } from "react";
3
- import { clsx as h } from "clsx";
4
- import * as e from "prop-types";
1
+ import { jsxs as m, jsx as i } from "react/jsx-runtime";
2
+ import { forwardRef as l } from "react";
3
+ import { clsx as o } from "clsx";
5
4
  /* empty css */
6
- const a = p(
7
- ({ className: o, label: i, error: u, disabled: r, size: t = "md", variant: c = "primary", ...n }, l) => /* @__PURE__ */ m(
5
+ const p = l(
6
+ ({ className: c, label: s, error: u, disabled: t, size: r = "md", variant: a = "primary", ...e }, h) => /* @__PURE__ */ m(
8
7
  "label",
9
8
  {
10
- className: h(
9
+ className: o(
11
10
  "ui-switch-label",
12
- `ui-switch-${t}`,
13
- `ui-switch-${c}`,
14
- r && "ui-switch-disabled",
15
- o
11
+ `ui-switch-${r}`,
12
+ `ui-switch-${a}`,
13
+ t && "ui-switch-disabled",
14
+ c
16
15
  ),
17
16
  children: [
18
- /* @__PURE__ */ s(
17
+ /* @__PURE__ */ i(
19
18
  "input",
20
19
  {
21
20
  type: "checkbox",
22
21
  className: "ui-switch-input",
23
- disabled: r,
24
- ref: l,
22
+ disabled: t,
23
+ ref: h,
25
24
  role: "switch",
26
- ...n
25
+ ...e
27
26
  }
28
27
  ),
29
- /* @__PURE__ */ s("span", { className: "ui-switch-track", children: /* @__PURE__ */ s("span", { className: "ui-switch-thumb" }) }),
30
- i && /* @__PURE__ */ s("span", { className: "ui-switch-text", children: i })
28
+ /* @__PURE__ */ i("span", { className: "ui-switch-track", children: /* @__PURE__ */ i("span", { className: "ui-switch-thumb" }) }),
29
+ s && /* @__PURE__ */ i("span", { className: "ui-switch-text", children: s })
31
30
  ]
32
31
  }
33
32
  )
34
33
  );
35
- a.displayName = "Switch";
36
- a.propTypes = {
37
- label: e.node,
38
- error: e.bool,
39
- size: e.oneOf(["sm", "md", "lg", "xl"]),
40
- variant: e.oneOf(["primary", "success", "warning", "danger"]),
41
- checked: e.bool,
42
- defaultChecked: e.bool,
43
- onChange: e.func,
44
- name: e.string,
45
- value: e.oneOfType([e.string, e.number]),
46
- disabled: e.bool,
47
- required: e.bool,
48
- id: e.string,
49
- className: e.string
50
- };
34
+ p.displayName = "Switch";
51
35
  export {
52
- a as Switch
36
+ p as Switch
53
37
  };
@@ -1,29 +1,20 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { forwardRef as n } from "react";
3
- import * as e from "prop-types";
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { forwardRef as d } from "react";
4
3
  /* empty css */
5
- const r = n(
6
- ({ className: s, bordered: a = !0, striped: i, hover: l, size: t = "md", children: m, ...b }, d) => {
7
- const p = [
4
+ const u = d(
5
+ ({ className: a, bordered: r = !0, striped: t, hover: i, size: l = "md", children: s, ...o }, m) => {
6
+ const b = [
8
7
  "ui-table",
9
- a && "ui-table-bordered",
10
- i && "ui-table-striped",
11
- l && "ui-table-hover",
12
- t === "sm" && "ui-table-sm",
13
- s
8
+ r && "ui-table-bordered",
9
+ t && "ui-table-striped",
10
+ i && "ui-table-hover",
11
+ l === "sm" && "ui-table-sm",
12
+ a
14
13
  ].filter(Boolean).join(" ");
15
- return /* @__PURE__ */ o("div", { className: "ui-table-responsive", children: /* @__PURE__ */ o("table", { ref: d, className: p, ...b, children: m }) });
14
+ return /* @__PURE__ */ e("div", { className: "ui-table-responsive", children: /* @__PURE__ */ e("table", { ref: m, className: b, ...o, children: s }) });
16
15
  }
17
16
  );
18
- r.displayName = "Table";
19
- r.propTypes = {
20
- bordered: e.bool,
21
- striped: e.bool,
22
- hover: e.bool,
23
- size: e.oneOf(["sm", "md"]),
24
- children: e.node,
25
- className: e.string
26
- };
17
+ u.displayName = "Table";
27
18
  export {
28
- r as Table
19
+ u as Table
29
20
  };
@@ -1,6 +1,5 @@
1
1
  import { ReactNode, MouseEventHandler } from 'react';
2
2
 
3
- import * as PropTypes from 'prop-types';
4
3
  /**
5
4
  * Tabs Root properties.
6
5
  */
@@ -40,41 +39,17 @@ export interface TabsContentProps {
40
39
  export declare const Tabs: {
41
40
  ({ defaultValue, value, onValueChange, children, className }: TabsProps): import("react/jsx-runtime").JSX.Element;
42
41
  displayName: string;
43
- propTypes: {
44
- defaultValue: PropTypes.Requireable<string>;
45
- value: PropTypes.Requireable<string>;
46
- onValueChange: PropTypes.Requireable<(...args: any[]) => any>;
47
- children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
48
- className: PropTypes.Requireable<string>;
49
- };
50
42
  } & {
51
43
  List: {
52
44
  ({ className, children, variant, ...props }: TabsListProps): import("react/jsx-runtime").JSX.Element;
53
45
  displayName: string;
54
- propTypes: {
55
- children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
56
- variant: PropTypes.Requireable<string>;
57
- className: PropTypes.Requireable<string>;
58
- };
59
46
  };
60
47
  Trigger: {
61
48
  ({ value, className, children, onClick, ...props }: TabsTriggerProps): import("react/jsx-runtime").JSX.Element;
62
49
  displayName: string;
63
- propTypes: {
64
- value: PropTypes.Validator<string>;
65
- children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
66
- className: PropTypes.Requireable<string>;
67
- onClick: PropTypes.Requireable<(...args: any[]) => any>;
68
- disabled: PropTypes.Requireable<boolean>;
69
- };
70
50
  };
71
51
  Content: {
72
52
  ({ value, className, children, ...props }: TabsContentProps): import("react/jsx-runtime").JSX.Element | null;
73
53
  displayName: string;
74
- propTypes: {
75
- value: PropTypes.Validator<string>;
76
- children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
77
- className: PropTypes.Requireable<string>;
78
- };
79
54
  };
80
55
  };
@@ -1,92 +1,67 @@
1
- import { jsx as l } from "react/jsx-runtime";
2
- import { createContext as N, useState as v, useId as y, useContext as f } from "react";
3
- import { clsx as d } from "clsx";
4
- import * as t from "prop-types";
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import { createContext as x, useState as $, useId as N, useContext as m } from "react";
3
+ import { clsx as b } from "clsx";
5
4
  /* empty css */
6
- const p = N(null), m = ({ defaultValue: e, value: n, onValueChange: i, children: r, className: a }) => {
7
- const [s, o] = v(e || ""), c = n !== void 0, b = c ? n : s, u = y(), g = (I) => {
8
- c || o(I), i?.(I);
5
+ const u = x(null), C = ({ defaultValue: t, value: s, onValueChange: a, children: o, className: n }) => {
6
+ const [e, i] = $(t || ""), r = s !== void 0, l = r ? s : e, d = N(), g = (T) => {
7
+ r || i(T), a?.(T);
9
8
  };
10
- return /* @__PURE__ */ l(p.Provider, { value: { value: b, onChange: g, baseId: u }, children: /* @__PURE__ */ l("div", { className: d("ui-tabs", a), children: r }) });
11
- }, T = ({ className: e, children: n, variant: i = "line", ...r }) => /* @__PURE__ */ l(
9
+ return /* @__PURE__ */ c(u.Provider, { value: { value: l, onChange: g, baseId: d }, children: /* @__PURE__ */ c("div", { className: b("ui-tabs", n), children: o }) });
10
+ }, I = ({ className: t, children: s, variant: a = "line", ...o }) => /* @__PURE__ */ c(
12
11
  "div",
13
12
  {
14
13
  role: "tablist",
15
- className: d("ui-tabs-list", `ui-tabs-list-${i}`, e),
16
- ...r,
17
- children: n
14
+ className: b("ui-tabs-list", `ui-tabs-list-${a}`, t),
15
+ ...o,
16
+ children: s
18
17
  }
19
- ), h = ({ value: e, className: n, children: i, onClick: r, ...a }) => {
20
- const s = f(p);
21
- if (!s) throw new Error("TabsTrigger must be used within Tabs");
22
- const o = s.value === e, c = `${s.baseId}-trigger-${e}`, b = `${s.baseId}-content-${e}`, u = (g) => {
23
- s.onChange(e), r?.(g);
18
+ ), p = ({ value: t, className: s, children: a, onClick: o, ...n }) => {
19
+ const e = m(u);
20
+ if (!e) throw new Error("TabsTrigger must be used within Tabs");
21
+ const i = e.value === t, r = `${e.baseId}-trigger-${t}`, l = `${e.baseId}-content-${t}`, d = (g) => {
22
+ e.onChange(t), o?.(g);
24
23
  };
25
- return /* @__PURE__ */ l(
24
+ return /* @__PURE__ */ c(
26
25
  "button",
27
26
  {
28
27
  type: "button",
29
28
  role: "tab",
30
- "aria-selected": o,
31
- "aria-controls": b,
32
- id: c,
33
- tabIndex: o ? 0 : -1,
34
- "data-state": o ? "active" : "inactive",
35
- className: d("ui-tabs-trigger", n),
36
- onClick: u,
37
- ...a,
38
- children: i
29
+ "aria-selected": i,
30
+ "aria-controls": l,
31
+ id: r,
32
+ tabIndex: i ? 0 : -1,
33
+ "data-state": i ? "active" : "inactive",
34
+ className: b("ui-tabs-trigger", s),
35
+ onClick: d,
36
+ ...n,
37
+ children: a
39
38
  }
40
39
  );
41
- }, C = ({ value: e, className: n, children: i, ...r }) => {
42
- const a = f(p);
43
- if (!a) throw new Error("TabsContent must be used within Tabs");
44
- const s = a.value === e, o = `${a.baseId}-trigger-${e}`, c = `${a.baseId}-content-${e}`;
45
- return s ? /* @__PURE__ */ l(
40
+ }, h = ({ value: t, className: s, children: a, ...o }) => {
41
+ const n = m(u);
42
+ if (!n) throw new Error("TabsContent must be used within Tabs");
43
+ const e = n.value === t, i = `${n.baseId}-trigger-${t}`, r = `${n.baseId}-content-${t}`;
44
+ return e ? /* @__PURE__ */ c(
46
45
  "div",
47
46
  {
48
47
  role: "tabpanel",
49
- id: c,
50
- "aria-labelledby": o,
48
+ id: r,
49
+ "aria-labelledby": i,
51
50
  tabIndex: 0,
52
- className: d("ui-tabs-content", n),
53
- ...r,
54
- children: i
51
+ className: b("ui-tabs-content", s),
52
+ ...o,
53
+ children: a
55
54
  }
56
55
  ) : null;
57
- }, k = Object.assign(m, {
58
- List: T,
59
- Trigger: h,
60
- Content: C
56
+ }, L = Object.assign(C, {
57
+ List: I,
58
+ Trigger: p,
59
+ Content: h
61
60
  });
62
- m.displayName = "Tabs";
63
- T.displayName = "TabsList";
64
- h.displayName = "TabsTrigger";
65
- C.displayName = "TabsContent";
66
- m.propTypes = {
67
- defaultValue: t.string,
68
- value: t.string,
69
- onValueChange: t.func,
70
- children: t.node,
71
- className: t.string
72
- };
73
- T.propTypes = {
74
- children: t.node,
75
- variant: t.oneOf(["line", "pills"]),
76
- className: t.string
77
- };
78
- h.propTypes = {
79
- value: t.string.isRequired,
80
- children: t.node,
81
- className: t.string,
82
- onClick: t.func,
83
- disabled: t.bool
84
- };
85
- C.propTypes = {
86
- value: t.string.isRequired,
87
- children: t.node,
88
- className: t.string
89
- };
61
+ C.displayName = "Tabs";
62
+ I.displayName = "TabsList";
63
+ p.displayName = "TabsTrigger";
64
+ h.displayName = "TabsContent";
90
65
  export {
91
- k as Tabs
66
+ L as Tabs
92
67
  };
@@ -1,39 +1,29 @@
1
- import { jsx as d } from "react/jsx-runtime";
2
- import { forwardRef as u } from "react";
3
- import { clsx as f } from "clsx";
4
- import * as e from "prop-types";
1
+ import { jsx as u } from "react/jsx-runtime";
2
+ import { forwardRef as d } from "react";
3
+ import { clsx as s } from "clsx";
5
4
  /* empty css */
6
- const i = u(
7
- ({ className: n, children: a, level: o = 1, truncate: m, lines: t, style: r, ...p }, s) => {
8
- const c = `h${o}`, l = t ? { ...r, "--ui-line-clamp": t } : r;
9
- return /* @__PURE__ */ d(
5
+ const f = d(
6
+ ({ className: i, children: r, level: o = 1, truncate: m, lines: t, style: a, ...e }, n) => {
7
+ const c = `h${o}`, p = t ? { ...a, "--ui-line-clamp": t } : a;
8
+ return /* @__PURE__ */ u(
10
9
  c,
11
10
  {
12
- ref: s,
13
- className: f(
11
+ ref: n,
12
+ className: s(
14
13
  "ui-heading",
15
14
  `ui-heading-h${o}`,
16
15
  m && "ui-text-truncate",
17
16
  t && "ui-text-clamp",
18
- n
17
+ i
19
18
  ),
20
- style: l,
21
- ...p,
22
- children: a
19
+ style: p,
20
+ ...e,
21
+ children: r
23
22
  }
24
23
  );
25
24
  }
26
25
  );
27
- i.displayName = "Heading";
28
- i.propTypes = {
29
- level: e.oneOf([1, 2, 3, 4, 5, 6]),
30
- truncate: e.bool,
31
- lines: e.number,
32
- children: e.node,
33
- className: e.string,
34
- style: e.object,
35
- id: e.string
36
- };
26
+ f.displayName = "Heading";
37
27
  export {
38
- i as Heading
28
+ f as Heading
39
29
  };