@gusto/embedded-react-sdk 0.12.1 → 0.13.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 +139 -0
- package/dist/_virtual/dynamic-import-helper.js +1 -8
- package/dist/_virtual/dynamic-import-helper.js.map +1 -1
- package/dist/assets/icons/spinner_small.svg.js +10 -0
- package/dist/assets/icons/spinner_small.svg.js.map +1 -0
- package/dist/components/Base/Base.js +38 -36
- package/dist/components/Base/Base.js.map +1 -1
- package/dist/components/Base/useBase.d.ts +2 -0
- package/dist/components/Base/useBase.js.map +1 -1
- package/dist/components/Common/DataView/DataView.d.ts +2 -1
- package/dist/components/Common/DataView/DataView.js +20 -19
- package/dist/components/Common/DataView/DataView.js.map +1 -1
- package/dist/components/Common/DataView/useDataView.d.ts +3 -1
- package/dist/components/Common/DataView/useDataView.js +13 -11
- package/dist/components/Common/DataView/useDataView.js.map +1 -1
- package/dist/components/Common/EmptyData/EmptyData.module.scss.js +1 -1
- package/dist/components/Common/InlineSpinner/InlineSpinner.d.ts +6 -0
- package/dist/components/Common/InlineSpinner/InlineSpinner.js +25 -0
- package/dist/components/Common/InlineSpinner/InlineSpinner.js.map +1 -0
- package/dist/components/Common/InlineSpinner/InlineSpinner.module.scss.js +10 -0
- package/dist/components/Common/InlineSpinner/InlineSpinner.module.scss.js.map +1 -0
- package/dist/components/Common/InlineSpinner/index.d.ts +2 -0
- package/dist/components/Common/PaginationControl/PaginationControl.js +31 -28
- package/dist/components/Common/PaginationControl/PaginationControl.js.map +1 -1
- package/dist/components/Common/PaginationControl/PaginationControlTypes.d.ts +1 -0
- package/dist/components/Common/ReorderableList/DropZone.js +1 -1
- package/dist/components/Common/ReorderableList/DropZone.js.map +1 -1
- package/dist/components/Common/ReorderableList/ReorderableItem.js +1 -1
- package/dist/components/Common/ReorderableList/ReorderableItem.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureForm.js +8 -5
- package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormActions.js +13 -10
- package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormFields.js +13 -10
- package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
- package/dist/components/Common/UI/CalendarPreview/CalendarPreview.js +1 -1
- package/dist/components/Common/UI/DatePicker/DatePicker.js +1 -1
- package/dist/components/Common/UI/Table/Table.module.scss.js +1 -1
- package/dist/components/Common/hooks/useNumberFormatter.js +1 -1
- package/dist/components/Common/index.d.ts +1 -0
- package/dist/components/Company/AssignSignatory/AssignSignatory.js +8 -6
- package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +8 -6
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +10 -8
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +8 -7
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +14 -13
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/Schema.d.ts +2 -2
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +5 -8
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +8 -6
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +10 -9
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +11 -10
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +5 -8
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/TitleSelect.js +8 -7
- package/dist/components/Company/AssignSignatory/TitleSelect.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +7 -10
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccount.js +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +9 -8
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js +2 -2
- package/dist/components/Company/BankAccount/BankAccountForm/Form.js +11 -9
- package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +5 -8
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js +12 -10
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/BankAccountList.js +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +13 -11
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/BankAccountVerify.js +2 -2
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +6 -4
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +7 -5
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +14 -12
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +5 -8
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentSigner.js +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +11 -9
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +5 -8
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Actions.js +9 -7
- package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
- package/dist/components/Company/FederalTaxes/FederalTaxes.js +20 -18
- package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Form.js +6 -4
- package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +10 -13
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Actions.js +7 -5
- package/dist/components/Company/Industry/Actions.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +8 -11
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Industry/Edit.js +12 -10
- package/dist/components/Company/Industry/Edit.js.map +1 -1
- package/dist/components/Company/Industry/Industry.js +2 -2
- package/dist/components/Company/Locations/LocationForm/Actions.js +8 -6
- package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Form.js +6 -5
- package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/LocationForm.js +16 -14
- package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +5 -8
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/Actions.js +8 -6
- package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/List.js +4 -2
- package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/LocationsList.js +15 -13
- package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +5 -8
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/Completed.js +14 -12
- package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/MissingRequirements.js +8 -6
- package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +5 -3
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +5 -8
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js +40 -38
- package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Actions.js +12 -10
- package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Edit.js +17 -16
- package/dist/components/Company/PaySchedule/_parts/Edit.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Head.js +8 -6
- package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/List.js +15 -13
- package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
- package/dist/components/Company/PaySchedule/usePaySchedule.js +8 -11
- package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +7 -5
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +3 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +5 -8
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +8 -6
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js +7 -5
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.js +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +5 -8
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Contractor/Address/Address.js +10 -8
- package/dist/components/Contractor/Address/Address.js.map +1 -1
- package/dist/components/Contractor/Address/Form.js +4 -3
- package/dist/components/Contractor/Address/Form.js.map +1 -1
- package/dist/components/Contractor/Address/useAddress.js +7 -10
- package/dist/components/Contractor/Address/useAddress.js.map +1 -1
- package/dist/components/Contractor/ContractorList/index.js +26 -25
- package/dist/components/Contractor/ContractorList/index.js.map +1 -1
- package/dist/components/Contractor/ContractorList/useContractorList.js +1 -1
- package/dist/components/Contractor/NewHireReport/NewHireReport.js +58 -55
- package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
- package/dist/components/Contractor/NewHireReport/types.d.ts +1 -0
- package/dist/components/Contractor/OnboardingFlow/OnboardingFlowComponents.js +19 -12
- package/dist/components/Contractor/OnboardingFlow/OnboardingFlowComponents.js.map +1 -1
- package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.js +6 -5
- package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +7 -5
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.d.ts +4 -4
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +87 -85
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +3 -2
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -1
- package/dist/components/Contractor/Profile/ContractorProfile.js +1 -1
- package/dist/components/Contractor/Profile/ContractorProfileForm.js +13 -13
- package/dist/components/Contractor/Profile/useContractorProfile.d.ts +19 -19
- package/dist/components/Contractor/Profile/useContractorProfile.js +37 -41
- package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
- package/dist/components/Contractor/Submit/Submit.js +28 -27
- package/dist/components/Contractor/Submit/Submit.js.map +1 -1
- package/dist/components/Employee/Compensation/Actions.js +6 -5
- package/dist/components/Employee/Compensation/Actions.js.map +1 -1
- package/dist/components/Employee/Compensation/Compensation.js +10 -10
- package/dist/components/Employee/Compensation/Compensation.js.map +1 -1
- package/dist/components/Employee/Compensation/Edit.js +15 -14
- package/dist/components/Employee/Compensation/Edit.js.map +1 -1
- package/dist/components/Employee/Compensation/List.js +25 -23
- package/dist/components/Employee/Compensation/List.js.map +1 -1
- package/dist/components/Employee/Compensation/useCompensation.js +1 -1
- package/dist/components/Employee/Compensation/useCompensation.js.map +1 -1
- package/dist/components/Employee/Deductions/Deductions.js +1 -1
- package/dist/components/Employee/Deductions/Deductions.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js +15 -14
- package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +10 -9
- package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js.map +1 -1
- package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.js +12 -11
- package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +8 -6
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +12 -10
- package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/List.js +4 -2
- package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +5 -8
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +16 -14
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +5 -8
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Employee/EmployeeList/Actions.js +6 -4
- package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
- package/dist/components/Employee/EmployeeList/EmployeeList.js +76 -62
- package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeList/Head.js +7 -5
- package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
- package/dist/components/Employee/EmployeeList/List.js +30 -27
- package/dist/components/Employee/EmployeeList/List.js.map +1 -1
- package/dist/components/Employee/EmployeeList/useEmployeeList.d.ts +1 -0
- package/dist/components/Employee/EmployeeList/useEmployeeList.js +5 -8
- package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/Actions.d.ts +1 -0
- package/dist/components/Employee/FederalTaxes/Actions.js +15 -0
- package/dist/components/Employee/FederalTaxes/Actions.js.map +1 -0
- package/dist/components/Employee/FederalTaxes/FederalForm.d.ts +29 -0
- package/dist/components/Employee/FederalTaxes/FederalForm.js +110 -0
- package/dist/components/Employee/FederalTaxes/FederalForm.js.map +1 -0
- package/dist/components/Employee/FederalTaxes/FederalTaxes.d.ts +6 -0
- package/dist/components/Employee/FederalTaxes/FederalTaxes.js +72 -0
- package/dist/components/Employee/FederalTaxes/FederalTaxes.js.map +1 -0
- package/dist/components/Employee/FederalTaxes/Head.d.ts +1 -0
- package/dist/components/Employee/FederalTaxes/Head.js +24 -0
- package/dist/components/Employee/FederalTaxes/Head.js.map +1 -0
- package/dist/components/Employee/FederalTaxes/index.d.ts +2 -0
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.d.ts +5 -0
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +17 -0
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -0
- package/dist/components/Employee/Landing/Landing.js +15 -14
- package/dist/components/Employee/Landing/Landing.js.map +1 -1
- package/dist/components/Employee/OnboardingFlow/OnboardingFlow.d.ts +1 -19
- package/dist/components/Employee/OnboardingFlow/OnboardingFlow.js.map +1 -1
- package/dist/components/Employee/OnboardingFlow/OnboardingFlowComponents.d.ts +22 -0
- package/dist/components/Employee/OnboardingFlow/OnboardingFlowComponents.js +18 -0
- package/dist/components/Employee/OnboardingFlow/OnboardingFlowComponents.js.map +1 -0
- package/dist/components/Employee/OnboardingFlow/onboardingStateMachine.d.ts +2 -1
- package/dist/components/Employee/OnboardingFlow/onboardingStateMachine.js +72 -63
- package/dist/components/Employee/OnboardingFlow/onboardingStateMachine.js.map +1 -1
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +9 -9
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/Actions.js +9 -7
- package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccount.d.ts +2 -2
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +6 -5
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js +10 -8
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js +8 -8
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +3 -2
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/Split.js +12 -11
- package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.d.ts +8 -8
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +11 -14
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/Actions.js +9 -7
- package/dist/components/Employee/Profile/Actions.js.map +1 -1
- package/dist/components/Employee/Profile/AdminPersonalDetails.d.ts +2 -2
- package/dist/components/Employee/Profile/AdminPersonalDetails.js +10 -9
- package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
- package/dist/components/Employee/Profile/HomeAddress.js +6 -5
- package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
- package/dist/components/Employee/Profile/PersonalDetailsInputs.d.ts +2 -2
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js +22 -21
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
- package/dist/components/Employee/Profile/Profile.js +15 -13
- package/dist/components/Employee/Profile/Profile.js.map +1 -1
- package/dist/components/Employee/Profile/useProfile.js +5 -8
- package/dist/components/Employee/Profile/useProfile.js.map +1 -1
- package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingComponents.d.ts +2 -1
- package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingComponents.js +37 -24
- package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingComponents.js.map +1 -1
- package/dist/components/Employee/SelfOnboardingFlow/selfOnboardingMachine.d.ts +2 -1
- package/dist/components/Employee/SelfOnboardingFlow/selfOnboardingMachine.js +31 -19
- package/dist/components/Employee/SelfOnboardingFlow/selfOnboardingMachine.js.map +1 -1
- package/dist/components/Employee/StateTaxes/Actions.d.ts +1 -0
- package/dist/components/Employee/StateTaxes/Actions.js +15 -0
- package/dist/components/Employee/StateTaxes/Actions.js.map +1 -0
- package/dist/components/Employee/StateTaxes/StateForm.d.ts +10 -0
- package/dist/components/Employee/StateTaxes/StateForm.js +34 -0
- package/dist/components/Employee/StateTaxes/StateForm.js.map +1 -0
- package/dist/components/Employee/StateTaxes/StateTaxes.d.ts +7 -0
- package/dist/components/Employee/StateTaxes/StateTaxes.js +90 -0
- package/dist/components/Employee/StateTaxes/StateTaxes.js.map +1 -0
- package/dist/components/Employee/StateTaxes/index.d.ts +2 -0
- package/dist/components/Employee/StateTaxes/useStateTaxes.d.ts +8 -0
- package/dist/components/Employee/StateTaxes/useStateTaxes.js +17 -0
- package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -0
- package/dist/components/Employee/Taxes/Actions.js +10 -8
- package/dist/components/Employee/Taxes/Actions.js.map +1 -1
- package/dist/components/Employee/Taxes/FederalForm.js +14 -12
- package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/Taxes/Taxes.d.ts +5 -0
- package/dist/components/Employee/Taxes/Taxes.js +73 -85
- package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
- package/dist/components/Employee/Taxes/useTaxes.js +5 -8
- package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
- package/dist/components/Employee/index.d.ts +3 -1
- package/dist/components/Employee/index.js +16 -12
- package/dist/components/Employee/index.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.d.ts +4 -2
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +75 -34
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +10 -5
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +118 -50
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +14 -11
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollList.d.ts +1 -1
- package/dist/components/Payroll/PayrollList/PayrollList.js +24 -11
- package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.d.ts +8 -6
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +36 -25
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +12 -9
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/RunPayrollFlow/RunPayroll.d.ts +2 -1
- package/dist/components/Payroll/RunPayrollFlow/RunPayroll.js +4 -4
- package/dist/components/Payroll/RunPayrollFlow/RunPayroll.js.map +1 -1
- package/dist/components/Payroll/helpers.d.ts +20 -0
- package/dist/components/Payroll/helpers.js +208 -0
- package/dist/components/Payroll/helpers.js.map +1 -0
- package/dist/components/Payroll/helpers.test.d.ts +1 -0
- package/dist/contexts/ApiProvider/ApiProvider.js +4 -4
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +8 -5
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/contexts/ThemeProvider/ThemeProvider.js +7 -7
- package/dist/contexts/ThemeProvider/ThemeProvider.js.map +1 -1
- package/dist/helpers/formattedStrings.d.ts +9 -0
- package/dist/helpers/formattedStrings.js +55 -16
- package/dist/helpers/formattedStrings.js.map +1 -1
- package/dist/i18n/I18n.js +11 -11
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Employee.FederalTaxes.json.js +46 -0
- package/dist/i18n/en/Employee.FederalTaxes.json.js.map +1 -0
- package/dist/i18n/en/Employee.StateTaxes.json.js +6 -10
- package/dist/i18n/en/Employee.StateTaxes.json.js.map +1 -1
- package/dist/i18n/en/Employee.Taxes.json.js +7 -7
- package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +30 -0
- package/dist/i18n/en/Payroll.PayrollConfiguration.json.js.map +1 -0
- package/dist/i18n/en/Payroll.PayrollList.json.js +14 -0
- package/dist/i18n/en/Payroll.PayrollList.json.js.map +1 -0
- package/dist/i18n/en/common.json.d.ts +8 -0
- package/dist/i18n/en/common.json.js +15 -13
- package/dist/i18n/en/common.json.js.map +1 -1
- package/dist/shared/constants.d.ts +4 -2
- package/dist/shared/constants.js +10 -9
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/i18next.d.ts +71 -4
- package/package.json +29 -30
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,144 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.13.0
|
|
4
|
+
|
|
5
|
+
### Features & Enhancements
|
|
6
|
+
|
|
7
|
+
- Infrastructural work to support eventual RunPayroll early access
|
|
8
|
+
|
|
9
|
+
## 0.12.3
|
|
10
|
+
|
|
11
|
+
### Features & Enhancements
|
|
12
|
+
|
|
13
|
+
- Separate `Employee.Taxes` into separate `Employee.StateTaxes` and `Employee.FederalTaxes` components and deprecate `Employee.Taxes` (See upgrade guide below)
|
|
14
|
+
- Add CTA (Call to Action) functionality to ProgressBar component
|
|
15
|
+
- Expose Payroll components as UNSTABLE for early access
|
|
16
|
+
- Add Payroll Submit API call functionality
|
|
17
|
+
|
|
18
|
+
### Fixes
|
|
19
|
+
|
|
20
|
+
- Fix documentation links ending with .md extension
|
|
21
|
+
|
|
22
|
+
### Chores & Maintenance
|
|
23
|
+
|
|
24
|
+
- Upgrade various development dependencies for improved stability
|
|
25
|
+
- Update embedded API to latest version
|
|
26
|
+
|
|
27
|
+
### Migrating `Employee.Taxes` to `Employee.StateTaxes` and `Employee.FederalTaxes`
|
|
28
|
+
|
|
29
|
+
We have split the `Employee.Taxes` component into dedicated `Employee.StateTaxes` and `Employee.FederalTaxes` components. The `Employee.Taxes` component is now deprecated and will be removed in a future version.
|
|
30
|
+
|
|
31
|
+
#### Component Usage
|
|
32
|
+
|
|
33
|
+
**Before (using combined Employee.Taxes):**
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
import { Employee } from '@gusto/embedded-react-sdk'
|
|
37
|
+
|
|
38
|
+
// In employee onboarding flow
|
|
39
|
+
<Employee.Taxes
|
|
40
|
+
employeeId="employee-id"
|
|
41
|
+
isAdmin
|
|
42
|
+
onEvent={(eventType) => {
|
|
43
|
+
if (eventType === componentEvents.EMPLOYEE_TAXES_DONE) {
|
|
44
|
+
// called when taxes is done
|
|
45
|
+
}
|
|
46
|
+
}}
|
|
47
|
+
/>
|
|
48
|
+
|
|
49
|
+
// In self-onboarding flow
|
|
50
|
+
<Employee.Taxes
|
|
51
|
+
employeeId="employee-id"
|
|
52
|
+
isAdmin={false}
|
|
53
|
+
onEvent={(eventType) => {
|
|
54
|
+
if (eventType === componentEvents.EMPLOYEE_TAXES_DONE) {
|
|
55
|
+
// called when taxes is done
|
|
56
|
+
}
|
|
57
|
+
}}
|
|
58
|
+
/>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**After (using separate components):**
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
import { Employee } from '@gusto/embedded-react-sdk'
|
|
65
|
+
|
|
66
|
+
// In employee onboarding flow - Federal Taxes step
|
|
67
|
+
<Employee.FederalTaxes
|
|
68
|
+
employeeId="employee-id"
|
|
69
|
+
onEvent={(eventType) => {
|
|
70
|
+
if (eventType === componentEvents.EMPLOYEE_FEDERAL_TAXES_DONE) {
|
|
71
|
+
// called when federal taxes is done
|
|
72
|
+
}
|
|
73
|
+
}}
|
|
74
|
+
/>
|
|
75
|
+
|
|
76
|
+
// In employee onboarding flow - State Taxes step
|
|
77
|
+
<Employee.StateTaxes
|
|
78
|
+
employeeId="employee-id"
|
|
79
|
+
isAdmin
|
|
80
|
+
onEvent={(eventType) => {
|
|
81
|
+
if (eventType === componentEvents.EMPLOYEE_STATE_TAXES_DONE) {
|
|
82
|
+
// called when state taxes is done
|
|
83
|
+
}
|
|
84
|
+
}}
|
|
85
|
+
/>
|
|
86
|
+
|
|
87
|
+
// In self-onboarding flow - Federal Taxes step
|
|
88
|
+
<Employee.FederalTaxes
|
|
89
|
+
employeeId="employee-id"
|
|
90
|
+
onEvent={(eventType) => {
|
|
91
|
+
if (eventType === componentEvents.EMPLOYEE_FEDERAL_TAXES_DONE) {
|
|
92
|
+
// called when federal taxes is done
|
|
93
|
+
}
|
|
94
|
+
}}
|
|
95
|
+
/>
|
|
96
|
+
|
|
97
|
+
// In self-onboarding flow - State Taxes step
|
|
98
|
+
<Employee.StateTaxes
|
|
99
|
+
employeeId="employee-id"
|
|
100
|
+
isAdmin={false}
|
|
101
|
+
onEvent={(eventType) => {
|
|
102
|
+
if (eventType === componentEvents.EMPLOYEE_STATE_TAXES_DONE) {
|
|
103
|
+
// called when state taxes is done
|
|
104
|
+
}
|
|
105
|
+
}}
|
|
106
|
+
/>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## 0.12.2
|
|
110
|
+
|
|
111
|
+
### Features & Enhancements
|
|
112
|
+
|
|
113
|
+
- Add CTA (Call to Action) functionality to ProgressBar component
|
|
114
|
+
- Expose Payroll components as UNSTABLE for early access
|
|
115
|
+
- Add Payroll Submit API call functionality
|
|
116
|
+
|
|
117
|
+
### Fixes
|
|
118
|
+
|
|
119
|
+
- Fix contractor payment details validation and display
|
|
120
|
+
- Fix contractor ID not being passed correctly from profile to submit
|
|
121
|
+
- Fix self onboarding switch with correct onboarding status
|
|
122
|
+
|
|
123
|
+
### Chores & Maintenance
|
|
124
|
+
|
|
125
|
+
- Upgrade react-i18next from 15.6.0 to 15.7.0
|
|
126
|
+
- Upgrade react-hook-form from 7.60.0 to 7.62.0
|
|
127
|
+
- Update embedded API to latest version
|
|
128
|
+
|
|
129
|
+
## 0.12.1
|
|
130
|
+
|
|
131
|
+
### Fixes
|
|
132
|
+
|
|
133
|
+
- Fix contractor payment details validation and display
|
|
134
|
+
- Fix contractor ID not being passed correctly from profile to submit
|
|
135
|
+
|
|
136
|
+
### Chores & Maintenance
|
|
137
|
+
|
|
138
|
+
- Upgrade react-i18next from 15.6.0 to 15.7.0
|
|
139
|
+
- Upgrade react-hook-form from 7.60.0 to 7.62.0
|
|
140
|
+
- Update embedded API to latest version
|
|
141
|
+
|
|
3
142
|
## 0.12.0
|
|
4
143
|
|
|
5
144
|
### Updated theming
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
const l = (r, n, t) => {
|
|
2
2
|
const e = r[n];
|
|
3
3
|
return e ? typeof e == "function" ? e() : Promise.resolve(e) : new Promise((i, o) => {
|
|
4
|
-
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
|
|
5
|
-
o.bind(
|
|
6
|
-
null,
|
|
7
|
-
new Error(
|
|
8
|
-
"Unknown variable dynamic import: " + n + (n.split("/").length !== t ? ". Note that variables only represent file names one level deep." : "")
|
|
9
|
-
)
|
|
10
|
-
)
|
|
11
|
-
);
|
|
4
|
+
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(o.bind(null, /* @__PURE__ */ new Error("Unknown variable dynamic import: " + n + (n.split("/").length !== t ? ". Note that variables only represent file names one level deep." : ""))));
|
|
12
5
|
});
|
|
13
6
|
};
|
|
14
7
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-import-helper.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dynamic-import-helper.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
const r = ({
|
|
3
|
+
title: l,
|
|
4
|
+
titleId: t,
|
|
5
|
+
...a
|
|
6
|
+
}) => /* @__PURE__ */ e.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", "aria-labelledby": t, ...a }, l ? /* @__PURE__ */ e.createElement("title", { id: t }, l) : null, /* @__PURE__ */ e.createElement("path", { d: "M12 22.5C12 21.6716 11.3234 21.0131 10.5063 20.8766C6.24662 20.1651 3 16.4617 3 12C3 7.02944 7.02944 3 12 3C16.4617 3 20.1651 6.24662 20.8766 10.5063C21.0131 11.3234 21.6716 12 22.5 12C23.3284 12 24.0098 11.3251 23.9075 10.503C23.1707 4.58207 18.1204 0 12 0C5.37258 0 0 5.37258 0 12C0 18.1205 4.58207 23.1707 10.503 23.9075C11.3251 24.0098 12 23.3284 12 22.5Z", fill: "currentColor" }));
|
|
7
|
+
export {
|
|
8
|
+
r as default
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=spinner_small.svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner_small.svg.js","sources":["../../../src/assets/icons/spinner_small.svg?react"],"sourcesContent":["import * as React from \"react\";\nconst SvgSpinnerSmall = ({\n title,\n titleId,\n ...props\n}) => /* @__PURE__ */ React.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", \"aria-labelledby\": titleId, ...props }, title ? /* @__PURE__ */ React.createElement(\"title\", { id: titleId }, title) : null, /* @__PURE__ */ React.createElement(\"path\", { d: \"M12 22.5C12 21.6716 11.3234 21.0131 10.5063 20.8766C6.24662 20.1651 3 16.4617 3 12C3 7.02944 7.02944 3 12 3C16.4617 3 20.1651 6.24662 20.8766 10.5063C21.0131 11.3234 21.6716 12 22.5 12C23.3284 12 24.0098 11.3251 23.9075 10.503C23.1707 4.58207 18.1204 0 12 0C5.37258 0 0 5.37258 0 12C0 18.1205 4.58207 23.1707 10.503 23.9075C11.3251 24.0098 12 23.3284 12 22.5Z\", fill: \"currentColor\" }));\nexport default SvgSpinnerSmall;\n"],"names":["SvgSpinnerSmall","title","titleId","props","React"],"mappings":";AACK,MAACA,IAAkB,CAAC;AAAA,EACvB,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,GAAGC;AACL,MAAsB,gBAAAC,EAAM,cAAc,OAAO,EAAE,OAAO,8BAA8B,OAAO,IAAI,QAAQ,IAAI,SAAS,aAAa,MAAM,QAAQ,mBAAmBF,GAAS,GAAGC,EAAK,GAAIF,IAAwB,gBAAAG,EAAM,cAAc,SAAS,EAAE,IAAIF,EAAO,GAAID,CAAK,IAAI,MAAsB,gBAAAG,EAAM,cAAc,QAAQ,EAAE,GAAG,2WAA2W,MAAM,gBAAgB,CAAC;"}
|
|
@@ -1,50 +1,51 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsx as o, jsxs as y } from "react/jsx-runtime";
|
|
2
|
+
import { useState as E, useCallback as g, Suspense as R } from "react";
|
|
3
3
|
import { ErrorBoundary as S } from "react-error-boundary";
|
|
4
4
|
import { useTranslation as B } from "react-i18next";
|
|
5
|
-
import { APIError as
|
|
6
|
-
import { SDKValidationError as
|
|
7
|
-
import { UnprocessableEntityErrorObject as
|
|
8
|
-
import { QueryErrorResetBoundary as T } from "
|
|
5
|
+
import { APIError as C } from "/home/runner/work/embedded-react-sdk/embedded-react-sdk/node_modules/@gusto/embedded-api/esm/models/errors/apierror.js";
|
|
6
|
+
import { SDKValidationError as h } from "/home/runner/work/embedded-react-sdk/embedded-react-sdk/node_modules/@gusto/embedded-api/esm/models/errors/sdkvalidationerror.js";
|
|
7
|
+
import { UnprocessableEntityErrorObject as k } from "/home/runner/work/embedded-react-sdk/embedded-react-sdk/node_modules/@gusto/embedded-api/esm/models/errors/unprocessableentityerrorobject.js";
|
|
8
|
+
import { QueryErrorResetBoundary as T } from "/home/runner/work/embedded-react-sdk/embedded-react-sdk/node_modules/@tanstack/react-query/build/modern/index.js";
|
|
9
9
|
import { FadeIn as _ } from "../Common/FadeIn/FadeIn.js";
|
|
10
10
|
import { BaseContext as j } from "./useBase.js";
|
|
11
11
|
import { componentEvents as F } from "../../shared/constants.js";
|
|
12
12
|
import { useAsyncError as K } from "../Common/hooks/useAsyncError.js";
|
|
13
|
+
import "classnames";
|
|
13
14
|
import { InternalError as P } from "../Common/InternalError/InternalError.js";
|
|
14
15
|
import { snakeCaseToCamelCase as w } from "../../helpers/formattedStrings.js";
|
|
15
16
|
import { useComponentContext as M } from "../../contexts/ComponentAdapter/useComponentContext.js";
|
|
16
17
|
import { useLoadingIndicator as O } from "../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
17
|
-
const U = (
|
|
18
|
+
const U = (t) => t.map((n) => n.message ? /* @__PURE__ */ o("li", { children: n.message }, n.key) : null), x = (t, n) => {
|
|
18
19
|
const m = n ? n + "." : "";
|
|
19
|
-
if (
|
|
20
|
+
if (t.category === "invalid_attribute_value" || t.category === "invalid_operation")
|
|
20
21
|
return [
|
|
21
22
|
{
|
|
22
|
-
key: w(m +
|
|
23
|
-
message:
|
|
23
|
+
key: w(m + t.errorKey),
|
|
24
|
+
message: t.message ?? ""
|
|
24
25
|
}
|
|
25
26
|
];
|
|
26
|
-
if (
|
|
27
|
-
let
|
|
28
|
-
return
|
|
27
|
+
if (t.category === "nested_errors" && t.errors !== void 0) {
|
|
28
|
+
let a = "";
|
|
29
|
+
return t.metadata?.key && typeof t.metadata.key == "string" ? a = t.metadata.key : t.metadata?.state && typeof t.metadata.state == "string" ? a = t.metadata.state : t.errorKey && (a = t.errorKey), t.errors.flatMap((r) => x(r, m + a));
|
|
29
30
|
}
|
|
30
31
|
return [];
|
|
31
|
-
},
|
|
32
|
-
children:
|
|
32
|
+
}, ot = ({
|
|
33
|
+
children: t,
|
|
33
34
|
FallbackComponent: n = P,
|
|
34
35
|
LoaderComponent: m,
|
|
35
|
-
onEvent:
|
|
36
|
+
onEvent: a
|
|
36
37
|
}) => {
|
|
37
|
-
const [r, l] =
|
|
38
|
-
l(
|
|
39
|
-
}, []),
|
|
40
|
-
l(
|
|
41
|
-
},
|
|
42
|
-
async (
|
|
38
|
+
const [r, l] = E(null), [c, f] = E(null), p = K(), { t: b } = B(), d = M(), { LoadingIndicator: I } = O(), u = m ?? I, v = g((e) => {
|
|
39
|
+
l(e), e || f(null);
|
|
40
|
+
}, []), L = (e) => {
|
|
41
|
+
l(e), e instanceof k && Array.isArray(e.errors) && f(e.errors.flatMap((s) => x(s)));
|
|
42
|
+
}, A = g(
|
|
43
|
+
async (e, s) => {
|
|
43
44
|
l(null), f(null);
|
|
44
45
|
try {
|
|
45
|
-
await
|
|
46
|
+
await s(e);
|
|
46
47
|
} catch (i) {
|
|
47
|
-
i instanceof
|
|
48
|
+
i instanceof C || i instanceof h || i instanceof k ? L(i) : p(i);
|
|
48
49
|
}
|
|
49
50
|
},
|
|
50
51
|
[l, p]
|
|
@@ -54,26 +55,27 @@ const U = (e) => e.map((n) => n.message ? /* @__PURE__ */ o("li", { children: n.
|
|
|
54
55
|
{
|
|
55
56
|
value: {
|
|
56
57
|
fieldErrors: c,
|
|
57
|
-
setError:
|
|
58
|
-
onEvent:
|
|
58
|
+
setError: v,
|
|
59
|
+
onEvent: a,
|
|
59
60
|
throwError: p,
|
|
60
|
-
baseSubmitHandler:
|
|
61
|
+
baseSubmitHandler: A,
|
|
62
|
+
LoadingIndicator: u
|
|
61
63
|
},
|
|
62
|
-
children: /* @__PURE__ */ o(T, { children: ({ reset:
|
|
64
|
+
children: /* @__PURE__ */ o(T, { children: ({ reset: e }) => /* @__PURE__ */ y(
|
|
63
65
|
S,
|
|
64
66
|
{
|
|
65
67
|
FallbackComponent: n,
|
|
66
|
-
onReset:
|
|
67
|
-
onError: (
|
|
68
|
-
|
|
68
|
+
onReset: e,
|
|
69
|
+
onError: (s) => {
|
|
70
|
+
a(F.ERROR, s);
|
|
69
71
|
},
|
|
70
72
|
children: [
|
|
71
|
-
(r || c) && /* @__PURE__ */
|
|
73
|
+
(r || c) && /* @__PURE__ */ y(d.Alert, { label: b("status.errorEncountered"), status: "error", children: [
|
|
72
74
|
c && /* @__PURE__ */ o(d.UnorderedList, { items: U(c) }),
|
|
73
|
-
r && r instanceof
|
|
74
|
-
r && r instanceof
|
|
75
|
+
r && r instanceof C && /* @__PURE__ */ o(d.Text, { children: r.message }),
|
|
76
|
+
r && r instanceof h && /* @__PURE__ */ o(d.Text, { as: "pre", children: r.pretty() })
|
|
75
77
|
] }),
|
|
76
|
-
/* @__PURE__ */ o(R, { fallback: /* @__PURE__ */ o(
|
|
78
|
+
/* @__PURE__ */ o(R, { fallback: /* @__PURE__ */ o(u, {}), children: /* @__PURE__ */ o(_, { children: t }) })
|
|
77
79
|
]
|
|
78
80
|
}
|
|
79
81
|
) })
|
|
@@ -81,6 +83,6 @@ const U = (e) => e.map((n) => n.message ? /* @__PURE__ */ o("li", { children: n.
|
|
|
81
83
|
);
|
|
82
84
|
};
|
|
83
85
|
export {
|
|
84
|
-
|
|
86
|
+
ot as BaseComponent
|
|
85
87
|
};
|
|
86
88
|
//# sourceMappingURL=Base.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Base.js","sources":["../../../src/components/Base/Base.tsx"],"sourcesContent":["import type { ReactNode, JSX } from 'react'\nimport { Suspense, useState, useCallback } from 'react'\nimport type { FallbackProps } from 'react-error-boundary'\nimport { ErrorBoundary } from 'react-error-boundary'\nimport { useTranslation } from 'react-i18next'\nimport { APIError } from '@gusto/embedded-api/models/errors/apierror'\nimport { SDKValidationError } from '@gusto/embedded-api/models/errors/sdkvalidationerror'\nimport { UnprocessableEntityErrorObject } from '@gusto/embedded-api/models/errors/unprocessableentityerrorobject'\nimport type { EntityErrorObject } from '@gusto/embedded-api/models/components/entityerrorobject'\nimport { QueryErrorResetBoundary } from '@tanstack/react-query'\nimport { FadeIn } from '../Common/FadeIn/FadeIn'\nimport { BaseContext, type FieldError, type KnownErrors, type OnEventType } from './useBase'\nimport { componentEvents, type EventType } from '@/shared/constants'\nimport { InternalError, useAsyncError } from '@/components/Common'\nimport { snakeCaseToCamelCase } from '@/helpers/formattedStrings'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport type { ResourceDictionary, Resources } from '@/types/Helpers'\nimport { useLoadingIndicator } from '@/contexts/LoadingIndicatorProvider/useLoadingIndicator'\nimport type { LoadingIndicatorContextProps } from '@/contexts/LoadingIndicatorProvider/useLoadingIndicator'\n\nexport interface CommonComponentInterface<TResourceKey extends keyof Resources = keyof Resources> {\n children?: ReactNode\n className?: string\n defaultValues?: unknown\n dictionary?: ResourceDictionary<TResourceKey>\n}\n\n// Base component wrapper with error and suspense handling\nexport interface BaseComponentInterface<TResourceKey extends keyof Resources = keyof Resources>\n extends CommonComponentInterface<TResourceKey> {\n FallbackComponent?: (props: FallbackProps) => JSX.Element\n LoaderComponent?: LoadingIndicatorContextProps['LoadingIndicator']\n onEvent: OnEventType<EventType, unknown>\n}\n\n/**Traverses errorList and finds items with message properties */\nconst renderErrorList = (errorList: FieldError[]): React.ReactNode[] => {\n return errorList.map(errorFromList => {\n if (errorFromList.message) {\n return <li key={errorFromList.key}>{errorFromList.message}</li>\n }\n return null\n })\n}\n/**Recuresively parses error list and constructs an array of objects containing attribute value error messages associated with form fields. Nested errors construct '.' separated keys\n * metadata.state is a special case for state taxes validation errors\n */\nconst getFieldErrors = (\n error: EntityErrorObject,\n parentKey?: string,\n): { key: string; message: string }[] => {\n const keyPrefix = parentKey ? parentKey + '.' : ''\n if (error.category === 'invalid_attribute_value' || error.category === 'invalid_operation') {\n return [\n {\n key: snakeCaseToCamelCase(keyPrefix + error.errorKey),\n message: error.message ?? '',\n },\n ]\n }\n if (error.category === 'nested_errors' && error.errors !== undefined) {\n //TODO: clean this up once Metadata type is fixed in openapi spec\n let keySuffix = ''\n //@ts-expect-error: Metadata in speakeasy is incorrectly typed\n if (error.metadata?.key && typeof error.metadata.key === 'string') {\n //@ts-expect-error: Metadata in speakeasy is incorrectly typed\n keySuffix = error.metadata.key as string\n //@ts-expect-error: Metadata in speakeasy is incorrectly typed\n } else if (error.metadata?.state && typeof error.metadata.state === 'string') {\n //@ts-expect-error: Metadata in speakeasy is incorrectly typed\n keySuffix = error.metadata.state as string\n } else if (error.errorKey) {\n keySuffix = error.errorKey\n }\n return error.errors.flatMap(err => getFieldErrors(err, keyPrefix + keySuffix))\n }\n return []\n}\n\ntype SubmitHandler<T> = (data: T) => Promise<void>\n\nexport const BaseComponent = <TResourceKey extends keyof Resources = keyof Resources>({\n children,\n FallbackComponent = InternalError,\n LoaderComponent: LoadingIndicatorFromProps,\n onEvent,\n}: BaseComponentInterface<TResourceKey>) => {\n const [error, setError] = useState<KnownErrors | null>(null)\n const [fieldErrors, setFieldErrors] = useState<FieldError[] | null>(null)\n const throwError = useAsyncError()\n const { t } = useTranslation()\n const Components = useComponentContext()\n\n const { LoadingIndicator: LoadingIndicatorFromContext } = useLoadingIndicator()\n\n const LoaderComponent = LoadingIndicatorFromProps ?? LoadingIndicatorFromContext\n\n // Enhanced setError that also clears fieldErrors when error is cleared\n const setErrorWithFieldsClear = useCallback((error: KnownErrors | null) => {\n setError(error)\n if (!error) {\n setFieldErrors(null)\n }\n }, [])\n\n const processError = (error: KnownErrors) => {\n setError(error)\n //422\tapplication/json - content relaited error\n if (error instanceof UnprocessableEntityErrorObject && Array.isArray(error.errors)) {\n setFieldErrors(error.errors.flatMap(err => getFieldErrors(err)))\n }\n }\n\n const baseSubmitHandler = useCallback(\n async <T,>(data: T, componentHandler: SubmitHandler<T>) => {\n setError(null)\n setFieldErrors(null)\n try {\n await componentHandler(data)\n } catch (err) {\n if (\n err instanceof APIError ||\n err instanceof SDKValidationError ||\n err instanceof UnprocessableEntityErrorObject\n ) {\n processError(err)\n } else throwError(err)\n }\n },\n [setError, throwError],\n )\n\n return (\n <BaseContext.Provider\n value={{\n fieldErrors,\n setError: setErrorWithFieldsClear,\n onEvent,\n throwError,\n baseSubmitHandler,\n }}\n >\n <QueryErrorResetBoundary>\n {({ reset: resetQueries }) => (\n <ErrorBoundary\n FallbackComponent={FallbackComponent}\n onReset={resetQueries}\n onError={err => {\n onEvent(componentEvents.ERROR, err)\n }}\n >\n {(error || fieldErrors) && (\n <Components.Alert label={t('status.errorEncountered')} status=\"error\">\n {fieldErrors && <Components.UnorderedList items={renderErrorList(fieldErrors)} />}\n {error && error instanceof APIError && (\n <Components.Text>{error.message}</Components.Text>\n )}\n {error && error instanceof SDKValidationError && (\n <Components.Text as=\"pre\">{error.pretty()}</Components.Text>\n )}\n </Components.Alert>\n )}\n <Suspense fallback={<LoaderComponent />}>\n <FadeIn>{children}</FadeIn>\n </Suspense>\n </ErrorBoundary>\n )}\n </QueryErrorResetBoundary>\n </BaseContext.Provider>\n )\n}\n"],"names":["renderErrorList","errorList","errorFromList","jsx","getFieldErrors","error","parentKey","keyPrefix","snakeCaseToCamelCase","keySuffix","err","BaseComponent","children","FallbackComponent","InternalError","LoadingIndicatorFromProps","onEvent","setError","useState","fieldErrors","setFieldErrors","throwError","useAsyncError","t","useTranslation","Components","useComponentContext","LoadingIndicatorFromContext","useLoadingIndicator","LoaderComponent","setErrorWithFieldsClear","useCallback","processError","UnprocessableEntityErrorObject","baseSubmitHandler","data","componentHandler","APIError","SDKValidationError","BaseContext","QueryErrorResetBoundary","resetQueries","jsxs","ErrorBoundary","componentEvents","Suspense","FadeIn"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"Base.js","sources":["../../../src/components/Base/Base.tsx"],"sourcesContent":["import type { ReactNode, JSX } from 'react'\nimport { Suspense, useState, useCallback } from 'react'\nimport type { FallbackProps } from 'react-error-boundary'\nimport { ErrorBoundary } from 'react-error-boundary'\nimport { useTranslation } from 'react-i18next'\nimport { APIError } from '@gusto/embedded-api/models/errors/apierror'\nimport { SDKValidationError } from '@gusto/embedded-api/models/errors/sdkvalidationerror'\nimport { UnprocessableEntityErrorObject } from '@gusto/embedded-api/models/errors/unprocessableentityerrorobject'\nimport type { EntityErrorObject } from '@gusto/embedded-api/models/components/entityerrorobject'\nimport { QueryErrorResetBoundary } from '@tanstack/react-query'\nimport { FadeIn } from '../Common/FadeIn/FadeIn'\nimport { BaseContext, type FieldError, type KnownErrors, type OnEventType } from './useBase'\nimport { componentEvents, type EventType } from '@/shared/constants'\nimport { InternalError, useAsyncError } from '@/components/Common'\nimport { snakeCaseToCamelCase } from '@/helpers/formattedStrings'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport type { ResourceDictionary, Resources } from '@/types/Helpers'\nimport { useLoadingIndicator } from '@/contexts/LoadingIndicatorProvider/useLoadingIndicator'\nimport type { LoadingIndicatorContextProps } from '@/contexts/LoadingIndicatorProvider/useLoadingIndicator'\n\nexport interface CommonComponentInterface<TResourceKey extends keyof Resources = keyof Resources> {\n children?: ReactNode\n className?: string\n defaultValues?: unknown\n dictionary?: ResourceDictionary<TResourceKey>\n}\n\n// Base component wrapper with error and suspense handling\nexport interface BaseComponentInterface<TResourceKey extends keyof Resources = keyof Resources>\n extends CommonComponentInterface<TResourceKey> {\n FallbackComponent?: (props: FallbackProps) => JSX.Element\n LoaderComponent?: LoadingIndicatorContextProps['LoadingIndicator']\n onEvent: OnEventType<EventType, unknown>\n}\n\n/**Traverses errorList and finds items with message properties */\nconst renderErrorList = (errorList: FieldError[]): React.ReactNode[] => {\n return errorList.map(errorFromList => {\n if (errorFromList.message) {\n return <li key={errorFromList.key}>{errorFromList.message}</li>\n }\n return null\n })\n}\n/**Recuresively parses error list and constructs an array of objects containing attribute value error messages associated with form fields. Nested errors construct '.' separated keys\n * metadata.state is a special case for state taxes validation errors\n */\nconst getFieldErrors = (\n error: EntityErrorObject,\n parentKey?: string,\n): { key: string; message: string }[] => {\n const keyPrefix = parentKey ? parentKey + '.' : ''\n if (error.category === 'invalid_attribute_value' || error.category === 'invalid_operation') {\n return [\n {\n key: snakeCaseToCamelCase(keyPrefix + error.errorKey),\n message: error.message ?? '',\n },\n ]\n }\n if (error.category === 'nested_errors' && error.errors !== undefined) {\n //TODO: clean this up once Metadata type is fixed in openapi spec\n let keySuffix = ''\n //@ts-expect-error: Metadata in speakeasy is incorrectly typed\n if (error.metadata?.key && typeof error.metadata.key === 'string') {\n //@ts-expect-error: Metadata in speakeasy is incorrectly typed\n keySuffix = error.metadata.key as string\n //@ts-expect-error: Metadata in speakeasy is incorrectly typed\n } else if (error.metadata?.state && typeof error.metadata.state === 'string') {\n //@ts-expect-error: Metadata in speakeasy is incorrectly typed\n keySuffix = error.metadata.state as string\n } else if (error.errorKey) {\n keySuffix = error.errorKey\n }\n return error.errors.flatMap(err => getFieldErrors(err, keyPrefix + keySuffix))\n }\n return []\n}\n\ntype SubmitHandler<T> = (data: T) => Promise<void>\n\nexport const BaseComponent = <TResourceKey extends keyof Resources = keyof Resources>({\n children,\n FallbackComponent = InternalError,\n LoaderComponent: LoadingIndicatorFromProps,\n onEvent,\n}: BaseComponentInterface<TResourceKey>) => {\n const [error, setError] = useState<KnownErrors | null>(null)\n const [fieldErrors, setFieldErrors] = useState<FieldError[] | null>(null)\n const throwError = useAsyncError()\n const { t } = useTranslation()\n const Components = useComponentContext()\n\n const { LoadingIndicator: LoadingIndicatorFromContext } = useLoadingIndicator()\n\n const LoaderComponent = LoadingIndicatorFromProps ?? LoadingIndicatorFromContext\n\n // Enhanced setError that also clears fieldErrors when error is cleared\n const setErrorWithFieldsClear = useCallback((error: KnownErrors | null) => {\n setError(error)\n if (!error) {\n setFieldErrors(null)\n }\n }, [])\n\n const processError = (error: KnownErrors) => {\n setError(error)\n //422\tapplication/json - content relaited error\n if (error instanceof UnprocessableEntityErrorObject && Array.isArray(error.errors)) {\n setFieldErrors(error.errors.flatMap(err => getFieldErrors(err)))\n }\n }\n\n const baseSubmitHandler = useCallback(\n async <T,>(data: T, componentHandler: SubmitHandler<T>) => {\n setError(null)\n setFieldErrors(null)\n try {\n await componentHandler(data)\n } catch (err) {\n if (\n err instanceof APIError ||\n err instanceof SDKValidationError ||\n err instanceof UnprocessableEntityErrorObject\n ) {\n processError(err)\n } else throwError(err)\n }\n },\n [setError, throwError],\n )\n\n return (\n <BaseContext.Provider\n value={{\n fieldErrors,\n setError: setErrorWithFieldsClear,\n onEvent,\n throwError,\n baseSubmitHandler,\n LoadingIndicator: LoaderComponent,\n }}\n >\n <QueryErrorResetBoundary>\n {({ reset: resetQueries }) => (\n <ErrorBoundary\n FallbackComponent={FallbackComponent}\n onReset={resetQueries}\n onError={err => {\n onEvent(componentEvents.ERROR, err)\n }}\n >\n {(error || fieldErrors) && (\n <Components.Alert label={t('status.errorEncountered')} status=\"error\">\n {fieldErrors && <Components.UnorderedList items={renderErrorList(fieldErrors)} />}\n {error && error instanceof APIError && (\n <Components.Text>{error.message}</Components.Text>\n )}\n {error && error instanceof SDKValidationError && (\n <Components.Text as=\"pre\">{error.pretty()}</Components.Text>\n )}\n </Components.Alert>\n )}\n <Suspense fallback={<LoaderComponent />}>\n <FadeIn>{children}</FadeIn>\n </Suspense>\n </ErrorBoundary>\n )}\n </QueryErrorResetBoundary>\n </BaseContext.Provider>\n )\n}\n"],"names":["renderErrorList","errorList","errorFromList","jsx","getFieldErrors","error","parentKey","keyPrefix","snakeCaseToCamelCase","keySuffix","err","BaseComponent","children","FallbackComponent","InternalError","LoadingIndicatorFromProps","onEvent","setError","useState","fieldErrors","setFieldErrors","throwError","useAsyncError","t","useTranslation","Components","useComponentContext","LoadingIndicatorFromContext","useLoadingIndicator","LoaderComponent","setErrorWithFieldsClear","useCallback","processError","UnprocessableEntityErrorObject","baseSubmitHandler","data","componentHandler","APIError","SDKValidationError","BaseContext","QueryErrorResetBoundary","resetQueries","jsxs","ErrorBoundary","componentEvents","Suspense","FadeIn"],"mappings":"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"}
|
|
@@ -2,6 +2,7 @@ import { APIError } from '@gusto/embedded-api/models/errors/apierror';
|
|
|
2
2
|
import { SDKValidationError } from '@gusto/embedded-api/models/errors/sdkvalidationerror';
|
|
3
3
|
import { UnprocessableEntityErrorObject } from '@gusto/embedded-api/models/errors/unprocessableentityerrorobject';
|
|
4
4
|
import { EventType } from '../../shared/constants';
|
|
5
|
+
import { LoadingIndicatorContextProps } from '../../contexts/LoadingIndicatorProvider/useLoadingIndicator';
|
|
5
6
|
export type OnEventType<K, T> = (type: K, data?: T) => void;
|
|
6
7
|
export type KnownErrors = APIError | SDKValidationError | UnprocessableEntityErrorObject;
|
|
7
8
|
export type FieldError = {
|
|
@@ -14,6 +15,7 @@ interface BaseContextProps {
|
|
|
14
15
|
onEvent: OnEventType<EventType, unknown>;
|
|
15
16
|
throwError: (e: unknown) => void;
|
|
16
17
|
baseSubmitHandler: <T>(formData: T, componentHandler: (payload: T) => Promise<void>) => Promise<void>;
|
|
18
|
+
LoadingIndicator: LoadingIndicatorContextProps['LoadingIndicator'];
|
|
17
19
|
}
|
|
18
20
|
export declare const BaseContext: import('react').Context<BaseContextProps | undefined>;
|
|
19
21
|
export declare const useBase: () => BaseContextProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBase.js","sources":["../../../src/components/Base/useBase.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { APIError } from '@gusto/embedded-api/models/errors/apierror'\nimport type { SDKValidationError } from '@gusto/embedded-api/models/errors/sdkvalidationerror'\nimport type { UnprocessableEntityErrorObject } from '@gusto/embedded-api/models/errors/unprocessableentityerrorobject'\nimport { type EventType } from '@/shared/constants'\n\nexport type OnEventType<K, T> = (type: K, data?: T) => void\n\nexport type KnownErrors = APIError | SDKValidationError | UnprocessableEntityErrorObject\n\nexport type FieldError = {\n key: string\n message: string\n}\n\ninterface BaseContextProps {\n fieldErrors: FieldError[] | null\n setError: (err: KnownErrors | null) => void\n onEvent: OnEventType<EventType, unknown>\n throwError: (e: unknown) => void\n baseSubmitHandler: <T>(\n formData: T,\n componentHandler: (payload: T) => Promise<void>,\n ) => Promise<void>\n}\n\nexport const BaseContext = createContext<BaseContextProps | undefined>(undefined)\n\nexport const useBase = () => {\n const context = useContext(BaseContext)\n if (!context) {\n throw new Error('useBase must be used within a BaseProvider')\n }\n return context\n}\n"],"names":["BaseContext","createContext","useBase","context","useContext"],"mappings":";
|
|
1
|
+
{"version":3,"file":"useBase.js","sources":["../../../src/components/Base/useBase.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { APIError } from '@gusto/embedded-api/models/errors/apierror'\nimport type { SDKValidationError } from '@gusto/embedded-api/models/errors/sdkvalidationerror'\nimport type { UnprocessableEntityErrorObject } from '@gusto/embedded-api/models/errors/unprocessableentityerrorobject'\nimport { type EventType } from '@/shared/constants'\nimport type { LoadingIndicatorContextProps } from '@/contexts/LoadingIndicatorProvider/useLoadingIndicator'\n\nexport type OnEventType<K, T> = (type: K, data?: T) => void\n\nexport type KnownErrors = APIError | SDKValidationError | UnprocessableEntityErrorObject\n\nexport type FieldError = {\n key: string\n message: string\n}\n\ninterface BaseContextProps {\n fieldErrors: FieldError[] | null\n setError: (err: KnownErrors | null) => void\n onEvent: OnEventType<EventType, unknown>\n throwError: (e: unknown) => void\n baseSubmitHandler: <T>(\n formData: T,\n componentHandler: (payload: T) => Promise<void>,\n ) => Promise<void>\n LoadingIndicator: LoadingIndicatorContextProps['LoadingIndicator']\n}\n\nexport const BaseContext = createContext<BaseContextProps | undefined>(undefined)\n\nexport const useBase = () => {\n const context = useContext(BaseContext)\n if (!context) {\n throw new Error('useBase must be used within a BaseProvider')\n }\n return context\n}\n"],"names":["BaseContext","createContext","useBase","context","useContext"],"mappings":";AA4BO,MAAMA,IAAcC,EAA4C,MAAS,GAEnEC,IAAU,MAAM;AAC3B,QAAMC,IAAUC,EAAWJ,CAAW;AACtC,MAAI,CAACG;AACH,UAAM,IAAI,MAAM,4CAA4C;AAE9D,SAAOA;AACT;"}
|
|
@@ -8,5 +8,6 @@ export type DataViewProps<T> = {
|
|
|
8
8
|
itemMenu?: useDataViewPropReturn<T>['itemMenu'];
|
|
9
9
|
onSelect?: useDataViewPropReturn<T>['onSelect'];
|
|
10
10
|
breakAt?: BreakpointKey;
|
|
11
|
+
isFetching?: boolean;
|
|
11
12
|
};
|
|
12
|
-
export declare const DataView: <T>({ pagination, breakAt, ...dataViewProps }: DataViewProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const DataView: <T>({ pagination, isFetching, breakAt, ...dataViewProps }: DataViewProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { PaginationControl as
|
|
4
|
-
import
|
|
5
|
-
import { DataTable as
|
|
6
|
-
import { DataCards as
|
|
7
|
-
import { useContainerBreakpoints as
|
|
8
|
-
const
|
|
1
|
+
import { jsxs as f, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as p, useMemo as d } from "react";
|
|
3
|
+
import { PaginationControl as u } from "../PaginationControl/PaginationControl.js";
|
|
4
|
+
import C from "./DataView.module.scss.js";
|
|
5
|
+
import { DataTable as D } from "./DataTable/DataTable.js";
|
|
6
|
+
import { DataCards as b } from "./DataCards/DataCards.js";
|
|
7
|
+
import { useContainerBreakpoints as k } from "../../../hooks/useContainerBreakpoints/useContainerBreakpoints.js";
|
|
8
|
+
const R = ({
|
|
9
9
|
pagination: t,
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
isFetching: s,
|
|
11
|
+
breakAt: a = "small",
|
|
12
|
+
...i
|
|
12
13
|
}) => {
|
|
13
|
-
const e =
|
|
14
|
+
const e = p(null), o = k({
|
|
14
15
|
ref: e
|
|
15
|
-
}),
|
|
16
|
-
return /* @__PURE__ */
|
|
16
|
+
}), m = o.length > 0, r = !o.includes(a), c = d(() => r ? b : D, [r]);
|
|
17
|
+
return /* @__PURE__ */ f(
|
|
17
18
|
"div",
|
|
18
19
|
{
|
|
19
20
|
"data-testid": "data-view",
|
|
20
|
-
className:
|
|
21
|
-
ref: (
|
|
22
|
-
e.current =
|
|
21
|
+
className: C.dataViewContainer,
|
|
22
|
+
ref: (l) => {
|
|
23
|
+
e.current = l;
|
|
23
24
|
},
|
|
24
25
|
children: [
|
|
25
|
-
|
|
26
|
-
t && /* @__PURE__ */ n(
|
|
26
|
+
m && /* @__PURE__ */ n(c, { ...i }),
|
|
27
|
+
t && /* @__PURE__ */ n(u, { ...t, isFetching: s })
|
|
27
28
|
]
|
|
28
29
|
}
|
|
29
30
|
);
|
|
30
31
|
};
|
|
31
32
|
export {
|
|
32
|
-
|
|
33
|
+
R as DataView
|
|
33
34
|
};
|
|
34
35
|
//# sourceMappingURL=DataView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataView.js","sources":["../../../../src/components/Common/DataView/DataView.tsx"],"sourcesContent":["import { useMemo, useRef } from 'react'\nimport { PaginationControl } from '../PaginationControl/PaginationControl'\nimport styles from './DataView.module.scss'\nimport { DataTable } from './DataTable/DataTable'\nimport type { useDataViewPropReturn } from './useDataView'\nimport { DataCards } from './DataCards/DataCards'\nimport type { BreakpointKey } from '@/hooks/useContainerBreakpoints/useContainerBreakpoints'\nimport useContainerBreakpoints from '@/hooks/useContainerBreakpoints/useContainerBreakpoints'\n\nexport type DataViewProps<T> = {\n columns: useDataViewPropReturn<T>['columns']\n data: T[]\n pagination?: useDataViewPropReturn<T>['pagination']\n label: string\n itemMenu?: useDataViewPropReturn<T>['itemMenu']\n onSelect?: useDataViewPropReturn<T>['onSelect']\n breakAt?: BreakpointKey\n}\n\nexport const DataView = <T,>({\n pagination,\n breakAt = 'small',\n ...dataViewProps\n}: DataViewProps<T>) => {\n const containerRef = useRef<HTMLElement | null>(null)\n const breakpoints = useContainerBreakpoints({\n ref: containerRef,\n })\n\n // Wait for breakpoints to be detected before rendering\n const isBreakpointsDetected = breakpoints.length > 0\n const isMobile = !breakpoints.includes(breakAt)\n\n const Component = useMemo(() => {\n return isMobile ? DataCards : DataTable\n }, [isMobile])\n\n return (\n <div\n data-testid=\"data-view\"\n className={styles.dataViewContainer}\n ref={ref => {\n containerRef.current = ref\n }}\n >\n {isBreakpointsDetected && <Component {...dataViewProps} />}\n {pagination && <PaginationControl {...pagination} />}\n </div>\n )\n}\n"],"names":["DataView","pagination","breakAt","dataViewProps","containerRef","useRef","breakpoints","useContainerBreakpoints","isBreakpointsDetected","isMobile","Component","useMemo","DataCards","DataTable","jsxs","styles","ref","jsx","PaginationControl"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"DataView.js","sources":["../../../../src/components/Common/DataView/DataView.tsx"],"sourcesContent":["import { useMemo, useRef } from 'react'\nimport { PaginationControl } from '../PaginationControl/PaginationControl'\nimport styles from './DataView.module.scss'\nimport { DataTable } from './DataTable/DataTable'\nimport type { useDataViewPropReturn } from './useDataView'\nimport { DataCards } from './DataCards/DataCards'\nimport type { BreakpointKey } from '@/hooks/useContainerBreakpoints/useContainerBreakpoints'\nimport useContainerBreakpoints from '@/hooks/useContainerBreakpoints/useContainerBreakpoints'\n\nexport type DataViewProps<T> = {\n columns: useDataViewPropReturn<T>['columns']\n data: T[]\n pagination?: useDataViewPropReturn<T>['pagination']\n label: string\n itemMenu?: useDataViewPropReturn<T>['itemMenu']\n onSelect?: useDataViewPropReturn<T>['onSelect']\n breakAt?: BreakpointKey\n isFetching?: boolean\n}\n\nexport const DataView = <T,>({\n pagination,\n isFetching,\n breakAt = 'small',\n ...dataViewProps\n}: DataViewProps<T>) => {\n const containerRef = useRef<HTMLElement | null>(null)\n const breakpoints = useContainerBreakpoints({\n ref: containerRef,\n })\n\n // Wait for breakpoints to be detected before rendering\n const isBreakpointsDetected = breakpoints.length > 0\n const isMobile = !breakpoints.includes(breakAt)\n\n const Component = useMemo(() => {\n return isMobile ? DataCards : DataTable\n }, [isMobile])\n\n return (\n <div\n data-testid=\"data-view\"\n className={styles.dataViewContainer}\n ref={ref => {\n containerRef.current = ref\n }}\n >\n {isBreakpointsDetected && <Component {...dataViewProps} />}\n {pagination && <PaginationControl {...pagination} isFetching={isFetching} />}\n </div>\n )\n}\n"],"names":["DataView","pagination","isFetching","breakAt","dataViewProps","containerRef","useRef","breakpoints","useContainerBreakpoints","isBreakpointsDetected","isMobile","Component","useMemo","DataCards","DataTable","jsxs","styles","ref","jsx","PaginationControl"],"mappings":";;;;;;;AAoBO,MAAMA,IAAW,CAAK;AAAA,EAC3B,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,GAAGC;AACL,MAAwB;AACtB,QAAMC,IAAeC,EAA2B,IAAI,GAC9CC,IAAcC,EAAwB;AAAA,IAC1C,KAAKH;AAAA,EAAA,CACN,GAGKI,IAAwBF,EAAY,SAAS,GAC7CG,IAAW,CAACH,EAAY,SAASJ,CAAO,GAExCQ,IAAYC,EAAQ,MACjBF,IAAWG,IAAYC,GAC7B,CAACJ,CAAQ,CAAC;AAEb,SACE,gBAAAK;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,eAAY;AAAA,MACZ,WAAWC,EAAO;AAAA,MAClB,KAAK,CAAAC,MAAO;AACV,QAAAZ,EAAa,UAAUY;AAAA,MACzB;AAAA,MAEC,UAAA;AAAA,QAAAR,KAAyB,gBAAAS,EAACP,GAAA,EAAW,GAAGP,EAAA,CAAe;AAAA,QACvDH,KAAc,gBAAAiB,EAACC,GAAA,EAAmB,GAAGlB,GAAY,YAAAC,EAAA,CAAwB;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGhF;"}
|
|
@@ -15,6 +15,7 @@ export type useDataViewProp<T> = {
|
|
|
15
15
|
itemMenu?: (item: T) => React.ReactNode;
|
|
16
16
|
onSelect?: (item: T, checked: boolean) => void;
|
|
17
17
|
emptyState?: () => React.ReactNode;
|
|
18
|
+
isFetching?: boolean;
|
|
18
19
|
};
|
|
19
20
|
export type useDataViewPropReturn<T> = {
|
|
20
21
|
pagination?: PaginationControlProps;
|
|
@@ -23,6 +24,7 @@ export type useDataViewPropReturn<T> = {
|
|
|
23
24
|
itemMenu?: (item: T) => React.ReactNode;
|
|
24
25
|
onSelect?: (item: T, checked: boolean) => void;
|
|
25
26
|
emptyState?: () => React.ReactNode;
|
|
27
|
+
isFetching?: boolean;
|
|
26
28
|
};
|
|
27
|
-
export declare const useDataView: <T>({ columns, data, itemMenu, onSelect, pagination, emptyState, }: useDataViewProp<T>) => useDataViewPropReturn<T>;
|
|
29
|
+
export declare const useDataView: <T>({ columns, data, itemMenu, onSelect, pagination, emptyState, isFetching, }: useDataViewProp<T>) => useDataViewPropReturn<T>;
|
|
28
30
|
export {};
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import { useMemo as
|
|
2
|
-
const
|
|
1
|
+
import { useMemo as u } from "react";
|
|
2
|
+
const d = ({
|
|
3
3
|
columns: r,
|
|
4
4
|
data: o,
|
|
5
5
|
itemMenu: s,
|
|
6
|
-
onSelect:
|
|
7
|
-
pagination:
|
|
8
|
-
emptyState:
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
onSelect: w,
|
|
7
|
+
pagination: V,
|
|
8
|
+
emptyState: e,
|
|
9
|
+
isFetching: p
|
|
10
|
+
}) => u(() => ({
|
|
11
|
+
pagination: V,
|
|
11
12
|
data: o,
|
|
12
13
|
columns: r,
|
|
13
14
|
itemMenu: s,
|
|
14
|
-
onSelect:
|
|
15
|
-
emptyState:
|
|
16
|
-
|
|
15
|
+
onSelect: w,
|
|
16
|
+
emptyState: e,
|
|
17
|
+
isFetching: p
|
|
18
|
+
}), [V, o, r, s, w, e, p]);
|
|
17
19
|
export {
|
|
18
|
-
|
|
20
|
+
d as useDataView
|
|
19
21
|
};
|
|
20
22
|
//# sourceMappingURL=useDataView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDataView.js","sources":["../../../../src/components/Common/DataView/useDataView.ts"],"sourcesContent":["import { useMemo } from 'react'\nimport type { PaginationControlProps } from '@/components/Common/PaginationControl/PaginationControlTypes'\n\ntype DataViewColumn<T> =\n | {\n key: keyof T\n title: string | React.ReactNode\n render?: (item: T) => React.ReactNode\n }\n | {\n key?: string\n title: string | React.ReactNode\n render: (item: T) => React.ReactNode\n }\n\nexport type useDataViewProp<T> = {\n columns: DataViewColumn<T>[]\n data: T[]\n pagination?: PaginationControlProps\n itemMenu?: (item: T) => React.ReactNode\n onSelect?: (item: T, checked: boolean) => void\n emptyState?: () => React.ReactNode\n}\n\nexport type useDataViewPropReturn<T> = {\n pagination?: PaginationControlProps\n data: T[]\n columns: DataViewColumn<T>[]\n itemMenu?: (item: T) => React.ReactNode\n onSelect?: (item: T, checked: boolean) => void\n emptyState?: () => React.ReactNode\n}\n\nexport const useDataView = <T>({\n columns,\n data,\n itemMenu,\n onSelect,\n pagination,\n emptyState,\n}: useDataViewProp<T>): useDataViewPropReturn<T> => {\n const dataViewProps = useMemo(() => {\n return {\n pagination,\n data,\n columns,\n itemMenu,\n onSelect,\n emptyState,\n }\n }, [pagination, data, columns, itemMenu, onSelect, emptyState])\n\n return dataViewProps\n}\n"],"names":["useDataView","columns","data","itemMenu","onSelect","pagination","emptyState","useMemo"],"mappings":";
|
|
1
|
+
{"version":3,"file":"useDataView.js","sources":["../../../../src/components/Common/DataView/useDataView.ts"],"sourcesContent":["import { useMemo } from 'react'\nimport type { PaginationControlProps } from '@/components/Common/PaginationControl/PaginationControlTypes'\n\ntype DataViewColumn<T> =\n | {\n key: keyof T\n title: string | React.ReactNode\n render?: (item: T) => React.ReactNode\n }\n | {\n key?: string\n title: string | React.ReactNode\n render: (item: T) => React.ReactNode\n }\n\nexport type useDataViewProp<T> = {\n columns: DataViewColumn<T>[]\n data: T[]\n pagination?: PaginationControlProps\n itemMenu?: (item: T) => React.ReactNode\n onSelect?: (item: T, checked: boolean) => void\n emptyState?: () => React.ReactNode\n isFetching?: boolean\n}\n\nexport type useDataViewPropReturn<T> = {\n pagination?: PaginationControlProps\n data: T[]\n columns: DataViewColumn<T>[]\n itemMenu?: (item: T) => React.ReactNode\n onSelect?: (item: T, checked: boolean) => void\n emptyState?: () => React.ReactNode\n isFetching?: boolean\n}\n\nexport const useDataView = <T>({\n columns,\n data,\n itemMenu,\n onSelect,\n pagination,\n emptyState,\n isFetching,\n}: useDataViewProp<T>): useDataViewPropReturn<T> => {\n const dataViewProps = useMemo(() => {\n return {\n pagination,\n data,\n columns,\n itemMenu,\n onSelect,\n emptyState,\n isFetching,\n }\n }, [pagination, data, columns, itemMenu, onSelect, emptyState, isFetching])\n\n return dataViewProps\n}\n"],"names":["useDataView","columns","data","itemMenu","onSelect","pagination","emptyState","isFetching","useMemo"],"mappings":";AAmCO,MAAMA,IAAc,CAAI;AAAA,EAC7B,SAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AACF,MACwBC,EAAQ,OACrB;AAAA,EACL,YAAAH;AAAA,EACA,MAAAH;AAAA,EACA,SAAAD;AAAA,EACA,UAAAE;AAAA,EACA,UAAAC;AAAA,EACA,YAAAE;AAAA,EACA,YAAAC;AAAA,IAED,CAACF,GAAYH,GAAMD,GAASE,GAAUC,GAAUE,GAAYC,CAAU,CAAC;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation as r } from "react-i18next";
|
|
3
|
+
import e from "./InlineSpinner.module.scss.js";
|
|
4
|
+
import t from "../../../assets/icons/spinner_small.svg.js";
|
|
5
|
+
const d = ({ ariaLabel: a, size: s = "small" }) => {
|
|
6
|
+
const { t: l } = r("common"), o = l("status.loading"), i = {
|
|
7
|
+
small: 16,
|
|
8
|
+
medium: 20,
|
|
9
|
+
large: 24
|
|
10
|
+
}[s];
|
|
11
|
+
return /* @__PURE__ */ n(
|
|
12
|
+
"span",
|
|
13
|
+
{
|
|
14
|
+
className: e.inlineSpinner,
|
|
15
|
+
"aria-label": a || o,
|
|
16
|
+
"aria-live": "polite",
|
|
17
|
+
role: "status",
|
|
18
|
+
children: /* @__PURE__ */ n(t, { className: e.spinnerIcon, width: i, height: i })
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
d as InlineSpinner
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=InlineSpinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InlineSpinner.js","sources":["../../../../src/components/Common/InlineSpinner/InlineSpinner.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport styles from './InlineSpinner.module.scss'\nimport SpinnerIcon from '@/assets/icons/spinner_small.svg?react'\n\ninterface InlineSpinnerProps {\n ariaLabel?: string\n size?: 'small' | 'medium' | 'large'\n}\n\nexport const InlineSpinner = ({ ariaLabel, size = 'small' }: InlineSpinnerProps) => {\n const { t } = useTranslation('common')\n const defaultAriaLabel = t('status.loading')\n\n const sizeMap = {\n small: 16,\n medium: 20,\n large: 24,\n }\n\n const iconSize = sizeMap[size]\n\n return (\n <span\n className={styles.inlineSpinner}\n aria-label={ariaLabel || defaultAriaLabel}\n aria-live=\"polite\"\n role=\"status\"\n >\n <SpinnerIcon className={styles.spinnerIcon} width={iconSize} height={iconSize} />\n </span>\n )\n}\n"],"names":["InlineSpinner","ariaLabel","size","t","useTranslation","defaultAriaLabel","iconSize","jsx","styles","SpinnerIcon"],"mappings":";;;;AASO,MAAMA,IAAgB,CAAC,EAAE,WAAAC,GAAW,MAAAC,IAAO,cAAkC;AAClF,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,QAAQ,GAC/BC,IAAmBF,EAAE,gBAAgB,GAQrCG,IANU;AAAA,IACd,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,OAAO;AAAA,EAAA,EAGgBJ,CAAI;AAE7B,SACE,gBAAAK;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAO;AAAA,MAClB,cAAYP,KAAaI;AAAA,MACzB,aAAU;AAAA,MACV,MAAK;AAAA,MAEL,UAAA,gBAAAE,EAACE,KAAY,WAAWD,EAAO,aAAa,OAAOF,GAAU,QAAQA,EAAA,CAAU;AAAA,IAAA;AAAA,EAAA;AAGrF;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InlineSpinner.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|