@gusto/embedded-react-sdk 0.10.5 → 0.10.6-rc.1

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.
Files changed (196) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/components/Base/Base.js +18 -19
  3. package/dist/components/Base/Base.js.map +1 -1
  4. package/dist/components/Common/OnboardingStatusBadge/index.d.ts +1 -1
  5. package/dist/components/Common/OnboardingStatusBadge/index.js.map +1 -1
  6. package/dist/components/Common/SignatureForm/SignatureForm.js +4 -6
  7. package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
  8. package/dist/components/Common/SignatureForm/SignatureFormActions.js +10 -12
  9. package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
  10. package/dist/components/Common/SignatureForm/SignatureFormFields.js +6 -8
  11. package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
  12. package/dist/components/Common/TaxInputs/TaxInputs.d.ts +1 -0
  13. package/dist/components/Common/TaxInputs/TaxInputs.js +100 -80
  14. package/dist/components/Common/TaxInputs/TaxInputs.js.map +1 -1
  15. package/dist/components/Company/AssignSignatory/AssignSignatory.js +11 -13
  16. package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
  17. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +6 -7
  18. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
  19. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +8 -9
  20. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
  21. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +0 -1
  22. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js.map +1 -1
  23. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +2 -3
  24. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
  25. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +1 -1
  26. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +6 -7
  27. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
  28. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +3 -4
  29. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js.map +1 -1
  30. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +9 -10
  31. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +1 -1
  32. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +1 -1
  33. package/dist/components/Company/AssignSignatory/TitleSelect.js +7 -8
  34. package/dist/components/Company/AssignSignatory/TitleSelect.js.map +1 -1
  35. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +1 -1
  36. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +2 -3
  37. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
  38. package/dist/components/Company/BankAccount/BankAccountForm/Form.js +7 -8
  39. package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
  40. package/dist/components/Company/BankAccount/BankAccountForm/context.js +1 -1
  41. package/dist/components/Company/BankAccount/BankAccountList/Actions.js +6 -7
  42. package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
  43. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +7 -8
  44. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
  45. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +4 -5
  46. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
  47. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +5 -6
  48. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
  49. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +15 -17
  50. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  51. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +1 -1
  52. package/dist/components/Company/DocumentSigner/DocumentSigner.js +24 -22
  53. package/dist/components/Company/DocumentSigner/DocumentSigner.js.map +1 -1
  54. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +7 -9
  55. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  56. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +1 -1
  57. package/dist/components/Company/FederalTaxes/Actions.js +6 -7
  58. package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
  59. package/dist/components/Company/FederalTaxes/FederalTaxes.js +15 -17
  60. package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
  61. package/dist/components/Company/FederalTaxes/Form.js +2 -3
  62. package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
  63. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +1 -1
  64. package/dist/components/Company/Industry/Actions.js +5 -6
  65. package/dist/components/Company/Industry/Actions.js.map +1 -1
  66. package/dist/components/Company/Industry/Context.js +1 -1
  67. package/dist/components/Company/Industry/Edit.js +10 -11
  68. package/dist/components/Company/Industry/Edit.js.map +1 -1
  69. package/dist/components/Company/Locations/LocationForm/Actions.js +2 -3
  70. package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
  71. package/dist/components/Company/Locations/LocationForm/Form.js +4 -5
  72. package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
  73. package/dist/components/Company/Locations/LocationForm/LocationForm.js +7 -9
  74. package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
  75. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +1 -1
  76. package/dist/components/Company/Locations/Locations.js +25 -21
  77. package/dist/components/Company/Locations/Locations.js.map +1 -1
  78. package/dist/components/Company/Locations/LocationsList/Actions.js +2 -3
  79. package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
  80. package/dist/components/Company/Locations/LocationsList/List.js +2 -3
  81. package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
  82. package/dist/components/Company/Locations/LocationsList/LocationsList.js +9 -11
  83. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  84. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +1 -1
  85. package/dist/components/Company/OnboardingOverview/Completed.js +5 -6
  86. package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
  87. package/dist/components/Company/OnboardingOverview/MissingRequirements.js +2 -3
  88. package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
  89. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +2 -4
  90. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
  91. package/dist/components/Company/OnboardingOverview/context.js +1 -1
  92. package/dist/components/Company/PaySchedule/PaySchedule.js +16 -18
  93. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  94. package/dist/components/Company/PaySchedule/_parts/Actions.js +10 -11
  95. package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
  96. package/dist/components/Company/PaySchedule/_parts/Edit.js +25 -26
  97. package/dist/components/Company/PaySchedule/_parts/Edit.js.map +1 -1
  98. package/dist/components/Company/PaySchedule/_parts/Head.js +2 -3
  99. package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
  100. package/dist/components/Company/PaySchedule/_parts/List.js +5 -6
  101. package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
  102. package/dist/components/Company/PaySchedule/usePaySchedule.js +1 -1
  103. package/dist/components/Company/StateTaxes/StateTaxes.js +22 -18
  104. package/dist/components/Company/StateTaxes/StateTaxes.js.map +1 -1
  105. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +5 -6
  106. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
  107. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +14 -14
  108. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
  109. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +1 -1
  110. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +6 -7
  111. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
  112. package/dist/components/Company/StateTaxes/StateTaxesList/List.js +5 -6
  113. package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
  114. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +1 -1
  115. package/dist/components/Contractor/Address/Address.js +0 -2
  116. package/dist/components/Contractor/Address/Address.js.map +1 -1
  117. package/dist/components/Contractor/Address/Form.js +2 -3
  118. package/dist/components/Contractor/Address/Form.js.map +1 -1
  119. package/dist/components/Contractor/Address/useAddress.js +1 -1
  120. package/dist/components/Contractor/List/index.js +2 -3
  121. package/dist/components/Contractor/List/index.js.map +1 -1
  122. package/dist/components/Contractor/NewHireReport/NewHireReport.js +16 -17
  123. package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
  124. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +2 -3
  125. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
  126. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +2 -3
  127. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
  128. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +2 -3
  129. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -1
  130. package/dist/components/Employee/Compensation/Actions.js +4 -5
  131. package/dist/components/Employee/Compensation/Actions.js.map +1 -1
  132. package/dist/components/Employee/Compensation/Edit.js +2 -3
  133. package/dist/components/Employee/Compensation/Edit.js.map +1 -1
  134. package/dist/components/Employee/Compensation/List.js +5 -6
  135. package/dist/components/Employee/Compensation/List.js.map +1 -1
  136. package/dist/components/Employee/Deductions/Actions.js +8 -9
  137. package/dist/components/Employee/Deductions/Actions.js.map +1 -1
  138. package/dist/components/Employee/Deductions/DeductionForm.js +2 -3
  139. package/dist/components/Employee/Deductions/DeductionForm.js.map +1 -1
  140. package/dist/components/Employee/Deductions/DeductionsList.js +2 -3
  141. package/dist/components/Employee/Deductions/DeductionsList.js.map +1 -1
  142. package/dist/components/Employee/Deductions/IncludeDeductionsForm.js +2 -3
  143. package/dist/components/Employee/Deductions/IncludeDeductionsForm.js.map +1 -1
  144. package/dist/components/Employee/Deductions/useDeductions.js +1 -1
  145. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +4 -5
  146. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
  147. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +10 -12
  148. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  149. package/dist/components/Employee/DocumentSigner/DocumentList/List.js +2 -3
  150. package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
  151. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +1 -1
  152. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +8 -10
  153. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  154. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +1 -1
  155. package/dist/components/Employee/EmployeeList/Actions.js +4 -5
  156. package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
  157. package/dist/components/Employee/EmployeeList/EmployeeList.js +9 -11
  158. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  159. package/dist/components/Employee/EmployeeList/Head.js +2 -3
  160. package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
  161. package/dist/components/Employee/EmployeeList/List.js +2 -3
  162. package/dist/components/Employee/EmployeeList/List.js.map +1 -1
  163. package/dist/components/Employee/EmployeeList/useEmployeeList.js +1 -1
  164. package/dist/components/Employee/Landing/Landing.js +6 -7
  165. package/dist/components/Employee/Landing/Landing.js.map +1 -1
  166. package/dist/components/Employee/PaymentMethod/Actions.js +5 -6
  167. package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
  168. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +2 -3
  169. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
  170. package/dist/components/Employee/PaymentMethod/BankAccountsList.js +2 -3
  171. package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
  172. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +2 -3
  173. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
  174. package/dist/components/Employee/PaymentMethod/Split.js +2 -3
  175. package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
  176. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +1 -1
  177. package/dist/components/Employee/Profile/Actions.js +6 -7
  178. package/dist/components/Employee/Profile/Actions.js.map +1 -1
  179. package/dist/components/Employee/Profile/AdminPersonalDetails.js +9 -10
  180. package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
  181. package/dist/components/Employee/Profile/HomeAddress.js +4 -5
  182. package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
  183. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +8 -9
  184. package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
  185. package/dist/components/Employee/Profile/useProfile.js +1 -1
  186. package/dist/components/Employee/Taxes/Actions.js +7 -8
  187. package/dist/components/Employee/Taxes/Actions.js.map +1 -1
  188. package/dist/components/Employee/Taxes/FederalForm.js +4 -5
  189. package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
  190. package/dist/components/Employee/Taxes/useTaxes.js +1 -1
  191. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +2 -3
  192. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  193. package/dist/shared/constants.js +1 -1
  194. package/dist/shared/constants.js.map +1 -1
  195. package/dist/style.css +1 -1
  196. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.6
4
+
5
+ ### Fixes
6
+
7
+ - Fixed company state taxes validation issue
8
+ - Fixed document signer state machine signatory issues
9
+
3
10
  ## 0.10.5
4
11
 
5
12
  ### Fixes
@@ -10,40 +10,39 @@ 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";
14
13
  import { InternalError as P } from "../Common/InternalError/InternalError.js";
15
14
  import { snakeCaseToCamelCase as w } from "../../helpers/formattedStrings.js";
16
15
  import { useComponentContext as M } from "../../contexts/ComponentAdapter/useComponentContext.js";
17
16
  import { useLoadingIndicator as O } from "../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
18
- const U = (t) => t.map((n) => n.message ? /* @__PURE__ */ o("li", { children: n.message }, n.key) : null), k = (t, n) => {
17
+ const U = (e) => e.map((n) => n.message ? /* @__PURE__ */ o("li", { children: n.message }, n.key) : null), k = (e, n) => {
19
18
  const m = n ? n + "." : "";
20
- if (t.category === "invalid_attribute_value" || t.category === "invalid_operation")
19
+ if (e.category === "invalid_attribute_value" || e.category === "invalid_operation")
21
20
  return [
22
21
  {
23
- key: w(m + t.errorKey),
24
- message: t.message ?? ""
22
+ key: w(m + e.errorKey),
23
+ message: e.message ?? ""
25
24
  }
26
25
  ];
27
- if (t.category === "nested_errors" && t.errors !== void 0) {
26
+ if (e.category === "nested_errors" && e.errors !== void 0) {
28
27
  let s = "";
29
- return t.metadata?.key && typeof t.metadata.key == "string" ? s = t.metadata.key : t.metadata?.state && typeof t.metadata.state == "string" ? s = t.metadata.state : t.errorKey && (s = t.errorKey), t.errors.flatMap((r) => k(r, m + s));
28
+ return e.metadata?.key && typeof e.metadata.key == "string" ? s = e.metadata.key : e.metadata?.state && typeof e.metadata.state == "string" ? s = e.metadata.state : e.errorKey && (s = e.errorKey), e.errors.flatMap((r) => k(r, m + s));
30
29
  }
31
30
  return [];
32
- }, ot = ({
33
- children: t,
31
+ }, re = ({
32
+ children: e,
34
33
  FallbackComponent: n = P,
35
34
  LoaderComponent: m,
36
35
  onEvent: s
37
36
  }) => {
38
- const [r, l] = y(null), [c, f] = y(null), p = K(), { t: x } = B(), d = M(), { LoadingIndicator: b } = O(), v = m ?? b, I = E((e) => {
39
- l(e), e || f(null);
40
- }, []), A = (e) => {
41
- l(e), e instanceof h && Array.isArray(e.errors) && f(e.errors.flatMap((a) => k(a)));
37
+ const [r, l] = y(null), [c, f] = y(null), p = K(), { t: x } = B(), d = M(), { LoadingIndicator: b } = O(), v = m ?? b, I = E((t) => {
38
+ l(t), t || f(null);
39
+ }, []), A = (t) => {
40
+ l(t), t instanceof h && Array.isArray(t.errors) && f(t.errors.flatMap((a) => k(a)));
42
41
  }, L = E(
43
- async (e, a) => {
42
+ async (t, a) => {
44
43
  l(null), f(null);
45
44
  try {
46
- await a(e);
45
+ await a(t);
47
46
  } catch (i) {
48
47
  i instanceof g || i instanceof C || i instanceof h ? A(i) : p(i);
49
48
  }
@@ -60,11 +59,11 @@ const U = (t) => t.map((n) => n.message ? /* @__PURE__ */ o("li", { children: n.
60
59
  throwError: p,
61
60
  baseSubmitHandler: L
62
61
  },
63
- children: /* @__PURE__ */ o(T, { children: ({ reset: e }) => /* @__PURE__ */ u(
62
+ children: /* @__PURE__ */ o(T, { children: ({ reset: t }) => /* @__PURE__ */ u(
64
63
  S,
65
64
  {
66
65
  FallbackComponent: n,
67
- onReset: e,
66
+ onReset: t,
68
67
  onError: (a) => {
69
68
  s(F.ERROR, a);
70
69
  },
@@ -74,7 +73,7 @@ const U = (t) => t.map((n) => n.message ? /* @__PURE__ */ o("li", { children: n.
74
73
  r && r instanceof g && /* @__PURE__ */ o(d.Text, { children: r.message }),
75
74
  r && r instanceof C && /* @__PURE__ */ o(d.Text, { as: "pre", children: r.pretty() })
76
75
  ] }),
77
- /* @__PURE__ */ o(R, { fallback: /* @__PURE__ */ o(v, {}), children: /* @__PURE__ */ o(_, { children: t }) })
76
+ /* @__PURE__ */ o(R, { fallback: /* @__PURE__ */ o(v, {}), children: /* @__PURE__ */ o(_, { children: e }) })
78
77
  ]
79
78
  }
80
79
  ) })
@@ -82,6 +81,6 @@ const U = (t) => t.map((n) => n.message ? /* @__PURE__ */ o("li", { children: n.
82
81
  );
83
82
  };
84
83
  export {
85
- ot as BaseComponent
84
+ re as BaseComponent
86
85
  };
87
86
  //# 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 }}\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,6 +1,6 @@
1
1
  import "./types/i18next.d.ts"
2
2
  import { ContractorOnboardingStatus1 } from '@gusto/embedded-api/models/components/contractor';
3
- import { OnboardingStatus } from '@gusto/embedded-api/models/components/employee';
3
+ import { OnboardingStatus } from '@gusto/embedded-api/models/operations/putv1employeesemployeeidonboardingstatus';
4
4
  type OnboardingStatuses = ContractorOnboardingStatus1 | OnboardingStatus;
5
5
  interface OnboardingStatusBadgeProps<T extends OnboardingStatuses> {
6
6
  onboarded?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/Common/OnboardingStatusBadge/index.tsx"],"sourcesContent":["import type { ContractorOnboardingStatus1 } from '@gusto/embedded-api/models/components/contractor'\nimport type { OnboardingStatus } from '@gusto/embedded-api/models/components/employee'\nimport { useTranslation } from 'react-i18next'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\ntype OnboardingStatuses = ContractorOnboardingStatus1 | OnboardingStatus\n\ninterface OnboardingStatusBadgeProps<T extends OnboardingStatuses> {\n onboarded?: boolean\n onboardingEntity: 'contractor' | 'employee'\n onboardingStatus?: T | null\n}\nexport const OnboardingStatusBadge = <T extends OnboardingStatuses>({\n onboarded,\n onboardingEntity,\n onboardingStatus,\n}: OnboardingStatusBadgeProps<T>) => {\n const { Badge } = useComponentContext()\n const { t } = useTranslation()\n\n //HACK: `never` should instead be a better type\n return (\n <Badge status={onboarded ? 'success' : 'warning'}>\n {t(`onboardingStatus.${onboardingEntity}.${onboardingStatus ?? 'undefined'}` as never)}\n </Badge>\n )\n}\n\ninterface ContractorOnboardingStatusBadgeProps {\n onboarded?: boolean\n onboardingStatus?: ContractorOnboardingStatus1 | null\n}\nexport const ContractorOnboardingStatusBadge = (props: ContractorOnboardingStatusBadgeProps) => (\n <OnboardingStatusBadge {...props} onboardingEntity=\"contractor\" />\n)\n\ninterface EmployeeOnboardingStatusBadgeProps {\n onboarded?: boolean\n onboardingStatus?: OnboardingStatus | null\n}\nexport const EmployeeOnboardingStatusBadge = (props: EmployeeOnboardingStatusBadgeProps) => (\n <OnboardingStatusBadge {...props} onboardingEntity=\"employee\" />\n)\n"],"names":["OnboardingStatusBadge","onboarded","onboardingEntity","onboardingStatus","Badge","useComponentContext","t","useTranslation","jsx","ContractorOnboardingStatusBadge","props","EmployeeOnboardingStatusBadge"],"mappings":";;;AAYO,MAAMA,IAAwB,CAA+B;AAAA,EAClE,WAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,kBAAAC;AACF,MAAqC;AAC7B,QAAA,EAAE,OAAAC,EAAM,IAAIC,EAAoB,GAChC,EAAE,GAAAC,EAAE,IAAIC,EAAe;AAG7B,SACG,gBAAAC,EAAAJ,GAAA,EAAM,QAAQH,IAAY,YAAY,WACpC,UAAEK,EAAA,oBAAoBJ,CAAgB,IAAIC,KAAoB,WAAW,EAAW,GACvF;AAEJ,GAMaM,IAAkC,CAACC,MAC9C,gBAAAF,EAACR,KAAuB,GAAGU,GAAO,kBAAiB,aAAa,CAAA,GAOrDC,IAAgC,CAACD,MAC5C,gBAAAF,EAACR,KAAuB,GAAGU,GAAO,kBAAiB,WAAW,CAAA;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Common/OnboardingStatusBadge/index.tsx"],"sourcesContent":["import type { ContractorOnboardingStatus1 } from '@gusto/embedded-api/models/components/contractor'\nimport type { OnboardingStatus } from '@gusto/embedded-api/models/operations/putv1employeesemployeeidonboardingstatus'\nimport { useTranslation } from 'react-i18next'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\ntype OnboardingStatuses = ContractorOnboardingStatus1 | OnboardingStatus\n\ninterface OnboardingStatusBadgeProps<T extends OnboardingStatuses> {\n onboarded?: boolean\n onboardingEntity: 'contractor' | 'employee'\n onboardingStatus?: T | null\n}\nexport const OnboardingStatusBadge = <T extends OnboardingStatuses>({\n onboarded,\n onboardingEntity,\n onboardingStatus,\n}: OnboardingStatusBadgeProps<T>) => {\n const { Badge } = useComponentContext()\n const { t } = useTranslation()\n\n //HACK: `never` should instead be a better type\n return (\n <Badge status={onboarded ? 'success' : 'warning'}>\n {t(`onboardingStatus.${onboardingEntity}.${onboardingStatus ?? 'undefined'}` as never)}\n </Badge>\n )\n}\n\ninterface ContractorOnboardingStatusBadgeProps {\n onboarded?: boolean\n onboardingStatus?: ContractorOnboardingStatus1 | null\n}\nexport const ContractorOnboardingStatusBadge = (props: ContractorOnboardingStatusBadgeProps) => (\n <OnboardingStatusBadge {...props} onboardingEntity=\"contractor\" />\n)\n\ninterface EmployeeOnboardingStatusBadgeProps {\n onboarded?: boolean\n onboardingStatus?: OnboardingStatus | null\n}\nexport const EmployeeOnboardingStatusBadge = (props: EmployeeOnboardingStatusBadgeProps) => (\n <OnboardingStatusBadge {...props} onboardingEntity=\"employee\" />\n)\n"],"names":["OnboardingStatusBadge","onboarded","onboardingEntity","onboardingStatus","Badge","useComponentContext","t","useTranslation","jsx","ContractorOnboardingStatusBadge","props","EmployeeOnboardingStatusBadge"],"mappings":";;;AAYO,MAAMA,IAAwB,CAA+B;AAAA,EAClE,WAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,kBAAAC;AACF,MAAqC;AAC7B,QAAA,EAAE,OAAAC,EAAM,IAAIC,EAAoB,GAChC,EAAE,GAAAC,EAAE,IAAIC,EAAe;AAG7B,SACG,gBAAAC,EAAAJ,GAAA,EAAM,QAAQH,IAAY,YAAY,WACpC,UAAEK,EAAA,oBAAoBJ,CAAgB,IAAIC,KAAoB,WAAW,EAAW,GACvF;AAEJ,GAMaM,IAAkC,CAACC,MAC9C,gBAAAF,EAACR,KAAuB,GAAGU,GAAO,kBAAiB,aAAa,CAAA,GAOrDC,IAAgC,CAACD,MAC5C,gBAAAF,EAACR,KAAuB,GAAGU,GAAO,kBAAiB,WAAW,CAAA;"}
@@ -5,24 +5,22 @@ 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";
10
8
  const f = o.object({
11
9
  signature: o.string().min(1),
12
10
  confirmSignature: o.literal(!0)
13
- }), p = {
11
+ }), d = {
14
12
  signature: ""
15
13
  };
16
- function z({ onSubmit: m, children: i, formProps: n }) {
14
+ function b({ onSubmit: m, children: i, formProps: n }) {
17
15
  const e = s({
18
16
  resolver: l(f),
19
- defaultValues: p,
17
+ defaultValues: d,
20
18
  ...n
21
19
  });
22
20
  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 }) }) }) });
23
21
  }
24
22
  export {
25
- z as SignatureForm,
23
+ b as SignatureForm,
26
24
  f as SignatureFormSchema
27
25
  };
28
26
  //# 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":";;;;;;;;;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
+ {"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,21 +1,19 @@
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({
1
+ import { jsxs as s, jsx as n } from "react/jsx-runtime";
2
+ import { ActionsLayout as m } from "../ActionsLayout/ActionsLayout.js";
3
+ import { useComponentContext as u } from "../../../contexts/ComponentAdapter/useComponentContext.js";
4
+ function f({
7
5
  onBack: t,
8
6
  backLabel: r,
9
- submitLabel: i,
10
- isLoading: e = !1
7
+ submitLabel: e,
8
+ isLoading: i = !1
11
9
  }) {
12
- const o = p();
13
- return /* @__PURE__ */ m(s, { children: [
10
+ const o = u();
11
+ return /* @__PURE__ */ s(m, { children: [
14
12
  t && /* @__PURE__ */ n(o.Button, { variant: "secondary", type: "button", onClick: t, children: r }),
15
- /* @__PURE__ */ n(o.Button, { type: "submit", isLoading: e, children: i })
13
+ /* @__PURE__ */ n(o.Button, { type: "submit", isLoading: i, children: e })
16
14
  ] });
17
15
  }
18
16
  export {
19
- d as SignatureFormActions
17
+ f as SignatureFormActions
20
18
  };
21
19
  //# 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":";;;;;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
+ {"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,16 +1,14 @@
1
- import { jsxs as n, Fragment as s, jsx as e } from "react/jsx-runtime";
2
- import "react-i18next";
3
- import "classnames";
1
+ import { jsxs as s, Fragment as m, jsx as e } from "react/jsx-runtime";
4
2
  import { TextInputField as a } from "../Fields/TextInputField/TextInputField.js";
5
3
  import { CheckboxField as u } from "../Fields/CheckboxField/CheckboxField.js";
6
- function f({
4
+ function p({
7
5
  signatureLabel: r,
8
6
  signatureDescription: i = "",
9
7
  signatureError: t = "",
10
8
  confirmationLabel: o,
11
- confirmationError: m = ""
9
+ confirmationError: n = ""
12
10
  }) {
13
- return /* @__PURE__ */ n(s, { children: [
11
+ return /* @__PURE__ */ s(m, { children: [
14
12
  /* @__PURE__ */ e(
15
13
  a,
16
14
  {
@@ -27,12 +25,12 @@ function f({
27
25
  name: "confirmSignature",
28
26
  isRequired: !0,
29
27
  label: o,
30
- errorMessage: m
28
+ errorMessage: n
31
29
  }
32
30
  )
33
31
  ] });
34
32
  }
35
33
  export {
36
- f as SignatureFormFields
34
+ p as SignatureFormFields
37
35
  };
38
36
  //# 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":";;;;;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
+ {"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;"}
@@ -22,4 +22,5 @@ export declare function TextInput({ question, requirement, isDisabled }: EmpQ |
22
22
  export declare function NumberInput({ question, requirement, isCurrency, isPercent, isDisabled, }: (EmpQ | CompR) & NumberFieldProps): import("react/jsx-runtime").JSX.Element | null;
23
23
  export declare function RadioInput({ question, requirement, isDisabled }: EmpQ | CompR): import("react/jsx-runtime").JSX.Element | null;
24
24
  export declare function DateField({ question, requirement, isDisabled, }: (EmpQ | CompR) & NumberFieldProps): import("react/jsx-runtime").JSX.Element | null;
25
+ export declare function TaxRateInput({ requirement, question, ...props }: EmpQ | CompR): import("react/jsx-runtime").JSX.Element;
25
26
  export {};
@@ -1,118 +1,118 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import v from "dompurify";
3
- import { useTranslation as w } from "react-i18next";
4
- import { SelectField as y } from "../Fields/SelectField/SelectField.js";
5
- import { TextInputField as b } from "../Fields/TextInputField/TextInputField.js";
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import b from "dompurify";
3
+ import { useTranslation as y } from "react-i18next";
4
+ import { SelectField as m } from "../Fields/SelectField/SelectField.js";
5
+ import { TextInputField as w } from "../Fields/TextInputField/TextInputField.js";
6
6
  import { NumberInputField as k } from "../Fields/NumberInputField/NumberInputField.js";
7
- import { RadioGroupField as _ } from "../Fields/RadioGroupField/RadioGroupField.js";
8
- import { DatePickerField as D } from "../Fields/DatePickerField/DatePickerField.js";
9
- import { useComponentContext as R } from "../../../contexts/ComponentAdapter/useComponentContext.js";
10
- import { useMaskedTransform as h } from "../../../helpers/mask.js";
11
- const C = { ALLOWED_TAGS: ["a", "b", "strong"], ALLOWED_ATTR: ["target", "href"] };
12
- function V({
13
- questionType: t,
14
- ...e
7
+ import { RadioGroupField as R } from "../Fields/RadioGroupField/RadioGroupField.js";
8
+ import { DatePickerField as _ } from "../Fields/DatePickerField/DatePickerField.js";
9
+ import { useComponentContext as D } from "../../../contexts/ComponentAdapter/useComponentContext.js";
10
+ import { useMaskedTransform as T } from "../../../helpers/mask.js";
11
+ const h = { ALLOWED_TAGS: ["a", "b", "strong"], ALLOWED_ATTR: ["target", "href"] };
12
+ function M({
13
+ questionType: e,
14
+ ...t
15
15
  }) {
16
- switch (t.toLowerCase()) {
16
+ switch (e.toLowerCase()) {
17
17
  case "date":
18
- return /* @__PURE__ */ r(I, { ...e });
18
+ return /* @__PURE__ */ a(I, { ...t });
19
19
  case "radio":
20
- return /* @__PURE__ */ r(x, { ...e });
20
+ return /* @__PURE__ */ a(C, { ...t });
21
21
  case "text":
22
22
  case "account_number":
23
- return /* @__PURE__ */ r(f, { ...e });
23
+ return /* @__PURE__ */ a(f, { ...t });
24
24
  case "select":
25
- return /* @__PURE__ */ r(T, { ...e });
25
+ return /* @__PURE__ */ a(x, { ...t });
26
26
  case "number":
27
- return /* @__PURE__ */ r(d, { ...e });
27
+ return /* @__PURE__ */ a(d, { ...t });
28
28
  case "workers_compensation_rate":
29
- return /* @__PURE__ */ r(d, { ...e, isPercent: e.requirement?.metadata?.rateType === "percent" });
29
+ return /* @__PURE__ */ a(d, { ...t, isPercent: t.requirement?.metadata?.rateType === "percent" });
30
30
  case "percent":
31
31
  case "tax_rate":
32
- return /* @__PURE__ */ r(d, { ...e, isPercent: !0 });
32
+ return /* @__PURE__ */ a(g, { ...t });
33
33
  case "currency":
34
- return /* @__PURE__ */ r(d, { ...e, isCurrency: !0 });
34
+ return /* @__PURE__ */ a(d, { ...t, isCurrency: !0 });
35
35
  default:
36
- return /* @__PURE__ */ r(f, { ...e });
36
+ return /* @__PURE__ */ a(f, { ...t });
37
37
  }
38
38
  }
39
- function T({ question: t, requirement: e, isDisabled: s = !1 }) {
40
- const { key: a, label: i, description: l } = t || e, n = t ? t.answers[0]?.value : e.value, o = t ? t.inputQuestionFormat : e.metadata;
39
+ function x({ question: e, requirement: t, isDisabled: l = !1 }) {
40
+ const { key: r, label: u, description: i } = e || t, n = e ? e.answers[0]?.value : t.value, o = e ? e.inputQuestionFormat : t.metadata;
41
41
  if (!o?.options) throw new Error("Select input must have options");
42
- return a ? /* @__PURE__ */ r(
43
- y,
42
+ return r ? /* @__PURE__ */ a(
43
+ m,
44
44
  {
45
45
  isRequired: !0,
46
- name: a,
46
+ name: r,
47
47
  defaultValue: n,
48
- label: i,
49
- description: l,
50
- isDisabled: a.includes("fileNewHireReport") ? n !== void 0 : s,
51
- options: o.options.map((u, c) => ({
52
- value: u.value,
53
- label: u.label
48
+ label: u,
49
+ description: i,
50
+ isDisabled: r.includes("fileNewHireReport") ? n !== void 0 : l,
51
+ options: o.options.map((s, c) => ({
52
+ value: s.value,
53
+ label: s.label
54
54
  }))
55
55
  }
56
56
  ) : null;
57
57
  }
58
- function f({ question: t, requirement: e, isDisabled: s = !1 }) {
59
- const { key: a, label: i, description: l } = t || e, n = t ? t.answers[0]?.value : e.value, o = e?.metadata?.mask ?? null, u = h(o);
60
- return a ? /* @__PURE__ */ r(
61
- b,
58
+ function f({ question: e, requirement: t, isDisabled: l = !1 }) {
59
+ const { key: r, label: u, description: i } = e || t, n = e ? e.answers[0]?.value : t.value, o = t?.metadata?.mask ?? null, s = T(o);
60
+ return r ? /* @__PURE__ */ a(
61
+ w,
62
62
  {
63
63
  isRequired: !0,
64
- name: a,
65
- label: i,
64
+ name: r,
65
+ label: u,
66
66
  defaultValue: n,
67
- description: l,
68
- isDisabled: s,
69
- transform: o ? u : void 0,
67
+ description: i,
68
+ isDisabled: l,
69
+ transform: o ? s : void 0,
70
70
  placeholder: o || void 0
71
71
  }
72
72
  ) : null;
73
73
  }
74
74
  function d({
75
- question: t,
76
- requirement: e,
77
- isCurrency: s,
78
- isPercent: a,
79
- isDisabled: i = !1
75
+ question: e,
76
+ requirement: t,
77
+ isCurrency: l,
78
+ isPercent: r,
79
+ isDisabled: u = !1
80
80
  }) {
81
- const { t: l } = w("common"), { key: n, label: o, description: u } = t || e, c = t ? t.answers[0]?.value : e.value;
81
+ const { t: i } = y("common"), { key: n, label: o, description: s } = e || t, c = e ? e.answers[0]?.value : t.value;
82
82
  if (!n) return null;
83
- const m = e?.metadata?.type === "workers_compensation_rate" && e.metadata.riskClassCode !== void 0 ? `${e.metadata.riskClassCode}: ${e.metadata.riskClassDescription}` : null, p = e?.metadata?.rateType === "currency_per_hour" ? l("inputs.workersCompensationRatePerHourAdornment") : void 0;
84
- return /* @__PURE__ */ r(
83
+ const p = t?.metadata?.type === "workers_compensation_rate" && t.metadata.riskClassCode !== void 0 ? `${t.metadata.riskClassCode}: ${t.metadata.riskClassDescription}` : null, v = t?.metadata?.rateType === "currency_per_hour" ? i("inputs.workersCompensationRatePerHourAdornment") : void 0;
84
+ return /* @__PURE__ */ a(
85
85
  k,
86
86
  {
87
87
  isRequired: !0,
88
88
  name: n,
89
89
  label: o,
90
- description: u ?? m,
90
+ description: s ?? p,
91
91
  defaultValue: typeof c < "u" ? Number(c) : void 0,
92
- format: s ? "currency" : a ? "percent" : "decimal",
93
- isDisabled: i,
94
- maximumFractionDigits: a ? 4 : void 0,
95
- adornmentEnd: p
92
+ format: l ? "currency" : r ? "percent" : "decimal",
93
+ isDisabled: u,
94
+ maximumFractionDigits: r ? 4 : void 0,
95
+ adornmentEnd: v
96
96
  }
97
97
  );
98
98
  }
99
- function x({ question: t, requirement: e, isDisabled: s = !1 }) {
100
- const { key: a, label: i, description: l } = t || e, n = t ? t.answers[0]?.value : e.value, { Text: o } = R(), u = t ? t.inputQuestionFormat : e.metadata;
101
- if (!u?.options) throw new Error(`RadioInput must have options:${JSON.stringify(t)}`);
102
- return a ? /* @__PURE__ */ r(
103
- _,
99
+ function C({ question: e, requirement: t, isDisabled: l = !1 }) {
100
+ const { key: r, label: u, description: i } = e || t, n = e ? e.answers[0]?.value : t.value, { Text: o } = D(), s = e ? e.inputQuestionFormat : t.metadata;
101
+ if (!s?.options) throw new Error(`RadioInput must have options:${JSON.stringify(e)}`);
102
+ return r ? /* @__PURE__ */ a(
103
+ R,
104
104
  {
105
105
  isRequired: !0,
106
- name: a,
107
- isDisabled: a.includes("fileNewHireReport") ? n !== void 0 : s,
108
- description: l && /* @__PURE__ */ r(o, { as: "span", children: /* @__PURE__ */ r(
106
+ name: r,
107
+ isDisabled: r.includes("fileNewHireReport") ? n !== void 0 : l,
108
+ description: i && /* @__PURE__ */ a(o, { as: "span", children: /* @__PURE__ */ a(
109
109
  "span",
110
110
  {
111
- dangerouslySetInnerHTML: { __html: v.sanitize(l, C) }
111
+ dangerouslySetInnerHTML: { __html: b.sanitize(i, h) }
112
112
  }
113
113
  ) }),
114
- label: i,
115
- options: u.options.map((c) => ({
114
+ label: u,
115
+ options: s.options.map((c) => ({
116
116
  value: c.value,
117
117
  label: c.label
118
118
  }))
@@ -120,31 +120,51 @@ function x({ question: t, requirement: e, isDisabled: s = !1 }) {
120
120
  ) : null;
121
121
  }
122
122
  function I({
123
- question: t,
124
- requirement: e,
125
- isDisabled: s = !1
123
+ question: e,
124
+ requirement: t,
125
+ isDisabled: l = !1
126
126
  }) {
127
- const { key: a, label: i, description: l } = t || e, n = t ? t.answers[0]?.value : e.value;
127
+ const { key: r, label: u, description: i } = e || t, n = e ? e.answers[0]?.value : t.value;
128
128
  if (typeof n != "string" && typeof n < "u")
129
129
  throw new Error("Expecting value to be string for DateInput");
130
- return a ? /* @__PURE__ */ r(
131
- D,
130
+ return r ? /* @__PURE__ */ a(
131
+ _,
132
132
  {
133
133
  isRequired: !0,
134
- name: a,
134
+ name: r,
135
135
  defaultValue: n ? new Date(n) : null,
136
- label: i,
137
- description: l,
138
- isDisabled: s
136
+ label: u,
137
+ description: i,
138
+ isDisabled: l
139
139
  }
140
140
  ) : null;
141
141
  }
142
+ function g({ requirement: e, question: t, ...l }) {
143
+ if (e) {
144
+ const { key: r, metadata: u, label: i, description: n } = e, { validation: o } = u || {};
145
+ return o?.type === "one_of" ? /* @__PURE__ */ a(
146
+ m,
147
+ {
148
+ isRequired: !0,
149
+ name: r || "",
150
+ label: i || "",
151
+ description: n,
152
+ options: o.rates?.map((s) => ({
153
+ value: s,
154
+ label: s
155
+ })) || []
156
+ }
157
+ ) : /* @__PURE__ */ a(d, { requirement: e, ...l, isPercent: !0 });
158
+ }
159
+ return /* @__PURE__ */ a(d, { question: t, ...l, isPercent: !0 });
160
+ }
142
161
  export {
143
162
  I as DateField,
144
163
  d as NumberInput,
145
- V as QuestionInput,
146
- x as RadioInput,
147
- T as SelectInput,
164
+ M as QuestionInput,
165
+ C as RadioInput,
166
+ x as SelectInput,
167
+ g as TaxRateInput,
148
168
  f as TextInput
149
169
  };
150
170
  //# sourceMappingURL=TaxInputs.js.map