@gusto/embedded-react-sdk 0.16.0 → 0.18.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 (387) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/dist/components/Base/Base.js +50 -65
  3. package/dist/components/Base/Base.js.map +1 -1
  4. package/dist/components/Base/useBase.d.ts +2 -5
  5. package/dist/components/Base/useBase.js.map +1 -1
  6. package/dist/components/Common/EmptyData/EmptyData.js +10 -10
  7. package/dist/components/Common/EmptyData/EmptyData.js.map +1 -1
  8. package/dist/components/Common/EmptyData/EmptyData.module.scss.js +5 -3
  9. package/dist/components/Common/EmptyData/EmptyData.module.scss.js.map +1 -1
  10. package/dist/components/Common/FieldDescription/FieldDescription.module.scss.js +1 -1
  11. package/dist/components/Common/FlowBreadcrumbs/FlowBreadcrumbs.js +41 -33
  12. package/dist/components/Common/FlowBreadcrumbs/FlowBreadcrumbs.js.map +1 -1
  13. package/dist/components/Common/HamburgerMenu/HamburgerMenu.js +1 -1
  14. package/dist/components/Common/HamburgerMenu/HamburgerMenu.js.map +1 -1
  15. package/dist/components/Common/SignatureForm/SignatureForm.js +4 -6
  16. package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
  17. package/dist/components/Common/SignatureForm/SignatureFormActions.js +10 -12
  18. package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
  19. package/dist/components/Common/SignatureForm/SignatureFormFields.js +6 -8
  20. package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
  21. package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.d.ts +1 -1
  22. package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +32 -18
  23. package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js.map +1 -1
  24. package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.module.scss.js +12 -12
  25. package/dist/components/Common/UI/Breadcrumbs/BreadcrumbsTypes.d.ts +14 -0
  26. package/dist/components/Common/UI/Breadcrumbs/BreadcrumbsTypes.js +8 -0
  27. package/dist/components/Common/UI/Breadcrumbs/BreadcrumbsTypes.js.map +1 -0
  28. package/dist/components/Common/UI/DatePicker/DatePicker.module.scss.js +8 -8
  29. package/dist/components/Common/UI/DescriptionList/DescriptionList.d.ts +2 -0
  30. package/dist/components/Common/UI/DescriptionList/DescriptionList.js +16 -0
  31. package/dist/components/Common/UI/DescriptionList/DescriptionList.js.map +1 -0
  32. package/dist/components/Common/UI/DescriptionList/DescriptionList.module.scss.js +10 -0
  33. package/dist/components/Common/UI/DescriptionList/DescriptionList.module.scss.js.map +1 -0
  34. package/dist/components/Common/UI/DescriptionList/DescriptionListTypes.d.ts +10 -0
  35. package/dist/components/Common/UI/DescriptionList/DescriptionListTypes.js +5 -0
  36. package/dist/components/Common/UI/DescriptionList/DescriptionListTypes.js.map +1 -0
  37. package/dist/components/Common/UI/DescriptionList/index.d.ts +3 -0
  38. package/dist/components/Common/UI/Dialog/Dialog.js +50 -76
  39. package/dist/components/Common/UI/Dialog/Dialog.js.map +1 -1
  40. package/dist/components/Common/UI/Dialog/Dialog.module.scss.js +8 -14
  41. package/dist/components/Common/UI/Dialog/Dialog.module.scss.js.map +1 -1
  42. package/dist/components/Common/UI/Link/LinkTypes.d.ts +7 -6
  43. package/dist/components/Common/UI/Modal/Modal.d.ts +2 -0
  44. package/dist/components/Common/UI/Modal/Modal.js +90 -0
  45. package/dist/components/Common/UI/Modal/Modal.js.map +1 -0
  46. package/dist/components/Common/UI/Modal/Modal.module.scss.js +26 -0
  47. package/dist/components/Common/UI/Modal/Modal.module.scss.js.map +1 -0
  48. package/dist/components/Common/UI/Modal/ModalTypes.d.ts +34 -0
  49. package/dist/components/Common/UI/Modal/ModalTypes.js +8 -0
  50. package/dist/components/Common/UI/Modal/ModalTypes.js.map +1 -0
  51. package/dist/components/Common/UI/Modal/index.d.ts +3 -0
  52. package/dist/components/Common/UI/Tabs/Tabs.d.ts +0 -5
  53. package/dist/components/Common/UI/Tabs/Tabs.js +45 -16
  54. package/dist/components/Common/UI/Tabs/Tabs.js.map +1 -1
  55. package/dist/components/Common/UI/Tabs/Tabs.module.scss.js +8 -4
  56. package/dist/components/Common/UI/Tabs/Tabs.module.scss.js.map +1 -1
  57. package/dist/components/Common/UI/Tabs/TabsTypes.d.ts +7 -0
  58. package/dist/components/Common/index.d.ts +0 -1
  59. package/dist/components/Company/AssignSignatory/AssignSignatory.js +6 -8
  60. package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
  61. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +6 -7
  62. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
  63. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +8 -9
  64. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
  65. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +2 -3
  66. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js.map +1 -1
  67. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +2 -3
  68. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
  69. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +4 -6
  70. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  71. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +6 -7
  72. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
  73. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +5 -6
  74. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js.map +1 -1
  75. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +9 -10
  76. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +1 -1
  77. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +4 -6
  78. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  79. package/dist/components/Company/AssignSignatory/TitleSelect.js +7 -8
  80. package/dist/components/Company/AssignSignatory/TitleSelect.js.map +1 -1
  81. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +6 -8
  82. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  83. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +2 -3
  84. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
  85. package/dist/components/Company/BankAccount/BankAccountForm/Form.js +7 -8
  86. package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
  87. package/dist/components/Company/BankAccount/BankAccountForm/context.js +4 -6
  88. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  89. package/dist/components/Company/BankAccount/BankAccountList/AccountView.js +22 -17
  90. package/dist/components/Company/BankAccount/BankAccountList/AccountView.js.map +1 -1
  91. package/dist/components/Company/BankAccount/BankAccountList/Actions.js +6 -7
  92. package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
  93. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +7 -8
  94. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
  95. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +4 -5
  96. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
  97. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +5 -6
  98. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
  99. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +11 -13
  100. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  101. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +4 -6
  102. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  103. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +6 -8
  104. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  105. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +4 -6
  106. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  107. package/dist/components/Company/FederalTaxes/Actions.js +6 -7
  108. package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
  109. package/dist/components/Company/FederalTaxes/FederalTaxes.js +15 -17
  110. package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
  111. package/dist/components/Company/FederalTaxes/Form.js +2 -3
  112. package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
  113. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +9 -11
  114. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  115. package/dist/components/Company/Industry/Actions.js +5 -6
  116. package/dist/components/Company/Industry/Actions.js.map +1 -1
  117. package/dist/components/Company/Industry/Context.js +7 -9
  118. package/dist/components/Company/Industry/Context.js.map +1 -1
  119. package/dist/components/Company/Industry/Edit.js +10 -11
  120. package/dist/components/Company/Industry/Edit.js.map +1 -1
  121. package/dist/components/Company/Locations/LocationForm/Actions.js +2 -3
  122. package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
  123. package/dist/components/Company/Locations/LocationForm/Form.js +4 -5
  124. package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
  125. package/dist/components/Company/Locations/LocationForm/LocationForm.js +9 -11
  126. package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
  127. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +4 -6
  128. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  129. package/dist/components/Company/Locations/LocationsList/Actions.js +2 -3
  130. package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
  131. package/dist/components/Company/Locations/LocationsList/List.js +2 -3
  132. package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
  133. package/dist/components/Company/Locations/LocationsList/LocationsList.js +12 -14
  134. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  135. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +4 -6
  136. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  137. package/dist/components/Company/OnboardingOverview/Completed.js +5 -6
  138. package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
  139. package/dist/components/Company/OnboardingOverview/MissingRequirements.js +2 -3
  140. package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
  141. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +2 -4
  142. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
  143. package/dist/components/Company/OnboardingOverview/context.js +4 -6
  144. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  145. package/dist/components/Company/PaySchedule/PaySchedule.js +39 -41
  146. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  147. package/dist/components/Company/PaySchedule/_parts/Actions.js +10 -11
  148. package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
  149. package/dist/components/Company/PaySchedule/_parts/Edit.js +35 -37
  150. package/dist/components/Company/PaySchedule/_parts/Edit.js.map +1 -1
  151. package/dist/components/Company/PaySchedule/_parts/Head.js +18 -19
  152. package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
  153. package/dist/components/Company/PaySchedule/_parts/List.js +5 -6
  154. package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
  155. package/dist/components/Company/PaySchedule/usePaySchedule.js +6 -8
  156. package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
  157. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +5 -6
  158. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
  159. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +4 -6
  160. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  161. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +6 -7
  162. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
  163. package/dist/components/Company/StateTaxes/StateTaxesList/List.js +5 -6
  164. package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
  165. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +4 -6
  166. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  167. package/dist/components/Contractor/Address/Address.js +3 -5
  168. package/dist/components/Contractor/Address/Address.js.map +1 -1
  169. package/dist/components/Contractor/Address/Form.js +2 -3
  170. package/dist/components/Contractor/Address/Form.js.map +1 -1
  171. package/dist/components/Contractor/Address/useAddress.js +6 -8
  172. package/dist/components/Contractor/Address/useAddress.js.map +1 -1
  173. package/dist/components/Contractor/ContractorList/index.js +15 -16
  174. package/dist/components/Contractor/ContractorList/index.js.map +1 -1
  175. package/dist/components/Contractor/NewHireReport/NewHireReport.js +13 -14
  176. package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
  177. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +2 -3
  178. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
  179. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +2 -3
  180. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
  181. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +2 -3
  182. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -1
  183. package/dist/components/Contractor/Profile/useContractorProfile.js +3 -4
  184. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
  185. package/dist/components/Contractor/Submit/Submit.js +2 -3
  186. package/dist/components/Contractor/Submit/Submit.js.map +1 -1
  187. package/dist/components/Employee/Compensation/Actions.js +4 -5
  188. package/dist/components/Employee/Compensation/Actions.js.map +1 -1
  189. package/dist/components/Employee/Compensation/Edit.js +10 -9
  190. package/dist/components/Employee/Compensation/Edit.js.map +1 -1
  191. package/dist/components/Employee/Compensation/List.js +5 -6
  192. package/dist/components/Employee/Compensation/List.js.map +1 -1
  193. package/dist/components/Employee/Deductions/DeductionsComponents.js +1 -1
  194. package/dist/components/Employee/Deductions/DeductionsComponents.js.map +1 -1
  195. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.d.ts +6 -6
  196. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.d.ts +2 -2
  197. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js +2 -3
  198. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js.map +1 -1
  199. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +44 -40
  200. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js.map +1 -1
  201. package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.js +2 -3
  202. package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.js.map +1 -1
  203. package/dist/components/Employee/Deductions/useDeductions.d.ts +2 -2
  204. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +4 -5
  205. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
  206. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +9 -11
  207. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  208. package/dist/components/Employee/DocumentSigner/DocumentList/List.js +2 -3
  209. package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
  210. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +4 -6
  211. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  212. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +11 -13
  213. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  214. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +4 -6
  215. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  216. package/dist/components/Employee/EmployeeList/Actions.js +4 -5
  217. package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
  218. package/dist/components/Employee/EmployeeList/Head.js +2 -3
  219. package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
  220. package/dist/components/Employee/EmployeeList/List.js +9 -10
  221. package/dist/components/Employee/EmployeeList/List.js.map +1 -1
  222. package/dist/components/Employee/EmployeeList/useEmployeeList.js +4 -6
  223. package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
  224. package/dist/components/Employee/FederalTaxes/Actions.js +2 -3
  225. package/dist/components/Employee/FederalTaxes/Actions.js.map +1 -1
  226. package/dist/components/Employee/FederalTaxes/FederalForm.js +5 -6
  227. package/dist/components/Employee/FederalTaxes/FederalForm.js.map +1 -1
  228. package/dist/components/Employee/FederalTaxes/FederalTaxes.js +8 -8
  229. package/dist/components/Employee/FederalTaxes/FederalTaxes.js.map +1 -1
  230. package/dist/components/Employee/FederalTaxes/Head.js +6 -6
  231. package/dist/components/Employee/FederalTaxes/Head.js.map +1 -1
  232. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +4 -6
  233. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
  234. package/dist/components/Employee/Landing/Landing.js +6 -7
  235. package/dist/components/Employee/Landing/Landing.js.map +1 -1
  236. package/dist/components/Employee/PaymentMethod/Actions.js +5 -6
  237. package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
  238. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +4 -5
  239. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
  240. package/dist/components/Employee/PaymentMethod/BankAccountsList.js +3 -4
  241. package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
  242. package/dist/components/Employee/PaymentMethod/PaymentMethod.d.ts +1 -0
  243. package/dist/components/Employee/PaymentMethod/PaymentMethod.js +79 -78
  244. package/dist/components/Employee/PaymentMethod/PaymentMethod.js.map +1 -1
  245. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +12 -13
  246. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
  247. package/dist/components/Employee/PaymentMethod/Split.js +2 -3
  248. package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
  249. package/dist/components/Employee/PaymentMethod/usePaymentMethod.d.ts +1 -0
  250. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +6 -8
  251. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  252. package/dist/components/Employee/Profile/Actions.js +6 -7
  253. package/dist/components/Employee/Profile/Actions.js.map +1 -1
  254. package/dist/components/Employee/Profile/AdminPersonalDetails.js +38 -35
  255. package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
  256. package/dist/components/Employee/Profile/HomeAddress.d.ts +52 -0
  257. package/dist/components/Employee/Profile/HomeAddress.js +63 -44
  258. package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
  259. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +20 -21
  260. package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
  261. package/dist/components/Employee/Profile/Profile.js +150 -143
  262. package/dist/components/Employee/Profile/Profile.js.map +1 -1
  263. package/dist/components/Employee/Profile/useProfile.d.ts +1 -0
  264. package/dist/components/Employee/Profile/useProfile.js +4 -6
  265. package/dist/components/Employee/Profile/useProfile.js.map +1 -1
  266. package/dist/components/Employee/StateTaxes/Actions.js +6 -7
  267. package/dist/components/Employee/StateTaxes/Actions.js.map +1 -1
  268. package/dist/components/Employee/StateTaxes/StateTaxes.js +4 -4
  269. package/dist/components/Employee/StateTaxes/StateTaxes.js.map +1 -1
  270. package/dist/components/Employee/StateTaxes/useStateTaxes.js +4 -6
  271. package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
  272. package/dist/components/Employee/Taxes/Actions.js +7 -8
  273. package/dist/components/Employee/Taxes/Actions.js.map +1 -1
  274. package/dist/components/Employee/Taxes/FederalForm.js +5 -6
  275. package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
  276. package/dist/components/Employee/Taxes/FederalHead.js +6 -6
  277. package/dist/components/Employee/Taxes/FederalHead.js.map +1 -1
  278. package/dist/components/Employee/Taxes/Taxes.js +5 -5
  279. package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
  280. package/dist/components/Employee/Taxes/useTaxes.js +4 -6
  281. package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
  282. package/dist/components/Flow/Flow.js +9 -10
  283. package/dist/components/Flow/Flow.js.map +1 -1
  284. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +9 -10
  285. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
  286. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +101 -90
  287. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
  288. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +5 -1
  289. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +135 -133
  290. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
  291. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.module.scss.js +5 -3
  292. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.module.scss.js.map +1 -1
  293. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +127 -119
  294. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
  295. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +5 -6
  296. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
  297. package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.d.ts +3 -1
  298. package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js +22 -22
  299. package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js.map +1 -1
  300. package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js +40 -27
  301. package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js.map +1 -1
  302. package/dist/components/Payroll/PayrollHistory/PayrollHistory.js +50 -72
  303. package/dist/components/Payroll/PayrollHistory/PayrollHistory.js.map +1 -1
  304. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +2 -3
  305. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
  306. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.d.ts +1 -1
  307. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js +4 -4
  308. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js.map +1 -1
  309. package/dist/components/Payroll/PayrollLanding/payrollLandingStateMachine.js +20 -20
  310. package/dist/components/Payroll/PayrollLanding/payrollLandingStateMachine.js.map +1 -1
  311. package/dist/components/Payroll/PayrollList/PayrollList.js +24 -21
  312. package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
  313. package/dist/components/Payroll/PayrollList/PayrollListPresentation.d.ts +3 -9
  314. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +117 -128
  315. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  316. package/dist/components/Payroll/PayrollList/PayrollListPresentation.module.scss.js +6 -6
  317. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +89 -78
  318. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
  319. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +195 -214
  320. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  321. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.module.scss.js +8 -0
  322. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.module.scss.js.map +1 -0
  323. package/dist/components/Payroll/usePreparedPayrollData.js +8 -10
  324. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  325. package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js +49 -45
  326. package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js.map +1 -1
  327. package/dist/contexts/ComponentAdapter/componentAdapterTypes.d.ts +2 -0
  328. package/dist/contexts/ComponentAdapter/useComponentContext.d.ts +4 -0
  329. package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
  330. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +5 -7
  331. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  332. package/dist/helpers/apiErrorToList.d.ts +7 -0
  333. package/dist/helpers/apiErrorToList.js +23 -0
  334. package/dist/helpers/apiErrorToList.js.map +1 -0
  335. package/dist/helpers/breadcrumbHelpers.js +30 -30
  336. package/dist/helpers/breadcrumbHelpers.js.map +1 -1
  337. package/dist/helpers/dateFormatting.d.ts +18 -6
  338. package/dist/helpers/dateFormatting.js +93 -24
  339. package/dist/helpers/dateFormatting.js.map +1 -1
  340. package/dist/helpers/formattedStrings.js +11 -12
  341. package/dist/helpers/formattedStrings.js.map +1 -1
  342. package/dist/hooks/useAsyncError.js.map +1 -0
  343. package/dist/hooks/useDateFormatter.d.ts +19 -0
  344. package/dist/hooks/useDateFormatter.js +24 -0
  345. package/dist/hooks/useDateFormatter.js.map +1 -0
  346. package/dist/hooks/useMenu.js.map +1 -0
  347. package/dist/{components/Common/hooks → hooks}/useNumberFormatter.js +1 -1
  348. package/dist/hooks/useNumberFormatter.js.map +1 -0
  349. package/dist/hooks/useOverflowDetection/index.d.ts +3 -0
  350. package/dist/hooks/useOverflowDetection/useOverflowDetection.d.ts +7 -0
  351. package/dist/hooks/useOverflowDetection/useOverflowDetection.js +28 -0
  352. package/dist/hooks/useOverflowDetection/useOverflowDetection.js.map +1 -0
  353. package/dist/i18n/en/Company.PaySchedule.json.js +9 -9
  354. package/dist/i18n/en/Employee.Compensation.json.js +15 -15
  355. package/dist/i18n/en/Employee.Deductions.json.js +131 -105
  356. package/dist/i18n/en/Employee.Deductions.json.js.map +1 -1
  357. package/dist/i18n/en/Employee.FederalTaxes.json.js +9 -9
  358. package/dist/i18n/en/Employee.HomeAddress.json.js +1 -1
  359. package/dist/i18n/en/Employee.PaymentMethod.json.js +70 -66
  360. package/dist/i18n/en/Employee.PaymentMethod.json.js.map +1 -1
  361. package/dist/i18n/en/Employee.Taxes.json.js +25 -27
  362. package/dist/i18n/en/Employee.Taxes.json.js.map +1 -1
  363. package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +17 -17
  364. package/dist/i18n/en/Payroll.PayrollOverview.json.js +23 -23
  365. package/dist/i18n/en/common.json.d.ts +2 -1
  366. package/dist/i18n/en/common.json.js +4 -4
  367. package/dist/style.css +1 -1
  368. package/dist/types/i18next.d.ts +20 -1
  369. package/package.json +10 -10
  370. package/dist/components/Common/hooks/useAsyncError.js.map +0 -1
  371. package/dist/components/Common/hooks/useMenu.js.map +0 -1
  372. package/dist/components/Common/hooks/useNumberFormatter.js.map +0 -1
  373. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +0 -221
  374. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +0 -1
  375. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.module.scss.js +0 -8
  376. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.module.scss.js.map +0 -1
  377. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +0 -132
  378. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +0 -1
  379. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.module.scss.js +0 -14
  380. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.module.scss.js.map +0 -1
  381. package/dist/components/Employee/Deductions/DeductionsForm/UNSTABLE_DeductionsForm.js +0 -98
  382. package/dist/components/Employee/Deductions/DeductionsForm/UNSTABLE_DeductionsForm.js.map +0 -1
  383. /package/dist/{components/Common/hooks → hooks}/useAsyncError.d.ts +0 -0
  384. /package/dist/{components/Common/hooks → hooks}/useAsyncError.js +0 -0
  385. /package/dist/{components/Common/hooks → hooks}/useMenu.d.ts +0 -0
  386. /package/dist/{components/Common/hooks → hooks}/useMenu.js +0 -0
  387. /package/dist/{components/Common/hooks → hooks}/useNumberFormatter.d.ts +0 -0
@@ -0,0 +1,7 @@
1
+ import { EntityErrorObject } from '@gusto/embedded-api/models/components/entityerrorobject';
2
+ /**Traverses errorList and finds items with message properties */
3
+ export declare const renderErrorList: (errorList: Array<EntityErrorObject>) => React.ReactNode[];
4
+ /**Recuresively parses error list and constructs an array of objects containing attribute value error messages associated with form fields. Nested errors construct '.' separated keys
5
+ * metadata.state is a special case for state taxes validation errors
6
+ */
7
+ export declare const getFieldErrors: (error: EntityErrorObject, parentKey?: string) => Array<EntityErrorObject>;
@@ -0,0 +1,23 @@
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { snakeCaseToCamelCase as y } from "./formattedStrings.js";
3
+ const g = (e) => e.map((t) => t.message ? /* @__PURE__ */ n("span", { children: t.message }, t.errorKey) : null), f = (e, t) => {
4
+ const s = t ? t + "." : "";
5
+ if (e.category === "invalid_attribute_value" || e.category === "invalid_operation")
6
+ return [
7
+ {
8
+ errorKey: y(s + e.errorKey),
9
+ message: e.message ?? "",
10
+ category: e.category
11
+ }
12
+ ];
13
+ if (e.category === "nested_errors" && e.errors !== void 0) {
14
+ let a = "";
15
+ return e.metadata?.key && typeof e.metadata.key == "string" ? a = e.metadata.key : e.metadata?.state && typeof e.metadata.state == "string" ? a = e.metadata.state : e.errorKey && (a = e.errorKey), e.errors.flatMap((i) => f(i, s + a));
16
+ }
17
+ return [];
18
+ };
19
+ export {
20
+ f as getFieldErrors,
21
+ g as renderErrorList
22
+ };
23
+ //# sourceMappingURL=apiErrorToList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiErrorToList.js","sources":["../../src/helpers/apiErrorToList.tsx"],"sourcesContent":["import type { EntityErrorObject } from '@gusto/embedded-api/models/components/entityerrorobject'\nimport { snakeCaseToCamelCase } from './formattedStrings'\n\n/**Traverses errorList and finds items with message properties */\nexport const renderErrorList = (errorList: Array<EntityErrorObject>): React.ReactNode[] => {\n return errorList.map(errorFromList => {\n if (errorFromList.message) {\n return <span key={errorFromList.errorKey}>{errorFromList.message}</span>\n }\n return null\n })\n}\n/**Recuresively parses error list and constructs an array of objects containing attribute value error messages associated with form fields. Nested errors construct '.' separated keys\n * metadata.state is a special case for state taxes validation errors\n */\nexport const getFieldErrors = (\n error: EntityErrorObject,\n parentKey?: string,\n): Array<EntityErrorObject> => {\n const keyPrefix = parentKey ? parentKey + '.' : ''\n if (error.category === 'invalid_attribute_value' || error.category === 'invalid_operation') {\n return [\n {\n errorKey: snakeCaseToCamelCase(keyPrefix + error.errorKey),\n message: error.message ?? '',\n category: error.category,\n },\n ]\n }\n if (error.category === 'nested_errors' && error.errors !== undefined) {\n //TODO: clean this up once Metadata type is fixed in openapi spec\n let keySuffix = ''\n //@ts-expect-error: Metadata in speakeasy is incorrectly typed\n if (error.metadata?.key && typeof error.metadata.key === 'string') {\n //@ts-expect-error: Metadata in speakeasy is incorrectly typed\n keySuffix = error.metadata.key as string\n //@ts-expect-error: Metadata in speakeasy is incorrectly typed\n } else if (error.metadata?.state && typeof error.metadata.state === 'string') {\n //@ts-expect-error: Metadata in speakeasy is incorrectly typed\n keySuffix = error.metadata.state as string\n } else if (error.errorKey) {\n keySuffix = error.errorKey\n }\n return error.errors.flatMap(err => getFieldErrors(err, keyPrefix + keySuffix))\n }\n return []\n}\n"],"names":["renderErrorList","errorList","errorFromList","jsx","getFieldErrors","error","parentKey","keyPrefix","snakeCaseToCamelCase","keySuffix","err"],"mappings":";;AAIO,MAAMA,IAAkB,CAACC,MACvBA,EAAU,IAAI,CAAAC,MACfA,EAAc,UACT,gBAAAC,EAAC,QAAA,EAAmC,UAAAD,EAAc,QAAA,GAAvCA,EAAc,QAAiC,IAE5D,IACR,GAKUE,IAAiB,CAC5BC,GACAC,MAC6B;AAC7B,QAAMC,IAAYD,IAAYA,IAAY,MAAM;AAChD,MAAID,EAAM,aAAa,6BAA6BA,EAAM,aAAa;AACrE,WAAO;AAAA,MACL;AAAA,QACE,UAAUG,EAAqBD,IAAYF,EAAM,QAAQ;AAAA,QACzD,SAASA,EAAM,WAAW;AAAA,QAC1B,UAAUA,EAAM;AAAA,MAAA;AAAA,IAClB;AAGJ,MAAIA,EAAM,aAAa,mBAAmBA,EAAM,WAAW,QAAW;AAEpE,QAAII,IAAY;AAEhB,WAAIJ,EAAM,UAAU,OAAO,OAAOA,EAAM,SAAS,OAAQ,WAEvDI,IAAYJ,EAAM,SAAS,MAElBA,EAAM,UAAU,SAAS,OAAOA,EAAM,SAAS,SAAU,WAElEI,IAAYJ,EAAM,SAAS,QAClBA,EAAM,aACfI,IAAYJ,EAAM,WAEbA,EAAM,OAAO,QAAQ,CAAAK,MAAON,EAAeM,GAAKH,IAAYE,CAAS,CAAC;AAAA,EAC/E;AACA,SAAO,CAAA;AACT;"}
@@ -1,46 +1,46 @@
1
- const l = (r) => {
2
- const e = {};
3
- for (const [n, s] of Object.entries(r)) {
4
- const o = [];
5
- let t = s;
6
- for (; t; ) {
7
- o.unshift(t.item);
8
- const c = t.parent;
9
- t = c ? r[c] ?? null : null;
1
+ const a = (r) => {
2
+ const t = {};
3
+ for (const [c, n] of Object.entries(r)) {
4
+ const s = [];
5
+ let e = n;
6
+ for (; e; ) {
7
+ s.unshift(e.item);
8
+ const o = e.parent;
9
+ e = o ? r[o] ?? null : null;
10
10
  }
11
- e[n] = o;
11
+ t[c] = s;
12
12
  }
13
- return e;
14
- }, u = (r, e) => {
13
+ return t;
14
+ }, u = (r, t) => {
15
15
  if (!r)
16
16
  return {};
17
- const n = {};
18
- for (const [s, o] of Object.entries(r)) {
19
- const t = o.match(/{{(.*?)}}/);
20
- if (t?.[1]) {
21
- const c = t[1].trim();
22
- n[s] = e[c] ?? "";
17
+ const c = {};
18
+ for (const [n, s] of Object.entries(r)) {
19
+ const e = s.match(/{{(.*?)}}/);
20
+ if (e?.[1]) {
21
+ const o = e[1].trim();
22
+ c[n] = t[o] ?? "";
23
23
  } else
24
- n[s] = o;
24
+ c[n] = s;
25
25
  }
26
- return n;
27
- }, i = (r, e, n) => {
28
- const s = e.breadcrumbs ?? {}, t = (s[r] ?? []).map((c) => c.id === r && n ? {
29
- ...c,
30
- variables: u(n, e)
31
- } : c);
26
+ return c;
27
+ }, l = (r, t, c) => {
28
+ const n = t.breadcrumbs ?? {}, e = (n[r] ?? []).map((o) => ({
29
+ ...o,
30
+ variables: u(c, t)
31
+ }));
32
32
  return {
33
- ...e,
33
+ ...t,
34
34
  breadcrumbs: {
35
- ...s,
36
- [r]: t
35
+ ...n,
36
+ [r]: e
37
37
  },
38
38
  currentBreadcrumbId: r
39
39
  };
40
40
  };
41
41
  export {
42
- l as buildBreadcrumbs,
42
+ a as buildBreadcrumbs,
43
43
  u as resolveBreadcrumbVariables,
44
- i as updateBreadcrumbs
44
+ l as updateBreadcrumbs
45
45
  };
46
46
  //# sourceMappingURL=breadcrumbHelpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"breadcrumbHelpers.js","sources":["../../src/helpers/breadcrumbHelpers.ts"],"sourcesContent":["import type {\n BreadcrumbNode,\n BreadcrumbNodes,\n BreadcrumbTrail,\n FlowBreadcrumb,\n} from '@/components/Common/FlowBreadcrumbs/FlowBreadcrumbsTypes'\n\n/**\n * Builds a complete breadcrumb trail map from a hierarchical node structure.\n *\n * Takes a tree structure of breadcrumb nodes and generates a map where each state\n * has its complete breadcrumb trail from root to that state. This is useful for\n * initializing breadcrumb navigation in state machines or multi-step flows.\n */\nexport const buildBreadcrumbs = (nodes: BreadcrumbNodes): BreadcrumbTrail => {\n const map: Record<string, FlowBreadcrumb[]> = {}\n\n for (const [state, node] of Object.entries(nodes)) {\n const trail: FlowBreadcrumb[] = []\n let current: BreadcrumbNode | null = node\n\n while (current) {\n trail.unshift(current.item)\n const parentKey: string | null = current.parent\n current = parentKey ? (nodes[parentKey] ?? null) : null\n }\n\n map[state] = trail\n }\n\n return map\n}\n\n/**\n * Resolves template variables in breadcrumb labels using values from a context object.\n *\n * Supports Handlebars-style template syntax ({{variableName}}) for dynamic breadcrumb labels.\n * Variables enclosed in double braces are replaced with their corresponding values from the context.\n * Non-template strings are returned as-is.\n */\nexport const resolveBreadcrumbVariables = (\n variables: Record<string, string> | undefined,\n context: Record<string, unknown>,\n): Record<string, unknown> => {\n if (!variables) {\n return {}\n }\n\n const resolved: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(variables)) {\n const match = value.match(/{{(.*?)}}/)\n if (match?.[1]) {\n const ctxKey = match[1].trim()\n resolved[key] = context[ctxKey] ?? ''\n } else {\n resolved[key] = value\n }\n }\n return resolved\n}\n\n/**\n * Updates the breadcrumb trail for a specific state with resolved variables.\n *\n * This function is typically used in state machine transitions to update breadcrumb\n * navigation when moving between states. It preserves all existing breadcrumb trails\n * for other states and only updates the trail for the specified state by resolving\n * any template variables for that state's breadcrumb.\n\n */\nexport const updateBreadcrumbs = <\n T extends { breadcrumbs?: BreadcrumbTrail; currentBreadcrumb?: string },\n>(\n stateName: string,\n context: T,\n variables?: Record<string, string>,\n): Omit<T, 'breadcrumbs' | 'currentBreadcrumb'> & {\n breadcrumbs: BreadcrumbTrail\n currentBreadcrumbId: string\n} => {\n const allBreadcrumbs = context.breadcrumbs ?? {}\n const trail = allBreadcrumbs[stateName] ?? []\n const resolvedTrail = trail.map(breadcrumb => {\n if (breadcrumb.id === stateName && variables) {\n return {\n ...breadcrumb,\n variables: resolveBreadcrumbVariables(variables, context as Record<string, unknown>),\n }\n }\n return breadcrumb\n })\n return {\n ...context,\n breadcrumbs: {\n ...allBreadcrumbs,\n [stateName]: resolvedTrail,\n },\n currentBreadcrumbId: stateName,\n }\n}\n"],"names":["buildBreadcrumbs","nodes","map","state","node","trail","current","parentKey","resolveBreadcrumbVariables","variables","context","resolved","key","value","match","ctxKey","updateBreadcrumbs","stateName","allBreadcrumbs","resolvedTrail","breadcrumb"],"mappings":"AAcO,MAAMA,IAAmB,CAACC,MAA4C;AAC3E,QAAMC,IAAwC,CAAA;AAE9C,aAAW,CAACC,GAAOC,CAAI,KAAK,OAAO,QAAQH,CAAK,GAAG;AACjD,UAAMI,IAA0B,CAAA;AAChC,QAAIC,IAAiCF;AAErC,WAAOE,KAAS;AACd,MAAAD,EAAM,QAAQC,EAAQ,IAAI;AAC1B,YAAMC,IAA2BD,EAAQ;AACzC,MAAAA,IAAUC,IAAaN,EAAMM,CAAS,KAAK,OAAQ;AAAA,IACrD;AAEA,IAAAL,EAAIC,CAAK,IAAIE;AAAA,EACf;AAEA,SAAOH;AACT,GASaM,IAA6B,CACxCC,GACAC,MAC4B;AAC5B,MAAI,CAACD;AACH,WAAO,CAAA;AAGT,QAAME,IAAoC,CAAA;AAC1C,aAAW,CAACC,GAAKC,CAAK,KAAK,OAAO,QAAQJ,CAAS,GAAG;AACpD,UAAMK,IAAQD,EAAM,MAAM,WAAW;AACrC,QAAIC,IAAQ,CAAC,GAAG;AACd,YAAMC,IAASD,EAAM,CAAC,EAAE,KAAA;AACxB,MAAAH,EAASC,CAAG,IAAIF,EAAQK,CAAM,KAAK;AAAA,IACrC;AACE,MAAAJ,EAASC,CAAG,IAAIC;AAAA,EAEpB;AACA,SAAOF;AACT,GAWaK,IAAoB,CAG/BC,GACAP,GACAD,MAIG;AACH,QAAMS,IAAiBR,EAAQ,eAAe,CAAA,GAExCS,KADQD,EAAeD,CAAS,KAAK,CAAA,GACf,IAAI,CAAAG,MAC1BA,EAAW,OAAOH,KAAaR,IAC1B;AAAA,IACL,GAAGW;AAAA,IACH,WAAWZ,EAA2BC,GAAWC,CAAkC;AAAA,EAAA,IAGhFU,CACR;AACD,SAAO;AAAA,IACL,GAAGV;AAAA,IACH,aAAa;AAAA,MACX,GAAGQ;AAAA,MACH,CAACD,CAAS,GAAGE;AAAA,IAAA;AAAA,IAEf,qBAAqBF;AAAA,EAAA;AAEzB;"}
1
+ {"version":3,"file":"breadcrumbHelpers.js","sources":["../../src/helpers/breadcrumbHelpers.ts"],"sourcesContent":["import type {\n BreadcrumbNode,\n BreadcrumbNodes,\n BreadcrumbTrail,\n FlowBreadcrumb,\n} from '@/components/Common/FlowBreadcrumbs/FlowBreadcrumbsTypes'\n\n/**\n * Builds a complete breadcrumb trail map from a hierarchical node structure.\n *\n * Takes a tree structure of breadcrumb nodes and generates a map where each state\n * has its complete breadcrumb trail from root to that state. This is useful for\n * initializing breadcrumb navigation in state machines or multi-step flows.\n */\nexport const buildBreadcrumbs = (nodes: BreadcrumbNodes): BreadcrumbTrail => {\n const map: Record<string, FlowBreadcrumb[]> = {}\n\n for (const [state, node] of Object.entries(nodes)) {\n const trail: FlowBreadcrumb[] = []\n let current: BreadcrumbNode | null = node\n\n while (current) {\n trail.unshift(current.item)\n const parentKey: string | null = current.parent\n current = parentKey ? (nodes[parentKey] ?? null) : null\n }\n\n map[state] = trail\n }\n\n return map\n}\n\n/**\n * Resolves template variables in breadcrumb labels using values from a context object.\n *\n * Supports Handlebars-style template syntax ({{variableName}}) for dynamic breadcrumb labels.\n * Variables enclosed in double braces are replaced with their corresponding values from the context.\n * Non-template strings are returned as-is.\n */\nexport const resolveBreadcrumbVariables = (\n variables: Record<string, string> | undefined,\n context: Record<string, unknown>,\n): Record<string, unknown> => {\n if (!variables) {\n return {}\n }\n\n const resolved: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(variables)) {\n const match = value.match(/{{(.*?)}}/)\n if (match?.[1]) {\n const ctxKey = match[1].trim()\n resolved[key] = context[ctxKey] ?? ''\n } else {\n resolved[key] = value\n }\n }\n return resolved\n}\n\n/**\n * Updates the breadcrumb trail for a specific state with resolved variables.\n *\n * This function is typically used in state machine transitions to update breadcrumb\n * navigation when moving between states. It preserves all existing breadcrumb trails\n * for other states and only updates the trail for the specified state by resolving\n * any template variables for that state's breadcrumb.\n\n */\nexport const updateBreadcrumbs = <\n T extends { breadcrumbs?: BreadcrumbTrail; currentBreadcrumb?: string },\n>(\n stateName: string,\n context: T,\n variables?: Record<string, string>,\n): Omit<T, 'breadcrumbs' | 'currentBreadcrumb'> & {\n breadcrumbs: BreadcrumbTrail\n currentBreadcrumbId: string\n} => {\n const allBreadcrumbs = context.breadcrumbs ?? {}\n const trail = allBreadcrumbs[stateName] ?? []\n const resolvedTrail = trail.map(breadcrumb => {\n return {\n ...breadcrumb,\n variables: resolveBreadcrumbVariables(variables, context as Record<string, unknown>),\n }\n })\n return {\n ...context,\n breadcrumbs: {\n ...allBreadcrumbs,\n [stateName]: resolvedTrail,\n },\n currentBreadcrumbId: stateName,\n }\n}\n"],"names":["buildBreadcrumbs","nodes","map","state","node","trail","current","parentKey","resolveBreadcrumbVariables","variables","context","resolved","key","value","match","ctxKey","updateBreadcrumbs","stateName","allBreadcrumbs","resolvedTrail","breadcrumb"],"mappings":"AAcO,MAAMA,IAAmB,CAACC,MAA4C;AAC3E,QAAMC,IAAwC,CAAA;AAE9C,aAAW,CAACC,GAAOC,CAAI,KAAK,OAAO,QAAQH,CAAK,GAAG;AACjD,UAAMI,IAA0B,CAAA;AAChC,QAAIC,IAAiCF;AAErC,WAAOE,KAAS;AACd,MAAAD,EAAM,QAAQC,EAAQ,IAAI;AAC1B,YAAMC,IAA2BD,EAAQ;AACzC,MAAAA,IAAUC,IAAaN,EAAMM,CAAS,KAAK,OAAQ;AAAA,IACrD;AAEA,IAAAL,EAAIC,CAAK,IAAIE;AAAA,EACf;AAEA,SAAOH;AACT,GASaM,IAA6B,CACxCC,GACAC,MAC4B;AAC5B,MAAI,CAACD;AACH,WAAO,CAAA;AAGT,QAAME,IAAoC,CAAA;AAC1C,aAAW,CAACC,GAAKC,CAAK,KAAK,OAAO,QAAQJ,CAAS,GAAG;AACpD,UAAMK,IAAQD,EAAM,MAAM,WAAW;AACrC,QAAIC,IAAQ,CAAC,GAAG;AACd,YAAMC,IAASD,EAAM,CAAC,EAAE,KAAA;AACxB,MAAAH,EAASC,CAAG,IAAIF,EAAQK,CAAM,KAAK;AAAA,IACrC;AACE,MAAAJ,EAASC,CAAG,IAAIC;AAAA,EAEpB;AACA,SAAOF;AACT,GAWaK,IAAoB,CAG/BC,GACAP,GACAD,MAIG;AACH,QAAMS,IAAiBR,EAAQ,eAAe,CAAA,GAExCS,KADQD,EAAeD,CAAS,KAAK,CAAA,GACf,IAAI,CAAAG,OACvB;AAAA,IACL,GAAGA;AAAA,IACH,WAAWZ,EAA2BC,GAAWC,CAAkC;AAAA,EAAA,EAEtF;AACD,SAAO;AAAA,IACL,GAAGA;AAAA,IACH,aAAa;AAAA,MACX,GAAGQ;AAAA,MACH,CAACD,CAAS,GAAGE;AAAA,IAAA;AAAA,IAEf,qBAAqBF;AAAA,EAAA;AAEzB;"}
@@ -1,9 +1,21 @@
1
- export declare const formatDateNamedWeekdayShortPlusDate: (date?: string, locale?: string) => string;
2
- export declare const formatDateToStringDate: (date: Date) => string | null | undefined;
3
- /**
4
- * Parses YYYY-MM-DD string to local Date, avoiding timezone issues from `new Date(dateString)`.
5
- */
6
- export declare const parseDateStringToLocal: (dateString: string) => Date | null;
1
+ export declare const formatDateShortWithWeekday: (dateInput?: string | Date | null, locale?: string) => string;
2
+ export declare const formatDateShortWithWeekdayAndYear: (dateInput?: string | Date | null, locale?: string) => string;
3
+ export declare const formatDateShort: (dateInput?: string | Date | null, locale?: string) => string;
4
+ export declare const formatDateShortWithYear: (dateInput?: string | Date | null, locale?: string) => string;
5
+ export declare const formatDateLong: (dateInput?: string | Date | null, locale?: string) => string;
6
+ export declare const formatDateLongWithYear: (dateInput?: string | Date | null, locale?: string) => string;
7
+ export declare const formatDateWithTime: (dateInput?: string | Date | null, locale?: string) => {
8
+ time: string;
9
+ date: string;
10
+ };
11
+ export declare const formatPayPeriod: (startDateInput?: string | Date | null, endDateInput?: string | Date | null, locale?: string) => {
12
+ startDate: string;
13
+ endDate: string;
14
+ };
15
+ export declare const formatPayPeriodRange: (startDateInput?: string | Date | null, endDateInput?: string | Date | null, locale?: string, options?: {
16
+ useShortMonth?: boolean;
17
+ }) => string;
18
+ export declare const formatDateToStringDate: (date: Date) => string | null;
7
19
  /**
8
20
  * Normalizes Date to local midnight, handling timezone issues from any adapter.
9
21
  */
@@ -1,33 +1,102 @@
1
- const l = (t, o) => {
2
- if (!t) return "";
3
- const n = u(t);
4
- return n ? n.toLocaleDateString(o, {
1
+ const m = (t) => {
2
+ if (!t) return null;
3
+ if (typeof t == "string") {
4
+ if (/^\d{4}-\d{2}-\d{2}$/.test(t)) {
5
+ const r = t.split("-");
6
+ if (r.length !== 3) return null;
7
+ const e = r.map(Number), n = e[0], i = e[1], o = e[2];
8
+ return n === void 0 || i === void 0 || o === void 0 || isNaN(n) || isNaN(i) || isNaN(o) || i < 1 || i > 12 || o < 1 || o > 31 ? null : new Date(n, i - 1, o);
9
+ }
10
+ const a = new Date(t);
11
+ return isNaN(a.getTime()) ? null : a;
12
+ }
13
+ return t instanceof Date ? isNaN(t.getTime()) ? null : t : null;
14
+ }, c = (t) => (a, r) => {
15
+ const e = m(a);
16
+ return e ? e.toLocaleDateString(r, t) : "";
17
+ }, h = c({
18
+ weekday: "short",
19
+ month: "short",
20
+ day: "numeric"
21
+ }), l = c({
22
+ weekday: "short",
23
+ month: "short",
24
+ day: "numeric",
25
+ year: "numeric"
26
+ }), d = c({
27
+ month: "short",
28
+ day: "numeric"
29
+ }), D = c({
30
+ month: "short",
31
+ day: "numeric",
32
+ year: "numeric"
33
+ }), f = c({
34
+ month: "long",
35
+ day: "numeric"
36
+ }), y = c({
37
+ month: "long",
38
+ day: "numeric",
39
+ year: "numeric"
40
+ }), g = (t, a) => {
41
+ const r = m(t);
42
+ if (!r) return { time: "", date: "" };
43
+ const e = r.toLocaleTimeString(a, {
44
+ hour: "numeric",
45
+ minute: "2-digit",
46
+ hour12: !0,
47
+ timeZoneName: "short"
48
+ }), n = r.toLocaleDateString(a, {
5
49
  weekday: "short",
6
50
  month: "short",
7
51
  day: "numeric"
8
- }) : "";
9
- }, c = (t) => isNaN(t.getTime()) ? null : t.toISOString().split("T")[0], u = (t) => {
10
- if (!t || !/^\d{4}-\d{2}-\d{2}$/.test(t))
11
- return null;
12
- const o = t.split("-");
13
- if (o.length !== 3)
14
- return null;
15
- const n = o.map(Number), s = n[0], r = n[1], e = n[2];
16
- return s === void 0 || r === void 0 || e === void 0 || isNaN(s) || isNaN(r) || isNaN(e) || r < 1 || r > 12 || e < 1 || e > 31 ? null : new Date(s, r - 1, e);
17
- }, N = (t) => {
52
+ });
53
+ return { time: e, date: n };
54
+ }, N = (t, a, r) => {
55
+ const e = m(t), n = m(a);
56
+ if (!e || !n)
57
+ return { startDate: "", endDate: "" };
58
+ const i = e.toLocaleDateString(r, {
59
+ month: "long",
60
+ day: "numeric"
61
+ }), o = n.toLocaleDateString(r, {
62
+ month: "short",
63
+ day: "numeric",
64
+ year: "numeric"
65
+ });
66
+ return { startDate: i, endDate: o };
67
+ }, S = (t, a, r, e) => {
68
+ const n = m(t), i = m(a);
69
+ if (!n || !i) return "";
70
+ const o = e?.useShortMonth ? "short" : "long", s = n.toLocaleDateString(r, {
71
+ month: o,
72
+ day: "numeric"
73
+ }), u = i.toLocaleDateString(r, {
74
+ month: o,
75
+ day: "numeric",
76
+ year: "numeric"
77
+ });
78
+ return `${s}–${u}`;
79
+ }, T = (t) => isNaN(t.getTime()) ? null : t.toISOString().split("T")[0] || null, L = (t) => {
18
80
  if (!t || isNaN(t.getTime()))
19
81
  return null;
20
- const o = t.toISOString(), [n] = o.split("T");
21
- if (!n) return null;
22
- const s = n.split("-");
23
- if (s.length !== 3) return null;
24
- const r = s.map(Number), e = r[0], i = r[1], a = r[2];
25
- return isNaN(e) || isNaN(i) || isNaN(a) || i < 1 || i > 12 || a < 1 || a > 31 ? null : new Date(e, i - 1, a);
82
+ const a = t.toISOString(), [r] = a.split("T");
83
+ if (!r) return null;
84
+ const e = r.split("-");
85
+ if (e.length !== 3) return null;
86
+ const n = e.map(Number), i = n[0], o = n[1], s = n[2];
87
+ return isNaN(i) || isNaN(o) || isNaN(s) || o < 1 || o > 12 || s < 1 || s > 31 ? null : new Date(i, o - 1, s);
26
88
  };
27
89
  export {
28
- l as formatDateNamedWeekdayShortPlusDate,
29
- c as formatDateToStringDate,
30
- N as normalizeDateToLocal,
31
- u as parseDateStringToLocal
90
+ f as formatDateLong,
91
+ y as formatDateLongWithYear,
92
+ d as formatDateShort,
93
+ h as formatDateShortWithWeekday,
94
+ l as formatDateShortWithWeekdayAndYear,
95
+ D as formatDateShortWithYear,
96
+ T as formatDateToStringDate,
97
+ g as formatDateWithTime,
98
+ N as formatPayPeriod,
99
+ S as formatPayPeriodRange,
100
+ L as normalizeDateToLocal
32
101
  };
33
102
  //# sourceMappingURL=dateFormatting.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dateFormatting.js","sources":["../../src/helpers/dateFormatting.ts"],"sourcesContent":["export const formatDateNamedWeekdayShortPlusDate = (date?: string, locale?: string) => {\n if (!date) return ''\n const parsedDate = parseDateStringToLocal(date)\n if (!parsedDate) return ''\n return parsedDate.toLocaleDateString(locale, {\n weekday: 'short',\n month: 'short',\n day: 'numeric',\n })\n}\n\nexport const formatDateToStringDate = (date: Date) => {\n // Handle invalid dates gracefully\n if (isNaN(date.getTime())) {\n return null\n }\n return date.toISOString().split('T')[0]\n}\n\n/**\n * Parses YYYY-MM-DD string to local Date, avoiding timezone issues from `new Date(dateString)`.\n */\nexport const parseDateStringToLocal = (dateString: string): Date | null => {\n if (!dateString || !/^\\d{4}-\\d{2}-\\d{2}$/.test(dateString)) {\n return null\n }\n\n const parts = dateString.split('-')\n if (parts.length !== 3) {\n return null\n }\n\n const numbers = parts.map(Number)\n const year = numbers[0]\n const month = numbers[1]\n const day = numbers[2]\n if (year === undefined || month === undefined || day === undefined) {\n return null\n }\n\n // Validate date components\n if (isNaN(year) || isNaN(month) || isNaN(day) || month < 1 || month > 12 || day < 1 || day > 31) {\n return null\n }\n\n // Create Date in local timezone (month is 0-indexed)\n return new Date(year, month - 1, day)\n}\n\n/**\n * Normalizes Date to local midnight, handling timezone issues from any adapter.\n */\nexport const normalizeDateToLocal = (date: Date | null): Date | null => {\n if (!date || isNaN(date.getTime())) {\n return null\n }\n\n // Use ISO string to get the intended date, then parse components\n const isoString = date.toISOString()\n const [datePart] = isoString.split('T')\n if (!datePart) return null\n\n const parts = datePart.split('-')\n if (parts.length !== 3) return null\n const numbers = parts.map(Number)\n const year = numbers[0]!\n const month = numbers[1]!\n const day = numbers[2]!\n if (isNaN(year) || isNaN(month) || isNaN(day) || month < 1 || month > 12 || day < 1 || day > 31) {\n return null\n }\n\n return new Date(year, month - 1, day)\n}\n"],"names":["formatDateNamedWeekdayShortPlusDate","date","locale","parsedDate","parseDateStringToLocal","formatDateToStringDate","dateString","parts","numbers","year","month","day","normalizeDateToLocal","isoString","datePart"],"mappings":"AAAO,MAAMA,IAAsC,CAACC,GAAeC,MAAoB;AACrF,MAAI,CAACD,EAAM,QAAO;AAClB,QAAME,IAAaC,EAAuBH,CAAI;AAC9C,SAAKE,IACEA,EAAW,mBAAmBD,GAAQ;AAAA,IAC3C,SAAS;AAAA,IACT,OAAO;AAAA,IACP,KAAK;AAAA,EAAA,CACN,IALuB;AAM1B,GAEaG,IAAyB,CAACJ,MAEjC,MAAMA,EAAK,QAAA,CAAS,IACf,OAEFA,EAAK,YAAA,EAAc,MAAM,GAAG,EAAE,CAAC,GAM3BG,IAAyB,CAACE,MAAoC;AACzE,MAAI,CAACA,KAAc,CAAC,sBAAsB,KAAKA,CAAU;AACvD,WAAO;AAGT,QAAMC,IAAQD,EAAW,MAAM,GAAG;AAClC,MAAIC,EAAM,WAAW;AACnB,WAAO;AAGT,QAAMC,IAAUD,EAAM,IAAI,MAAM,GAC1BE,IAAOD,EAAQ,CAAC,GAChBE,IAAQF,EAAQ,CAAC,GACjBG,IAAMH,EAAQ,CAAC;AAMrB,SALIC,MAAS,UAAaC,MAAU,UAAaC,MAAQ,UAKrD,MAAMF,CAAI,KAAK,MAAMC,CAAK,KAAK,MAAMC,CAAG,KAAKD,IAAQ,KAAKA,IAAQ,MAAMC,IAAM,KAAKA,IAAM,KACpF,OAIF,IAAI,KAAKF,GAAMC,IAAQ,GAAGC,CAAG;AACtC,GAKaC,IAAuB,CAACX,MAAmC;AACtE,MAAI,CAACA,KAAQ,MAAMA,EAAK,QAAA,CAAS;AAC/B,WAAO;AAIT,QAAMY,IAAYZ,EAAK,YAAA,GACjB,CAACa,CAAQ,IAAID,EAAU,MAAM,GAAG;AACtC,MAAI,CAACC,EAAU,QAAO;AAEtB,QAAMP,IAAQO,EAAS,MAAM,GAAG;AAChC,MAAIP,EAAM,WAAW,EAAG,QAAO;AAC/B,QAAMC,IAAUD,EAAM,IAAI,MAAM,GAC1BE,IAAOD,EAAQ,CAAC,GAChBE,IAAQF,EAAQ,CAAC,GACjBG,IAAMH,EAAQ,CAAC;AACrB,SAAI,MAAMC,CAAI,KAAK,MAAMC,CAAK,KAAK,MAAMC,CAAG,KAAKD,IAAQ,KAAKA,IAAQ,MAAMC,IAAM,KAAKA,IAAM,KACpF,OAGF,IAAI,KAAKF,GAAMC,IAAQ,GAAGC,CAAG;AACtC;"}
1
+ {"version":3,"file":"dateFormatting.js","sources":["../../src/helpers/dateFormatting.ts"],"sourcesContent":["/**\n * Normalizes any date input (string, Date, or undefined) to a Date object.\n * Handles YYYY-MM-DD strings by parsing them in local timezone to avoid timezone issues.\n * Also handles ISO timestamp strings for compatibility.\n * Returns null for invalid inputs.\n */\nconst normalizeToDate = (dateInput?: string | Date | null): Date | null => {\n if (!dateInput) return null\n\n if (typeof dateInput === 'string') {\n if (/^\\d{4}-\\d{2}-\\d{2}$/.test(dateInput)) {\n const parts = dateInput.split('-')\n if (parts.length !== 3) return null\n\n const numbers = parts.map(Number)\n const year = numbers[0]\n const month = numbers[1]\n const day = numbers[2]\n if (year === undefined || month === undefined || day === undefined) {\n return null\n }\n\n if (\n isNaN(year) ||\n isNaN(month) ||\n isNaN(day) ||\n month < 1 ||\n month > 12 ||\n day < 1 ||\n day > 31\n ) {\n return null\n }\n\n return new Date(year, month - 1, day)\n }\n\n const parsedDate = new Date(dateInput)\n return isNaN(parsedDate.getTime()) ? null : parsedDate\n }\n\n if (dateInput instanceof Date) {\n return isNaN(dateInput.getTime()) ? null : dateInput\n }\n\n return null\n}\n\n/**\n * Creates a date formatter function that handles both string and Date inputs.\n */\nconst createDateFormatter =\n (options: Intl.DateTimeFormatOptions) =>\n (dateInput?: string | Date | null, locale?: string): string => {\n const date = normalizeToDate(dateInput)\n if (!date) return ''\n return date.toLocaleDateString(locale, options)\n }\n\nexport const formatDateShortWithWeekday = createDateFormatter({\n weekday: 'short',\n month: 'short',\n day: 'numeric',\n})\n\nexport const formatDateShortWithWeekdayAndYear = createDateFormatter({\n weekday: 'short',\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n})\n\nexport const formatDateShort = createDateFormatter({\n month: 'short',\n day: 'numeric',\n})\n\nexport const formatDateShortWithYear = createDateFormatter({\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n})\n\nexport const formatDateLong = createDateFormatter({\n month: 'long',\n day: 'numeric',\n})\n\nexport const formatDateLongWithYear = createDateFormatter({\n month: 'long',\n day: 'numeric',\n year: 'numeric',\n})\n\nexport const formatDateWithTime = (\n dateInput?: string | Date | null,\n locale?: string,\n): { time: string; date: string } => {\n const date = normalizeToDate(dateInput)\n if (!date) return { time: '', date: '' }\n\n const time = date.toLocaleTimeString(locale, {\n hour: 'numeric',\n minute: '2-digit',\n hour12: true,\n timeZoneName: 'short',\n })\n\n const dateString = date.toLocaleDateString(locale, {\n weekday: 'short',\n month: 'short',\n day: 'numeric',\n })\n\n return { time, date: dateString }\n}\n\nexport const formatPayPeriod = (\n startDateInput?: string | Date | null,\n endDateInput?: string | Date | null,\n locale?: string,\n): { startDate: string; endDate: string } => {\n const startDate = normalizeToDate(startDateInput)\n const endDate = normalizeToDate(endDateInput)\n\n if (!startDate || !endDate) {\n return { startDate: '', endDate: '' }\n }\n\n const startFormatted = startDate.toLocaleDateString(locale, {\n month: 'long',\n day: 'numeric',\n })\n\n const endFormatted = endDate.toLocaleDateString(locale, {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n })\n\n return { startDate: startFormatted, endDate: endFormatted }\n}\n\nexport const formatPayPeriodRange = (\n startDateInput?: string | Date | null,\n endDateInput?: string | Date | null,\n locale?: string,\n options?: { useShortMonth?: boolean },\n): string => {\n const startDate = normalizeToDate(startDateInput)\n const endDate = normalizeToDate(endDateInput)\n\n if (!startDate || !endDate) return ''\n\n const monthFormat = options?.useShortMonth ? 'short' : 'long'\n\n const startFormatted = startDate.toLocaleDateString(locale, {\n month: monthFormat,\n day: 'numeric',\n })\n\n const endFormatted = endDate.toLocaleDateString(locale, {\n month: monthFormat,\n day: 'numeric',\n year: 'numeric',\n })\n\n return `${startFormatted}–${endFormatted}`\n}\n\nexport const formatDateToStringDate = (date: Date): string | null => {\n if (isNaN(date.getTime())) {\n return null\n }\n return date.toISOString().split('T')[0] || null\n}\n\n/**\n * Normalizes Date to local midnight, handling timezone issues from any adapter.\n */\nexport const normalizeDateToLocal = (date: Date | null): Date | null => {\n if (!date || isNaN(date.getTime())) {\n return null\n }\n\n const isoString = date.toISOString()\n const [datePart] = isoString.split('T')\n if (!datePart) return null\n\n const parts = datePart.split('-')\n if (parts.length !== 3) return null\n const numbers = parts.map(Number)\n const year = numbers[0]!\n const month = numbers[1]!\n const day = numbers[2]!\n if (isNaN(year) || isNaN(month) || isNaN(day) || month < 1 || month > 12 || day < 1 || day > 31) {\n return null\n }\n\n return new Date(year, month - 1, day)\n}\n"],"names":["normalizeToDate","dateInput","parts","numbers","year","month","day","parsedDate","createDateFormatter","options","locale","date","formatDateShortWithWeekday","formatDateShortWithWeekdayAndYear","formatDateShort","formatDateShortWithYear","formatDateLong","formatDateLongWithYear","formatDateWithTime","time","dateString","formatPayPeriod","startDateInput","endDateInput","startDate","endDate","startFormatted","endFormatted","formatPayPeriodRange","monthFormat","formatDateToStringDate","normalizeDateToLocal","isoString","datePart"],"mappings":"AAMA,MAAMA,IAAkB,CAACC,MAAkD;AACzE,MAAI,CAACA,EAAW,QAAO;AAEvB,MAAI,OAAOA,KAAc,UAAU;AACjC,QAAI,sBAAsB,KAAKA,CAAS,GAAG;AACzC,YAAMC,IAAQD,EAAU,MAAM,GAAG;AACjC,UAAIC,EAAM,WAAW,EAAG,QAAO;AAE/B,YAAMC,IAAUD,EAAM,IAAI,MAAM,GAC1BE,IAAOD,EAAQ,CAAC,GAChBE,IAAQF,EAAQ,CAAC,GACjBG,IAAMH,EAAQ,CAAC;AAKrB,aAJIC,MAAS,UAAaC,MAAU,UAAaC,MAAQ,UAKvD,MAAMF,CAAI,KACV,MAAMC,CAAK,KACX,MAAMC,CAAG,KACTD,IAAQ,KACRA,IAAQ,MACRC,IAAM,KACNA,IAAM,KAEC,OAGF,IAAI,KAAKF,GAAMC,IAAQ,GAAGC,CAAG;AAAA,IACtC;AAEA,UAAMC,IAAa,IAAI,KAAKN,CAAS;AACrC,WAAO,MAAMM,EAAW,QAAA,CAAS,IAAI,OAAOA;AAAA,EAC9C;AAEA,SAAIN,aAAqB,OAChB,MAAMA,EAAU,QAAA,CAAS,IAAI,OAAOA,IAGtC;AACT,GAKMO,IACJ,CAACC,MACD,CAACR,GAAkCS,MAA4B;AAC7D,QAAMC,IAAOX,EAAgBC,CAAS;AACtC,SAAKU,IACEA,EAAK,mBAAmBD,GAAQD,CAAO,IAD5B;AAEpB,GAEWG,IAA6BJ,EAAoB;AAAA,EAC5D,SAAS;AAAA,EACT,OAAO;AAAA,EACP,KAAK;AACP,CAAC,GAEYK,IAAoCL,EAAoB;AAAA,EACnE,SAAS;AAAA,EACT,OAAO;AAAA,EACP,KAAK;AAAA,EACL,MAAM;AACR,CAAC,GAEYM,IAAkBN,EAAoB;AAAA,EACjD,OAAO;AAAA,EACP,KAAK;AACP,CAAC,GAEYO,IAA0BP,EAAoB;AAAA,EACzD,OAAO;AAAA,EACP,KAAK;AAAA,EACL,MAAM;AACR,CAAC,GAEYQ,IAAiBR,EAAoB;AAAA,EAChD,OAAO;AAAA,EACP,KAAK;AACP,CAAC,GAEYS,IAAyBT,EAAoB;AAAA,EACxD,OAAO;AAAA,EACP,KAAK;AAAA,EACL,MAAM;AACR,CAAC,GAEYU,IAAqB,CAChCjB,GACAS,MACmC;AACnC,QAAMC,IAAOX,EAAgBC,CAAS;AACtC,MAAI,CAACU,EAAM,QAAO,EAAE,MAAM,IAAI,MAAM,GAAA;AAEpC,QAAMQ,IAAOR,EAAK,mBAAmBD,GAAQ;AAAA,IAC3C,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,cAAc;AAAA,EAAA,CACf,GAEKU,IAAaT,EAAK,mBAAmBD,GAAQ;AAAA,IACjD,SAAS;AAAA,IACT,OAAO;AAAA,IACP,KAAK;AAAA,EAAA,CACN;AAED,SAAO,EAAE,MAAAS,GAAM,MAAMC,EAAA;AACvB,GAEaC,IAAkB,CAC7BC,GACAC,GACAb,MAC2C;AAC3C,QAAMc,IAAYxB,EAAgBsB,CAAc,GAC1CG,IAAUzB,EAAgBuB,CAAY;AAE5C,MAAI,CAACC,KAAa,CAACC;AACjB,WAAO,EAAE,WAAW,IAAI,SAAS,GAAA;AAGnC,QAAMC,IAAiBF,EAAU,mBAAmBd,GAAQ;AAAA,IAC1D,OAAO;AAAA,IACP,KAAK;AAAA,EAAA,CACN,GAEKiB,IAAeF,EAAQ,mBAAmBf,GAAQ;AAAA,IACtD,OAAO;AAAA,IACP,KAAK;AAAA,IACL,MAAM;AAAA,EAAA,CACP;AAED,SAAO,EAAE,WAAWgB,GAAgB,SAASC,EAAA;AAC/C,GAEaC,IAAuB,CAClCN,GACAC,GACAb,GACAD,MACW;AACX,QAAMe,IAAYxB,EAAgBsB,CAAc,GAC1CG,IAAUzB,EAAgBuB,CAAY;AAE5C,MAAI,CAACC,KAAa,CAACC,EAAS,QAAO;AAEnC,QAAMI,IAAcpB,GAAS,gBAAgB,UAAU,QAEjDiB,IAAiBF,EAAU,mBAAmBd,GAAQ;AAAA,IAC1D,OAAOmB;AAAA,IACP,KAAK;AAAA,EAAA,CACN,GAEKF,IAAeF,EAAQ,mBAAmBf,GAAQ;AAAA,IACtD,OAAOmB;AAAA,IACP,KAAK;AAAA,IACL,MAAM;AAAA,EAAA,CACP;AAED,SAAO,GAAGH,CAAc,IAAIC,CAAY;AAC1C,GAEaG,IAAyB,CAACnB,MACjC,MAAMA,EAAK,QAAA,CAAS,IACf,OAEFA,EAAK,cAAc,MAAM,GAAG,EAAE,CAAC,KAAK,MAMhCoB,IAAuB,CAACpB,MAAmC;AACtE,MAAI,CAACA,KAAQ,MAAMA,EAAK,QAAA,CAAS;AAC/B,WAAO;AAGT,QAAMqB,IAAYrB,EAAK,YAAA,GACjB,CAACsB,CAAQ,IAAID,EAAU,MAAM,GAAG;AACtC,MAAI,CAACC,EAAU,QAAO;AAEtB,QAAM/B,IAAQ+B,EAAS,MAAM,GAAG;AAChC,MAAI/B,EAAM,WAAW,EAAG,QAAO;AAC/B,QAAMC,IAAUD,EAAM,IAAI,MAAM,GAC1BE,IAAOD,EAAQ,CAAC,GAChBE,IAAQF,EAAQ,CAAC,GACjBG,IAAMH,EAAQ,CAAC;AACrB,SAAI,MAAMC,CAAI,KAAK,MAAMC,CAAK,KAAK,MAAMC,CAAG,KAAKD,IAAQ,KAAKA,IAAQ,MAAMC,IAAM,KAAKA,IAAM,KACpF,OAGF,IAAI,KAAKF,GAAMC,IAAQ,GAAGC,CAAG;AACtC;"}
@@ -1,20 +1,19 @@
1
1
  import m from "dompurify";
2
2
  import "react-i18next";
3
3
  import "react";
4
- import "../contexts/LocaleProvider/useLocale.js";
5
- const c = (t) => t.charAt(0).toLocaleUpperCase() + t.slice(1), h = ({
4
+ const c = (t) => t.charAt(0).toLocaleUpperCase() + t.slice(1), l = ({
6
5
  first_name: t,
7
6
  last_name: e
8
7
  }) => `${t ? c(t) : ""}${e ? n(c(e)) : ""}`, n = (t) => t ? ` ${t}` : "", i = (t) => {
9
8
  const e = n(t.street1), r = n(t.street2);
10
9
  return `${e},${r}`;
11
- }, u = (t) => `${n(t.city)}, ${n(t.state)} ${n(t.zip)}`, C = (t) => `${i(t)} ${u(t)}`, p = (t, e) => e ? `${t}%` : `$${t}`, s = (t, e = "en-US") => {
10
+ }, u = (t) => `${n(t.city)}, ${n(t.state)} ${n(t.zip)}`, h = (t) => `${i(t)} ${u(t)}`, p = (t, e) => e ? `${t}%` : `$${t}`, s = (t, e = "en-US") => {
12
11
  const r = t.toLocaleString(e, {
13
12
  minimumFractionDigits: 2,
14
13
  maximumFractionDigits: 2
15
14
  });
16
15
  return p(r, !1);
17
- }, S = ({
16
+ }, C = ({
18
17
  rate: t,
19
18
  paymentUnit: e,
20
19
  t: r,
@@ -42,20 +41,20 @@ const c = (t) => t.charAt(0).toLocaleUpperCase() + t.slice(1), h = ({
42
41
  return o;
43
42
  }
44
43
  }, y = { ALLOWED_TAGS: ["a", "b", "strong"], ALLOWED_ATTR: ["href", "target"] };
45
- function D(t) {
44
+ function S(t) {
46
45
  return t ? { __html: m.sanitize(t, y) } : { __html: "" };
47
46
  }
48
- const F = (t) => t.replace(/\D/g, ""), L = (t) => t.replace(/_([a-z])/g, (e, r) => r.toUpperCase());
47
+ const D = (t) => t.replace(/\D/g, ""), F = (t) => t.replace(/_([a-z])/g, (e, r) => r.toUpperCase());
49
48
  export {
50
- C as addressInline,
49
+ h as addressInline,
51
50
  p as amountStr,
52
- D as createMarkup,
53
- h as firstLastName,
51
+ S as createMarkup,
52
+ l as firstLastName,
54
53
  s as formatNumberAsCurrency,
55
- S as formatPayRate,
54
+ C as formatPayRate,
56
55
  u as getCityStateZip,
57
56
  i as getStreet,
58
- F as removeNonDigits,
59
- L as snakeCaseToCamelCase
57
+ D as removeNonDigits,
58
+ F as snakeCaseToCamelCase
60
59
  };
61
60
  //# sourceMappingURL=formattedStrings.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"formattedStrings.js","sources":["../../src/helpers/formattedStrings.ts"],"sourcesContent":["import DOMPurify from 'dompurify'\nimport { type Location } from '@gusto/embedded-api/models/components/location'\nimport { type EmployeeAddress } from '@gusto/embedded-api/models/components/employeeaddress'\nimport { type TFunction } from 'i18next'\nimport { useTranslation } from 'react-i18next'\nimport { useCallback } from 'react'\nimport { useLocale } from '@/contexts/LocaleProvider/useLocale'\n\nconst capitalize = (word: string) => word.charAt(0).toLocaleUpperCase() + word.slice(1)\n\nexport const firstLastName = ({\n first_name,\n last_name,\n}: {\n first_name?: string | null\n last_name?: string | null\n}) =>\n `${first_name ? capitalize(first_name) : ''}${last_name ? maybeString(capitalize(last_name)) : ''}`\n\nconst maybeString = (str: string | null | undefined) => {\n return str ? ` ${str}` : ''\n}\n\nexport const getStreet = (address: EmployeeAddress | Location) => {\n const street1 = maybeString(address.street1)\n const street2 = maybeString(address.street2)\n\n return `${street1},${street2}`\n}\n\nexport const getCityStateZip = (address: EmployeeAddress | Location) =>\n `${maybeString(address.city)}, ${maybeString(address.state)} ${maybeString(address.zip)}`\n\nexport const addressInline = (address: EmployeeAddress | Location) =>\n `${getStreet(address)} ${getCityStateZip(address)}`\n\nexport const currentDateString = () => {\n const d = new Date()\n const dateString = `${String(d.getFullYear())}-${('0' + String(d.getMonth() + 1)).slice(-2)}-${('0' + String(d.getDate())).slice(-2)}`\n return dateString\n}\n\nexport function isNumberKey({ which, keyCode }: KeyboardEvent) {\n const charCode = which ? which : keyCode\n if (charCode > 31 && charCode != 46 && (charCode < 48 || charCode > 57)) return false\n return true\n}\n\nexport const booleanToString = (value: boolean) => (value ? 'true' : 'false')\n\nexport const amountStr = (amount: string, isPercentage: boolean) =>\n isPercentage ? `${amount}%` : `$${amount}`\n\nexport const formatNumberAsCurrency = (amount: number, locale: string = 'en-US') => {\n const formattedNumber = amount.toLocaleString(locale, {\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n })\n return amountStr(formattedNumber, false)\n}\n\nexport const formatPayRate = ({\n rate,\n paymentUnit,\n t,\n locale = 'en-US',\n}: {\n rate: number\n paymentUnit: string\n t: TFunction\n locale?: string\n}) => {\n const amount = formatNumberAsCurrency(rate, locale)\n\n switch (paymentUnit) {\n case 'Hour':\n return t('payRateFormats.hourly', { amount, ns: 'common' })\n case 'Week':\n return t('payRateFormats.weekly', {\n amount: formatNumberAsCurrency(rate * 52, locale),\n ns: 'common',\n })\n case 'Month':\n return t('payRateFormats.monthly', {\n amount: formatNumberAsCurrency(rate * 12, locale),\n ns: 'common',\n })\n case 'Year':\n return t('payRateFormats.yearly', { amount, ns: 'common' })\n case 'Paycheck':\n return t('payRateFormats.paycheck', { amount, ns: 'common' })\n default:\n return amount\n }\n}\n\nexport const useFormatPayRate = () => {\n const { t } = useTranslation('common')\n const { locale } = useLocale()\n\n return useCallback(\n (rate: number, paymentUnit: string) => {\n return formatPayRate({ rate, paymentUnit, t, locale })\n },\n [t, locale],\n )\n}\n\nconst dompurifyConfig = { ALLOWED_TAGS: ['a', 'b', 'strong'], ALLOWED_ATTR: ['href', 'target'] }\nexport function createMarkup(dirty: string) {\n if (!dirty) return { __html: '' }\n return { __html: DOMPurify.sanitize(dirty, dompurifyConfig) }\n}\n\nexport const removeNonDigits = (value: string): string => {\n return value.replace(/\\D/g, '')\n}\n\nexport const snakeCaseToCamelCase = (s: string) => {\n return s.replace(/_([a-z])/g, (_: string, char: string) => char.toUpperCase())\n}\n\nexport const camelCaseToSnakeCase = (s: string) => {\n return s\n .replace(\n /([a-z0-9])([A-Z])/g,\n (_: string, group1: string, group2: string) => `${group1}_${group2.toLowerCase()}`,\n )\n .replace(\n /([A-Z])([A-Z])(?=[a-z])/g,\n (_: string, group1: string, group2: string) =>\n `${group1.toLowerCase()}_${group2.toLowerCase()}`,\n )\n .toLowerCase()\n}\n"],"names":["capitalize","word","firstLastName","first_name","last_name","maybeString","str","getStreet","address","street1","street2","getCityStateZip","addressInline","amountStr","amount","isPercentage","formatNumberAsCurrency","locale","formattedNumber","formatPayRate","rate","paymentUnit","t","dompurifyConfig","createMarkup","dirty","DOMPurify","removeNonDigits","value","snakeCaseToCamelCase","s","_","char"],"mappings":";;;;AAQA,MAAMA,IAAa,CAACC,MAAiBA,EAAK,OAAO,CAAC,EAAE,sBAAsBA,EAAK,MAAM,CAAC,GAEzEC,IAAgB,CAAC;AAAA,EAC5B,YAAAC;AAAA,EACA,WAAAC;AACF,MAIE,GAAGD,IAAaH,EAAWG,CAAU,IAAI,EAAE,GAAGC,IAAYC,EAAYL,EAAWI,CAAS,CAAC,IAAI,EAAE,IAE7FC,IAAc,CAACC,MACZA,IAAM,IAAIA,CAAG,KAAK,IAGdC,IAAY,CAACC,MAAwC;AAChE,QAAMC,IAAUJ,EAAYG,EAAQ,OAAO,GACrCE,IAAUL,EAAYG,EAAQ,OAAO;AAE3C,SAAO,GAAGC,CAAO,IAAIC,CAAO;AAC9B,GAEaC,IAAkB,CAACH,MAC9B,GAAGH,EAAYG,EAAQ,IAAI,CAAC,KAAKH,EAAYG,EAAQ,KAAK,CAAC,IAAIH,EAAYG,EAAQ,GAAG,CAAC,IAE5EI,IAAgB,CAACJ,MAC5B,GAAGD,EAAUC,CAAO,CAAC,IAAIG,EAAgBH,CAAO,CAAC,IAgBtCK,IAAY,CAACC,GAAgBC,MACxCA,IAAe,GAAGD,CAAM,MAAM,IAAIA,CAAM,IAE7BE,IAAyB,CAACF,GAAgBG,IAAiB,YAAY;AAClF,QAAMC,IAAkBJ,EAAO,eAAeG,GAAQ;AAAA,IACpD,uBAAuB;AAAA,IACvB,uBAAuB;AAAA,EAAA,CACxB;AACD,SAAOJ,EAAUK,GAAiB,EAAK;AACzC,GAEaC,IAAgB,CAAC;AAAA,EAC5B,MAAAC;AAAA,EACA,aAAAC;AAAA,EACA,GAAAC;AAAA,EACA,QAAAL,IAAS;AACX,MAKM;AACJ,QAAMH,IAASE,EAAuBI,GAAMH,CAAM;AAElD,UAAQI,GAAA;AAAA,IACN,KAAK;AACH,aAAOC,EAAE,yBAAyB,EAAE,QAAAR,GAAQ,IAAI,UAAU;AAAA,IAC5D,KAAK;AACH,aAAOQ,EAAE,yBAAyB;AAAA,QAChC,QAAQN,EAAuBI,IAAO,IAAIH,CAAM;AAAA,QAChD,IAAI;AAAA,MAAA,CACL;AAAA,IACH,KAAK;AACH,aAAOK,EAAE,0BAA0B;AAAA,QACjC,QAAQN,EAAuBI,IAAO,IAAIH,CAAM;AAAA,QAChD,IAAI;AAAA,MAAA,CACL;AAAA,IACH,KAAK;AACH,aAAOK,EAAE,yBAAyB,EAAE,QAAAR,GAAQ,IAAI,UAAU;AAAA,IAC5D,KAAK;AACH,aAAOQ,EAAE,2BAA2B,EAAE,QAAAR,GAAQ,IAAI,UAAU;AAAA,IAC9D;AACE,aAAOA;AAAA,EAAA;AAEb,GAcMS,IAAkB,EAAE,cAAc,CAAC,KAAK,KAAK,QAAQ,GAAG,cAAc,CAAC,QAAQ,QAAQ,EAAA;AACtF,SAASC,EAAaC,GAAe;AAC1C,SAAKA,IACE,EAAE,QAAQC,EAAU,SAASD,GAAOF,CAAe,EAAA,IADvC,EAAE,QAAQ,GAAA;AAE/B;AAEO,MAAMI,IAAkB,CAACC,MACvBA,EAAM,QAAQ,OAAO,EAAE,GAGnBC,IAAuB,CAACC,MAC5BA,EAAE,QAAQ,aAAa,CAACC,GAAWC,MAAiBA,EAAK,aAAa;"}
1
+ {"version":3,"file":"formattedStrings.js","sources":["../../src/helpers/formattedStrings.ts"],"sourcesContent":["import DOMPurify from 'dompurify'\nimport { type Location } from '@gusto/embedded-api/models/components/location'\nimport { type EmployeeAddress } from '@gusto/embedded-api/models/components/employeeaddress'\nimport { type TFunction } from 'i18next'\nimport { useTranslation } from 'react-i18next'\nimport { useCallback } from 'react'\nimport { useLocale } from '@/contexts/LocaleProvider/useLocale'\n\nconst capitalize = (word: string) => word.charAt(0).toLocaleUpperCase() + word.slice(1)\n\nexport const firstLastName = ({\n first_name,\n last_name,\n}: {\n first_name?: string | null\n last_name?: string | null\n}) =>\n `${first_name ? capitalize(first_name) : ''}${last_name ? maybeString(capitalize(last_name)) : ''}`\n\nconst maybeString = (str: string | null | undefined) => {\n return str ? ` ${str}` : ''\n}\n\nexport const getStreet = (address: EmployeeAddress | Location) => {\n const street1 = maybeString(address.street1)\n const street2 = maybeString(address.street2)\n\n return `${street1},${street2}`\n}\n\nexport const getCityStateZip = (address: EmployeeAddress | Location) =>\n `${maybeString(address.city)}, ${maybeString(address.state)} ${maybeString(address.zip)}`\n\nexport const addressInline = (address: EmployeeAddress | Location) =>\n `${getStreet(address)} ${getCityStateZip(address)}`\n\nexport const currentDateString = () => {\n const d = new Date()\n const dateString = `${String(d.getFullYear())}-${('0' + String(d.getMonth() + 1)).slice(-2)}-${('0' + String(d.getDate())).slice(-2)}`\n return dateString\n}\n\nexport function isNumberKey({ which, keyCode }: KeyboardEvent) {\n const charCode = which ? which : keyCode\n if (charCode > 31 && charCode != 46 && (charCode < 48 || charCode > 57)) return false\n return true\n}\n\nexport const booleanToString = (value: boolean) => (value ? 'true' : 'false')\n\nexport const amountStr = (amount: string, isPercentage: boolean) =>\n isPercentage ? `${amount}%` : `$${amount}`\n\nexport const formatNumberAsCurrency = (amount: number, locale: string = 'en-US') => {\n const formattedNumber = amount.toLocaleString(locale, {\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n })\n return amountStr(formattedNumber, false)\n}\n\nexport const formatPayRate = ({\n rate,\n paymentUnit,\n t,\n locale = 'en-US',\n}: {\n rate: number\n paymentUnit: string\n t: TFunction\n locale?: string\n}) => {\n const amount = formatNumberAsCurrency(rate, locale)\n\n switch (paymentUnit) {\n case 'Hour':\n return t('payRateFormats.hourly', { amount, ns: 'common' })\n case 'Week':\n return t('payRateFormats.weekly', {\n amount: formatNumberAsCurrency(rate * 52, locale),\n ns: 'common',\n })\n case 'Month':\n return t('payRateFormats.monthly', {\n amount: formatNumberAsCurrency(rate * 12, locale),\n ns: 'common',\n })\n case 'Year':\n return t('payRateFormats.yearly', { amount, ns: 'common' })\n case 'Paycheck':\n return t('payRateFormats.paycheck', { amount, ns: 'common' })\n default:\n return amount\n }\n}\n\nexport const useFormatPayRate = () => {\n const { t } = useTranslation('common')\n const { locale } = useLocale()\n\n return useCallback(\n (rate: number, paymentUnit: string) => {\n return formatPayRate({ rate, paymentUnit, t, locale })\n },\n [t, locale],\n )\n}\n\nconst dompurifyConfig = { ALLOWED_TAGS: ['a', 'b', 'strong'], ALLOWED_ATTR: ['href', 'target'] }\nexport function createMarkup(dirty: string) {\n if (!dirty) return { __html: '' }\n return { __html: DOMPurify.sanitize(dirty, dompurifyConfig) }\n}\n\nexport const removeNonDigits = (value: string): string => {\n return value.replace(/\\D/g, '')\n}\n\nexport const snakeCaseToCamelCase = (s: string) => {\n return s.replace(/_([a-z])/g, (_: string, char: string) => char.toUpperCase())\n}\n\nexport const camelCaseToSnakeCase = (s: string) => {\n return s\n .replace(\n /([a-z0-9])([A-Z])/g,\n (_: string, group1: string, group2: string) => `${group1}_${group2.toLowerCase()}`,\n )\n .replace(\n /([A-Z])([A-Z])(?=[a-z])/g,\n (_: string, group1: string, group2: string) =>\n `${group1.toLowerCase()}_${group2.toLowerCase()}`,\n )\n .toLowerCase()\n}\n"],"names":["capitalize","word","firstLastName","first_name","last_name","maybeString","str","getStreet","address","street1","street2","getCityStateZip","addressInline","amountStr","amount","isPercentage","formatNumberAsCurrency","locale","formattedNumber","formatPayRate","rate","paymentUnit","t","dompurifyConfig","createMarkup","dirty","DOMPurify","removeNonDigits","value","snakeCaseToCamelCase","s","_","char"],"mappings":";;;AAQA,MAAMA,IAAa,CAACC,MAAiBA,EAAK,OAAO,CAAC,EAAE,sBAAsBA,EAAK,MAAM,CAAC,GAEzEC,IAAgB,CAAC;AAAA,EAC5B,YAAAC;AAAA,EACA,WAAAC;AACF,MAIE,GAAGD,IAAaH,EAAWG,CAAU,IAAI,EAAE,GAAGC,IAAYC,EAAYL,EAAWI,CAAS,CAAC,IAAI,EAAE,IAE7FC,IAAc,CAACC,MACZA,IAAM,IAAIA,CAAG,KAAK,IAGdC,IAAY,CAACC,MAAwC;AAChE,QAAMC,IAAUJ,EAAYG,EAAQ,OAAO,GACrCE,IAAUL,EAAYG,EAAQ,OAAO;AAE3C,SAAO,GAAGC,CAAO,IAAIC,CAAO;AAC9B,GAEaC,IAAkB,CAACH,MAC9B,GAAGH,EAAYG,EAAQ,IAAI,CAAC,KAAKH,EAAYG,EAAQ,KAAK,CAAC,IAAIH,EAAYG,EAAQ,GAAG,CAAC,IAE5EI,IAAgB,CAACJ,MAC5B,GAAGD,EAAUC,CAAO,CAAC,IAAIG,EAAgBH,CAAO,CAAC,IAgBtCK,IAAY,CAACC,GAAgBC,MACxCA,IAAe,GAAGD,CAAM,MAAM,IAAIA,CAAM,IAE7BE,IAAyB,CAACF,GAAgBG,IAAiB,YAAY;AAClF,QAAMC,IAAkBJ,EAAO,eAAeG,GAAQ;AAAA,IACpD,uBAAuB;AAAA,IACvB,uBAAuB;AAAA,EAAA,CACxB;AACD,SAAOJ,EAAUK,GAAiB,EAAK;AACzC,GAEaC,IAAgB,CAAC;AAAA,EAC5B,MAAAC;AAAA,EACA,aAAAC;AAAA,EACA,GAAAC;AAAA,EACA,QAAAL,IAAS;AACX,MAKM;AACJ,QAAMH,IAASE,EAAuBI,GAAMH,CAAM;AAElD,UAAQI,GAAA;AAAA,IACN,KAAK;AACH,aAAOC,EAAE,yBAAyB,EAAE,QAAAR,GAAQ,IAAI,UAAU;AAAA,IAC5D,KAAK;AACH,aAAOQ,EAAE,yBAAyB;AAAA,QAChC,QAAQN,EAAuBI,IAAO,IAAIH,CAAM;AAAA,QAChD,IAAI;AAAA,MAAA,CACL;AAAA,IACH,KAAK;AACH,aAAOK,EAAE,0BAA0B;AAAA,QACjC,QAAQN,EAAuBI,IAAO,IAAIH,CAAM;AAAA,QAChD,IAAI;AAAA,MAAA,CACL;AAAA,IACH,KAAK;AACH,aAAOK,EAAE,yBAAyB,EAAE,QAAAR,GAAQ,IAAI,UAAU;AAAA,IAC5D,KAAK;AACH,aAAOQ,EAAE,2BAA2B,EAAE,QAAAR,GAAQ,IAAI,UAAU;AAAA,IAC9D;AACE,aAAOA;AAAA,EAAA;AAEb,GAcMS,IAAkB,EAAE,cAAc,CAAC,KAAK,KAAK,QAAQ,GAAG,cAAc,CAAC,QAAQ,QAAQ,EAAA;AACtF,SAASC,EAAaC,GAAe;AAC1C,SAAKA,IACE,EAAE,QAAQC,EAAU,SAASD,GAAOF,CAAe,EAAA,IADvC,EAAE,QAAQ,GAAA;AAE/B;AAEO,MAAMI,IAAkB,CAACC,MACvBA,EAAM,QAAQ,OAAO,EAAE,GAGnBC,IAAuB,CAACC,MAC5BA,EAAE,QAAQ,aAAa,CAACC,GAAWC,MAAiBA,EAAK,aAAa;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAsyncError.js","sources":["../../src/hooks/useAsyncError.tsx"],"sourcesContent":["import React from 'react'\n/**\n * Triggers re-render of a component to allow ErrorBoundary to catch a thrown error - that way we can handle all exceptions from asynchrounous functions in the same way and catch them in react boundary\n * @returns Function\n */\nexport const useAsyncError = () => {\n const [_, setError] = React.useState()\n return React.useCallback(\n (e: unknown) => {\n const err = e instanceof Error ? e : new Error(typeof e === 'string' ? e : 'Unknown error')\n setError(() => {\n throw err\n })\n },\n [setError],\n )\n}\n"],"names":["useAsyncError","_","setError","React","e","err"],"mappings":";AAKO,MAAMA,IAAgB,MAAM;AACjC,QAAM,CAACC,GAAGC,CAAQ,IAAIC,EAAM,SAAA;AAC5B,SAAOA,EAAM;AAAA,IACX,CAACC,MAAe;AACd,YAAMC,IAAMD,aAAa,QAAQA,IAAI,IAAI,MAAM,OAAOA,KAAM,WAAWA,IAAI,eAAe;AAC1F,MAAAF,EAAS,MAAM;AACb,cAAMG;AAAA,MACR,CAAC;AAAA,IACH;AAAA,IACA,CAACH,CAAQ;AAAA,EAAA;AAEb;"}
@@ -0,0 +1,19 @@
1
+ export declare const useDateFormatter: () => {
2
+ formatShortWithWeekday: (date?: string | Date | null) => string;
3
+ formatShortWithWeekdayAndYear: (date?: string | Date | null) => string;
4
+ formatShort: (date?: string | Date | null) => string;
5
+ formatShortWithYear: (date?: string | Date | null) => string;
6
+ formatLong: (date?: string | Date | null) => string;
7
+ formatLongWithYear: (date?: string | Date | null) => string;
8
+ formatWithTime: (date?: string | Date | null) => {
9
+ time: string;
10
+ date: string;
11
+ };
12
+ formatPayPeriod: (startDate?: string | Date | null, endDate?: string | Date | null) => {
13
+ startDate: string;
14
+ endDate: string;
15
+ };
16
+ formatPayPeriodRange: (startDate?: string | Date | null, endDate?: string | Date | null, options?: {
17
+ useShortMonth?: boolean;
18
+ }) => string;
19
+ };
@@ -0,0 +1,24 @@
1
+ import { useMemo as e } from "react";
2
+ import { formatPayPeriodRange as m, formatPayPeriod as f, formatDateWithTime as i, formatDateLongWithYear as h, formatDateLong as W, formatDateShortWithYear as n, formatDateShort as d, formatDateShortWithWeekdayAndYear as y, formatDateShortWithWeekday as D } from "../helpers/dateFormatting.js";
3
+ import { useLocale as P } from "../contexts/LocaleProvider/useLocale.js";
4
+ const s = () => {
5
+ const { locale: o } = P();
6
+ return e(
7
+ () => ({
8
+ formatShortWithWeekday: (t) => D(t, o),
9
+ formatShortWithWeekdayAndYear: (t) => y(t, o),
10
+ formatShort: (t) => d(t, o),
11
+ formatShortWithYear: (t) => n(t, o),
12
+ formatLong: (t) => W(t, o),
13
+ formatLongWithYear: (t) => h(t, o),
14
+ formatWithTime: (t) => i(t, o),
15
+ formatPayPeriod: (t, r) => f(t, r, o),
16
+ formatPayPeriodRange: (t, r, a) => m(t, r, o, a)
17
+ }),
18
+ [o]
19
+ );
20
+ };
21
+ export {
22
+ s as useDateFormatter
23
+ };
24
+ //# sourceMappingURL=useDateFormatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDateFormatter.js","sources":["../../src/hooks/useDateFormatter.ts"],"sourcesContent":["import { useMemo } from 'react'\nimport {\n formatDateShortWithWeekday,\n formatDateShortWithWeekdayAndYear,\n formatDateShort,\n formatDateShortWithYear,\n formatDateLong,\n formatDateLongWithYear,\n formatDateWithTime,\n formatPayPeriod,\n formatPayPeriodRange,\n} from '@/helpers/dateFormatting'\nimport { useLocale } from '@/contexts/LocaleProvider'\n\nexport const useDateFormatter = () => {\n const { locale } = useLocale()\n\n return useMemo(\n () => ({\n formatShortWithWeekday: (date?: string | Date | null) =>\n formatDateShortWithWeekday(date, locale),\n\n formatShortWithWeekdayAndYear: (date?: string | Date | null) =>\n formatDateShortWithWeekdayAndYear(date, locale),\n\n formatShort: (date?: string | Date | null) => formatDateShort(date, locale),\n\n formatShortWithYear: (date?: string | Date | null) => formatDateShortWithYear(date, locale),\n\n formatLong: (date?: string | Date | null) => formatDateLong(date, locale),\n\n formatLongWithYear: (date?: string | Date | null) => formatDateLongWithYear(date, locale),\n\n formatWithTime: (date?: string | Date | null) => formatDateWithTime(date, locale),\n\n formatPayPeriod: (startDate?: string | Date | null, endDate?: string | Date | null) =>\n formatPayPeriod(startDate, endDate, locale),\n\n formatPayPeriodRange: (\n startDate?: string | Date | null,\n endDate?: string | Date | null,\n options?: { useShortMonth?: boolean },\n ) => formatPayPeriodRange(startDate, endDate, locale, options),\n }),\n [locale],\n )\n}\n"],"names":["useDateFormatter","locale","useLocale","useMemo","date","formatDateShortWithWeekday","formatDateShortWithWeekdayAndYear","formatDateShort","formatDateShortWithYear","formatDateLong","formatDateLongWithYear","formatDateWithTime","startDate","endDate","formatPayPeriod","options","formatPayPeriodRange"],"mappings":";;;AAcO,MAAMA,IAAmB,MAAM;AACpC,QAAM,EAAE,QAAAC,EAAA,IAAWC,EAAA;AAEnB,SAAOC;AAAA,IACL,OAAO;AAAA,MACL,wBAAwB,CAACC,MACvBC,EAA2BD,GAAMH,CAAM;AAAA,MAEzC,+BAA+B,CAACG,MAC9BE,EAAkCF,GAAMH,CAAM;AAAA,MAEhD,aAAa,CAACG,MAAgCG,EAAgBH,GAAMH,CAAM;AAAA,MAE1E,qBAAqB,CAACG,MAAgCI,EAAwBJ,GAAMH,CAAM;AAAA,MAE1F,YAAY,CAACG,MAAgCK,EAAeL,GAAMH,CAAM;AAAA,MAExE,oBAAoB,CAACG,MAAgCM,EAAuBN,GAAMH,CAAM;AAAA,MAExF,gBAAgB,CAACG,MAAgCO,EAAmBP,GAAMH,CAAM;AAAA,MAEhF,iBAAiB,CAACW,GAAkCC,MAClDC,EAAgBF,GAAWC,GAASZ,CAAM;AAAA,MAE5C,sBAAsB,CACpBW,GACAC,GACAE,MACGC,EAAqBJ,GAAWC,GAASZ,GAAQc,CAAO;AAAA,IAAA;AAAA,IAE/D,CAACd,CAAM;AAAA,EAAA;AAEX;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMenu.js","sources":["../../src/hooks/useMenu.ts"],"sourcesContent":["import { useState, useRef } from 'react'\n\nexport function useMenu<T extends Element = HTMLButtonElement>() {\n const [isOpen, setIsOpen] = useState(false)\n const triggerRef = useRef<T>(null)\n\n return {\n triggerProps: {\n ref: triggerRef,\n onClick: () => {\n setIsOpen(true)\n },\n 'aria-haspopup': true,\n 'aria-expanded': isOpen,\n },\n menuProps: {\n isOpen,\n onClose: () => {\n setIsOpen(false)\n },\n triggerRef,\n },\n }\n}\n"],"names":["useMenu","isOpen","setIsOpen","useState","triggerRef","useRef"],"mappings":";AAEO,SAASA,IAAiD;AAC/D,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GACpCC,IAAaC,EAAU,IAAI;AAEjC,SAAO;AAAA,IACL,cAAc;AAAA,MACZ,KAAKD;AAAA,MACL,SAAS,MAAM;AACb,QAAAF,EAAU,EAAI;AAAA,MAChB;AAAA,MACA,iBAAiB;AAAA,MACjB,iBAAiBD;AAAA,IAAA;AAAA,IAEnB,WAAW;AAAA,MACT,QAAAA;AAAA,MACA,SAAS,MAAM;AACb,QAAAC,EAAU,EAAK;AAAA,MACjB;AAAA,MACA,YAAAE;AAAA,IAAA;AAAA,EACF;AAEJ;"}
@@ -1,6 +1,6 @@
1
1
  import { useMemo as e } from "react";
2
2
  import { NumberFormatter as t } from "@internationalized/number";
3
- import { useLocale as n } from "../../../contexts/LocaleProvider/useLocale.js";
3
+ import { useLocale as n } from "../contexts/LocaleProvider/useLocale.js";
4
4
  const f = (r = "currency") => {
5
5
  const { locale: m, currency: o } = n();
6
6
  return e(() => (c) => new t(m, {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useNumberFormatter.js","sources":["../../src/hooks/useNumberFormatter.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { NumberFormatter } from '@internationalized/number'\nimport { useLocale } from '@/contexts/LocaleProvider'\n\n/**Custom hook wrapping NumberFormatter and returing format method */\nconst useNumberFormatter = (style: 'currency' | 'percent' = 'currency') => {\n const { locale, currency } = useLocale()\n return useMemo(() => {\n return (value: number) =>\n new NumberFormatter(locale, {\n style: style,\n currency: style === 'currency' ? currency : undefined,\n minimumFractionDigits: style === 'currency' ? 2 : 0,\n maximumFractionDigits: 2,\n }).format(style === 'percent' ? value / 100 : value) //GustoAPI does not store percent values as fractions\n }, [style, currency, locale])\n}\n\nexport default useNumberFormatter\n"],"names":["useNumberFormatter","style","locale","currency","useLocale","useMemo","value","NumberFormatter"],"mappings":";;;AAKA,MAAMA,IAAqB,CAACC,IAAgC,eAAe;AACzE,QAAM,EAAE,QAAAC,GAAQ,UAAAC,EAAA,IAAaC,EAAA;AAC7B,SAAOC,EAAQ,MACN,CAACC,MACN,IAAIC,EAAgBL,GAAQ;AAAA,IAC1B,OAAAD;AAAA,IACA,UAAUA,MAAU,aAAaE,IAAW;AAAA,IAC5C,uBAAuBF,MAAU,aAAa,IAAI;AAAA,IAClD,uBAAuB;AAAA,EAAA,CACxB,EAAE,OAAOA,MAAU,YAAYK,IAAQ,MAAMA,CAAK,GACpD,CAACL,GAAOE,GAAUD,CAAM,CAAC;AAC9B;"}
@@ -0,0 +1,3 @@
1
+ import "./types/i18next.d.ts"
2
+ export { useOverflowDetection } from './useOverflowDetection';
3
+ export type { UseOverflowDetectionProps } from './useOverflowDetection';
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ export type UseOverflowDetectionProps = {
3
+ ref: React.RefObject<HTMLElement | null>;
4
+ debounceTimeout?: number;
5
+ };
6
+ export declare const useOverflowDetection: ({ ref, debounceTimeout, }: UseOverflowDetectionProps) => boolean;
7
+ export default useOverflowDetection;
@@ -0,0 +1,28 @@
1
+ import { useState as f, useRef as a, useEffect as v } from "react";
2
+ const O = 10, w = ({
3
+ ref: c,
4
+ debounceTimeout: o = O
5
+ }) => {
6
+ const [u, i] = f(!1), e = a(null), s = (t) => {
7
+ const r = t.scrollHeight > t.clientHeight;
8
+ i(r);
9
+ };
10
+ return v(() => {
11
+ const t = (n) => {
12
+ e.current && clearTimeout(e.current), e.current = setTimeout(() => {
13
+ if (n.length >= 1 && n[0]) {
14
+ const l = n[0].target;
15
+ s(l);
16
+ }
17
+ }, o);
18
+ }, r = new ResizeObserver(t);
19
+ return c.current && (s(c.current), r.observe(c.current)), () => {
20
+ r.disconnect(), e.current && clearTimeout(e.current);
21
+ };
22
+ }, [o]), u;
23
+ };
24
+ export {
25
+ w as default,
26
+ w as useOverflowDetection
27
+ };
28
+ //# sourceMappingURL=useOverflowDetection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useOverflowDetection.js","sources":["../../../src/hooks/useOverflowDetection/useOverflowDetection.ts"],"sourcesContent":["import { useState, useEffect, useRef } from 'react'\nimport type React from 'react'\n\nexport type UseOverflowDetectionProps = {\n ref: React.RefObject<HTMLElement | null>\n debounceTimeout?: number\n}\n\nconst DEBOUNCE_TIMEOUT = 10\n\nexport const useOverflowDetection = ({\n ref,\n debounceTimeout = DEBOUNCE_TIMEOUT,\n}: UseOverflowDetectionProps) => {\n const [isOverflowing, setIsOverflowing] = useState(false)\n const timeoutRef = useRef<NodeJS.Timeout | null>(null)\n\n const checkOverflow = (element: HTMLElement) => {\n const hasOverflow = element.scrollHeight > element.clientHeight\n setIsOverflowing(hasOverflow)\n }\n\n useEffect(() => {\n const debouncedHandleResize = (entries: ResizeObserverEntry[]) => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current)\n }\n timeoutRef.current = setTimeout(() => {\n if (entries.length >= 1 && entries[0]) {\n const element = entries[0].target as HTMLElement\n checkOverflow(element)\n }\n }, debounceTimeout)\n }\n\n const observer = new ResizeObserver(debouncedHandleResize)\n\n if (ref.current) {\n checkOverflow(ref.current)\n observer.observe(ref.current)\n }\n\n return () => {\n observer.disconnect()\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current)\n }\n }\n }, [debounceTimeout])\n\n return isOverflowing\n}\n\nexport default useOverflowDetection\n"],"names":["DEBOUNCE_TIMEOUT","useOverflowDetection","ref","debounceTimeout","isOverflowing","setIsOverflowing","useState","timeoutRef","useRef","checkOverflow","element","hasOverflow","useEffect","debouncedHandleResize","entries","observer"],"mappings":";AAQA,MAAMA,IAAmB,IAEZC,IAAuB,CAAC;AAAA,EACnC,KAAAC;AAAA,EACA,iBAAAC,IAAkBH;AACpB,MAAiC;AAC/B,QAAM,CAACI,GAAeC,CAAgB,IAAIC,EAAS,EAAK,GAClDC,IAAaC,EAA8B,IAAI,GAE/CC,IAAgB,CAACC,MAAyB;AAC9C,UAAMC,IAAcD,EAAQ,eAAeA,EAAQ;AACnD,IAAAL,EAAiBM,CAAW;AAAA,EAC9B;AAEA,SAAAC,EAAU,MAAM;AACd,UAAMC,IAAwB,CAACC,MAAmC;AAChE,MAAIP,EAAW,WACb,aAAaA,EAAW,OAAO,GAEjCA,EAAW,UAAU,WAAW,MAAM;AACpC,YAAIO,EAAQ,UAAU,KAAKA,EAAQ,CAAC,GAAG;AACrC,gBAAMJ,IAAUI,EAAQ,CAAC,EAAE;AAC3B,UAAAL,EAAcC,CAAO;AAAA,QACvB;AAAA,MACF,GAAGP,CAAe;AAAA,IACpB,GAEMY,IAAW,IAAI,eAAeF,CAAqB;AAEzD,WAAIX,EAAI,YACNO,EAAcP,EAAI,OAAO,GACzBa,EAAS,QAAQb,EAAI,OAAO,IAGvB,MAAM;AACX,MAAAa,EAAS,WAAA,GACLR,EAAW,WACb,aAAaA,EAAW,OAAO;AAAA,IAEnC;AAAA,EACF,GAAG,CAACJ,CAAe,CAAC,GAEbC;AACT;"}