@addsign/moje-agenda-shared-lib 2.0.14 → 2.0.16
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/Dialog-BmQoVu5C.js +424 -0
- package/dist/Dialog-BmQoVu5C.js.map +1 -0
- package/dist/assets/style.css +5 -50
- package/dist/components/datatable/DataTable.js +1 -2
- package/dist/components/datatable/DataTable.js.map +1 -1
- package/dist/components/datatable/DataTableServer.js +1 -2
- package/dist/components/datatable/DataTableServer.js.map +1 -1
- package/dist/components/form/AutocompleteSearchBar.js +1 -2
- package/dist/components/form/AutocompleteSearchBar.js.map +1 -1
- package/dist/components/form/AutocompleteSearchBarServer.js +1 -2
- package/dist/components/form/AutocompleteSearchBarServer.js.map +1 -1
- package/dist/components/form/DateField.js +1 -1
- package/dist/components/form/DateField.js.map +1 -1
- package/dist/components/form/DateRangeField.js +1 -1
- package/dist/components/form/DateRangeField.js.map +1 -1
- package/dist/components/form/FileInput.js +2 -3
- package/dist/components/form/FileInput.js.map +1 -1
- package/dist/components/form/FileInputMultiple.js +2 -3
- package/dist/components/form/FileInputMultiple.js.map +1 -1
- package/dist/components/form/FormField.js +1 -2
- package/dist/components/form/FormField.js.map +1 -1
- package/dist/components/form/InputField.js +2 -2
- package/dist/components/form/InputField.js.map +1 -1
- package/dist/components/form/PositionsSelectorSingle.js +1 -2
- package/dist/components/form/PositionsSelectorSingle.js.map +1 -1
- package/dist/components/form/SelectField.js +1 -2
- package/dist/components/form/SelectField.js.map +1 -1
- package/dist/components/profiles/ProfileOverview.js +1 -2
- package/dist/components/profiles/ProfileOverview.js.map +1 -1
- package/dist/components/ui/Combobox.js +1 -1
- package/dist/components/ui/DateTimePicker.js +1 -1
- package/dist/components/ui/Dialog.js +1 -1
- package/dist/components/ui/ScrollArea.js +1 -1
- package/dist/components/ui/checkbox.js +1 -1
- package/dist/components/ui/command.js +2 -2
- package/dist/components/ui/datepicker.js +1 -1
- package/dist/components/ui/input.js +12 -8
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/label.js +1 -1
- package/dist/components/ui/popover.js +1 -1
- package/dist/components/ui/radioGroup.js +1 -1
- package/dist/components/ui/select.js +6 -7
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/separator.js +1 -1
- package/dist/components/ui/sonner.js +9 -5
- package/dist/components/ui/sonner.js.map +1 -1
- package/dist/components/ui/timeInput.d.ts +7 -0
- package/dist/components/ui/timeInput.js +42 -0
- package/dist/components/ui/timeInput.js.map +1 -0
- package/dist/components/ui/toast.js +4 -5
- package/dist/components/ui/toast.js.map +1 -1
- package/dist/components/ui/tooltip.js +4 -4
- package/dist/form-CFof7yon.js +404 -0
- package/dist/form-CFof7yon.js.map +1 -0
- package/dist/index-DDUC0qyC.js +18 -0
- package/dist/index-DDUC0qyC.js.map +1 -0
- package/dist/index-DoIb06Ge.js +1162 -0
- package/dist/index-DoIb06Ge.js.map +1 -0
- package/dist/index-DrJcw1yx.js +2266 -0
- package/dist/index-DrJcw1yx.js.map +1 -0
- package/dist/index-Dz0Z0Mhp.js +234 -0
- package/dist/index-Dz0Z0Mhp.js.map +1 -0
- package/dist/main.d.ts +0 -1
- package/dist/main.js +1 -5
- package/dist/main.js.map +1 -1
- package/dist/popover-DpJhfyvx.js +319 -0
- package/dist/popover-DpJhfyvx.js.map +1 -0
- package/lib/components/form/DateField.tsx +1 -1
- package/lib/components/form/DateRangeField.tsx +1 -1
- package/lib/components/form/InputField.tsx +2 -2
- package/lib/components/ui/input.tsx +15 -9
- package/lib/main.ts +0 -1
- package/package.json +1 -2
- package/lib/components/ui/sonner.tsx +0 -31
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import React__default from "react";
|
|
4
|
+
import { S as Slot } from "./index-D9mvqz1C.js";
|
|
5
|
+
import { cn } from "./utils/utils.js";
|
|
6
|
+
import { Label } from "./components/ui/label.js";
|
|
7
|
+
var isCheckBoxInput = (element) => element.type === "checkbox";
|
|
8
|
+
var isDateObject = (value) => value instanceof Date;
|
|
9
|
+
var isNullOrUndefined = (value) => value == null;
|
|
10
|
+
const isObjectType = (value) => typeof value === "object";
|
|
11
|
+
var isObject = (value) => !isNullOrUndefined(value) && !Array.isArray(value) && isObjectType(value) && !isDateObject(value);
|
|
12
|
+
var getEventValue = (event) => isObject(event) && event.target ? isCheckBoxInput(event.target) ? event.target.checked : event.target.value : event;
|
|
13
|
+
var getNodeParentName = (name) => name.substring(0, name.search(/\.\d+(\.|$)/)) || name;
|
|
14
|
+
var isNameInFieldArray = (names, name) => names.has(getNodeParentName(name));
|
|
15
|
+
var isPlainObject = (tempObject) => {
|
|
16
|
+
const prototypeCopy = tempObject.constructor && tempObject.constructor.prototype;
|
|
17
|
+
return isObject(prototypeCopy) && prototypeCopy.hasOwnProperty("isPrototypeOf");
|
|
18
|
+
};
|
|
19
|
+
var isWeb = typeof window !== "undefined" && typeof window.HTMLElement !== "undefined" && typeof document !== "undefined";
|
|
20
|
+
function cloneObject(data) {
|
|
21
|
+
let copy;
|
|
22
|
+
const isArray = Array.isArray(data);
|
|
23
|
+
if (data instanceof Date) {
|
|
24
|
+
copy = new Date(data);
|
|
25
|
+
} else if (data instanceof Set) {
|
|
26
|
+
copy = new Set(data);
|
|
27
|
+
} else if (!(isWeb && (data instanceof Blob || data instanceof FileList)) && (isArray || isObject(data))) {
|
|
28
|
+
copy = isArray ? [] : {};
|
|
29
|
+
if (!isArray && !isPlainObject(data)) {
|
|
30
|
+
copy = data;
|
|
31
|
+
} else {
|
|
32
|
+
for (const key in data) {
|
|
33
|
+
if (data.hasOwnProperty(key)) {
|
|
34
|
+
copy[key] = cloneObject(data[key]);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
return data;
|
|
40
|
+
}
|
|
41
|
+
return copy;
|
|
42
|
+
}
|
|
43
|
+
var compact = (value) => Array.isArray(value) ? value.filter(Boolean) : [];
|
|
44
|
+
var isUndefined = (val) => val === void 0;
|
|
45
|
+
var get = (object, path, defaultValue) => {
|
|
46
|
+
if (!path || !isObject(object)) {
|
|
47
|
+
return defaultValue;
|
|
48
|
+
}
|
|
49
|
+
const result = compact(path.split(/[,[\].]+?/)).reduce((result2, key) => isNullOrUndefined(result2) ? result2 : result2[key], object);
|
|
50
|
+
return isUndefined(result) || result === object ? isUndefined(object[path]) ? defaultValue : object[path] : result;
|
|
51
|
+
};
|
|
52
|
+
var isBoolean = (value) => typeof value === "boolean";
|
|
53
|
+
var isKey = (value) => /^\w*$/.test(value);
|
|
54
|
+
var stringToPath = (input) => compact(input.replace(/["|']|\]/g, "").split(/\.|\[/));
|
|
55
|
+
var set = (object, path, value) => {
|
|
56
|
+
let index = -1;
|
|
57
|
+
const tempPath = isKey(path) ? [path] : stringToPath(path);
|
|
58
|
+
const length = tempPath.length;
|
|
59
|
+
const lastIndex = length - 1;
|
|
60
|
+
while (++index < length) {
|
|
61
|
+
const key = tempPath[index];
|
|
62
|
+
let newValue = value;
|
|
63
|
+
if (index !== lastIndex) {
|
|
64
|
+
const objValue = object[key];
|
|
65
|
+
newValue = isObject(objValue) || Array.isArray(objValue) ? objValue : !isNaN(+tempPath[index + 1]) ? [] : {};
|
|
66
|
+
}
|
|
67
|
+
if (key === "__proto__") {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
object[key] = newValue;
|
|
71
|
+
object = object[key];
|
|
72
|
+
}
|
|
73
|
+
return object;
|
|
74
|
+
};
|
|
75
|
+
const EVENTS = {
|
|
76
|
+
BLUR: "blur",
|
|
77
|
+
FOCUS_OUT: "focusout",
|
|
78
|
+
CHANGE: "change"
|
|
79
|
+
};
|
|
80
|
+
const VALIDATION_MODE = {
|
|
81
|
+
onBlur: "onBlur",
|
|
82
|
+
onChange: "onChange",
|
|
83
|
+
onSubmit: "onSubmit",
|
|
84
|
+
onTouched: "onTouched",
|
|
85
|
+
all: "all"
|
|
86
|
+
};
|
|
87
|
+
const HookFormContext = React__default.createContext(null);
|
|
88
|
+
const useFormContext = () => React__default.useContext(HookFormContext);
|
|
89
|
+
const FormProvider = (props) => {
|
|
90
|
+
const { children, ...data } = props;
|
|
91
|
+
return React__default.createElement(HookFormContext.Provider, { value: data }, children);
|
|
92
|
+
};
|
|
93
|
+
var getProxyFormState = (formState, control, localProxyFormState, isRoot = true) => {
|
|
94
|
+
const result = {
|
|
95
|
+
defaultValues: control._defaultValues
|
|
96
|
+
};
|
|
97
|
+
for (const key in formState) {
|
|
98
|
+
Object.defineProperty(result, key, {
|
|
99
|
+
get: () => {
|
|
100
|
+
const _key = key;
|
|
101
|
+
if (control._proxyFormState[_key] !== VALIDATION_MODE.all) {
|
|
102
|
+
control._proxyFormState[_key] = !isRoot || VALIDATION_MODE.all;
|
|
103
|
+
}
|
|
104
|
+
localProxyFormState && (localProxyFormState[_key] = true);
|
|
105
|
+
return formState[_key];
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return result;
|
|
110
|
+
};
|
|
111
|
+
var isEmptyObject = (value) => isObject(value) && !Object.keys(value).length;
|
|
112
|
+
var shouldRenderFormState = (formStateData, _proxyFormState, updateFormState, isRoot) => {
|
|
113
|
+
updateFormState(formStateData);
|
|
114
|
+
const { name, ...formState } = formStateData;
|
|
115
|
+
return isEmptyObject(formState) || Object.keys(formState).length >= Object.keys(_proxyFormState).length || Object.keys(formState).find((key) => _proxyFormState[key] === !isRoot);
|
|
116
|
+
};
|
|
117
|
+
var convertToArrayPayload = (value) => Array.isArray(value) ? value : [value];
|
|
118
|
+
var shouldSubscribeByName = (name, signalName, exact) => !name || !signalName || name === signalName || convertToArrayPayload(name).some((currentName) => currentName && (exact ? currentName === signalName : currentName.startsWith(signalName) || signalName.startsWith(currentName)));
|
|
119
|
+
function useSubscribe(props) {
|
|
120
|
+
const _props = React__default.useRef(props);
|
|
121
|
+
_props.current = props;
|
|
122
|
+
React__default.useEffect(() => {
|
|
123
|
+
const subscription = !props.disabled && _props.current.subject && _props.current.subject.subscribe({
|
|
124
|
+
next: _props.current.next
|
|
125
|
+
});
|
|
126
|
+
return () => {
|
|
127
|
+
subscription && subscription.unsubscribe();
|
|
128
|
+
};
|
|
129
|
+
}, [props.disabled]);
|
|
130
|
+
}
|
|
131
|
+
function useFormState(props) {
|
|
132
|
+
const methods = useFormContext();
|
|
133
|
+
const { control = methods.control, disabled, name, exact } = props || {};
|
|
134
|
+
const [formState, updateFormState] = React__default.useState(control._formState);
|
|
135
|
+
const _mounted = React__default.useRef(true);
|
|
136
|
+
const _localProxyFormState = React__default.useRef({
|
|
137
|
+
isDirty: false,
|
|
138
|
+
isLoading: false,
|
|
139
|
+
dirtyFields: false,
|
|
140
|
+
touchedFields: false,
|
|
141
|
+
validatingFields: false,
|
|
142
|
+
isValidating: false,
|
|
143
|
+
isValid: false,
|
|
144
|
+
errors: false
|
|
145
|
+
});
|
|
146
|
+
const _name = React__default.useRef(name);
|
|
147
|
+
_name.current = name;
|
|
148
|
+
useSubscribe({
|
|
149
|
+
disabled,
|
|
150
|
+
next: (value) => _mounted.current && shouldSubscribeByName(_name.current, value.name, exact) && shouldRenderFormState(value, _localProxyFormState.current, control._updateFormState) && updateFormState({
|
|
151
|
+
...control._formState,
|
|
152
|
+
...value
|
|
153
|
+
}),
|
|
154
|
+
subject: control._subjects.state
|
|
155
|
+
});
|
|
156
|
+
React__default.useEffect(() => {
|
|
157
|
+
_mounted.current = true;
|
|
158
|
+
_localProxyFormState.current.isValid && control._updateValid(true);
|
|
159
|
+
return () => {
|
|
160
|
+
_mounted.current = false;
|
|
161
|
+
};
|
|
162
|
+
}, [control]);
|
|
163
|
+
return getProxyFormState(formState, control, _localProxyFormState.current, false);
|
|
164
|
+
}
|
|
165
|
+
var isString = (value) => typeof value === "string";
|
|
166
|
+
var generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) => {
|
|
167
|
+
if (isString(names)) {
|
|
168
|
+
return get(formValues, names, defaultValue);
|
|
169
|
+
}
|
|
170
|
+
if (Array.isArray(names)) {
|
|
171
|
+
return names.map((fieldName) => get(formValues, fieldName));
|
|
172
|
+
}
|
|
173
|
+
return formValues;
|
|
174
|
+
};
|
|
175
|
+
function useWatch(props) {
|
|
176
|
+
const methods = useFormContext();
|
|
177
|
+
const { control = methods.control, name, defaultValue, disabled, exact } = props || {};
|
|
178
|
+
const _name = React__default.useRef(name);
|
|
179
|
+
_name.current = name;
|
|
180
|
+
useSubscribe({
|
|
181
|
+
disabled,
|
|
182
|
+
subject: control._subjects.values,
|
|
183
|
+
next: (formState) => {
|
|
184
|
+
if (shouldSubscribeByName(_name.current, formState.name, exact)) {
|
|
185
|
+
updateValue(cloneObject(generateWatchOutput(_name.current, control._names, formState.values || control._formValues, false, defaultValue)));
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
const [value, updateValue] = React__default.useState(control._getWatch(name, defaultValue));
|
|
190
|
+
React__default.useEffect(() => control._removeUnmounted());
|
|
191
|
+
return value;
|
|
192
|
+
}
|
|
193
|
+
function useController(props) {
|
|
194
|
+
const methods = useFormContext();
|
|
195
|
+
const { name, disabled, control = methods.control, shouldUnregister } = props;
|
|
196
|
+
const isArrayField = isNameInFieldArray(control._names.array, name);
|
|
197
|
+
const value = useWatch({
|
|
198
|
+
control,
|
|
199
|
+
name,
|
|
200
|
+
defaultValue: get(control._formValues, name, get(control._defaultValues, name, props.defaultValue)),
|
|
201
|
+
exact: true
|
|
202
|
+
});
|
|
203
|
+
const formState = useFormState({
|
|
204
|
+
control,
|
|
205
|
+
name,
|
|
206
|
+
exact: true
|
|
207
|
+
});
|
|
208
|
+
const _registerProps = React__default.useRef(control.register(name, {
|
|
209
|
+
...props.rules,
|
|
210
|
+
value,
|
|
211
|
+
...isBoolean(props.disabled) ? { disabled: props.disabled } : {}
|
|
212
|
+
}));
|
|
213
|
+
React__default.useEffect(() => {
|
|
214
|
+
const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
|
|
215
|
+
const updateMounted = (name2, value2) => {
|
|
216
|
+
const field = get(control._fields, name2);
|
|
217
|
+
if (field && field._f) {
|
|
218
|
+
field._f.mount = value2;
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
updateMounted(name, true);
|
|
222
|
+
if (_shouldUnregisterField) {
|
|
223
|
+
const value2 = cloneObject(get(control._options.defaultValues, name));
|
|
224
|
+
set(control._defaultValues, name, value2);
|
|
225
|
+
if (isUndefined(get(control._formValues, name))) {
|
|
226
|
+
set(control._formValues, name, value2);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return () => {
|
|
230
|
+
(isArrayField ? _shouldUnregisterField && !control._state.action : _shouldUnregisterField) ? control.unregister(name) : updateMounted(name, false);
|
|
231
|
+
};
|
|
232
|
+
}, [name, control, isArrayField, shouldUnregister]);
|
|
233
|
+
React__default.useEffect(() => {
|
|
234
|
+
if (get(control._fields, name)) {
|
|
235
|
+
control._updateDisabledField({
|
|
236
|
+
disabled,
|
|
237
|
+
fields: control._fields,
|
|
238
|
+
name,
|
|
239
|
+
value: get(control._fields, name)._f.value
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
}, [disabled, name, control]);
|
|
243
|
+
return {
|
|
244
|
+
field: {
|
|
245
|
+
name,
|
|
246
|
+
value,
|
|
247
|
+
...isBoolean(disabled) || formState.disabled ? { disabled: formState.disabled || disabled } : {},
|
|
248
|
+
onChange: React__default.useCallback((event) => _registerProps.current.onChange({
|
|
249
|
+
target: {
|
|
250
|
+
value: getEventValue(event),
|
|
251
|
+
name
|
|
252
|
+
},
|
|
253
|
+
type: EVENTS.CHANGE
|
|
254
|
+
}), [name]),
|
|
255
|
+
onBlur: React__default.useCallback(() => _registerProps.current.onBlur({
|
|
256
|
+
target: {
|
|
257
|
+
value: get(control._formValues, name),
|
|
258
|
+
name
|
|
259
|
+
},
|
|
260
|
+
type: EVENTS.BLUR
|
|
261
|
+
}), [name, control]),
|
|
262
|
+
ref: React__default.useCallback((elm) => {
|
|
263
|
+
const field = get(control._fields, name);
|
|
264
|
+
if (field && elm) {
|
|
265
|
+
field._f.ref = {
|
|
266
|
+
focus: () => elm.focus(),
|
|
267
|
+
select: () => elm.select(),
|
|
268
|
+
setCustomValidity: (message) => elm.setCustomValidity(message),
|
|
269
|
+
reportValidity: () => elm.reportValidity()
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
}, [control._fields, name])
|
|
273
|
+
},
|
|
274
|
+
formState,
|
|
275
|
+
fieldState: Object.defineProperties({}, {
|
|
276
|
+
invalid: {
|
|
277
|
+
enumerable: true,
|
|
278
|
+
get: () => !!get(formState.errors, name)
|
|
279
|
+
},
|
|
280
|
+
isDirty: {
|
|
281
|
+
enumerable: true,
|
|
282
|
+
get: () => !!get(formState.dirtyFields, name)
|
|
283
|
+
},
|
|
284
|
+
isTouched: {
|
|
285
|
+
enumerable: true,
|
|
286
|
+
get: () => !!get(formState.touchedFields, name)
|
|
287
|
+
},
|
|
288
|
+
isValidating: {
|
|
289
|
+
enumerable: true,
|
|
290
|
+
get: () => !!get(formState.validatingFields, name)
|
|
291
|
+
},
|
|
292
|
+
error: {
|
|
293
|
+
enumerable: true,
|
|
294
|
+
get: () => get(formState.errors, name)
|
|
295
|
+
}
|
|
296
|
+
})
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
const Controller = (props) => props.render(useController(props));
|
|
300
|
+
const Form = FormProvider;
|
|
301
|
+
const FormFieldContext = React.createContext(
|
|
302
|
+
{}
|
|
303
|
+
);
|
|
304
|
+
const FormField = ({
|
|
305
|
+
...props
|
|
306
|
+
}) => {
|
|
307
|
+
return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
|
|
308
|
+
};
|
|
309
|
+
const useFormField = () => {
|
|
310
|
+
const fieldContext = React.useContext(FormFieldContext);
|
|
311
|
+
const itemContext = React.useContext(FormItemContext);
|
|
312
|
+
const { getFieldState, formState } = useFormContext();
|
|
313
|
+
const fieldState = getFieldState(fieldContext.name, formState);
|
|
314
|
+
if (!fieldContext) {
|
|
315
|
+
throw new Error("useFormField should be used within <FormField>");
|
|
316
|
+
}
|
|
317
|
+
const { id } = itemContext;
|
|
318
|
+
return {
|
|
319
|
+
id,
|
|
320
|
+
name: fieldContext.name,
|
|
321
|
+
formItemId: `${id}-form-item`,
|
|
322
|
+
formDescriptionId: `${id}-form-item-description`,
|
|
323
|
+
formMessageId: `${id}-form-item-message`,
|
|
324
|
+
...fieldState
|
|
325
|
+
};
|
|
326
|
+
};
|
|
327
|
+
const FormItemContext = React.createContext(
|
|
328
|
+
{}
|
|
329
|
+
);
|
|
330
|
+
const FormItem = React.forwardRef(({ className, ...props }, ref) => {
|
|
331
|
+
const id = React.useId();
|
|
332
|
+
return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx("div", { ref, className: cn("space-y-2", className), ...props }) });
|
|
333
|
+
});
|
|
334
|
+
FormItem.displayName = "FormItem";
|
|
335
|
+
const FormLabel = React.forwardRef(({ className, ...props }, ref) => {
|
|
336
|
+
const { error, formItemId } = useFormField();
|
|
337
|
+
return /* @__PURE__ */ jsx(
|
|
338
|
+
Label,
|
|
339
|
+
{
|
|
340
|
+
ref,
|
|
341
|
+
className: cn(error && "text-destructive", className),
|
|
342
|
+
htmlFor: formItemId,
|
|
343
|
+
...props
|
|
344
|
+
}
|
|
345
|
+
);
|
|
346
|
+
});
|
|
347
|
+
FormLabel.displayName = "FormLabel";
|
|
348
|
+
const FormControl = React.forwardRef(({ ...props }, ref) => {
|
|
349
|
+
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
350
|
+
return /* @__PURE__ */ jsx(
|
|
351
|
+
Slot,
|
|
352
|
+
{
|
|
353
|
+
ref,
|
|
354
|
+
id: formItemId,
|
|
355
|
+
"aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
|
|
356
|
+
"aria-invalid": !!error,
|
|
357
|
+
...props
|
|
358
|
+
}
|
|
359
|
+
);
|
|
360
|
+
});
|
|
361
|
+
FormControl.displayName = "FormControl";
|
|
362
|
+
const FormDescription = React.forwardRef(({ className, ...props }, ref) => {
|
|
363
|
+
const { formDescriptionId } = useFormField();
|
|
364
|
+
return /* @__PURE__ */ jsx(
|
|
365
|
+
"p",
|
|
366
|
+
{
|
|
367
|
+
ref,
|
|
368
|
+
id: formDescriptionId,
|
|
369
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
370
|
+
...props
|
|
371
|
+
}
|
|
372
|
+
);
|
|
373
|
+
});
|
|
374
|
+
FormDescription.displayName = "FormDescription";
|
|
375
|
+
const FormMessage = React.forwardRef(({ className, children, ...props }, ref) => {
|
|
376
|
+
const { error, formMessageId } = useFormField();
|
|
377
|
+
const body = error ? String(error == null ? void 0 : error.message) : children;
|
|
378
|
+
if (!body) {
|
|
379
|
+
return null;
|
|
380
|
+
}
|
|
381
|
+
return /* @__PURE__ */ jsx(
|
|
382
|
+
"p",
|
|
383
|
+
{
|
|
384
|
+
ref,
|
|
385
|
+
id: formMessageId,
|
|
386
|
+
className: cn("text-sm font-medium text-destructive", className),
|
|
387
|
+
...props,
|
|
388
|
+
children: body
|
|
389
|
+
}
|
|
390
|
+
);
|
|
391
|
+
});
|
|
392
|
+
FormMessage.displayName = "FormMessage";
|
|
393
|
+
export {
|
|
394
|
+
Form as F,
|
|
395
|
+
FormItem as a,
|
|
396
|
+
FormLabel as b,
|
|
397
|
+
FormControl as c,
|
|
398
|
+
FormDescription as d,
|
|
399
|
+
FormMessage as e,
|
|
400
|
+
FormField as f,
|
|
401
|
+
useFormContext as g,
|
|
402
|
+
useFormField as u
|
|
403
|
+
};
|
|
404
|
+
//# sourceMappingURL=form-CFof7yon.js.map
|