trepur_components 2.3.24 → 2.3.26

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,7 +4,7 @@ export interface ButtonProps {
4
4
  variant?: 'primary' | 'secondary' | 'ghost' | 'bordered' | 'basic';
5
5
  disabled?: boolean;
6
6
  loading?: boolean;
7
- type?: 'button' | 'link';
7
+ type?: 'button' | 'link' | 'submit';
8
8
  href?: string;
9
9
  target?: string;
10
10
  size?: 'sm' | 'md' | 'lg';
@@ -1,82 +1,82 @@
1
- import { jsx as o, jsxs as f } from "react/jsx-runtime";
2
- import { createContext as I, forwardRef as s, useMemo as b, useRef as N, useContext as i } from "react";
3
- import h from "clsx";
4
- const d = I(null), u = s(({ children: n, errors: t, placeholder: e, ...r }, l) => {
5
- const a = b(
1
+ import { jsx as o, jsxs as I } from "react/jsx-runtime";
2
+ import { createContext as b, forwardRef as a, useMemo as N, useRef as h, useContext as i } from "react";
3
+ import m from "clsx";
4
+ const d = b(null), p = a(({ children: r, errors: t, placeholder: n, ...e }, l) => {
5
+ const s = N(
6
6
  () => ({
7
7
  errors: t,
8
- placeholder: e,
9
- ...r
8
+ placeholder: n,
9
+ ...e
10
10
  }),
11
- [t, r]
11
+ [t, e]
12
12
  );
13
- return /* @__PURE__ */ o(d.Provider, { value: a, children: /* @__PURE__ */ o("div", { ref: l, children: n }) });
14
- }), m = s(
15
- ({ children: n, ...t }, e) => {
16
- const r = N(null);
13
+ return /* @__PURE__ */ o(d.Provider, { value: s, children: /* @__PURE__ */ o("div", { ref: l, children: r }) });
14
+ }), u = a(
15
+ ({ children: r, ...t }, n) => {
16
+ const e = h(null);
17
17
  return /* @__PURE__ */ o(
18
18
  "div",
19
19
  {
20
20
  className: "mt-4 w-full",
21
21
  onClick: () => {
22
22
  var l;
23
- return (l = r.current) == null ? void 0 : l.focus();
23
+ return (l = e.current) == null ? void 0 : l.focus();
24
24
  },
25
- ref: e,
25
+ ref: n,
26
26
  ...t,
27
- children: n
27
+ children: r
28
28
  }
29
29
  );
30
30
  }
31
- ), p = s(({ children: n, required: t = !1 }, e) => /* @__PURE__ */ f(
31
+ ), c = a(({ className: r, children: t, required: n = !1 }, e) => /* @__PURE__ */ I(
32
32
  "div",
33
33
  {
34
34
  ref: e,
35
- className: "text-md flex items-center rounded-2xl px-1 font-semibold",
35
+ className: m("flex px-1 text-sm font-normal leading-5", r),
36
36
  children: [
37
- /* @__PURE__ */ o("p", { children: n }),
38
- t && /* @__PURE__ */ o("p", { className: "font-semiBold text-lg", children: " *" })
37
+ /* @__PURE__ */ o("p", { children: t }),
38
+ n && /* @__PURE__ */ o("p", { className: "text-sm font-normal", children: " *" })
39
39
  ]
40
40
  }
41
- )), c = s(
42
- ({ ...n }) => {
43
- const { errors: t, placeholder: e } = i(d) || {};
41
+ )), x = a(
42
+ ({ ...r }) => {
43
+ const { errors: t, placeholder: n } = i(d) || {};
44
44
  return /* @__PURE__ */ o(
45
45
  "input",
46
46
  {
47
- placeholder: e,
48
- className: h(
47
+ placeholder: n,
48
+ className: m(
49
49
  "text-ink text-md w-full rounded-md border border-gray-300 bg-white py-2 pl-4",
50
50
  {
51
51
  "border-error border-2": t != null
52
52
  }
53
53
  ),
54
- ...n
54
+ ...r
55
55
  }
56
56
  );
57
57
  }
58
- ), x = s(({ children: n, ...t }, e) => {
59
- const { errors: r } = i(d) || {};
58
+ ), f = a(({ children: r, ...t }, n) => {
59
+ const { errors: e } = i(d) || {};
60
60
  return /* @__PURE__ */ o(
61
61
  "div",
62
62
  {
63
- ref: e,
63
+ ref: n,
64
64
  className: "text-md gap-y-2 pl-1 pt-2 font-semibold text-error-default",
65
65
  ...t,
66
- children: r == null ? void 0 : r.map((l, a) => /* @__PURE__ */ o("p", { children: l }, `error-msg-${a + 1}`))
66
+ children: e == null ? void 0 : e.map((l, s) => /* @__PURE__ */ o("p", { children: l }, `error-msg-${s + 1}`))
67
67
  }
68
68
  );
69
69
  });
70
- u.displayName = "Input";
71
- m.displayName = "Input.Item";
72
- p.displayName = "Input.Label";
73
- c.displayName = "Input.Box";
74
- x.displayName = "Input.Validation";
75
- const C = Object.assign(u, {
76
- Item: m,
77
- Label: p,
78
- Box: c,
79
- Validation: x
70
+ p.displayName = "Input";
71
+ u.displayName = "Input.Item";
72
+ c.displayName = "Input.Label";
73
+ x.displayName = "Input.Box";
74
+ f.displayName = "Input.Validation";
75
+ const C = Object.assign(p, {
76
+ Item: u,
77
+ Label: c,
78
+ Box: x,
79
+ Validation: f
80
80
  });
81
81
  export {
82
82
  C as Input
@@ -29,3 +29,4 @@ declare const meta: {
29
29
  export default meta;
30
30
  type Story = StoryObj<typeof Nav>;
31
31
  export declare const Default: Story;
32
+ export declare const Loading: Story;
@@ -4,6 +4,7 @@ import { HTMLAttributes } from 'react';
4
4
  export interface NavContextProps {
5
5
  expanded?: boolean;
6
6
  setExpanded?: (val: boolean) => void;
7
+ loading?: boolean;
7
8
  }
8
9
  declare const Nav: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & NavContextProps & import('react').RefAttributes<HTMLDivElement>> & {
9
10
  Header: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import('react').RefAttributes<HTMLDivElement>>;
@@ -1,125 +1,140 @@
1
- import { jsx as e, jsxs as i, Fragment as H } from "react/jsx-runtime";
2
- import { createContext as C, forwardRef as o, useState as m, useMemo as k, useContext as p, useRef as w } from "react";
1
+ import { jsx as e, jsxs as p, Fragment as H } from "react/jsx-runtime";
2
+ import { createContext as C, forwardRef as l, useState as v, useMemo as k, useContext as c, useRef as w } from "react";
3
3
  import { HamburgerIcon as M } from "../HamburgerIcon/index.js";
4
4
  import { faChevronDown as j } from "@fortawesome/fontawesome-free-solid";
5
- import n from "clsx";
5
+ import d from "clsx";
6
6
  import { Icon as D } from "../Icon/index.js";
7
- const c = C(null), v = o(({ className: a, children: t }, s) => {
8
- const [r, d] = m(!1), l = k(
7
+ import { NavItem as F } from "../NavItem/index.js";
8
+ const i = C(null), N = l(({ className: t, children: r, loading: a }, s) => {
9
+ const [o, n] = v(!1), m = k(
9
10
  () => ({
10
- expanded: r,
11
- setExpanded: d
11
+ expanded: o,
12
+ setExpanded: n,
13
+ loading: a
12
14
  }),
13
- [r, d]
15
+ [o, n, a]
14
16
  );
15
- return /* @__PURE__ */ e(c.Provider, { value: l, children: /* @__PURE__ */ e("div", { className: a, ref: s, children: t }) });
16
- }), N = o(
17
- ({ className: a, children: t }, s) => /* @__PURE__ */ e(
17
+ return /* @__PURE__ */ e(i.Provider, { value: m, children: /* @__PURE__ */ e("div", { className: t, ref: s, children: r }) });
18
+ }), f = l(
19
+ ({ className: t, children: r }, a) => /* @__PURE__ */ e(
18
20
  "div",
19
21
  {
20
- ref: s,
21
- className: n("relative h-24 w-full bg-nav-bg px-2 py-2", a),
22
- children: t
22
+ ref: a,
23
+ className: d("relative h-24 w-full bg-nav-bg px-2 py-2", t),
24
+ children: r
23
25
  }
24
26
  )
25
- ), f = o(({ className: a, children: t }, s) => {
26
- const { setExpanded: r, expanded: d } = p(c) || {};
27
- return /* @__PURE__ */ i("div", { ref: s, className: n("flex h-full md:hidden", a), children: [
28
- /* @__PURE__ */ e("div", { className: "my-auto", children: /* @__PURE__ */ e(
27
+ ), g = l(({ className: t, children: r }, a) => {
28
+ const { loading: s, setExpanded: o, expanded: n } = c(i) || {};
29
+ return /* @__PURE__ */ p("div", { ref: a, className: d("flex h-full md:hidden", t), children: [
30
+ !s && /* @__PURE__ */ e("div", { className: "my-auto", children: /* @__PURE__ */ e(
29
31
  M,
30
32
  {
31
33
  variant: "ghost",
32
- onClick: () => r == null ? void 0 : r(!d),
34
+ onClick: () => o == null ? void 0 : o(!n),
33
35
  className: "aspect-square"
34
36
  }
35
37
  ) }),
36
- /* @__PURE__ */ e("div", { className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 transform", children: t })
38
+ /* @__PURE__ */ e("div", { className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 transform", children: r })
37
39
  ] });
38
- }), g = o(({ className: a, children: t }, s) => /* @__PURE__ */ e(
40
+ }), u = l(({ className: t, children: r }, a) => /* @__PURE__ */ e(
39
41
  "div",
40
42
  {
41
- ref: s,
42
- className: n(
43
+ ref: a,
44
+ className: d(
43
45
  "hidden justify-between md:flex md:gap-4 md:px-4 lg:gap-8 lg:px-20",
44
- a
46
+ t
45
47
  ),
46
- children: t
48
+ children: r
47
49
  }
48
- )), x = o(
49
- ({ className: a, children: t }, s) => {
50
- const { expanded: r } = p(c) || {};
51
- return r ? /* @__PURE__ */ e(
50
+ )), x = l(
51
+ ({ className: t, children: r }, a) => {
52
+ const { expanded: s } = c(i) || {};
53
+ return s ? /* @__PURE__ */ e(
52
54
  "div",
53
55
  {
54
- ref: s,
55
- className: n(
56
+ ref: a,
57
+ className: d(
56
58
  "h-screen bg-nav-bg px-8 pb-12 pt-2 md:hidden",
57
- a
59
+ t
58
60
  ),
59
- children: /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-4 md:hidden", children: t })
61
+ children: /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-4 md:hidden", children: r })
60
62
  }
61
63
  ) : /* @__PURE__ */ e(H, {});
62
64
  }
63
- ), u = o(
64
- ({ className: a, children: t }, s) => /* @__PURE__ */ e(
65
- "div",
66
- {
67
- ref: s,
68
- className: n("my-4 md:flex md:gap-4 lg:gap-6", a),
69
- children: t
70
- }
71
- )
72
- ), b = o(({ className: a, label: t, children: s, active: r = !1 }) => {
73
- const [d, l] = m(!1), y = w(null);
74
- return /* @__PURE__ */ i(
65
+ ), h = l(
66
+ ({ className: t, children: r }, a) => {
67
+ const { loading: s } = c(i) || {};
68
+ return s ? /* @__PURE__ */ e(
69
+ "div",
70
+ {
71
+ ref: a,
72
+ className: d("my-4 md:flex md:gap-4 lg:gap-6", t),
73
+ children: [...Array(5)].map((o, n) => /* @__PURE__ */ e(F, { loading: !0 }, n))
74
+ }
75
+ ) : /* @__PURE__ */ e(
76
+ "div",
77
+ {
78
+ ref: a,
79
+ className: d("my-4 md:flex md:gap-4 lg:gap-6", t),
80
+ children: r
81
+ }
82
+ );
83
+ }
84
+ ), b = l(({ className: t, label: r, children: a, active: s = !1 }) => {
85
+ const [o, n] = v(!1), m = w(null);
86
+ return /* @__PURE__ */ p(
75
87
  "div",
76
88
  {
77
- ref: y,
78
- onClick: () => l(!0),
79
- onMouseLeave: () => l(!1),
80
- className: n(
89
+ ref: m,
90
+ onClick: () => n(!0),
91
+ onMouseLeave: () => n(!1),
92
+ className: d(
81
93
  "relative m-auto py-0 text-nav-text after:block after:scale-x-0 after:border-b-2 after:border-nav-text after:transition-all after:duration-300 after:ease-in-out hover:cursor-pointer hover:after:scale-x-100",
82
94
  {
83
- "font-bold": r,
84
- "font-light": !r
95
+ "font-bold": s,
96
+ "font-light": !s
85
97
  },
86
- a
98
+ t
87
99
  ),
88
100
  children: [
89
- /* @__PURE__ */ i("div", { className: "flex items-center gap-1", children: [
90
- /* @__PURE__ */ e("p", { className: "text-lg", children: t }),
101
+ /* @__PURE__ */ p("div", { className: "flex items-center gap-1", children: [
102
+ /* @__PURE__ */ e("p", { className: "text-lg", children: r }),
91
103
  /* @__PURE__ */ e(D, { size: "xs", icon: j })
92
104
  ] }),
93
- d && /* @__PURE__ */ e("div", { className: "absolute -left-5 top-7 z-50 w-40 bg-nav-bg", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-y-2 bg-nav-bg px-4 py-4", children: s }) })
105
+ o && /* @__PURE__ */ e("div", { className: "absolute -left-5 top-7 z-50 w-40 bg-nav-bg", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-y-2 bg-nav-bg px-4 py-4", children: a }) })
94
106
  ]
95
107
  }
96
108
  );
97
- }), h = o(({ className: a, src: t, ...s }, r) => /* @__PURE__ */ e(
98
- "img",
99
- {
100
- className: n("h-20 flex-none", a),
101
- ref: r,
102
- src: t,
103
- ...s
104
- }
105
- ));
106
- v.displayName = "Nav";
107
- N.displayName = "Nav.Header";
108
- g.displayName = "Nav.DesktopHeader";
109
- f.displayName = "Nav.MobileHeader";
110
- h.displayName = "Nav.Logo";
111
- u.displayName = "Nav.Section";
109
+ }), y = l(({ className: t, src: r, ...a }, s) => {
110
+ const { loading: o } = c(i) || {};
111
+ return o ? /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("div", { className: "h-20 w-20 animate-pulse bg-gray-300" }) }) : /* @__PURE__ */ e(
112
+ "img",
113
+ {
114
+ className: d("h-20 flex-none", t),
115
+ ref: s,
116
+ src: r,
117
+ ...a
118
+ }
119
+ );
120
+ });
121
+ N.displayName = "Nav";
122
+ f.displayName = "Nav.Header";
123
+ u.displayName = "Nav.DesktopHeader";
124
+ g.displayName = "Nav.MobileHeader";
125
+ y.displayName = "Nav.Logo";
126
+ h.displayName = "Nav.Section";
112
127
  x.displayName = "Nav.Body";
113
128
  b.displayName = "Nav.Folder";
114
- const R = Object.assign(v, {
115
- Header: N,
116
- DesktopHeader: g,
117
- MobileHeader: f,
118
- Section: u,
119
- Logo: h,
129
+ const A = Object.assign(N, {
130
+ Header: f,
131
+ DesktopHeader: u,
132
+ MobileHeader: g,
133
+ Section: h,
134
+ Logo: y,
120
135
  Body: x,
121
136
  Folder: b
122
137
  });
123
138
  export {
124
- R as Nav
139
+ A as Nav
125
140
  };
@@ -4,8 +4,9 @@ import { NavItem } from './';
4
4
  declare const meta: {
5
5
  title: string;
6
6
  component: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLAnchorElement> & {
7
- href: string;
7
+ href?: string | undefined;
8
8
  active?: boolean | undefined;
9
+ loading?: boolean | undefined;
9
10
  } & import('react').RefAttributes<HTMLAnchorElement>> & {
10
11
  Label: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLParagraphElement> & import('react').RefAttributes<HTMLParagraphElement>>;
11
12
  };
@@ -17,3 +18,4 @@ export default meta;
17
18
  type Story = StoryObj<typeof NavItem>;
18
19
  export declare const Default: Story;
19
20
  export declare const Active: Story;
21
+ export declare const Loading: Story;
@@ -1,8 +1,9 @@
1
1
  import { HTMLAttributes } from 'react';
2
2
 
3
3
  declare const NavItem: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLAnchorElement> & {
4
- href: string;
4
+ href?: string | undefined;
5
5
  active?: boolean | undefined;
6
+ loading?: boolean | undefined;
6
7
  } & import('react').RefAttributes<HTMLAnchorElement>> & {
7
8
  Label: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLParagraphElement> & import('react').RefAttributes<HTMLParagraphElement>>;
8
9
  };
@@ -1,28 +1,28 @@
1
- import { jsx as r } from "react/jsx-runtime";
1
+ import { jsx as a } from "react/jsx-runtime";
2
2
  import { forwardRef as o } from "react";
3
3
  import c from "clsx";
4
- const s = o(({ active: e, children: t, className: a, href: l, ...m }, f) => /* @__PURE__ */ r(
4
+ const s = o(({ loading: r = !1, active: e, children: t, className: n, href: m, ...f }, i) => r ? /* @__PURE__ */ a("div", { className: "m-auto", children: /* @__PURE__ */ a("div", { className: "h-7 w-20 animate-pulse rounded-md bg-gray-300" }) }) : /* @__PURE__ */ a(
5
5
  "a",
6
6
  {
7
- href: l,
8
- ref: f,
7
+ href: m,
8
+ ref: i,
9
9
  className: c(
10
- "m-auto py-0 text-nav-text after:block after:scale-x-0 after:border-b-2 after:border-nav-text after:transition-all after:duration-300 after:ease-in-out hover:cursor-pointer hover:after:scale-x-100",
10
+ "m-auto inline-block py-0 text-nav-text after:block after:scale-x-0 after:border-b-2 after:border-nav-text after:transition-all after:duration-300 after:ease-in-out hover:cursor-pointer hover:after:scale-x-100",
11
11
  {
12
12
  "font-bold": e,
13
13
  "font-light": !e
14
14
  },
15
- a
15
+ n
16
16
  ),
17
- ...m,
17
+ ...f,
18
18
  children: t
19
19
  }
20
- )), n = o(({ className: e, ...t }, a) => /* @__PURE__ */ r("p", { className: "flex-none text-nowrap text-lg", ref: a, ...t }));
20
+ )), l = o(({ className: r, ...e }, t) => /* @__PURE__ */ a("p", { className: "flex-none text-nowrap text-lg", ref: t, ...e }));
21
21
  s.displayName = "NavItem";
22
- n.displayName = "NavItem.Label";
23
- const N = Object.assign(s, {
24
- Label: n
22
+ l.displayName = "NavItem.Label";
23
+ const b = Object.assign(s, {
24
+ Label: l
25
25
  });
26
26
  export {
27
- N as NavItem
27
+ b as NavItem
28
28
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trepur_components",
3
- "version": "2.3.24",
3
+ "version": "2.3.26",
4
4
  "description": "component lib",
5
5
  "author": "trepur_ttenneb",
6
6
  "private": false,