@gusto/embedded-react-sdk 0.8.2 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/CHANGELOG.md +91 -2
  2. package/dist/components/Common/DataView/DataCards/DataCards.js +21 -21
  3. package/dist/components/Common/DataView/DataCards/DataCards.js.map +1 -1
  4. package/dist/components/Common/OnboardingStatusBadge/index.d.ts +21 -0
  5. package/dist/components/Common/OnboardingStatusBadge/index.js +17 -0
  6. package/dist/components/Common/OnboardingStatusBadge/index.js.map +1 -0
  7. package/dist/components/Common/SignatureForm/SignatureFormActions.js +8 -7
  8. package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
  9. package/dist/components/Common/SignatureForm/SignatureFormFields.js +5 -4
  10. package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
  11. package/dist/components/Common/TaxInputs/TaxInputs.js +42 -36
  12. package/dist/components/Common/TaxInputs/TaxInputs.js.map +1 -1
  13. package/dist/components/Common/UI/ComboBox/ComboBox.js +28 -27
  14. package/dist/components/Common/UI/ComboBox/ComboBox.js.map +1 -1
  15. package/dist/components/Common/UI/ComboBox/ComboBox.module.scss.js +6 -6
  16. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +7 -6
  17. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
  18. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +9 -8
  19. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
  20. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +5 -3
  21. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  22. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +7 -6
  23. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
  24. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +5 -3
  25. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  26. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +7 -5
  27. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  28. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +3 -2
  29. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
  30. package/dist/components/Company/BankAccount/BankAccountForm/context.js +5 -3
  31. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  32. package/dist/components/Company/BankAccount/BankAccountList/Actions.js +7 -6
  33. package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
  34. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +8 -7
  35. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
  36. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +6 -5
  37. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
  38. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +5 -3
  39. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  40. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +5 -3
  41. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  42. package/dist/components/Company/FederalTaxes/Actions.js +7 -6
  43. package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
  44. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +13 -11
  45. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  46. package/dist/components/Company/Industry/Actions.js +6 -5
  47. package/dist/components/Company/Industry/Actions.js.map +1 -1
  48. package/dist/components/Company/Industry/Context.js +8 -6
  49. package/dist/components/Company/Industry/Context.js.map +1 -1
  50. package/dist/components/Company/Industry/Edit.js +11 -10
  51. package/dist/components/Company/Industry/Edit.js.map +1 -1
  52. package/dist/components/Company/Locations/LocationForm/Actions.js +3 -2
  53. package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
  54. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +5 -3
  55. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  56. package/dist/components/Company/Locations/LocationsList/Actions.js +3 -2
  57. package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
  58. package/dist/components/Company/Locations/LocationsList/List.js +7 -6
  59. package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
  60. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +5 -3
  61. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  62. package/dist/components/Company/OnboardingOverview/context.js +5 -3
  63. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  64. package/dist/components/Company/PaySchedule/_parts/Actions.js +11 -10
  65. package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
  66. package/dist/components/Company/PaySchedule/usePaySchedule.js +7 -5
  67. package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
  68. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +10 -9
  69. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
  70. package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js +1 -1
  71. package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js.map +1 -1
  72. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +29 -29
  73. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
  74. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +5 -3
  75. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  76. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +7 -6
  77. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
  78. package/dist/components/Company/StateTaxes/StateTaxesList/List.js +6 -5
  79. package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
  80. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +5 -3
  81. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  82. package/dist/components/Contractor/Address/Actions.d.ts +1 -0
  83. package/dist/components/Contractor/Address/Actions.js +13 -0
  84. package/dist/components/Contractor/Address/Actions.js.map +1 -0
  85. package/dist/components/Contractor/Address/Address.d.ts +16 -0
  86. package/dist/components/Contractor/Address/Address.js +74 -0
  87. package/dist/components/Contractor/Address/Address.js.map +1 -0
  88. package/dist/components/Contractor/Address/Form.d.ts +1 -0
  89. package/dist/components/Contractor/Address/Form.js +57 -0
  90. package/dist/components/Contractor/Address/Form.js.map +1 -0
  91. package/dist/components/Contractor/Address/Head.d.ts +1 -0
  92. package/dist/components/Contractor/Address/Head.js +15 -0
  93. package/dist/components/Contractor/Address/Head.js.map +1 -0
  94. package/dist/components/Contractor/Address/index.d.ts +2 -0
  95. package/dist/components/Contractor/Address/useAddress.d.ts +33 -0
  96. package/dist/components/Contractor/Address/useAddress.js +28 -0
  97. package/dist/components/Contractor/Address/useAddress.js.map +1 -0
  98. package/dist/components/Contractor/List/index.d.ts +25 -0
  99. package/dist/components/Contractor/List/index.js +84 -0
  100. package/dist/components/Contractor/List/index.js.map +1 -0
  101. package/dist/components/Contractor/List/useContractorList.d.ts +20 -0
  102. package/dist/components/Contractor/List/useContractorList.js +31 -0
  103. package/dist/components/Contractor/List/useContractorList.js.map +1 -0
  104. package/dist/components/Contractor/PaymentMethod/BankAccountForm.d.ts +2 -0
  105. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +53 -0
  106. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -0
  107. package/dist/components/Contractor/PaymentMethod/PaymentMethod.d.ts +31 -0
  108. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +108 -0
  109. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -0
  110. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.d.ts +11 -0
  111. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +35 -0
  112. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -0
  113. package/dist/components/Contractor/PaymentMethod/types.d.ts +8 -0
  114. package/dist/components/Contractor/index.d.ts +4 -0
  115. package/dist/components/Contractor/index.js +9 -0
  116. package/dist/components/Contractor/index.js.map +1 -0
  117. package/dist/components/Employee/Compensation/Actions.js +1 -1
  118. package/dist/components/Employee/Compensation/Compensation.js +1 -1
  119. package/dist/components/Employee/Compensation/Compensation.js.map +1 -1
  120. package/dist/components/Employee/Compensation/Edit.js +59 -56
  121. package/dist/components/Employee/Compensation/Edit.js.map +1 -1
  122. package/dist/components/Employee/Compensation/List.js +6 -5
  123. package/dist/components/Employee/Compensation/List.js.map +1 -1
  124. package/dist/components/Employee/Compensation/useCompensation.d.ts +2 -0
  125. package/dist/components/Employee/Compensation/useCompensation.js +16 -14
  126. package/dist/components/Employee/Compensation/useCompensation.js.map +1 -1
  127. package/dist/components/Employee/Deductions/Actions.js +9 -8
  128. package/dist/components/Employee/Deductions/Actions.js.map +1 -1
  129. package/dist/components/Employee/Deductions/DeductionForm.js +14 -5
  130. package/dist/components/Employee/Deductions/DeductionForm.js.map +1 -1
  131. package/dist/components/Employee/Deductions/Deductions.js +25 -25
  132. package/dist/components/Employee/Deductions/Deductions.js.map +1 -1
  133. package/dist/components/Employee/Deductions/DeductionsList.js +3 -2
  134. package/dist/components/Employee/Deductions/DeductionsList.js.map +1 -1
  135. package/dist/components/Employee/Deductions/IncludeDeductionsForm.js +3 -2
  136. package/dist/components/Employee/Deductions/IncludeDeductionsForm.js.map +1 -1
  137. package/dist/components/Employee/Deductions/useDeductions.js +8 -6
  138. package/dist/components/Employee/Deductions/useDeductions.js.map +1 -1
  139. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +5 -4
  140. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
  141. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +5 -3
  142. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  143. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +5 -3
  144. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  145. package/dist/components/Employee/EmployeeList/Actions.js +5 -4
  146. package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
  147. package/dist/components/Employee/EmployeeList/EmployeeList.js +1 -1
  148. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  149. package/dist/components/Employee/EmployeeList/List.js +56 -51
  150. package/dist/components/Employee/EmployeeList/List.js.map +1 -1
  151. package/dist/components/Employee/EmployeeList/useEmployeeList.d.ts +2 -1
  152. package/dist/components/Employee/EmployeeList/useEmployeeList.js +5 -3
  153. package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
  154. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +48 -43
  155. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js.map +1 -1
  156. package/dist/components/Employee/PaymentMethod/Actions.js +6 -5
  157. package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
  158. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +1 -1
  159. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
  160. package/dist/components/Employee/PaymentMethod/BankAccountsList.js +3 -2
  161. package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
  162. package/dist/components/Employee/PaymentMethod/PaymentMethod.js +3 -4
  163. package/dist/components/Employee/PaymentMethod/PaymentMethod.js.map +1 -1
  164. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +1 -1
  165. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
  166. package/dist/components/Employee/PaymentMethod/Split.js +88 -76
  167. package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
  168. package/dist/components/Employee/PaymentMethod/usePaymentMethod.d.ts +2 -2
  169. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +35 -29
  170. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  171. package/dist/components/Employee/Profile/Actions.js +7 -6
  172. package/dist/components/Employee/Profile/Actions.js.map +1 -1
  173. package/dist/components/Employee/Profile/AdminPersonalDetails.d.ts +49 -20
  174. package/dist/components/Employee/Profile/AdminPersonalDetails.js +27 -25
  175. package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
  176. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +10 -9
  177. package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
  178. package/dist/components/Employee/Profile/Profile.js +124 -116
  179. package/dist/components/Employee/Profile/Profile.js.map +1 -1
  180. package/dist/components/Employee/Profile/useProfile.js +5 -3
  181. package/dist/components/Employee/Profile/useProfile.js.map +1 -1
  182. package/dist/components/Employee/Taxes/Actions.js +8 -7
  183. package/dist/components/Employee/Taxes/Actions.js.map +1 -1
  184. package/dist/components/Employee/Taxes/FederalForm.js +5 -4
  185. package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
  186. package/dist/components/Employee/Taxes/StateForm.d.ts +1 -1
  187. package/dist/components/Employee/Taxes/StateForm.js +27 -25
  188. package/dist/components/Employee/Taxes/StateForm.js.map +1 -1
  189. package/dist/components/Employee/Taxes/Taxes.d.ts +1 -1
  190. package/dist/components/Employee/Taxes/Taxes.js +90 -83
  191. package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
  192. package/dist/components/Employee/Taxes/useTaxes.d.ts +2 -2
  193. package/dist/components/Employee/Taxes/useTaxes.js +5 -3
  194. package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
  195. package/dist/components/index.d.ts +1 -0
  196. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +8 -7
  197. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  198. package/dist/i18n/I18n.js +5 -5
  199. package/dist/i18n/I18n.js.map +1 -1
  200. package/dist/i18n/en/Contractor.Address.json.js +35 -0
  201. package/dist/i18n/en/Contractor.Address.json.js.map +1 -0
  202. package/dist/i18n/en/Contractor.ContractorList.json.js +25 -0
  203. package/dist/i18n/en/Contractor.ContractorList.json.js.map +1 -0
  204. package/dist/i18n/en/Contractor.PaymentMethod.json.js +35 -0
  205. package/dist/i18n/en/Contractor.PaymentMethod.json.js.map +1 -0
  206. package/dist/i18n/en/Employee.Compensation.json.js +22 -20
  207. package/dist/i18n/en/Employee.Compensation.json.js.map +1 -1
  208. package/dist/i18n/en/Employee.PaymentMethod.json.js +18 -17
  209. package/dist/i18n/en/Employee.PaymentMethod.json.js.map +1 -1
  210. package/dist/i18n/en/common.json.d.ts +21 -9
  211. package/dist/i18n/en/common.json.js +35 -23
  212. package/dist/i18n/en/common.json.js.map +1 -1
  213. package/dist/index.js +11 -9
  214. package/dist/index.js.map +1 -1
  215. package/dist/shared/constants.d.ts +20 -0
  216. package/dist/shared/constants.js +62 -45
  217. package/dist/shared/constants.js.map +1 -1
  218. package/dist/style.css +1 -1
  219. package/dist/types/i18next.d.ts +71 -1
  220. package/package.json +7 -3
  221. package/dist/components/Employee/PaymentMethod/Constants.d.ts +0 -8
  222. package/dist/components/Employee/PaymentMethod/Constants.js +0 -6
  223. package/dist/components/Employee/PaymentMethod/Constants.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.0
4
+
5
+ ### Features & Enhancements
6
+
7
+ - Added contractor payment method with custom validation, including handling for masked account numbers
8
+ - Added `annualMaximum` field to DeductionForm with comprehensive tests
9
+ - Added PaymentMethod percentage validation tests
10
+
11
+ ### Fixes
12
+
13
+ - Correctly set version for employee taxes
14
+ - Set correct mode on deductions cancel
15
+ - Skip state taxes for states that only have questions for admins
16
+ - Allow special characters in user name
17
+ - Fix split validation
18
+ - Fix withholding allowance of 0 causing error on state tax submission
19
+ - Restore proper SSN validation
20
+ - Update rate to not be labeled optional when it is required
21
+
22
+ ### Chores & Maintenance
23
+
24
+ - Upgrade embedded API version to 0.6.4
25
+ - Update changelog with breaking changes and update docs
26
+
27
+ ## 0.9.0
28
+
29
+ - Added new Contractor.Address form component for managing contractor address information
30
+ - Improved ComboBox accessibility and added comprehensive component tests
31
+ - Added accessibility testing infrastructure with foundational component coverage
32
+ - Added accessibility tests to complex interactive and data components
33
+ - Fixed state tax boolean validation issues
34
+ - Updated Gusto embedded-api version to the latest
35
+
36
+ ### Breaking changes
37
+
38
+ Be sure to note the breaking change listed below for version 0.8.2 around component renaming and removal of the top level Flow component.
39
+
3
40
  ## 0.8.2
4
41
 
5
42
  - Refactored employee flow components structure and improved organization within Employee namespace
@@ -8,6 +45,56 @@
8
45
  - Fixed commission Zod schema validation issues
9
46
  - Fixed issue with headers not being passed properly through our API client
10
47
 
48
+ ### Breaking changes
49
+
50
+ > Note: We are pre alpha and are regularly iterating on the SDK as we learn more about our consumers and their needs which sometimes involves breaking changes. [Read more about our current versioning strategy here](./docs/04/01/versioning.md).
51
+
52
+ #### Rename components to remove the "Flow" naming suffix
53
+
54
+ The following components have been updated to remove the "Flow" naming suffix.
55
+
56
+ | Old name | Updated name |
57
+ | ----------------------------- | ------------------------- |
58
+ | `Employee.DocumentSignerFlow` | `Employee.DocumentSigner` |
59
+ | `Company.LocationsFlow` | `Company.Locations` |
60
+ | `Company.BankAccountFlow` | `Company.BankAccount` |
61
+ | `Company.StateTaxesFlow` | `Company.StateTaxes` |
62
+ | `Company.DocumentSignerFlow` | `Company.DocumentSigner` |
63
+
64
+ #### Removed top level Flow component and renamed flow subcomponents
65
+
66
+ We have removed the top level `Flow` component and have migrated the flow subcomponents to `Employee` and `Company` respectively.
67
+
68
+ | Old name | Updated name |
69
+ | --------------------------------- | ----------------------------- |
70
+ | `Flow.EmployeeOnboardingFlow` | `Employee.OnboardingFlow` |
71
+ | `Flow.EmployeeSelfOnboardingFlow` | `Employee.SelfOnboardingFlow` |
72
+
73
+ Some examples of before/after:
74
+
75
+ _Before_
76
+
77
+ ```tsx
78
+ import { Flow } from '@gusto/embedded-react-sdk'
79
+
80
+ ...
81
+
82
+ <Flow.EmployeeOnboardingFlow ... />
83
+ <Flow.EmployeeSelfOnboardingFlow ... />
84
+
85
+ ```
86
+
87
+ _After_
88
+
89
+ ```tsx
90
+ import { Employee } from '@gusto/embedded-react-sdk'
91
+
92
+ ...
93
+
94
+ <Employee.OnboardingFlow ... />
95
+ <Employee.SelfOnboardingFlow ... />
96
+ ```
97
+
11
98
  ## 0.8.1
12
99
 
13
100
  - Replaced Valibot with Zod for bundle size reduction. Also included zod as a dependency
@@ -116,7 +203,9 @@ You would do the following instead::
116
203
  >
117
204
  ```
118
205
 
119
- #### DocumentSigner has been renamed to DocumentSigner
206
+ #### DocumentSigner has been renamed to DocumentSignerFlow
207
+
208
+ > This was actually reverted in 0.8.2. If you have DocumentSigner as the component name, you can continue to use that if you are on 0.8.2 or later. Between 0.7.0 up until 0.8.2 the naming is DocumentSignerFlow
120
209
 
121
210
  Where you would previously do
122
211
 
@@ -127,7 +216,7 @@ Where you would previously do
127
216
  You should update the naming as follows:
128
217
 
129
218
  ```tsx
130
- <Employee.DocumentSigner employeeId="some-id" onEvent={() => {}} />
219
+ <Employee.DocumentSignerFlow employeeId="some-id" onEvent={() => {}} />
131
220
  ```
132
221
 
133
222
  ## 0.6.0
@@ -1,31 +1,31 @@
1
- import { jsxs as i, jsx as t } from "react/jsx-runtime";
2
- import s from "./DataCards.module.scss.js";
3
- import { Flex as h } from "../../Flex/Flex.js";
1
+ import { jsxs as l, jsx as e } from "react/jsx-runtime";
2
+ import a from "./DataCards.module.scss.js";
3
+ import { Flex as p } from "../../Flex/Flex.js";
4
4
  import { useComponentContext as x } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
5
5
  const D = ({
6
- data: n,
7
- columns: a,
8
- itemMenu: o,
9
- onSelect: d,
10
- emptyState: c
6
+ data: t,
7
+ columns: c,
8
+ itemMenu: d,
9
+ onSelect: n,
10
+ emptyState: o
11
11
  }) => {
12
- const l = x();
13
- return /* @__PURE__ */ i("div", { role: "list", "data-testid": "data-cards", children: [
14
- n.length === 0 && /* @__PURE__ */ t(l.Card, { children: c?.() }),
15
- n.map((e, m) => /* @__PURE__ */ t("div", { role: "listitem", children: /* @__PURE__ */ t(
16
- l.Card,
12
+ const s = x();
13
+ return /* @__PURE__ */ l("div", { role: "list", "data-testid": "data-cards", children: [
14
+ t.length === 0 && o && /* @__PURE__ */ e("div", { role: "listitem", children: /* @__PURE__ */ e(s.Card, { children: o() }) }),
15
+ t.map((i, m) => /* @__PURE__ */ e("div", { role: "listitem", children: /* @__PURE__ */ e(
16
+ s.Card,
17
17
  {
18
- menu: o && o(e),
19
- onSelect: d ? (r) => {
20
- d(e, r);
18
+ menu: d && d(i),
19
+ onSelect: n ? (r) => {
20
+ n(i, r);
21
21
  } : void 0,
22
- children: a.map((r, p) => /* @__PURE__ */ i(h, { flexDirection: "column", gap: 0, children: [
23
- /* @__PURE__ */ t("h5", { className: s.columnTitle, children: r.title }),
24
- /* @__PURE__ */ i("div", { className: s.columnData, children: [
22
+ children: c.map((r, h) => /* @__PURE__ */ l(p, { flexDirection: "column", gap: 0, children: [
23
+ /* @__PURE__ */ e("h5", { className: a.columnTitle, children: r.title }),
24
+ /* @__PURE__ */ l("div", { className: a.columnData, children: [
25
25
  " ",
26
- r.render ? r.render(e) : String(e[r.key])
26
+ r.render ? r.render(i) : String(i[r.key])
27
27
  ] })
28
- ] }, p))
28
+ ] }, h))
29
29
  }
30
30
  ) }, m))
31
31
  ] });
@@ -1 +1 @@
1
- {"version":3,"file":"DataCards.js","sources":["../../../../../src/components/Common/DataView/DataCards/DataCards.tsx"],"sourcesContent":["import styles from './DataCards.module.scss'\nimport type { useDataViewPropReturn } from '@/components/Common/DataView/useDataView'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport type DataCardsProps<T> = {\n columns: useDataViewPropReturn<T>['columns']\n data: useDataViewPropReturn<T>['data']\n itemMenu?: useDataViewPropReturn<T>['itemMenu']\n onSelect?: useDataViewPropReturn<T>['onSelect']\n emptyState?: useDataViewPropReturn<T>['emptyState']\n}\n\nexport const DataCards = <T,>({\n data,\n columns,\n itemMenu,\n onSelect,\n emptyState,\n}: DataCardsProps<T>) => {\n const Components = useComponentContext()\n return (\n <div role=\"list\" data-testid=\"data-cards\">\n {data.length === 0 && <Components.Card>{emptyState?.()}</Components.Card>}\n {data.map((item, index) => (\n <div role=\"listitem\" key={index}>\n <Components.Card\n menu={itemMenu && itemMenu(item)}\n onSelect={\n onSelect\n ? (checked: boolean) => {\n onSelect(item, checked)\n }\n : undefined\n }\n >\n {columns.map((column, index) => (\n <Flex key={index} flexDirection=\"column\" gap={0}>\n <h5 className={styles.columnTitle}>{column.title}</h5>\n <div className={styles.columnData}>\n {' '}\n {column.render ? column.render(item) : String(item[column.key as keyof T])}\n </div>\n </Flex>\n ))}\n </Components.Card>\n </div>\n ))}\n </div>\n )\n}\n"],"names":["DataCards","data","columns","itemMenu","onSelect","emptyState","Components","useComponentContext","jsxs","jsx","item","index","checked","column","Flex","styles"],"mappings":";;;;AAaO,MAAMA,IAAY,CAAK;AAAA,EAC5B,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AACF,MAAyB;AACvB,QAAMC,IAAaC,EAAoB;AACvC,SACG,gBAAAC,EAAA,OAAA,EAAI,MAAK,QAAO,eAAY,cAC1B,UAAA;AAAA,IAAAP,EAAK,WAAW,KAAK,gBAAAQ,EAACH,EAAW,MAAX,EAAiB,iBAAe;AAAA,IACtDL,EAAK,IAAI,CAACS,GAAMC,MACd,gBAAAF,EAAA,OAAA,EAAI,MAAK,YACR,UAAA,gBAAAA;AAAA,MAACH,EAAW;AAAA,MAAX;AAAA,QACC,MAAMH,KAAYA,EAASO,CAAI;AAAA,QAC/B,UACEN,IACI,CAACQ,MAAqB;AACpB,UAAAR,EAASM,GAAME,CAAO;AAAA,QAAA,IAExB;AAAA,QAGL,UAAAV,EAAQ,IAAI,CAACW,GAAQF,wBACnBG,GAAiB,EAAA,eAAc,UAAS,KAAK,GAC5C,UAAA;AAAA,UAAA,gBAAAL,EAAC,MAAG,EAAA,WAAWM,EAAO,aAAc,YAAO,OAAM;AAAA,UAChD,gBAAAP,EAAA,OAAA,EAAI,WAAWO,EAAO,YACpB,UAAA;AAAA,YAAA;AAAA,YACAF,EAAO,SAASA,EAAO,OAAOH,CAAI,IAAI,OAAOA,EAAKG,EAAO,GAAc,CAAC;AAAA,UAAA,EAC3E,CAAA;AAAA,QAAA,EAAA,GALSF,CAMX,CACD;AAAA,MAAA;AAAA,IACH,EAAA,GApBwBA,CAqB1B,CACD;AAAA,EAAA,GACH;AAEJ;"}
1
+ {"version":3,"file":"DataCards.js","sources":["../../../../../src/components/Common/DataView/DataCards/DataCards.tsx"],"sourcesContent":["import styles from './DataCards.module.scss'\nimport type { useDataViewPropReturn } from '@/components/Common/DataView/useDataView'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport type DataCardsProps<T> = {\n columns: useDataViewPropReturn<T>['columns']\n data: useDataViewPropReturn<T>['data']\n itemMenu?: useDataViewPropReturn<T>['itemMenu']\n onSelect?: useDataViewPropReturn<T>['onSelect']\n emptyState?: useDataViewPropReturn<T>['emptyState']\n}\n\nexport const DataCards = <T,>({\n data,\n columns,\n itemMenu,\n onSelect,\n emptyState,\n}: DataCardsProps<T>) => {\n const Components = useComponentContext()\n return (\n <div role=\"list\" data-testid=\"data-cards\">\n {data.length === 0 && emptyState && (\n <div role=\"listitem\">\n <Components.Card>{emptyState()}</Components.Card>\n </div>\n )}\n {data.map((item, index) => (\n <div role=\"listitem\" key={index}>\n <Components.Card\n menu={itemMenu && itemMenu(item)}\n onSelect={\n onSelect\n ? (checked: boolean) => {\n onSelect(item, checked)\n }\n : undefined\n }\n >\n {columns.map((column, index) => (\n <Flex key={index} flexDirection=\"column\" gap={0}>\n <h5 className={styles.columnTitle}>{column.title}</h5>\n <div className={styles.columnData}>\n {' '}\n {column.render ? column.render(item) : String(item[column.key as keyof T])}\n </div>\n </Flex>\n ))}\n </Components.Card>\n </div>\n ))}\n </div>\n )\n}\n"],"names":["DataCards","data","columns","itemMenu","onSelect","emptyState","Components","useComponentContext","jsxs","jsx","item","index","checked","column","Flex","styles"],"mappings":";;;;AAaO,MAAMA,IAAY,CAAK;AAAA,EAC5B,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AACF,MAAyB;AACvB,QAAMC,IAAaC,EAAoB;AACvC,SACG,gBAAAC,EAAA,OAAA,EAAI,MAAK,QAAO,eAAY,cAC1B,UAAA;AAAA,IAAAP,EAAK,WAAW,KAAKI,KACpB,gBAAAI,EAAC,OAAI,EAAA,MAAK,YACR,UAAA,gBAAAA,EAACH,EAAW,MAAX,EAAiB,UAAAD,EAAA,EAAa,CAAA,GACjC;AAAA,IAEDJ,EAAK,IAAI,CAACS,GAAMC,MACd,gBAAAF,EAAA,OAAA,EAAI,MAAK,YACR,UAAA,gBAAAA;AAAA,MAACH,EAAW;AAAA,MAAX;AAAA,QACC,MAAMH,KAAYA,EAASO,CAAI;AAAA,QAC/B,UACEN,IACI,CAACQ,MAAqB;AACpB,UAAAR,EAASM,GAAME,CAAO;AAAA,QAAA,IAExB;AAAA,QAGL,UAAAV,EAAQ,IAAI,CAACW,GAAQF,wBACnBG,GAAiB,EAAA,eAAc,UAAS,KAAK,GAC5C,UAAA;AAAA,UAAA,gBAAAL,EAAC,MAAG,EAAA,WAAWM,EAAO,aAAc,YAAO,OAAM;AAAA,UAChD,gBAAAP,EAAA,OAAA,EAAI,WAAWO,EAAO,YACpB,UAAA;AAAA,YAAA;AAAA,YACAF,EAAO,SAASA,EAAO,OAAOH,CAAI,IAAI,OAAOA,EAAKG,EAAO,GAAc,CAAC;AAAA,UAAA,EAC3E,CAAA;AAAA,QAAA,EAAA,GALSF,CAMX,CACD;AAAA,MAAA;AAAA,IACH,EAAA,GApBwBA,CAqB1B,CACD;AAAA,EAAA,GACH;AAEJ;"}
@@ -0,0 +1,21 @@
1
+ import "./types/i18next.d.ts"
2
+ import { ContractorOnboardingStatus1 } from '@gusto/embedded-api/models/components/contractor';
3
+ import { OnboardingStatus } from '@gusto/embedded-api/models/components/employee';
4
+ type OnboardingStatuses = ContractorOnboardingStatus1 | OnboardingStatus;
5
+ interface OnboardingStatusBadgeProps<T extends OnboardingStatuses> {
6
+ onboarded?: boolean;
7
+ onboardingEntity: 'contractor' | 'employee';
8
+ onboardingStatus?: T | null;
9
+ }
10
+ export declare const OnboardingStatusBadge: <T extends OnboardingStatuses>({ onboarded, onboardingEntity, onboardingStatus, }: OnboardingStatusBadgeProps<T>) => import("react/jsx-runtime").JSX.Element;
11
+ interface ContractorOnboardingStatusBadgeProps {
12
+ onboarded?: boolean;
13
+ onboardingStatus?: ContractorOnboardingStatus1 | null;
14
+ }
15
+ export declare const ContractorOnboardingStatusBadge: (props: ContractorOnboardingStatusBadgeProps) => import("react/jsx-runtime").JSX.Element;
16
+ interface EmployeeOnboardingStatusBadgeProps {
17
+ onboarded?: boolean;
18
+ onboardingStatus?: OnboardingStatus | null;
19
+ }
20
+ export declare const EmployeeOnboardingStatusBadge: (props: EmployeeOnboardingStatusBadgeProps) => import("react/jsx-runtime").JSX.Element;
21
+ export {};
@@ -0,0 +1,17 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { useTranslation as i } from "react-i18next";
3
+ import { useComponentContext as d } from "../../../contexts/ComponentAdapter/useComponentContext.js";
4
+ const o = ({
5
+ onboarded: t,
6
+ onboardingEntity: r,
7
+ onboardingStatus: a
8
+ }) => {
9
+ const { Badge: e } = d(), { t: s } = i();
10
+ return /* @__PURE__ */ n(e, { status: t ? "success" : "warning", children: s(`onboardingStatus.${r}.${a ?? "undefined"}`) });
11
+ }, m = (t) => /* @__PURE__ */ n(o, { ...t, onboardingEntity: "contractor" }), p = (t) => /* @__PURE__ */ n(o, { ...t, onboardingEntity: "employee" });
12
+ export {
13
+ m as ContractorOnboardingStatusBadge,
14
+ p as EmployeeOnboardingStatusBadge,
15
+ o as OnboardingStatusBadge
16
+ };
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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,19 +1,20 @@
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({
1
+ import { jsxs as m, jsx as n } from "react/jsx-runtime";
2
+ import "../../../shared/constants.js";
3
+ import { ActionsLayout as s } from "../ActionsLayout/ActionsLayout.js";
4
+ import { useComponentContext as p } from "../../../contexts/ComponentAdapter/useComponentContext.js";
5
+ function l({
5
6
  onBack: t,
6
7
  backLabel: r,
7
8
  submitLabel: e,
8
9
  isLoading: i = !1
9
10
  }) {
10
- const o = u();
11
- return /* @__PURE__ */ s(m, { children: [
11
+ const o = p();
12
+ return /* @__PURE__ */ m(s, { children: [
12
13
  t && /* @__PURE__ */ n(o.Button, { variant: "secondary", type: "button", onClick: t, children: r }),
13
14
  /* @__PURE__ */ n(o.Button, { type: "submit", isLoading: i, children: e })
14
15
  ] });
15
16
  }
16
17
  export {
17
- f as SignatureFormActions
18
+ l as SignatureFormActions
18
19
  };
19
20
  //# 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,14 +1,15 @@
1
- import { jsxs as s, Fragment as m, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as m, Fragment as s, jsx as e } from "react/jsx-runtime";
2
+ import "../../../shared/constants.js";
2
3
  import { TextInputField as a } from "../Fields/TextInputField/TextInputField.js";
3
4
  import { CheckboxField as u } from "../Fields/CheckboxField/CheckboxField.js";
4
- function p({
5
+ function c({
5
6
  signatureLabel: r,
6
7
  signatureDescription: i = "",
7
8
  signatureError: t = "",
8
9
  confirmationLabel: o,
9
10
  confirmationError: n = ""
10
11
  }) {
11
- return /* @__PURE__ */ s(m, { children: [
12
+ return /* @__PURE__ */ m(s, { children: [
12
13
  /* @__PURE__ */ e(
13
14
  a,
14
15
  {
@@ -31,6 +32,6 @@ function p({
31
32
  ] });
32
33
  }
33
34
  export {
34
- p as SignatureFormFields
35
+ c as SignatureFormFields
35
36
  };
36
37
  //# 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;"}
@@ -1,28 +1,28 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
2
  import v from "dompurify";
3
3
  import { useTranslation as w } from "react-i18next";
4
- import { SelectField as b } from "../Fields/SelectField/SelectField.js";
5
- import { TextInputField as y } from "../Fields/TextInputField/TextInputField.js";
4
+ import { SelectField as y } from "../Fields/SelectField/SelectField.js";
5
+ import { TextInputField as b } from "../Fields/TextInputField/TextInputField.js";
6
6
  import { NumberInputField as k } from "../Fields/NumberInputField/NumberInputField.js";
7
7
  import { RadioGroupField as _ } from "../Fields/RadioGroupField/RadioGroupField.js";
8
8
  import { DatePickerField as D } from "../Fields/DatePickerField/DatePickerField.js";
9
- import { useComponentContext as h } from "../../../contexts/ComponentAdapter/useComponentContext.js";
10
- import { useMaskedTransform as C } from "../../../helpers/mask.js";
11
- const T = { ALLOWED_TAGS: ["a", "b", "strong"], ALLOWED_ATTR: ["target", "href"] };
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
12
  function V({
13
13
  questionType: t,
14
14
  ...e
15
15
  }) {
16
16
  switch (t.toLowerCase()) {
17
17
  case "date":
18
- return /* @__PURE__ */ r(g, { ...e });
19
- case "radio":
20
18
  return /* @__PURE__ */ r(I, { ...e });
19
+ case "radio":
20
+ return /* @__PURE__ */ r(x, { ...e });
21
21
  case "text":
22
22
  case "account_number":
23
- return /* @__PURE__ */ r(m, { ...e });
23
+ return /* @__PURE__ */ r(f, { ...e });
24
24
  case "select":
25
- return /* @__PURE__ */ r(x, { ...e });
25
+ return /* @__PURE__ */ r(T, { ...e });
26
26
  case "number":
27
27
  return /* @__PURE__ */ r(d, { ...e });
28
28
  case "workers_compensation_rate":
@@ -33,38 +33,40 @@ function V({
33
33
  case "currency":
34
34
  return /* @__PURE__ */ r(d, { ...e, isCurrency: !0 });
35
35
  default:
36
- return /* @__PURE__ */ r(m, { ...e });
36
+ return /* @__PURE__ */ r(f, { ...e });
37
37
  }
38
38
  }
39
- function x({ question: t, requirement: e, isDisabled: s = !1 }) {
39
+ function T({ question: t, requirement: e, isDisabled: s = !1 }) {
40
40
  const { key: a, label: i, description: l } = t || e, n = t ? t.answers[0]?.value : e.value, o = t ? t.inputQuestionFormat : e.metadata;
41
41
  if (!o?.options) throw new Error("Select input must have options");
42
42
  return a ? /* @__PURE__ */ r(
43
- b,
43
+ y,
44
44
  {
45
+ isRequired: !0,
45
46
  name: a,
46
47
  defaultValue: n,
47
48
  label: i,
48
49
  description: l,
49
50
  isDisabled: a.includes("fileNewHireReport") ? n !== void 0 : s,
50
- options: o.options.map((c, u) => ({
51
- value: c.value,
52
- label: c.label
51
+ options: o.options.map((u, c) => ({
52
+ value: u.value,
53
+ label: u.label
53
54
  }))
54
55
  }
55
56
  ) : null;
56
57
  }
57
- function m({ question: t, requirement: e, isDisabled: s = !1 }) {
58
- const { key: a, label: i, description: l } = t || e, n = t ? t.answers[0]?.value : e.value, o = e?.metadata?.mask ?? null, c = C(o);
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);
59
60
  return a ? /* @__PURE__ */ r(
60
- y,
61
+ b,
61
62
  {
63
+ isRequired: !0,
62
64
  name: a,
63
65
  label: i,
64
66
  defaultValue: n,
65
67
  description: l,
66
68
  isDisabled: s,
67
- transform: o ? c : void 0,
69
+ transform: o ? u : void 0,
68
70
  placeholder: o || void 0
69
71
  }
70
72
  ) : null;
@@ -76,16 +78,17 @@ function d({
76
78
  isPercent: a,
77
79
  isDisabled: i = !1
78
80
  }) {
79
- const { t: l } = w("common"), { key: n, label: o, description: c } = t || e, u = t ? t.answers[0]?.value : e.value;
81
+ const { t: l } = w("common"), { key: n, label: o, description: u } = t || e, c = t ? t.answers[0]?.value : e.value;
80
82
  if (!n) return null;
81
- const f = 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;
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;
82
84
  return /* @__PURE__ */ r(
83
85
  k,
84
86
  {
87
+ isRequired: !0,
85
88
  name: n,
86
89
  label: o,
87
- description: c ?? f,
88
- defaultValue: Number(u),
90
+ description: u ?? m,
91
+ defaultValue: typeof c < "u" ? Number(c) : void 0,
89
92
  format: s ? "currency" : a ? "percent" : "decimal",
90
93
  isDisabled: i,
91
94
  maximumFractionDigits: a ? 4 : void 0,
@@ -93,38 +96,41 @@ function d({
93
96
  }
94
97
  );
95
98
  }
96
- function I({ question: t, requirement: e, isDisabled: s = !1 }) {
97
- const { key: a, label: i, description: l } = t || e, n = t ? t.answers[0]?.value : e.value, { Text: o } = h(), c = t ? t.inputQuestionFormat : e.metadata;
98
- if (!c?.options) throw new Error(`RadioInput must have options:${JSON.stringify(t)}`);
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)}`);
99
102
  return a ? /* @__PURE__ */ r(
100
103
  _,
101
104
  {
105
+ isRequired: !0,
102
106
  name: a,
103
107
  isDisabled: a.includes("fileNewHireReport") ? n !== void 0 : s,
104
108
  description: l && /* @__PURE__ */ r(o, { as: "span", children: /* @__PURE__ */ r(
105
109
  "span",
106
110
  {
107
- dangerouslySetInnerHTML: { __html: v.sanitize(l, T) }
111
+ dangerouslySetInnerHTML: { __html: v.sanitize(l, C) }
108
112
  }
109
113
  ) }),
110
114
  label: i,
111
- options: c.options.map((u) => ({
112
- value: u.value,
113
- label: u.label
115
+ options: u.options.map((c) => ({
116
+ value: c.value,
117
+ label: c.label
114
118
  }))
115
119
  }
116
120
  ) : null;
117
121
  }
118
- function g({
122
+ function I({
119
123
  question: t,
120
124
  requirement: e,
121
125
  isDisabled: s = !1
122
126
  }) {
123
127
  const { key: a, label: i, description: l } = t || e, n = t ? t.answers[0]?.value : e.value;
124
- if (typeof n != "string") throw new Error("Expecting value to be string for DateInput");
128
+ if (typeof n != "string" && typeof n < "u")
129
+ throw new Error("Expecting value to be string for DateInput");
125
130
  return a ? /* @__PURE__ */ r(
126
131
  D,
127
132
  {
133
+ isRequired: !0,
128
134
  name: a,
129
135
  defaultValue: n ? new Date(n) : null,
130
136
  label: i,
@@ -134,11 +140,11 @@ function g({
134
140
  ) : null;
135
141
  }
136
142
  export {
137
- g as DateField,
143
+ I as DateField,
138
144
  d as NumberInput,
139
145
  V as QuestionInput,
140
- I as RadioInput,
141
- x as SelectInput,
142
- m as TextInput
146
+ x as RadioInput,
147
+ T as SelectInput,
148
+ f as TextInput
143
149
  };
144
150
  //# sourceMappingURL=TaxInputs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TaxInputs.js","sources":["../../../../src/components/Common/TaxInputs/TaxInputs.tsx"],"sourcesContent":["import DOMPurify from 'dompurify'\nimport type { EmployeeStateTaxQuestion } from '@gusto/embedded-api/models/components/employeestatetaxquestion'\nimport { type TaxRequirement } from '@gusto/embedded-api/models/components/taxrequirement'\nimport { useTranslation } from 'react-i18next'\nimport { SelectField } from '../Fields/SelectField/SelectField'\nimport { TextInputField } from '../Fields/TextInputField/TextInputField'\nimport { NumberInputField } from '../Fields/NumberInputField/NumberInputField'\nimport { RadioGroupField } from '../Fields/RadioGroupField/RadioGroupField'\nimport { DatePickerField } from '../Fields/DatePickerField/DatePickerField'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useMaskedTransform } from '@/helpers/mask'\n\nconst dompurifyConfig = { ALLOWED_TAGS: ['a', 'b', 'strong'], ALLOWED_ATTR: ['target', 'href'] }\n\ninterface EmpQ {\n question: NonNullable<EmployeeStateTaxQuestion>\n requirement?: never\n isDisabled?: boolean\n}\ninterface CompR {\n requirement: TaxRequirement\n question?: never\n isDisabled?: boolean\n}\n\ntype NumberFieldProps = { isCurrency?: boolean; isPercent?: boolean }\n\nexport function QuestionInput({\n questionType,\n ...props\n}: (EmpQ | CompR) & {\n questionType: string\n}) {\n switch (questionType.toLowerCase()) {\n case 'date':\n return <DateField {...props} />\n case 'radio':\n return <RadioInput {...props} />\n case 'text':\n case 'account_number': //TODO: temporary - need special handling for account numbers\n return <TextInput {...props} />\n case 'select':\n return <SelectInput {...props} />\n case 'number':\n return <NumberInput {...props} />\n case 'workers_compensation_rate':\n return (\n <NumberInput {...props} isPercent={props.requirement?.metadata?.rateType === 'percent'} />\n )\n case 'percent':\n case 'tax_rate':\n return <NumberInput {...props} isPercent />\n case 'currency':\n return <NumberInput {...props} isCurrency />\n default:\n return <TextInput {...props} />\n // return null\n }\n}\n\nexport function SelectInput({ question, requirement, isDisabled = false }: EmpQ | CompR) {\n const { key, label, description } = question ? question : requirement\n const value = question ? question.answers[0]?.value : requirement.value\n\n const meta = question ? question.inputQuestionFormat : requirement.metadata\n if (!meta?.options) throw new Error('Select input must have options')\n\n if (!key) return null\n\n return (\n <SelectField\n name={key}\n defaultValue={value}\n label={label as string}\n description={description}\n isDisabled={\n key.includes('fileNewHireReport') ? (value === undefined ? false : true) : isDisabled\n }\n options={meta.options.map((item, _) => ({\n value: item.value,\n label: item.label,\n }))}\n />\n )\n}\n\nexport function TextInput({ question, requirement, isDisabled = false }: EmpQ | CompR) {\n const { key, label, description } = question ? question : requirement\n const value = question ? question.answers[0]?.value : requirement.value\n const mask = requirement?.metadata?.mask ?? null\n const transform = useMaskedTransform(mask)\n\n if (!key) return null\n return (\n <TextInputField\n name={key}\n label={label}\n // @ts-expect-error HACK value is insufficiently narrowed here\n defaultValue={value}\n description={description}\n isDisabled={isDisabled}\n transform={mask ? transform : undefined}\n placeholder={mask ? mask : undefined}\n />\n )\n}\nexport function NumberInput({\n question,\n requirement,\n isCurrency,\n isPercent,\n isDisabled = false,\n}: (EmpQ | CompR) & NumberFieldProps) {\n const { t } = useTranslation('common')\n const { key, label, description } = question ? question : requirement\n const value = question ? question.answers[0]?.value : requirement.value\n\n if (!key) return null\n\n const wcDescription =\n requirement?.metadata?.type === 'workers_compensation_rate' &&\n requirement.metadata.riskClassCode !== undefined\n ? `${requirement.metadata.riskClassCode}: ${requirement.metadata.riskClassDescription}`\n : null\n const adornmentEnd =\n requirement?.metadata?.rateType === 'currency_per_hour'\n ? t('inputs.workersCompensationRatePerHourAdornment')\n : undefined\n\n return (\n <NumberInputField\n name={key}\n label={label}\n description={description ?? wcDescription}\n defaultValue={Number(value)}\n format={isCurrency ? 'currency' : isPercent ? 'percent' : 'decimal'}\n isDisabled={isDisabled}\n maximumFractionDigits={isPercent ? 4 : undefined}\n adornmentEnd={adornmentEnd}\n />\n )\n}\n\nexport function RadioInput({ question, requirement, isDisabled = false }: EmpQ | CompR) {\n const { key, label, description } = question ? question : requirement\n const value = question ? question.answers[0]?.value : requirement.value\n const { Text } = useComponentContext()\n\n const meta = question ? question.inputQuestionFormat : requirement.metadata\n if (!meta?.options) throw new Error(`RadioInput must have options:${JSON.stringify(question)}`)\n\n if (!key) return null\n\n return (\n <RadioGroupField\n name={key}\n //File new hire report setting cannot be changed after it has been configured.\n isDisabled={\n key.includes('fileNewHireReport') ? (value === undefined ? false : true) : isDisabled\n }\n description={\n description && (\n <Text as=\"span\">\n <span\n dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(description, dompurifyConfig) }}\n />\n </Text>\n )\n }\n label={label as string}\n options={meta.options.map(item => ({\n value: item.value,\n label: item.label,\n }))}\n />\n )\n}\n//TODO: This type is untested as of yet\nexport function DateField({\n question,\n requirement,\n isDisabled = false,\n}: (EmpQ | CompR) & NumberFieldProps) {\n const { key, label, description } = question ? question : requirement\n const value = question ? question.answers[0]?.value : requirement.value\n if (typeof value !== 'string') throw new Error('Expecting value to be string for DateInput')\n\n if (!key) return null\n\n return (\n <DatePickerField\n name={key}\n defaultValue={value ? new Date(value) : null}\n label={label as string}\n description={description}\n isDisabled={isDisabled}\n />\n )\n}\n"],"names":["dompurifyConfig","QuestionInput","questionType","props","jsx","DateField","RadioInput","TextInput","SelectInput","NumberInput","question","requirement","isDisabled","key","label","description","value","meta","SelectField","item","_","mask","transform","useMaskedTransform","TextInputField","isCurrency","isPercent","t","useTranslation","wcDescription","adornmentEnd","NumberInputField","Text","useComponentContext","RadioGroupField","DOMPurify","DatePickerField"],"mappings":";;;;;;;;;;AAYA,MAAMA,IAAkB,EAAE,cAAc,CAAC,KAAK,KAAK,QAAQ,GAAG,cAAc,CAAC,UAAU,MAAM,EAAE;AAexF,SAASC,EAAc;AAAA,EAC5B,cAAAC;AAAA,EACA,GAAGC;AACL,GAEG;AACO,UAAAD,EAAa,YAAe,GAAA;AAAA,IAClC,KAAK;AACI,aAAA,gBAAAE,EAACC,GAAW,EAAA,GAAGF,EAAO,CAAA;AAAA,IAC/B,KAAK;AACI,aAAA,gBAAAC,EAACE,GAAY,EAAA,GAAGH,EAAO,CAAA;AAAA,IAChC,KAAK;AAAA,IACL,KAAK;AACI,aAAA,gBAAAC,EAACG,GAAW,EAAA,GAAGJ,EAAO,CAAA;AAAA,IAC/B,KAAK;AACI,aAAA,gBAAAC,EAACI,GAAa,EAAA,GAAGL,EAAO,CAAA;AAAA,IACjC,KAAK;AACI,aAAA,gBAAAC,EAACK,GAAa,EAAA,GAAGN,EAAO,CAAA;AAAA,IACjC,KAAK;AAED,aAAA,gBAAAC,EAACK,KAAa,GAAGN,GAAO,WAAWA,EAAM,aAAa,UAAU,aAAa,UAAW,CAAA;AAAA,IAE5F,KAAK;AAAA,IACL,KAAK;AACH,aAAQ,gBAAAC,EAAAK,GAAA,EAAa,GAAGN,GAAO,WAAS,IAAC;AAAA,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A,CAACM,GAAM,QAAe,OAAA,IAAI,MAAM,gCAAgC,KAAK,UAAUP,CAAQ,CAAC,EAAE;AAE1F,SAACG,IAGH,gBAAAT;AAAA,IAAC8B;AAAA,IAAA;AAAA,MACC,MAAMrB;AAAA,MAEN,YACEA,EAAI,SAAS,mBAAmB,IAAKG,MAAU,SAA4BJ;AAAA,MAE7E,aACEG,KACG,gBAAAX,EAAA4B,GAAA,EAAK,IAAG,QACP,UAAA,gBAAA5B;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,yBAAyB,EAAE,QAAQ+B,EAAU,SAASpB,GAAaf,CAAe,EAAE;AAAA,QAAA;AAAA,MAAA,GAExF;AAAA,MAGJ,OAAAc;AAAA,MACA,SAASG,EAAK,QAAQ,IAAI,CAASE,OAAA;AAAA,QACjC,OAAOA,EAAK;AAAA,QACZ,OAAOA,EAAK;AAAA,MAAA,EACZ;AAAA,IAAA;AAAA,EACJ,IAvBe;AAyBnB;AAEO,SAASd,EAAU;AAAA,EACxB,UAAAK;AAAA,EACA,aAAAC;AAAA,EACA,YAAAC,IAAa;AACf,GAAsC;AACpC,QAAM,EAAE,KAAAC,GAAK,OAAAC,GAAO,aAAAC,EAAY,IAAIL,KAAsBC,GACpDK,IAAQN,IAAWA,EAAS,QAAQ,CAAC,GAAG,QAAQC,EAAY;AAClE,MAAI,OAAOK,KAAU,SAAgB,OAAA,IAAI,MAAM,4CAA4C;AAEvF,SAACH,IAGH,gBAAAT;AAAA,IAACgC;AAAA,IAAA;AAAA,MACC,MAAMvB;AAAA,MACN,cAAcG,IAAQ,IAAI,KAAKA,CAAK,IAAI;AAAA,MACxC,OAAAF;AAAA,MACA,aAAAC;AAAA,MACA,YAAAH;AAAA,IAAA;AAAA,EACF,IATe;AAWnB;"}
1
+ {"version":3,"file":"TaxInputs.js","sources":["../../../../src/components/Common/TaxInputs/TaxInputs.tsx"],"sourcesContent":["import DOMPurify from 'dompurify'\nimport type { EmployeeStateTaxQuestion } from '@gusto/embedded-api/models/components/employeestatetaxquestion'\nimport { type TaxRequirement } from '@gusto/embedded-api/models/components/taxrequirement'\nimport { useTranslation } from 'react-i18next'\nimport { SelectField } from '../Fields/SelectField/SelectField'\nimport { TextInputField } from '../Fields/TextInputField/TextInputField'\nimport { NumberInputField } from '../Fields/NumberInputField/NumberInputField'\nimport { RadioGroupField } from '../Fields/RadioGroupField/RadioGroupField'\nimport { DatePickerField } from '../Fields/DatePickerField/DatePickerField'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useMaskedTransform } from '@/helpers/mask'\n\nconst dompurifyConfig = { ALLOWED_TAGS: ['a', 'b', 'strong'], ALLOWED_ATTR: ['target', 'href'] }\n\ninterface EmpQ {\n question: NonNullable<EmployeeStateTaxQuestion>\n requirement?: never\n isDisabled?: boolean\n}\ninterface CompR {\n requirement: TaxRequirement\n question?: never\n isDisabled?: boolean\n}\n\ntype NumberFieldProps = { isCurrency?: boolean; isPercent?: boolean }\n\nexport function QuestionInput({\n questionType,\n ...props\n}: (EmpQ | CompR) & {\n questionType: string\n}) {\n switch (questionType.toLowerCase()) {\n case 'date':\n return <DateField {...props} />\n case 'radio':\n return <RadioInput {...props} />\n case 'text':\n case 'account_number': //TODO: temporary - need special handling for account numbers\n return <TextInput {...props} />\n case 'select':\n return <SelectInput {...props} />\n case 'number':\n return <NumberInput {...props} />\n case 'workers_compensation_rate':\n return (\n <NumberInput {...props} isPercent={props.requirement?.metadata?.rateType === 'percent'} />\n )\n case 'percent':\n case 'tax_rate':\n return <NumberInput {...props} isPercent />\n case 'currency':\n return <NumberInput {...props} isCurrency />\n default:\n return <TextInput {...props} />\n // return null\n }\n}\n\nexport function SelectInput({ question, requirement, isDisabled = false }: EmpQ | CompR) {\n const { key, label, description } = question ? question : requirement\n const value = question ? question.answers[0]?.value : requirement.value\n\n const meta = question ? question.inputQuestionFormat : requirement.metadata\n if (!meta?.options) throw new Error('Select input must have options')\n\n if (!key) return null\n\n return (\n <SelectField\n isRequired\n name={key}\n defaultValue={value}\n label={label as string}\n description={description}\n isDisabled={\n key.includes('fileNewHireReport') ? (value === undefined ? false : true) : isDisabled\n }\n options={meta.options.map((item, _) => ({\n value: item.value,\n label: item.label,\n }))}\n />\n )\n}\n\nexport function TextInput({ question, requirement, isDisabled = false }: EmpQ | CompR) {\n const { key, label, description } = question ? question : requirement\n const value = question ? question.answers[0]?.value : requirement.value\n const mask = requirement?.metadata?.mask ?? null\n const transform = useMaskedTransform(mask)\n\n if (!key) return null\n return (\n <TextInputField\n isRequired\n name={key}\n label={label}\n // @ts-expect-error HACK value is insufficiently narrowed here\n defaultValue={value}\n description={description}\n isDisabled={isDisabled}\n transform={mask ? transform : undefined}\n placeholder={mask ? mask : undefined}\n />\n )\n}\nexport function NumberInput({\n question,\n requirement,\n isCurrency,\n isPercent,\n isDisabled = false,\n}: (EmpQ | CompR) & NumberFieldProps) {\n const { t } = useTranslation('common')\n const { key, label, description } = question ? question : requirement\n const value = question ? question.answers[0]?.value : requirement.value\n\n if (!key) return null\n\n const wcDescription =\n requirement?.metadata?.type === 'workers_compensation_rate' &&\n requirement.metadata.riskClassCode !== undefined\n ? `${requirement.metadata.riskClassCode}: ${requirement.metadata.riskClassDescription}`\n : null\n const adornmentEnd =\n requirement?.metadata?.rateType === 'currency_per_hour'\n ? t('inputs.workersCompensationRatePerHourAdornment')\n : undefined\n\n return (\n <NumberInputField\n isRequired\n name={key}\n label={label}\n description={description ?? wcDescription}\n defaultValue={typeof value !== 'undefined' ? Number(value) : undefined}\n format={isCurrency ? 'currency' : isPercent ? 'percent' : 'decimal'}\n isDisabled={isDisabled}\n maximumFractionDigits={isPercent ? 4 : undefined}\n adornmentEnd={adornmentEnd}\n />\n )\n}\n\nexport function RadioInput({ question, requirement, isDisabled = false }: EmpQ | CompR) {\n const { key, label, description } = question ? question : requirement\n const value = question ? question.answers[0]?.value : requirement.value\n const { Text } = useComponentContext()\n\n const meta = question ? question.inputQuestionFormat : requirement.metadata\n if (!meta?.options) throw new Error(`RadioInput must have options:${JSON.stringify(question)}`)\n\n if (!key) return null\n\n return (\n <RadioGroupField\n isRequired\n name={key}\n //File new hire report setting cannot be changed after it has been configured.\n isDisabled={\n key.includes('fileNewHireReport') ? (value === undefined ? false : true) : isDisabled\n }\n description={\n description && (\n <Text as=\"span\">\n <span\n dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(description, dompurifyConfig) }}\n />\n </Text>\n )\n }\n label={label as string}\n options={meta.options.map(item => ({\n value: item.value,\n label: item.label,\n }))}\n />\n )\n}\n//TODO: This type is untested as of yet\nexport function DateField({\n question,\n requirement,\n isDisabled = false,\n}: (EmpQ | CompR) & NumberFieldProps) {\n const { key, label, description } = question ? question : requirement\n const value = question ? question.answers[0]?.value : requirement.value\n if (typeof value !== 'string' && typeof value !== 'undefined')\n throw new Error('Expecting value to be string for DateInput')\n\n if (!key) return null\n\n return (\n <DatePickerField\n isRequired\n name={key}\n defaultValue={value ? new Date(value) : null}\n label={label as string}\n description={description}\n isDisabled={isDisabled}\n />\n )\n}\n"],"names":["dompurifyConfig","QuestionInput","questionType","props","jsx","DateField","RadioInput","TextInput","SelectInput","NumberInput","question","requirement","isDisabled","key","label","description","value","meta","SelectField","item","_","mask","transform","useMaskedTransform","TextInputField","isCurrency","isPercent","t","useTranslation","wcDescription","adornmentEnd","NumberInputField","Text","useComponentContext","RadioGroupField","DOMPurify","DatePickerField"],"mappings":";;;;;;;;;;AAYA,MAAMA,IAAkB,EAAE,cAAc,CAAC,KAAK,KAAK,QAAQ,GAAG,cAAc,CAAC,UAAU,MAAM,EAAE;AAexF,SAASC,EAAc;AAAA,EAC5B,cAAAC;AAAA,EACA,GAAGC;AACL,GAEG;AACO,UAAAD,EAAa,YAAe,GAAA;AAAA,IAClC,KAAK;AACI,aAAA,gBAAAE,EAACC,GAAW,EAAA,GAAGF,EAAO,CAAA;AAAA,IAC/B,KAAK;AACI,aAAA,gBAAAC,EAACE,GAAY,EAAA,GAAGH,EAAO,CAAA;AAAA,I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