trepur_components 2.4.7 → 2.4.8

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,15 +4,18 @@ import { Input } from '.';
4
4
  declare const meta: {
5
5
  title: string;
6
6
  component: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLDivElement> & import('.').InputContextProps & import('react').RefAttributes<HTMLDivElement>> & {
7
- Label: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLDivElement> & {
7
+ Label: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLLabelElement> & {
8
8
  required?: boolean;
9
- } & import('react').RefAttributes<HTMLDivElement>>;
9
+ } & import('react').RefAttributes<HTMLLabelElement>>;
10
10
  Validation: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLDivElement> & import('react').RefAttributes<HTMLDivElement>>;
11
11
  Actions: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLDivElement> & import('react').RefAttributes<HTMLDivElement>>;
12
- Wrapper: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLInputElement> & import('.').InputContextProps & import('react').RefAttributes<HTMLInputElement>>;
12
+ Wrapper: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLInputElement> & {
13
+ handleChange?: (e: any) => void;
14
+ } & import('react').RefAttributes<HTMLInputElement>>;
13
15
  };
14
16
  args: {
15
17
  placeholder: string;
18
+ id: string;
16
19
  children: import("react/jsx-runtime").JSX.Element[];
17
20
  };
18
21
  };
@@ -1,6 +1,7 @@
1
1
  import { HTMLAttributes } from 'react';
2
2
 
3
3
  export interface InputContextProps {
4
+ id: string;
4
5
  autoComplete?: string;
5
6
  disabled?: boolean;
6
7
  formId?: string;
@@ -23,11 +24,13 @@ export interface InputContextProps {
23
24
  value?: string;
24
25
  }
25
26
  declare const Input: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & InputContextProps & import('react').RefAttributes<HTMLDivElement>> & {
26
- Label: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
27
+ Label: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLLabelElement> & {
27
28
  required?: boolean;
28
- } & import('react').RefAttributes<HTMLDivElement>>;
29
+ } & import('react').RefAttributes<HTMLLabelElement>>;
29
30
  Validation: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import('react').RefAttributes<HTMLDivElement>>;
30
31
  Actions: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import('react').RefAttributes<HTMLDivElement>>;
31
- Wrapper: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLInputElement> & InputContextProps & import('react').RefAttributes<HTMLInputElement>>;
32
+ Wrapper: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLInputElement> & {
33
+ handleChange?: (e: any) => void;
34
+ } & import('react').RefAttributes<HTMLInputElement>>;
32
35
  };
33
36
  export { Input };
@@ -1,114 +1,107 @@
1
- import { jsx as n, jsxs as s } from "react/jsx-runtime";
2
- import { forwardRef as o, useMemo as v, createContext as h, useContext as p } from "react";
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(
1
+ import { jsx as l, jsxs as c } from "react/jsx-runtime";
2
+ import { forwardRef as n, useMemo as w, createContext as j, useContext as x } from "react";
3
+ import s from "clsx";
4
+ import { Icon as A } from "../Icon/index.js";
5
+ import { faCircleExclamation as L } from "@fortawesome/free-solid-svg-icons";
6
+ const u = j(null), f = n(({ id: e, children: r, className: t, errors: a, placeholder: i, ...o }, d) => {
7
+ const p = w(
8
8
  () => ({
9
- errors: t,
10
- placeholder: l,
11
- ...e
9
+ id: e,
10
+ errors: a,
11
+ placeholder: i,
12
+ ...o
12
13
  }),
13
- [t, e]
14
+ [a, o]
14
15
  );
15
- return /* @__PURE__ */ n(u.Provider, { value: d, children: /* @__PURE__ */ n(
16
+ return /* @__PURE__ */ l(u.Provider, { value: p, children: /* @__PURE__ */ l(
16
17
  "div",
17
18
  {
18
- ref: m,
19
- className: i("grid grid-cols-1 gap-1 w-full rounded-md", a),
20
- ...e,
19
+ ref: d,
20
+ className: s("grid grid-cols-1 gap-1 w-full rounded-md", t),
21
+ ...o,
21
22
  children: r
22
23
  }
23
24
  ) });
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: [
27
- /* @__PURE__ */ n(
25
+ }), b = n(({ className: e, children: r, handleChange: t, onClick: a, onBlur: i, ...o }, d) => {
26
+ const { id: p, placeholder: y, value: g, errors: m } = x(u) || {};
27
+ return /* @__PURE__ */ c("div", { ref: d, className: "group/input relative isolate flex w-full", children: [
28
+ /* @__PURE__ */ l(
28
29
  "input",
29
30
  {
30
- placeholder: d,
31
- className: i(
31
+ id: p,
32
+ placeholder: y,
33
+ className: s(
32
34
  "h-10 border border-black rounded-md flex w-full bg-card px-3 py-1.5 text-sm placeholder:text-gray-500",
33
35
  {
34
- "border-border border": !c,
35
- "border-red-600 border-2": c
36
- }
36
+ "border-border border": !m,
37
+ "border-red-600 border-2": m
38
+ },
39
+ e
37
40
  ),
38
- value: I,
39
- readOnly: e.readOnly,
40
- disabled: e.disabled,
41
- autoComplete: e.autoComplete,
42
- form: e.formId,
43
- maxLength: e.maxLength,
44
- minLength: e.minLength,
45
- pattern: e.pattern,
46
- required: e.required,
47
- type: e.type,
48
- name: e.name,
49
- onChange: (g) => a == null ? void 0 : a(g.target.value),
50
- onClick: t,
51
- onBlur: l,
52
- onFocus: e.onFocus
41
+ value: g,
42
+ onChange: (h) => t == null ? void 0 : t(h.target.value),
43
+ onClick: a,
44
+ onBlur: i,
45
+ ...o
53
46
  }
54
47
  ),
55
48
  r
56
49
  ] });
57
- }), b = o(
58
- ({ className: r, children: a }, t) => /* @__PURE__ */ n(
50
+ }), I = n(
51
+ ({ className: e, children: r }, t) => /* @__PURE__ */ l(
59
52
  "div",
60
53
  {
61
54
  ref: t,
62
- className: i(
55
+ className: s(
63
56
  "absolute right-1 top-1/2 my-auto -translate-y-1/2",
64
- r
57
+ e
65
58
  ),
66
- children: a
59
+ children: r
67
60
  }
68
61
  )
69
- ), y = o(({ className: r, children: a, required: t = !1 }, l) => /* @__PURE__ */ s(
70
- "div",
62
+ ), N = n(({ id: e, className: r, children: t, required: a }) => /* @__PURE__ */ c(
63
+ "label",
71
64
  {
72
- ref: l,
73
- className: i("flex px-1 text-sm font-normal leading-5", r),
65
+ htmlFor: e,
66
+ className: s("flex px-1 text-md font-normal leading-5", r),
74
67
  children: [
75
- /* @__PURE__ */ n("p", { children: a }),
76
- t && /* @__PURE__ */ n("p", { className: "text-sm font-normal", children: "*" })
68
+ t,
69
+ a && /* @__PURE__ */ l("span", { children: "*" })
77
70
  ]
78
71
  }
79
- )), N = o(({ ...r }, a) => {
80
- const { errors: t } = p(u) || {};
81
- return t ? /* @__PURE__ */ n(
72
+ )), v = n(({ ...e }, r) => {
73
+ const { errors: t } = x(u) || {};
74
+ return t ? /* @__PURE__ */ l(
82
75
  "div",
83
76
  {
84
- ref: a,
77
+ ref: r,
85
78
  className: "text-sm pl-1 font-medium text-error-default",
86
- ...r,
87
- children: t == null ? void 0 : t.map((l, e) => /* @__PURE__ */ s("div", { className: "gap-1 flex", children: [
88
- /* @__PURE__ */ n(
89
- L,
79
+ ...e,
80
+ children: t == null ? void 0 : t.map((a) => /* @__PURE__ */ c("div", { className: "text-xs gap-1 flex", children: [
81
+ /* @__PURE__ */ l(
82
+ A,
90
83
  {
84
+ size: "xs",
91
85
  className: "my-auto text-error-default",
92
- icon: w,
93
- co: !0
86
+ icon: L
94
87
  }
95
88
  ),
96
- /* @__PURE__ */ n("span", { className: "my-auto", children: l }, `error-msg-${e + 1}`)
89
+ /* @__PURE__ */ l("span", { children: a }, `error-msg:${a.replace(" ", "_")}`)
97
90
  ] }))
98
91
  }
99
92
  ) : null;
100
93
  });
101
94
  f.displayName = "Input";
102
- b.displayName = "Input.Actions";
103
- y.displayName = "Input.Label";
104
- N.displayName = "Input.Validation";
105
- x.displayName = "Input.Wrapper";
106
- const W = Object.assign(f, {
107
- Label: y,
108
- Validation: N,
109
- Actions: b,
110
- Wrapper: x
95
+ I.displayName = "Input.Actions";
96
+ N.displayName = "Input.Label";
97
+ v.displayName = "Input.Validation";
98
+ b.displayName = "Input.Wrapper";
99
+ const E = Object.assign(f, {
100
+ Label: N,
101
+ Validation: v,
102
+ Actions: I,
103
+ Wrapper: b
111
104
  });
112
105
  export {
113
- W as Input
106
+ E as Input
114
107
  };
@@ -4,15 +4,14 @@ import { Select } from '.';
4
4
  declare const meta: {
5
5
  title: string;
6
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
- Item: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLLIElement> & {
8
- value: string;
9
- } & import('react').RefAttributes<HTMLLIElement>>;
10
- Label: import('react').ForwardRefExoticComponent<Omit<import('react').HTMLAttributes<HTMLDivElement> & {
7
+ Item: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLLIElement> & import('react').RefAttributes<HTMLLIElement>>;
8
+ Label: import('react').ForwardRefExoticComponent<Omit<import('react').HTMLAttributes<HTMLLabelElement> & {
11
9
  required?: boolean;
12
- } & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
10
+ } & import('react').RefAttributes<HTMLLabelElement>, "ref"> & import('react').RefAttributes<HTMLLabelElement>>;
13
11
  };
14
12
  parameters: {};
15
13
  args: {
14
+ id: string;
16
15
  label: string;
17
16
  placeholder: string;
18
17
  children: import("react/jsx-runtime").JSX.Element[];
@@ -14,11 +14,9 @@ export interface SelectContextProps {
14
14
  handleChange?: (e: any) => void;
15
15
  }
16
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>> & {
17
- Item: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLLIElement> & {
18
- value: string;
19
- } & import('react').RefAttributes<HTMLLIElement>>;
20
- Label: import('react').ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement> & {
17
+ Item: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLLIElement> & import('react').RefAttributes<HTMLLIElement>>;
18
+ Label: import('react').ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLLabelElement> & {
21
19
  required?: boolean;
22
- } & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
20
+ } & import('react').RefAttributes<HTMLLabelElement>, "ref"> & import('react').RefAttributes<HTMLLabelElement>>;
23
21
  };
24
22
  export { Select };
@@ -1,152 +1,159 @@
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";
1
+ import { jsx as l, jsxs as L } from "react/jsx-runtime";
2
+ import { forwardRef as s, useState as I, useCallback as v, useEffect as A, createContext as H, useContext as p } from "react";
3
3
  import d from "clsx";
4
- import { Input as m } from "../Input/index.js";
5
- import { Card as P } from "../Card/index.js";
6
- import { Button as v } from "../Button/index.js";
7
- import { faCaretDown as R } from "@fortawesome/fontawesome-free-solid";
8
- const u = H(null), w = i(
4
+ import { Input as i } from "../Input/index.js";
5
+ import { Card as K } from "../Card/index.js";
6
+ import { Button as w } from "../Button/index.js";
7
+ import { faCaretDown as P } from "@fortawesome/fontawesome-free-solid";
8
+ const m = H(null), k = s(
9
9
  ({
10
- id: o,
11
- open: r,
12
- defaultOpen: a,
13
- onOpenChange: t,
10
+ id: n,
11
+ open: t,
12
+ defaultOpen: r,
13
+ onOpenChange: a,
14
14
  onChange: e,
15
- className: n,
16
- children: c,
15
+ className: o,
16
+ children: u,
17
17
  loading: f,
18
- label: z,
19
- placeholder: B,
20
- ...D
18
+ label: b,
19
+ placeholder: S,
20
+ ...B
21
21
  }) => {
22
- const [M, V] = y(r ?? a), [S, b] = y(""), N = x(
23
- (s) => {
24
- V(s), t == null || t(s);
22
+ const [E, M] = I(t ?? r), [y, x] = I(""), N = v(
23
+ (c) => {
24
+ M(c), a == null || a(c);
25
25
  },
26
- [t]
27
- ), h = {
26
+ [a]
27
+ ), V = {
28
28
  loading: f,
29
- label: z,
30
- placeholder: B,
31
- open: M,
29
+ label: b,
30
+ placeholder: S,
31
+ open: E,
32
32
  setOpen: N,
33
- internalValue: S,
34
- setInternalValue: b
33
+ internalValue: y,
34
+ setInternalValue: x
35
35
  };
36
- E(
37
- () => N(r ?? a ?? !1),
38
- [r, a, N]
36
+ A(
37
+ () => N(t ?? r ?? !1),
38
+ [t, r, N]
39
39
  );
40
- const A = x(
41
- (s) => {
42
- alert(s), S.includes(s) ? (b(""), e == null || e("")) : (b(s), e == null || e(s));
40
+ const h = v(
41
+ (c) => {
42
+ alert(c), y.includes(c) ? (x(""), e == null || e("")) : (x(c), e == null || e(c));
43
43
  },
44
- [S, e]
44
+ [y, e]
45
45
  );
46
- return /* @__PURE__ */ l(u.Provider, { value: h, children: /* @__PURE__ */ I("div", { className: "relative", children: [
46
+ return /* @__PURE__ */ l(m.Provider, { value: V, children: /* @__PURE__ */ L("div", { className: "relative", children: [
47
47
  /* @__PURE__ */ l(
48
- j,
48
+ D,
49
49
  {
50
- id: o,
51
- className: n,
52
- onChange: () => A,
53
- ...D,
54
- children: c
50
+ id: n,
51
+ className: o,
52
+ onChange: () => h,
53
+ ...B,
54
+ children: u
55
55
  }
56
56
  ),
57
- /* @__PURE__ */ l(k, { children: c })
57
+ /* @__PURE__ */ l(T, { children: u })
58
58
  ] }) });
59
59
  }
60
- ), W = i(({ className: o, ...r }, a) => {
61
- const { open: t, setOpen: e } = p(u) || {};
60
+ ), R = s(({ className: n, ...t }, r) => {
61
+ const { open: a, setOpen: e } = p(m) || {};
62
62
  return /* @__PURE__ */ l(
63
- v,
63
+ w,
64
64
  {
65
- ref: a,
66
- className: o,
65
+ tabIndex: -1,
66
+ ref: r,
67
+ className: n,
67
68
  "aria-label": "toggle open",
68
- onClick: () => e == null ? void 0 : e(!t),
69
+ onClick: () => e == null ? void 0 : e(!a),
69
70
  variant: "ghost",
70
71
  size: "sm",
71
- ...r,
72
+ ...t,
72
73
  children: /* @__PURE__ */ l(
73
- v.Icon,
74
+ w.Icon,
74
75
  {
75
76
  className: d("transition-transform duration-300 ease-in-out", {
76
- "rotate-180 transform": t
77
+ "rotate-180 transform": a
77
78
  }),
78
- icon: R
79
+ icon: P
79
80
  }
80
81
  )
81
82
  }
82
83
  );
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) || {};
85
- return /* @__PURE__ */ I(
86
- m,
84
+ }), j = s(({ className: n, children: t }, r) => /* @__PURE__ */ l(i.Label, { className: n, ref: r, children: t })), D = s(({ id: n, className: t, ...r }, a) => {
85
+ const { open: e, setOpen: o, internalValue: u, label: f, placeholder: b } = p(m) || {};
86
+ return /* @__PURE__ */ L(
87
+ i,
87
88
  {
88
- className: d("w-full rounded-md caret-transparent ", o),
89
+ id: n,
90
+ className: d("w-full rounded-md caret-transparent ", t),
89
91
  ref: a,
90
- "data-open": t,
91
- placeholder: f,
92
- value: n ?? "",
92
+ "data-open": e,
93
+ placeholder: b,
94
+ value: u ?? "",
93
95
  ...r,
94
96
  children: [
95
- /* @__PURE__ */ l(m.Label, { children: c }),
97
+ /* @__PURE__ */ l(i.Label, { children: f }),
96
98
  /* @__PURE__ */ l(
97
- m.Wrapper,
99
+ i.Wrapper,
98
100
  {
99
- onClick: () => e == null ? void 0 : e(!t),
100
- onBlur: () => e == null ? void 0 : e(!1),
101
+ onClick: () => o == null ? void 0 : o(!e),
102
+ onBlur: () => o == null ? void 0 : o(!1),
101
103
  className: d(
102
104
  "caret-transparent rounded hover:cursor-pointer data-[open=true]:border-primary data-[open=true]:ring-1 data-[open=true]:ring-primary",
103
- o
105
+ t
104
106
  ),
105
- children: /* @__PURE__ */ l(m.Actions, { children: /* @__PURE__ */ l(W, {}) })
107
+ onKeyDown: (S) => {
108
+ S.key === "Enter" && (o == null || o(!e));
109
+ },
110
+ children: /* @__PURE__ */ l(i.Actions, { children: /* @__PURE__ */ l(R, {}) })
106
111
  }
107
112
  )
108
113
  ]
109
114
  }
110
115
  );
111
- }), k = i(({ children: o, className: r, ...a }, t) => {
112
- const { open: e } = p(u) || {};
116
+ }), T = s(({ children: n, className: t, ...r }, a) => {
117
+ const { open: e } = p(m) || {};
113
118
  return e ? /* @__PURE__ */ l(
114
- P,
119
+ K,
115
120
  {
116
- ref: t,
121
+ ref: a,
117
122
  className: d(
118
123
  "!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
124
+ t
120
125
  ),
121
- ...a,
122
- children: /* @__PURE__ */ l("ul", { children: o })
126
+ ...r,
127
+ children: /* @__PURE__ */ l("ul", { children: n })
123
128
  }
124
129
  ) : null;
125
- }), T = i(({ children: o, value: r, className: a, ...t }, e) => {
126
- const { setInternalValue: n } = p(u) || {};
127
- return /* @__PURE__ */ l(
128
- "li",
129
- {
130
- ref: e,
131
- className: d(
132
- "hover:cursor-pointer hover:bg-gray-100 w-full py-2 px-4",
133
- a
134
- ),
135
- value: r,
136
- onMouseDown: (c) => n == null ? void 0 : n(c.target.innerHTML),
137
- ...t,
138
- children: o
139
- }
140
- );
141
- });
142
- w.displayName = "Select";
143
- k.displayName = "Select.Content";
144
- j.displayName = "Select.Trigger";
145
- T.displayName = "Select.Item";
146
- L.displayName = "Select.Label";
147
- const U = Object.assign(w, {
148
- Item: T,
149
- Label: L
130
+ }), z = s(
131
+ ({ children: n, className: t, ...r }, a) => {
132
+ const { setInternalValue: e } = p(m) || {};
133
+ return /* @__PURE__ */ l(
134
+ "li",
135
+ {
136
+ tabIndex: 1,
137
+ ref: a,
138
+ className: d(
139
+ "hover:cursor-pointer hover:bg-gray-100 w-full py-2 px-4",
140
+ t
141
+ ),
142
+ onMouseDown: (o) => e == null ? void 0 : e(o.target.innerHTML),
143
+ ...r,
144
+ children: n
145
+ }
146
+ );
147
+ }
148
+ );
149
+ k.displayName = "Select";
150
+ T.displayName = "Select.Content";
151
+ D.displayName = "Select.Trigger";
152
+ z.displayName = "Select.Item";
153
+ j.displayName = "Select.Label";
154
+ const U = Object.assign(k, {
155
+ Item: z,
156
+ Label: j
150
157
  });
151
158
  export {
152
159
  U as Select
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trepur_components",
3
- "version": "2.4.7",
3
+ "version": "2.4.8",
4
4
  "description": "component lib",
5
5
  "author": "trepur_ttenneb",
6
6
  "private": false,