@gusto/embedded-react-sdk 0.37.0-rc.3 → 0.37.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Common/SignatureForm/SignatureFormActions.js +8 -7
- package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormFields.js +5 -4
- package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
- package/dist/components/Common/UI/DatePicker/DatePicker.d.ts +1 -1
- package/dist/components/Common/UI/DatePicker/DatePicker.js +88 -69
- package/dist/components/Common/UI/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/Common/UI/DatePicker/DatePickerTypes.d.ts +13 -0
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +7 -6
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +9 -8
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +11 -11
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +4 -3
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +7 -6
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +4 -3
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +6 -5
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +6 -6
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +4 -3
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js +7 -6
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +8 -7
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +6 -5
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +4 -3
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +4 -3
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Actions.js +7 -6
- package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +6 -5
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Actions.js +6 -5
- package/dist/components/Company/Industry/Actions.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +7 -6
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Industry/Edit.js +11 -10
- package/dist/components/Company/Industry/Edit.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Actions.js +3 -2
- package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +4 -3
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/Actions.js +3 -2
- package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/List.js +7 -6
- package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +4 -3
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +4 -3
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js +60 -58
- package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Actions.js +11 -10
- package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Edit.js +39 -36
- package/dist/components/Company/PaySchedule/_parts/Edit.js.map +1 -1
- package/dist/components/Company/PaySchedule/usePaySchedule.d.ts +1 -0
- package/dist/components/Company/PaySchedule/usePaySchedule.js +6 -5
- package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +6 -5
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +4 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +7 -6
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js +6 -5
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +4 -3
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Contractor/Address/Form.js +4 -4
- package/dist/components/Contractor/Address/useAddress.js +6 -5
- package/dist/components/Contractor/Address/useAddress.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +3 -2
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
- package/dist/components/Contractor/Profile/ContractorProfileForm.js +15 -15
- package/dist/components/Contractor/Profile/useContractorProfile.js +3 -2
- package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
- package/dist/components/Employee/Compensation/Actions.js +1 -1
- package/dist/components/Employee/Compensation/List.js +6 -5
- package/dist/components/Employee/Compensation/List.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +3 -2
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +3 -2
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +3 -2
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +5 -4
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +4 -3
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js +16 -16
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +4 -3
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Employee/EmployeeList/Actions.js +5 -4
- package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
- package/dist/components/Employee/EmployeeList/List.js +10 -10
- package/dist/components/Employee/EmployeeList/useEmployeeList.js +4 -3
- package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/Actions.js +3 -2
- package/dist/components/Employee/FederalTaxes/Actions.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/FederalForm.js +5 -4
- package/dist/components/Employee/FederalTaxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +4 -3
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/Actions.js +6 -5
- package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js +4 -4
- package/dist/components/Employee/PaymentMethod/Split.js +1 -1
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +6 -5
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/Actions.js +7 -6
- package/dist/components/Employee/Profile/Actions.js.map +1 -1
- package/dist/components/Employee/Profile/AdminPersonalDetails.js +5 -4
- package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js +10 -9
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
- package/dist/components/Employee/Profile/useProfile.js +4 -3
- package/dist/components/Employee/Profile/useProfile.js.map +1 -1
- package/dist/components/Employee/StateTaxes/Actions.js +7 -6
- package/dist/components/Employee/StateTaxes/Actions.js.map +1 -1
- package/dist/components/Employee/StateTaxes/useStateTaxes.js +4 -3
- package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
- package/dist/components/Employee/Taxes/Actions.js +8 -7
- package/dist/components/Employee/Taxes/Actions.js.map +1 -1
- package/dist/components/Employee/Taxes/FederalForm.js +5 -4
- package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/Taxes/useTaxes.js +4 -3
- package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js +48 -48
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.js +10 -10
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +10 -10
- package/dist/components/Payroll/Dismissal/DismissalFlowComponents.js +15 -14
- package/dist/components/Payroll/Dismissal/DismissalFlowComponents.js.map +1 -1
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +3 -2
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.module.scss.js +4 -4
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js +12 -11
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js.map +1 -1
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js +1 -0
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js.map +1 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js +3 -2
- package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js.map +1 -1
- package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.js +10 -10
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.js +44 -55
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +3 -2
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/components/UNSTABLE_Hooks/form/fields/CheckboxHookField.js +9 -8
- package/dist/components/UNSTABLE_Hooks/form/fields/CheckboxHookField.js.map +1 -1
- package/dist/components/UNSTABLE_Hooks/form/fields/NumberInputHookField.js +12 -11
- package/dist/components/UNSTABLE_Hooks/form/fields/NumberInputHookField.js.map +1 -1
- package/dist/components/UNSTABLE_Hooks/form/fields/RadioGroupHookField.js +3 -2
- package/dist/components/UNSTABLE_Hooks/form/fields/RadioGroupHookField.js.map +1 -1
- package/dist/components/UNSTABLE_Hooks/form/fields/SelectHookField.js +8 -7
- package/dist/components/UNSTABLE_Hooks/form/fields/SelectHookField.js.map +1 -1
- package/dist/components/UNSTABLE_Hooks/form/fields/SwitchHookField.js +9 -8
- package/dist/components/UNSTABLE_Hooks/form/fields/SwitchHookField.js.map +1 -1
- package/dist/components/UNSTABLE_Hooks/form/fields/TextInputHookField.js +13 -12
- package/dist/components/UNSTABLE_Hooks/form/fields/TextInputHookField.js.map +1 -1
- package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/CompensationForm.js +4 -4
- package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/EmployeeDetailsForm.js +1 -1
- package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/WorkAddressForm.js +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +3 -2
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/i18n/en/Company.PaySchedule.json.js +6 -6
- package/dist/i18n/en/Payroll.TransitionPayrollAlert.json.js +8 -8
- package/dist/style.css +1 -1
- package/dist/types/i18next.d.ts +2 -1
- package/docs/reference/endpoint-inventory.json +9 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OffCyclePayPeriodDateFormPresentation.js","sources":["../../../../src/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport styles from './OffCyclePayPeriodDateFormPresentation.module.scss'\nimport { useI18n } from '@/i18n'\nimport { CheckboxField, DatePickerField } from '@/components/Common'\n\nexport function OffCyclePayPeriodDateFormPresentation() {\n useI18n('Payroll.OffCyclePayPeriodDateForm')\n const { t } = useTranslation('Payroll.OffCyclePayPeriodDateForm')\n\n return (\n <div className={styles.root}>\n <div className={styles.dateFields}>\n <DatePickerField name=\"startDate\" label={t('startDateLabel')} isRequired />\n <DatePickerField name=\"endDate\" label={t('endDateLabel')} isRequired />\n </div>\n\n <div className={styles.checkDateField}>\n <DatePickerField name=\"checkDate\" label={t('checkDateLabel')} isRequired />\n </div>\n\n <CheckboxField\n name=\"isCheckOnly\"\n label={t('checkOnlyLabel')}\n description={t('checkOnlyDescription')}\n />\n </div>\n )\n}\n"],"names":["OffCyclePayPeriodDateFormPresentation","useI18n","t","useTranslation","jsxs","styles","jsx","DatePickerField","CheckboxField"],"mappings":"
|
|
1
|
+
{"version":3,"file":"OffCyclePayPeriodDateFormPresentation.js","sources":["../../../../src/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport styles from './OffCyclePayPeriodDateFormPresentation.module.scss'\nimport { useI18n } from '@/i18n'\nimport { CheckboxField, DatePickerField } from '@/components/Common'\n\nexport function OffCyclePayPeriodDateFormPresentation() {\n useI18n('Payroll.OffCyclePayPeriodDateForm')\n const { t } = useTranslation('Payroll.OffCyclePayPeriodDateForm')\n\n return (\n <div className={styles.root}>\n <div className={styles.dateFields}>\n <DatePickerField name=\"startDate\" label={t('startDateLabel')} isRequired />\n <DatePickerField name=\"endDate\" label={t('endDateLabel')} isRequired />\n </div>\n\n <div className={styles.checkDateField}>\n <DatePickerField name=\"checkDate\" label={t('checkDateLabel')} isRequired />\n </div>\n\n <CheckboxField\n name=\"isCheckOnly\"\n label={t('checkOnlyLabel')}\n description={t('checkOnlyDescription')}\n />\n </div>\n )\n}\n"],"names":["OffCyclePayPeriodDateFormPresentation","useI18n","t","useTranslation","jsxs","styles","jsx","DatePickerField","CheckboxField"],"mappings":";;;;;;;AAKO,SAASA,IAAwC;AACtD,EAAAC,EAAQ,mCAAmC;AAC3C,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,mCAAmC;AAEhE,SACE,gBAAAC,EAAC,OAAA,EAAI,WAAWC,EAAO,MACrB,UAAA;AAAA,IAAA,gBAAAD,EAAC,OAAA,EAAI,WAAWC,EAAO,YACrB,UAAA;AAAA,MAAA,gBAAAC,EAACC,GAAA,EAAgB,MAAK,aAAY,OAAOL,EAAE,gBAAgB,GAAG,YAAU,IAAC;AAAA,MACzE,gBAAAI,EAACC,KAAgB,MAAK,WAAU,OAAOL,EAAE,cAAc,GAAG,YAAU,GAAA,CAAC;AAAA,IAAA,GACvE;AAAA,IAEA,gBAAAI,EAAC,OAAA,EAAI,WAAWD,EAAO,gBACrB,UAAA,gBAAAC,EAACC,GAAA,EAAgB,MAAK,aAAY,OAAOL,EAAE,gBAAgB,GAAG,YAAU,IAAC,GAC3E;AAAA,IAEA,gBAAAI;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAON,EAAE,gBAAgB;AAAA,QACzB,aAAaA,EAAE,sBAAsB;AAAA,MAAA;AAAA,IAAA;AAAA,EACvC,GACF;AAEJ;"}
|
package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as r } from "react";
|
|
3
3
|
import { useTranslation as s } from "react-i18next";
|
|
4
|
+
import "../../../shared/constants.js";
|
|
4
5
|
import { RadioGroupField as l } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
5
6
|
function f({
|
|
6
7
|
name: e,
|
package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OffCycleReasonSelectionPresentation.js","sources":["../../../../src/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport type { OffCycleReason } from './types'\nimport { RadioGroupField } from '@/components/Common'\n\ninterface OffCycleReasonSelectionPresentationProps {\n name: string\n onChange?: (value: OffCycleReason) => void\n}\n\nexport function OffCycleReasonSelectionPresentation({\n name,\n onChange,\n}: OffCycleReasonSelectionPresentationProps) {\n const { t } = useTranslation('Payroll.OffCycleReasonSelection')\n\n const options = useMemo(\n () => [\n {\n value: 'correction' as OffCycleReason,\n label: t('options.correction.label'),\n description: t('options.correction.description'),\n },\n {\n value: 'bonus' as OffCycleReason,\n label: t('options.bonus.label'),\n description: t('options.bonus.description'),\n },\n ],\n [t],\n )\n\n return (\n <RadioGroupField<OffCycleReason>\n name={name}\n label={t('title')}\n options={options}\n isRequired\n onChange={onChange}\n />\n )\n}\n"],"names":["OffCycleReasonSelectionPresentation","name","onChange","t","useTranslation","options","useMemo","jsx","RadioGroupField"],"mappings":"
|
|
1
|
+
{"version":3,"file":"OffCycleReasonSelectionPresentation.js","sources":["../../../../src/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport type { OffCycleReason } from './types'\nimport { RadioGroupField } from '@/components/Common'\n\ninterface OffCycleReasonSelectionPresentationProps {\n name: string\n onChange?: (value: OffCycleReason) => void\n}\n\nexport function OffCycleReasonSelectionPresentation({\n name,\n onChange,\n}: OffCycleReasonSelectionPresentationProps) {\n const { t } = useTranslation('Payroll.OffCycleReasonSelection')\n\n const options = useMemo(\n () => [\n {\n value: 'correction' as OffCycleReason,\n label: t('options.correction.label'),\n description: t('options.correction.description'),\n },\n {\n value: 'bonus' as OffCycleReason,\n label: t('options.bonus.label'),\n description: t('options.bonus.description'),\n },\n ],\n [t],\n )\n\n return (\n <RadioGroupField<OffCycleReason>\n name={name}\n label={t('title')}\n options={options}\n isRequired\n onChange={onChange}\n />\n )\n}\n"],"names":["OffCycleReasonSelectionPresentation","name","onChange","t","useTranslation","options","useMemo","jsx","RadioGroupField"],"mappings":";;;;;AAUO,SAASA,EAAoC;AAAA,EAClD,MAAAC;AAAA,EACA,UAAAC;AACF,GAA6C;AAC3C,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,iCAAiC,GAExDC,IAAUC;AAAA,IACd,MAAM;AAAA,MACJ;AAAA,QACE,OAAO;AAAA,QACP,OAAOH,EAAE,0BAA0B;AAAA,QACnC,aAAaA,EAAE,gCAAgC;AAAA,MAAA;AAAA,MAEjD;AAAA,QACE,OAAO;AAAA,QACP,OAAOA,EAAE,qBAAqB;AAAA,QAC9B,aAAaA,EAAE,2BAA2B;AAAA,MAAA;AAAA,IAC5C;AAAA,IAEF,CAACA,CAAC;AAAA,EAAA;AAGJ,SACE,gBAAAI;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,MAAAP;AAAA,MACA,OAAOE,EAAE,OAAO;AAAA,MAChB,SAAAE;AAAA,MACA,YAAU;AAAA,MACV,UAAAH;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -5,12 +5,13 @@ import { useTranslation as L } from "react-i18next";
|
|
|
5
5
|
import { WithholdingPayPeriod as N } from "@gusto/embedded-api/models/operations/postv1companiescompanyidpayrolls";
|
|
6
6
|
import { WITHHOLDING_PAY_PERIOD_I18N_KEY as p } from "../OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.js";
|
|
7
7
|
import l from "./OffCycleTaxWithholdingModal.module.scss.js";
|
|
8
|
+
import "../../../shared/constants.js";
|
|
8
9
|
import { ActionsLayout as T } from "../../Common/ActionsLayout/ActionsLayout.js";
|
|
9
10
|
import { useComponentContext as W } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
10
11
|
import { useI18n as w } from "../../../i18n/I18n.js";
|
|
11
12
|
import { SelectField as D } from "../../Common/Fields/SelectField/SelectField.js";
|
|
12
13
|
import { RadioGroupField as H } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
13
|
-
function
|
|
14
|
+
function K({
|
|
14
15
|
isOpen: h,
|
|
15
16
|
defaultConfig: f,
|
|
16
17
|
onDone: g,
|
|
@@ -95,6 +96,6 @@ function Y({
|
|
|
95
96
|
);
|
|
96
97
|
}
|
|
97
98
|
export {
|
|
98
|
-
|
|
99
|
+
K as OffCycleTaxWithholdingModal
|
|
99
100
|
};
|
|
100
101
|
//# sourceMappingURL=OffCycleTaxWithholdingModal.js.map
|
package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OffCycleTaxWithholdingModal.js","sources":["../../../../src/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.tsx"],"sourcesContent":["import { useMemo, useRef } from 'react'\nimport { FormProvider, useForm, useWatch } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { WithholdingPayPeriod } from '@gusto/embedded-api/models/operations/postv1companiescompanyidpayrolls'\nimport { WITHHOLDING_PAY_PERIOD_I18N_KEY } from '../OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes'\nimport type { OffCycleTaxWithholdingConfig } from '../OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes'\nimport styles from './OffCycleTaxWithholdingModal.module.scss'\nimport type { OffCycleTaxWithholdingModalProps } from './OffCycleTaxWithholdingModalTypes'\nimport { ActionsLayout, SelectField, RadioGroupField } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\n\nexport function OffCycleTaxWithholdingModal({\n isOpen,\n defaultConfig,\n onDone,\n onCancel,\n}: OffCycleTaxWithholdingModalProps) {\n useI18n('Payroll.OffCycleTaxWithholding')\n const { t } = useTranslation('Payroll.OffCycleTaxWithholding')\n const { Modal, Heading, Text, Button } = useComponentContext()\n const modalContainerRef = useRef<HTMLDivElement>(null)\n\n const formHandlers = useForm<OffCycleTaxWithholdingConfig>({\n defaultValues: defaultConfig,\n })\n\n const currentWithholdingPayPeriod = useWatch({\n control: formHandlers.control,\n name: 'withholdingPayPeriod',\n })\n\n const frequencyOptions = useMemo(\n () =>\n Object.values(WithholdingPayPeriod).map(value => ({\n value,\n label: t(WITHHOLDING_PAY_PERIOD_I18N_KEY[value]),\n })),\n [t],\n )\n\n const frequencyDisplayText = t(\n WITHHOLDING_PAY_PERIOD_I18N_KEY[currentWithholdingPayPeriod],\n ).toLowerCase()\n\n const withholdingRateOptions = useMemo(\n () => [\n {\n value: 'supplemental' as const,\n label: t('modal.supplementalSection.useSupplementalRate'),\n description: t('modal.supplementalSection.useSupplementalRateDescription'),\n },\n {\n value: 'regular' as const,\n label: t('modal.supplementalSection.useRegularRate', {\n frequency: frequencyDisplayText,\n }),\n description: t('modal.supplementalSection.useRegularRateDescription'),\n },\n ],\n [t, frequencyDisplayText],\n )\n\n const handleSubmit = formHandlers.handleSubmit(onDone)\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={onCancel}\n containerRef={modalContainerRef}\n footer={\n <ActionsLayout>\n <Button variant=\"secondary\" onClick={onCancel}>\n {t('modal.cancelButton')}\n </Button>\n <Button variant=\"primary\" onClick={handleSubmit}>\n {t('modal.doneButton')}\n </Button>\n </ActionsLayout>\n }\n >\n <FormProvider {...formHandlers}>\n <div className={styles.content}>\n <Heading as=\"h2\">{t('modal.title')}</Heading>\n\n <div className={styles.section}>\n <Heading as=\"h3\">{t('modal.regularSection.title')}</Heading>\n <Text variant=\"supporting\">{t('modal.regularSection.subtitle')}</Text>\n\n <div className={styles.rateInfo}>\n <Text weight=\"semibold\">{t('modal.regularSection.rateLabel')}</Text>\n <Text variant=\"supporting\">{t('modal.regularSection.rateDescription')}</Text>\n </div>\n\n <SelectField\n name=\"withholdingPayPeriod\"\n label={t('modal.regularSection.rateLabel')}\n options={frequencyOptions}\n shouldVisuallyHideLabel\n portalContainer={modalContainerRef.current ?? undefined}\n />\n </div>\n\n <hr className={styles.divider} />\n\n <div className={styles.section}>\n <Heading as=\"h3\">{t('modal.supplementalSection.title')}</Heading>\n <RadioGroupField\n name=\"withholdingRate\"\n label={t('modal.supplementalSection.title')}\n options={withholdingRateOptions}\n shouldVisuallyHideLabel\n />\n </div>\n </div>\n </FormProvider>\n </Modal>\n )\n}\n"],"names":["OffCycleTaxWithholdingModal","isOpen","defaultConfig","onDone","onCancel","useI18n","t","useTranslation","Modal","Heading","Text","Button","useComponentContext","modalContainerRef","useRef","formHandlers","useForm","currentWithholdingPayPeriod","useWatch","frequencyOptions","useMemo","WithholdingPayPeriod","value","WITHHOLDING_PAY_PERIOD_I18N_KEY","frequencyDisplayText","withholdingRateOptions","handleSubmit","jsx","ActionsLayout","FormProvider","styles","jsxs","SelectField","RadioGroupField"],"mappings":"
|
|
1
|
+
{"version":3,"file":"OffCycleTaxWithholdingModal.js","sources":["../../../../src/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.tsx"],"sourcesContent":["import { useMemo, useRef } from 'react'\nimport { FormProvider, useForm, useWatch } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { WithholdingPayPeriod } from '@gusto/embedded-api/models/operations/postv1companiescompanyidpayrolls'\nimport { WITHHOLDING_PAY_PERIOD_I18N_KEY } from '../OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes'\nimport type { OffCycleTaxWithholdingConfig } from '../OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes'\nimport styles from './OffCycleTaxWithholdingModal.module.scss'\nimport type { OffCycleTaxWithholdingModalProps } from './OffCycleTaxWithholdingModalTypes'\nimport { ActionsLayout, SelectField, RadioGroupField } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\n\nexport function OffCycleTaxWithholdingModal({\n isOpen,\n defaultConfig,\n onDone,\n onCancel,\n}: OffCycleTaxWithholdingModalProps) {\n useI18n('Payroll.OffCycleTaxWithholding')\n const { t } = useTranslation('Payroll.OffCycleTaxWithholding')\n const { Modal, Heading, Text, Button } = useComponentContext()\n const modalContainerRef = useRef<HTMLDivElement>(null)\n\n const formHandlers = useForm<OffCycleTaxWithholdingConfig>({\n defaultValues: defaultConfig,\n })\n\n const currentWithholdingPayPeriod = useWatch({\n control: formHandlers.control,\n name: 'withholdingPayPeriod',\n })\n\n const frequencyOptions = useMemo(\n () =>\n Object.values(WithholdingPayPeriod).map(value => ({\n value,\n label: t(WITHHOLDING_PAY_PERIOD_I18N_KEY[value]),\n })),\n [t],\n )\n\n const frequencyDisplayText = t(\n WITHHOLDING_PAY_PERIOD_I18N_KEY[currentWithholdingPayPeriod],\n ).toLowerCase()\n\n const withholdingRateOptions = useMemo(\n () => [\n {\n value: 'supplemental' as const,\n label: t('modal.supplementalSection.useSupplementalRate'),\n description: t('modal.supplementalSection.useSupplementalRateDescription'),\n },\n {\n value: 'regular' as const,\n label: t('modal.supplementalSection.useRegularRate', {\n frequency: frequencyDisplayText,\n }),\n description: t('modal.supplementalSection.useRegularRateDescription'),\n },\n ],\n [t, frequencyDisplayText],\n )\n\n const handleSubmit = formHandlers.handleSubmit(onDone)\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={onCancel}\n containerRef={modalContainerRef}\n footer={\n <ActionsLayout>\n <Button variant=\"secondary\" onClick={onCancel}>\n {t('modal.cancelButton')}\n </Button>\n <Button variant=\"primary\" onClick={handleSubmit}>\n {t('modal.doneButton')}\n </Button>\n </ActionsLayout>\n }\n >\n <FormProvider {...formHandlers}>\n <div className={styles.content}>\n <Heading as=\"h2\">{t('modal.title')}</Heading>\n\n <div className={styles.section}>\n <Heading as=\"h3\">{t('modal.regularSection.title')}</Heading>\n <Text variant=\"supporting\">{t('modal.regularSection.subtitle')}</Text>\n\n <div className={styles.rateInfo}>\n <Text weight=\"semibold\">{t('modal.regularSection.rateLabel')}</Text>\n <Text variant=\"supporting\">{t('modal.regularSection.rateDescription')}</Text>\n </div>\n\n <SelectField\n name=\"withholdingPayPeriod\"\n label={t('modal.regularSection.rateLabel')}\n options={frequencyOptions}\n shouldVisuallyHideLabel\n portalContainer={modalContainerRef.current ?? undefined}\n />\n </div>\n\n <hr className={styles.divider} />\n\n <div className={styles.section}>\n <Heading as=\"h3\">{t('modal.supplementalSection.title')}</Heading>\n <RadioGroupField\n name=\"withholdingRate\"\n label={t('modal.supplementalSection.title')}\n options={withholdingRateOptions}\n shouldVisuallyHideLabel\n />\n </div>\n </div>\n </FormProvider>\n </Modal>\n )\n}\n"],"names":["OffCycleTaxWithholdingModal","isOpen","defaultConfig","onDone","onCancel","useI18n","t","useTranslation","Modal","Heading","Text","Button","useComponentContext","modalContainerRef","useRef","formHandlers","useForm","currentWithholdingPayPeriod","useWatch","frequencyOptions","useMemo","WithholdingPayPeriod","value","WITHHOLDING_PAY_PERIOD_I18N_KEY","frequencyDisplayText","withholdingRateOptions","handleSubmit","jsx","ActionsLayout","FormProvider","styles","jsxs","SelectField","RadioGroupField"],"mappings":"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"}
|
|
@@ -6,11 +6,11 @@ import a from "./TransitionCreationPresentation.module.scss.js";
|
|
|
6
6
|
import { useI18n as d } from "../../../i18n/I18n.js";
|
|
7
7
|
import { useComponentContext as G } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
8
8
|
import { Flex as t } from "../../Common/Flex/Flex.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
9
|
+
import { useDateFormatter as j } from "../../../hooks/useDateFormatter.js";
|
|
10
|
+
import { RadioGroupField as F } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
11
|
+
import { OffCycleTaxWithholdingTable as L } from "../OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.js";
|
|
12
|
+
import { OffCycleTaxWithholdingModal as R } from "../OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js";
|
|
13
|
+
import { DatePickerField as A } from "../../Common/Fields/DatePickerField/DatePickerField.js";
|
|
14
14
|
function Q({
|
|
15
15
|
startDate: D,
|
|
16
16
|
endDate: C,
|
|
@@ -23,7 +23,7 @@ function Q({
|
|
|
23
23
|
onTaxWithholdingModalCancel: O
|
|
24
24
|
}) {
|
|
25
25
|
d("Payroll.TransitionCreation"), d("Payroll.OffCycleDeductionsSetting"), d("Payroll.OffCycleTaxWithholding");
|
|
26
|
-
const { t: i } = c("Payroll.TransitionCreation"), { t: r } = c("Payroll.OffCycleDeductionsSetting"), { t: s } = c("Payroll.OffCycleTaxWithholding"), { Heading: u, Text: l, Alert: P, Button: v } = G(), h =
|
|
26
|
+
const { t: i } = c("Payroll.TransitionCreation"), { t: r } = c("Payroll.OffCycleDeductionsSetting"), { t: s } = c("Payroll.OffCycleTaxWithholding"), { Heading: u, Text: l, Alert: P, Button: v } = G(), h = j(), S = h.formatShortWithYear(D), w = h.formatShortWithYear(C), E = b(
|
|
27
27
|
() => [
|
|
28
28
|
{
|
|
29
29
|
value: !1,
|
|
@@ -70,10 +70,10 @@ function Q({
|
|
|
70
70
|
] })
|
|
71
71
|
] }),
|
|
72
72
|
/* @__PURE__ */ e("hr", { className: a.divider }),
|
|
73
|
-
/* @__PURE__ */ e(t, { flexDirection: "column", gap: 20, children: /* @__PURE__ */ e(
|
|
73
|
+
/* @__PURE__ */ e(t, { flexDirection: "column", gap: 20, children: /* @__PURE__ */ e(A, { name: "checkDate", label: i("checkDateLabel"), isRequired: !0 }) }),
|
|
74
74
|
/* @__PURE__ */ e("hr", { className: a.divider }),
|
|
75
75
|
/* @__PURE__ */ e(t, { flexDirection: "column", gap: 20, children: /* @__PURE__ */ e(
|
|
76
|
-
|
|
76
|
+
F,
|
|
77
77
|
{
|
|
78
78
|
name: "skipRegularDeductions",
|
|
79
79
|
label: r("title"),
|
|
@@ -84,7 +84,7 @@ function Q({
|
|
|
84
84
|
) }),
|
|
85
85
|
/* @__PURE__ */ e("hr", { className: a.divider }),
|
|
86
86
|
/* @__PURE__ */ e(
|
|
87
|
-
|
|
87
|
+
L,
|
|
88
88
|
{
|
|
89
89
|
wageTypeGroups: W,
|
|
90
90
|
config: f,
|
|
@@ -92,7 +92,7 @@ function Q({
|
|
|
92
92
|
}
|
|
93
93
|
),
|
|
94
94
|
x && /* @__PURE__ */ e(
|
|
95
|
-
|
|
95
|
+
R,
|
|
96
96
|
{
|
|
97
97
|
isOpen: !0,
|
|
98
98
|
defaultConfig: f,
|
package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.js
CHANGED
|
@@ -14,73 +14,62 @@ function B({
|
|
|
14
14
|
skippingPayPeriod: D
|
|
15
15
|
}) {
|
|
16
16
|
R("Payroll.TransitionPayrollAlert");
|
|
17
|
-
const { t } = T("Payroll.TransitionPayrollAlert"), { Alert:
|
|
17
|
+
const { t } = T("Payroll.TransitionPayrollAlert"), { Alert: c, Button: m, Text: u, Dialog: k } = v(), y = F(), [l, s] = P(null);
|
|
18
18
|
if (a.length === 0)
|
|
19
19
|
return null;
|
|
20
20
|
const p = (i) => y.formatPayPeriodRange(i.startDate, i.endDate, {
|
|
21
21
|
useShortMonth: !0
|
|
22
22
|
}), x = () => {
|
|
23
|
-
l && (d(l),
|
|
23
|
+
l && (d(l), s(null));
|
|
24
24
|
}, C = a.length > 1;
|
|
25
25
|
return /* @__PURE__ */ r(o, { flexDirection: "column", gap: 16, children: [
|
|
26
|
-
g && /* @__PURE__ */ e(
|
|
27
|
-
|
|
28
|
-
/* @__PURE__ */ e(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
] })
|
|
68
|
-
]
|
|
69
|
-
},
|
|
70
|
-
`${n.payScheduleUuid}-${n.startDate}`
|
|
71
|
-
);
|
|
72
|
-
})
|
|
73
|
-
]
|
|
74
|
-
},
|
|
75
|
-
i.payScheduleUuid || `group-${S}`
|
|
76
|
-
))
|
|
77
|
-
] }) }),
|
|
26
|
+
g && /* @__PURE__ */ e(c, { status: "info", label: t("skipSuccessAlert"), onDismiss: f }),
|
|
27
|
+
a.map((i, S) => /* @__PURE__ */ r(o, { flexDirection: "column", gap: 16, children: [
|
|
28
|
+
C && /* @__PURE__ */ e(u, { weight: "semibold", children: i.payScheduleName }),
|
|
29
|
+
i.payPeriods.map((n) => {
|
|
30
|
+
const A = p(n), b = D === n;
|
|
31
|
+
return /* @__PURE__ */ e(
|
|
32
|
+
c,
|
|
33
|
+
{
|
|
34
|
+
status: "warning",
|
|
35
|
+
label: t("alertTitle", { dateRange: A }),
|
|
36
|
+
children: /* @__PURE__ */ r(o, { flexDirection: "column", gap: 16, children: [
|
|
37
|
+
/* @__PURE__ */ e(u, { children: t("alertDescription") }),
|
|
38
|
+
/* @__PURE__ */ r(o, { gap: 12, alignItems: "center", children: [
|
|
39
|
+
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
40
|
+
m,
|
|
41
|
+
{
|
|
42
|
+
variant: "secondary",
|
|
43
|
+
onClick: () => {
|
|
44
|
+
h(n);
|
|
45
|
+
},
|
|
46
|
+
children: t("runPayroll")
|
|
47
|
+
}
|
|
48
|
+
) }),
|
|
49
|
+
/* @__PURE__ */ e(
|
|
50
|
+
m,
|
|
51
|
+
{
|
|
52
|
+
variant: "tertiary",
|
|
53
|
+
onClick: () => {
|
|
54
|
+
s(n);
|
|
55
|
+
},
|
|
56
|
+
isLoading: b,
|
|
57
|
+
children: t("skipPayroll")
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
] })
|
|
61
|
+
] })
|
|
62
|
+
},
|
|
63
|
+
`${n.payScheduleUuid}-${n.startDate}`
|
|
64
|
+
);
|
|
65
|
+
})
|
|
66
|
+
] }, i.payScheduleUuid || `group-${S}`)),
|
|
78
67
|
/* @__PURE__ */ e(
|
|
79
68
|
k,
|
|
80
69
|
{
|
|
81
70
|
isOpen: l !== null,
|
|
82
71
|
onClose: () => {
|
|
83
|
-
|
|
72
|
+
s(null);
|
|
84
73
|
},
|
|
85
74
|
onPrimaryActionClick: x,
|
|
86
75
|
isDestructive: !0,
|
package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransitionPayrollAlertPresentation.js","sources":["../../../../src/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.tsx"],"sourcesContent":["import { useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport type { PayPeriod } from '@gusto/embedded-api/models/components/payperiod'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { useI18n } from '@/i18n'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\n\ninterface TransitionPayPeriodGroup {\n payScheduleUuid: string\n payScheduleName: string\n payPeriods: PayPeriod[]\n}\n\ninterface TransitionPayrollAlertPresentationProps {\n groupedPayPeriods: TransitionPayPeriodGroup[]\n onRunPayroll: (payPeriod: PayPeriod) => void\n onSkipPayroll: (payPeriod: PayPeriod) => void\n showSkipSuccessAlert: boolean\n onDismissSkipSuccessAlert: () => void\n skippingPayPeriod: PayPeriod | null\n}\n\nexport function TransitionPayrollAlertPresentation({\n groupedPayPeriods,\n onRunPayroll,\n onSkipPayroll,\n showSkipSuccessAlert,\n onDismissSkipSuccessAlert,\n skippingPayPeriod,\n}: TransitionPayrollAlertPresentationProps) {\n useI18n('Payroll.TransitionPayrollAlert')\n const { t } = useTranslation('Payroll.TransitionPayrollAlert')\n const { Alert, Button, Text, Dialog } = useComponentContext()\n const dateFormatter = useDateFormatter()\n const [skipDialogPayPeriod, setSkipDialogPayPeriod] = useState<PayPeriod | null>(null)\n\n if (groupedPayPeriods.length === 0) {\n return null\n }\n\n const formatDateRange = (payPeriod: PayPeriod) =>\n dateFormatter.formatPayPeriodRange(payPeriod.startDate, payPeriod.endDate, {\n useShortMonth: true,\n })\n\n const handleConfirmSkip = () => {\n if (skipDialogPayPeriod) {\n onSkipPayroll(skipDialogPayPeriod)\n setSkipDialogPayPeriod(null)\n }\n }\n\n const hasMultipleGroups = groupedPayPeriods.length > 1\n\n return (\n <Flex flexDirection=\"column\" gap={16}>\n {showSkipSuccessAlert && (\n <Alert status=\"info\" label={t('skipSuccessAlert')} onDismiss={onDismissSkipSuccessAlert} />\n )}\n
|
|
1
|
+
{"version":3,"file":"TransitionPayrollAlertPresentation.js","sources":["../../../../src/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.tsx"],"sourcesContent":["import { useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport type { PayPeriod } from '@gusto/embedded-api/models/components/payperiod'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { useI18n } from '@/i18n'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\n\ninterface TransitionPayPeriodGroup {\n payScheduleUuid: string\n payScheduleName: string\n payPeriods: PayPeriod[]\n}\n\ninterface TransitionPayrollAlertPresentationProps {\n groupedPayPeriods: TransitionPayPeriodGroup[]\n onRunPayroll: (payPeriod: PayPeriod) => void\n onSkipPayroll: (payPeriod: PayPeriod) => void\n showSkipSuccessAlert: boolean\n onDismissSkipSuccessAlert: () => void\n skippingPayPeriod: PayPeriod | null\n}\n\nexport function TransitionPayrollAlertPresentation({\n groupedPayPeriods,\n onRunPayroll,\n onSkipPayroll,\n showSkipSuccessAlert,\n onDismissSkipSuccessAlert,\n skippingPayPeriod,\n}: TransitionPayrollAlertPresentationProps) {\n useI18n('Payroll.TransitionPayrollAlert')\n const { t } = useTranslation('Payroll.TransitionPayrollAlert')\n const { Alert, Button, Text, Dialog } = useComponentContext()\n const dateFormatter = useDateFormatter()\n const [skipDialogPayPeriod, setSkipDialogPayPeriod] = useState<PayPeriod | null>(null)\n\n if (groupedPayPeriods.length === 0) {\n return null\n }\n\n const formatDateRange = (payPeriod: PayPeriod) =>\n dateFormatter.formatPayPeriodRange(payPeriod.startDate, payPeriod.endDate, {\n useShortMonth: true,\n })\n\n const handleConfirmSkip = () => {\n if (skipDialogPayPeriod) {\n onSkipPayroll(skipDialogPayPeriod)\n setSkipDialogPayPeriod(null)\n }\n }\n\n const hasMultipleGroups = groupedPayPeriods.length > 1\n\n return (\n <Flex flexDirection=\"column\" gap={16}>\n {showSkipSuccessAlert && (\n <Alert status=\"info\" label={t('skipSuccessAlert')} onDismiss={onDismissSkipSuccessAlert} />\n )}\n {groupedPayPeriods.map((group, groupIndex) => (\n <Flex key={group.payScheduleUuid || `group-${groupIndex}`} flexDirection=\"column\" gap={16}>\n {hasMultipleGroups && <Text weight=\"semibold\">{group.payScheduleName}</Text>}\n {group.payPeriods.map(payPeriod => {\n const dateRange = formatDateRange(payPeriod)\n const isSkipping = skippingPayPeriod === payPeriod\n\n return (\n <Alert\n key={`${payPeriod.payScheduleUuid}-${payPeriod.startDate}`}\n status=\"warning\"\n label={t('alertTitle', { dateRange })}\n >\n <Flex flexDirection=\"column\" gap={16}>\n <Text>{t('alertDescription')}</Text>\n <Flex gap={12} alignItems=\"center\">\n <div>\n <Button\n variant=\"secondary\"\n onClick={() => {\n onRunPayroll(payPeriod)\n }}\n >\n {t('runPayroll')}\n </Button>\n </div>\n <Button\n variant=\"tertiary\"\n onClick={() => {\n setSkipDialogPayPeriod(payPeriod)\n }}\n isLoading={isSkipping}\n >\n {t('skipPayroll')}\n </Button>\n </Flex>\n </Flex>\n </Alert>\n )\n })}\n </Flex>\n ))}\n <Dialog\n isOpen={skipDialogPayPeriod !== null}\n onClose={() => {\n setSkipDialogPayPeriod(null)\n }}\n onPrimaryActionClick={handleConfirmSkip}\n isDestructive\n title={t('skipDialog.title', {\n dateRange: skipDialogPayPeriod ? formatDateRange(skipDialogPayPeriod) : '',\n })}\n primaryActionLabel={t('skipDialog.confirmCta')}\n closeActionLabel={t('skipDialog.cancelCta')}\n >\n {t('skipDialog.body')}\n </Dialog>\n </Flex>\n )\n}\n"],"names":["TransitionPayrollAlertPresentation","groupedPayPeriods","onRunPayroll","onSkipPayroll","showSkipSuccessAlert","onDismissSkipSuccessAlert","skippingPayPeriod","useI18n","useTranslation","Alert","Button","Text","Dialog","useComponentContext","dateFormatter","useDateFormatter","skipDialogPayPeriod","setSkipDialogPayPeriod","useState","formatDateRange","payPeriod","handleConfirmSkip","hasMultipleGroups","jsxs","Flex","jsx","group","groupIndex","dateRange","isSkipping"],"mappings":"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"}
|
|
@@ -13,8 +13,9 @@ import "@gusto/embedded-api/models/errors/sdkvalidationerror";
|
|
|
13
13
|
import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
14
14
|
import "../../shared/constants.js";
|
|
15
15
|
import "../../contexts/ComponentAdapter/useComponentContext.js";
|
|
16
|
+
import "../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
16
17
|
import { retryAsync as x } from "../../helpers/retryAsync.js";
|
|
17
|
-
const q = 4, v = 1500, w = (e) => e instanceof T ? Array.isArray(e.errors) && e.errors.some((r) => r.category === "invalid_operation") : !1,
|
|
18
|
+
const q = 4, v = 1500, w = (e) => e instanceof T ? Array.isArray(e.errors) && e.errors.some((r) => r.category === "invalid_operation") : !1, W = ({
|
|
18
19
|
companyId: e,
|
|
19
20
|
payrollId: r,
|
|
20
21
|
employeeUuids: a,
|
|
@@ -65,6 +66,6 @@ const q = 4, v = 1500, w = (e) => e instanceof T ? Array.isArray(e.errors) && e.
|
|
|
65
66
|
};
|
|
66
67
|
};
|
|
67
68
|
export {
|
|
68
|
-
|
|
69
|
+
W as usePreparedPayrollData
|
|
69
70
|
};
|
|
70
71
|
//# sourceMappingURL=usePreparedPayrollData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePreparedPayrollData.js","sources":["../../../src/components/Payroll/usePreparedPayrollData.ts"],"sourcesContent":["import { useState, useEffect, useCallback, useRef, useMemo } from 'react'\nimport { usePayrollsPrepareMutation } from '@gusto/embedded-api/react-query/payrollsPrepare'\nimport { usePaySchedulesGet } from '@gusto/embedded-api/react-query/paySchedulesGet'\nimport type { PayrollPrepared } from '@gusto/embedded-api/models/components/payroll'\nimport type { PayScheduleObject } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport type { QueryParamSortBy } from '@gusto/embedded-api/models/operations/putv1companiescompanyidpayrollspayrollidprepare'\nimport { UnprocessableEntityErrorObject } from '@gusto/embedded-api/models/errors/unprocessableentityerrorobject'\nimport { useBase } from '../Base'\nimport { retryAsync } from '@/helpers/retryAsync'\n\ninterface UsePreparedPayrollDataParams {\n companyId: string\n payrollId: string\n employeeUuids?: string[]\n sortBy?: QueryParamSortBy\n onDataReady?: (preparedPayroll: PayrollPrepared) => void\n}\n\ninterface UsePreparedPayrollDataReturn {\n handlePreparePayroll: () => Promise<void>\n preparedPayroll: PayrollPrepared | undefined\n paySchedule: PayScheduleObject | undefined\n isLoading: boolean\n isPaginating: boolean\n hasInitialData: boolean\n}\n\nconst PREPARE_MAX_ATTEMPTS = 4\nconst PREPARE_RETRY_DELAY_MS = 1500\n\nconst isPayrollBeingProcessedError = (error: unknown): boolean => {\n if (!(error instanceof UnprocessableEntityErrorObject)) return false\n return Array.isArray(error.errors) && error.errors.some(e => e.category === 'invalid_operation')\n}\n\nexport const usePreparedPayrollData = ({\n companyId,\n payrollId,\n employeeUuids,\n sortBy,\n onDataReady,\n}: UsePreparedPayrollDataParams): UsePreparedPayrollDataReturn => {\n const { mutateAsync: preparePayroll, isPending: isPreparePayrollPending } =\n usePayrollsPrepareMutation()\n const [preparedPayroll, setPreparedPayroll] = useState<PayrollPrepared | undefined>()\n const hasInitialDataRef = useRef(false)\n const hasFiredRef = useRef(false)\n const { baseSubmitHandler } = useBase()\n\n const employeeUuidsKey = useMemo(() => employeeUuids?.join(',') ?? '', [employeeUuids])\n\n const { data: payScheduleData, isLoading: isPayScheduleLoading } = usePaySchedulesGet(\n {\n companyId,\n payScheduleId: preparedPayroll?.payPeriod?.payScheduleUuid || '',\n },\n {\n enabled: !!preparedPayroll?.payPeriod?.payScheduleUuid,\n },\n )\n\n const executePrepare = useCallback(async () => {\n const result = await preparePayroll({\n request: {\n companyId,\n payrollId,\n sortBy,\n requestBody: {\n employeeUuids,\n },\n },\n })\n setPreparedPayroll(result.payrollPrepared)\n if (result.payrollPrepared) {\n hasInitialDataRef.current = true\n onDataReady?.(result.payrollPrepared)\n }\n }, [companyId, payrollId, preparePayroll, employeeUuidsKey, sortBy, onDataReady])\n\n const handlePreparePayroll = useCallback(async () => {\n await baseSubmitHandler(null, () =>\n retryAsync(executePrepare, {\n maxAttempts: PREPARE_MAX_ATTEMPTS,\n delayMs: PREPARE_RETRY_DELAY_MS,\n shouldRetry: isPayrollBeingProcessedError,\n }),\n )\n }, [baseSubmitHandler, executePrepare])\n\n useEffect(() => {\n if (hasFiredRef.current) return\n hasFiredRef.current = true\n void handlePreparePayroll()\n }, [handlePreparePayroll])\n\n const isInitialLoading = isPreparePayrollPending && !hasInitialDataRef.current\n const isPaginating = isPreparePayrollPending && hasInitialDataRef.current\n const isLoading = isInitialLoading || isPayScheduleLoading\n\n return {\n handlePreparePayroll,\n preparedPayroll,\n paySchedule: payScheduleData?.payScheduleObject,\n isLoading,\n isPaginating,\n hasInitialData: hasInitialDataRef.current,\n }\n}\n"],"names":["PREPARE_MAX_ATTEMPTS","PREPARE_RETRY_DELAY_MS","isPayrollBeingProcessedError","error","UnprocessableEntityErrorObject","e","usePreparedPayrollData","companyId","payrollId","employeeUuids","sortBy","onDataReady","preparePayroll","isPreparePayrollPending","usePayrollsPrepareMutation","preparedPayroll","setPreparedPayroll","useState","hasInitialDataRef","useRef","hasFiredRef","baseSubmitHandler","useBase","employeeUuidsKey","useMemo","payScheduleData","isPayScheduleLoading","usePaySchedulesGet","executePrepare","useCallback","result","handlePreparePayroll","retryAsync","useEffect","isInitialLoading","isPaginating","isLoading"],"mappings":"
|
|
1
|
+
{"version":3,"file":"usePreparedPayrollData.js","sources":["../../../src/components/Payroll/usePreparedPayrollData.ts"],"sourcesContent":["import { useState, useEffect, useCallback, useRef, useMemo } from 'react'\nimport { usePayrollsPrepareMutation } from '@gusto/embedded-api/react-query/payrollsPrepare'\nimport { usePaySchedulesGet } from '@gusto/embedded-api/react-query/paySchedulesGet'\nimport type { PayrollPrepared } from '@gusto/embedded-api/models/components/payroll'\nimport type { PayScheduleObject } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport type { QueryParamSortBy } from '@gusto/embedded-api/models/operations/putv1companiescompanyidpayrollspayrollidprepare'\nimport { UnprocessableEntityErrorObject } from '@gusto/embedded-api/models/errors/unprocessableentityerrorobject'\nimport { useBase } from '../Base'\nimport { retryAsync } from '@/helpers/retryAsync'\n\ninterface UsePreparedPayrollDataParams {\n companyId: string\n payrollId: string\n employeeUuids?: string[]\n sortBy?: QueryParamSortBy\n onDataReady?: (preparedPayroll: PayrollPrepared) => void\n}\n\ninterface UsePreparedPayrollDataReturn {\n handlePreparePayroll: () => Promise<void>\n preparedPayroll: PayrollPrepared | undefined\n paySchedule: PayScheduleObject | undefined\n isLoading: boolean\n isPaginating: boolean\n hasInitialData: boolean\n}\n\nconst PREPARE_MAX_ATTEMPTS = 4\nconst PREPARE_RETRY_DELAY_MS = 1500\n\nconst isPayrollBeingProcessedError = (error: unknown): boolean => {\n if (!(error instanceof UnprocessableEntityErrorObject)) return false\n return Array.isArray(error.errors) && error.errors.some(e => e.category === 'invalid_operation')\n}\n\nexport const usePreparedPayrollData = ({\n companyId,\n payrollId,\n employeeUuids,\n sortBy,\n onDataReady,\n}: UsePreparedPayrollDataParams): UsePreparedPayrollDataReturn => {\n const { mutateAsync: preparePayroll, isPending: isPreparePayrollPending } =\n usePayrollsPrepareMutation()\n const [preparedPayroll, setPreparedPayroll] = useState<PayrollPrepared | undefined>()\n const hasInitialDataRef = useRef(false)\n const hasFiredRef = useRef(false)\n const { baseSubmitHandler } = useBase()\n\n const employeeUuidsKey = useMemo(() => employeeUuids?.join(',') ?? '', [employeeUuids])\n\n const { data: payScheduleData, isLoading: isPayScheduleLoading } = usePaySchedulesGet(\n {\n companyId,\n payScheduleId: preparedPayroll?.payPeriod?.payScheduleUuid || '',\n },\n {\n enabled: !!preparedPayroll?.payPeriod?.payScheduleUuid,\n },\n )\n\n const executePrepare = useCallback(async () => {\n const result = await preparePayroll({\n request: {\n companyId,\n payrollId,\n sortBy,\n requestBody: {\n employeeUuids,\n },\n },\n })\n setPreparedPayroll(result.payrollPrepared)\n if (result.payrollPrepared) {\n hasInitialDataRef.current = true\n onDataReady?.(result.payrollPrepared)\n }\n }, [companyId, payrollId, preparePayroll, employeeUuidsKey, sortBy, onDataReady])\n\n const handlePreparePayroll = useCallback(async () => {\n await baseSubmitHandler(null, () =>\n retryAsync(executePrepare, {\n maxAttempts: PREPARE_MAX_ATTEMPTS,\n delayMs: PREPARE_RETRY_DELAY_MS,\n shouldRetry: isPayrollBeingProcessedError,\n }),\n )\n }, [baseSubmitHandler, executePrepare])\n\n useEffect(() => {\n if (hasFiredRef.current) return\n hasFiredRef.current = true\n void handlePreparePayroll()\n }, [handlePreparePayroll])\n\n const isInitialLoading = isPreparePayrollPending && !hasInitialDataRef.current\n const isPaginating = isPreparePayrollPending && hasInitialDataRef.current\n const isLoading = isInitialLoading || isPayScheduleLoading\n\n return {\n handlePreparePayroll,\n preparedPayroll,\n paySchedule: payScheduleData?.payScheduleObject,\n isLoading,\n isPaginating,\n hasInitialData: hasInitialDataRef.current,\n }\n}\n"],"names":["PREPARE_MAX_ATTEMPTS","PREPARE_RETRY_DELAY_MS","isPayrollBeingProcessedError","error","UnprocessableEntityErrorObject","e","usePreparedPayrollData","companyId","payrollId","employeeUuids","sortBy","onDataReady","preparePayroll","isPreparePayrollPending","usePayrollsPrepareMutation","preparedPayroll","setPreparedPayroll","useState","hasInitialDataRef","useRef","hasFiredRef","baseSubmitHandler","useBase","employeeUuidsKey","useMemo","payScheduleData","isPayScheduleLoading","usePaySchedulesGet","executePrepare","useCallback","result","handlePreparePayroll","retryAsync","useEffect","isInitialLoading","isPaginating","isLoading"],"mappings":";;;;;;;;;;;;;;;;;AA2BA,MAAMA,IAAuB,GACvBC,IAAyB,MAEzBC,IAA+B,CAACC,MAC9BA,aAAiBC,IAChB,MAAM,QAAQD,EAAM,MAAM,KAAKA,EAAM,OAAO,KAAK,CAAAE,MAAKA,EAAE,aAAa,mBAAmB,IADhC,IAIpDC,IAAyB,CAAC;AAAA,EACrC,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC;AACF,MAAkE;AAChE,QAAM,EAAE,aAAaC,GAAgB,WAAWC,EAAA,IAC9CC,EAAA,GACI,CAACC,GAAiBC,CAAkB,IAAIC,EAAA,GACxCC,IAAoBC,EAAO,EAAK,GAChCC,IAAcD,EAAO,EAAK,GAC1B,EAAE,mBAAAE,EAAA,IAAsBC,EAAA,GAExBC,IAAmBC,EAAQ,MAAMf,GAAe,KAAK,GAAG,KAAK,IAAI,CAACA,CAAa,CAAC,GAEhF,EAAE,MAAMgB,GAAiB,WAAWC,MAAyBC;AAAA,IACjE;AAAA,MACE,WAAApB;AAAA,MACA,eAAeQ,GAAiB,WAAW,mBAAmB;AAAA,IAAA;AAAA,IAEhE;AAAA,MACE,SAAS,CAAC,CAACA,GAAiB,WAAW;AAAA,IAAA;AAAA,EACzC,GAGIa,IAAiBC,EAAY,YAAY;AAC7C,UAAMC,IAAS,MAAMlB,EAAe;AAAA,MAClC,SAAS;AAAA,QACP,WAAAL;AAAA,QACA,WAAAC;AAAA,QACA,QAAAE;AAAA,QACA,aAAa;AAAA,UACX,eAAAD;AAAA,QAAA;AAAA,MACF;AAAA,IACF,CACD;AACD,IAAAO,EAAmBc,EAAO,eAAe,GACrCA,EAAO,oBACTZ,EAAkB,UAAU,IAC5BP,IAAcmB,EAAO,eAAe;AAAA,EAExC,GAAG,CAACvB,GAAWC,GAAWI,GAAgBW,GAAkBb,GAAQC,CAAW,CAAC,GAE1EoB,IAAuBF,EAAY,YAAY;AACnD,UAAMR;AAAA,MAAkB;AAAA,MAAM,MAC5BW,EAAWJ,GAAgB;AAAA,QACzB,aAAa5B;AAAA,QACb,SAASC;AAAA,QACT,aAAaC;AAAA,MAAA,CACd;AAAA,IAAA;AAAA,EAEL,GAAG,CAACmB,GAAmBO,CAAc,CAAC;AAEtC,EAAAK,EAAU,MAAM;AACd,IAAIb,EAAY,YAChBA,EAAY,UAAU,IACjBW,EAAA;AAAA,EACP,GAAG,CAACA,CAAoB,CAAC;AAEzB,QAAMG,IAAmBrB,KAA2B,CAACK,EAAkB,SACjEiB,IAAetB,KAA2BK,EAAkB,SAC5DkB,IAAYF,KAAoBR;AAEtC,SAAO;AAAA,IACL,sBAAAK;AAAA,IACA,iBAAAhB;AAAA,IACA,aAAaU,GAAiB;AAAA,IAC9B,WAAAW;AAAA,IACA,cAAAD;AAAA,IACA,gBAAgBjB,EAAkB;AAAA,EAAA;AAEtC;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useHookFieldResolution as
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { useHookFieldResolution as u } from "../useHookFieldResolution.js";
|
|
3
|
+
import "../../../../shared/constants.js";
|
|
4
|
+
import { CheckboxField as f } from "../../../Common/Fields/CheckboxField/CheckboxField.js";
|
|
5
|
+
function x({
|
|
5
6
|
name: o,
|
|
6
7
|
formHookResult: i,
|
|
7
8
|
label: r,
|
|
@@ -9,13 +10,13 @@ function p({
|
|
|
9
10
|
validationMessages: s,
|
|
10
11
|
FieldComponent: d
|
|
11
12
|
}) {
|
|
12
|
-
const { metadata: l, control: a, errorMessage: c } =
|
|
13
|
+
const { metadata: l, control: a, errorMessage: c } = u(
|
|
13
14
|
o,
|
|
14
15
|
i,
|
|
15
16
|
s
|
|
16
17
|
), e = l[o];
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
-
|
|
18
|
+
return /* @__PURE__ */ m(
|
|
19
|
+
f,
|
|
19
20
|
{
|
|
20
21
|
name: o,
|
|
21
22
|
control: a,
|
|
@@ -29,6 +30,6 @@ function p({
|
|
|
29
30
|
);
|
|
30
31
|
}
|
|
31
32
|
export {
|
|
32
|
-
|
|
33
|
+
x as CheckboxHookField
|
|
33
34
|
};
|
|
34
35
|
//# sourceMappingURL=CheckboxHookField.js.map
|
|
@@ -1 +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 type { BaseFormHookReady } from '../../types'\nimport { useHookFieldResolution } from '../useHookFieldResolution'\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 formHookResult?: BaseFormHookReady\n validationMessages?: ValidationMessages<TErrorCode>\n FieldComponent?: ComponentType<CheckboxProps>\n}\n\nexport function CheckboxHookField<TErrorCode extends string>({\n name,\n formHookResult,\n label,\n description,\n validationMessages,\n FieldComponent,\n}: CheckboxHookFieldProps<TErrorCode>) {\n const { metadata, control, errorMessage } = useHookFieldResolution(\n name,\n formHookResult,\n validationMessages,\n )\n const fieldMetadata = metadata[name]\n\n return (\n <CheckboxField\n name={name}\n control={control}\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","formHookResult","label","description","validationMessages","FieldComponent","metadata","control","errorMessage","useHookFieldResolution","fieldMetadata","jsx","CheckboxField"],"mappings":"
|
|
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 type { BaseFormHookReady } from '../../types'\nimport { useHookFieldResolution } from '../useHookFieldResolution'\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 formHookResult?: BaseFormHookReady\n validationMessages?: ValidationMessages<TErrorCode>\n FieldComponent?: ComponentType<CheckboxProps>\n}\n\nexport function CheckboxHookField<TErrorCode extends string>({\n name,\n formHookResult,\n label,\n description,\n validationMessages,\n FieldComponent,\n}: CheckboxHookFieldProps<TErrorCode>) {\n const { metadata, control, errorMessage } = useHookFieldResolution(\n name,\n formHookResult,\n validationMessages,\n )\n const fieldMetadata = metadata[name]\n\n return (\n <CheckboxField\n name={name}\n control={control}\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","formHookResult","label","description","validationMessages","FieldComponent","metadata","control","errorMessage","useHookFieldResolution","fieldMetadata","jsx","CheckboxField"],"mappings":";;;;AAcO,SAASA,EAA6C;AAAA,EAC3D,MAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,gBAAAC;AACF,GAAuC;AACrC,QAAM,EAAE,UAAAC,GAAU,SAAAC,GAAS,cAAAC,EAAA,IAAiBC;AAAA,IAC1CT;AAAA,IACAC;AAAA,IACAG;AAAA,EAAA,GAEIM,IAAgBJ,EAASN,CAAI;AAEnC,SACE,gBAAAW;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,MAAAZ;AAAA,MACA,SAAAO;AAAA,MACA,OAAAL;AAAA,MACA,aAAAC;AAAA,MACA,cAAAK;AAAA,MACA,YAAYE,GAAe;AAAA,MAC3B,YAAYA,GAAe;AAAA,MAC3B,gBAAAL;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as f } from "react/jsx-runtime";
|
|
2
2
|
import { useHookFieldResolution as b } from "../useHookFieldResolution.js";
|
|
3
|
+
import "../../../../shared/constants.js";
|
|
3
4
|
import { NumberInputField as c } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
|
|
4
|
-
function
|
|
5
|
-
name:
|
|
5
|
+
function x({
|
|
6
|
+
name: o,
|
|
6
7
|
formHookResult: i,
|
|
7
8
|
label: r,
|
|
8
9
|
description: t,
|
|
@@ -10,31 +11,31 @@ function q({
|
|
|
10
11
|
min: d,
|
|
11
12
|
max: u,
|
|
12
13
|
validationMessages: l,
|
|
13
|
-
FieldComponent:
|
|
14
|
+
FieldComponent: m
|
|
14
15
|
}) {
|
|
15
|
-
const { metadata:
|
|
16
|
-
|
|
16
|
+
const { metadata: a, control: n, errorMessage: p } = b(
|
|
17
|
+
o,
|
|
17
18
|
i,
|
|
18
19
|
l
|
|
19
|
-
),
|
|
20
|
+
), e = a[o];
|
|
20
21
|
return /* @__PURE__ */ f(
|
|
21
22
|
c,
|
|
22
23
|
{
|
|
23
|
-
name:
|
|
24
|
+
name: o,
|
|
24
25
|
control: n,
|
|
25
26
|
label: r,
|
|
26
27
|
description: t,
|
|
27
28
|
errorMessage: p,
|
|
28
|
-
isRequired:
|
|
29
|
-
isDisabled:
|
|
29
|
+
isRequired: e?.isRequired,
|
|
30
|
+
isDisabled: e?.isDisabled,
|
|
30
31
|
format: s,
|
|
31
32
|
min: d,
|
|
32
33
|
max: u,
|
|
33
|
-
FieldComponent:
|
|
34
|
+
FieldComponent: m
|
|
34
35
|
}
|
|
35
36
|
);
|
|
36
37
|
}
|
|
37
38
|
export {
|
|
38
|
-
|
|
39
|
+
x as NumberInputHookField
|
|
39
40
|
};
|
|
40
41
|
//# sourceMappingURL=NumberInputHookField.js.map
|
|
@@ -1 +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 type { BaseFormHookReady } from '../../types'\nimport { useHookFieldResolution } from '../useHookFieldResolution'\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 formHookResult?: BaseFormHookReady\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 formHookResult,\n label,\n description,\n format,\n min,\n max,\n validationMessages,\n FieldComponent,\n}: NumberInputHookFieldProps<TErrorCode>) {\n const { metadata, control, errorMessage } = useHookFieldResolution(\n name,\n formHookResult,\n validationMessages,\n )\n const fieldMetadata = metadata[name]\n\n return (\n <NumberInputField\n name={name}\n control={control}\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","formHookResult","label","description","format","min","max","validationMessages","FieldComponent","metadata","control","errorMessage","useHookFieldResolution","fieldMetadata","jsx","NumberInputField"],"mappings":"
|
|
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 type { BaseFormHookReady } from '../../types'\nimport { useHookFieldResolution } from '../useHookFieldResolution'\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 formHookResult?: BaseFormHookReady\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 formHookResult,\n label,\n description,\n format,\n min,\n max,\n validationMessages,\n FieldComponent,\n}: NumberInputHookFieldProps<TErrorCode>) {\n const { metadata, control, errorMessage } = useHookFieldResolution(\n name,\n formHookResult,\n validationMessages,\n )\n const fieldMetadata = metadata[name]\n\n return (\n <NumberInputField\n name={name}\n control={control}\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","formHookResult","label","description","format","min","max","validationMessages","FieldComponent","metadata","control","errorMessage","useHookFieldResolution","fieldMetadata","jsx","NumberInputField"],"mappings":";;;;AAmBO,SAASA,EAAgD;AAAA,EAC9D,MAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,QAAAC;AAAA,EACA,KAAAC;AAAA,EACA,KAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,gBAAAC;AACF,GAA0C;AACxC,QAAM,EAAE,UAAAC,GAAU,SAAAC,GAAS,cAAAC,EAAA,IAAiBC;AAAA,IAC1CZ;AAAA,IACAC;AAAA,IACAM;AAAA,EAAA,GAEIM,IAAgBJ,EAAST,CAAI;AAEnC,SACE,gBAAAc;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,MAAAf;AAAA,MACA,SAAAU;AAAA,MACA,OAAAR;AAAA,MACA,aAAAC;AAAA,MACA,cAAAQ;AAAA,MACA,YAAYE,GAAe;AAAA,MAC3B,YAAYA,GAAe;AAAA,MAC3B,QAAAT;AAAA,MACA,KAAAC;AAAA,MACA,KAAAC;AAAA,MACA,gBAAAE;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as R } from "react/jsx-runtime";
|
|
2
2
|
import { useHookFieldResolution as F } from "../useHookFieldResolution.js";
|
|
3
3
|
import { getFieldWithOptions as b } from "../getFieldWithOptions.js";
|
|
4
|
+
import "../../../../shared/constants.js";
|
|
4
5
|
import { RadioGroupField as k } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
5
|
-
function
|
|
6
|
+
function H({
|
|
6
7
|
name: i,
|
|
7
8
|
formHookResult: r,
|
|
8
9
|
label: s,
|
|
@@ -35,6 +36,6 @@ function G({
|
|
|
35
36
|
);
|
|
36
37
|
}
|
|
37
38
|
export {
|
|
38
|
-
|
|
39
|
+
H as RadioGroupHookField
|
|
39
40
|
};
|
|
40
41
|
//# sourceMappingURL=RadioGroupHookField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroupHookField.js","sources":["../../../../../src/components/UNSTABLE_Hooks/form/fields/RadioGroupHookField.tsx"],"sourcesContent":["import type { ComponentType } from 'react'\nimport type { BaseFieldProps, ValidationMessages } from '../types'\nimport type { BaseFormHookReady } from '../../types'\nimport { useHookFieldResolution } from '../useHookFieldResolution'\nimport { getFieldWithOptions } from '../getFieldWithOptions'\nimport { RadioGroupField } from '@/components/Common'\nimport type { RadioGroupProps } from '@/components/Common/UI/RadioGroup/RadioGroupTypes'\n\nexport interface RadioGroupHookFieldProps<\n TErrorCode extends string = never,\n TEntry = unknown,\n> extends BaseFieldProps {\n name: string\n formHookResult?: BaseFormHookReady\n validationMessages?: ValidationMessages<TErrorCode>\n getOptionLabel?: (entry: TEntry) => string\n FieldComponent?: ComponentType<RadioGroupProps>\n}\n\nexport function RadioGroupHookField<TErrorCode extends string, TEntry = unknown>({\n name,\n formHookResult,\n label,\n description,\n validationMessages,\n getOptionLabel,\n FieldComponent,\n}: RadioGroupHookFieldProps<TErrorCode, TEntry>) {\n const { metadata, control, errorMessage } = useHookFieldResolution(\n name,\n formHookResult,\n validationMessages,\n )\n const fieldMetadata = getFieldWithOptions<TEntry>(metadata, name)\n\n const defaultOptions = fieldMetadata?.options ?? []\n const options =\n getOptionLabel && fieldMetadata?.entries\n ? fieldMetadata.entries.map((entry, index) => ({\n value: defaultOptions[index]?.value ?? '',\n label: getOptionLabel(entry),\n }))\n : defaultOptions\n\n return (\n <RadioGroupField\n name={name}\n control={control}\n label={label}\n description={description}\n errorMessage={errorMessage}\n isRequired={fieldMetadata?.isRequired}\n isDisabled={fieldMetadata?.isDisabled}\n options={options}\n FieldComponent={FieldComponent}\n />\n )\n}\n"],"names":["RadioGroupHookField","name","formHookResult","label","description","validationMessages","getOptionLabel","FieldComponent","metadata","control","errorMessage","useHookFieldResolution","fieldMetadata","getFieldWithOptions","defaultOptions","options","entry","index","jsx","RadioGroupField"],"mappings":"
|
|
1
|
+
{"version":3,"file":"RadioGroupHookField.js","sources":["../../../../../src/components/UNSTABLE_Hooks/form/fields/RadioGroupHookField.tsx"],"sourcesContent":["import type { ComponentType } from 'react'\nimport type { BaseFieldProps, ValidationMessages } from '../types'\nimport type { BaseFormHookReady } from '../../types'\nimport { useHookFieldResolution } from '../useHookFieldResolution'\nimport { getFieldWithOptions } from '../getFieldWithOptions'\nimport { RadioGroupField } from '@/components/Common'\nimport type { RadioGroupProps } from '@/components/Common/UI/RadioGroup/RadioGroupTypes'\n\nexport interface RadioGroupHookFieldProps<\n TErrorCode extends string = never,\n TEntry = unknown,\n> extends BaseFieldProps {\n name: string\n formHookResult?: BaseFormHookReady\n validationMessages?: ValidationMessages<TErrorCode>\n getOptionLabel?: (entry: TEntry) => string\n FieldComponent?: ComponentType<RadioGroupProps>\n}\n\nexport function RadioGroupHookField<TErrorCode extends string, TEntry = unknown>({\n name,\n formHookResult,\n label,\n description,\n validationMessages,\n getOptionLabel,\n FieldComponent,\n}: RadioGroupHookFieldProps<TErrorCode, TEntry>) {\n const { metadata, control, errorMessage } = useHookFieldResolution(\n name,\n formHookResult,\n validationMessages,\n )\n const fieldMetadata = getFieldWithOptions<TEntry>(metadata, name)\n\n const defaultOptions = fieldMetadata?.options ?? []\n const options =\n getOptionLabel && fieldMetadata?.entries\n ? fieldMetadata.entries.map((entry, index) => ({\n value: defaultOptions[index]?.value ?? '',\n label: getOptionLabel(entry),\n }))\n : defaultOptions\n\n return (\n <RadioGroupField\n name={name}\n control={control}\n label={label}\n description={description}\n errorMessage={errorMessage}\n isRequired={fieldMetadata?.isRequired}\n isDisabled={fieldMetadata?.isDisabled}\n options={options}\n FieldComponent={FieldComponent}\n />\n )\n}\n"],"names":["RadioGroupHookField","name","formHookResult","label","description","validationMessages","getOptionLabel","FieldComponent","metadata","control","errorMessage","useHookFieldResolution","fieldMetadata","getFieldWithOptions","defaultOptions","options","entry","index","jsx","RadioGroupField"],"mappings":";;;;;AAmBO,SAASA,EAAiE;AAAA,EAC/E,MAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,gBAAAC;AACF,GAAiD;AAC/C,QAAM,EAAE,UAAAC,GAAU,SAAAC,GAAS,cAAAC,EAAA,IAAiBC;AAAA,IAC1CV;AAAA,IACAC;AAAA,IACAG;AAAA,EAAA,GAEIO,IAAgBC,EAA4BL,GAAUP,CAAI,GAE1Da,IAAiBF,GAAe,WAAW,CAAA,GAC3CG,IACJT,KAAkBM,GAAe,UAC7BA,EAAc,QAAQ,IAAI,CAACI,GAAOC,OAAW;AAAA,IAC3C,OAAOH,EAAeG,CAAK,GAAG,SAAS;AAAA,IACvC,OAAOX,EAAeU,CAAK;AAAA,EAAA,EAC3B,IACFF;AAEN,SACE,gBAAAI;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,MAAAlB;AAAA,MACA,SAAAQ;AAAA,MACA,OAAAN;AAAA,MACA,aAAAC;AAAA,MACA,cAAAM;AAAA,MACA,YAAYE,GAAe;AAAA,MAC3B,YAAYA,GAAe;AAAA,MAC3B,SAAAG;AAAA,MACA,gBAAAR;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as F } from "react/jsx-runtime";
|
|
2
2
|
import { useHookFieldResolution as R } from "../useHookFieldResolution.js";
|
|
3
3
|
import { getFieldWithOptions as b } from "../getFieldWithOptions.js";
|
|
4
|
+
import "../../../../shared/constants.js";
|
|
4
5
|
import { SelectField as k } from "../../../Common/Fields/SelectField/SelectField.js";
|
|
5
|
-
function
|
|
6
|
+
function M({
|
|
6
7
|
name: o,
|
|
7
8
|
formHookResult: s,
|
|
8
9
|
label: r,
|
|
@@ -11,13 +12,13 @@ function H({
|
|
|
11
12
|
getOptionLabel: t,
|
|
12
13
|
FieldComponent: n
|
|
13
14
|
}) {
|
|
14
|
-
const { metadata: a, control: p, errorMessage:
|
|
15
|
+
const { metadata: a, control: p, errorMessage: m } = R(
|
|
15
16
|
o,
|
|
16
17
|
s,
|
|
17
18
|
d
|
|
18
|
-
), e = b(a, o), i = e?.options ?? [],
|
|
19
|
+
), e = b(a, o), i = e?.options ?? [], u = t && e?.entries ? e.entries.map((c, f) => ({
|
|
19
20
|
value: i[f]?.value ?? "",
|
|
20
|
-
label: t(
|
|
21
|
+
label: t(c)
|
|
21
22
|
})) : i;
|
|
22
23
|
return /* @__PURE__ */ F(
|
|
23
24
|
k,
|
|
@@ -26,15 +27,15 @@ function H({
|
|
|
26
27
|
control: p,
|
|
27
28
|
label: r,
|
|
28
29
|
description: l,
|
|
29
|
-
errorMessage:
|
|
30
|
+
errorMessage: m,
|
|
30
31
|
isRequired: e?.isRequired,
|
|
31
32
|
isDisabled: e?.isDisabled,
|
|
32
|
-
options:
|
|
33
|
+
options: u,
|
|
33
34
|
FieldComponent: n
|
|
34
35
|
}
|
|
35
36
|
);
|
|
36
37
|
}
|
|
37
38
|
export {
|
|
38
|
-
|
|
39
|
+
M as SelectHookField
|
|
39
40
|
};
|
|
40
41
|
//# sourceMappingURL=SelectHookField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectHookField.js","sources":["../../../../../src/components/UNSTABLE_Hooks/form/fields/SelectHookField.tsx"],"sourcesContent":["import type { ComponentType } from 'react'\nimport type { BaseFieldProps, ValidationMessages } from '../types'\nimport type { BaseFormHookReady } from '../../types'\nimport { useHookFieldResolution } from '../useHookFieldResolution'\nimport { getFieldWithOptions } from '../getFieldWithOptions'\nimport { SelectField } from '@/components/Common'\nimport type { SelectProps } from '@/components/Common/UI/Select/SelectTypes'\n\nexport interface SelectHookFieldProps<\n TErrorCode extends string = never,\n TEntry = unknown,\n> extends BaseFieldProps {\n name: string\n formHookResult?: BaseFormHookReady\n validationMessages?: ValidationMessages<TErrorCode>\n getOptionLabel?: (entry: TEntry) => string\n FieldComponent?: ComponentType<SelectProps>\n}\n\nexport function SelectHookField<TErrorCode extends string, TEntry = unknown>({\n name,\n formHookResult,\n label,\n description,\n validationMessages,\n getOptionLabel,\n FieldComponent,\n}: SelectHookFieldProps<TErrorCode, TEntry>) {\n const { metadata, control, errorMessage } = useHookFieldResolution(\n name,\n formHookResult,\n validationMessages,\n )\n const fieldMetadata = getFieldWithOptions<TEntry>(metadata, name)\n\n const defaultOptions = fieldMetadata?.options ?? []\n const options =\n getOptionLabel && fieldMetadata?.entries\n ? fieldMetadata.entries.map((entry, index) => ({\n value: defaultOptions[index]?.value ?? '',\n label: getOptionLabel(entry),\n }))\n : defaultOptions\n\n return (\n <SelectField\n name={name}\n control={control}\n label={label}\n description={description}\n errorMessage={errorMessage}\n isRequired={fieldMetadata?.isRequired}\n isDisabled={fieldMetadata?.isDisabled}\n options={options}\n FieldComponent={FieldComponent}\n />\n )\n}\n"],"names":["SelectHookField","name","formHookResult","label","description","validationMessages","getOptionLabel","FieldComponent","metadata","control","errorMessage","useHookFieldResolution","fieldMetadata","getFieldWithOptions","defaultOptions","options","entry","index","jsx","SelectField"],"mappings":"
|
|
1
|
+
{"version":3,"file":"SelectHookField.js","sources":["../../../../../src/components/UNSTABLE_Hooks/form/fields/SelectHookField.tsx"],"sourcesContent":["import type { ComponentType } from 'react'\nimport type { BaseFieldProps, ValidationMessages } from '../types'\nimport type { BaseFormHookReady } from '../../types'\nimport { useHookFieldResolution } from '../useHookFieldResolution'\nimport { getFieldWithOptions } from '../getFieldWithOptions'\nimport { SelectField } from '@/components/Common'\nimport type { SelectProps } from '@/components/Common/UI/Select/SelectTypes'\n\nexport interface SelectHookFieldProps<\n TErrorCode extends string = never,\n TEntry = unknown,\n> extends BaseFieldProps {\n name: string\n formHookResult?: BaseFormHookReady\n validationMessages?: ValidationMessages<TErrorCode>\n getOptionLabel?: (entry: TEntry) => string\n FieldComponent?: ComponentType<SelectProps>\n}\n\nexport function SelectHookField<TErrorCode extends string, TEntry = unknown>({\n name,\n formHookResult,\n label,\n description,\n validationMessages,\n getOptionLabel,\n FieldComponent,\n}: SelectHookFieldProps<TErrorCode, TEntry>) {\n const { metadata, control, errorMessage } = useHookFieldResolution(\n name,\n formHookResult,\n validationMessages,\n )\n const fieldMetadata = getFieldWithOptions<TEntry>(metadata, name)\n\n const defaultOptions = fieldMetadata?.options ?? []\n const options =\n getOptionLabel && fieldMetadata?.entries\n ? fieldMetadata.entries.map((entry, index) => ({\n value: defaultOptions[index]?.value ?? '',\n label: getOptionLabel(entry),\n }))\n : defaultOptions\n\n return (\n <SelectField\n name={name}\n control={control}\n label={label}\n description={description}\n errorMessage={errorMessage}\n isRequired={fieldMetadata?.isRequired}\n isDisabled={fieldMetadata?.isDisabled}\n options={options}\n FieldComponent={FieldComponent}\n />\n )\n}\n"],"names":["SelectHookField","name","formHookResult","label","description","validationMessages","getOptionLabel","FieldComponent","metadata","control","errorMessage","useHookFieldResolution","fieldMetadata","getFieldWithOptions","defaultOptions","options","entry","index","jsx","SelectField"],"mappings":";;;;;AAmBO,SAASA,EAA6D;AAAA,EAC3E,MAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,gBAAAC;AACF,GAA6C;AAC3C,QAAM,EAAE,UAAAC,GAAU,SAAAC,GAAS,cAAAC,EAAA,IAAiBC;AAAA,IAC1CV;AAAA,IACAC;AAAA,IACAG;AAAA,EAAA,GAEIO,IAAgBC,EAA4BL,GAAUP,CAAI,GAE1Da,IAAiBF,GAAe,WAAW,CAAA,GAC3CG,IACJT,KAAkBM,GAAe,UAC7BA,EAAc,QAAQ,IAAI,CAACI,GAAOC,OAAW;AAAA,IAC3C,OAAOH,EAAeG,CAAK,GAAG,SAAS;AAAA,IACvC,OAAOX,EAAeU,CAAK;AAAA,EAAA,EAC3B,IACFF;AAEN,SACE,gBAAAI;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,MAAAlB;AAAA,MACA,SAAAQ;AAAA,MACA,OAAAN;AAAA,MACA,aAAAC;AAAA,MACA,cAAAM;AAAA,MACA,YAAYE,GAAe;AAAA,MAC3B,YAAYA,GAAe;AAAA,MAC3B,SAAAG;AAAA,MACA,gBAAAR;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|