@gusto/embedded-react-sdk 0.36.0 → 0.37.0
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/CHANGELOG.md +58 -0
- package/README.md +6 -0
- package/dist/UNSTABLE_Hooks.d.ts +1 -1
- package/dist/UNSTABLE_Hooks.js +50 -6
- package/dist/UNSTABLE_Hooks.js.map +1 -1
- package/dist/components/Base/Base.d.ts +8 -9
- package/dist/components/Base/Base.js +123 -101
- package/dist/components/Base/Base.js.map +1 -1
- package/dist/components/Base/index.d.ts +1 -1
- package/dist/components/Base/useBase.d.ts +3 -7
- package/dist/components/Base/useBase.js.map +1 -1
- package/dist/components/Base/useBaseSubmit.d.ts +3 -5
- package/dist/components/Base/useBaseSubmit.js +27 -50
- package/dist/components/Base/useBaseSubmit.js.map +1 -1
- package/dist/components/Common/Fields/CheckboxField/CheckboxField.d.ts +2 -0
- package/dist/components/Common/Fields/CheckboxField/CheckboxField.js +17 -16
- package/dist/components/Common/Fields/CheckboxField/CheckboxField.js.map +1 -1
- package/dist/components/Common/Fields/DatePickerField/DatePickerField.d.ts +5 -3
- package/dist/components/Common/Fields/DatePickerField/DatePickerField.js +46 -36
- package/dist/components/Common/Fields/DatePickerField/DatePickerField.js.map +1 -1
- package/dist/components/Common/Fields/NumberInputField/NumberInputField.d.ts +2 -0
- package/dist/components/Common/Fields/NumberInputField/NumberInputField.js +21 -20
- package/dist/components/Common/Fields/NumberInputField/NumberInputField.js.map +1 -1
- package/dist/components/Common/Fields/RadioGroupField/RadioGroupField.d.ts +3 -1
- package/dist/components/Common/Fields/RadioGroupField/RadioGroupField.js +20 -19
- package/dist/components/Common/Fields/RadioGroupField/RadioGroupField.js.map +1 -1
- package/dist/components/Common/Fields/SelectField/SelectField.d.ts +3 -1
- package/dist/components/Common/Fields/SelectField/SelectField.js +19 -18
- package/dist/components/Common/Fields/SelectField/SelectField.js.map +1 -1
- package/dist/components/Common/Fields/SwitchField/SwitchField.d.ts +2 -0
- package/dist/components/Common/Fields/SwitchField/SwitchField.js +19 -18
- package/dist/components/Common/Fields/SwitchField/SwitchField.js.map +1 -1
- package/dist/components/Common/Fields/TextInputField/TextInputField.d.ts +2 -0
- package/dist/components/Common/Fields/TextInputField/TextInputField.js +10 -9
- package/dist/components/Common/Fields/TextInputField/TextInputField.js.map +1 -1
- package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/components/Common/UI/DescriptionList/DescriptionList.module.scss.js +2 -2
- package/dist/components/Common/UI/FileInput/FileInput.js +1 -1
- package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +8 -7
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +8 -7
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +10 -9
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +8 -7
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +8 -7
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +8 -7
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +13 -12
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +11 -10
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +8 -7
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +8 -7
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +8 -7
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js +60 -60
- package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
- package/dist/components/Company/PaySchedule/usePaySchedule.js +10 -9
- package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +8 -7
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +8 -7
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Contractor/Address/useAddress.js +10 -9
- package/dist/components/Contractor/Address/useAddress.js.map +1 -1
- package/dist/components/Contractor/Profile/ContractorProfileForm.js +15 -15
- package/dist/components/Contractor/Profile/useContractorProfile.js +41 -38
- package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +7 -6
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +14 -13
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +7 -6
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +8 -7
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +8 -7
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Employee/EmployeeList/useEmployeeList.js +8 -7
- package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/FederalTaxes.js +42 -42
- package/dist/components/Employee/FederalTaxes/FederalTaxes.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +8 -7
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +10 -9
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/HomeAddress.d.ts +3 -3
- package/dist/components/Employee/Profile/HomeAddress.js +38 -36
- package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
- package/dist/components/Employee/Profile/Profile.js +30 -29
- package/dist/components/Employee/Profile/Profile.js.map +1 -1
- package/dist/components/Employee/Profile/useProfile.js +8 -7
- package/dist/components/Employee/Profile/useProfile.js.map +1 -1
- package/dist/components/Employee/StateTaxes/StateTaxes.js +50 -50
- package/dist/components/Employee/StateTaxes/StateTaxes.js.map +1 -1
- package/dist/components/Employee/StateTaxes/useStateTaxes.js +8 -7
- package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
- package/dist/components/Employee/Taxes/Taxes.js +53 -53
- package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
- package/dist/components/Employee/Taxes/useTaxes.js +8 -7
- package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.d.ts +11 -0
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js +123 -0
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js.map +1 -0
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.d.ts +11 -0
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.js +92 -0
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.js.map +1 -0
- package/dist/components/Employee/Terminations/TerminationFlow/TerminationFlow.d.ts +2 -0
- package/dist/components/Employee/Terminations/TerminationFlow/TerminationFlow.js +30 -0
- package/dist/components/Employee/Terminations/TerminationFlow/TerminationFlow.js.map +1 -0
- package/dist/components/Employee/Terminations/TerminationFlow/TerminationFlowComponents.d.ts +23 -0
- package/dist/components/Employee/Terminations/TerminationFlow/TerminationFlowComponents.js +72 -0
- package/dist/components/Employee/Terminations/TerminationFlow/TerminationFlowComponents.js.map +1 -0
- package/dist/components/Employee/Terminations/TerminationFlow/index.d.ts +3 -0
- package/dist/components/Employee/Terminations/TerminationFlow/terminationStateMachine.d.ts +7 -0
- package/dist/components/Employee/Terminations/TerminationFlow/terminationStateMachine.js +165 -0
- package/dist/components/Employee/Terminations/TerminationFlow/terminationStateMachine.js.map +1 -0
- package/dist/components/Employee/Terminations/TerminationFlow/terminationStateMachine.test.d.ts +1 -0
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummary.d.ts +9 -0
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummary.js +86 -0
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummary.js.map +1 -0
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummaryPresentation.d.ts +20 -0
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummaryPresentation.js +103 -0
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummaryPresentation.js.map +1 -0
- package/dist/components/Employee/Terminations/TerminationsData.d.ts +6 -0
- package/dist/components/Employee/Terminations/index.d.ts +8 -0
- package/dist/components/Employee/Terminations/types.d.ts +1 -0
- package/dist/components/Employee/index.d.ts +7 -0
- package/dist/components/Employee/index.js +34 -28
- package/dist/components/Employee/index.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequests.js +31 -31
- package/dist/components/InformationRequests/InformationRequests.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js +41 -41
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js.map +1 -1
- package/dist/components/Payroll/Dismissal/DismissalFlow.d.ts +2 -0
- package/dist/components/Payroll/Dismissal/DismissalFlow.js +32 -0
- package/dist/components/Payroll/Dismissal/DismissalFlow.js.map +1 -0
- package/dist/components/Payroll/Dismissal/DismissalFlowComponents.d.ts +16 -0
- package/dist/components/Payroll/Dismissal/DismissalFlowComponents.js +52 -0
- package/dist/components/Payroll/Dismissal/DismissalFlowComponents.js.map +1 -0
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.d.ts +6 -0
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.js +69 -0
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.js.map +1 -0
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.d.ts +9 -0
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.js +53 -0
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.js.map +1 -0
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/index.d.ts +3 -0
- package/dist/components/Payroll/Dismissal/dismissalStateMachine.d.ts +6 -0
- package/dist/components/Payroll/Dismissal/dismissalStateMachine.js +51 -0
- package/dist/components/Payroll/Dismissal/dismissalStateMachine.js.map +1 -0
- package/dist/components/Payroll/Dismissal/dismissalStateMachine.test.d.ts +1 -0
- package/dist/components/Payroll/Dismissal/index.d.ts +3 -0
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +18 -15
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
- package/dist/components/Payroll/OffCycle/OffCycleFlow.d.ts +1 -1
- package/dist/components/Payroll/OffCycle/OffCycleFlow.js +19 -18
- package/dist/components/Payroll/OffCycle/OffCycleFlow.js.map +1 -1
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.d.ts +3 -0
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js +32 -24
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +45 -45
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.d.ts +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js +75 -66
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.module.scss.js +8 -0
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.module.scss.js.map +1 -0
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationTypes.d.ts +0 -1
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.module.scss.js +4 -4
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes.js +2 -2
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes.js.map +1 -1
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/useOffCyclePayPeriodDateValidation.d.ts +1 -0
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/useOffCyclePayPeriodDateValidation.js +1 -0
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/useOffCyclePayPeriodDateValidation.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +186 -159
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +3 -3
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +69 -69
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/grossUpHelpers.d.ts +3 -2
- package/dist/components/Payroll/PayrollConfiguration/grossUpHelpers.js +8 -8
- package/dist/components/Payroll/PayrollConfiguration/grossUpHelpers.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.d.ts +5 -3
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +76 -70
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +47 -42
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +4 -2
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +235 -196
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/OffCycleFlowContextual.d.ts +1 -0
- package/dist/components/Payroll/PayrollFlow/OffCycleFlowContextual.js +12 -0
- package/dist/components/Payroll/PayrollFlow/OffCycleFlowContextual.js.map +1 -0
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.d.ts +3 -0
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/TransitionFlowContextual.d.ts +1 -0
- package/dist/components/Payroll/PayrollFlow/TransitionFlowContextual.js +21 -0
- package/dist/components/Payroll/PayrollFlow/TransitionFlowContextual.js.map +1 -0
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.d.ts +2 -0
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js +95 -64
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.js +53 -47
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +8 -8
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js +25 -23
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollList.js +40 -32
- package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.d.ts +2 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +110 -93
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.module.scss.js +12 -8
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.module.scss.js.map +1 -1
- package/dist/components/Payroll/Transition/TransitionFlow.d.ts +2 -0
- package/dist/components/Payroll/Transition/TransitionFlow.js +38 -0
- package/dist/components/Payroll/Transition/TransitionFlow.js.map +1 -0
- package/dist/components/Payroll/Transition/TransitionFlowComponents.d.ts +19 -0
- package/dist/components/Payroll/Transition/TransitionFlowComponents.js +54 -0
- package/dist/components/Payroll/Transition/TransitionFlowComponents.js.map +1 -0
- package/dist/components/Payroll/Transition/index.d.ts +3 -0
- package/dist/components/Payroll/Transition/transitionStateMachine.d.ts +6 -0
- package/dist/components/Payroll/Transition/transitionStateMachine.js +58 -0
- package/dist/components/Payroll/Transition/transitionStateMachine.js.map +1 -0
- package/dist/components/Payroll/Transition/transitionStateMachine.test.d.ts +1 -0
- package/dist/components/Payroll/TransitionCreation/TransitionCreation.d.ts +2 -0
- package/dist/components/Payroll/TransitionCreation/TransitionCreation.js +92 -0
- package/dist/components/Payroll/TransitionCreation/TransitionCreation.js.map +1 -0
- package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.d.ts +2 -0
- package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.js +111 -0
- package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.js.map +1 -0
- package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.module.scss.js +8 -0
- package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.module.scss.js.map +1 -0
- package/dist/components/Payroll/TransitionCreation/TransitionCreationTypes.d.ts +28 -0
- package/dist/components/Payroll/TransitionCreation/TransitionCreationTypes.js +21 -0
- package/dist/components/Payroll/TransitionCreation/TransitionCreationTypes.js.map +1 -0
- package/dist/components/Payroll/TransitionCreation/index.d.ts +3 -0
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.d.ts +8 -0
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js +83 -0
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js.map +1 -0
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.d.ts +16 -0
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.js +100 -0
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.js.map +1 -0
- package/dist/components/Payroll/TransitionPayrollAlert/index.d.ts +2 -0
- package/dist/components/Payroll/helpers.d.ts +2 -1
- package/dist/components/Payroll/helpers.js +98 -87
- package/dist/components/Payroll/helpers.js.map +1 -1
- package/dist/components/Payroll/index.d.ts +6 -0
- package/dist/components/Payroll/index.js +32 -26
- package/dist/components/Payroll/index.js.map +1 -1
- package/dist/components/Payroll/payrollTypes.d.ts +21 -0
- package/dist/components/Payroll/payrollTypes.js +27 -0
- package/dist/components/Payroll/payrollTypes.js.map +1 -0
- package/dist/components/Payroll/usePreparedPayrollData.js +4 -4
- package/dist/components/UNSTABLE_Hooks/collectErrors.d.ts +6 -0
- package/dist/components/UNSTABLE_Hooks/collectErrors.js +9 -0
- package/dist/components/UNSTABLE_Hooks/collectErrors.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/form/FormFieldsMetadataContext.d.ts +8 -0
- package/dist/components/UNSTABLE_Hooks/form/FormFieldsMetadataContext.js +13 -0
- package/dist/components/UNSTABLE_Hooks/form/FormFieldsMetadataContext.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/form/FormFieldsMetadataProvider.d.ts +10 -0
- package/dist/components/UNSTABLE_Hooks/form/FormFieldsMetadataProvider.js +13 -0
- package/dist/components/UNSTABLE_Hooks/form/FormFieldsMetadataProvider.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/form/SDKFormProvider.d.ts +23 -0
- package/dist/components/UNSTABLE_Hooks/form/SDKFormProvider.js +24 -0
- package/dist/components/UNSTABLE_Hooks/form/SDKFormProvider.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/form/composeFormSchema.d.ts +26 -0
- package/dist/components/UNSTABLE_Hooks/form/composeFormSchema.js +24 -0
- package/dist/components/UNSTABLE_Hooks/form/composeFormSchema.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/form/composeSubmitHandler.d.ts +53 -0
- package/dist/components/UNSTABLE_Hooks/form/composeSubmitHandler.js +34 -0
- package/dist/components/UNSTABLE_Hooks/form/composeSubmitHandler.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/form/composeSubmitHandler.test.d.ts +1 -0
- package/dist/components/UNSTABLE_Hooks/form/deriveFieldsMetadata.d.ts +3 -0
- package/dist/components/UNSTABLE_Hooks/form/deriveFieldsMetadata.js +14 -0
- package/dist/components/UNSTABLE_Hooks/form/deriveFieldsMetadata.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/form/deriveFieldsMetadata.test.d.ts +1 -0
- package/dist/components/UNSTABLE_Hooks/form/fields/CheckboxHookField.d.ts +9 -0
- package/dist/components/UNSTABLE_Hooks/form/fields/CheckboxHookField.js +34 -0
- package/dist/components/UNSTABLE_Hooks/form/fields/CheckboxHookField.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/form/fields/DatePickerHookField.d.ts +9 -0
- package/dist/components/UNSTABLE_Hooks/form/fields/DatePickerHookField.js +29 -0
- package/dist/components/UNSTABLE_Hooks/form/fields/DatePickerHookField.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/form/fields/NumberInputHookField.d.ts +12 -0
- package/dist/components/UNSTABLE_Hooks/form/fields/NumberInputHookField.js +40 -0
- package/dist/components/UNSTABLE_Hooks/form/fields/NumberInputHookField.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/form/fields/RadioGroupHookField.d.ts +10 -0
- package/dist/components/UNSTABLE_Hooks/form/fields/RadioGroupHookField.js +40 -0
- package/dist/components/UNSTABLE_Hooks/form/fields/RadioGroupHookField.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/form/fields/SelectHookField.d.ts +10 -0
- package/dist/components/UNSTABLE_Hooks/form/fields/SelectHookField.js +40 -0
- package/dist/components/UNSTABLE_Hooks/form/fields/SelectHookField.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/form/fields/SwitchHookField.d.ts +9 -0
- package/dist/components/UNSTABLE_Hooks/form/fields/SwitchHookField.js +34 -0
- package/dist/components/UNSTABLE_Hooks/form/fields/SwitchHookField.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/form/fields/TextInputHookField.d.ts +11 -0
- package/dist/components/UNSTABLE_Hooks/form/fields/TextInputHookField.js +38 -0
- package/dist/components/UNSTABLE_Hooks/form/fields/TextInputHookField.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/form/fields/index.d.ts +15 -0
- package/dist/components/UNSTABLE_Hooks/form/getFieldWithOptions.d.ts +2 -0
- package/dist/components/UNSTABLE_Hooks/form/getFieldWithOptions.js +8 -0
- package/dist/components/UNSTABLE_Hooks/form/getFieldWithOptions.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/form/getFormSubmissionValues.d.ts +18 -0
- package/dist/components/UNSTABLE_Hooks/form/getFormSubmissionValues.js +10 -0
- package/dist/components/UNSTABLE_Hooks/form/getFormSubmissionValues.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/form/getFormSubmissionValues.test.d.ts +1 -0
- package/dist/components/UNSTABLE_Hooks/form/index.d.ts +14 -0
- package/dist/components/UNSTABLE_Hooks/form/resolveRequiredFields.d.ts +6 -0
- package/dist/components/UNSTABLE_Hooks/form/resolveRequiredFields.js +14 -0
- package/dist/components/UNSTABLE_Hooks/form/resolveRequiredFields.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/form/types.d.ts +27 -0
- package/dist/components/UNSTABLE_Hooks/form/useFieldErrorMessage.d.ts +2 -0
- package/dist/components/UNSTABLE_Hooks/form/useFieldErrorMessage.js +17 -0
- package/dist/components/UNSTABLE_Hooks/form/useFieldErrorMessage.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/form/useFieldsMetadata.d.ts +4 -0
- package/dist/components/UNSTABLE_Hooks/form/useFieldsMetadata.js +9 -0
- package/dist/components/UNSTABLE_Hooks/form/useFieldsMetadata.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/form/withOptions.d.ts +5 -0
- package/dist/components/UNSTABLE_Hooks/form/withOptions.js +7 -0
- package/dist/components/UNSTABLE_Hooks/form/withOptions.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/CompensationForm.d.ts +5 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/CompensationForm.js +151 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/CompensationForm.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/compensationSchema.d.ts +97 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/compensationSchema.js +121 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/compensationSchema.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/fields.d.ts +34 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/fields.js +50 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/fields.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/index.d.ts +7 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/useCompensationForm.d.ts +104 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/useCompensationForm.js +259 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/useCompensationForm.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/EmployeeDetailsForm.d.ts +5 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/EmployeeDetailsForm.js +114 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/EmployeeDetailsForm.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/employeeDetailsSchema.d.ts +39 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/employeeDetailsSchema.js +45 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/employeeDetailsSchema.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/fields.d.ts +23 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/fields.js +46 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/fields.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/index.d.ts +7 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/useEmployeeDetailsForm.d.ts +77 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/useEmployeeDetailsForm.js +153 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/useEmployeeDetailsForm.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/WorkAddressForm.d.ts +5 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/WorkAddressForm.js +71 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/WorkAddressForm.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/fields.d.ts +10 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/fields.js +14 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/fields.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/index.d.ts +7 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/useWorkAddressForm.d.ts +68 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/useWorkAddressForm.js +129 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/useWorkAddressForm.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/workAddressSchema.d.ts +25 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/workAddressSchema.js +24 -0
- package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/workAddressSchema.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/index.d.ts +9 -0
- package/dist/components/UNSTABLE_Hooks/types.d.ts +49 -0
- package/dist/components/UNSTABLE_Hooks/useErrorHandling.d.ts +9 -0
- package/dist/components/UNSTABLE_Hooks/useErrorHandling.js +12 -0
- package/dist/components/UNSTABLE_Hooks/useErrorHandling.js.map +1 -0
- package/dist/components/UNSTABLE_Hooks/useErrorHandling.test.d.ts +1 -0
- package/dist/contexts/ApiProvider/ApiProvider.js +11 -11
- package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +43 -47
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/contexts/ObservabilityProvider/index.d.ts +1 -1
- package/dist/contexts/ObservabilityProvider/sanitization.d.ts +0 -14
- package/dist/contexts/ObservabilityProvider/sanitization.js +51 -51
- package/dist/contexts/ObservabilityProvider/sanitization.js.map +1 -1
- package/dist/contexts/ObservabilityProvider/useSanitizedObservability.d.ts +0 -3
- package/dist/contexts/ObservabilityProvider/useSanitizedObservability.js.map +1 -1
- package/dist/helpers/requiredIf.d.ts +13 -0
- package/dist/helpers/requiredIf.js +8 -0
- package/dist/helpers/requiredIf.js.map +1 -0
- package/dist/i18n/I18n.js +13 -13
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Employee.Terminations.TerminateEmployee.json.js +18 -0
- package/dist/i18n/en/Employee.Terminations.TerminateEmployee.json.js.map +1 -0
- package/dist/i18n/en/Employee.Terminations.TerminationFlow.json.js +12 -0
- package/dist/i18n/en/Employee.Terminations.TerminationFlow.json.js.map +1 -0
- package/dist/i18n/en/Employee.Terminations.TerminationSummary.json.js +20 -0
- package/dist/i18n/en/Employee.Terminations.TerminationSummary.json.js.map +1 -0
- package/dist/i18n/en/Payroll.Dismissal.json.js +22 -0
- package/dist/i18n/en/Payroll.Dismissal.json.js.map +1 -0
- package/dist/i18n/en/Payroll.OffCycleCreation.json.js +15 -11
- package/dist/i18n/en/Payroll.OffCycleCreation.json.js.map +1 -1
- package/dist/i18n/en/Payroll.OffCyclePayPeriodDateForm.json.js +1 -1
- package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js +20 -18
- package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollList.json.js +20 -18
- package/dist/i18n/en/Payroll.PayrollList.json.js.map +1 -1
- package/dist/i18n/en/Payroll.Transition.json.js +8 -0
- package/dist/i18n/en/Payroll.Transition.json.js.map +1 -0
- package/dist/i18n/en/Payroll.TransitionCreation.json.js +26 -0
- package/dist/i18n/en/Payroll.TransitionCreation.json.js.map +1 -0
- package/dist/i18n/en/Payroll.TransitionPayrollAlert.json.js +18 -0
- package/dist/i18n/en/Payroll.TransitionPayrollAlert.json.js.map +1 -0
- package/dist/i18n/en/UNSTABLE.CompensationForm.json.js +58 -0
- package/dist/i18n/en/UNSTABLE.CompensationForm.json.js.map +1 -0
- package/dist/i18n/en/UNSTABLE.EmployeeDetailsForm.json.js +34 -0
- package/dist/i18n/en/UNSTABLE.EmployeeDetailsForm.json.js.map +1 -0
- package/dist/i18n/en/UNSTABLE.WorkAddressForm.json.js +24 -0
- package/dist/i18n/en/UNSTABLE.WorkAddressForm.json.js.map +1 -0
- package/dist/i18n/en/common.json.d.ts +2 -1
- package/dist/i18n/en/common.json.js +9 -9
- package/dist/index.d.ts +3 -2
- package/dist/index.js +14 -13
- package/dist/models/WA_RISK_CODES.d.ts +5 -2866
- package/dist/models/WA_RISK_CODES.js.map +1 -1
- package/dist/shared/constants.d.ts +32 -0
- package/dist/shared/constants.js +83 -65
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/i18next.d.ts +279 -1
- package/dist/types/observability.d.ts +31 -65
- package/dist/types/sdkError.d.ts +97 -0
- package/dist/types/sdkError.js +95 -0
- package/dist/types/sdkError.js.map +1 -0
- package/dist/types/sdkError.test.d.ts +1 -0
- package/docs/reference/endpoint-inventory.json +212 -14
- package/package.json +16 -16
- package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/PayrollConfiguration.d.ts +0 -6
- package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/PayrollConfiguration.js +0 -70
- package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/PayrollConfiguration.js.map +0 -1
- package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/PayrollConfigurationContext.d.ts +0 -7
- package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/PayrollConfigurationContext.js +0 -6
- package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/PayrollConfigurationContext.js.map +0 -1
- package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/PayrollConfigurationProvider.d.ts +0 -9
- package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/PayrollConfigurationProvider.js +0 -40
- package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/PayrollConfigurationProvider.js.map +0 -1
- package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/index.d.ts +0 -5
- package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/usePayrollConfiguration.d.ts +0 -2
- package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/usePayrollConfiguration.js +0 -12
- package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/usePayrollConfiguration.js.map +0 -1
- package/dist/components/Payroll/UNSTABLE_PayrollHooks/index.d.ts +0 -2
- package/dist/contexts/ObservabilityProvider/observabilityUtils.d.ts +0 -5
- package/dist/contexts/ObservabilityProvider/observabilityUtils.js +0 -45
- package/dist/contexts/ObservabilityProvider/observabilityUtils.js.map +0 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const PayrollCategory: {
|
|
2
|
+
readonly Regular: "Regular";
|
|
3
|
+
readonly External: "External";
|
|
4
|
+
readonly Bonus: "Bonus";
|
|
5
|
+
readonly Correction: "Correction";
|
|
6
|
+
readonly Dismissal: "Dismissed employee";
|
|
7
|
+
readonly HiredEmployee: "Hired employee";
|
|
8
|
+
readonly Transition: "Transition from old pay schedule";
|
|
9
|
+
readonly BenefitReversal: "Benefit reversal";
|
|
10
|
+
readonly WageCorrection: "Wage correction";
|
|
11
|
+
readonly TaxReconciliation: "Tax reconciliation";
|
|
12
|
+
readonly Reversal: "Reversal";
|
|
13
|
+
readonly DisabilityInsurance: "Disability insurance distribution";
|
|
14
|
+
};
|
|
15
|
+
export type PayrollCategory = (typeof PayrollCategory)[keyof typeof PayrollCategory];
|
|
16
|
+
export declare function derivePayrollCategory(payroll: {
|
|
17
|
+
offCycle?: boolean;
|
|
18
|
+
offCycleReason?: string | null;
|
|
19
|
+
external?: boolean;
|
|
20
|
+
}): PayrollCategory;
|
|
21
|
+
export declare function isOffCyclePayroll(category: PayrollCategory): boolean;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { OffCycleReasonType as e } from "@gusto/embedded-api/models/components/payroll";
|
|
2
|
+
const r = {
|
|
3
|
+
Regular: "Regular",
|
|
4
|
+
External: "External",
|
|
5
|
+
Bonus: e.Bonus,
|
|
6
|
+
Correction: e.Correction,
|
|
7
|
+
Dismissal: e.DismissedEmployee,
|
|
8
|
+
HiredEmployee: e.HiredEmployee,
|
|
9
|
+
Transition: e.TransitionFromOldPaySchedule,
|
|
10
|
+
BenefitReversal: e.BenefitReversal,
|
|
11
|
+
WageCorrection: e.WageCorrection,
|
|
12
|
+
TaxReconciliation: e.TaxReconciliation,
|
|
13
|
+
Reversal: e.Reversal,
|
|
14
|
+
DisabilityInsurance: e.DisabilityInsuranceDistribution
|
|
15
|
+
}, i = new Set(Object.values(r));
|
|
16
|
+
function a(n) {
|
|
17
|
+
return n.external ? r.External : n.offCycle && n.offCycleReason && i.has(n.offCycleReason) ? n.offCycleReason : r.Regular;
|
|
18
|
+
}
|
|
19
|
+
function t(n) {
|
|
20
|
+
return n !== r.Regular && n !== r.External;
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
r as PayrollCategory,
|
|
24
|
+
a as derivePayrollCategory,
|
|
25
|
+
t as isOffCyclePayroll
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=payrollTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payrollTypes.js","sources":["../../../src/components/Payroll/payrollTypes.ts"],"sourcesContent":["import { OffCycleReasonType } from '@gusto/embedded-api/models/components/payroll'\n\nexport const PayrollCategory = {\n Regular: 'Regular',\n External: 'External',\n Bonus: OffCycleReasonType.Bonus,\n Correction: OffCycleReasonType.Correction,\n Dismissal: OffCycleReasonType.DismissedEmployee,\n HiredEmployee: OffCycleReasonType.HiredEmployee,\n Transition: OffCycleReasonType.TransitionFromOldPaySchedule,\n BenefitReversal: OffCycleReasonType.BenefitReversal,\n WageCorrection: OffCycleReasonType.WageCorrection,\n TaxReconciliation: OffCycleReasonType.TaxReconciliation,\n Reversal: OffCycleReasonType.Reversal,\n DisabilityInsurance: OffCycleReasonType.DisabilityInsuranceDistribution,\n} as const\n\nexport type PayrollCategory = (typeof PayrollCategory)[keyof typeof PayrollCategory]\n\nconst VALID_PAYROLL_CATEGORIES = new Set<string>(Object.values(PayrollCategory))\n\nexport function derivePayrollCategory(payroll: {\n offCycle?: boolean\n offCycleReason?: string | null\n external?: boolean\n}): PayrollCategory {\n if (payroll.external) return PayrollCategory.External\n if (\n payroll.offCycle &&\n payroll.offCycleReason &&\n VALID_PAYROLL_CATEGORIES.has(payroll.offCycleReason)\n ) {\n return payroll.offCycleReason as PayrollCategory\n }\n return PayrollCategory.Regular\n}\n\nexport function isOffCyclePayroll(category: PayrollCategory): boolean {\n return category !== PayrollCategory.Regular && category !== PayrollCategory.External\n}\n"],"names":["PayrollCategory","OffCycleReasonType","VALID_PAYROLL_CATEGORIES","derivePayrollCategory","payroll","isOffCyclePayroll","category"],"mappings":";AAEO,MAAMA,IAAkB;AAAA,EAC7B,SAAS;AAAA,EACT,UAAU;AAAA,EACV,OAAOC,EAAmB;AAAA,EAC1B,YAAYA,EAAmB;AAAA,EAC/B,WAAWA,EAAmB;AAAA,EAC9B,eAAeA,EAAmB;AAAA,EAClC,YAAYA,EAAmB;AAAA,EAC/B,iBAAiBA,EAAmB;AAAA,EACpC,gBAAgBA,EAAmB;AAAA,EACnC,mBAAmBA,EAAmB;AAAA,EACtC,UAAUA,EAAmB;AAAA,EAC7B,qBAAqBA,EAAmB;AAC1C,GAIMC,IAA2B,IAAI,IAAY,OAAO,OAAOF,CAAe,CAAC;AAExE,SAASG,EAAsBC,GAIlB;AAClB,SAAIA,EAAQ,WAAiBJ,EAAgB,WAE3CI,EAAQ,YACRA,EAAQ,kBACRF,EAAyB,IAAIE,EAAQ,cAAc,IAE5CA,EAAQ,iBAEVJ,EAAgB;AACzB;AAEO,SAASK,EAAkBC,GAAoC;AACpE,SAAOA,MAAaN,EAAgB,WAAWM,MAAaN,EAAgB;AAC9E;"}
|
|
@@ -5,16 +5,16 @@ import { UnprocessableEntityErrorObject as T } from "@gusto/embedded-api/models/
|
|
|
5
5
|
import "react/jsx-runtime";
|
|
6
6
|
import "react-error-boundary";
|
|
7
7
|
import "react-i18next";
|
|
8
|
-
import "@gusto/embedded-api/models/errors/gustoembeddederror";
|
|
9
|
-
import "@gusto/embedded-api/models/errors/sdkvalidationerror";
|
|
10
8
|
import "@tanstack/react-query";
|
|
11
9
|
import { useBase as j } from "../Base/useBase.js";
|
|
10
|
+
import "@gusto/embedded-api/models/errors/apierror";
|
|
11
|
+
import "@gusto/embedded-api/models/errors/gustoembeddederror";
|
|
12
|
+
import "@gusto/embedded-api/models/errors/sdkvalidationerror";
|
|
13
|
+
import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
12
14
|
import "../../shared/constants.js";
|
|
13
15
|
import "classnames";
|
|
14
16
|
import "../../contexts/ComponentAdapter/useComponentContext.js";
|
|
15
17
|
import "../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
16
|
-
import "dompurify";
|
|
17
|
-
import "../../contexts/LocaleProvider/useLocale.js";
|
|
18
18
|
import { retryAsync as x } from "../../helpers/retryAsync.js";
|
|
19
19
|
const q = 4, v = 1500, w = (e) => e instanceof T ? Array.isArray(e.errors) && e.errors.some((r) => r.category === "invalid_operation") : !1, Z = ({
|
|
20
20
|
companyId: e,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { normalizeToSDKError as n } from "../../types/sdkError.js";
|
|
2
|
+
function c(l, o) {
|
|
3
|
+
const e = l.filter((r) => r.error != null).map((r) => n(r.error));
|
|
4
|
+
return o && e.push(o), e;
|
|
5
|
+
}
|
|
6
|
+
export {
|
|
7
|
+
c as collectErrors
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=collectErrors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collectErrors.js","sources":["../../../src/components/UNSTABLE_Hooks/collectErrors.ts"],"sourcesContent":["import { type SDKError, normalizeToSDKError } from '@/types/sdkError'\n\ninterface QueryWithError {\n error: Error | null\n}\n\nexport function collectErrors(queries: QueryWithError[], submitError: SDKError | null): SDKError[] {\n const queryErrors = queries\n .filter((q): q is QueryWithError & { error: Error } => q.error != null)\n .map(q => normalizeToSDKError(q.error))\n\n if (submitError) {\n queryErrors.push(submitError)\n }\n\n return queryErrors\n}\n"],"names":["collectErrors","queries","submitError","queryErrors","q","normalizeToSDKError"],"mappings":";AAMO,SAASA,EAAcC,GAA2BC,GAA0C;AACjG,QAAMC,IAAcF,EACjB,OAAO,CAACG,MAA8CA,EAAE,SAAS,IAAI,EACrE,IAAI,CAAAA,MAAKC,EAAoBD,EAAE,KAAK,CAAC;AAExC,SAAIF,KACFC,EAAY,KAAKD,CAAW,GAGvBC;AACT;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FieldsMetadata } from './types';
|
|
2
|
+
import { SDKError } from '../../../types/sdkError';
|
|
3
|
+
export interface FormFieldsMetadataContextValue {
|
|
4
|
+
metadata: FieldsMetadata;
|
|
5
|
+
errors: SDKError[];
|
|
6
|
+
}
|
|
7
|
+
export declare const FormFieldsMetadataContext: import('react').Context<FormFieldsMetadataContextValue | null>;
|
|
8
|
+
export declare function useFormFieldsMetadataContext(): FormFieldsMetadataContextValue;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createContext as e, useContext as o } from "react";
|
|
2
|
+
const r = e(null);
|
|
3
|
+
function n() {
|
|
4
|
+
const t = o(r);
|
|
5
|
+
if (!t)
|
|
6
|
+
throw new Error("useFormFieldsMetadataContext must be used within a FormFieldsMetadataProvider");
|
|
7
|
+
return t;
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
r as FormFieldsMetadataContext,
|
|
11
|
+
n as useFormFieldsMetadataContext
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=FormFieldsMetadataContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormFieldsMetadataContext.js","sources":["../../../../src/components/UNSTABLE_Hooks/form/FormFieldsMetadataContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { FieldsMetadata } from './types'\nimport type { SDKError } from '@/types/sdkError'\n\nexport interface FormFieldsMetadataContextValue {\n metadata: FieldsMetadata\n errors: SDKError[]\n}\n\nexport const FormFieldsMetadataContext = createContext<FormFieldsMetadataContextValue | null>(null)\n\nexport function useFormFieldsMetadataContext(): FormFieldsMetadataContextValue {\n const context = useContext(FormFieldsMetadataContext)\n if (!context) {\n throw new Error('useFormFieldsMetadataContext must be used within a FormFieldsMetadataProvider')\n }\n return context\n}\n"],"names":["FormFieldsMetadataContext","createContext","useFormFieldsMetadataContext","context","useContext"],"mappings":";AASO,MAAMA,IAA4BC,EAAqD,IAAI;AAE3F,SAASC,IAA+D;AAC7E,QAAMC,IAAUC,EAAWJ,CAAyB;AACpD,MAAI,CAACG;AACH,UAAM,IAAI,MAAM,+EAA+E;AAEjG,SAAOA;AACT;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { FieldMetadata, FieldMetadataWithOptions } from './types';
|
|
3
|
+
import { SDKError } from '../../../types/sdkError';
|
|
4
|
+
interface FormFieldsMetadataProviderProps {
|
|
5
|
+
metadata: Record<string, FieldMetadata | FieldMetadataWithOptions>;
|
|
6
|
+
errors: SDKError[];
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare function FormFieldsMetadataProvider({ metadata, errors, children, }: FormFieldsMetadataProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { FormFieldsMetadataContext as a } from "./FormFieldsMetadataContext.js";
|
|
3
|
+
function m({
|
|
4
|
+
metadata: r,
|
|
5
|
+
errors: o,
|
|
6
|
+
children: t
|
|
7
|
+
}) {
|
|
8
|
+
return /* @__PURE__ */ e(a.Provider, { value: { metadata: r, errors: o }, children: t });
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
m as FormFieldsMetadataProvider
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=FormFieldsMetadataProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormFieldsMetadataProvider.js","sources":["../../../../src/components/UNSTABLE_Hooks/form/FormFieldsMetadataProvider.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { FieldMetadata, FieldMetadataWithOptions } from './types'\nimport { FormFieldsMetadataContext } from './FormFieldsMetadataContext'\nimport type { SDKError } from '@/types/sdkError'\n\ninterface FormFieldsMetadataProviderProps {\n metadata: Record<string, FieldMetadata | FieldMetadataWithOptions>\n errors: SDKError[]\n children: ReactNode\n}\n\nexport function FormFieldsMetadataProvider({\n metadata,\n errors,\n children,\n}: FormFieldsMetadataProviderProps) {\n return (\n <FormFieldsMetadataContext.Provider value={{ metadata, errors }}>\n {children}\n </FormFieldsMetadataContext.Provider>\n )\n}\n"],"names":["FormFieldsMetadataProvider","metadata","errors","children","jsx","FormFieldsMetadataContext"],"mappings":";;AAWO,SAASA,EAA2B;AAAA,EACzC,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AACF,GAAoC;AAClC,SACE,gBAAAC,EAACC,EAA0B,UAA1B,EAAmC,OAAO,EAAE,UAAAJ,GAAU,QAAAC,KACpD,UAAAC,GACH;AAEJ;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { FieldValues } from 'react-hook-form';
|
|
3
|
+
import { HookFormInternals } from '../types';
|
|
4
|
+
import { FieldMetadata, FieldMetadataWithOptions } from './types';
|
|
5
|
+
import { SDKError } from '../../../types/sdkError';
|
|
6
|
+
interface SDKFormProviderProps<TFormData extends FieldValues = FieldValues, TFieldsMetadata extends {
|
|
7
|
+
[K in keyof TFieldsMetadata]: FieldMetadata | FieldMetadataWithOptions;
|
|
8
|
+
} = Record<string, FieldMetadata | FieldMetadataWithOptions>> {
|
|
9
|
+
formHookResult: {
|
|
10
|
+
errorHandling: {
|
|
11
|
+
errors: SDKError[];
|
|
12
|
+
};
|
|
13
|
+
form: {
|
|
14
|
+
fieldsMetadata: TFieldsMetadata;
|
|
15
|
+
hookFormInternals: HookFormInternals<TFormData>;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
export declare function SDKFormProvider<TFormData extends FieldValues = FieldValues, TFieldsMetadata extends {
|
|
21
|
+
[K in keyof TFieldsMetadata]: FieldMetadata | FieldMetadataWithOptions;
|
|
22
|
+
} = Record<string, FieldMetadata | FieldMetadataWithOptions>>({ formHookResult, children }: SDKFormProviderProps<TFormData, TFieldsMetadata>): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as i } from "react";
|
|
3
|
+
import { FormProvider as d } from "react-hook-form";
|
|
4
|
+
import { FormFieldsMetadataProvider as f } from "./FormFieldsMetadataProvider.js";
|
|
5
|
+
function m(o, s) {
|
|
6
|
+
const { fieldsMetadata: e } = s, { setError: r } = s.hookFormInternals.formMethods;
|
|
7
|
+
i(() => {
|
|
8
|
+
if (!o.length) return;
|
|
9
|
+
const n = new Set(Object.keys(e));
|
|
10
|
+
for (const t of o)
|
|
11
|
+
n.has(t.field) && r(t.field, {
|
|
12
|
+
type: "custom",
|
|
13
|
+
message: t.message
|
|
14
|
+
});
|
|
15
|
+
}, [o, r, e]);
|
|
16
|
+
}
|
|
17
|
+
function p({ formHookResult: o, children: s }) {
|
|
18
|
+
const { errorHandling: e, form: r } = o, n = e.errors.flatMap((t) => t.fieldErrors);
|
|
19
|
+
return m(n, r), /* @__PURE__ */ a(f, { metadata: r.fieldsMetadata, errors: e.errors, children: /* @__PURE__ */ a(d, { ...r.hookFormInternals.formMethods, children: s }) });
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
p as SDKFormProvider
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=SDKFormProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SDKFormProvider.js","sources":["../../../../src/components/UNSTABLE_Hooks/form/SDKFormProvider.tsx"],"sourcesContent":["import { type ReactNode, useEffect } from 'react'\nimport type { FieldPath, FieldValues } from 'react-hook-form'\nimport { FormProvider } from 'react-hook-form'\nimport type { HookFormInternals } from '../types'\nimport { FormFieldsMetadataProvider } from './FormFieldsMetadataProvider'\nimport type { FieldMetadata, FieldMetadataWithOptions } from './types'\nimport type { SDKError, SDKFieldError } from '@/types/sdkError'\n\nfunction useSyncFieldErrors<\n TFormData extends FieldValues,\n TFieldsMetadata extends {\n [K in keyof TFieldsMetadata]: FieldMetadata | FieldMetadataWithOptions\n },\n>(\n fieldErrors: SDKFieldError[],\n form: {\n fieldsMetadata: TFieldsMetadata\n hookFormInternals: HookFormInternals<TFormData>\n },\n) {\n const { fieldsMetadata } = form\n const { setError } = form.hookFormInternals.formMethods\n\n useEffect(() => {\n if (!fieldErrors.length) return\n const knownFields = new Set(Object.keys(fieldsMetadata))\n for (const fieldError of fieldErrors) {\n if (knownFields.has(fieldError.field)) {\n setError(fieldError.field as FieldPath<TFormData>, {\n type: 'custom',\n message: fieldError.message,\n })\n }\n }\n }, [fieldErrors, setError, fieldsMetadata])\n}\n\ninterface SDKFormProviderProps<\n TFormData extends FieldValues = FieldValues,\n TFieldsMetadata extends {\n [K in keyof TFieldsMetadata]: FieldMetadata | FieldMetadataWithOptions\n } = Record<string, FieldMetadata | FieldMetadataWithOptions>,\n> {\n formHookResult: {\n errorHandling: { errors: SDKError[] }\n form: {\n fieldsMetadata: TFieldsMetadata\n hookFormInternals: HookFormInternals<TFormData>\n }\n }\n children: ReactNode\n}\n\nexport function SDKFormProvider<\n TFormData extends FieldValues = FieldValues,\n TFieldsMetadata extends {\n [K in keyof TFieldsMetadata]: FieldMetadata | FieldMetadataWithOptions\n } = Record<string, FieldMetadata | FieldMetadataWithOptions>,\n>({ formHookResult, children }: SDKFormProviderProps<TFormData, TFieldsMetadata>) {\n const { errorHandling, form } = formHookResult\n const allFieldErrors = errorHandling.errors.flatMap(e => e.fieldErrors)\n useSyncFieldErrors(allFieldErrors, form)\n\n return (\n <FormFieldsMetadataProvider metadata={form.fieldsMetadata} errors={errorHandling.errors}>\n <FormProvider {...form.hookFormInternals.formMethods}>{children}</FormProvider>\n </FormFieldsMetadataProvider>\n )\n}\n"],"names":["useSyncFieldErrors","fieldErrors","form","fieldsMetadata","setError","useEffect","knownFields","fieldError","SDKFormProvider","formHookResult","children","errorHandling","allFieldErrors","e","jsx","FormFieldsMetadataProvider","FormProvider"],"mappings":";;;;AAQA,SAASA,EAMPC,GACAC,GAIA;AACA,QAAM,EAAE,gBAAAC,MAAmBD,GACrB,EAAE,UAAAE,EAAA,IAAaF,EAAK,kBAAkB;AAE5C,EAAAG,EAAU,MAAM;AACd,QAAI,CAACJ,EAAY,OAAQ;AACzB,UAAMK,IAAc,IAAI,IAAI,OAAO,KAAKH,CAAc,CAAC;AACvD,eAAWI,KAAcN;AACvB,MAAIK,EAAY,IAAIC,EAAW,KAAK,KAClCH,EAASG,EAAW,OAA+B;AAAA,QACjD,MAAM;AAAA,QACN,SAASA,EAAW;AAAA,MAAA,CACrB;AAAA,EAGP,GAAG,CAACN,GAAaG,GAAUD,CAAc,CAAC;AAC5C;AAkBO,SAASK,EAKd,EAAE,gBAAAC,GAAgB,UAAAC,KAA8D;AAChF,QAAM,EAAE,eAAAC,GAAe,MAAAT,EAAA,IAASO,GAC1BG,IAAiBD,EAAc,OAAO,QAAQ,CAAAE,MAAKA,EAAE,WAAW;AACtE,SAAAb,EAAmBY,GAAgBV,CAAI,GAGrC,gBAAAY,EAACC,GAAA,EAA2B,UAAUb,EAAK,gBAAgB,QAAQS,EAAc,QAC/E,UAAA,gBAAAG,EAACE,KAAc,GAAGd,EAAK,kBAAkB,aAAc,UAAAQ,GAAS,GAClE;AAEJ;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { RequiredFields } from './resolveRequiredFields';
|
|
3
|
+
interface ComposeFormSchemaOptions<T extends Record<string, z.ZodType>> {
|
|
4
|
+
fieldValidators: T;
|
|
5
|
+
fixedFields?: Set<string>;
|
|
6
|
+
requiredOnCreate?: Set<string>;
|
|
7
|
+
requiredOnUpdate?: Set<string>;
|
|
8
|
+
mode: 'create' | 'update';
|
|
9
|
+
requiredFields?: RequiredFields<string>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Composes a Zod form schema by applying `requiredIf` to configurable fields
|
|
13
|
+
* based on mode and partner-specified required fields.
|
|
14
|
+
*
|
|
15
|
+
* Pattern: define all field validators as if required, then pass them here.
|
|
16
|
+
* Configurable fields get wrapped with `requiredIf` to conditionally accept
|
|
17
|
+
* empty input. Fixed fields (e.g. booleans, always-present controls) pass through as-is.
|
|
18
|
+
*
|
|
19
|
+
* `requiredOnCreate` / `requiredOnUpdate` define mode-specific defaults.
|
|
20
|
+
* `requiredFields` (partner overrides) are additive on top of those defaults.
|
|
21
|
+
*
|
|
22
|
+
* Generic `T` preserves the fieldValidators type so zodResolver can infer
|
|
23
|
+
* the correct form data type without manual casts at the call site.
|
|
24
|
+
*/
|
|
25
|
+
export declare function composeFormSchema<T extends Record<string, z.ZodType>>({ fieldValidators, fixedFields, requiredOnCreate, requiredOnUpdate, mode, requiredFields, }: ComposeFormSchemaOptions<T>): z.ZodObject<T>;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z as a } from "zod";
|
|
2
|
+
import { resolveRequiredFields as h } from "./resolveRequiredFields.js";
|
|
3
|
+
import { requiredIf as S } from "../../../helpers/requiredIf.js";
|
|
4
|
+
function b({
|
|
5
|
+
fieldValidators: o,
|
|
6
|
+
fixedFields: n = /* @__PURE__ */ new Set(),
|
|
7
|
+
requiredOnCreate: s = /* @__PURE__ */ new Set(),
|
|
8
|
+
requiredOnUpdate: i = /* @__PURE__ */ new Set(),
|
|
9
|
+
mode: r,
|
|
10
|
+
requiredFields: c
|
|
11
|
+
}) {
|
|
12
|
+
const m = new Set(h(c, r)), u = r === "create" ? s : i, f = Object.fromEntries(
|
|
13
|
+
Object.entries(o).map(([e, t]) => {
|
|
14
|
+
if (n.has(e)) return [e, t];
|
|
15
|
+
const p = u.has(e) || m.has(e);
|
|
16
|
+
return [e, S(t, p)];
|
|
17
|
+
})
|
|
18
|
+
);
|
|
19
|
+
return a.object(f);
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
b as composeFormSchema
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=composeFormSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composeFormSchema.js","sources":["../../../../src/components/UNSTABLE_Hooks/form/composeFormSchema.ts"],"sourcesContent":["import { z } from 'zod'\nimport { resolveRequiredFields, type RequiredFields } from './resolveRequiredFields'\nimport { requiredIf } from '@/helpers/requiredIf'\n\ninterface ComposeFormSchemaOptions<T extends Record<string, z.ZodType>> {\n fieldValidators: T\n fixedFields?: Set<string>\n requiredOnCreate?: Set<string>\n requiredOnUpdate?: Set<string>\n mode: 'create' | 'update'\n requiredFields?: RequiredFields<string>\n}\n\n/**\n * Composes a Zod form schema by applying `requiredIf` to configurable fields\n * based on mode and partner-specified required fields.\n *\n * Pattern: define all field validators as if required, then pass them here.\n * Configurable fields get wrapped with `requiredIf` to conditionally accept\n * empty input. Fixed fields (e.g. booleans, always-present controls) pass through as-is.\n *\n * `requiredOnCreate` / `requiredOnUpdate` define mode-specific defaults.\n * `requiredFields` (partner overrides) are additive on top of those defaults.\n *\n * Generic `T` preserves the fieldValidators type so zodResolver can infer\n * the correct form data type without manual casts at the call site.\n */\nexport function composeFormSchema<T extends Record<string, z.ZodType>>({\n fieldValidators,\n fixedFields = new Set(),\n requiredOnCreate = new Set(),\n requiredOnUpdate = new Set(),\n mode,\n requiredFields,\n}: ComposeFormSchemaOptions<T>) {\n const required = new Set(resolveRequiredFields(requiredFields, mode))\n const modeDefaults = mode === 'create' ? requiredOnCreate : requiredOnUpdate\n\n const shape = Object.fromEntries(\n Object.entries(fieldValidators).map(([key, validator]) => {\n if (fixedFields.has(key)) return [key, validator]\n\n const isRequired = modeDefaults.has(key) || required.has(key)\n return [key, requiredIf(validator, isRequired)]\n }),\n )\n\n // Object.fromEntries erases specific field types to Record<string, ZodType>,\n // and requiredIf wraps fields with z.preprocess which makes z.input infer unknown.\n // Cast back to ZodObject<T> so zodResolver infers the correct form data type\n // from the original fieldValidators — consumers don't need per-hook casts.\n return z.object(shape) as unknown as z.ZodObject<T>\n}\n"],"names":["composeFormSchema","fieldValidators","fixedFields","requiredOnCreate","requiredOnUpdate","mode","requiredFields","required","resolveRequiredFields","modeDefaults","shape","key","validator","isRequired","requiredIf","z"],"mappings":";;;AA2BO,SAASA,EAAuD;AAAA,EACrE,iBAAAC;AAAA,EACA,aAAAC,wBAAkB,IAAA;AAAA,EAClB,kBAAAC,wBAAuB,IAAA;AAAA,EACvB,kBAAAC,wBAAuB,IAAA;AAAA,EACvB,MAAAC;AAAA,EACA,gBAAAC;AACF,GAAgC;AAC9B,QAAMC,IAAW,IAAI,IAAIC,EAAsBF,GAAgBD,CAAI,CAAC,GAC9DI,IAAeJ,MAAS,WAAWF,IAAmBC,GAEtDM,IAAQ,OAAO;AAAA,IACnB,OAAO,QAAQT,CAAe,EAAE,IAAI,CAAC,CAACU,GAAKC,CAAS,MAAM;AACxD,UAAIV,EAAY,IAAIS,CAAG,EAAG,QAAO,CAACA,GAAKC,CAAS;AAEhD,YAAMC,IAAaJ,EAAa,IAAIE,CAAG,KAAKJ,EAAS,IAAII,CAAG;AAC5D,aAAO,CAACA,GAAKG,EAAWF,GAAWC,CAAU,CAAC;AAAA,IAChD,CAAC;AAAA,EAAA;AAOH,SAAOE,EAAE,OAAOL,CAAK;AACvB;"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { SyntheticEvent } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Minimal shape required for a form hook result to participate in `composeSubmitHandler`.
|
|
4
|
+
* Any hook returning `BaseFormHookReady` satisfies this interface.
|
|
5
|
+
*
|
|
6
|
+
* Uses method syntax so TypeScript applies bivariant checking on parameter types,
|
|
7
|
+
* allowing hooks with specific form data generics to be passed without casts.
|
|
8
|
+
*/
|
|
9
|
+
interface ComposableFormHookResult {
|
|
10
|
+
form: {
|
|
11
|
+
hookFormInternals: {
|
|
12
|
+
formMethods: {
|
|
13
|
+
handleSubmit(onValid: () => void, onInvalid?: () => void): () => Promise<void>;
|
|
14
|
+
setFocus(name: string): void;
|
|
15
|
+
formState: {
|
|
16
|
+
errors: Record<string, unknown>;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Coordinates validation and submission across multiple form hooks on the same page.
|
|
24
|
+
*
|
|
25
|
+
* Validates all forms simultaneously via `handleSubmit()`, then focuses the first invalid
|
|
26
|
+
* field across all forms (in array order). Only calls `onAllValid` when every form passes.
|
|
27
|
+
*
|
|
28
|
+
* Uses `handleSubmit` rather than `trigger` so that react-hook-form sets
|
|
29
|
+
* `formState.isSubmitted = true`, which enables `reValidateMode` (default: `onChange`).
|
|
30
|
+
* Without this, errors set by manual `trigger()` calls would never clear as the user types.
|
|
31
|
+
*
|
|
32
|
+
* Each hook passed to `forms` should be initialized with `shouldFocusError: false` so that
|
|
33
|
+
* react-hook-form's built-in per-form focus is disabled and `composeSubmitHandler` can manage
|
|
34
|
+
* cross-form focus instead.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const detailsForm = useEmployeeDetailsForm({ employeeId, shouldFocusError: false })
|
|
39
|
+
* const addressForm = useHomeAddressForm({ employeeId, shouldFocusError: false })
|
|
40
|
+
*
|
|
41
|
+
* const handleSubmit = composeSubmitHandler(
|
|
42
|
+
* [detailsForm, addressForm],
|
|
43
|
+
* async () => {
|
|
44
|
+
* await detailsForm.actions.onSubmit()
|
|
45
|
+
* await addressForm.actions.onSubmit()
|
|
46
|
+
* },
|
|
47
|
+
* )
|
|
48
|
+
*
|
|
49
|
+
* return <form onSubmit={handleSubmit}>...</form>
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare function composeSubmitHandler(forms: ComposableFormHookResult[], onAllValid: () => Promise<void>): (e: SyntheticEvent) => Promise<void>;
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
function l(t, e) {
|
|
2
|
+
return async (a) => {
|
|
3
|
+
if (a.preventDefault(), !(await Promise.all(
|
|
4
|
+
t.map(
|
|
5
|
+
(r) => new Promise((o) => {
|
|
6
|
+
r.form.hookFormInternals.formMethods.handleSubmit(
|
|
7
|
+
() => {
|
|
8
|
+
o(!0);
|
|
9
|
+
},
|
|
10
|
+
() => {
|
|
11
|
+
o(!1);
|
|
12
|
+
}
|
|
13
|
+
)();
|
|
14
|
+
})
|
|
15
|
+
)
|
|
16
|
+
)).every(Boolean)) {
|
|
17
|
+
for (const r of t) {
|
|
18
|
+
const o = Object.keys(
|
|
19
|
+
r.form.hookFormInternals.formMethods.formState.errors
|
|
20
|
+
)[0];
|
|
21
|
+
if (o) {
|
|
22
|
+
r.form.hookFormInternals.formMethods.setFocus(o);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
await e();
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
l as composeSubmitHandler
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=composeSubmitHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composeSubmitHandler.js","sources":["../../../../src/components/UNSTABLE_Hooks/form/composeSubmitHandler.ts"],"sourcesContent":["import type { SyntheticEvent } from 'react'\n\n/**\n * Minimal shape required for a form hook result to participate in `composeSubmitHandler`.\n * Any hook returning `BaseFormHookReady` satisfies this interface.\n *\n * Uses method syntax so TypeScript applies bivariant checking on parameter types,\n * allowing hooks with specific form data generics to be passed without casts.\n */\ninterface ComposableFormHookResult {\n form: {\n hookFormInternals: {\n formMethods: {\n handleSubmit(onValid: () => void, onInvalid?: () => void): () => Promise<void>\n setFocus(name: string): void\n formState: { errors: Record<string, unknown> }\n }\n }\n }\n}\n\n/**\n * Coordinates validation and submission across multiple form hooks on the same page.\n *\n * Validates all forms simultaneously via `handleSubmit()`, then focuses the first invalid\n * field across all forms (in array order). Only calls `onAllValid` when every form passes.\n *\n * Uses `handleSubmit` rather than `trigger` so that react-hook-form sets\n * `formState.isSubmitted = true`, which enables `reValidateMode` (default: `onChange`).\n * Without this, errors set by manual `trigger()` calls would never clear as the user types.\n *\n * Each hook passed to `forms` should be initialized with `shouldFocusError: false` so that\n * react-hook-form's built-in per-form focus is disabled and `composeSubmitHandler` can manage\n * cross-form focus instead.\n *\n * @example\n * ```ts\n * const detailsForm = useEmployeeDetailsForm({ employeeId, shouldFocusError: false })\n * const addressForm = useHomeAddressForm({ employeeId, shouldFocusError: false })\n *\n * const handleSubmit = composeSubmitHandler(\n * [detailsForm, addressForm],\n * async () => {\n * await detailsForm.actions.onSubmit()\n * await addressForm.actions.onSubmit()\n * },\n * )\n *\n * return <form onSubmit={handleSubmit}>...</form>\n * ```\n */\nexport function composeSubmitHandler(\n forms: ComposableFormHookResult[],\n onAllValid: () => Promise<void>,\n): (e: SyntheticEvent) => Promise<void> {\n return async (e: SyntheticEvent) => {\n e.preventDefault()\n\n const validationResults = await Promise.all(\n forms.map(\n form =>\n new Promise<boolean>(resolve => {\n void form.form.hookFormInternals.formMethods.handleSubmit(\n () => {\n resolve(true)\n },\n () => {\n resolve(false)\n },\n )()\n }),\n ),\n )\n\n const allValid = validationResults.every(Boolean)\n\n if (!allValid) {\n for (const form of forms) {\n const firstErrorField = Object.keys(\n form.form.hookFormInternals.formMethods.formState.errors,\n )[0]\n if (firstErrorField) {\n form.form.hookFormInternals.formMethods.setFocus(firstErrorField)\n return\n }\n }\n return\n }\n\n await onAllValid()\n }\n}\n"],"names":["composeSubmitHandler","forms","onAllValid","e","form","resolve","firstErrorField"],"mappings":"AAmDO,SAASA,EACdC,GACAC,GACsC;AACtC,SAAO,OAAOC,MAAsB;AAqBlC,QApBAA,EAAE,eAAA,GAoBE,EAlBsB,MAAM,QAAQ;AAAA,MACtCF,EAAM;AAAA,QACJ,CAAAG,MACE,IAAI,QAAiB,CAAAC,MAAW;AAC9B,UAAKD,EAAK,KAAK,kBAAkB,YAAY;AAAA,YAC3C,MAAM;AACJ,cAAAC,EAAQ,EAAI;AAAA,YACd;AAAA,YACA,MAAM;AACJ,cAAAA,EAAQ,EAAK;AAAA,YACf;AAAA,UAAA,EACF;AAAA,QACF,CAAC;AAAA,MAAA;AAAA,IACL,GAGiC,MAAM,OAAO,GAEjC;AACb,iBAAWD,KAAQH,GAAO;AACxB,cAAMK,IAAkB,OAAO;AAAA,UAC7BF,EAAK,KAAK,kBAAkB,YAAY,UAAU;AAAA,QAAA,EAClD,CAAC;AACH,YAAIE,GAAiB;AACnB,UAAAF,EAAK,KAAK,kBAAkB,YAAY,SAASE,CAAe;AAChE;AAAA,QACF;AAAA,MACF;AACA;AAAA,IACF;AAEA,UAAMJ,EAAA;AAAA,EACR;AACF;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z as i } from "zod";
|
|
2
|
+
function c(t) {
|
|
3
|
+
const r = i.toJSONSchema(t), s = new Set(r.required ?? []), n = t.shape, o = {};
|
|
4
|
+
for (const e of Object.keys(n))
|
|
5
|
+
o[e] = {
|
|
6
|
+
name: e,
|
|
7
|
+
isRequired: s.has(e)
|
|
8
|
+
};
|
|
9
|
+
return o;
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
c as deriveFieldsMetadata
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=deriveFieldsMetadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deriveFieldsMetadata.js","sources":["../../../../src/components/UNSTABLE_Hooks/form/deriveFieldsMetadata.ts"],"sourcesContent":["import { z } from 'zod'\nimport type { FieldMetadata } from './types'\n\nexport function deriveFieldsMetadata<T extends z.ZodObject<z.ZodRawShape>>(\n schema: T,\n): Record<keyof z.infer<T>, FieldMetadata> {\n const jsonSchema = z.toJSONSchema(schema)\n const requiredFields = new Set((jsonSchema as { required?: string[] }).required ?? [])\n const shape = schema.shape as Record<string, z.ZodType>\n const result: Record<string, FieldMetadata> = {}\n\n for (const key of Object.keys(shape)) {\n result[key] = {\n name: key,\n isRequired: requiredFields.has(key),\n }\n }\n\n return result as Record<keyof z.infer<T>, FieldMetadata>\n}\n"],"names":["deriveFieldsMetadata","schema","jsonSchema","z","requiredFields","shape","result","key"],"mappings":";AAGO,SAASA,EACdC,GACyC;AACzC,QAAMC,IAAaC,EAAE,aAAaF,CAAM,GAClCG,IAAiB,IAAI,IAAKF,EAAuC,YAAY,CAAA,CAAE,GAC/EG,IAAQJ,EAAO,OACfK,IAAwC,CAAA;AAE9C,aAAWC,KAAO,OAAO,KAAKF,CAAK;AACjC,IAAAC,EAAOC,CAAG,IAAI;AAAA,MACZ,MAAMA;AAAA,MACN,YAAYH,EAAe,IAAIG,CAAG;AAAA,IAAA;AAItC,SAAOD;AACT;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { BaseFieldProps, ValidationMessages } from '../types';
|
|
3
|
+
import { CheckboxProps } from '../../../Common/UI/Checkbox/CheckboxTypes';
|
|
4
|
+
export interface CheckboxHookFieldProps<TErrorCode extends string = never> extends BaseFieldProps {
|
|
5
|
+
name: string;
|
|
6
|
+
validationMessages?: ValidationMessages<TErrorCode>;
|
|
7
|
+
FieldComponent?: ComponentType<CheckboxProps>;
|
|
8
|
+
}
|
|
9
|
+
export declare function CheckboxHookField<TErrorCode extends string>({ name, label, description, validationMessages, FieldComponent, }: CheckboxHookFieldProps<TErrorCode>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { useFieldsMetadata as m } from "../useFieldsMetadata.js";
|
|
3
|
+
import { useFieldErrorMessage as p } from "../useFieldErrorMessage.js";
|
|
4
|
+
import "../../../../shared/constants.js";
|
|
5
|
+
import "classnames";
|
|
6
|
+
import "react-i18next";
|
|
7
|
+
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
8
|
+
import "react";
|
|
9
|
+
import { CheckboxField as l } from "../../../Common/Fields/CheckboxField/CheckboxField.js";
|
|
10
|
+
function h({
|
|
11
|
+
name: e,
|
|
12
|
+
label: r,
|
|
13
|
+
description: i,
|
|
14
|
+
validationMessages: t,
|
|
15
|
+
FieldComponent: s
|
|
16
|
+
}) {
|
|
17
|
+
const o = m()[e], a = p(e, t);
|
|
18
|
+
return /* @__PURE__ */ d(
|
|
19
|
+
l,
|
|
20
|
+
{
|
|
21
|
+
name: e,
|
|
22
|
+
label: r,
|
|
23
|
+
description: i,
|
|
24
|
+
errorMessage: a,
|
|
25
|
+
isRequired: o?.isRequired,
|
|
26
|
+
isDisabled: o?.isDisabled,
|
|
27
|
+
FieldComponent: s
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
h as CheckboxHookField
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=CheckboxHookField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxHookField.js","sources":["../../../../../src/components/UNSTABLE_Hooks/form/fields/CheckboxHookField.tsx"],"sourcesContent":["import type { ComponentType } from 'react'\nimport type { BaseFieldProps, ValidationMessages } from '../types'\nimport { useFieldsMetadata } from '../useFieldsMetadata'\nimport { useFieldErrorMessage } from '../useFieldErrorMessage'\nimport { CheckboxField } from '@/components/Common'\nimport type { CheckboxProps } from '@/components/Common/UI/Checkbox/CheckboxTypes'\n\nexport interface CheckboxHookFieldProps<TErrorCode extends string = never> extends BaseFieldProps {\n name: string\n validationMessages?: ValidationMessages<TErrorCode>\n FieldComponent?: ComponentType<CheckboxProps>\n}\n\nexport function CheckboxHookField<TErrorCode extends string>({\n name,\n label,\n description,\n validationMessages,\n FieldComponent,\n}: CheckboxHookFieldProps<TErrorCode>) {\n const metadata = useFieldsMetadata()\n const fieldMetadata = metadata[name]\n const errorMessage = useFieldErrorMessage(name, validationMessages)\n\n return (\n <CheckboxField\n name={name}\n label={label}\n description={description}\n errorMessage={errorMessage}\n isRequired={fieldMetadata?.isRequired}\n isDisabled={fieldMetadata?.isDisabled}\n FieldComponent={FieldComponent}\n />\n )\n}\n"],"names":["CheckboxHookField","name","label","description","validationMessages","FieldComponent","fieldMetadata","useFieldsMetadata","errorMessage","useFieldErrorMessage","jsx","CheckboxField"],"mappings":";;;;;;;;;AAaO,SAASA,EAA6C;AAAA,EAC3D,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,gBAAAC;AACF,GAAuC;AAErC,QAAMC,IADWC,EAAA,EACcN,CAAI,GAC7BO,IAAeC,EAAqBR,GAAMG,CAAkB;AAElE,SACE,gBAAAM;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,MAAAV;AAAA,MACA,OAAAC;AAAA,MACA,aAAAC;AAAA,MACA,cAAAK;AAAA,MACA,YAAYF,GAAe;AAAA,MAC3B,YAAYA,GAAe;AAAA,MAC3B,gBAAAD;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { BaseFieldProps, ValidationMessages } from '../types';
|
|
3
|
+
import { DatePickerProps } from '../../../Common/UI/DatePicker/DatePickerTypes';
|
|
4
|
+
export interface DatePickerHookFieldProps<TErrorCode extends string = never> extends BaseFieldProps {
|
|
5
|
+
name: string;
|
|
6
|
+
validationMessages?: ValidationMessages<TErrorCode>;
|
|
7
|
+
FieldComponent?: ComponentType<DatePickerProps>;
|
|
8
|
+
}
|
|
9
|
+
export declare function DatePickerHookField<TErrorCode extends string>({ name, label, description, validationMessages, FieldComponent, }: DatePickerHookFieldProps<TErrorCode>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { useFieldsMetadata as m } from "../useFieldsMetadata.js";
|
|
3
|
+
import { useFieldErrorMessage as l } from "../useFieldErrorMessage.js";
|
|
4
|
+
import { DatePickerField as c } from "../../../Common/Fields/DatePickerField/DatePickerField.js";
|
|
5
|
+
function F({
|
|
6
|
+
name: e,
|
|
7
|
+
label: i,
|
|
8
|
+
description: t,
|
|
9
|
+
validationMessages: o,
|
|
10
|
+
FieldComponent: s
|
|
11
|
+
}) {
|
|
12
|
+
const r = m()[e], a = l(e, o);
|
|
13
|
+
return /* @__PURE__ */ d(
|
|
14
|
+
c,
|
|
15
|
+
{
|
|
16
|
+
name: e,
|
|
17
|
+
label: i,
|
|
18
|
+
description: t,
|
|
19
|
+
errorMessage: a,
|
|
20
|
+
isRequired: r?.isRequired,
|
|
21
|
+
isDisabled: r?.isDisabled,
|
|
22
|
+
FieldComponent: s
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
F as DatePickerHookField
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=DatePickerHookField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePickerHookField.js","sources":["../../../../../src/components/UNSTABLE_Hooks/form/fields/DatePickerHookField.tsx"],"sourcesContent":["import type { ComponentType } from 'react'\nimport type { BaseFieldProps, ValidationMessages } from '../types'\nimport { useFieldsMetadata } from '../useFieldsMetadata'\nimport { useFieldErrorMessage } from '../useFieldErrorMessage'\nimport { DatePickerField } from '@/components/Common/Fields/DatePickerField'\nimport type { DatePickerProps } from '@/components/Common/UI/DatePicker/DatePickerTypes'\n\nexport interface DatePickerHookFieldProps<\n TErrorCode extends string = never,\n> extends BaseFieldProps {\n name: string\n validationMessages?: ValidationMessages<TErrorCode>\n FieldComponent?: ComponentType<DatePickerProps>\n}\n\nexport function DatePickerHookField<TErrorCode extends string>({\n name,\n label,\n description,\n validationMessages,\n FieldComponent,\n}: DatePickerHookFieldProps<TErrorCode>) {\n const metadata = useFieldsMetadata()\n const fieldMetadata = metadata[name]\n const errorMessage = useFieldErrorMessage(name, validationMessages)\n\n return (\n <DatePickerField\n name={name}\n label={label}\n description={description}\n errorMessage={errorMessage}\n isRequired={fieldMetadata?.isRequired}\n isDisabled={fieldMetadata?.isDisabled}\n FieldComponent={FieldComponent}\n />\n )\n}\n"],"names":["DatePickerHookField","name","label","description","validationMessages","FieldComponent","fieldMetadata","useFieldsMetadata","errorMessage","useFieldErrorMessage","jsx","DatePickerField"],"mappings":";;;;AAeO,SAASA,EAA+C;AAAA,EAC7D,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,gBAAAC;AACF,GAAyC;AAEvC,QAAMC,IADWC,EAAA,EACcN,CAAI,GAC7BO,IAAeC,EAAqBR,GAAMG,CAAkB;AAElE,SACE,gBAAAM;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,MAAAV;AAAA,MACA,OAAAC;AAAA,MACA,aAAAC;AAAA,MACA,cAAAK;AAAA,MACA,YAAYF,GAAe;AAAA,MAC3B,YAAYA,GAAe;AAAA,MAC3B,gBAAAD;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { BaseFieldProps, ValidationMessages } from '../types';
|
|
3
|
+
import { NumberInputProps } from '../../../Common/UI/NumberInput/NumberInputTypes';
|
|
4
|
+
export interface NumberInputHookFieldProps<TErrorCode extends string = never> extends BaseFieldProps {
|
|
5
|
+
name: string;
|
|
6
|
+
format?: NumberInputProps['format'];
|
|
7
|
+
min?: NumberInputProps['min'];
|
|
8
|
+
max?: NumberInputProps['max'];
|
|
9
|
+
validationMessages?: ValidationMessages<TErrorCode>;
|
|
10
|
+
FieldComponent?: ComponentType<NumberInputProps>;
|
|
11
|
+
}
|
|
12
|
+
export declare function NumberInputHookField<TErrorCode extends string>({ name, label, description, format, min, max, validationMessages, FieldComponent, }: NumberInputHookFieldProps<TErrorCode>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { useFieldsMetadata as l } from "../useFieldsMetadata.js";
|
|
3
|
+
import { useFieldErrorMessage as f } from "../useFieldErrorMessage.js";
|
|
4
|
+
import "../../../../shared/constants.js";
|
|
5
|
+
import "classnames";
|
|
6
|
+
import { NumberInputField as n } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
|
|
7
|
+
import "react-i18next";
|
|
8
|
+
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
9
|
+
import "react";
|
|
10
|
+
function R({
|
|
11
|
+
name: r,
|
|
12
|
+
label: e,
|
|
13
|
+
description: i,
|
|
14
|
+
format: o,
|
|
15
|
+
min: s,
|
|
16
|
+
max: m,
|
|
17
|
+
validationMessages: a,
|
|
18
|
+
FieldComponent: d
|
|
19
|
+
}) {
|
|
20
|
+
const t = l()[r], p = f(r, a);
|
|
21
|
+
return /* @__PURE__ */ u(
|
|
22
|
+
n,
|
|
23
|
+
{
|
|
24
|
+
name: r,
|
|
25
|
+
label: e,
|
|
26
|
+
description: i,
|
|
27
|
+
errorMessage: p,
|
|
28
|
+
isRequired: t?.isRequired,
|
|
29
|
+
isDisabled: t?.isDisabled,
|
|
30
|
+
format: o,
|
|
31
|
+
min: s,
|
|
32
|
+
max: m,
|
|
33
|
+
FieldComponent: d
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
R as NumberInputHookField
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=NumberInputHookField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NumberInputHookField.js","sources":["../../../../../src/components/UNSTABLE_Hooks/form/fields/NumberInputHookField.tsx"],"sourcesContent":["import type { ComponentType } from 'react'\nimport type { BaseFieldProps, ValidationMessages } from '../types'\nimport { useFieldsMetadata } from '../useFieldsMetadata'\nimport { useFieldErrorMessage } from '../useFieldErrorMessage'\nimport { NumberInputField } from '@/components/Common'\nimport type { NumberInputProps } from '@/components/Common/UI/NumberInput/NumberInputTypes'\n\nexport interface NumberInputHookFieldProps<\n TErrorCode extends string = never,\n> extends BaseFieldProps {\n name: string\n format?: NumberInputProps['format']\n min?: NumberInputProps['min']\n max?: NumberInputProps['max']\n validationMessages?: ValidationMessages<TErrorCode>\n FieldComponent?: ComponentType<NumberInputProps>\n}\n\nexport function NumberInputHookField<TErrorCode extends string>({\n name,\n label,\n description,\n format,\n min,\n max,\n validationMessages,\n FieldComponent,\n}: NumberInputHookFieldProps<TErrorCode>) {\n const metadata = useFieldsMetadata()\n const fieldMetadata = metadata[name]\n const errorMessage = useFieldErrorMessage(name, validationMessages)\n\n return (\n <NumberInputField\n name={name}\n label={label}\n description={description}\n errorMessage={errorMessage}\n isRequired={fieldMetadata?.isRequired}\n isDisabled={fieldMetadata?.isDisabled}\n format={format}\n min={min}\n max={max}\n FieldComponent={FieldComponent}\n />\n )\n}\n"],"names":["NumberInputHookField","name","label","description","format","min","max","validationMessages","FieldComponent","fieldMetadata","useFieldsMetadata","errorMessage","useFieldErrorMessage","jsx","NumberInputField"],"mappings":";;;;;;;;;AAkBO,SAASA,EAAgD;AAAA,EAC9D,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,QAAAC;AAAA,EACA,KAAAC;AAAA,EACA,KAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,gBAAAC;AACF,GAA0C;AAExC,QAAMC,IADWC,EAAA,EACcT,CAAI,GAC7BU,IAAeC,EAAqBX,GAAMM,CAAkB;AAElE,SACE,gBAAAM;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,MAAAb;AAAA,MACA,OAAAC;AAAA,MACA,aAAAC;AAAA,MACA,cAAAQ;AAAA,MACA,YAAYF,GAAe;AAAA,MAC3B,YAAYA,GAAe;AAAA,MAC3B,QAAAL;AAAA,MACA,KAAAC;AAAA,MACA,KAAAC;AAAA,MACA,gBAAAE;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { BaseFieldProps, ValidationMessages } from '../types';
|
|
3
|
+
import { RadioGroupProps } from '../../../Common/UI/RadioGroup/RadioGroupTypes';
|
|
4
|
+
export interface RadioGroupHookFieldProps<TErrorCode extends string = never, TEntry = unknown> extends BaseFieldProps {
|
|
5
|
+
name: string;
|
|
6
|
+
validationMessages?: ValidationMessages<TErrorCode>;
|
|
7
|
+
getOptionLabel?: (entry: TEntry) => string;
|
|
8
|
+
FieldComponent?: ComponentType<RadioGroupProps>;
|
|
9
|
+
}
|
|
10
|
+
export declare function RadioGroupHookField<TErrorCode extends string, TEntry = unknown>({ name, label, description, validationMessages, getOptionLabel, FieldComponent, }: RadioGroupHookFieldProps<TErrorCode, TEntry>): import("react/jsx-runtime").JSX.Element;
|