@pnkx-lib/ui 1.3.5 → 1.3.6

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.
@@ -0,0 +1,127 @@
1
+ import { g as m, j as s, L as E, E as M, T as C } from "./Switch-C9zRQPNY.js";
2
+ import { Select as N, Radio as k, Checkbox as R } from "antd";
3
+ const B = (h) => {
4
+ //! State
5
+ var e;
6
+ const {
7
+ field: x,
8
+ formState: p,
9
+ label: d,
10
+ required: n,
11
+ afterOnChange: o,
12
+ customStyleContainer: g,
13
+ ...j
14
+ } = h, { name: t, value: S, onChange: r, onBlur: b } = x || {}, { touchedFields: v, errors: f, isSubmitted: i } = p || {}, a = m(v, t), c = (e = m(f, t)) == null ? void 0 : e.message;
15
+ //! Function
16
+ const y = (l) => {
17
+ r == null || r(l), o == null || o(l);
18
+ }, u = () => c ? /* @__PURE__ */ s.jsx(
19
+ M,
20
+ {
21
+ errorMessage: c,
22
+ isTouched: a,
23
+ isSubmitted: i
24
+ }
25
+ ) : null;
26
+ //! Render
27
+ return /* @__PURE__ */ s.jsxs("div", { className: g, children: [
28
+ d && /* @__PURE__ */ s.jsx(E, { label: d, required: n }),
29
+ /* @__PURE__ */ s.jsx(
30
+ N,
31
+ {
32
+ onChange: y,
33
+ onBlur: b,
34
+ value: S,
35
+ style: { width: "100%" },
36
+ optionLabelProp: "label",
37
+ status: (a || i) && c ? "error" : void 0,
38
+ ...j
39
+ }
40
+ ),
41
+ u()
42
+ ] });
43
+ }, L = (h) => {
44
+ //! State
45
+ var u;
46
+ const {
47
+ field: x,
48
+ formState: p,
49
+ customStyleRadio: d,
50
+ customStyleWrap: n = "",
51
+ afterOnChange: o,
52
+ options: g,
53
+ ...j
54
+ } = h, { name: t, value: S, onChange: r } = x || {}, { touchedFields: b, errors: v, isSubmitted: f } = p || {}, i = m(b, t), a = (u = m(v, t)) == null ? void 0 : u.message;
55
+ //! Function
56
+ const c = (e) => {
57
+ var l;
58
+ r == null || r(e), o == null || o((l = e == null ? void 0 : e.target) == null ? void 0 : l.value);
59
+ }, y = () => a ? /* @__PURE__ */ s.jsx(
60
+ M,
61
+ {
62
+ errorMessage: a,
63
+ isTouched: i,
64
+ isSubmitted: f
65
+ }
66
+ ) : null;
67
+ //! Render
68
+ return /* @__PURE__ */ s.jsxs("div", { className: n, children: [
69
+ /* @__PURE__ */ s.jsx(k.Group, { onChange: c, value: S, ...j, children: g.map((e) => /* @__PURE__ */ s.jsx(
70
+ k,
71
+ {
72
+ value: e.value,
73
+ className: d,
74
+ children: /* @__PURE__ */ s.jsxs(C.Text, { children: [
75
+ " ",
76
+ e.label
77
+ ] })
78
+ },
79
+ `${t}-${e.value}`
80
+ )) }),
81
+ y()
82
+ ] });
83
+ }, $ = (h) => {
84
+ //! State
85
+ var e;
86
+ const {
87
+ field: x,
88
+ formState: p,
89
+ label: d,
90
+ afterOnChange: n,
91
+ customStyleContainer: o,
92
+ customStyleCheckbox: g,
93
+ ...j
94
+ } = h, { name: t, value: S, onChange: r, onBlur: b } = x || {}, { touchedFields: v, errors: f, isSubmitted: i } = p || {}, a = m(v, t), c = (e = m(f, t)) == null ? void 0 : e.message;
95
+ //! Function
96
+ const y = (l) => {
97
+ const T = l.target.checked;
98
+ r == null || r(T), n == null || n(T);
99
+ }, u = () => c ? /* @__PURE__ */ s.jsx(
100
+ M,
101
+ {
102
+ errorMessage: c,
103
+ isTouched: a,
104
+ isSubmitted: i
105
+ }
106
+ ) : null;
107
+ //! Render
108
+ return /* @__PURE__ */ s.jsxs("div", { className: o, children: [
109
+ /* @__PURE__ */ s.jsx(
110
+ R,
111
+ {
112
+ onBlur: b,
113
+ checked: !!S,
114
+ onChange: y,
115
+ className: g,
116
+ ...j,
117
+ children: /* @__PURE__ */ s.jsx(C.Text, { children: d })
118
+ }
119
+ ),
120
+ u()
121
+ ] });
122
+ };
123
+ export {
124
+ $ as C,
125
+ L as R,
126
+ B as S
127
+ };