@joelbarron/react-web-dev-kit 0.1.8 → 0.1.9
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/README.md +65 -160
- package/package.json +9 -2
- package/dist/auth/client.d.ts +0 -46
- package/dist/auth/client.d.ts.map +0 -1
- package/dist/auth/client.js +0 -379
- package/dist/auth/constants/countryCallingCodes.d.ts +0 -9
- package/dist/auth/constants/countryCallingCodes.d.ts.map +0 -1
- package/dist/auth/constants/countryCallingCodes.js +0 -209
- package/dist/auth/constants/gender.d.ts +0 -9
- package/dist/auth/constants/gender.d.ts.map +0 -1
- package/dist/auth/constants/gender.js +0 -12
- package/dist/auth/constants/index.d.ts +0 -3
- package/dist/auth/constants/index.d.ts.map +0 -1
- package/dist/auth/constants/index.js +0 -2
- package/dist/auth/forms/account/AuthAccountConfirmationForm.d.ts +0 -18
- package/dist/auth/forms/account/AuthAccountConfirmationForm.d.ts.map +0 -1
- package/dist/auth/forms/account/AuthAccountConfirmationForm.js +0 -167
- package/dist/auth/forms/account/index.d.ts +0 -2
- package/dist/auth/forms/account/index.d.ts.map +0 -1
- package/dist/auth/forms/account/index.js +0 -1
- package/dist/auth/forms/errorParser.d.ts +0 -7
- package/dist/auth/forms/errorParser.d.ts.map +0 -1
- package/dist/auth/forms/errorParser.js +0 -65
- package/dist/auth/forms/index.d.ts +0 -6
- package/dist/auth/forms/index.d.ts.map +0 -1
- package/dist/auth/forms/index.js +0 -5
- package/dist/auth/forms/password/AuthForgotPasswordForm.d.ts +0 -16
- package/dist/auth/forms/password/AuthForgotPasswordForm.d.ts.map +0 -1
- package/dist/auth/forms/password/AuthForgotPasswordForm.js +0 -109
- package/dist/auth/forms/password/AuthPasswordResetConfirmForm.d.ts +0 -17
- package/dist/auth/forms/password/AuthPasswordResetConfirmForm.d.ts.map +0 -1
- package/dist/auth/forms/password/AuthPasswordResetConfirmForm.js +0 -163
- package/dist/auth/forms/password/AuthResetPasswordForm.d.ts +0 -12
- package/dist/auth/forms/password/AuthResetPasswordForm.d.ts.map +0 -1
- package/dist/auth/forms/password/AuthResetPasswordForm.js +0 -22
- package/dist/auth/forms/password/index.d.ts +0 -4
- package/dist/auth/forms/password/index.d.ts.map +0 -1
- package/dist/auth/forms/password/index.js +0 -3
- package/dist/auth/forms/password/passwordValidation.d.ts +0 -3
- package/dist/auth/forms/password/passwordValidation.d.ts.map +0 -1
- package/dist/auth/forms/password/passwordValidation.js +0 -45
- package/dist/auth/forms/sign-in/AuthOtpSignInForm.d.ts +0 -24
- package/dist/auth/forms/sign-in/AuthOtpSignInForm.d.ts.map +0 -1
- package/dist/auth/forms/sign-in/AuthOtpSignInForm.js +0 -227
- package/dist/auth/forms/sign-in/AuthPasswordSignInForm.d.ts +0 -22
- package/dist/auth/forms/sign-in/AuthPasswordSignInForm.d.ts.map +0 -1
- package/dist/auth/forms/sign-in/AuthPasswordSignInForm.js +0 -148
- package/dist/auth/forms/sign-in/index.d.ts +0 -3
- package/dist/auth/forms/sign-in/index.d.ts.map +0 -1
- package/dist/auth/forms/sign-in/index.js +0 -2
- package/dist/auth/forms/sign-up/AuthSignUpForm.d.ts +0 -37
- package/dist/auth/forms/sign-up/AuthSignUpForm.d.ts.map +0 -1
- package/dist/auth/forms/sign-up/AuthSignUpForm.js +0 -193
- package/dist/auth/forms/sign-up/index.d.ts +0 -2
- package/dist/auth/forms/sign-up/index.d.ts.map +0 -1
- package/dist/auth/forms/sign-up/index.js +0 -1
- package/dist/auth/fuse/createFuseAuthViews.d.ts +0 -25
- package/dist/auth/fuse/createFuseAuthViews.d.ts.map +0 -1
- package/dist/auth/fuse/createFuseAuthViews.js +0 -510
- package/dist/auth/fuse/fuseAdapter.d.ts +0 -42
- package/dist/auth/fuse/fuseAdapter.d.ts.map +0 -1
- package/dist/auth/fuse/fuseAdapter.js +0 -291
- package/dist/auth/fuse/fuseIntegration.d.ts +0 -61
- package/dist/auth/fuse/fuseIntegration.d.ts.map +0 -1
- package/dist/auth/fuse/fuseIntegration.js +0 -103
- package/dist/auth/fuse/index.d.ts +0 -4
- package/dist/auth/fuse/index.d.ts.map +0 -1
- package/dist/auth/fuse/index.js +0 -3
- package/dist/auth/index.d.ts +0 -11
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/index.js +0 -10
- package/dist/auth/provider.d.ts +0 -35
- package/dist/auth/provider.d.ts.map +0 -1
- package/dist/auth/provider.js +0 -133
- package/dist/auth/query.d.ts +0 -23
- package/dist/auth/query.d.ts.map +0 -1
- package/dist/auth/query.js +0 -103
- package/dist/auth/routes.d.ts +0 -37
- package/dist/auth/routes.d.ts.map +0 -1
- package/dist/auth/routes.js +0 -75
- package/dist/auth/social/providerAuth.d.ts +0 -101
- package/dist/auth/social/providerAuth.d.ts.map +0 -1
- package/dist/auth/social/providerAuth.js +0 -207
- package/dist/auth/storage.d.ts +0 -3
- package/dist/auth/storage.d.ts.map +0 -1
- package/dist/auth/storage.js +0 -20
- package/dist/auth/types.d.ts +0 -238
- package/dist/auth/types.d.ts.map +0 -1
- package/dist/auth/types.js +0 -1
- package/dist/auth/ui/AuthPageTitle.d.ts +0 -7
- package/dist/auth/ui/AuthPageTitle.d.ts.map +0 -1
- package/dist/auth/ui/AuthPageTitle.js +0 -7
- package/dist/auth/ui/AuthPagesMessageSection.d.ts +0 -3
- package/dist/auth/ui/AuthPagesMessageSection.d.ts.map +0 -1
- package/dist/auth/ui/AuthPagesMessageSection.js +0 -39
- package/dist/auth/ui/AuthPrimaryButton.d.ts +0 -9
- package/dist/auth/ui/AuthPrimaryButton.d.ts.map +0 -1
- package/dist/auth/ui/AuthPrimaryButton.js +0 -19
- package/dist/auth/ui/AuthRoleSelectionDialog.d.ts +0 -14
- package/dist/auth/ui/AuthRoleSelectionDialog.d.ts.map +0 -1
- package/dist/auth/ui/AuthRoleSelectionDialog.js +0 -39
- package/dist/auth/ui/AuthRoutePageWrapper.d.ts +0 -12
- package/dist/auth/ui/AuthRoutePageWrapper.d.ts.map +0 -1
- package/dist/auth/ui/AuthRoutePageWrapper.js +0 -61
- package/dist/auth/ui/AuthSecondaryButton.d.ts +0 -7
- package/dist/auth/ui/AuthSecondaryButton.d.ts.map +0 -1
- package/dist/auth/ui/AuthSecondaryButton.js +0 -18
- package/dist/auth/ui/AuthSocialProviderButton.d.ts +0 -11
- package/dist/auth/ui/AuthSocialProviderButton.d.ts.map +0 -1
- package/dist/auth/ui/AuthSocialProviderButton.js +0 -33
- package/dist/auth/ui/index.d.ts +0 -9
- package/dist/auth/ui/index.d.ts.map +0 -1
- package/dist/auth/ui/index.js +0 -8
- package/dist/auth/ui/types.d.ts +0 -15
- package/dist/auth/ui/types.d.ts.map +0 -1
- package/dist/auth/ui/types.js +0 -1
- package/dist/config/createConfig.d.ts +0 -14
- package/dist/config/createConfig.d.ts.map +0 -1
- package/dist/config/createConfig.js +0 -179
- package/dist/config/defaults.d.ts +0 -3
- package/dist/config/defaults.d.ts.map +0 -1
- package/dist/config/defaults.js +0 -39
- package/dist/config/index.d.ts +0 -5
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js +0 -4
- package/dist/config/merge.d.ts +0 -2
- package/dist/config/merge.d.ts.map +0 -1
- package/dist/config/merge.js +0 -18
- package/dist/config/types.d.ts +0 -53
- package/dist/config/types.d.ts.map +0 -1
- package/dist/config/types.js +0 -1
- package/dist/core/buttons/JBButton.d.ts +0 -8
- package/dist/core/buttons/JBButton.d.ts.map +0 -1
- package/dist/core/buttons/JBButton.js +0 -55
- package/dist/core/buttons/index.d.ts +0 -2
- package/dist/core/buttons/index.d.ts.map +0 -1
- package/dist/core/buttons/index.js +0 -1
- package/dist/core/dialogs/JBConfirmDialog.d.ts +0 -15
- package/dist/core/dialogs/JBConfirmDialog.d.ts.map +0 -1
- package/dist/core/dialogs/JBConfirmDialog.js +0 -6
- package/dist/core/dialogs/index.d.ts +0 -2
- package/dist/core/dialogs/index.d.ts.map +0 -1
- package/dist/core/dialogs/index.js +0 -1
- package/dist/core/index.d.ts +0 -5
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -4
- package/dist/core/layout/JBContentContainer.d.ts +0 -31
- package/dist/core/layout/JBContentContainer.d.ts.map +0 -1
- package/dist/core/layout/JBContentContainer.js +0 -50
- package/dist/core/layout/JBFormHeader.d.ts +0 -3
- package/dist/core/layout/JBFormHeader.d.ts.map +0 -1
- package/dist/core/layout/JBFormHeader.js +0 -131
- package/dist/core/layout/index.d.ts +0 -3
- package/dist/core/layout/index.d.ts.map +0 -1
- package/dist/core/layout/index.js +0 -2
- package/dist/core/skeletons/JBFormContentSkeleton.d.ts +0 -5
- package/dist/core/skeletons/JBFormContentSkeleton.d.ts.map +0 -1
- package/dist/core/skeletons/JBFormContentSkeleton.js +0 -12
- package/dist/core/skeletons/JBFormHeaderSkeleton.d.ts +0 -6
- package/dist/core/skeletons/JBFormHeaderSkeleton.d.ts.map +0 -1
- package/dist/core/skeletons/JBFormHeaderSkeleton.js +0 -19
- package/dist/core/skeletons/index.d.ts +0 -3
- package/dist/core/skeletons/index.d.ts.map +0 -1
- package/dist/core/skeletons/index.js +0 -2
- package/dist/forms/JBAutocompleteField.d.ts +0 -12
- package/dist/forms/JBAutocompleteField.d.ts.map +0 -1
- package/dist/forms/JBAutocompleteField.js +0 -20
- package/dist/forms/JBCheckboxField.d.ts +0 -12
- package/dist/forms/JBCheckboxField.d.ts.map +0 -1
- package/dist/forms/JBCheckboxField.js +0 -36
- package/dist/forms/JBDatePickerField.d.ts +0 -13
- package/dist/forms/JBDatePickerField.d.ts.map +0 -1
- package/dist/forms/JBDatePickerField.js +0 -49
- package/dist/forms/JBRadioGroupField.d.ts +0 -10
- package/dist/forms/JBRadioGroupField.d.ts.map +0 -1
- package/dist/forms/JBRadioGroupField.js +0 -8
- package/dist/forms/JBSelectField.d.ts +0 -9
- package/dist/forms/JBSelectField.d.ts.map +0 -1
- package/dist/forms/JBSelectField.js +0 -8
- package/dist/forms/JBSwitchField.d.ts +0 -11
- package/dist/forms/JBSwitchField.d.ts.map +0 -1
- package/dist/forms/JBSwitchField.js +0 -10
- package/dist/forms/JBTextField.d.ts +0 -6
- package/dist/forms/JBTextField.d.ts.map +0 -1
- package/dist/forms/JBTextField.js +0 -8
- package/dist/forms/JBTimePickerField.d.ts +0 -12
- package/dist/forms/JBTimePickerField.d.ts.map +0 -1
- package/dist/forms/JBTimePickerField.js +0 -17
- package/dist/forms/index.d.ts +0 -13
- package/dist/forms/index.d.ts.map +0 -1
- package/dist/forms/index.js +0 -12
- package/dist/forms/rules.d.ts +0 -16
- package/dist/forms/rules.d.ts.map +0 -1
- package/dist/forms/rules.js +0 -21
- package/dist/forms/types.d.ts +0 -12
- package/dist/forms/types.d.ts.map +0 -1
- package/dist/forms/types.js +0 -1
- package/dist/forms/utils.d.ts +0 -5
- package/dist/forms/utils.d.ts.map +0 -1
- package/dist/forms/utils.js +0 -7
- package/dist/forms/zod.d.ts +0 -4
- package/dist/forms/zod.d.ts.map +0 -1
- package/dist/forms/zod.js +0 -9
- package/dist/grid/JBGrid.d.ts +0 -3
- package/dist/grid/JBGrid.d.ts.map +0 -1
- package/dist/grid/JBGrid.js +0 -338
- package/dist/grid/JBGridHeader.d.ts +0 -3
- package/dist/grid/JBGridHeader.d.ts.map +0 -1
- package/dist/grid/JBGridHeader.js +0 -93
- package/dist/grid/JBGridLoading.d.ts +0 -9
- package/dist/grid/JBGridLoading.d.ts.map +0 -1
- package/dist/grid/JBGridLoading.js +0 -14
- package/dist/grid/JBGridProviders.d.ts +0 -13
- package/dist/grid/JBGridProviders.d.ts.map +0 -1
- package/dist/grid/JBGridProviders.js +0 -54
- package/dist/grid/JBGridSkeleton.d.ts +0 -7
- package/dist/grid/JBGridSkeleton.d.ts.map +0 -1
- package/dist/grid/JBGridSkeleton.js +0 -6
- package/dist/grid/defaults.d.ts +0 -4
- package/dist/grid/defaults.d.ts.map +0 -1
- package/dist/grid/defaults.js +0 -29
- package/dist/grid/index.d.ts +0 -8
- package/dist/grid/index.d.ts.map +0 -1
- package/dist/grid/index.js +0 -7
- package/dist/grid/types.d.ts +0 -197
- package/dist/grid/types.d.ts.map +0 -1
- package/dist/grid/types.js +0 -1
- package/dist/hooks/index.d.ts +0 -4
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/index.js +0 -3
- package/dist/hooks/useJBDebouncedValue.d.ts +0 -2
- package/dist/hooks/useJBDebouncedValue.d.ts.map +0 -1
- package/dist/hooks/useJBDebouncedValue.js +0 -11
- package/dist/hooks/useJBEntityFormController.d.ts +0 -54
- package/dist/hooks/useJBEntityFormController.d.ts.map +0 -1
- package/dist/hooks/useJBEntityFormController.js +0 -156
- package/dist/hooks/useJBRedirect.d.ts +0 -10
- package/dist/hooks/useJBRedirect.d.ts.map +0 -1
- package/dist/hooks/useJBRedirect.js +0 -11
- package/dist/index.d.ts +0 -9
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -8
- package/dist/query/createQueryClient.d.ts +0 -8
- package/dist/query/createQueryClient.d.ts.map +0 -1
- package/dist/query/createQueryClient.js +0 -25
- package/dist/query/http.d.ts +0 -3
- package/dist/query/http.d.ts.map +0 -1
- package/dist/query/http.js +0 -12
- package/dist/query/index.d.ts +0 -4
- package/dist/query/index.d.ts.map +0 -1
- package/dist/query/index.js +0 -3
- package/dist/query/types.d.ts +0 -7
- package/dist/query/types.d.ts.map +0 -1
- package/dist/query/types.js +0 -1
- package/dist/utils/errors.d.ts +0 -10
- package/dist/utils/errors.d.ts.map +0 -1
- package/dist/utils/errors.js +0 -55
- package/dist/utils/format.d.ts +0 -4
- package/dist/utils/format.d.ts.map +0 -1
- package/dist/utils/format.js +0 -28
- package/dist/utils/geo.d.ts +0 -9
- package/dist/utils/geo.d.ts.map +0 -1
- package/dist/utils/geo.js +0 -186
- package/dist/utils/index.d.ts +0 -6
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -5
- package/dist/utils/query.d.ts +0 -2
- package/dist/utils/query.d.ts.map +0 -1
- package/dist/utils/query.js +0 -4
- package/dist/utils/regex.d.ts +0 -7
- package/dist/utils/regex.d.ts.map +0 -1
- package/dist/utils/regex.js +0 -6
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Typography } from '@mui/material';
|
|
3
|
-
import { alpha } from '@mui/material/styles';
|
|
4
|
-
import { JBButton } from '../buttons';
|
|
5
|
-
export function JBFormHeader(props) {
|
|
6
|
-
const { moduleConfig, iconNameRenderer, animated = true, animationDurationMs = 260, animationStaggerMs = 70, animationPreset = 'vertical', breadcrumb, showBackButton = false, backLabel, onBackClick, backContent, isNew = false, recordId, title, dynamicTitle, formValues, getDynamicTitle, subtitle, dynamicSubtitle, getDynamicSubtitle, icon, actions, rightContent } = props;
|
|
7
|
-
const dynamicTitleFromResolver = getDynamicTitle?.({ isNew, values: formValues });
|
|
8
|
-
const dynamicSubtitleFromResolver = getDynamicSubtitle?.({ isNew, values: formValues });
|
|
9
|
-
const resolvedDynamicTitle = (!isNew ? dynamicTitle : undefined) ?? dynamicTitleFromResolver;
|
|
10
|
-
const moduleTitle = title ??
|
|
11
|
-
(isNew ? moduleConfig?.texts?.newText : moduleConfig?.texts?.editText) ??
|
|
12
|
-
moduleConfig?.texts?.moduleName ??
|
|
13
|
-
'';
|
|
14
|
-
const hasStaticTitle = Boolean(moduleTitle);
|
|
15
|
-
const dynamicSubtitleCandidate = dynamicSubtitle ??
|
|
16
|
-
dynamicSubtitleFromResolver ??
|
|
17
|
-
(hasStaticTitle ? resolvedDynamicTitle : undefined);
|
|
18
|
-
const staticSubtitleCandidate = subtitle ??
|
|
19
|
-
moduleConfig?.texts?.formHeaderSubtitle ??
|
|
20
|
-
'';
|
|
21
|
-
const baseSubtitle = dynamicSubtitleCandidate ?? staticSubtitleCandidate;
|
|
22
|
-
const recordPrefix = moduleConfig?.texts?.formHeaderRecordPrefix;
|
|
23
|
-
const canApplyRecordPrefix = !isNew &&
|
|
24
|
-
Boolean(recordPrefix) &&
|
|
25
|
-
recordId !== undefined &&
|
|
26
|
-
recordId !== null &&
|
|
27
|
-
String(recordId).trim() !== '' &&
|
|
28
|
-
Boolean(dynamicSubtitleCandidate);
|
|
29
|
-
const resolvedTitle = (hasStaticTitle ? moduleTitle : undefined) ||
|
|
30
|
-
resolvedDynamicTitle ||
|
|
31
|
-
'';
|
|
32
|
-
const resolvedSubtitle = canApplyRecordPrefix
|
|
33
|
-
? [`${recordPrefix}-${recordId}`, baseSubtitle].filter(Boolean).join(' / ')
|
|
34
|
-
: baseSubtitle;
|
|
35
|
-
const resolvedBackLabel = backLabel ?? moduleConfig?.texts?.goBackToGrid ?? 'Volver';
|
|
36
|
-
const resolvedIcon = icon ??
|
|
37
|
-
(moduleConfig?.texts?.iconName && iconNameRenderer
|
|
38
|
-
? iconNameRenderer(moduleConfig.texts.iconName)
|
|
39
|
-
: null);
|
|
40
|
-
const formDisabled = actions?.formDisabled ?? false;
|
|
41
|
-
const allowEdit = actions?.allowEdit ?? false;
|
|
42
|
-
const allowDelete = actions?.allowDelete ?? false;
|
|
43
|
-
const showDeleteWhenEditing = actions?.showDeleteWhenEditing ?? false;
|
|
44
|
-
const defaultActions = actions ? (_jsxs(Box, { sx: {
|
|
45
|
-
display: 'flex',
|
|
46
|
-
gap: 1,
|
|
47
|
-
flexWrap: 'wrap',
|
|
48
|
-
justifyContent: { xs: 'center', md: 'flex-end' },
|
|
49
|
-
alignItems: 'center',
|
|
50
|
-
width: { xs: '100%', md: 'auto' }
|
|
51
|
-
}, children: [!isNew && allowEdit && formDisabled && actions.onStartEdit ? (_jsx(JBButton, { action: "edit", size: "large", disabled: actions.disableEdit, startIcon: actions.editIcon, onClick: actions.onStartEdit, children: actions.editLabel ?? 'Editar' })) : null, (isNew || !formDisabled) && actions.onCancel ? (_jsx(JBButton, { action: "cancel", size: "large", disabled: actions.disableCancel, startIcon: actions.cancelIcon, onClick: actions.onCancel, children: actions.cancelLabel ?? 'Cancelar' })) : null, (isNew || !formDisabled) && actions.onSave ? (_jsx(JBButton, { action: "save", size: "large", disabled: actions.disableSave, startIcon: actions.saveIcon, onClick: actions.onSave, children: actions.saveLabel ?? (isNew ? 'Guardar' : 'Guardar cambios') })) : null, allowDelete &&
|
|
52
|
-
actions.onDelete &&
|
|
53
|
-
(formDisabled || showDeleteWhenEditing) ? (_jsx(JBButton, { action: "delete", size: "large", disabled: actions.disableDelete, startIcon: actions.deleteIcon, onClick: actions.onDelete, children: actions.deleteLabel ?? 'Eliminar' })) : null] })) : null;
|
|
54
|
-
const resolvedRightContent = rightContent ?? defaultActions;
|
|
55
|
-
const animateSx = (delayMs) => animated
|
|
56
|
-
? {
|
|
57
|
-
animation: `jbHeaderFadeIn ${animationDurationMs}ms ease-out ${delayMs}ms both`
|
|
58
|
-
}
|
|
59
|
-
: undefined;
|
|
60
|
-
const animateFromLeftSx = (delayMs) => animated && animationPreset === 'sides'
|
|
61
|
-
? {
|
|
62
|
-
animation: `jbHeaderFadeInLeft ${animationDurationMs}ms ease-out ${delayMs}ms both`
|
|
63
|
-
}
|
|
64
|
-
: animateSx(delayMs);
|
|
65
|
-
const animateFromRightSx = (delayMs) => animated && animationPreset === 'sides'
|
|
66
|
-
? {
|
|
67
|
-
animation: `jbHeaderFadeInRight ${animationDurationMs}ms ease-out ${delayMs}ms both`
|
|
68
|
-
}
|
|
69
|
-
: animateSx(delayMs);
|
|
70
|
-
return (_jsxs(Box, { sx: {
|
|
71
|
-
width: '100%',
|
|
72
|
-
display: 'flex',
|
|
73
|
-
flexDirection: 'column',
|
|
74
|
-
gap: 2,
|
|
75
|
-
p: { xs: 2, sm: 3 },
|
|
76
|
-
'@keyframes jbHeaderFadeIn': {
|
|
77
|
-
from: { opacity: 0, transform: 'translateY(10px)' },
|
|
78
|
-
to: { opacity: 1, transform: 'translateY(0)' }
|
|
79
|
-
},
|
|
80
|
-
'@keyframes jbHeaderFadeInLeft': {
|
|
81
|
-
from: { opacity: 0, transform: 'translateX(-16px)' },
|
|
82
|
-
to: { opacity: 1, transform: 'translateX(0)' }
|
|
83
|
-
},
|
|
84
|
-
'@keyframes jbHeaderFadeInRight': {
|
|
85
|
-
from: { opacity: 0, transform: 'translateX(16px)' },
|
|
86
|
-
to: { opacity: 1, transform: 'translateX(0)' }
|
|
87
|
-
}
|
|
88
|
-
}, children: [breadcrumb ? _jsx(Box, { sx: animateSx(0), children: breadcrumb }) : null, backContent ? _jsx(Box, { sx: animateSx(animationStaggerMs), children: backContent }) : null, showBackButton && onBackClick ? (_jsx(Typography, { role: "button", color: "text.primary", sx: {
|
|
89
|
-
display: 'inline-flex',
|
|
90
|
-
alignItems: 'center',
|
|
91
|
-
gap: 0.75,
|
|
92
|
-
width: 'fit-content',
|
|
93
|
-
alignSelf: { xs: 'center', md: 'flex-start' },
|
|
94
|
-
fontWeight: 500,
|
|
95
|
-
fontSize: { xs: '0.95rem', md: '1rem' },
|
|
96
|
-
cursor: 'pointer',
|
|
97
|
-
opacity: 0.9,
|
|
98
|
-
transition: 'all .16s ease',
|
|
99
|
-
'&:hover': { opacity: 1, color: 'primary.main' },
|
|
100
|
-
...animateSx(animationStaggerMs * 2)
|
|
101
|
-
}, onClick: onBackClick, children: `← ${resolvedBackLabel}` })) : null, _jsxs(Box, { sx: {
|
|
102
|
-
display: { xs: 'flex', md: 'grid' },
|
|
103
|
-
flexDirection: { xs: 'column', md: 'row' },
|
|
104
|
-
gridTemplateColumns: { md: 'minmax(0, 1fr) auto' },
|
|
105
|
-
alignItems: { xs: 'center', md: 'center' },
|
|
106
|
-
width: '100%',
|
|
107
|
-
gap: 2
|
|
108
|
-
}, children: [_jsxs(Box, { sx: {
|
|
109
|
-
display: 'flex',
|
|
110
|
-
alignItems: 'center',
|
|
111
|
-
justifyContent: { xs: 'center', md: 'flex-start' },
|
|
112
|
-
gap: 1.25,
|
|
113
|
-
minWidth: 0,
|
|
114
|
-
width: '100%',
|
|
115
|
-
...animateFromLeftSx(animationStaggerMs * 3)
|
|
116
|
-
}, children: [resolvedIcon ? _jsx(Box, { sx: { display: 'inline-flex', alignItems: 'center' }, children: resolvedIcon }) : null, _jsxs(Box, { sx: { minWidth: 0, textAlign: { xs: 'center', md: 'left' } }, children: [_jsx(Typography, { variant: "h5", sx: { fontWeight: 700, lineHeight: 1.15 }, children: resolvedTitle }), resolvedSubtitle ? (_jsx(Typography, { variant: "body2", sx: (theme) => ({
|
|
117
|
-
mt: 0.4,
|
|
118
|
-
fontWeight: 500,
|
|
119
|
-
lineHeight: 1.1,
|
|
120
|
-
color: theme.palette.mode === 'dark'
|
|
121
|
-
? alpha(theme.palette.common.white, 0.9)
|
|
122
|
-
: theme.palette.primary.dark
|
|
123
|
-
}), children: resolvedSubtitle })) : null] })] }), _jsx(Box, { sx: {
|
|
124
|
-
width: { xs: '100%', md: 'auto' },
|
|
125
|
-
display: 'flex',
|
|
126
|
-
justifySelf: { md: 'end' },
|
|
127
|
-
justifyContent: { xs: 'center', md: 'flex-end' },
|
|
128
|
-
alignItems: 'center',
|
|
129
|
-
...animateFromRightSx(animationStaggerMs * 4)
|
|
130
|
-
}, children: resolvedRightContent })] })] }));
|
|
131
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/layout/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JBFormContentSkeleton.d.ts","sourceRoot":"","sources":["../../../src/core/skeletons/JBFormContentSkeleton.tsx"],"names":[],"mappings":"AAEA,MAAM,MAAM,0BAA0B,GAAG;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,2CA8BtE"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Skeleton } from '@mui/material';
|
|
3
|
-
export function JBFormContentSkeleton(props) {
|
|
4
|
-
const { fieldCount = 4 } = props;
|
|
5
|
-
const fields = Array.from({ length: fieldCount });
|
|
6
|
-
return (_jsx(Box, { sx: {
|
|
7
|
-
width: '100%',
|
|
8
|
-
display: 'flex',
|
|
9
|
-
flexDirection: 'column',
|
|
10
|
-
gap: 3
|
|
11
|
-
}, children: fields.map((_, index) => (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 1 }, children: [_jsx(Skeleton, { variant: "text", width: 140, height: 24 }), _jsx(Skeleton, { variant: "rounded", width: "100%", height: 44 })] }, index))) }));
|
|
12
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export type JBFormHeaderSkeletonProps = {
|
|
2
|
-
showBackLink?: boolean;
|
|
3
|
-
showActions?: boolean;
|
|
4
|
-
};
|
|
5
|
-
export declare function JBFormHeaderSkeleton(props: JBFormHeaderSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
//# sourceMappingURL=JBFormHeaderSkeleton.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JBFormHeaderSkeleton.d.ts","sourceRoot":"","sources":["../../../src/core/skeletons/JBFormHeaderSkeleton.tsx"],"names":[],"mappings":"AAEA,MAAM,MAAM,yBAAyB,GAAG;IACtC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,2CAwEpE"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Skeleton } from '@mui/material';
|
|
3
|
-
export function JBFormHeaderSkeleton(props) {
|
|
4
|
-
const { showBackLink = true, showActions = true } = props;
|
|
5
|
-
return (_jsxs(Box, { sx: {
|
|
6
|
-
width: '100%',
|
|
7
|
-
display: 'flex',
|
|
8
|
-
flexDirection: 'column',
|
|
9
|
-
gap: 2,
|
|
10
|
-
p: { xs: 2, sm: 3 }
|
|
11
|
-
}, children: [_jsx(Skeleton, { variant: "rounded", width: 300, height: 28 }), showBackLink ? (_jsx(Skeleton, { variant: "text", width: 170, height: 30 })) : null, _jsxs(Box, { sx: {
|
|
12
|
-
display: { xs: 'flex', sm: 'grid' },
|
|
13
|
-
flexDirection: { xs: 'column', sm: 'row' },
|
|
14
|
-
gridTemplateColumns: { sm: 'minmax(0, 1fr) auto' },
|
|
15
|
-
alignItems: { xs: 'stretch', sm: 'center' },
|
|
16
|
-
width: '100%',
|
|
17
|
-
gap: 2
|
|
18
|
-
}, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 1.25, minWidth: 0 }, children: [_jsx(Skeleton, { variant: "circular", width: 30, height: 30 }), _jsxs(Box, { sx: { minWidth: 0 }, children: [_jsx(Skeleton, { variant: "text", width: 280, height: 52 }), _jsx(Skeleton, { variant: "text", width: 240, height: 30 })] })] }), showActions ? (_jsxs(Box, { sx: { display: 'flex', gap: 1, justifySelf: { sm: 'end' } }, children: [_jsx(Skeleton, { variant: "rounded", width: 116, height: 42 }), _jsx(Skeleton, { variant: "rounded", width: 116, height: 42 })] })) : null] })] }));
|
|
19
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/skeletons/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { TextFieldProps } from '@mui/material';
|
|
2
|
-
import { FieldValues, Path } from 'react-hook-form';
|
|
3
|
-
import { JBFieldControlProps, SelectOption } from './types';
|
|
4
|
-
export type JBAutocompleteFieldProps<TFieldValues extends FieldValues, TName extends Path<TFieldValues>> = JBFieldControlProps<TFieldValues, TName> & Omit<TextFieldProps, 'name' | 'defaultValue' | 'value' | 'onChange' | 'error' | 'helperText'> & {
|
|
5
|
-
options: SelectOption[];
|
|
6
|
-
loading?: boolean;
|
|
7
|
-
disableClearable?: boolean;
|
|
8
|
-
noOptionsText?: string;
|
|
9
|
-
onSearchTextChange?: (value: string) => void;
|
|
10
|
-
};
|
|
11
|
-
export declare function JBAutocompleteField<TFieldValues extends FieldValues, TName extends Path<TFieldValues>>(props: JBAutocompleteFieldProps<TFieldValues, TName>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
//# sourceMappingURL=JBAutocompleteField.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JBAutocompleteField.d.ts","sourceRoot":"","sources":["../../src/forms/JBAutocompleteField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6C,cAAc,EAAE,MAAM,eAAe,CAAC;AAC1F,OAAO,EAAc,WAAW,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5D,MAAM,MAAM,wBAAwB,CAClC,YAAY,SAAS,WAAW,EAChC,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,IAC9B,mBAAmB,CAAC,YAAY,EAAE,KAAK,CAAC,GAC1C,IAAI,CACF,cAAc,EACd,MAAM,GAAG,cAAc,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,GAAG,YAAY,CACxE,GAAG;IACF,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C,CAAC;AAEJ,wBAAgB,mBAAmB,CACjC,YAAY,SAAS,WAAW,EAChC,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,EAChC,KAAK,EAAE,wBAAwB,CAAC,YAAY,EAAE,KAAK,CAAC,2CAwErD"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Autocomplete, CircularProgress, TextField } from '@mui/material';
|
|
3
|
-
import { Controller } from 'react-hook-form';
|
|
4
|
-
import { getJBFieldErrorMessage } from './utils';
|
|
5
|
-
export function JBAutocompleteField(props) {
|
|
6
|
-
const { control, name, rules, options, loading = false, disableClearable = false, noOptionsText = 'Sin opciones', onSearchTextChange, size = 'medium', ...textFieldProps } = props;
|
|
7
|
-
return (_jsx(Controller, { control: control, name: name, rules: rules, render: ({ field, fieldState }) => {
|
|
8
|
-
const selectedOption = options.find((option) => String(option.value) === String(field.value ?? '')) ?? null;
|
|
9
|
-
return (_jsx(Autocomplete, { options: options, value: selectedOption, disabled: textFieldProps.disabled, loading: loading, disableClearable: disableClearable, noOptionsText: noOptionsText, getOptionDisabled: (option) => !!option.disabled, getOptionLabel: (option) => option.label ?? '', isOptionEqualToValue: (option, value) => String(option.value) === String(value.value), onChange: (_, option) => {
|
|
10
|
-
field.onChange(option ? option.value : '');
|
|
11
|
-
}, onInputChange: (_, value, reason) => {
|
|
12
|
-
if (reason === 'input') {
|
|
13
|
-
onSearchTextChange?.(value);
|
|
14
|
-
}
|
|
15
|
-
}, renderInput: (params) => (_jsx(TextField, { ...params, ...textFieldProps, name: field.name, size: size, error: !!fieldState.error, helperText: getJBFieldErrorMessage(fieldState.error), inputRef: field.ref, InputProps: {
|
|
16
|
-
...params.InputProps,
|
|
17
|
-
endAdornment: (_jsxs(_Fragment, { children: [loading ? (_jsx(CircularProgress, { color: "inherit", size: 16 })) : null, params.InputProps.endAdornment] }))
|
|
18
|
-
} })) }));
|
|
19
|
-
} }));
|
|
20
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { CheckboxProps, FormControlLabelProps, FormControlProps, SxProps, Theme } from '@mui/material';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
import { FieldValues, Path } from 'react-hook-form';
|
|
4
|
-
import { JBFieldControlProps } from './types';
|
|
5
|
-
export type JBCheckboxFieldProps<TFieldValues extends FieldValues, TName extends Path<TFieldValues>> = JBFieldControlProps<TFieldValues, TName> & Omit<CheckboxProps, 'name' | 'checked' | 'onChange' | 'defaultChecked'> & {
|
|
6
|
-
label: ReactNode;
|
|
7
|
-
formControlProps?: Omit<FormControlProps, 'error'>;
|
|
8
|
-
formControlLabelProps?: Omit<FormControlLabelProps, 'control' | 'label'>;
|
|
9
|
-
checkboxSx?: SxProps<Theme>;
|
|
10
|
-
};
|
|
11
|
-
export declare function JBCheckboxField<TFieldValues extends FieldValues, TName extends Path<TFieldValues>>(props: JBCheckboxFieldProps<TFieldValues, TName>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
//# sourceMappingURL=JBCheckboxField.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JBCheckboxField.d.ts","sourceRoot":"","sources":["../../src/forms/JBCheckboxField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EAGb,qBAAqB,EACrB,gBAAgB,EAEhB,OAAO,EACP,KAAK,EACN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAc,WAAW,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAG9C,MAAM,MAAM,oBAAoB,CAC9B,YAAY,SAAS,WAAW,EAChC,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,IAC9B,mBAAmB,CAAC,YAAY,EAAE,KAAK,CAAC,GAC1C,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,gBAAgB,CAAC,GAAG;IACxE,KAAK,EAAE,SAAS,CAAC;IACjB,gBAAgB,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IACnD,qBAAqB,CAAC,EAAE,IAAI,CAAC,qBAAqB,EAAE,SAAS,GAAG,OAAO,CAAC,CAAC;IACzE,UAAU,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CAC7B,CAAC;AAEJ,wBAAgB,eAAe,CAC7B,YAAY,SAAS,WAAW,EAChC,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,EAChC,KAAK,EAAE,oBAAoB,CAAC,YAAY,EAAE,KAAK,CAAC,2CAsEjD"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Checkbox, FormControl, FormControlLabel, FormHelperText } from '@mui/material';
|
|
3
|
-
import { Controller } from 'react-hook-form';
|
|
4
|
-
import { getJBFieldErrorMessage } from './utils';
|
|
5
|
-
export function JBCheckboxField(props) {
|
|
6
|
-
const { control, name, rules, label, formControlProps, formControlLabelProps, checkboxSx, ...checkboxProps } = props;
|
|
7
|
-
return (_jsx(Controller, { control: control, name: name, rules: rules, render: ({ field, fieldState }) => (_jsxs(FormControl, { ...formControlProps, error: !!fieldState.error, children: [_jsx(FormControlLabel, { ...formControlLabelProps, label: label, sx: {
|
|
8
|
-
alignItems: 'center',
|
|
9
|
-
m: 0,
|
|
10
|
-
columnGap: 1,
|
|
11
|
-
'& .MuiFormControlLabel-label': {
|
|
12
|
-
fontSize: 14,
|
|
13
|
-
lineHeight: 1.35,
|
|
14
|
-
color: 'text.primary'
|
|
15
|
-
}
|
|
16
|
-
}, control: _jsx(Checkbox, { ...checkboxProps, size: checkboxProps.size ?? 'small', inputRef: field.ref, checked: !!field.value, onBlur: field.onBlur, onChange: (_, checked) => {
|
|
17
|
-
field.onChange(checked);
|
|
18
|
-
}, sx: {
|
|
19
|
-
p: 0.25,
|
|
20
|
-
borderRadius: 1,
|
|
21
|
-
'& .MuiSvgIcon-root': {
|
|
22
|
-
fontSize: 18
|
|
23
|
-
},
|
|
24
|
-
'&:not(.Mui-checked) .MuiSvgIcon-root': {
|
|
25
|
-
color: 'transparent',
|
|
26
|
-
border: '1px solid',
|
|
27
|
-
borderColor: 'rgba(15, 23, 42, 0.35)',
|
|
28
|
-
borderRadius: '4px',
|
|
29
|
-
backgroundColor: 'background.paper'
|
|
30
|
-
},
|
|
31
|
-
'&:hover:not(.Mui-checked) .MuiSvgIcon-root': {
|
|
32
|
-
borderColor: 'rgba(15, 23, 42, 0.55)'
|
|
33
|
-
},
|
|
34
|
-
...(checkboxSx ?? {})
|
|
35
|
-
} }) }), _jsx(FormHelperText, { children: getJBFieldErrorMessage(fieldState.error) })] })) }));
|
|
36
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { TextFieldProps } from '@mui/material';
|
|
2
|
-
import { DatePicker } from '@mui/x-date-pickers';
|
|
3
|
-
import { ComponentProps } from 'react';
|
|
4
|
-
import { FieldValues, Path } from 'react-hook-form';
|
|
5
|
-
import { JBFieldControlProps } from './types';
|
|
6
|
-
type MuiDatePickerProps = ComponentProps<typeof DatePicker>;
|
|
7
|
-
export type JBDatePickerFieldProps<TFieldValues extends FieldValues, TName extends Path<TFieldValues>> = JBFieldControlProps<TFieldValues, TName> & Omit<MuiDatePickerProps, 'value' | 'onChange' | 'slotProps'> & {
|
|
8
|
-
textFieldProps?: TextFieldProps;
|
|
9
|
-
storeAsDateString?: boolean;
|
|
10
|
-
};
|
|
11
|
-
export declare function JBDatePickerField<TFieldValues extends FieldValues, TName extends Path<TFieldValues>>(props: JBDatePickerFieldProps<TFieldValues, TName>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=JBDatePickerField.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JBDatePickerField.d.ts","sourceRoot":"","sources":["../../src/forms/JBDatePickerField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAwB,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAc,WAAW,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAG9C,KAAK,kBAAkB,GAAG,cAAc,CAAC,OAAO,UAAU,CAAC,CAAC;AAE5D,MAAM,MAAM,sBAAsB,CAChC,YAAY,SAAS,WAAW,EAChC,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,IAC9B,mBAAmB,CAAC,YAAY,EAAE,KAAK,CAAC,GAC1C,IAAI,CAAC,kBAAkB,EAAE,OAAO,GAAG,UAAU,GAAG,WAAW,CAAC,GAAG;IAC7D,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAyCJ,wBAAgB,iBAAiB,CAC/B,YAAY,SAAS,WAAW,EAChC,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,EAChC,KAAK,EAAE,sBAAsB,CAAC,YAAY,EAAE,KAAK,CAAC,2CAmCnD"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
|
|
3
|
-
import { DatePicker, LocalizationProvider } from '@mui/x-date-pickers';
|
|
4
|
-
import { Controller } from 'react-hook-form';
|
|
5
|
-
import { getJBFieldErrorMessage } from './utils';
|
|
6
|
-
const asDateValue = (value) => {
|
|
7
|
-
if (value instanceof Date && !Number.isNaN(value.getTime())) {
|
|
8
|
-
return value;
|
|
9
|
-
}
|
|
10
|
-
if (typeof value !== 'string' || !value.trim()) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
const isoDateOnlyMatch = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value.trim());
|
|
14
|
-
if (isoDateOnlyMatch) {
|
|
15
|
-
const year = Number(isoDateOnlyMatch[1]);
|
|
16
|
-
const month = Number(isoDateOnlyMatch[2]);
|
|
17
|
-
const day = Number(isoDateOnlyMatch[3]);
|
|
18
|
-
const localDate = new Date(year, month - 1, day);
|
|
19
|
-
if (!Number.isNaN(localDate.getTime())) {
|
|
20
|
-
return localDate;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
const parsed = new Date(value);
|
|
24
|
-
if (Number.isNaN(parsed.getTime())) {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
return parsed;
|
|
28
|
-
};
|
|
29
|
-
const formatDateValue = (value) => {
|
|
30
|
-
if (!(value instanceof Date) || Number.isNaN(value.getTime())) {
|
|
31
|
-
return '';
|
|
32
|
-
}
|
|
33
|
-
const year = value.getFullYear();
|
|
34
|
-
const month = String(value.getMonth() + 1).padStart(2, '0');
|
|
35
|
-
const day = String(value.getDate()).padStart(2, '0');
|
|
36
|
-
return `${year}-${month}-${day}`;
|
|
37
|
-
};
|
|
38
|
-
export function JBDatePickerField(props) {
|
|
39
|
-
const { control, name, rules, textFieldProps, storeAsDateString = false, ...datePickerProps } = props;
|
|
40
|
-
const { size = 'medium', ...resolvedTextFieldProps } = textFieldProps ?? {};
|
|
41
|
-
return (_jsx(Controller, { control: control, name: name, rules: rules, render: ({ field, fieldState }) => (_jsx(LocalizationProvider, { dateAdapter: AdapterDateFns, children: _jsx(DatePicker, { ...datePickerProps, value: storeAsDateString ? asDateValue(field.value) : field.value ?? null, onChange: (value) => field.onChange(storeAsDateString ? formatDateValue(value) : value), slotProps: {
|
|
42
|
-
textField: {
|
|
43
|
-
...resolvedTextFieldProps,
|
|
44
|
-
size,
|
|
45
|
-
error: !!fieldState.error,
|
|
46
|
-
helperText: getJBFieldErrorMessage(fieldState.error) ?? resolvedTextFieldProps.helperText
|
|
47
|
-
}
|
|
48
|
-
} }) })) }));
|
|
49
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { FormControlProps, RadioGroupProps } from '@mui/material';
|
|
2
|
-
import { FieldValues, Path } from 'react-hook-form';
|
|
3
|
-
import { JBFieldControlProps, SelectOption } from './types';
|
|
4
|
-
export type JBRadioGroupFieldProps<TFieldValues extends FieldValues, TName extends Path<TFieldValues>> = JBFieldControlProps<TFieldValues, TName> & Omit<RadioGroupProps, 'name' | 'value' | 'onChange'> & {
|
|
5
|
-
label?: string;
|
|
6
|
-
options: SelectOption[];
|
|
7
|
-
formControlProps?: Omit<FormControlProps, 'error'>;
|
|
8
|
-
};
|
|
9
|
-
export declare function JBRadioGroupField<TFieldValues extends FieldValues, TName extends Path<TFieldValues>>(props: JBRadioGroupFieldProps<TFieldValues, TName>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
//# sourceMappingURL=JBRadioGroupField.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JBRadioGroupField.d.ts","sourceRoot":"","sources":["../../src/forms/JBRadioGroupField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,gBAAgB,EAKhB,eAAe,EAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAc,WAAW,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5D,MAAM,MAAM,sBAAsB,CAChC,YAAY,SAAS,WAAW,EAChC,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,IAC9B,mBAAmB,CAAC,YAAY,EAAE,KAAK,CAAC,GAC1C,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC,GAAG;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,gBAAgB,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;CACpD,CAAC;AAEJ,wBAAgB,iBAAiB,CAC/B,YAAY,SAAS,WAAW,EAChC,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,EAChC,KAAK,EAAE,sBAAsB,CAAC,YAAY,EAAE,KAAK,CAAC,2CAkCnD"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { FormControl, FormControlLabel, FormHelperText, FormLabel, Radio, RadioGroup } from '@mui/material';
|
|
3
|
-
import { Controller } from 'react-hook-form';
|
|
4
|
-
import { getJBFieldErrorMessage } from './utils';
|
|
5
|
-
export function JBRadioGroupField(props) {
|
|
6
|
-
const { control, name, rules, label, options, formControlProps, ...radioGroupProps } = props;
|
|
7
|
-
return (_jsx(Controller, { control: control, name: name, rules: rules, render: ({ field, fieldState }) => (_jsxs(FormControl, { ...formControlProps, error: !!fieldState.error, children: [label ? _jsx(FormLabel, { children: label }) : null, _jsx(RadioGroup, { ...radioGroupProps, name: field.name, value: field.value ?? '', onBlur: field.onBlur, onChange: (_, value) => field.onChange(value), children: options.map((option) => (_jsx(FormControlLabel, { value: option.value, disabled: option.disabled, control: _jsx(Radio, { inputRef: field.ref }), label: option.label }, `${option.value}`))) }), _jsx(FormHelperText, { children: getJBFieldErrorMessage(fieldState.error) })] })) }));
|
|
8
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { TextFieldProps } from '@mui/material';
|
|
2
|
-
import { FieldValues, Path } from 'react-hook-form';
|
|
3
|
-
import { JBFieldControlProps, SelectOption } from './types';
|
|
4
|
-
export type JBSelectFieldProps<TFieldValues extends FieldValues, TName extends Path<TFieldValues>> = JBFieldControlProps<TFieldValues, TName> & Omit<TextFieldProps, 'name' | 'defaultValue' | 'value' | 'onChange' | 'error' | 'helperText' | 'select'> & {
|
|
5
|
-
options: SelectOption[];
|
|
6
|
-
emptyOptionLabel?: string;
|
|
7
|
-
};
|
|
8
|
-
export declare function JBSelectField<TFieldValues extends FieldValues, TName extends Path<TFieldValues>>(props: JBSelectFieldProps<TFieldValues, TName>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
//# sourceMappingURL=JBSelectField.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JBSelectField.d.ts","sourceRoot":"","sources":["../../src/forms/JBSelectField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,cAAc,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAc,WAAW,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5D,MAAM,MAAM,kBAAkB,CAC5B,YAAY,SAAS,WAAW,EAChC,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,IAC9B,mBAAmB,CAAC,YAAY,EAAE,KAAK,CAAC,GAC1C,IAAI,CACF,cAAc,EACd,MAAM,GAAG,cAAc,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,GAAG,YAAY,GAAG,QAAQ,CACnF,GAAG;IACF,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEJ,wBAAgB,aAAa,CAC3B,YAAY,SAAS,WAAW,EAChC,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,EAChC,KAAK,EAAE,kBAAkB,CAAC,YAAY,EAAE,KAAK,CAAC,2CA8B/C"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { MenuItem, TextField } from '@mui/material';
|
|
3
|
-
import { Controller } from 'react-hook-form';
|
|
4
|
-
import { getJBFieldErrorMessage } from './utils';
|
|
5
|
-
export function JBSelectField(props) {
|
|
6
|
-
const { control, name, rules, options, emptyOptionLabel, size = 'medium', ...textFieldProps } = props;
|
|
7
|
-
return (_jsx(Controller, { control: control, name: name, rules: rules, render: ({ field, fieldState }) => (_jsxs(TextField, { ...textFieldProps, ...field, size: size, select: true, value: field.value ?? '', error: !!fieldState.error, helperText: getJBFieldErrorMessage(fieldState.error), children: [emptyOptionLabel ? _jsx(MenuItem, { value: "", children: emptyOptionLabel }) : null, options.map((option, index) => (_jsx(MenuItem, { value: option.value, disabled: option.disabled, children: option.label }, `${option.value}-${index}`)))] })) }));
|
|
8
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { FormControlLabelProps, FormControlProps, SwitchProps } from '@mui/material';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
import { FieldValues, Path } from 'react-hook-form';
|
|
4
|
-
import { JBFieldControlProps } from './types';
|
|
5
|
-
export type JBSwitchFieldProps<TFieldValues extends FieldValues, TName extends Path<TFieldValues>> = JBFieldControlProps<TFieldValues, TName> & Omit<SwitchProps, 'name' | 'checked' | 'onChange' | 'defaultChecked'> & {
|
|
6
|
-
label: ReactNode;
|
|
7
|
-
formControlProps?: Omit<FormControlProps, 'error'>;
|
|
8
|
-
formControlLabelProps?: Omit<FormControlLabelProps, 'control' | 'label'>;
|
|
9
|
-
};
|
|
10
|
-
export declare function JBSwitchField<TFieldValues extends FieldValues, TName extends Path<TFieldValues>>(props: JBSwitchFieldProps<TFieldValues, TName>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
//# sourceMappingURL=JBSwitchField.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JBSwitchField.d.ts","sourceRoot":"","sources":["../../src/forms/JBSwitchField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,qBAAqB,EACrB,gBAAgB,EAGhB,WAAW,EACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAc,WAAW,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAG9C,MAAM,MAAM,kBAAkB,CAC5B,YAAY,SAAS,WAAW,EAChC,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,IAC9B,mBAAmB,CAAC,YAAY,EAAE,KAAK,CAAC,GAC1C,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,gBAAgB,CAAC,GAAG;IACtE,KAAK,EAAE,SAAS,CAAC;IACjB,gBAAgB,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IACnD,qBAAqB,CAAC,EAAE,IAAI,CAAC,qBAAqB,EAAE,SAAS,GAAG,OAAO,CAAC,CAAC;CAC1E,CAAC;AAEJ,wBAAgB,aAAa,CAC3B,YAAY,SAAS,WAAW,EAChC,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,EAChC,KAAK,EAAE,kBAAkB,CAAC,YAAY,EAAE,KAAK,CAAC,2CAiC/C"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { FormControl, FormControlLabel, FormHelperText, Switch } from '@mui/material';
|
|
3
|
-
import { Controller } from 'react-hook-form';
|
|
4
|
-
import { getJBFieldErrorMessage } from './utils';
|
|
5
|
-
export function JBSwitchField(props) {
|
|
6
|
-
const { control, name, rules, label, formControlProps, formControlLabelProps, ...switchProps } = props;
|
|
7
|
-
return (_jsx(Controller, { control: control, name: name, rules: rules, render: ({ field, fieldState }) => (_jsxs(FormControl, { ...formControlProps, error: !!fieldState.error, children: [_jsx(FormControlLabel, { ...formControlLabelProps, label: label, control: _jsx(Switch, { ...switchProps, inputRef: field.ref, checked: !!field.value, onBlur: field.onBlur, onChange: (_, checked) => {
|
|
8
|
-
field.onChange(checked);
|
|
9
|
-
} }) }), _jsx(FormHelperText, { children: getJBFieldErrorMessage(fieldState.error) })] })) }));
|
|
10
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { TextFieldProps } from '@mui/material';
|
|
2
|
-
import { FieldValues, Path } from 'react-hook-form';
|
|
3
|
-
import { JBFieldControlProps } from './types';
|
|
4
|
-
export type JBTextFieldProps<TFieldValues extends FieldValues, TName extends Path<TFieldValues>> = JBFieldControlProps<TFieldValues, TName> & Omit<TextFieldProps, 'name' | 'defaultValue' | 'value' | 'onChange' | 'error' | 'helperText'>;
|
|
5
|
-
export declare function JBTextField<TFieldValues extends FieldValues, TName extends Path<TFieldValues>>(props: JBTextFieldProps<TFieldValues, TName>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
//# sourceMappingURL=JBTextField.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JBTextField.d.ts","sourceRoot":"","sources":["../../src/forms/JBTextField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,cAAc,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAc,WAAW,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAG9C,MAAM,MAAM,gBAAgB,CAC1B,YAAY,SAAS,WAAW,EAChC,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,IAC9B,mBAAmB,CAAC,YAAY,EAAE,KAAK,CAAC,GAC1C,IAAI,CACF,cAAc,EACd,MAAM,GAAG,cAAc,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,GAAG,YAAY,CACxE,CAAC;AAEJ,wBAAgB,WAAW,CACzB,YAAY,SAAS,WAAW,EAChC,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,EAChC,KAAK,EAAE,gBAAgB,CAAC,YAAY,EAAE,KAAK,CAAC,2CAoB7C"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { TextField } from '@mui/material';
|
|
3
|
-
import { Controller } from 'react-hook-form';
|
|
4
|
-
import { getJBFieldErrorMessage } from './utils';
|
|
5
|
-
export function JBTextField(props) {
|
|
6
|
-
const { control, name, rules, size = 'medium', ...textFieldProps } = props;
|
|
7
|
-
return (_jsx(Controller, { control: control, name: name, rules: rules, render: ({ field, fieldState }) => (_jsx(TextField, { ...textFieldProps, ...field, size: size, value: field.value ?? '', error: !!fieldState.error, helperText: getJBFieldErrorMessage(fieldState.error) })) }));
|
|
8
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { TextFieldProps } from '@mui/material';
|
|
2
|
-
import { TimePicker } from '@mui/x-date-pickers';
|
|
3
|
-
import { ComponentProps } from 'react';
|
|
4
|
-
import { FieldValues, Path } from 'react-hook-form';
|
|
5
|
-
import { JBFieldControlProps } from './types';
|
|
6
|
-
type MuiTimePickerProps = ComponentProps<typeof TimePicker>;
|
|
7
|
-
export type JBTimePickerFieldProps<TFieldValues extends FieldValues, TName extends Path<TFieldValues>> = JBFieldControlProps<TFieldValues, TName> & Omit<MuiTimePickerProps, 'value' | 'onChange' | 'slotProps'> & {
|
|
8
|
-
textFieldProps?: TextFieldProps;
|
|
9
|
-
};
|
|
10
|
-
export declare function JBTimePickerField<TFieldValues extends FieldValues, TName extends Path<TFieldValues>>(props: JBTimePickerFieldProps<TFieldValues, TName>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export {};
|
|
12
|
-
//# sourceMappingURL=JBTimePickerField.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JBTimePickerField.d.ts","sourceRoot":"","sources":["../../src/forms/JBTimePickerField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAwB,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAc,WAAW,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAG9C,KAAK,kBAAkB,GAAG,cAAc,CAAC,OAAO,UAAU,CAAC,CAAC;AAE5D,MAAM,MAAM,sBAAsB,CAChC,YAAY,SAAS,WAAW,EAChC,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,IAC9B,mBAAmB,CAAC,YAAY,EAAE,KAAK,CAAC,GAC1C,IAAI,CAAC,kBAAkB,EAAE,OAAO,GAAG,UAAU,GAAG,WAAW,CAAC,GAAG;IAC7D,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,CAAC;AAEJ,wBAAgB,iBAAiB,CAC/B,YAAY,SAAS,WAAW,EAChC,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,EAChC,KAAK,EAAE,sBAAsB,CAAC,YAAY,EAAE,KAAK,CAAC,2CA4BnD"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
|
|
3
|
-
import { LocalizationProvider, TimePicker } from '@mui/x-date-pickers';
|
|
4
|
-
import { Controller } from 'react-hook-form';
|
|
5
|
-
import { getJBFieldErrorMessage } from './utils';
|
|
6
|
-
export function JBTimePickerField(props) {
|
|
7
|
-
const { control, name, rules, textFieldProps, ...timePickerProps } = props;
|
|
8
|
-
const { size = 'medium', ...resolvedTextFieldProps } = textFieldProps ?? {};
|
|
9
|
-
return (_jsx(Controller, { control: control, name: name, rules: rules, render: ({ field, fieldState }) => (_jsx(LocalizationProvider, { dateAdapter: AdapterDateFns, children: _jsx(TimePicker, { ...timePickerProps, value: field.value ?? null, onChange: (value) => field.onChange(value), slotProps: {
|
|
10
|
-
textField: {
|
|
11
|
-
...resolvedTextFieldProps,
|
|
12
|
-
size,
|
|
13
|
-
error: !!fieldState.error,
|
|
14
|
-
helperText: getJBFieldErrorMessage(fieldState.error) ?? resolvedTextFieldProps.helperText
|
|
15
|
-
}
|
|
16
|
-
} }) })) }));
|
|
17
|
-
}
|
package/dist/forms/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export * from './types';
|
|
2
|
-
export * from './utils';
|
|
3
|
-
export * from './rules';
|
|
4
|
-
export * from './zod';
|
|
5
|
-
export * from './JBTextField';
|
|
6
|
-
export * from './JBSelectField';
|
|
7
|
-
export * from './JBAutocompleteField';
|
|
8
|
-
export * from './JBCheckboxField';
|
|
9
|
-
export * from './JBSwitchField';
|
|
10
|
-
export * from './JBRadioGroupField';
|
|
11
|
-
export * from './JBDatePickerField';
|
|
12
|
-
export * from './JBTimePickerField';
|
|
13
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/forms/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
|
package/dist/forms/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export * from './types';
|
|
2
|
-
export * from './utils';
|
|
3
|
-
export * from './rules';
|
|
4
|
-
export * from './zod';
|
|
5
|
-
export * from './JBTextField';
|
|
6
|
-
export * from './JBSelectField';
|
|
7
|
-
export * from './JBAutocompleteField';
|
|
8
|
-
export * from './JBCheckboxField';
|
|
9
|
-
export * from './JBSwitchField';
|
|
10
|
-
export * from './JBRadioGroupField';
|
|
11
|
-
export * from './JBDatePickerField';
|
|
12
|
-
export * from './JBTimePickerField';
|
package/dist/forms/rules.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { RegisterOptions } from 'react-hook-form';
|
|
2
|
-
type FieldRules = RegisterOptions<any, any>;
|
|
3
|
-
export declare const jbRules: {
|
|
4
|
-
required: (message?: string) => FieldRules;
|
|
5
|
-
email: (message?: string) => FieldRules;
|
|
6
|
-
minLength: (value: number, message?: string) => FieldRules;
|
|
7
|
-
maxLength: (value: number, message?: string) => FieldRules;
|
|
8
|
-
pattern: (value: RegExp, message: string) => FieldRules;
|
|
9
|
-
compose: (...rules: FieldRules[]) => FieldRules;
|
|
10
|
-
};
|
|
11
|
-
export {};
|
|
12
|
-
/**
|
|
13
|
-
* Puedes usar `rules` junto con `zodResolver`.
|
|
14
|
-
* Si ambos validan la misma regla, el mensaje visible depende del error que primero reciba el campo.
|
|
15
|
-
*/
|
|
16
|
-
//# sourceMappingURL=rules.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../src/forms/rules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,KAAK,UAAU,GAAG,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAI5C,eAAO,MAAM,OAAO;oCACiC,UAAU;iCACX,UAAU;uBAGzC,MAAM,YAAY,MAAM,KAAG,UAAU;uBAGrC,MAAM,YAAY,MAAM,KAAG,UAAU;qBAGvC,MAAM,WAAW,MAAM,KAAG,UAAU;wBAGjC,UAAU,EAAE,KAAG,UAAU;CAC9C,CAAC;;AAEF;;;GAGG"}
|
package/dist/forms/rules.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
2
|
-
export const jbRules = {
|
|
3
|
-
required: (message = 'Este campo es obligatorio') => ({ required: message }),
|
|
4
|
-
email: (message = 'Correo electrónico inválido') => ({
|
|
5
|
-
pattern: { value: EMAIL_REGEX, message }
|
|
6
|
-
}),
|
|
7
|
-
minLength: (value, message) => ({
|
|
8
|
-
minLength: { value, message: message ?? `Mínimo ${value} caracteres` }
|
|
9
|
-
}),
|
|
10
|
-
maxLength: (value, message) => ({
|
|
11
|
-
maxLength: { value, message: message ?? `Máximo ${value} caracteres` }
|
|
12
|
-
}),
|
|
13
|
-
pattern: (value, message) => ({
|
|
14
|
-
pattern: { value, message }
|
|
15
|
-
}),
|
|
16
|
-
compose: (...rules) => Object.assign({}, ...rules)
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Puedes usar `rules` junto con `zodResolver`.
|
|
20
|
-
* Si ambos validan la misma regla, el mensaje visible depende del error que primero reciba el campo.
|
|
21
|
-
*/
|