trepur_components 2.3.24 → 2.3.25

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,136 @@
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 c, Fragment as v } from "react/jsx-runtime";
2
+ import { createContext as C, forwardRef as n, useState as N, useMemo as k, useContext as m, 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 l 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), f = n(({ className: a, children: t, loading: r }, o) => {
9
+ const [s, d] = N(!1), p = k(
9
10
  () => ({
10
- expanded: r,
11
- setExpanded: d
11
+ expanded: s,
12
+ setExpanded: d,
13
+ loading: r
12
14
  }),
13
- [r, d]
15
+ [s, d]
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: p, children: /* @__PURE__ */ e("div", { className: a, ref: o, children: t }) });
18
+ }), g = n(
19
+ ({ className: a, children: t }, r) => /* @__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
+ ref: r,
23
+ className: l("relative h-24 w-full bg-nav-bg px-2 py-2", a),
22
24
  children: t
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
+ ), u = n(({ className: a, children: t }, r) => {
28
+ const { loading: o, setExpanded: s, expanded: d } = m(i) || {};
29
+ return /* @__PURE__ */ c("div", { ref: r, className: l("flex h-full md:hidden", a), children: [
30
+ !o && /* @__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: () => s == null ? void 0 : s(!d),
33
35
  className: "aspect-square"
34
36
  }
35
37
  ) }),
36
38
  /* @__PURE__ */ e("div", { className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 transform", children: t })
37
39
  ] });
38
- }), g = o(({ className: a, children: t }, s) => /* @__PURE__ */ e(
40
+ }), x = n(({ className: a, children: t }, r) => /* @__PURE__ */ e(
39
41
  "div",
40
42
  {
41
- ref: s,
42
- className: n(
43
+ ref: r,
44
+ className: l(
43
45
  "hidden justify-between md:flex md:gap-4 md:px-4 lg:gap-8 lg:px-20",
44
46
  a
45
47
  ),
46
48
  children: t
47
49
  }
48
- )), x = o(
49
- ({ className: a, children: t }, s) => {
50
- const { expanded: r } = p(c) || {};
51
- return r ? /* @__PURE__ */ e(
50
+ )), h = n(
51
+ ({ className: a, children: t }, r) => {
52
+ const { expanded: o } = m(i) || {};
53
+ return o ? /* @__PURE__ */ e(
52
54
  "div",
53
55
  {
54
- ref: s,
55
- className: n(
56
+ ref: r,
57
+ className: l(
56
58
  "h-screen bg-nav-bg px-8 pb-12 pt-2 md:hidden",
57
59
  a
58
60
  ),
59
61
  children: /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-4 md:hidden", children: t })
60
62
  }
61
- ) : /* @__PURE__ */ e(H, {});
63
+ ) : /* @__PURE__ */ e(v, {});
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
+ ), b = n(
66
+ ({ className: a, children: t }, r) => {
67
+ const { loading: o } = m(i) || {};
68
+ return /* @__PURE__ */ e(
69
+ "div",
70
+ {
71
+ ref: r,
72
+ className: l("my-4 md:flex md:gap-4 lg:gap-6", a),
73
+ children: /* @__PURE__ */ c(v, { children: [
74
+ o && [...Array(5)].map((s) => /* @__PURE__ */ e(F, { loading: !0 })),
75
+ !o && t
76
+ ] })
77
+ }
78
+ );
79
+ }
80
+ ), y = n(({ className: a, label: t, children: r, active: o = !1 }) => {
81
+ const [s, d] = N(!1), p = w(null);
82
+ return /* @__PURE__ */ c(
75
83
  "div",
76
84
  {
77
- ref: y,
78
- onClick: () => l(!0),
79
- onMouseLeave: () => l(!1),
80
- className: n(
85
+ ref: p,
86
+ onClick: () => d(!0),
87
+ onMouseLeave: () => d(!1),
88
+ className: l(
81
89
  "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
90
  {
83
- "font-bold": r,
84
- "font-light": !r
91
+ "font-bold": o,
92
+ "font-light": !o
85
93
  },
86
94
  a
87
95
  ),
88
96
  children: [
89
- /* @__PURE__ */ i("div", { className: "flex items-center gap-1", children: [
97
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-1", children: [
90
98
  /* @__PURE__ */ e("p", { className: "text-lg", children: t }),
91
99
  /* @__PURE__ */ e(D, { size: "xs", icon: j })
92
100
  ] }),
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 }) })
101
+ s && /* @__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: r }) })
94
102
  ]
95
103
  }
96
104
  );
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";
112
- x.displayName = "Nav.Body";
113
- 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,
120
- Body: x,
121
- Folder: b
105
+ }), H = n(({ className: a, src: t, ...r }, o) => {
106
+ const { loading: s } = m(i) || {};
107
+ return s ? /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("div", { className: "h-20 w-20 animate-pulse bg-gray-300" }) }) : /* @__PURE__ */ e(
108
+ "img",
109
+ {
110
+ className: l("h-20 flex-none", a),
111
+ ref: o,
112
+ src: t,
113
+ ...r
114
+ }
115
+ );
116
+ });
117
+ f.displayName = "Nav";
118
+ g.displayName = "Nav.Header";
119
+ x.displayName = "Nav.DesktopHeader";
120
+ u.displayName = "Nav.MobileHeader";
121
+ H.displayName = "Nav.Logo";
122
+ b.displayName = "Nav.Section";
123
+ h.displayName = "Nav.Body";
124
+ y.displayName = "Nav.Folder";
125
+ const A = Object.assign(f, {
126
+ Header: g,
127
+ DesktopHeader: x,
128
+ MobileHeader: u,
129
+ Section: b,
130
+ Logo: H,
131
+ Body: h,
132
+ Folder: y
122
133
  });
123
134
  export {
124
- R as Nav
135
+ A as Nav
125
136
  };
@@ -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.25",
4
4
  "description": "component lib",
5
5
  "author": "trepur_ttenneb",
6
6
  "private": false,