@gusto/embedded-react-sdk 0.28.0 → 0.30.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 (250) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/dist/components/Common/Fields/PercentageField/PercentageField.d.ts +8 -0
  3. package/dist/components/Common/Fields/PercentageField/PercentageField.js +58 -0
  4. package/dist/components/Common/Fields/PercentageField/PercentageField.js.map +1 -0
  5. package/dist/components/Common/Fields/PercentageField/index.d.ts +2 -0
  6. package/dist/components/Common/SignatureForm/SignatureForm.js +11 -12
  7. package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
  8. package/dist/components/Common/SignatureForm/SignatureFormActions.js +1 -1
  9. package/dist/components/Common/SignatureForm/SignatureFormFields.js +2 -2
  10. package/dist/components/Common/TaxInputs/TaxInputs.js +125 -98
  11. package/dist/components/Common/TaxInputs/TaxInputs.js.map +1 -1
  12. package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
  13. package/dist/components/Common/UI/FileInput/FileInput.js +1 -1
  14. package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
  15. package/dist/components/Common/UI/Tabs/Tabs.module.scss.js +5 -5
  16. package/dist/components/Company/AssignSignatory/AssignSignatory.js +1 -1
  17. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +1 -1
  18. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +1 -1
  19. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +17 -16
  20. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
  21. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +3 -4
  22. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  23. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +1 -1
  24. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +6 -5
  25. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +1 -1
  26. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +3 -4
  27. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  28. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +5 -6
  29. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  30. package/dist/components/Company/BankAccount/BankAccountForm/Form.js +5 -6
  31. package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
  32. package/dist/components/Company/BankAccount/BankAccountForm/context.js +3 -4
  33. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  34. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +5 -6
  35. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
  36. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +2 -2
  37. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +3 -4
  38. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  39. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +2 -2
  40. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +3 -4
  41. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  42. package/dist/components/Company/FederalTaxes/FederalTaxes.js +2 -2
  43. package/dist/components/Company/FederalTaxes/Form.js +3 -4
  44. package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
  45. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +5 -6
  46. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  47. package/dist/components/Company/Industry/Context.js +6 -7
  48. package/dist/components/Company/Industry/Context.js.map +1 -1
  49. package/dist/components/Company/Locations/LocationForm/Form.js +6 -5
  50. package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
  51. package/dist/components/Company/Locations/LocationForm/LocationForm.js +2 -2
  52. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -4
  53. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  54. package/dist/components/Company/Locations/LocationsList/LocationsList.js +39 -56
  55. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  56. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -4
  57. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  58. package/dist/components/Company/OnboardingOverview/Completed.js +2 -3
  59. package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
  60. package/dist/components/Company/OnboardingOverview/MissingRequirements.js +2 -3
  61. package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
  62. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +2 -2
  63. package/dist/components/Company/OnboardingOverview/context.js +3 -4
  64. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  65. package/dist/components/Company/PaySchedule/PaySchedule.js +2 -2
  66. package/dist/components/Company/PaySchedule/_parts/Edit.js +24 -23
  67. package/dist/components/Company/PaySchedule/_parts/Edit.js.map +1 -1
  68. package/dist/components/Company/PaySchedule/_parts/Head.js +8 -9
  69. package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
  70. package/dist/components/Company/PaySchedule/_parts/List.js +11 -12
  71. package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
  72. package/dist/components/Company/PaySchedule/usePaySchedule.js +5 -6
  73. package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
  74. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +60 -67
  75. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
  76. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +3 -4
  77. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  78. package/dist/components/Company/StateTaxes/StateTaxesForm/index.d.ts +2 -0
  79. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +3 -4
  80. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  81. package/dist/components/Company/StateTaxes/StateTaxesList/index.d.ts +2 -0
  82. package/dist/components/Company/index.d.ts +2 -0
  83. package/dist/components/Company/index.js +21 -17
  84. package/dist/components/Company/index.js.map +1 -1
  85. package/dist/components/Contractor/Address/Address.js +2 -2
  86. package/dist/components/Contractor/Address/Form.js +8 -7
  87. package/dist/components/Contractor/Address/Form.js.map +1 -1
  88. package/dist/components/Contractor/Address/useAddress.js +5 -6
  89. package/dist/components/Contractor/Address/useAddress.js.map +1 -1
  90. package/dist/components/Contractor/ContractorList/index.js +17 -17
  91. package/dist/components/Contractor/ContractorList/useContractorList.d.ts +8 -8
  92. package/dist/components/Contractor/ContractorList/useContractorList.js +9 -25
  93. package/dist/components/Contractor/ContractorList/useContractorList.js.map +1 -1
  94. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +2 -2
  95. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +1 -1
  96. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js +2 -3
  97. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
  98. package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js +23 -22
  99. package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js.map +1 -1
  100. package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js +7 -8
  101. package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js.map +1 -1
  102. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js +1 -1
  103. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.d.ts +1 -0
  104. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js +38 -24
  105. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js.map +1 -1
  106. package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.d.ts +1 -0
  107. package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js +95 -60
  108. package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js.map +1 -1
  109. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js +2 -3
  110. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
  111. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js +6 -7
  112. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -1
  113. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js +2 -3
  114. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js.map +1 -1
  115. package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js +67 -42
  116. package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js.map +1 -1
  117. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.d.ts +3 -1
  118. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +40 -36
  119. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
  120. package/dist/components/Contractor/Payments/types.d.ts +2 -0
  121. package/dist/components/Contractor/Profile/ContractorProfileForm.js +15 -15
  122. package/dist/components/Contractor/Profile/useContractorProfile.js +2 -3
  123. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
  124. package/dist/components/Contractor/Submit/Submit.js +1 -1
  125. package/dist/components/Employee/Compensation/Edit.js +27 -23
  126. package/dist/components/Employee/Compensation/Edit.js.map +1 -1
  127. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +10 -11
  128. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
  129. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +11 -12
  130. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
  131. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +11 -12
  132. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
  133. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +1 -1
  134. package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js +3 -2
  135. package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js.map +1 -1
  136. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +1 -1
  137. package/dist/components/Employee/DocumentSigner/DocumentList/List.js +2 -3
  138. package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
  139. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +3 -4
  140. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  141. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +1 -1
  142. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +3 -4
  143. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  144. package/dist/components/Employee/EmployeeList/EmployeeList.js +77 -95
  145. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  146. package/dist/components/Employee/EmployeeList/Head.js +2 -3
  147. package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
  148. package/dist/components/Employee/EmployeeList/useEmployeeList.js +3 -4
  149. package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
  150. package/dist/components/Employee/FederalTaxes/FederalForm.js +7 -7
  151. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +3 -4
  152. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
  153. package/dist/components/Employee/Landing/Landing.js +8 -8
  154. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +7 -7
  155. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +2 -2
  156. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +1 -1
  157. package/dist/components/Employee/PaymentMethod/Split.js +8 -8
  158. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +5 -6
  159. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  160. package/dist/components/Employee/Profile/AdminPersonalDetails.js +1 -1
  161. package/dist/components/Employee/Profile/HomeAddress.js +10 -9
  162. package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
  163. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +11 -10
  164. package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
  165. package/dist/components/Employee/Profile/useProfile.js +3 -4
  166. package/dist/components/Employee/Profile/useProfile.js.map +1 -1
  167. package/dist/components/Employee/StateTaxes/useStateTaxes.js +3 -4
  168. package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
  169. package/dist/components/Employee/Taxes/FederalForm.js +7 -7
  170. package/dist/components/Employee/Taxes/useTaxes.js +3 -4
  171. package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
  172. package/dist/components/Flow/Flow.js +2 -3
  173. package/dist/components/Flow/Flow.js.map +1 -1
  174. package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js +16 -16
  175. package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js.map +1 -1
  176. package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js +4 -4
  177. package/dist/components/InformationRequests/InformationRequests.js +1 -1
  178. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +9 -9
  179. package/dist/components/Payroll/PayPeriodDateForm/PayPeriodDateFormPresentation.js +1 -1
  180. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +2 -3
  181. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
  182. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +12 -12
  183. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +4 -1
  184. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
  185. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +3 -2
  186. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
  187. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +50 -68
  188. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
  189. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +39 -38
  190. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
  191. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +17 -18
  192. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
  193. package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.d.ts +17 -0
  194. package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.js +75 -0
  195. package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.js.map +1 -0
  196. package/dist/components/Payroll/PayrollExecutionFlow/index.d.ts +3 -0
  197. package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.d.ts +9 -0
  198. package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js +198 -0
  199. package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js.map +1 -0
  200. package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.test.d.ts +1 -0
  201. package/dist/components/Payroll/PayrollFlow/PayrollExecutionFlowContextual.d.ts +1 -0
  202. package/dist/components/Payroll/PayrollFlow/PayrollExecutionFlowContextual.js +49 -0
  203. package/dist/components/Payroll/PayrollFlow/PayrollExecutionFlowContextual.js.map +1 -0
  204. package/dist/components/Payroll/PayrollFlow/PayrollFlow.js +17 -13
  205. package/dist/components/Payroll/PayrollFlow/PayrollFlow.js.map +1 -1
  206. package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.d.ts +1 -0
  207. package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js.map +1 -1
  208. package/dist/components/Payroll/PayrollFlow/payrollStateMachine.d.ts +3 -6
  209. package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js +115 -300
  210. package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js.map +1 -1
  211. package/dist/components/Payroll/PayrollFlow/payrollStateMachine.test.d.ts +1 -0
  212. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +2 -3
  213. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
  214. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +2 -3
  215. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  216. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +15 -13
  217. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
  218. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +3 -2
  219. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  220. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js +2 -3
  221. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js.map +1 -1
  222. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +2 -3
  223. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
  224. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js +1 -1
  225. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js +6 -6
  226. package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js +2 -3
  227. package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js.map +1 -1
  228. package/dist/components/Payroll/index.d.ts +1 -0
  229. package/dist/components/Payroll/index.js +14 -12
  230. package/dist/components/Payroll/index.js.map +1 -1
  231. package/dist/components/Payroll/usePreparedPayrollData.js +2 -3
  232. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  233. package/dist/helpers/percentageConversion.d.ts +3 -0
  234. package/dist/helpers/percentageConversion.js +27 -0
  235. package/dist/helpers/percentageConversion.js.map +1 -0
  236. package/dist/helpers/percentageConversion.test.d.ts +1 -0
  237. package/dist/hooks/usePagination/usePagination.d.ts +15 -0
  238. package/dist/hooks/usePagination/usePagination.js +37 -0
  239. package/dist/hooks/usePagination/usePagination.js.map +1 -0
  240. package/dist/hooks/usePagination/usePagination.test.d.ts +1 -0
  241. package/dist/i18n/en/Company.StateTaxes.json.js +1 -1
  242. package/dist/i18n/en/Contractor.Payments.PaymentsList.json.js +28 -28
  243. package/dist/i18n/en/common.json.d.ts +3 -1
  244. package/dist/i18n/en/common.json.js +1 -1
  245. package/dist/shared/constants.d.ts +2 -0
  246. package/dist/shared/constants.js +11 -10
  247. package/dist/shared/constants.js.map +1 -1
  248. package/dist/style.css +1 -1
  249. package/dist/types/i18next.d.ts +7 -0
  250. package/package.json +12 -10
package/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.30.0
4
+
5
+ ### Features & Enhancements
6
+
7
+ - Extract PayrollExecutionFlow from PayrollFlow
8
+ - Export PayrollExecutionFlow for consumers
9
+
10
+ ### Fixes
11
+
12
+ - Adjusting RCC rendering
13
+ - Pass staged filenames to format and lint commands in pre-commit hook
14
+
15
+ ### Chores & Maintenance
16
+
17
+ - Speed up pre-commit hook
18
+ - Bump i18next from 25.8.10 to 25.8.11
19
+ - Bump eslint-plugin-storybook from 10.2.8 to 10.2.10
20
+ - Bump @storybook/react-vite from 10.2.9 to 10.2.10
21
+
22
+ ## 0.29.0
23
+
24
+ ### Features & Enhancements
25
+
26
+ - Export StateTaxesList and StateTaxesForm from Company API
27
+ - Add RFI alerts to contractor payment list
28
+
29
+ ### Fixes
30
+
31
+ - Convert state tax percentage inputs from decimal to human-readable format
32
+ - Improve UI of tab component
33
+
34
+ ### Chores & Maintenance
35
+
36
+ - Rewrite contractor onboarding documentation
37
+ - Implement semver-based PR title validation and auto-versioning
38
+ - Switch auto-version workflow to manual dispatch
39
+ - Add reusable pagination hook and refactor components
40
+ - Improve cursor commands for branch creation and PR defaults
41
+ - Bump @storybook/addon-a11y, addon-docs, addon-onboarding, react-vite from 10.2.8 to 10.2.9
42
+ - Bump typescript-eslint from 8.55.0 to 8.56.0
43
+ - Bump i18next from 25.8.5 to 25.8.8
44
+ - Bump react-error-boundary from 6.1.0 to 6.1.1
45
+ - Bump dotenv from 17.2.4 to 17.3.1
46
+
3
47
  ## 0.28.0
4
48
 
5
49
  ### Features & Enhancements
@@ -0,0 +1,8 @@
1
+ import { NumberInputProps } from '../../UI/NumberInput/NumberInputTypes';
2
+ export interface PercentageFieldProps extends Pick<NumberInputProps, 'isDisabled' | 'className' | 'label' | 'isRequired' | 'description' | 'errorMessage'> {
3
+ name: string;
4
+ decimalValue?: string | number | boolean | null;
5
+ decimalMin?: string;
6
+ decimalMax?: string;
7
+ }
8
+ export declare function PercentageField({ decimalValue, decimalMin, decimalMax, ...props }: PercentageFieldProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,58 @@
1
+ import { jsx as N } from "react/jsx-runtime";
2
+ import { useMemo as d } from "react";
3
+ import { useTranslation as C } from "react-i18next";
4
+ import { useField as F } from "../hooks/useField.js";
5
+ import { useComponentContext as b } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
6
+ import { decimalToPercent as u, percentToDecimal as h } from "../../../../helpers/percentageConversion.js";
7
+ function x(t) {
8
+ if (!(t == null || typeof t == "boolean"))
9
+ return String(t);
10
+ }
11
+ function I({
12
+ decimalValue: t,
13
+ decimalMin: o,
14
+ decimalMax: n,
15
+ ...a
16
+ }) {
17
+ const f = b(), { t: i } = C("common"), p = d(() => {
18
+ const r = {};
19
+ if (o !== void 0) {
20
+ const m = parseFloat(o);
21
+ r.min = (s) => {
22
+ const e = Number(s);
23
+ return isNaN(e) ? !0 : e >= m || i("validations.percentageMin", { min: u(o) });
24
+ };
25
+ }
26
+ if (n !== void 0) {
27
+ const m = parseFloat(n);
28
+ r.max = (s) => {
29
+ const e = Number(s);
30
+ return isNaN(e) ? !0 : e <= m || i("validations.percentageMax", { max: u(n) });
31
+ };
32
+ }
33
+ return r;
34
+ }, [o, n, i]), { value: c, onChange: l, ...g } = F({
35
+ ...a,
36
+ defaultValue: x(t),
37
+ rules: { validate: p }
38
+ }), v = (r) => {
39
+ l(h(r));
40
+ };
41
+ return /* @__PURE__ */ N(
42
+ f.NumberInput,
43
+ {
44
+ ...a,
45
+ ...g,
46
+ value: u(c),
47
+ onChange: v,
48
+ min: o ? u(o) : void 0,
49
+ max: n ? u(n) : void 0,
50
+ format: "percent",
51
+ maximumFractionDigits: 4
52
+ }
53
+ );
54
+ }
55
+ export {
56
+ I as PercentageField
57
+ };
58
+ //# sourceMappingURL=PercentageField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PercentageField.js","sources":["../../../../../src/components/Common/Fields/PercentageField/PercentageField.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport type { NumberInputProps } from '@/components/Common/UI/NumberInput/NumberInputTypes'\nimport { useField } from '@/components/Common/Fields/hooks/useField'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { decimalToPercent, percentToDecimal } from '@/helpers/percentageConversion'\n\nexport interface PercentageFieldProps extends Pick<\n NumberInputProps,\n 'isDisabled' | 'className' | 'label' | 'isRequired' | 'description' | 'errorMessage'\n> {\n name: string\n decimalValue?: string | number | boolean | null\n decimalMin?: string\n decimalMax?: string\n}\n\nfunction toDefaultString(value?: string | number | boolean | null): string | undefined {\n if (value === null || value === undefined || typeof value === 'boolean') return undefined\n return String(value)\n}\n\nexport function PercentageField({\n decimalValue,\n decimalMin,\n decimalMax,\n ...props\n}: PercentageFieldProps) {\n const Components = useComponentContext()\n const { t } = useTranslation('common')\n\n const validationRules = useMemo(() => {\n const rules: Record<string, (value: string) => string | true> = {}\n\n if (decimalMin !== undefined) {\n const minNum = parseFloat(decimalMin)\n rules.min = (value: string) => {\n const num = Number(value)\n if (isNaN(num)) return true\n return (\n num >= minNum || t('validations.percentageMin', { min: decimalToPercent(decimalMin) })\n )\n }\n }\n\n if (decimalMax !== undefined) {\n const maxNum = parseFloat(decimalMax)\n rules.max = (value: string) => {\n const num = Number(value)\n if (isNaN(num)) return true\n return (\n num <= maxNum || t('validations.percentageMax', { max: decimalToPercent(decimalMax) })\n )\n }\n }\n\n return rules\n }, [decimalMin, decimalMax, t])\n\n const { value, onChange, ...fieldProps } = useField({\n ...props,\n defaultValue: toDefaultString(decimalValue),\n rules: { validate: validationRules },\n })\n\n const handleChange = (percentValue: number) => {\n onChange(percentToDecimal(percentValue))\n }\n\n return (\n <Components.NumberInput\n {...props}\n {...fieldProps}\n value={decimalToPercent(value)}\n onChange={handleChange}\n min={decimalMin ? decimalToPercent(decimalMin) : undefined}\n max={decimalMax ? decimalToPercent(decimalMax) : undefined}\n format=\"percent\"\n maximumFractionDigits={4}\n />\n )\n}\n"],"names":["toDefaultString","value","PercentageField","decimalValue","decimalMin","decimalMax","props","Components","useComponentContext","t","useTranslation","validationRules","useMemo","rules","minNum","num","decimalToPercent","maxNum","onChange","fieldProps","useField","handleChange","percentValue","percentToDecimal","jsx"],"mappings":";;;;;;AAiBA,SAASA,EAAgBC,GAA8D;AACrF,MAAI,EAAAA,KAAU,QAA+B,OAAOA,KAAU;AAC9D,WAAO,OAAOA,CAAK;AACrB;AAEO,SAASC,EAAgB;AAAA,EAC9B,cAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,GAAGC;AACL,GAAyB;AACvB,QAAMC,IAAaC,EAAA,GACb,EAAE,GAAAC,EAAA,IAAMC,EAAe,QAAQ,GAE/BC,IAAkBC,EAAQ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{ PercentageField, type PercentageFieldProps } from './PercentageField';
@@ -2,30 +2,29 @@ import { jsx as r } from "react/jsx-runtime";
2
2
  import { z as o } from "zod";
3
3
  import { useForm as s, FormProvider as a } from "react-hook-form";
4
4
  import { zodResolver as l } from "@hookform/resolvers/zod";
5
- import e from "./SignatureForm.module.scss.js";
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 "classnames";
9
- import "../../../shared/constants.js";
10
8
  import "react-i18next";
9
+ import "classnames";
11
10
  import "../../../contexts/ComponentAdapter/useComponentContext.js";
12
11
  import "react";
13
- const p = o.object({
12
+ const f = o.object({
14
13
  signature: o.string().min(1),
15
14
  confirmSignature: o.literal(!0)
16
- }), f = {
15
+ }), p = {
17
16
  signature: ""
18
17
  };
19
- function V({ onSubmit: m, children: i, formProps: n }) {
20
- const t = s({
21
- resolver: l(p),
22
- defaultValues: f,
18
+ function N({ onSubmit: m, children: i, formProps: n }) {
19
+ const e = s({
20
+ resolver: l(f),
21
+ defaultValues: p,
23
22
  ...n
24
23
  });
25
- return /* @__PURE__ */ r(a, { ...t, children: /* @__PURE__ */ r(u, { onSubmit: t.handleSubmit(m), className: e.container, children: /* @__PURE__ */ r("div", { className: e.formFields, children: /* @__PURE__ */ r(c, { flexDirection: "column", gap: 20, children: i }) }) }) });
24
+ 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 }) }) }) });
26
25
  }
27
26
  export {
28
- V as SignatureForm,
29
- p as SignatureFormSchema
27
+ N as SignatureForm,
28
+ f as SignatureFormSchema
30
29
  };
31
30
  //# 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":";;;;;;;;;;;;AAOO,MAAMA,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,SACE,gBAAAI,EAACC,GAAA,EAAc,GAAGJ,GAChB,UAAA,gBAAAG,EAACE,GAAA,EAAK,UAAUL,EAAQ,aAAaH,CAAQ,GAAG,WAAWS,EAAO,WAChE,UAAA,gBAAAH,EAAC,OAAA,EAAI,WAAWG,EAAO,YACrB,UAAA,gBAAAH,EAACI,GAAA,EAAK,eAAc,UAAS,KAAK,IAC/B,UAAAT,EAAA,CACH,EAAA,CACF,EAAA,CACF,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":";;;;;;;;;;;AAOO,MAAMA,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,SACE,gBAAAI,EAACC,GAAA,EAAc,GAAGJ,GAChB,UAAA,gBAAAG,EAACE,GAAA,EAAK,UAAUL,EAAQ,aAAaH,CAAQ,GAAG,WAAWS,EAAO,WAChE,UAAA,gBAAAH,EAAC,OAAA,EAAI,WAAWG,EAAO,YACrB,UAAA,gBAAAH,EAACI,GAAA,EAAK,eAAc,UAAS,KAAK,IAC/B,UAAAT,EAAA,CACH,EAAA,CACF,EAAA,CACF,GACF;AAEJ;"}
@@ -1,8 +1,8 @@
1
1
  import { jsxs as m, jsx as n } from "react/jsx-runtime";
2
2
  import "../../../shared/constants.js";
3
+ import "react-i18next";
3
4
  import "classnames";
4
5
  import { ActionsLayout as p } from "../ActionsLayout/ActionsLayout.js";
5
- import "react-i18next";
6
6
  import { useComponentContext as s } from "../../../contexts/ComponentAdapter/useComponentContext.js";
7
7
  import "react";
8
8
  function y({
@@ -1,10 +1,10 @@
1
1
  import { jsxs as n, Fragment as s, jsx as r } from "react/jsx-runtime";
2
2
  import "../../../shared/constants.js";
3
- import "classnames";
4
- import { TextInputField as p } from "../Fields/TextInputField/TextInputField.js";
5
3
  import "react-i18next";
4
+ import "classnames";
6
5
  import "../../../contexts/ComponentAdapter/useComponentContext.js";
7
6
  import "react";
7
+ import { TextInputField as p } from "../Fields/TextInputField/TextInputField.js";
8
8
  import { CheckboxField as a } from "../Fields/CheckboxField/CheckboxField.js";
9
9
  function b({
10
10
  signatureLabel: e,
@@ -1,178 +1,205 @@
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 p } from "../Fields/SelectField/SelectField.js";
5
- import { TextInputField as w } from "../Fields/TextInputField/TextInputField.js";
6
- import { NumberInputField as k } from "../Fields/NumberInputField/NumberInputField.js";
7
- import { RadioGroupField as R } from "../Fields/RadioGroupField/RadioGroupField.js";
8
- import { DatePickerField as _ } from "../Fields/DatePickerField/DatePickerField.js";
9
- import { useComponentContext as x } from "../../../contexts/ComponentAdapter/useComponentContext.js";
10
- import { useMaskedTransform as D } from "../../../helpers/mask.js";
11
- const T = { ALLOWED_TAGS: ["a", "b", "strong"], ALLOWED_ATTR: ["target", "href"] };
12
- function M({
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import k from "dompurify";
3
+ import { useTranslation as D } from "react-i18next";
4
+ import { SelectField as w } from "../Fields/SelectField/SelectField.js";
5
+ import { TextInputField as R } from "../Fields/TextInputField/TextInputField.js";
6
+ import { NumberInputField as x } from "../Fields/NumberInputField/NumberInputField.js";
7
+ import { RadioGroupField as _ } from "../Fields/RadioGroupField/RadioGroupField.js";
8
+ import { DatePickerField as T } from "../Fields/DatePickerField/DatePickerField.js";
9
+ import { PercentageField as b } from "../Fields/PercentageField/PercentageField.js";
10
+ import { useComponentContext as h } from "../../../contexts/ComponentAdapter/useComponentContext.js";
11
+ import { useLocale as C } from "../../../contexts/LocaleProvider/useLocale.js";
12
+ import { useMaskedTransform as I } from "../../../helpers/mask.js";
13
+ import { formatPercentLabel as g } from "../../../helpers/percentageConversion.js";
14
+ const F = { ALLOWED_TAGS: ["a", "b", "strong"], ALLOWED_ATTR: ["target", "href"] };
15
+ function B({
13
16
  questionType: e,
14
- ...t
17
+ ...a
15
18
  }) {
16
19
  switch (e.toLowerCase()) {
17
20
  case "date":
18
- return /* @__PURE__ */ a(I, { ...t });
21
+ return /* @__PURE__ */ t(N, { ...a });
19
22
  case "radio":
20
- return /* @__PURE__ */ a(C, { ...t });
23
+ return /* @__PURE__ */ t(L, { ...a });
21
24
  case "text":
22
25
  case "account_number":
23
- return /* @__PURE__ */ a(d, { ...t });
26
+ return /* @__PURE__ */ t(y, { ...a });
24
27
  case "select":
25
- return /* @__PURE__ */ a(h, { ...t });
28
+ return /* @__PURE__ */ t(E, { ...a });
26
29
  case "number":
27
- return /* @__PURE__ */ a(m, { ...t });
30
+ return /* @__PURE__ */ t(p, { ...a });
28
31
  case "workers_compensation_rate":
29
- return /* @__PURE__ */ a(m, { ...t, isPercent: t.requirement?.metadata?.rateType === "percent" });
32
+ return /* @__PURE__ */ t(p, { ...a, isPercent: a.requirement?.metadata?.rateType === "percent" });
30
33
  case "percent":
31
34
  case "tax_rate":
32
- return /* @__PURE__ */ a(g, { ...t });
35
+ return /* @__PURE__ */ t(S, { ...a });
33
36
  case "currency":
34
- return /* @__PURE__ */ a(m, { ...t, isCurrency: !0 });
37
+ return /* @__PURE__ */ t(p, { ...a, isCurrency: !0 });
35
38
  default:
36
- return /* @__PURE__ */ a(d, { ...t });
39
+ return /* @__PURE__ */ t(y, { ...a });
37
40
  }
38
41
  }
39
- function h({ question: e, requirement: t, isDisabled: l = !1 }) {
40
- const { key: r, label: s, description: o } = e || t, n = e ? e.answers[0]?.value : t.value, u = e ? e.inputQuestionFormat : t.metadata;
41
- if (!u?.options) throw new Error("Select input must have options");
42
- return r ? /* @__PURE__ */ a(
43
- p,
42
+ function E({ question: e, requirement: a, isDisabled: i = !1 }) {
43
+ const { key: r, label: u, description: o } = e || a, n = e ? e.answers[0]?.value : a.value, c = e ? e.inputQuestionFormat : a.metadata;
44
+ if (!c?.options) throw new Error("Select input must have options");
45
+ return r ? /* @__PURE__ */ t(
46
+ w,
44
47
  {
45
48
  isRequired: !0,
46
49
  name: r,
47
50
  defaultValue: n,
48
- label: s,
51
+ label: u,
49
52
  description: o,
50
- isDisabled: r.includes("fileNewHireReport") ? n !== void 0 : l,
51
- options: u.options.map((i, c) => ({
52
- value: i.value,
53
- label: i.label
53
+ isDisabled: r.includes("fileNewHireReport") ? n !== void 0 : i,
54
+ options: c.options.map((s, l) => ({
55
+ value: s.value,
56
+ label: s.label
54
57
  }))
55
58
  }
56
59
  ) : null;
57
60
  }
58
- function d({
61
+ function y({
59
62
  question: e,
60
- requirement: t,
61
- isDisabled: l = !1,
63
+ requirement: a,
64
+ isDisabled: i = !1,
62
65
  type: r = "text",
63
- isPercent: s = !1
66
+ isPercent: u = !1
64
67
  }) {
65
- const { key: o, label: n, description: u } = e || t, i = e ? e.answers[0]?.value : t.value, c = t?.metadata?.mask ?? null, f = D(c);
66
- return o ? /* @__PURE__ */ a(
67
- w,
68
+ const { key: o, label: n, description: c } = e || a, s = e ? e.answers[0]?.value : a.value, l = a?.metadata?.mask ?? null, d = I(l);
69
+ return o ? /* @__PURE__ */ t(
70
+ R,
68
71
  {
69
72
  isRequired: !0,
70
73
  name: o,
71
74
  label: n,
72
- defaultValue: i,
73
- description: u,
74
- isDisabled: l,
75
- transform: c ? f : void 0,
76
- placeholder: c || void 0,
75
+ defaultValue: s,
76
+ description: c,
77
+ isDisabled: i,
78
+ transform: l ? d : void 0,
79
+ placeholder: l || void 0,
77
80
  type: r,
78
- adornmentEnd: s ? "%" : void 0
81
+ adornmentEnd: u ? "%" : void 0
79
82
  }
80
83
  ) : null;
81
84
  }
82
- function m({
85
+ function p({
83
86
  question: e,
84
- requirement: t,
85
- isCurrency: l,
87
+ requirement: a,
88
+ isCurrency: i,
86
89
  isPercent: r,
87
- isDisabled: s = !1
90
+ isDisabled: u = !1
88
91
  }) {
89
- const { t: o } = y("common"), { key: n, label: u, description: i } = e || t, c = e ? e.answers[0]?.value : t.value;
92
+ const { t: o } = D("common"), { key: n, label: c, description: s } = e || a, l = e ? e.answers[0]?.value : a.value;
90
93
  if (!n) return null;
91
- const f = 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" ? o("inputs.workersCompensationRatePerHourAdornment") : void 0;
92
- return /* @__PURE__ */ a(
93
- k,
94
+ const d = a?.metadata?.type === "workers_compensation_rate" && a.metadata.riskClassCode !== void 0 ? `${a.metadata.riskClassCode}: ${a.metadata.riskClassDescription}` : null, m = a?.metadata?.rateType === "currency_per_hour" ? o("inputs.workersCompensationRatePerHourAdornment") : void 0;
95
+ return /* @__PURE__ */ t(
96
+ x,
94
97
  {
95
98
  isRequired: !0,
96
99
  name: n,
97
- label: u,
98
- description: i ?? f,
99
- defaultValue: typeof c < "u" ? Number(c) : void 0,
100
- format: l ? "currency" : r ? "percent" : "decimal",
101
- isDisabled: s,
100
+ label: c,
101
+ description: s ?? d,
102
+ defaultValue: typeof l < "u" ? Number(l) : void 0,
103
+ format: i ? "currency" : r ? "percent" : "decimal",
104
+ isDisabled: u,
102
105
  maximumFractionDigits: r ? 4 : void 0,
103
- adornmentEnd: v
106
+ adornmentEnd: m
104
107
  }
105
108
  );
106
109
  }
107
- function C({ question: e, requirement: t, isDisabled: l = !1 }) {
108
- const { key: r, label: s, description: o } = e || t, n = e ? e.answers[0]?.value : t.value, { Text: u } = x(), i = e ? e.inputQuestionFormat : t.metadata;
109
- if (!i?.options) throw new Error(`RadioInput must have options:${JSON.stringify(e)}`);
110
- return r ? /* @__PURE__ */ a(
111
- R,
110
+ function L({ question: e, requirement: a, isDisabled: i = !1 }) {
111
+ const { key: r, label: u, description: o } = e || a, n = e ? e.answers[0]?.value : a.value, { Text: c } = h(), s = e ? e.inputQuestionFormat : a.metadata;
112
+ if (!s?.options) throw new Error(`RadioInput must have options:${JSON.stringify(e)}`);
113
+ return r ? /* @__PURE__ */ t(
114
+ _,
112
115
  {
113
116
  isRequired: !0,
114
117
  name: r,
115
- isDisabled: r.includes("fileNewHireReport") ? n !== void 0 : l,
116
- description: o && /* @__PURE__ */ a(u, { as: "span", children: /* @__PURE__ */ a(
118
+ isDisabled: r.includes("fileNewHireReport") ? n !== void 0 : i,
119
+ description: o && /* @__PURE__ */ t(c, { as: "span", children: /* @__PURE__ */ t(
117
120
  "span",
118
121
  {
119
- dangerouslySetInnerHTML: { __html: b.sanitize(o, T) }
122
+ dangerouslySetInnerHTML: { __html: k.sanitize(o, F) }
120
123
  }
121
124
  ) }),
122
- label: s,
123
- options: i.options.map((c) => ({
124
- value: c.value,
125
- label: c.label
125
+ label: u,
126
+ options: s.options.map((l) => ({
127
+ value: l.value,
128
+ label: l.label
126
129
  }))
127
130
  }
128
131
  ) : null;
129
132
  }
130
- function I({
133
+ function N({
131
134
  question: e,
132
- requirement: t,
133
- isDisabled: l = !1
135
+ requirement: a,
136
+ isDisabled: i = !1
134
137
  }) {
135
- const { key: r, label: s, description: o } = e || t, n = e ? e.answers[0]?.value : t.value;
138
+ const { key: r, label: u, description: o } = e || a, n = e ? e.answers[0]?.value : a.value;
136
139
  if (typeof n != "string" && typeof n < "u")
137
140
  throw new Error("Expecting value to be string for DateInput");
138
- return r ? /* @__PURE__ */ a(
139
- _,
141
+ return r ? /* @__PURE__ */ t(
142
+ T,
140
143
  {
141
144
  isRequired: !0,
142
145
  name: r,
143
146
  defaultValue: n ? new Date(n) : null,
144
- label: s,
147
+ label: u,
145
148
  description: o,
146
- isDisabled: l
149
+ isDisabled: i
147
150
  }
148
151
  ) : null;
149
152
  }
150
- function g({ requirement: e, question: t, ...l }) {
153
+ function S({ requirement: e, question: a, ...i }) {
154
+ const { locale: r } = C();
151
155
  if (e) {
152
- const { key: r, metadata: s, label: o, description: n } = e, { validation: u } = s || {};
153
- return u?.type === "one_of" ? /* @__PURE__ */ a(
154
- p,
156
+ const { key: s, metadata: l, label: d, description: m } = e, { validation: f } = l || {};
157
+ return f?.type === "one_of" ? /* @__PURE__ */ t(
158
+ w,
155
159
  {
156
160
  isRequired: !0,
157
- name: r || "",
158
- label: o || "",
159
- description: n,
160
- options: u.rates?.map((i) => ({
161
- value: i,
162
- label: i
161
+ name: s || "",
162
+ label: d || "",
163
+ description: m,
164
+ options: f.rates?.map((v) => ({
165
+ value: v,
166
+ label: g(v, r)
163
167
  })) || []
164
168
  }
165
- ) : /* @__PURE__ */ a(d, { requirement: e, ...l, type: "number", isPercent: !0 });
169
+ ) : /* @__PURE__ */ t(
170
+ b,
171
+ {
172
+ isRequired: !0,
173
+ name: s || "",
174
+ label: d || "",
175
+ description: m,
176
+ decimalValue: e.value,
177
+ decimalMin: f?.min,
178
+ decimalMax: f?.max,
179
+ isDisabled: i.isDisabled
180
+ }
181
+ );
166
182
  }
167
- return /* @__PURE__ */ a(d, { question: t, ...l, type: "number", isPercent: !0 });
183
+ const { key: u, label: o, description: n, answers: c } = a;
184
+ return /* @__PURE__ */ t(
185
+ b,
186
+ {
187
+ isRequired: !0,
188
+ name: u || "",
189
+ label: o || "",
190
+ description: n,
191
+ decimalValue: c[0]?.value,
192
+ isDisabled: i.isDisabled
193
+ }
194
+ );
168
195
  }
169
196
  export {
170
- I as DateField,
171
- m as NumberInput,
172
- M as QuestionInput,
173
- C as RadioInput,
174
- h as SelectInput,
175
- g as TaxRateInput,
176
- d as TextInput
197
+ N as DateField,
198
+ p as NumberInput,
199
+ B as QuestionInput,
200
+ L as RadioInput,
201
+ E as SelectInput,
202
+ S as TaxRateInput,
203
+ y as TextInput
177
204
  };
178
205
  //# 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\ntype TextInputProps = { type?: string; 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 <TaxRateInput {...props} />\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({\n question,\n requirement,\n isDisabled = false,\n type = 'text',\n isPercent = false,\n}: (EmpQ | CompR) & TextInputProps) {\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 type={type}\n adornmentEnd={isPercent ? '%' : undefined}\n />\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\nexport function TaxRateInput({ requirement, question, ...props }: EmpQ | CompR) {\n if (requirement) {\n // Covers case for tax rate where the rate is a one_of option and must be submitted as a string\n // of enumerated rate values provided\n const { key, metadata, label, description } = requirement\n const { validation } = metadata || {}\n return validation?.type === 'one_of' ? (\n <SelectField\n isRequired\n name={key || ''}\n label={label || ''}\n description={description}\n options={\n validation.rates?.map(rate => ({\n value: rate,\n label: rate,\n })) || []\n }\n />\n ) : (\n <TextInput requirement={requirement} {...props} type=\"number\" isPercent />\n )\n }\n\n return <TextInput question={question} {...props} type=\"number\" isPercent />\n}\n"],"names":["dompurifyConfig","QuestionInput","questionType","props","jsx","DateField","RadioInput","TextInput","SelectInput","NumberInput","TaxRateInput","question","requirement","isDisabled","key","label","description","value","meta","SelectField","item","_","type","isPercent","mask","transform","useMaskedTransform","TextInputField","isCurrency","t","useTranslation","wcDescription","adornmentEnd","NumberInputField","Text","useComponentContext","RadioGroupField","DOMPurify","DatePickerField","metadata","validation","rate"],"mappings":";;;;;;;;;;AAYA,MAAMA,IAAkB,EAAE,cAAc,CAAC,KAAK,KAAK,QAAQ,GAAG,cAAc,CAAC,UAAU,MAAM,EAAA;AAiBtF,SAASC,EAAc;AAAA,EAC5B,cAAAC;AAAA,EACA,GAAGC;AACL,GA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IXlC,GAAA,EAAU,aAAAK,GAA2B,GAAGT,GAAO,MAAK,UAAS,WAAS,IAAC;AAAA,EAE5E;AAEA,SAAO,gBAAAC,EAACG,KAAU,UAAAI,GAAqB,GAAGR,GAAO,MAAK,UAAS,WAAS,IAAC;AAC3E;"}
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 { PercentageField } from '../Fields/PercentageField/PercentageField'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useLocale } from '@/contexts/LocaleProvider'\nimport { useMaskedTransform } from '@/helpers/mask'\nimport { formatPercentLabel } from '@/helpers/percentageConversion'\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\ntype TextInputProps = { type?: string; 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 <TaxRateInput {...props} />\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({\n question,\n requirement,\n isDisabled = false,\n type = 'text',\n isPercent = false,\n}: (EmpQ | CompR) & TextInputProps) {\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 type={type}\n adornmentEnd={isPercent ? '%' : undefined}\n />\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\nexport function TaxRateInput({ requirement, question, ...props }: EmpQ | CompR) {\n const { locale } = useLocale()\n\n if (requirement) {\n const { key, metadata, label, description } = requirement\n const { validation } = metadata || {}\n\n if (validation?.type === 'one_of') {\n return (\n <SelectField\n isRequired\n name={key || ''}\n label={label || ''}\n description={description}\n options={\n validation.rates?.map(rate => ({\n value: rate,\n label: formatPercentLabel(rate, locale),\n })) || []\n }\n />\n )\n }\n\n return (\n <PercentageField\n isRequired\n name={key || ''}\n label={label || ''}\n description={description}\n decimalValue={requirement.value}\n decimalMin={validation?.min}\n decimalMax={validation?.max}\n isDisabled={props.isDisabled}\n />\n )\n }\n\n const { key, label, description, answers } = question\n return (\n <PercentageField\n isRequired\n name={key || ''}\n label={label || ''}\n description={description}\n decimalValue={answers[0]?.value}\n isDisabled={props.isDisabled}\n />\n )\n}\n"],"names":["dompurifyConfig","QuestionInput","questionType","props","jsx","DateField","RadioInput","TextInput","SelectInput","NumberInput","TaxRateInput","question","requirement","isDisabled","key","label","description","value","meta","SelectField","item","_","type","isPercent","mask","transform","useMaskedTransform","TextInputField","isCurrency","t","useTranslation","wcDescription","adornmentEnd","NumberInputField","Text","useComponentContext","RadioGroupField","DOMPurify","DatePickerField","locale","useLocale","metadata","validation","rate","formatPercentLabel","PercentageField","answers"],"mappings":";;;;;;;;;;;;;AAeA,MAAMA,IAAkB,EAAE,cAAc,CAAC,KAAK,KAAK,QAAQ,GAAG,cAAc,CAAC,UAAU,MAAM,EAAA;AAiBtF,SAASC,EAAc;AAAA,EAC5B,cAAAC;AAAA,EACA,GAAGC;AACL,GAEG;AACD,UAAQD,EAAa,eAAY;AAAA,IAC/B,KAAK;AACH,aAAO,gBAAAE,EAACC,GAAA,EAAW,GAAGF,EAAA,CAAO;AAAA,IAC/B,KAAK;AACH,aAAO,gBAAAC,EAACE,GAAA,EAAY,GAAGH,EAAA,CAAO;AAAA,IAChC,KAAK;AAAA,IACL,KAAK;AACH,aAAO,gBAAAC,EAACG,GAAA,EAAW,GAAGJ,EAAA,CAAO;AAAA,IAC/B,KAAK;AACH,aAAO,gBAAAC,EA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;AAAA,IAAA;AAAA,EAGxB;AAEA,QAAM,EAAE,KAAAW,GAAK,OAAAC,GAAO,aAAAC,GAAa,SAAA8B,MAAYnC;AAC7C,SACE,gBAAAP;AAAA,IAACyC;AAAA,IAAA;AAAA,MACC,YAAU;AAAA,MACV,MAAM/B,KAAO;AAAA,MACb,OAAOC,KAAS;AAAA,MAChB,aAAAC;AAAA,MACA,cAAc8B,EAAQ,CAAC,GAAG;AAAA,MAC1B,YAAY3C,EAAM;AAAA,IAAA;AAAA,EAAA;AAGxB;"}
@@ -1,9 +1,9 @@
1
1
  import { jsx as l } from "react/jsx-runtime";
2
2
  import h from "classnames";
3
- import { Flex as u } from "../../Flex/Flex.js";
4
3
  import { BreadcrumbsDefaults as k } from "./BreadcrumbsTypes.js";
5
4
  import r from "./Breadcrumbs.module.scss.js";
6
5
  import { applyMissingDefaults as x } from "../../../../helpers/applyMissingDefaults.js";
6
+ import { Flex as u } from "../../Flex/Flex.js";
7
7
  function I(p) {
8
8
  const f = x(p, k), {
9
9
  className: s,
@@ -7,13 +7,13 @@ import { FileInputDefaults as K } from "./FileInputTypes.js";
7
7
  import n from "./FileInput.module.scss.js";
8
8
  import { applyMissingDefaults as L } from "../../../../helpers/applyMissingDefaults.js";
9
9
  import { FieldLayout as O } from "../../FieldLayout/FieldLayout.js";
10
- import { Flex as y } from "../../Flex/Flex.js";
11
10
  import { ButtonIcon as R } from "../Button/ButtonIcon.js";
12
11
  import W from "../../../../assets/icons/icon-trashcan.svg.js";
13
12
  import Z from "../../../../assets/icons/icon-file-outline.svg.js";
14
13
  import $ from "../../../../assets/icons/icon-file-pdf.svg.js";
15
14
  import H from "../../../../assets/icons/icon-file-png.svg.js";
16
15
  import V from "../../../../assets/icons/icon-file-jpg.svg.js";
16
+ import { Flex as y } from "../../Flex/Flex.js";
17
17
  function Q(i) {
18
18
  return i === "application/pdf" ? $ : i === "image/png" ? H : i === "image/jpeg" || i === "image/jpg" ? V : Z;
19
19
  }