trepur_components 2.4.5 → 2.4.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.
package/README.md CHANGED
@@ -17,3 +17,11 @@ You will need to log into npm if you have not done so already
17
17
  ### `npm publish`
18
18
 
19
19
  Publishes the new version of the package to npm - new version number to be updated in package.json before the publish is executed
20
+
21
+ ## Adding a new theme
22
+
23
+ To add a new theme:
24
+
25
+ 1. create a new css file in the src/styles/themes folder
26
+ 2. ensure that line 1 of the css file contains the new themes name
27
+ 3. add the file import for the new css file in the src/styles/globals.css files
@@ -1,8 +1,10 @@
1
- import { jsx as n, jsxs as c } from "react/jsx-runtime";
1
+ import { jsx as n, jsxs as s } from "react/jsx-runtime";
2
2
  import { forwardRef as o, useMemo as v, createContext as h, useContext as p } from "react";
3
- import d from "clsx";
4
- const s = h(null), x = o(({ children: r, className: a, errors: t, placeholder: l, ...e }, i) => {
5
- const m = v(
3
+ import i from "clsx";
4
+ import { Icon as L } from "../Icon/index.js";
5
+ import { faCircleExclamation as w } from "@fortawesome/free-solid-svg-icons";
6
+ const u = h(null), f = o(({ children: r, className: a, errors: t, placeholder: l, ...e }, m) => {
7
+ const d = v(
6
8
  () => ({
7
9
  errors: t,
8
10
  placeholder: l,
@@ -10,30 +12,30 @@ const s = h(null), x = o(({ children: r, className: a, errors: t, placeholder: l
10
12
  }),
11
13
  [t, e]
12
14
  );
13
- return /* @__PURE__ */ n(s.Provider, { value: m, children: /* @__PURE__ */ n(
15
+ return /* @__PURE__ */ n(u.Provider, { value: d, children: /* @__PURE__ */ n(
14
16
  "div",
15
17
  {
16
- ref: i,
17
- className: d("grid grid-cols-1 gap-2 w-full rounded-md", a),
18
+ ref: m,
19
+ className: i("grid grid-cols-1 gap-1 w-full rounded-md", a),
18
20
  ...e,
19
21
  children: r
20
22
  }
21
23
  ) });
22
- }), f = o(({ children: r, handleChange: a, onClick: t, onBlur: l, ...e }, i) => {
23
- const { placeholder: m, value: g, errors: u } = p(s) || {};
24
- return /* @__PURE__ */ c("div", { ref: i, className: "group/input relative isolate flex w-full", children: [
24
+ }), x = o(({ children: r, handleChange: a, onClick: t, onBlur: l, ...e }, m) => {
25
+ const { placeholder: d, value: I, errors: c } = p(u) || {};
26
+ return /* @__PURE__ */ s("div", { ref: m, className: "group/input relative isolate flex w-full", children: [
25
27
  /* @__PURE__ */ n(
26
28
  "input",
27
29
  {
28
- placeholder: m,
29
- className: d(
30
+ placeholder: d,
31
+ className: i(
30
32
  "h-10 border border-black rounded-md flex w-full bg-card px-3 py-1.5 text-sm placeholder:text-gray-500",
31
33
  {
32
- "border-border border": !u,
33
- "border-red-600 border-2": u
34
+ "border-border border": !c,
35
+ "border-red-600 border-2": c
34
36
  }
35
37
  ),
36
- value: g,
38
+ value: I,
37
39
  readOnly: e.readOnly,
38
40
  disabled: e.disabled,
39
41
  autoComplete: e.autoComplete,
@@ -44,7 +46,7 @@ const s = h(null), x = o(({ children: r, className: a, errors: t, placeholder: l
44
46
  required: e.required,
45
47
  type: e.type,
46
48
  name: e.name,
47
- onChange: (N) => a == null ? void 0 : a(N.target.value),
49
+ onChange: (g) => a == null ? void 0 : a(g.target.value),
48
50
  onClick: t,
49
51
  onBlur: l,
50
52
  onFocus: e.onFocus
@@ -57,46 +59,56 @@ const s = h(null), x = o(({ children: r, className: a, errors: t, placeholder: l
57
59
  "div",
58
60
  {
59
61
  ref: t,
60
- className: d(
62
+ className: i(
61
63
  "absolute right-1 top-1/2 my-auto -translate-y-1/2",
62
64
  r
63
65
  ),
64
66
  children: a
65
67
  }
66
68
  )
67
- ), y = o(({ className: r, children: a, required: t = !1 }, l) => /* @__PURE__ */ c(
69
+ ), y = o(({ className: r, children: a, required: t = !1 }, l) => /* @__PURE__ */ s(
68
70
  "div",
69
71
  {
70
72
  ref: l,
71
- className: d("flex px-1 text-sm font-normal leading-5", r),
73
+ className: i("flex px-1 text-sm font-normal leading-5", r),
72
74
  children: [
73
75
  /* @__PURE__ */ n("p", { children: a }),
74
76
  t && /* @__PURE__ */ n("p", { className: "text-sm font-normal", children: "*" })
75
77
  ]
76
78
  }
77
- )), I = o(({ ...r }, a) => {
78
- const { errors: t } = p(s) || {};
79
- return /* @__PURE__ */ n(
79
+ )), N = o(({ ...r }, a) => {
80
+ const { errors: t } = p(u) || {};
81
+ return t ? /* @__PURE__ */ n(
80
82
  "div",
81
83
  {
82
84
  ref: a,
83
85
  className: "text-sm pl-1 font-medium text-error-default",
84
86
  ...r,
85
- children: t == null ? void 0 : t.map((l, e) => /* @__PURE__ */ n("p", { children: l }, `error-msg-${e + 1}`))
87
+ children: t == null ? void 0 : t.map((l, e) => /* @__PURE__ */ s("div", { className: "gap-1 flex", children: [
88
+ /* @__PURE__ */ n(
89
+ L,
90
+ {
91
+ className: "my-auto text-error-default",
92
+ icon: w,
93
+ co: !0
94
+ }
95
+ ),
96
+ /* @__PURE__ */ n("span", { className: "my-auto", children: l }, `error-msg-${e + 1}`)
97
+ ] }))
86
98
  }
87
- );
99
+ ) : null;
88
100
  });
89
- x.displayName = "Input";
101
+ f.displayName = "Input";
90
102
  b.displayName = "Input.Actions";
91
103
  y.displayName = "Input.Label";
92
- I.displayName = "Input.Validation";
93
- f.displayName = "Input.Wrapper";
94
- const A = Object.assign(x, {
104
+ N.displayName = "Input.Validation";
105
+ x.displayName = "Input.Wrapper";
106
+ const W = Object.assign(f, {
95
107
  Label: y,
96
- Validation: I,
108
+ Validation: N,
97
109
  Actions: b,
98
- Wrapper: f
110
+ Wrapper: x
99
111
  });
100
112
  export {
101
- A as Input
113
+ W as Input
102
114
  };
@@ -3,7 +3,7 @@ import { Select } from '.';
3
3
 
4
4
  declare const meta: {
5
5
  title: string;
6
- component: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLDivElement> & import('.').SelectContextProps & import('react').RefAttributes<HTMLDivElement>> & {
6
+ component: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLDivElement> & Omit<import('react').HTMLAttributes<HTMLDivElement> & import('../Input').InputContextProps & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('.').SelectContextProps & import('react').RefAttributes<HTMLDivElement>> & {
7
7
  Item: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLLIElement> & {
8
8
  value: string;
9
9
  } & import('react').RefAttributes<HTMLLIElement>>;
@@ -14,6 +14,7 @@ declare const meta: {
14
14
  parameters: {};
15
15
  args: {
16
16
  label: string;
17
+ placeholder: string;
17
18
  children: import("react/jsx-runtime").JSX.Element[];
18
19
  };
19
20
  };
@@ -10,9 +10,10 @@ export interface SelectContextProps {
10
10
  internalValue?: string;
11
11
  setInternalValue?: (val: string) => void;
12
12
  label?: string;
13
+ placeholder?: string;
13
14
  handleChange?: (e: any) => void;
14
15
  }
15
- declare const Select: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & SelectContextProps & import('react').RefAttributes<HTMLDivElement>> & {
16
+ declare const Select: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & Omit<HTMLAttributes<HTMLDivElement> & import('../Input').InputContextProps & import('react').RefAttributes<HTMLDivElement>, "ref"> & SelectContextProps & import('react').RefAttributes<HTMLDivElement>> & {
16
17
  Item: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLLIElement> & {
17
18
  value: string;
18
19
  } & import('react').RefAttributes<HTMLLIElement>>;
@@ -1,154 +1,153 @@
1
- import { jsx as o, jsxs as I } from "react/jsx-runtime";
2
- import { forwardRef as i, useState as x, useCallback as y, useEffect as A, createContext as E, useContext as p } from "react";
3
- import u from "clsx";
1
+ import { jsx as l, jsxs as I } from "react/jsx-runtime";
2
+ import { forwardRef as i, useState as y, useCallback as x, useEffect as E, createContext as H, useContext as p } from "react";
3
+ import d from "clsx";
4
4
  import { Input as m } from "../Input/index.js";
5
- import { Card as H } from "../Card/index.js";
5
+ import { Card as P } from "../Card/index.js";
6
6
  import { Button as v } from "../Button/index.js";
7
- import { faCaretDown as P } from "@fortawesome/fontawesome-free-solid";
8
- const d = E(null), w = i(
7
+ import { faCaretDown as R } from "@fortawesome/fontawesome-free-solid";
8
+ const u = H(null), w = i(
9
9
  ({
10
- id: l,
11
- open: a,
12
- defaultOpen: r,
10
+ id: o,
11
+ open: r,
12
+ defaultOpen: a,
13
13
  onOpenChange: t,
14
14
  onChange: e,
15
- className: c,
16
- children: s,
15
+ className: n,
16
+ children: c,
17
17
  loading: f,
18
- label: T,
19
- ...B
18
+ label: z,
19
+ placeholder: B,
20
+ ...D
20
21
  }) => {
21
- const [D, M] = x(a ?? r), [S, b] = x(""), N = y(
22
- (n) => {
23
- M(n), t == null || t(n);
22
+ const [M, V] = y(r ?? a), [S, b] = y(""), N = x(
23
+ (s) => {
24
+ V(s), t == null || t(s);
24
25
  },
25
26
  [t]
26
- ), V = {
27
+ ), h = {
27
28
  loading: f,
28
- label: T,
29
- open: D,
29
+ label: z,
30
+ placeholder: B,
31
+ open: M,
30
32
  setOpen: N,
31
33
  internalValue: S,
32
34
  setInternalValue: b
33
35
  };
34
- A(
35
- () => N(a ?? r ?? !1),
36
- [a, r, N]
36
+ E(
37
+ () => N(r ?? a ?? !1),
38
+ [r, a, N]
37
39
  );
38
- const z = y(
39
- (n) => {
40
- S.includes(n) ? (b(""), e == null || e("")) : (b(n), e == null || e(n));
40
+ const A = x(
41
+ (s) => {
42
+ alert(s), S.includes(s) ? (b(""), e == null || e("")) : (b(s), e == null || e(s));
41
43
  },
42
44
  [S, e]
43
45
  );
44
- return /* @__PURE__ */ o(d.Provider, { value: V, children: /* @__PURE__ */ I("div", { className: "grid gap-1", children: [
45
- /* @__PURE__ */ o(
46
- g,
46
+ return /* @__PURE__ */ l(u.Provider, { value: h, children: /* @__PURE__ */ I("div", { className: "relative", children: [
47
+ /* @__PURE__ */ l(
48
+ j,
47
49
  {
48
- id: l,
49
- className: c,
50
- onChange: () => z,
51
- ...B,
52
- children: s
50
+ id: o,
51
+ className: n,
52
+ onChange: () => A,
53
+ ...D,
54
+ children: c
53
55
  }
54
56
  ),
55
- /* @__PURE__ */ o(j, { children: s })
57
+ /* @__PURE__ */ l(k, { children: c })
56
58
  ] }) });
57
59
  }
58
- ), R = i(({ className: l, ...a }, r) => {
59
- const { open: t, setOpen: e } = p(d) || {};
60
- return /* @__PURE__ */ o(
60
+ ), W = i(({ className: o, ...r }, a) => {
61
+ const { open: t, setOpen: e } = p(u) || {};
62
+ return /* @__PURE__ */ l(
61
63
  v,
62
64
  {
63
- ref: r,
64
- className: l,
65
+ ref: a,
66
+ className: o,
65
67
  "aria-label": "toggle open",
66
68
  onClick: () => e == null ? void 0 : e(!t),
67
69
  variant: "ghost",
68
70
  size: "sm",
69
- ...a,
70
- children: /* @__PURE__ */ o(
71
+ ...r,
72
+ children: /* @__PURE__ */ l(
71
73
  v.Icon,
72
74
  {
73
- className: u("transition-transform duration-300 ease-in-out", {
75
+ className: d("transition-transform duration-300 ease-in-out", {
74
76
  "rotate-180 transform": t
75
77
  }),
76
- icon: P
78
+ icon: R
77
79
  }
78
80
  )
79
81
  }
80
82
  );
81
- }), L = i(({ className: l, children: a }, r) => /* @__PURE__ */ o(m.Label, { className: l, ref: r, children: a })), g = i(({ className: l }, a) => {
82
- const { open: r, setOpen: t, internalValue: e, label: c, handleChange: s } = p(d) || {};
83
+ }), L = i(({ className: o, children: r }, a) => /* @__PURE__ */ l(m.Label, { className: o, ref: a, children: r })), j = i(({ className: o, ...r }, a) => {
84
+ const { open: t, setOpen: e, internalValue: n, label: c, placeholder: f } = p(u) || {};
83
85
  return /* @__PURE__ */ I(
84
86
  m,
85
87
  {
86
- className: u(
87
- "w-full rounded-md bg-white caret-transparent ",
88
- l
89
- ),
88
+ className: d("w-full rounded-md caret-transparent ", o),
90
89
  ref: a,
91
- "data-open": r,
92
- placeholder: "boo",
93
- value: e ?? "",
94
- onChange: (f) => s == null ? void 0 : s(f.target.value),
90
+ "data-open": t,
91
+ placeholder: f,
92
+ value: n ?? "",
93
+ ...r,
95
94
  children: [
96
- /* @__PURE__ */ o(m.Label, { children: c }),
97
- /* @__PURE__ */ o(
95
+ /* @__PURE__ */ l(m.Label, { children: c }),
96
+ /* @__PURE__ */ l(
98
97
  m.Wrapper,
99
98
  {
100
- onClick: () => t == null ? void 0 : t(!r),
101
- onBlur: () => t == null ? void 0 : t(!1),
102
- className: u(
99
+ onClick: () => e == null ? void 0 : e(!t),
100
+ onBlur: () => e == null ? void 0 : e(!1),
101
+ className: d(
103
102
  "caret-transparent rounded hover:cursor-pointer data-[open=true]:border-primary data-[open=true]:ring-1 data-[open=true]:ring-primary",
104
- l
103
+ o
105
104
  ),
106
- children: /* @__PURE__ */ o(m.Actions, { children: /* @__PURE__ */ o(R, {}) })
105
+ children: /* @__PURE__ */ l(m.Actions, { children: /* @__PURE__ */ l(W, {}) })
107
106
  }
108
107
  )
109
108
  ]
110
109
  }
111
110
  );
112
- }), j = i(({ children: l, className: a, ...r }, t) => {
113
- const { open: e } = p(d) || {};
114
- return e ? /* @__PURE__ */ o(
115
- H,
111
+ }), k = i(({ children: o, className: r, ...a }, t) => {
112
+ const { open: e } = p(u) || {};
113
+ return e ? /* @__PURE__ */ l(
114
+ P,
116
115
  {
117
116
  ref: t,
118
- className: u(
119
- "!px-0 data-[state=open]:animate-in w-full data-[state=open]:fade-in-0",
120
- a
117
+ className: d(
118
+ "!rounded-md z-10 mt-0.5 absolute overflow-hidden !p-0 data-[state=open]:animate-in w-full data-[state=open]:fade-in-0",
119
+ r
121
120
  ),
122
- ...r,
123
- children: /* @__PURE__ */ o("ul", { children: l })
121
+ ...a,
122
+ children: /* @__PURE__ */ l("ul", { children: o })
124
123
  }
125
124
  ) : null;
126
- }), k = i(({ children: l, value: a, className: r, ...t }, e) => {
127
- const { setInternalValue: c } = p(d) || {};
128
- return /* @__PURE__ */ o(
125
+ }), T = i(({ children: o, value: r, className: a, ...t }, e) => {
126
+ const { setInternalValue: n } = p(u) || {};
127
+ return /* @__PURE__ */ l(
129
128
  "li",
130
129
  {
131
130
  ref: e,
132
- className: u(
131
+ className: d(
133
132
  "hover:cursor-pointer hover:bg-gray-100 w-full py-2 px-4",
134
- r
133
+ a
135
134
  ),
136
- value: a,
137
- onMouseDown: (s) => c == null ? void 0 : c(s.target.innerHTML),
135
+ value: r,
136
+ onMouseDown: (c) => n == null ? void 0 : n(c.target.innerHTML),
138
137
  ...t,
139
- children: l
138
+ children: o
140
139
  }
141
140
  );
142
141
  });
143
142
  w.displayName = "Select";
144
- j.displayName = "Select.Content";
145
- g.displayName = "Select.Trigger";
146
- k.displayName = "Select.Item";
143
+ k.displayName = "Select.Content";
144
+ j.displayName = "Select.Trigger";
145
+ T.displayName = "Select.Item";
147
146
  L.displayName = "Select.Label";
148
- const Q = Object.assign(w, {
149
- Item: k,
147
+ const U = Object.assign(w, {
148
+ Item: T,
150
149
  Label: L
151
150
  });
152
151
  export {
153
- Q as Select
152
+ U as Select
154
153
  };
@@ -6,7 +6,7 @@ body.theme-paa {
6
6
  --color-loading: #a3a3a3;
7
7
 
8
8
  /* pill */
9
- --color-error-default: #ffffff;
9
+ --color-error-default: #b91c1c;
10
10
  --color-warning-default: #a16207;
11
11
  --color-success-default: #047857;
12
12
  --color-info-default: #0369a1;
@@ -20,13 +20,13 @@ body.theme-paa {
20
20
  --color-button-primary-active: #68a97b;
21
21
  --color-button-primary-border: #68a97b;
22
22
  --color-button-primary-bg: #68a97b;
23
- --color-button-primary-text: #68a97b;
23
+ --color-button-primary-text: #1d341e;
24
24
  --color-button-primary-hover: #68a97b;
25
25
 
26
26
  --color-button-secondary-active: #1d341e;
27
27
  --color-button-secondary-border: #1d341e;
28
28
  --color-button-secondary-bg: #1d341e;
29
- --color-button-secondary-text: #1d341e;
29
+ --color-button-secondary-text: #ede9d3;
30
30
  --color-button-secondary-hover: #1d341e;
31
31
 
32
32
  --color-button-ghost-active: #242424;
@@ -6,7 +6,7 @@ body.theme-penrithmrt {
6
6
  --color-loading: #a3a3a3;
7
7
 
8
8
  /* pill */
9
- --color-error-default: #ffffff;
9
+ --color-error-default: #b91c1c;
10
10
  --color-warning-default: #a16207;
11
11
  --color-success-default: #047857;
12
12
  --color-info-default: #0369a1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trepur_components",
3
- "version": "2.4.5",
3
+ "version": "2.4.7",
4
4
  "description": "component lib",
5
5
  "author": "trepur_ttenneb",
6
6
  "private": false,