@pnkx-lib/ui 1.9.4 → 1.9.5

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.
@@ -1,5 +1,5 @@
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';
1
+ import { g as get, j as jsxRuntimeExports, L as Label, E as ErrorMessage, T as Typography } from './Switch-eMq9KkOy.js';
2
+ import { Select as Select$1, Radio, Checkbox } from 'antd';
3
3
 
4
4
  const Select = (props) => {
5
5
  //! State
@@ -100,4 +100,53 @@ const RadioGroup = (props) => {
100
100
  ] });
101
101
  };
102
102
 
103
- export { RadioGroup as R, Select as S };
103
+ const CheckboxField = (props) => {
104
+ //! State
105
+ const {
106
+ field,
107
+ formState,
108
+ label,
109
+ afterOnChange,
110
+ customStyleContainer,
111
+ customStyleCheckbox,
112
+ ...restProps
113
+ } = props;
114
+ const { name, value, onChange, onBlur } = field || {};
115
+ const { touchedFields, errors, isSubmitted } = formState || {};
116
+ const isTouched = get(touchedFields, name);
117
+ const errorMessage = get(errors, name)?.message;
118
+ //! Function
119
+ const handleChange = (e) => {
120
+ const checked = e.target.checked;
121
+ onChange?.(checked);
122
+ afterOnChange?.(checked);
123
+ };
124
+ const renderErrorMessage = () => {
125
+ if (!errorMessage) return null;
126
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
127
+ ErrorMessage,
128
+ {
129
+ errorMessage,
130
+ isTouched,
131
+ isSubmitted
132
+ }
133
+ );
134
+ };
135
+ //! Render
136
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: customStyleContainer, children: [
137
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
138
+ Checkbox,
139
+ {
140
+ onBlur,
141
+ checked: !!value,
142
+ onChange: handleChange,
143
+ className: customStyleCheckbox,
144
+ ...restProps,
145
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Typography.Text, { children: label })
146
+ }
147
+ ),
148
+ renderErrorMessage()
149
+ ] });
150
+ };
151
+
152
+ export { CheckboxField as C, RadioGroup as R, Select as S };