@gusto/embedded-react-sdk 0.10.1 → 0.10.2-rc.3
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 +13 -0
- package/dist/components/Base/Base.d.ts +3 -2
- package/dist/components/Base/Base.js +57 -50
- package/dist/components/Base/Base.js.map +1 -1
- package/dist/components/Common/InternalError/InternalError.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureForm.js +6 -4
- package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormActions.js +12 -10
- package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormFields.js +8 -6
- package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
- package/dist/components/Common/UI/ComboBox/ComboBox.js +31 -33
- package/dist/components/Common/UI/ComboBox/ComboBox.js.map +1 -1
- package/dist/components/Common/UI/ComboBox/ComboBox.module.scss.js +1 -1
- package/dist/components/Common/UI/Text/TextTypes.d.ts +1 -1
- package/dist/components/Company/AssignSignatory/AssignSignatory.js +13 -11
- package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
- 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/CreateSignatory.js +1 -0
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +3 -2
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +5 -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/InviteSignatory.js +4 -3
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +10 -9
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +5 -3
- 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 -5
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccount.d.ts +2 -2
- package/dist/components/Company/BankAccount/BankAccount.js +25 -20
- package/dist/components/Company/BankAccount/BankAccount.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountComponents.js +16 -9
- package/dist/components/Company/BankAccount/BankAccountComponents.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +23 -8
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.d.ts +1 -0
- package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js +30 -30
- package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Form.js +8 -7
- package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.d.ts +4 -0
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +5 -3
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/AccountView.js +14 -13
- package/dist/components/Company/BankAccount/BankAccountList/AccountView.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/BankAccount/BankAccountVerify/Form.js +5 -4
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
- package/dist/components/Company/BankAccount/stateMachine.d.ts +1 -1
- package/dist/components/Company/BankAccount/stateMachine.js +13 -5
- package/dist/components/Company/BankAccount/stateMachine.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/DocumentList.js +17 -15
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +5 -3
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentSigner.d.ts +5 -7
- package/dist/components/Company/DocumentSigner/DocumentSigner.js +24 -24
- package/dist/components/Company/DocumentSigner/DocumentSigner.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +45 -44
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +5 -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/FederalTaxes.js +17 -15
- package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Form.js +3 -2
- package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +10 -8
- 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 +8 -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/Industry/Industry.js +30 -31
- package/dist/components/Company/Industry/Industry.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/Form.js +5 -4
- package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/LocationForm.js +36 -37
- package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +5 -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 +11 -7
- package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/LocationsList.js +11 -9
- package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +5 -3
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/Locations/stateMachine.js +35 -33
- package/dist/components/Company/Locations/stateMachine.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/Completed.js +6 -5
- package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/MissingRequirements.js +3 -2
- package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +4 -2
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +5 -3
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js +72 -71
- 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 +9 -8
- package/dist/components/Company/PaySchedule/_parts/Edit.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Head.js +3 -2
- package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/List.js +6 -5
- package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
- package/dist/components/Company/PaySchedule/usePaySchedule.js +7 -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 +5 -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 +5 -3
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Contractor/Address/Address.js +39 -38
- package/dist/components/Contractor/Address/Address.js.map +1 -1
- package/dist/components/Contractor/Address/Form.js +3 -2
- package/dist/components/Contractor/Address/Form.js.map +1 -1
- package/dist/components/Contractor/Address/useAddress.js +7 -5
- package/dist/components/Contractor/Address/useAddress.js.map +1 -1
- package/dist/components/Contractor/List/index.js +11 -10
- package/dist/components/Contractor/List/index.js.map +1 -1
- package/dist/components/Contractor/NewHireReport/NewHireReport.js +52 -52
- package/dist/components/Contractor/NewHireReport/NewHireReport.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/PaymentMethod/PaymentMethod.js +3 -2
- 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/Employee/Compensation/Actions.js +5 -4
- package/dist/components/Employee/Compensation/Actions.js.map +1 -1
- package/dist/components/Employee/Compensation/Compensation.js +123 -132
- package/dist/components/Employee/Compensation/Compensation.js.map +1 -1
- package/dist/components/Employee/Compensation/Edit.js +3 -2
- package/dist/components/Employee/Compensation/Edit.js.map +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/Actions.js +9 -8
- package/dist/components/Employee/Deductions/Actions.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionForm.js +3 -2
- package/dist/components/Employee/Deductions/DeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/Deductions.js +74 -79
- package/dist/components/Employee/Deductions/Deductions.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsList.js +3 -2
- package/dist/components/Employee/Deductions/DeductionsList.js.map +1 -1
- package/dist/components/Employee/Deductions/IncludeDeductionsForm.js +3 -2
- package/dist/components/Employee/Deductions/IncludeDeductionsForm.js.map +1 -1
- package/dist/components/Employee/Deductions/useDeductions.js +7 -5
- package/dist/components/Employee/Deductions/useDeductions.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/DocumentList.js +12 -10
- package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/List.js +3 -2
- package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +5 -3
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +38 -42
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +5 -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/EmployeeList.js +59 -58
- package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeList/Head.js +3 -2
- package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
- package/dist/components/Employee/EmployeeList/List.js +3 -2
- package/dist/components/Employee/EmployeeList/List.js.map +1 -1
- package/dist/components/Employee/EmployeeList/useEmployeeList.js +5 -3
- package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/Landing/Landing.js +7 -6
- package/dist/components/Employee/Landing/Landing.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/BankAccountEdit.js +3 -2
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js +3 -2
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js +95 -97
- 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 +3 -2
- package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +7 -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 +10 -9
- package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
- package/dist/components/Employee/Profile/HomeAddress.js +5 -4
- package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js +9 -8
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
- package/dist/components/Employee/Profile/Profile.js +118 -124
- package/dist/components/Employee/Profile/Profile.js.map +1 -1
- package/dist/components/Employee/Profile/useProfile.js +5 -3
- package/dist/components/Employee/Profile/useProfile.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 +7 -6
- package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/Taxes/Taxes.js +59 -60
- package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
- package/dist/components/Employee/Taxes/useTaxes.js +5 -3
- package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
- package/dist/contexts/ApiProvider/ApiProvider.js +16 -14
- package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
- package/dist/contexts/ComponentAdapter/componentAdapterTypes.d.ts +5 -0
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +2 -0
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +20 -17
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/contexts/LoadingIndicatorProvider/LoadingIndicatorProvider.d.ts +7 -0
- package/dist/contexts/LoadingIndicatorProvider/LoadingIndicatorProvider.js +10 -0
- package/dist/contexts/LoadingIndicatorProvider/LoadingIndicatorProvider.js.map +1 -0
- package/dist/contexts/LoadingIndicatorProvider/useLoadingIndicator.d.ts +6 -0
- package/dist/contexts/LoadingIndicatorProvider/useLoadingIndicator.js +11 -0
- package/dist/contexts/LoadingIndicatorProvider/useLoadingIndicator.js.map +1 -0
- package/dist/shared/constants.d.ts +2 -0
- package/dist/shared/constants.js +10 -9
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.10.2
|
|
4
|
+
|
|
5
|
+
### Fixes
|
|
6
|
+
|
|
7
|
+
- Fix bank account not found error
|
|
8
|
+
- Fix ComboBox focus ring
|
|
9
|
+
|
|
10
|
+
### Chores & Maintenance
|
|
11
|
+
|
|
12
|
+
- Add reset to InternalError and clean up error handling
|
|
13
|
+
- Add initial contractor onboarding documentation
|
|
14
|
+
- Add contractor address tests
|
|
15
|
+
|
|
3
16
|
## 0.10.1
|
|
4
17
|
|
|
5
18
|
- Fixed work address being stale when editing an existing employee in employee onboarding
|
|
@@ -3,6 +3,7 @@ import { FallbackProps } from 'react-error-boundary';
|
|
|
3
3
|
import { OnEventType } from './useBase';
|
|
4
4
|
import { EventType } from '../../shared/constants';
|
|
5
5
|
import { ResourceDictionary, Resources } from '../../types/Helpers';
|
|
6
|
+
import { LoadingIndicatorContextProps } from '../../contexts/LoadingIndicatorProvider/useLoadingIndicator';
|
|
6
7
|
export interface CommonComponentInterface<TResourceKey extends keyof Resources = keyof Resources> {
|
|
7
8
|
children?: ReactNode;
|
|
8
9
|
className?: string;
|
|
@@ -11,7 +12,7 @@ export interface CommonComponentInterface<TResourceKey extends keyof Resources =
|
|
|
11
12
|
}
|
|
12
13
|
export interface BaseComponentInterface<TResourceKey extends keyof Resources = keyof Resources> extends CommonComponentInterface<TResourceKey> {
|
|
13
14
|
FallbackComponent?: (props: FallbackProps) => JSX.Element;
|
|
14
|
-
LoaderComponent?:
|
|
15
|
+
LoaderComponent?: LoadingIndicatorContextProps['LoadingIndicator'];
|
|
15
16
|
onEvent: OnEventType<EventType, unknown>;
|
|
16
17
|
}
|
|
17
|
-
export declare const BaseComponent: <TResourceKey extends keyof Resources = keyof Resources>({ children, FallbackComponent, LoaderComponent, onEvent, }: BaseComponentInterface<TResourceKey>) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare const BaseComponent: <TResourceKey extends keyof Resources = keyof Resources>({ children, FallbackComponent, LoaderComponent: LoadingIndicatorFromProps, onEvent, }: BaseComponentInterface<TResourceKey>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,78 +1,85 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { ErrorBoundary as
|
|
4
|
-
import { useTranslation as
|
|
5
|
-
import { APIError as
|
|
6
|
-
import { SDKValidationError as
|
|
7
|
-
import { UnprocessableEntityErrorObject as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
1
|
+
import { jsx as r, jsxs as u } from "react/jsx-runtime";
|
|
2
|
+
import { useState as y, useCallback as A, Suspense as L } from "react";
|
|
3
|
+
import { ErrorBoundary as R } from "react-error-boundary";
|
|
4
|
+
import { useTranslation as S } from "react-i18next";
|
|
5
|
+
import { APIError as E } from "@gusto/embedded-api/models/errors/apierror";
|
|
6
|
+
import { SDKValidationError as g } from "@gusto/embedded-api/models/errors/sdkvalidationerror";
|
|
7
|
+
import { UnprocessableEntityErrorObject as C } from "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
8
|
+
import { QueryErrorResetBoundary as B } from "@tanstack/react-query";
|
|
9
|
+
import { FadeIn as T } from "../Common/FadeIn/FadeIn.js";
|
|
10
|
+
import { BaseContext as _ } from "./useBase.js";
|
|
11
|
+
import { componentEvents as j } from "../../shared/constants.js";
|
|
11
12
|
import { useAsyncError as K } from "../Common/hooks/useAsyncError.js";
|
|
12
|
-
import
|
|
13
|
-
import { InternalError as
|
|
13
|
+
import "classnames";
|
|
14
|
+
import { InternalError as P } from "../Common/InternalError/InternalError.js";
|
|
14
15
|
import { snakeCaseToCamelCase as w } from "../../helpers/formattedStrings.js";
|
|
15
|
-
import { useComponentContext as
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
import { useComponentContext as F } from "../../contexts/ComponentAdapter/useComponentContext.js";
|
|
17
|
+
import { useLoadingIndicator as M } from "../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
18
|
+
const O = (e) => e.map((o) => o.message ? /* @__PURE__ */ r("li", { children: o.message }, o.key) : null), h = (e, o) => {
|
|
19
|
+
const m = o ? o + "." : "";
|
|
20
|
+
if (e.category === "invalid_attribute_value" || e.category === "invalid_operation")
|
|
19
21
|
return [
|
|
20
22
|
{
|
|
21
|
-
key: w(
|
|
22
|
-
message:
|
|
23
|
+
key: w(m + e.errorKey),
|
|
24
|
+
message: e.message ?? ""
|
|
23
25
|
}
|
|
24
26
|
];
|
|
25
|
-
if (
|
|
26
|
-
let
|
|
27
|
-
return
|
|
27
|
+
if (e.category === "nested_errors" && e.errors !== void 0) {
|
|
28
|
+
let a = "";
|
|
29
|
+
return e.metadata?.key && typeof e.metadata.key == "string" ? a = e.metadata.key : e.metadata?.state && typeof e.metadata.state == "string" ? a = e.metadata.state : e.errorKey && (a = e.errorKey), e.errors.flatMap((t) => h(t, m + a));
|
|
28
30
|
}
|
|
29
31
|
return [];
|
|
30
|
-
},
|
|
31
|
-
children:
|
|
32
|
-
FallbackComponent:
|
|
33
|
-
LoaderComponent:
|
|
34
|
-
onEvent:
|
|
32
|
+
}, re = ({
|
|
33
|
+
children: e,
|
|
34
|
+
FallbackComponent: o = P,
|
|
35
|
+
LoaderComponent: m,
|
|
36
|
+
onEvent: a
|
|
35
37
|
}) => {
|
|
36
|
-
const [
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
async (
|
|
40
|
-
|
|
38
|
+
const [t, l] = y(null), [c, p] = y(null), f = K(), { t: k } = S(), d = F(), { LoadingIndicator: x } = M(), b = m ?? x, v = (n) => {
|
|
39
|
+
l(n), n instanceof C && Array.isArray(n.errors) && p(n.errors.flatMap((s) => h(s)));
|
|
40
|
+
}, I = A(
|
|
41
|
+
async (n, s) => {
|
|
42
|
+
l(null), p(null);
|
|
41
43
|
try {
|
|
42
|
-
await
|
|
43
|
-
} catch (
|
|
44
|
-
|
|
44
|
+
await s(n);
|
|
45
|
+
} catch (i) {
|
|
46
|
+
i instanceof E || i instanceof g || i instanceof C ? v(i) : f(i);
|
|
45
47
|
}
|
|
46
48
|
},
|
|
47
|
-
[
|
|
49
|
+
[l, f]
|
|
48
50
|
);
|
|
49
|
-
return /* @__PURE__ */
|
|
50
|
-
|
|
51
|
+
return /* @__PURE__ */ r(
|
|
52
|
+
_.Provider,
|
|
51
53
|
{
|
|
52
54
|
value: {
|
|
53
|
-
fieldErrors:
|
|
54
|
-
setError:
|
|
55
|
-
onEvent:
|
|
55
|
+
fieldErrors: c,
|
|
56
|
+
setError: l,
|
|
57
|
+
onEvent: a,
|
|
56
58
|
throwError: f,
|
|
57
|
-
baseSubmitHandler:
|
|
59
|
+
baseSubmitHandler: I
|
|
58
60
|
},
|
|
59
|
-
children: /* @__PURE__ */
|
|
60
|
-
|
|
61
|
+
children: /* @__PURE__ */ r(B, { children: ({ reset: n }) => /* @__PURE__ */ u(
|
|
62
|
+
R,
|
|
61
63
|
{
|
|
62
|
-
FallbackComponent:
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
FallbackComponent: o,
|
|
65
|
+
onReset: n,
|
|
66
|
+
onError: (s) => {
|
|
67
|
+
a(j.ERROR, s);
|
|
65
68
|
},
|
|
66
69
|
children: [
|
|
67
|
-
(
|
|
68
|
-
|
|
70
|
+
(t || c) && /* @__PURE__ */ u(d.Alert, { label: k("status.errorEncountered"), status: "error", children: [
|
|
71
|
+
c && /* @__PURE__ */ r(d.UnorderedList, { items: O(c) }),
|
|
72
|
+
t && t instanceof E && /* @__PURE__ */ r(d.Text, { children: t.message }),
|
|
73
|
+
t && t instanceof g && /* @__PURE__ */ r(d.Text, { as: "pre", children: t.pretty() })
|
|
74
|
+
] }),
|
|
75
|
+
/* @__PURE__ */ r(L, { fallback: /* @__PURE__ */ r(b, {}), children: /* @__PURE__ */ r(T, { children: e }) })
|
|
69
76
|
]
|
|
70
77
|
}
|
|
71
|
-
)
|
|
78
|
+
) })
|
|
72
79
|
}
|
|
73
80
|
);
|
|
74
81
|
};
|
|
75
82
|
export {
|
|
76
|
-
|
|
83
|
+
re as BaseComponent
|
|
77
84
|
};
|
|
78
85
|
//# 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 { FadeIn } from '../Common/FadeIn/FadeIn'\nimport { BaseContext, type FieldError, type KnownErrors, type OnEventType } from './useBase'\nimport { componentEvents, type EventType } from '@/shared/constants'\nimport { InternalError,
|
|
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 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,\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","processError","UnprocessableEntityErrorObject","baseSubmitHandler","useCallback","data","componentHandler","APIError","SDKValidationError","BaseContext","QueryErrorResetBoundary","resetQueries","jsxs","ErrorBoundary","componentEvents","Suspense","FadeIn"],"mappings":";;;;;;;;;;;;;;;;;AAoCA,MAAMA,IAAkB,CAACC,MAChBA,EAAU,IAAI,CAAiBC,MAChCA,EAAc,UACR,gBAAAC,EAAA,MAAA,EAA4B,UAAcD,EAAA,QAAA,GAAlCA,EAAc,GAA4B,IAErD,IACR,GAKGE,IAAiB,CACrBC,GACAC,MACuC;AACjC,QAAAC,IAAYD,IAAYA,IAAY,MAAM;AAChD,MAAID,EAAM,aAAa,6BAA6BA,EAAM,aAAa;AAC9D,WAAA;AAAA,MACL;AAAA,QACE,KAAKG,EAAqBD,IAAYF,EAAM,QAAQ;AAAA,QACpD,SAASA,EAAM,WAAW;AAAA,MAAA;AAAA,IAE9B;AAEF,MAAIA,EAAM,aAAa,mBAAmBA,EAAM,WAAW,QAAW;AAEpE,QAAII,IAAY;AAEhB,WAAIJ,EAAM,UAAU,OAAO,OAAOA,EAAM,SAAS,OAAQ,WAEvDI,IAAYJ,EAAM,SAAS,MAElBA,EAAM,UAAU,SAAS,OAAOA,EAAM,SAAS,SAAU,WAElEI,IAAYJ,EAAM,SAAS,QAClBA,EAAM,aACfI,IAAYJ,EAAM,WAEbA,EAAM,OAAO,QAAQ,CAAAK,MAAON,EAAeM,GAAKH,IAAYE,CAAS,CAAC;AAAA,EAAA;AAE/E,SAAO,CAAC;AACV,GAIaE,KAAgB,CAAyD;AAAA,EACpF,UAAAC;AAAA,EACA,mBAAAC,IAAoBC;AAAA,EACpB,iBAAiBC;AAAA,EACjB,SAAAC;AACF,MAA4C;AAC1C,QAAM,CAACX,GAAOY,CAAQ,IAAIC,EAA6B,IAAI,GACrD,CAACC,GAAaC,CAAc,IAAIF,EAA8B,IAAI,GAClEG,IAAaC,EAAc,GAC3B,EAAE,GAAAC,EAAE,IAAIC,EAAe,GACvBC,IAAaC,EAAoB,GAEjC,EAAE,kBAAkBC,EAA4B,IAAIC,EAAoB,GAExEC,IAAkBd,KAA6BY,GAE/CG,IAAe,CAACzB,MAAuB;AAC3C,IAAAY,EAASZ,CAAK,GAEVA,aAAiB0B,KAAkC,MAAM,QAAQ1B,EAAM,MAAM,KAC/Ee,EAAef,EAAM,OAAO,QAAQ,OAAOD,EAAeM,CAAG,CAAC,CAAC;AAAA,EAEnE,GAEMsB,IAAoBC;AAAA,IACxB,OAAWC,GAASC,MAAuC;AACzD,MAAAlB,EAAS,IAAI,GACbG,EAAe,IAAI;AACf,UAAA;AACF,cAAMe,EAAiBD,CAAI;AAAA,eACpBxB,GAAK;AACZ,QACEA,aAAe0B,KACf1B,aAAe2B,KACf3B,aAAeqB,IAEfD,EAAapB,CAAG,MACAA,CAAG;AAAA,MAAA;AAAA,IAEzB;AAAA,IACA,CAACO,GAAUI,CAAU;AAAA,EACvB;AAGE,SAAA,gBAAAlB;AAAA,IAACmC,EAAY;AAAA,IAAZ;AAAA,MACC,OAAO;AAAA,QACL,aAAAnB;AAAA,QACA,UAAAF;AAAA,QACA,SAAAD;AAAA,QACA,YAAAK;AAAA,QACA,mBAAAW;AAAA,MACF;AAAA,MAEA,4BAACO,GACE,EAAA,UAAA,CAAC,EAAE,OAAOC,QACT,gBAAAC;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,mBAAA7B;AAAA,UACA,SAAS2B;AAAA,UACT,SAAS,CAAO9B,MAAA;AACN,YAAAM,EAAA2B,EAAgB,OAAOjC,CAAG;AAAA,UACpC;AAAA,UAEE,UAAA;AAAA,aAASL,KAAAc,MACR,gBAAAsB,EAAAhB,EAAW,OAAX,EAAiB,OAAOF,EAAE,yBAAyB,GAAG,QAAO,SAC3D,UAAA;AAAA,cAAAJ,uBAAgBM,EAAW,eAAX,EAAyB,OAAOzB,EAAgBmB,CAAW,GAAG;AAAA,cAC9Ed,KAASA,aAAiB+B,KACzB,gBAAAjC,EAACsB,EAAW,MAAX,EAAiB,YAAM,SAAQ;AAAA,cAEjCpB,KAASA,aAAiBgC,KACxB,gBAAAlC,EAAAsB,EAAW,MAAX,EAAgB,IAAG,OAAO,UAAMpB,EAAA,OAAA,EAAS,CAAA;AAAA,YAAA,GAE9C;AAAA,YAEF,gBAAAF,EAACyC,KAAS,UAAU,gBAAAzC,EAAC0B,KAAgB,GACnC,UAAA,gBAAA1B,EAAC0C,GAAQ,EAAA,UAAAjC,EAAS,CAAA,EACpB,CAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA,EAGN,CAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalError.js","sources":["../../../../src/components/Common/InternalError/InternalError.tsx"],"sourcesContent":["import type { FallbackProps } from 'react-error-boundary'\nimport { Trans, useTranslation } from 'react-i18next'\nimport styles from './InternalError.module.scss'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport const InternalError = ({ error, resetErrorBoundary }: FallbackProps) => {\n
|
|
1
|
+
{"version":3,"file":"InternalError.js","sources":["../../../../src/components/Common/InternalError/InternalError.tsx"],"sourcesContent":["import type { FallbackProps } from 'react-error-boundary'\nimport { Trans, useTranslation } from 'react-i18next'\nimport styles from './InternalError.module.scss'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport const InternalError = ({ error, resetErrorBoundary }: FallbackProps) => {\n const { t } = useTranslation('common')\n const Components = useComponentContext()\n const errorMessage =\n typeof error === 'string'\n ? error\n : error instanceof Error\n ? error.message\n : t('errors.unknownError')\n return (\n <div className={styles.internalErrorCard} role=\"alert\" data-testid=\"internal-error-card\">\n <div>\n <Components.Heading className={styles.internalErrorCardTitle} as=\"h1\" styledAs=\"h3\">\n {t('errors.errorHeading')}\n </Components.Heading>\n <Components.Text className={styles.errorMessage}>\n <Trans\n t={t}\n i18nKey=\"errors.globalReactError\"\n values={{ error: errorMessage }}\n shouldUnescape={true}\n />\n </Components.Text>\n </div>\n <div>\n <Components.Button variant=\"secondary\" onClick={resetErrorBoundary}>\n {t('errors.resetGlobalError')}\n </Components.Button>\n </div>\n </div>\n )\n}\n"],"names":["InternalError","error","resetErrorBoundary","t","useTranslation","Components","useComponentContext","errorMessage","jsxs","styles","jsx","Trans"],"mappings":";;;;AAKO,MAAMA,IAAgB,CAAC,EAAE,OAAAC,GAAO,oBAAAC,QAAwC;AAC7E,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,QAAQ,GAC/BC,IAAaC,EAAoB,GACjCC,IACJ,OAAON,KAAU,WACbA,IACAA,aAAiB,QACfA,EAAM,UACNE,EAAE,qBAAqB;AAE7B,SAAA,gBAAAK,EAAC,SAAI,WAAWC,EAAO,mBAAmB,MAAK,SAAQ,eAAY,uBACjE,UAAA;AAAA,IAAA,gBAAAD,EAAC,OACC,EAAA,UAAA;AAAA,MAAA,gBAAAE,EAACL,EAAW,SAAX,EAAmB,WAAWI,EAAO,wBAAwB,IAAG,MAAK,UAAS,MAC5E,UAAEN,EAAA,qBAAqB,EAC1B,CAAA;AAAA,wBACCE,EAAW,MAAX,EAAgB,WAAWI,EAAO,cACjC,UAAA,gBAAAC;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,GAAAR;AAAA,UACA,SAAQ;AAAA,UACR,QAAQ,EAAE,OAAOI,EAAa;AAAA,UAC9B,gBAAgB;AAAA,QAAA;AAAA,MAAA,EAEpB,CAAA;AAAA,IAAA,GACF;AAAA,IACC,gBAAAG,EAAA,OAAA,EACC,UAAC,gBAAAA,EAAAL,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASH,GAC7C,UAAEC,EAAA,yBAAyB,GAC9B,EACF,CAAA;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -5,22 +5,24 @@ import { zodResolver as l } from "@hookform/resolvers/zod";
|
|
|
5
5
|
import t from "./SignatureForm.module.scss.js";
|
|
6
6
|
import { Form as u } from "../Form/Form.js";
|
|
7
7
|
import { Flex as c } from "../Flex/Flex.js";
|
|
8
|
+
import "react-i18next";
|
|
9
|
+
import "classnames";
|
|
8
10
|
const f = o.object({
|
|
9
11
|
signature: o.string().min(1),
|
|
10
12
|
confirmSignature: o.literal(!0)
|
|
11
|
-
}),
|
|
13
|
+
}), p = {
|
|
12
14
|
signature: ""
|
|
13
15
|
};
|
|
14
|
-
function
|
|
16
|
+
function z({ onSubmit: m, children: i, formProps: n }) {
|
|
15
17
|
const e = s({
|
|
16
18
|
resolver: l(f),
|
|
17
|
-
defaultValues:
|
|
19
|
+
defaultValues: p,
|
|
18
20
|
...n
|
|
19
21
|
});
|
|
20
22
|
return /* @__PURE__ */ r(a, { ...e, children: /* @__PURE__ */ r(u, { onSubmit: e.handleSubmit(m), className: t.container, children: /* @__PURE__ */ r("div", { className: t.formFields, children: /* @__PURE__ */ r(c, { flexDirection: "column", gap: 20, children: i }) }) }) });
|
|
21
23
|
}
|
|
22
24
|
export {
|
|
23
|
-
|
|
25
|
+
z as SignatureForm,
|
|
24
26
|
f as SignatureFormSchema
|
|
25
27
|
};
|
|
26
28
|
//# sourceMappingURL=SignatureForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignatureForm.js","sources":["../../../../src/components/Common/SignatureForm/SignatureForm.tsx"],"sourcesContent":["import { z } from 'zod'\nimport { FormProvider, useForm, type UseFormProps } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport styles from './SignatureForm.module.scss'\nimport { Form } from '@/components/Common/Form'\nimport { Flex } from '@/components/Common'\n\nexport const SignatureFormSchema = z.object({\n signature: z.string().min(1),\n confirmSignature: z.literal(true),\n})\n\nconst signatureFormDefaultValues = {\n signature: '',\n}\n\nexport type SignatureFormInputs = z.infer<typeof SignatureFormSchema>\n\ninterface SignatureFormProps {\n onSubmit: (data: SignatureFormInputs) => void | Promise<void>\n children?: React.ReactNode\n formProps?: Partial<UseFormProps<SignatureFormInputs>>\n}\n\nexport function SignatureForm({ onSubmit, children, formProps }: SignatureFormProps) {\n const methods = useForm<SignatureFormInputs>({\n resolver: zodResolver(SignatureFormSchema),\n defaultValues: signatureFormDefaultValues,\n ...formProps,\n })\n\n return (\n <FormProvider {...methods}>\n <Form onSubmit={methods.handleSubmit(onSubmit)} className={styles.container}>\n <div className={styles.formFields}>\n <Flex flexDirection=\"column\" gap={20}>\n {children}\n </Flex>\n </div>\n </Form>\n </FormProvider>\n )\n}\n"],"names":["SignatureFormSchema","z","signatureFormDefaultValues","SignatureForm","onSubmit","children","formProps","methods","useForm","zodResolver","jsx","FormProvider","Form","styles","Flex"],"mappings":"
|
|
1
|
+
{"version":3,"file":"SignatureForm.js","sources":["../../../../src/components/Common/SignatureForm/SignatureForm.tsx"],"sourcesContent":["import { z } from 'zod'\nimport { FormProvider, useForm, type UseFormProps } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport styles from './SignatureForm.module.scss'\nimport { Form } from '@/components/Common/Form'\nimport { Flex } from '@/components/Common'\n\nexport const SignatureFormSchema = z.object({\n signature: z.string().min(1),\n confirmSignature: z.literal(true),\n})\n\nconst signatureFormDefaultValues = {\n signature: '',\n}\n\nexport type SignatureFormInputs = z.infer<typeof SignatureFormSchema>\n\ninterface SignatureFormProps {\n onSubmit: (data: SignatureFormInputs) => void | Promise<void>\n children?: React.ReactNode\n formProps?: Partial<UseFormProps<SignatureFormInputs>>\n}\n\nexport function SignatureForm({ onSubmit, children, formProps }: SignatureFormProps) {\n const methods = useForm<SignatureFormInputs>({\n resolver: zodResolver(SignatureFormSchema),\n defaultValues: signatureFormDefaultValues,\n ...formProps,\n })\n\n return (\n <FormProvider {...methods}>\n <Form onSubmit={methods.handleSubmit(onSubmit)} className={styles.container}>\n <div className={styles.formFields}>\n <Flex flexDirection=\"column\" gap={20}>\n {children}\n </Flex>\n </div>\n </Form>\n </FormProvider>\n )\n}\n"],"names":["SignatureFormSchema","z","signatureFormDefaultValues","SignatureForm","onSubmit","children","formProps","methods","useForm","zodResolver","jsx","FormProvider","Form","styles","Flex"],"mappings":";;;;;;;;;AAOa,MAAAA,IAAsBC,EAAE,OAAO;AAAA,EAC1C,WAAWA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC3B,kBAAkBA,EAAE,QAAQ,EAAI;AAClC,CAAC,GAEKC,IAA6B;AAAA,EACjC,WAAW;AACb;AAUO,SAASC,EAAc,EAAE,UAAAC,GAAU,UAAAC,GAAU,WAAAC,KAAiC;AACnF,QAAMC,IAAUC,EAA6B;AAAA,IAC3C,UAAUC,EAAYT,CAAmB;AAAA,IACzC,eAAeE;AAAA,IACf,GAAGI;AAAA,EAAA,CACJ;AAED,SACG,gBAAAI,EAAAC,GAAA,EAAc,GAAGJ,GAChB,UAAC,gBAAAG,EAAAE,GAAA,EAAK,UAAUL,EAAQ,aAAaH,CAAQ,GAAG,WAAWS,EAAO,WAChE,UAAC,gBAAAH,EAAA,OAAA,EAAI,WAAWG,EAAO,YACrB,UAAA,gBAAAH,EAACI,GAAK,EAAA,eAAc,UAAS,KAAK,IAC/B,UAAAT,EACH,CAAA,EACF,CAAA,EACF,CAAA,GACF;AAEJ;"}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { jsxs as m, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import "react-i18next";
|
|
3
|
+
import "classnames";
|
|
4
|
+
import { ActionsLayout as s } from "../ActionsLayout/ActionsLayout.js";
|
|
5
|
+
import { useComponentContext as p } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
6
|
+
function d({
|
|
5
7
|
onBack: t,
|
|
6
8
|
backLabel: r,
|
|
7
|
-
submitLabel:
|
|
8
|
-
isLoading:
|
|
9
|
+
submitLabel: i,
|
|
10
|
+
isLoading: e = !1
|
|
9
11
|
}) {
|
|
10
|
-
const o =
|
|
11
|
-
return /* @__PURE__ */ s
|
|
12
|
+
const o = p();
|
|
13
|
+
return /* @__PURE__ */ m(s, { children: [
|
|
12
14
|
t && /* @__PURE__ */ n(o.Button, { variant: "secondary", type: "button", onClick: t, children: r }),
|
|
13
|
-
/* @__PURE__ */ n(o.Button, { type: "submit", isLoading:
|
|
15
|
+
/* @__PURE__ */ n(o.Button, { type: "submit", isLoading: e, children: i })
|
|
14
16
|
] });
|
|
15
17
|
}
|
|
16
18
|
export {
|
|
17
|
-
|
|
19
|
+
d as SignatureFormActions
|
|
18
20
|
};
|
|
19
21
|
//# sourceMappingURL=SignatureFormActions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignatureFormActions.js","sources":["../../../../src/components/Common/SignatureForm/SignatureFormActions.tsx"],"sourcesContent":["import { ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\ninterface SignatureFormActionsProps {\n onBack?: () => void\n backLabel: string\n submitLabel: string\n isLoading?: boolean\n}\n\nexport function SignatureFormActions({\n onBack,\n backLabel,\n submitLabel,\n isLoading = false,\n}: SignatureFormActionsProps) {\n const Components = useComponentContext()\n\n return (\n <ActionsLayout>\n {onBack && (\n <Components.Button variant=\"secondary\" type=\"button\" onClick={onBack}>\n {backLabel}\n </Components.Button>\n )}\n <Components.Button type=\"submit\" isLoading={isLoading}>\n {submitLabel}\n </Components.Button>\n </ActionsLayout>\n )\n}\n"],"names":["SignatureFormActions","onBack","backLabel","submitLabel","isLoading","Components","useComponentContext","ActionsLayout","jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"SignatureFormActions.js","sources":["../../../../src/components/Common/SignatureForm/SignatureFormActions.tsx"],"sourcesContent":["import { ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\ninterface SignatureFormActionsProps {\n onBack?: () => void\n backLabel: string\n submitLabel: string\n isLoading?: boolean\n}\n\nexport function SignatureFormActions({\n onBack,\n backLabel,\n submitLabel,\n isLoading = false,\n}: SignatureFormActionsProps) {\n const Components = useComponentContext()\n\n return (\n <ActionsLayout>\n {onBack && (\n <Components.Button variant=\"secondary\" type=\"button\" onClick={onBack}>\n {backLabel}\n </Components.Button>\n )}\n <Components.Button type=\"submit\" isLoading={isLoading}>\n {submitLabel}\n </Components.Button>\n </ActionsLayout>\n )\n}\n"],"names":["SignatureFormActions","onBack","backLabel","submitLabel","isLoading","Components","useComponentContext","ActionsLayout","jsx"],"mappings":";;;;;AAUO,SAASA,EAAqB;AAAA,EACnC,QAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC,IAAY;AACd,GAA8B;AAC5B,QAAMC,IAAaC,EAAoB;AAEvC,2BACGC,GACE,EAAA,UAAA;AAAA,IACCN,KAAA,gBAAAO,EAACH,EAAW,QAAX,EAAkB,SAAQ,aAAY,MAAK,UAAS,SAASJ,GAC3D,UACHC,EAAA,CAAA;AAAA,sBAEDG,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAAD,GAC9B,UACHD,EAAA,CAAA;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as n, Fragment as s, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import "react-i18next";
|
|
3
|
+
import "classnames";
|
|
2
4
|
import { TextInputField as a } from "../Fields/TextInputField/TextInputField.js";
|
|
3
5
|
import { CheckboxField as u } from "../Fields/CheckboxField/CheckboxField.js";
|
|
4
|
-
function
|
|
6
|
+
function f({
|
|
5
7
|
signatureLabel: r,
|
|
6
8
|
signatureDescription: i = "",
|
|
7
9
|
signatureError: t = "",
|
|
8
10
|
confirmationLabel: o,
|
|
9
|
-
confirmationError:
|
|
11
|
+
confirmationError: m = ""
|
|
10
12
|
}) {
|
|
11
|
-
return /* @__PURE__ */ s
|
|
13
|
+
return /* @__PURE__ */ n(s, { children: [
|
|
12
14
|
/* @__PURE__ */ e(
|
|
13
15
|
a,
|
|
14
16
|
{
|
|
@@ -25,12 +27,12 @@ function p({
|
|
|
25
27
|
name: "confirmSignature",
|
|
26
28
|
isRequired: !0,
|
|
27
29
|
label: o,
|
|
28
|
-
errorMessage:
|
|
30
|
+
errorMessage: m
|
|
29
31
|
}
|
|
30
32
|
)
|
|
31
33
|
] });
|
|
32
34
|
}
|
|
33
35
|
export {
|
|
34
|
-
|
|
36
|
+
f as SignatureFormFields
|
|
35
37
|
};
|
|
36
38
|
//# sourceMappingURL=SignatureFormFields.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignatureFormFields.js","sources":["../../../../src/components/Common/SignatureForm/SignatureFormFields.tsx"],"sourcesContent":["import { TextInputField, CheckboxField } from '@/components/Common'\n\ninterface SignatureFormFieldsProps {\n signatureLabel: string\n signatureDescription?: string\n signatureError?: string\n confirmationLabel: string\n confirmationError?: string\n}\n\nexport function SignatureFormFields({\n signatureLabel,\n signatureDescription = '',\n signatureError = '',\n confirmationLabel,\n confirmationError = '',\n}: SignatureFormFieldsProps) {\n return (\n <>\n <TextInputField\n name=\"signature\"\n label={signatureLabel}\n description={signatureDescription}\n errorMessage={signatureError}\n isRequired\n />\n <CheckboxField\n name=\"confirmSignature\"\n isRequired\n label={confirmationLabel}\n errorMessage={confirmationError}\n />\n </>\n )\n}\n"],"names":["SignatureFormFields","signatureLabel","signatureDescription","signatureError","confirmationLabel","confirmationError","jsxs","Fragment","jsx","TextInputField","CheckboxField"],"mappings":"
|
|
1
|
+
{"version":3,"file":"SignatureFormFields.js","sources":["../../../../src/components/Common/SignatureForm/SignatureFormFields.tsx"],"sourcesContent":["import { TextInputField, CheckboxField } from '@/components/Common'\n\ninterface SignatureFormFieldsProps {\n signatureLabel: string\n signatureDescription?: string\n signatureError?: string\n confirmationLabel: string\n confirmationError?: string\n}\n\nexport function SignatureFormFields({\n signatureLabel,\n signatureDescription = '',\n signatureError = '',\n confirmationLabel,\n confirmationError = '',\n}: SignatureFormFieldsProps) {\n return (\n <>\n <TextInputField\n name=\"signature\"\n label={signatureLabel}\n description={signatureDescription}\n errorMessage={signatureError}\n isRequired\n />\n <CheckboxField\n name=\"confirmSignature\"\n isRequired\n label={confirmationLabel}\n errorMessage={confirmationError}\n />\n </>\n )\n}\n"],"names":["SignatureFormFields","signatureLabel","signatureDescription","signatureError","confirmationLabel","confirmationError","jsxs","Fragment","jsx","TextInputField","CheckboxField"],"mappings":";;;;;AAUO,SAASA,EAAoB;AAAA,EAClC,gBAAAC;AAAA,EACA,sBAAAC,IAAuB;AAAA,EACvB,gBAAAC,IAAiB;AAAA,EACjB,mBAAAC;AAAA,EACA,mBAAAC,IAAoB;AACtB,GAA6B;AAC3B,SAEI,gBAAAC,EAAAC,GAAA,EAAA,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOR;AAAA,QACP,aAAaC;AAAA,QACb,cAAcC;AAAA,QACd,YAAU;AAAA,MAAA;AAAA,IACZ;AAAA,IACA,gBAAAK;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,YAAU;AAAA,QACV,OAAON;AAAA,QACP,cAAcC;AAAA,MAAA;AAAA,IAAA;AAAA,EAChB,GACF;AAEJ;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
1
|
+
import { jsx as o, jsxs as l } from "react/jsx-runtime";
|
|
2
2
|
import { ComboBox as A, Input as F, Button as j, Popover as D, ListBox as E, ListBoxItem as P } from "react-aria-components";
|
|
3
3
|
import { useTranslation as z } from "react-i18next";
|
|
4
4
|
import { useMemo as H } from "react";
|
|
5
5
|
import d from "classnames";
|
|
6
6
|
import { useFieldIds as K } from "../hooks/useFieldIds.js";
|
|
7
|
-
import
|
|
7
|
+
import e from "./ComboBox.module.scss.js";
|
|
8
8
|
import { FieldLayout as M } from "../../FieldLayout/FieldLayout.js";
|
|
9
9
|
import { useTheme as U } from "../../../../contexts/ThemeProvider/useTheme.js";
|
|
10
10
|
/* empty css */
|
|
@@ -12,68 +12,66 @@ import _ from "../../../../assets/icons/alert-circle.svg.js";
|
|
|
12
12
|
import $ from "../../../../assets/icons/caret-down.svg.js";
|
|
13
13
|
const rr = ({
|
|
14
14
|
className: p,
|
|
15
|
-
description:
|
|
16
|
-
errorMessage:
|
|
15
|
+
description: t,
|
|
16
|
+
errorMessage: i,
|
|
17
17
|
id: f,
|
|
18
18
|
isDisabled: u,
|
|
19
|
-
isInvalid:
|
|
19
|
+
isInvalid: m,
|
|
20
20
|
isRequired: h,
|
|
21
|
-
label:
|
|
21
|
+
label: a,
|
|
22
22
|
onChange: x,
|
|
23
23
|
onBlur: B,
|
|
24
|
-
options:
|
|
24
|
+
options: s,
|
|
25
25
|
placeholder: b,
|
|
26
|
-
value:
|
|
26
|
+
value: n,
|
|
27
27
|
inputRef: C,
|
|
28
28
|
shouldVisuallyHideLabel: g,
|
|
29
|
-
name:
|
|
30
|
-
...
|
|
29
|
+
name: I,
|
|
30
|
+
...v
|
|
31
31
|
}) => {
|
|
32
|
-
const { t: N } = z(), { inputId:
|
|
32
|
+
const { t: N } = z(), { inputId: c, errorMessageId: S, descriptionId: y, ariaDescribedBy: L } = K({
|
|
33
33
|
inputId: f,
|
|
34
|
-
errorMessage:
|
|
35
|
-
description:
|
|
36
|
-
}), { container: T } = U(), w = H(() =>
|
|
34
|
+
errorMessage: i,
|
|
35
|
+
description: t
|
|
36
|
+
}), { container: T } = U(), w = H(() => s.map((r) => ({ name: r.label, id: r.value })), [s]);
|
|
37
37
|
return /* @__PURE__ */ o(
|
|
38
38
|
M,
|
|
39
39
|
{
|
|
40
|
-
label:
|
|
41
|
-
htmlFor:
|
|
42
|
-
errorMessage:
|
|
40
|
+
label: a,
|
|
41
|
+
htmlFor: c,
|
|
42
|
+
errorMessage: i,
|
|
43
43
|
errorMessageId: S,
|
|
44
44
|
descriptionId: y,
|
|
45
45
|
isRequired: h,
|
|
46
|
-
description:
|
|
46
|
+
description: t,
|
|
47
47
|
shouldVisuallyHideLabel: g,
|
|
48
|
-
className: d(
|
|
48
|
+
className: d(e.root, p),
|
|
49
49
|
withErrorIcon: !1,
|
|
50
|
-
children: /* @__PURE__ */
|
|
50
|
+
children: /* @__PURE__ */ l(
|
|
51
51
|
A,
|
|
52
52
|
{
|
|
53
|
-
"aria-label":
|
|
53
|
+
"aria-label": a,
|
|
54
54
|
"aria-describedby": L,
|
|
55
55
|
className: "react-aria-ComboBox-root",
|
|
56
56
|
isDisabled: u,
|
|
57
|
-
isInvalid:
|
|
57
|
+
isInvalid: m,
|
|
58
58
|
menuTrigger: "focus",
|
|
59
59
|
onSelectionChange: (r) => {
|
|
60
60
|
r && x?.(r.toString());
|
|
61
61
|
},
|
|
62
|
-
id:
|
|
63
|
-
selectedKey:
|
|
64
|
-
name:
|
|
62
|
+
id: c,
|
|
63
|
+
selectedKey: n || void 0,
|
|
64
|
+
name: I,
|
|
65
65
|
children: [
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
] }) })
|
|
72
|
-
] }),
|
|
66
|
+
/* @__PURE__ */ o(F, { ref: C, placeholder: b, onBlur: B, ...v }),
|
|
67
|
+
/* @__PURE__ */ o(j, { children: /* @__PURE__ */ l("div", { "aria-hidden": "true", className: e.icons, children: [
|
|
68
|
+
m && /* @__PURE__ */ o(_, { fontSize: 16 }),
|
|
69
|
+
/* @__PURE__ */ o($, { title: N("icons.selectArrow") })
|
|
70
|
+
] }) }),
|
|
73
71
|
/* @__PURE__ */ o(
|
|
74
72
|
D,
|
|
75
73
|
{
|
|
76
|
-
className: d(
|
|
74
|
+
className: d(e.popover, "react-aria-Popover"),
|
|
77
75
|
UNSTABLE_portalContainer: T.current,
|
|
78
76
|
maxHeight: 320,
|
|
79
77
|
children: /* @__PURE__ */ o(E, { items: w, children: (r) => /* @__PURE__ */ o(P, { children: r.name }, r.id) })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboBox.js","sources":["../../../../../src/components/Common/UI/ComboBox/ComboBox.tsx"],"sourcesContent":["import type { Key } from 'react-aria-components'\nimport {\n ComboBox as AriaComboBox,\n Button,\n Input,\n ListBox,\n ListBoxItem,\n Popover,\n} from 'react-aria-components'\nimport { useTranslation } from 'react-i18next'\nimport { useMemo } from 'react'\nimport classNames from 'classnames'\nimport { useFieldIds } from '../hooks/useFieldIds'\nimport styles from './ComboBox.module.scss'\nimport type { ComboBoxProps } from './ComboBoxTypes'\nimport { FieldLayout } from '@/components/Common/FieldLayout'\nimport { useTheme } from '@/contexts/ThemeProvider'\nimport AlertCircle from '@/assets/icons/alert-circle.svg?react'\nimport CaretDown from '@/assets/icons/caret-down.svg?react'\n\nexport const ComboBox = ({\n className,\n description,\n errorMessage,\n id,\n isDisabled,\n isInvalid,\n isRequired,\n label,\n onChange,\n onBlur,\n options,\n placeholder,\n value,\n inputRef,\n shouldVisuallyHideLabel,\n name,\n ...props\n}: ComboBoxProps) => {\n const { t } = useTranslation()\n const { inputId, errorMessageId, descriptionId, ariaDescribedBy } = useFieldIds({\n inputId: id,\n errorMessage,\n description,\n })\n const { container } = useTheme()\n\n const items = useMemo(() => {\n return options.map(option => ({ name: option.label, id: option.value }))\n }, [options])\n\n return (\n <FieldLayout\n label={label}\n htmlFor={inputId}\n errorMessage={errorMessage}\n errorMessageId={errorMessageId}\n descriptionId={descriptionId}\n isRequired={isRequired}\n description={description}\n shouldVisuallyHideLabel={shouldVisuallyHideLabel}\n className={classNames(styles.root, className)}\n withErrorIcon={false}\n >\n <AriaComboBox\n aria-label={label}\n aria-describedby={ariaDescribedBy}\n className={'react-aria-ComboBox-root'}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n menuTrigger=\"focus\"\n onSelectionChange={key => {\n if (key) {\n onChange?.(key.toString())\n }\n }}\n id={inputId}\n selectedKey={value ? (value as Key) : undefined}\n name={name}\n >\n <
|
|
1
|
+
{"version":3,"file":"ComboBox.js","sources":["../../../../../src/components/Common/UI/ComboBox/ComboBox.tsx"],"sourcesContent":["import type { Key } from 'react-aria-components'\nimport {\n ComboBox as AriaComboBox,\n Button,\n Input,\n ListBox,\n ListBoxItem,\n Popover,\n} from 'react-aria-components'\nimport { useTranslation } from 'react-i18next'\nimport { useMemo } from 'react'\nimport classNames from 'classnames'\nimport { useFieldIds } from '../hooks/useFieldIds'\nimport styles from './ComboBox.module.scss'\nimport type { ComboBoxProps } from './ComboBoxTypes'\nimport { FieldLayout } from '@/components/Common/FieldLayout'\nimport { useTheme } from '@/contexts/ThemeProvider'\nimport AlertCircle from '@/assets/icons/alert-circle.svg?react'\nimport CaretDown from '@/assets/icons/caret-down.svg?react'\n\nexport const ComboBox = ({\n className,\n description,\n errorMessage,\n id,\n isDisabled,\n isInvalid,\n isRequired,\n label,\n onChange,\n onBlur,\n options,\n placeholder,\n value,\n inputRef,\n shouldVisuallyHideLabel,\n name,\n ...props\n}: ComboBoxProps) => {\n const { t } = useTranslation()\n const { inputId, errorMessageId, descriptionId, ariaDescribedBy } = useFieldIds({\n inputId: id,\n errorMessage,\n description,\n })\n const { container } = useTheme()\n\n const items = useMemo(() => {\n return options.map(option => ({ name: option.label, id: option.value }))\n }, [options])\n\n return (\n <FieldLayout\n label={label}\n htmlFor={inputId}\n errorMessage={errorMessage}\n errorMessageId={errorMessageId}\n descriptionId={descriptionId}\n isRequired={isRequired}\n description={description}\n shouldVisuallyHideLabel={shouldVisuallyHideLabel}\n className={classNames(styles.root, className)}\n withErrorIcon={false}\n >\n <AriaComboBox\n aria-label={label}\n aria-describedby={ariaDescribedBy}\n className={'react-aria-ComboBox-root'}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n menuTrigger=\"focus\"\n onSelectionChange={key => {\n if (key) {\n onChange?.(key.toString())\n }\n }}\n id={inputId}\n selectedKey={value ? (value as Key) : undefined}\n name={name}\n >\n <Input ref={inputRef} placeholder={placeholder} onBlur={onBlur} {...props} />\n <Button>\n <div aria-hidden=\"true\" className={styles.icons}>\n {isInvalid && <AlertCircle fontSize={16} />}\n <CaretDown title={t('icons.selectArrow')} />\n </div>\n </Button>\n\n <Popover\n className={classNames(styles.popover, 'react-aria-Popover')}\n UNSTABLE_portalContainer={container.current}\n maxHeight={320}\n >\n <ListBox items={items}>\n {item => <ListBoxItem key={item.id}>{item.name}</ListBoxItem>}\n </ListBox>\n </Popover>\n </AriaComboBox>\n </FieldLayout>\n )\n}\n"],"names":["ComboBox","className","description","errorMessage","id","isDisabled","isInvalid","isRequired","label","onChange","onBlur","options","placeholder","value","inputRef","shouldVisuallyHideLabel","name","props","t","useTranslation","inputId","errorMessageId","descriptionId","ariaDescribedBy","useFieldIds","container","useTheme","items","useMemo","option","jsx","FieldLayout","classNames","styles","jsxs","AriaComboBox","key","Input","Button","AlertCircle","CaretDown","Popover","ListBox","item","ListBoxItem"],"mappings":";;;;;;;;;;;;AAoBO,MAAMA,KAAW,CAAC;AAAA,EACvB,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,IAAAC;AAAA,EACA,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC;AAAA,EACA,aAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,MAAAC;AAAA,EACA,GAAGC;AACL,MAAqB;AACb,QAAA,EAAE,GAAAC,EAAE,IAAIC,EAAe,GACvB,EAAE,SAAAC,GAAS,gBAAAC,GAAgB,eAAAC,GAAe,iBAAAC,EAAA,IAAoBC,EAAY;AAAA,IAC9E,SAASpB;AAAA,IACT,cAAAD;AAAA,IACA,aAAAD;AAAA,EAAA,CACD,GACK,EAAE,WAAAuB,EAAU,IAAIC,EAAS,GAEzBC,IAAQC,EAAQ,MACbjB,EAAQ,IAAI,CAAAkB,OAAW,EAAE,MAAMA,EAAO,OAAO,IAAIA,EAAO,MAAQ,EAAA,GACtE,CAAClB,CAAO,CAAC;AAGV,SAAA,gBAAAmB;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,OAAAvB;AAAA,MACA,SAASY;AAAA,MACT,cAAAjB;AAAA,MACA,gBAAAkB;AAAA,MACA,eAAAC;AAAA,MACA,YAAAf;AAAA,MACA,aAAAL;AAAA,MACA,yBAAAa;AAAA,MACA,WAAWiB,EAAWC,EAAO,MAAMhC,CAAS;AAAA,MAC5C,eAAe;AAAA,MAEf,UAAA,gBAAAiC;AAAA,QAACC;AAAAA,QAAA;AAAA,UACC,cAAY3B;AAAA,UACZ,oBAAkBe;AAAA,UAClB,WAAW;AAAA,UACX,YAAAlB;AAAA,UACA,WAAAC;AAAA,UACA,aAAY;AAAA,UACZ,mBAAmB,CAAO8B,MAAA;AACxB,YAAIA,KACS3B,IAAA2B,EAAI,UAAU;AAAA,UAE7B;AAAA,UACA,IAAIhB;AAAA,UACJ,aAAaP,KAAyB;AAAA,UACtC,MAAAG;AAAA,UAEA,UAAA;AAAA,YAAA,gBAAAc,EAACO,KAAM,KAAKvB,GAAU,aAAAF,GAA0B,QAAAF,GAAiB,GAAGO,GAAO;AAAA,YAC3E,gBAAAa,EAACQ,KACC,UAAC,gBAAAJ,EAAA,OAAA,EAAI,eAAY,QAAO,WAAWD,EAAO,OACvC,UAAA;AAAA,cAAa3B,KAAA,gBAAAwB,EAACS,GAAY,EAAA,UAAU,GAAI,CAAA;AAAA,cACxC,gBAAAT,EAAAU,GAAA,EAAU,OAAOtB,EAAE,mBAAmB,EAAG,CAAA;AAAA,YAAA,EAAA,CAC5C,EACF,CAAA;AAAA,YAEA,gBAAAY;AAAA,cAACW;AAAA,cAAA;AAAA,gBACC,WAAWT,EAAWC,EAAO,SAAS,oBAAoB;AAAA,gBAC1D,0BAA0BR,EAAU;AAAA,gBACpC,WAAW;AAAA,gBAEX,UAAA,gBAAAK,EAACY,GAAQ,EAAA,OAAAf,GACN,UAAQ,CAAAgB,MAAA,gBAAAb,EAACc,KAA2B,UAAKD,EAAA,KAAA,GAAfA,EAAK,EAAe,EACjD,CAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UACF;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EACF;AAEJ;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
2
|
-
import { z as
|
|
1
|
+
import { jsx as o, jsxs as N, Fragment as _ } from "react/jsx-runtime";
|
|
2
|
+
import { z as e } from "zod";
|
|
3
3
|
import { useForm as O, FormProvider as u } from "react-hook-form";
|
|
4
4
|
import { zodResolver as E } from "@hookform/resolvers/zod";
|
|
5
5
|
import { SignatoryForm as g } from "./SignatoryForm.js";
|
|
@@ -8,16 +8,18 @@ import { AssignSignatorySelection as c } from "./AssignSignatorySelection.js";
|
|
|
8
8
|
import { SignatoryAssignmentMode as m, AssignSignatoryProvider as C } from "./useAssignSignatory.js";
|
|
9
9
|
import { companyEvents as i } from "../../../shared/constants.js";
|
|
10
10
|
import { Flex as M } from "../../Common/Flex/Flex.js";
|
|
11
|
+
import "react-i18next";
|
|
12
|
+
import "classnames";
|
|
11
13
|
import { BaseComponent as h } from "../../Base/Base.js";
|
|
12
14
|
import { useBase as I } from "../../Base/useBase.js";
|
|
13
15
|
import { useI18n as Y, useComponentDictionary as D } from "../../../i18n/I18n.js";
|
|
14
16
|
function s(n) {
|
|
15
17
|
return /* @__PURE__ */ o(h, { ...n, children: /* @__PURE__ */ o(F, { ...n, children: n.children }) });
|
|
16
18
|
}
|
|
17
|
-
const v =
|
|
18
|
-
signatoryAssignmentMode:
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const v = e.object({
|
|
20
|
+
signatoryAssignmentMode: e.union([
|
|
21
|
+
e.literal(m.createSignatory),
|
|
22
|
+
e.literal(m.inviteSignatory)
|
|
21
23
|
])
|
|
22
24
|
});
|
|
23
25
|
function F({
|
|
@@ -29,7 +31,7 @@ function F({
|
|
|
29
31
|
dictionary: f
|
|
30
32
|
}) {
|
|
31
33
|
Y("Company.AssignSignatory"), D("Company.AssignSignatory", f);
|
|
32
|
-
const { onEvent:
|
|
34
|
+
const { onEvent: t } = I(), d = O({
|
|
33
35
|
resolver: E(v),
|
|
34
36
|
defaultValues: {
|
|
35
37
|
signatoryAssignmentMode: m.createSignatory
|
|
@@ -43,13 +45,13 @@ function F({
|
|
|
43
45
|
signatoryId: A,
|
|
44
46
|
defaultValues: l,
|
|
45
47
|
onSignatoryAssignmentModeChange: (r) => {
|
|
46
|
-
|
|
48
|
+
t(i.COMPANY_ASSIGN_SIGNATORY_MODE_UPDATED, r);
|
|
47
49
|
},
|
|
48
|
-
onSignatoryFormEvent: (r,
|
|
49
|
-
r === i.COMPANY_CREATE_SIGNATORY_DONE ?
|
|
50
|
+
onSignatoryFormEvent: (r, p) => {
|
|
51
|
+
r === i.COMPANY_CREATE_SIGNATORY_DONE ? t(i.COMPANY_ASSIGN_SIGNATORY_DONE) : r === i.COMPANY_INVITE_SIGNATORY_DONE ? t(i.COMPANY_ASSIGN_SIGNATORY_DONE) : t(r, p);
|
|
50
52
|
}
|
|
51
53
|
},
|
|
52
|
-
children: /* @__PURE__ */ o(M, { flexDirection: "column", gap: 32, children: /* @__PURE__ */ o(u, { ...d, children: a || /* @__PURE__ */
|
|
54
|
+
children: /* @__PURE__ */ o(M, { flexDirection: "column", gap: 32, children: /* @__PURE__ */ o(u, { ...d, children: a || /* @__PURE__ */ N(_, { children: [
|
|
53
55
|
/* @__PURE__ */ o(S, {}),
|
|
54
56
|
/* @__PURE__ */ o(c, {}),
|
|
55
57
|
/* @__PURE__ */ o(g, {})
|