@pnkx-lib/ui 1.9.22 → 1.9.23
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/dist/style.css +2 -0
- package/es/assets/ui-Jiyqh2vu.css +820 -0
- package/es/chunks/CategoryStatus-DwWppmup.js +17354 -0
- package/es/chunks/Radio-D2me1zZ-.js +103 -0
- package/es/chunks/Switch-za5Skgtp.js +39387 -0
- package/es/chunks/cloneDeep-BLYi2V0G.js +2421 -0
- package/es/chunks/common-b3FKGF0Y.js +1261 -0
- package/es/chunks/useMessage-D_-VT5B4.js +94 -0
- package/es/fields/index.js +2 -0
- package/es/hooks/index.js +2 -0
- package/es/index.js +6 -0
- package/es/ui/index.js +3 -0
- package/es/vite.svg +1 -0
- package/package.json +1 -1
- package/types/fields.d.ts +193 -0
- package/types/hooks.d.ts +38 -0
- package/types/index.d.ts +806 -0
- package/types/ui.d.ts +584 -0
@@ -0,0 +1,103 @@
|
|
1
|
+
import { g as get, j as jsxRuntimeExports, L as Label, E as ErrorMessage, T as Typography } from './Switch-za5Skgtp.js';
|
2
|
+
import { Select as Select$1, Radio } from 'antd';
|
3
|
+
|
4
|
+
const Select = (props) => {
|
5
|
+
//! State
|
6
|
+
const {
|
7
|
+
field,
|
8
|
+
formState,
|
9
|
+
label,
|
10
|
+
required,
|
11
|
+
afterOnChange,
|
12
|
+
customStyleContainer,
|
13
|
+
...restProps
|
14
|
+
} = props;
|
15
|
+
const { name, value, onChange, onBlur } = field || {};
|
16
|
+
const { touchedFields, errors, isSubmitted } = formState || {};
|
17
|
+
const isTouched = get(touchedFields, name);
|
18
|
+
const errorMessage = get(errors, name)?.message;
|
19
|
+
//! Function
|
20
|
+
const handleChange = (val) => {
|
21
|
+
onChange?.(val);
|
22
|
+
afterOnChange?.(val);
|
23
|
+
};
|
24
|
+
const renderErrorMessage = () => {
|
25
|
+
if (!errorMessage) return null;
|
26
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
27
|
+
ErrorMessage,
|
28
|
+
{
|
29
|
+
errorMessage,
|
30
|
+
isTouched,
|
31
|
+
isSubmitted
|
32
|
+
}
|
33
|
+
);
|
34
|
+
};
|
35
|
+
//! Render
|
36
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: customStyleContainer, children: [
|
37
|
+
label && /* @__PURE__ */ jsxRuntimeExports.jsx(Label, { label, required }),
|
38
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
39
|
+
Select$1,
|
40
|
+
{
|
41
|
+
onChange: handleChange,
|
42
|
+
onBlur,
|
43
|
+
value,
|
44
|
+
style: { width: "100%" },
|
45
|
+
optionLabelProp: "label",
|
46
|
+
status: (isTouched || isSubmitted) && Boolean(errorMessage) ? "error" : void 0,
|
47
|
+
...restProps
|
48
|
+
}
|
49
|
+
),
|
50
|
+
renderErrorMessage()
|
51
|
+
] });
|
52
|
+
};
|
53
|
+
|
54
|
+
const RadioGroup = (props) => {
|
55
|
+
//! State
|
56
|
+
const {
|
57
|
+
field,
|
58
|
+
formState,
|
59
|
+
customStyleRadio,
|
60
|
+
customStyleWrap = "",
|
61
|
+
afterOnChange,
|
62
|
+
options,
|
63
|
+
...restProps
|
64
|
+
} = props;
|
65
|
+
const { name, value, onChange } = field || {};
|
66
|
+
const { touchedFields, errors, isSubmitted } = formState || {};
|
67
|
+
const isTouched = get(touchedFields, name);
|
68
|
+
const errorMessage = get(errors, name)?.message;
|
69
|
+
//! Function
|
70
|
+
const handleChange = (e) => {
|
71
|
+
onChange?.(e);
|
72
|
+
afterOnChange?.(e?.target?.value);
|
73
|
+
};
|
74
|
+
const renderErrorMessage = () => {
|
75
|
+
if (!errorMessage) return null;
|
76
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
77
|
+
ErrorMessage,
|
78
|
+
{
|
79
|
+
errorMessage,
|
80
|
+
isTouched,
|
81
|
+
isSubmitted
|
82
|
+
}
|
83
|
+
);
|
84
|
+
};
|
85
|
+
//! Render
|
86
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: customStyleWrap, children: [
|
87
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Radio.Group, { onChange: handleChange, value, ...restProps, children: options.map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
88
|
+
Radio,
|
89
|
+
{
|
90
|
+
value: item.value,
|
91
|
+
className: customStyleRadio,
|
92
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography.Text, { children: [
|
93
|
+
" ",
|
94
|
+
item.label
|
95
|
+
] })
|
96
|
+
},
|
97
|
+
`${name}-${item.value}`
|
98
|
+
)) }),
|
99
|
+
renderErrorMessage()
|
100
|
+
] });
|
101
|
+
};
|
102
|
+
|
103
|
+
export { RadioGroup as R, Select as S };
|