@envisiongroup/porygon 1.0.0-rc.4 → 1.0.0-rc.41

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 (251) hide show
  1. package/README.md +3 -3
  2. package/dist/index.d.ts +9 -15
  3. package/dist/index.js +95 -55
  4. package/dist/react-components/buttons/EFWButton/EFWButton.d.ts +1 -1
  5. package/dist/react-components/buttons/EFWButton/EFWButton.hooks.js +32 -31
  6. package/dist/react-components/buttons/EFWButton/EFWButton.js +158 -90
  7. package/dist/react-components/buttons/EFWButton/EFWButton.types.d.ts +32 -6
  8. package/dist/react-components/buttons/EFWButton/index.d.ts +1 -1
  9. package/dist/react-components/buttons/EFWDrawerButton/EFWDrawerButton.d.ts +1 -1
  10. package/dist/react-components/buttons/EFWDrawerButton/EFWDrawerButton.types.d.ts +1 -1
  11. package/dist/react-components/buttons/EFWGroupButton/EFWGroupButton.d.ts +1 -1
  12. package/dist/react-components/buttons/EFWGroupButton/EFWGroupButton.js +69 -62
  13. package/dist/react-components/buttons/EFWGroupButton/EFWGroupButton.types.d.ts +7 -1
  14. package/dist/react-components/buttons/EFWGroupButton/index.d.ts +1 -1
  15. package/dist/react-components/commons/utils.d.ts +1 -1
  16. package/dist/react-components/commons/utils.js +1 -1
  17. package/dist/react-components/commons/valueNormalization.d.ts +17 -0
  18. package/dist/react-components/commons/valueNormalization.js +7 -0
  19. package/dist/react-components/fields/Attachments/EFWAttachments.js +175 -0
  20. package/dist/react-components/fields/{EFWAttachments → Attachments}/EFWAttachments.types.d.ts +32 -2
  21. package/dist/react-components/fields/Attachments/EFWAttachments.utils.d.ts +8 -0
  22. package/dist/react-components/fields/Attachments/EFWAttachments.utils.js +4 -0
  23. package/dist/react-components/fields/{EFWAttachments/EFWAttachmentsCard → Attachments}/EFWAttachmentsCard.d.ts +2 -11
  24. package/dist/react-components/fields/Attachments/EFWAttachmentsCard.js +110 -0
  25. package/dist/react-components/fields/{EFWAttachments/EFWAttachmentsCard → Attachments}/EFWAttachmentsCard.types.d.ts +21 -1
  26. package/dist/react-components/fields/Attachments/EFWAttachmentsField.js +70 -0
  27. package/dist/react-components/fields/{EFWAttachmentsField → Attachments}/EFWAttachmentsField.types.d.ts +2 -2
  28. package/dist/react-components/fields/Attachments/index.d.ts +5 -0
  29. package/dist/react-components/fields/Attachments/index.js +8 -0
  30. package/dist/react-components/fields/{EFWDatePicker → DatePicker}/EFWDatePicker.d.ts +1 -3
  31. package/dist/react-components/fields/DatePicker/EFWDatePicker.js +134 -0
  32. package/dist/react-components/fields/{EFWDatePicker → DatePicker}/EFWDatePicker.types.d.ts +19 -7
  33. package/dist/react-components/fields/DatePicker/EFWDatePicker.utils.d.ts +19 -0
  34. package/dist/react-components/fields/DatePicker/EFWDatePicker.utils.js +179 -0
  35. package/dist/react-components/fields/DatePicker/EFWDatePickerField.js +251 -0
  36. package/dist/react-components/fields/DatePicker/EFWDatePickerField.types.d.ts +15 -0
  37. package/dist/react-components/fields/DatePicker/index.d.ts +6 -0
  38. package/dist/react-components/fields/DatePicker/index.js +11 -0
  39. package/dist/react-components/fields/{EFWInput → Input}/EFWInput.d.ts +0 -1
  40. package/dist/react-components/fields/Input/EFWInput.js +199 -0
  41. package/dist/react-components/fields/{EFWInput → Input}/EFWInput.types.d.ts +66 -16
  42. package/dist/react-components/fields/{EFWInput → Input}/EFWInput.utils.d.ts +13 -3
  43. package/dist/react-components/fields/Input/EFWInput.utils.js +93 -0
  44. package/dist/react-components/fields/Input/EFWInputField.js +84 -0
  45. package/dist/react-components/fields/{EFWInputField → Input}/EFWInputField.types.d.ts +2 -2
  46. package/dist/react-components/fields/Input/index.d.ts +5 -0
  47. package/dist/react-components/fields/Input/index.js +8 -0
  48. package/dist/react-components/fields/NumberInput/EFWNumberInput.js +231 -0
  49. package/dist/react-components/fields/{EFWNumberInput → NumberInput}/EFWNumberInput.types.d.ts +33 -14
  50. package/dist/react-components/fields/{EFWNumberInput → NumberInput}/EFWNumberInput.utils.d.ts +10 -14
  51. package/dist/react-components/fields/{EFWNumberInput → NumberInput}/EFWNumberInput.utils.js +30 -27
  52. package/dist/react-components/fields/NumberInput/EFWNumberInputField.js +84 -0
  53. package/dist/react-components/fields/{EFWNumberInputField → NumberInput}/EFWNumberInputField.types.d.ts +2 -2
  54. package/dist/react-components/fields/NumberInput/index.d.ts +5 -0
  55. package/dist/react-components/fields/NumberInput/index.js +8 -0
  56. package/dist/react-components/fields/Switch/EFWSwitch.js +75 -0
  57. package/dist/react-components/fields/{EFWSwitch → Switch}/EFWSwitch.types.d.ts +18 -10
  58. package/dist/react-components/fields/Switch/EFWSwitch.utils.d.ts +9 -0
  59. package/dist/react-components/fields/Switch/EFWSwitch.utils.js +4 -0
  60. package/dist/react-components/fields/Switch/EFWSwitchField.js +62 -0
  61. package/dist/react-components/fields/{EFWSwitchField → Switch}/EFWSwitchField.types.d.ts +6 -2
  62. package/dist/react-components/fields/Switch/index.d.ts +5 -0
  63. package/dist/react-components/fields/Switch/index.js +8 -0
  64. package/dist/react-components/fields/TagPicker/EFWTagPicker.js +329 -0
  65. package/dist/react-components/fields/{EFWTagPicker → TagPicker}/EFWTagPicker.types.d.ts +30 -17
  66. package/dist/react-components/fields/TagPicker/EFWTagPicker.utils.d.ts +6 -0
  67. package/dist/react-components/fields/TagPicker/EFWTagPicker.utils.js +4 -0
  68. package/dist/react-components/fields/TagPicker/EFWTagPickerField.js +83 -0
  69. package/dist/react-components/fields/{EFWTagPickerField → TagPicker}/EFWTagPickerField.types.d.ts +2 -2
  70. package/dist/react-components/fields/TagPicker/index.d.ts +5 -0
  71. package/dist/react-components/fields/TagPicker/index.js +8 -0
  72. package/dist/react-components/fields/TextArea/EFWTextArea.js +153 -0
  73. package/dist/react-components/fields/{EFWTextArea → TextArea}/EFWTextArea.types.d.ts +26 -8
  74. package/dist/react-components/fields/TextArea/EFWTextArea.utils.d.ts +6 -0
  75. package/dist/react-components/fields/TextArea/EFWTextArea.utils.js +4 -0
  76. package/dist/react-components/fields/TextArea/EFWTextAreaField.js +80 -0
  77. package/dist/react-components/fields/{EFWTextAreaField → TextArea}/EFWTextAreaField.types.d.ts +2 -2
  78. package/dist/react-components/fields/TextArea/index.d.ts +5 -0
  79. package/dist/react-components/fields/TextArea/index.js +8 -0
  80. package/dist/react-components/fields/_shared/EFWField/EFWField.js +115 -0
  81. package/dist/react-components/fields/{EFWField → _shared/EFWField}/EFWField.types.d.ts +24 -13
  82. package/dist/react-components/fields/_shared/EFWField/EFWField.utils.js +20 -0
  83. package/dist/react-components/forms/EFWForm/EFWForm.converter.d.ts +16 -1
  84. package/dist/react-components/forms/EFWForm/EFWForm.converter.js +38 -16
  85. package/dist/react-components/forms/EFWForm/EFWForm.d.ts +1 -1
  86. package/dist/react-components/forms/EFWForm/EFWForm.flatConverter.d.ts +130 -0
  87. package/dist/react-components/forms/EFWForm/EFWForm.flatConverter.js +279 -0
  88. package/dist/react-components/forms/EFWForm/EFWForm.hooks.js +21 -18
  89. package/dist/react-components/forms/EFWForm/EFWForm.js +531 -309
  90. package/dist/react-components/forms/EFWForm/EFWForm.types.d.ts +172 -42
  91. package/dist/react-components/forms/EFWForm/EFWForm.utils.d.ts +6 -4
  92. package/dist/react-components/forms/EFWForm/EFWForm.utils.js +308 -229
  93. package/dist/react-components/forms/EFWForm/index.d.ts +5 -2
  94. package/dist/react-components/forms/EFWForm/index.js +10 -6
  95. package/dist/react-components/forms/EFWFormMessageBarGroup/EFWFormMessageBarGroup.js +36 -38
  96. package/dist/react-components/hooks/useDrawer/component/EFWDrawer/EFWDrawer.js +49 -47
  97. package/dist/react-components/hooks/useDrawer/component/EFWDrawer/EFWDrawer.types.d.ts +1 -0
  98. package/dist/react-components/hooks/useDrawer/component/EFWDrawerLoader/EFWDrawerLoader.d.ts +5 -3
  99. package/dist/react-components/hooks/useDrawer/component/EFWDrawerLoader/EFWDrawerLoader.js +6 -6
  100. package/dist/react-components/hooks/useDrawer/index.d.ts +1 -1
  101. package/dist/react-components/hooks/useDrawer/useDrawer.d.ts +4 -2
  102. package/dist/react-components/hooks/useDrawer/useDrawer.js +216 -111
  103. package/dist/react-components/hooks/useDrawer/useDrawer.types.d.ts +15 -2
  104. package/dist/react-components/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts +42 -0
  105. package/dist/react-components/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +5 -0
  106. package/dist/react-components/i18n/PorygonI18nProvider.d.ts +13 -0
  107. package/dist/react-components/i18n/PorygonI18nProvider.js +145 -0
  108. package/dist/react-components/i18n/defaultLocaleText.d.ts +6 -0
  109. package/dist/react-components/i18n/defaultLocaleText.js +176 -0
  110. package/dist/react-components/i18n/index.d.ts +4 -0
  111. package/dist/react-components/i18n/index.js +19 -0
  112. package/dist/react-components/i18n/localePresets.d.ts +10 -0
  113. package/dist/react-components/i18n/localePresets.js +362 -0
  114. package/dist/react-components/i18n/porygonI18n.types.d.ts +168 -0
  115. package/dist/react-components/layout/MainNavItems/MainNavItems.js +13 -13
  116. package/dist/react-components/tables/EFWTable/EFWTable.d.ts +3 -5
  117. package/dist/react-components/tables/EFWTable/EFWTable.js +955 -530
  118. package/dist/react-components/tables/EFWTable/EFWTable.types.d.ts +344 -86
  119. package/dist/react-components/tables/EFWTable/components/EFWTableBody/EFWTableBody.d.ts +5 -1
  120. package/dist/react-components/tables/EFWTable/components/EFWTableBody/EFWTableBody.js +97 -52
  121. package/dist/react-components/tables/EFWTable/components/EFWTableBody/EFWTableBody.types.d.ts +6 -2
  122. package/dist/react-components/tables/EFWTable/components/EFWTableCell/EFWTableCell.d.ts +6 -13
  123. package/dist/react-components/tables/EFWTable/components/EFWTableCell/EFWTableCell.js +36 -25
  124. package/dist/react-components/tables/EFWTable/components/EFWTableCell/EFWTableCell.types.d.ts +13 -0
  125. package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/EFWTableCommandBar.d.ts +4 -2
  126. package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/EFWTableCommandBar.js +90 -65
  127. package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/EFWTableCommandBar.types.d.ts +23 -32
  128. package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/EFWTableCommandBar.utils.d.ts +3 -3
  129. package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/index.d.ts +1 -1
  130. package/dist/react-components/tables/EFWTable/components/EFWTableHeader/EFWTableHeader.d.ts +1 -1
  131. package/dist/react-components/tables/EFWTable/components/EFWTableHeader/EFWTableHeader.js +170 -83
  132. package/dist/react-components/tables/EFWTable/components/EFWTableHeader/EFWTableHeader.types.d.ts +3 -0
  133. package/dist/react-components/tables/EFWTable/components/EFWTableOverlay/EFWTableOverlay.js +90 -88
  134. package/dist/react-components/tables/EFWTable/components/EFWTableOverlay/EFWTableOverlay.types.d.ts +54 -0
  135. package/dist/react-components/tables/EFWTable/components/EFWTableOverlay/index.d.ts +1 -1
  136. package/dist/react-components/tables/EFWTable/components/EFWTableRow/EFWTableRow.d.ts +7 -19
  137. package/dist/react-components/tables/EFWTable/components/EFWTableRow/EFWTableRow.js +83 -45
  138. package/dist/react-components/tables/EFWTable/components/EFWTableRow/EFWTableRow.types.d.ts +23 -0
  139. package/dist/react-components/tables/EFWTable/hooks/useDefaultAddButton/useDefaultAddButton.d.ts +3 -1
  140. package/dist/react-components/tables/EFWTable/hooks/useDefaultAddButton/useDefaultAddButton.js +67 -50
  141. package/dist/react-components/tables/EFWTable/hooks/useDefaultDeleteButton/useDefaultDeleteButton.d.ts +3 -1
  142. package/dist/react-components/tables/EFWTable/hooks/useDefaultDeleteButton/useDefaultDeleteButton.js +72 -49
  143. package/dist/react-components/tables/EFWTable/hooks/useDefaultFilterButton/useDefaultFilterButton.d.ts +17 -0
  144. package/dist/react-components/tables/EFWTable/hooks/useDefaultFilterButton/useDefaultFilterButton.js +255 -0
  145. package/dist/react-components/tables/EFWTable/hooks/useDefaultUpdateButton/useDefaultUpdateButton.d.ts +3 -1
  146. package/dist/react-components/tables/EFWTable/hooks/useDefaultUpdateButton/useDefaultUpdateButton.js +70 -49
  147. package/dist/react-components/tables/EFWTable/hooks/useStableColumnRenderers/useStableColumnRenderers.d.ts +10 -0
  148. package/dist/react-components/tables/EFWTable/hooks/useStableColumnRenderers/useStableColumnRenderers.js +28 -0
  149. package/dist/react-components/tables/EFWTable/hooks/useTableController/useTableController.d.ts +1 -1
  150. package/dist/react-components/tables/EFWTable/hooks/useTableController/useTableController.js +156 -117
  151. package/dist/react-components/tables/EFWTable/hooks/useTableController/useTableController.types.d.ts +3 -3
  152. package/dist/react-components/tables/EFWTable/hooks/useTableSelection/useTableSelection.d.ts +2 -1
  153. package/dist/react-components/tables/EFWTable/hooks/useTableSelection/useTableSelection.js +100 -53
  154. package/dist/react-components/tables/EFWTable/hooks/useTableSelection/useTableSelection.types.d.ts +10 -6
  155. package/dist/react-components/tables/EFWTable/index.d.ts +5 -2
  156. package/dist/react-components/tables/EFWTable/index.js +7 -5
  157. package/dist/react-components/tables/EFWTable/utils/CellRenderer/CellRenderer.js +26 -23
  158. package/dist/react-components/tables/EFWTable/utils/cache.d.ts +1 -8
  159. package/dist/react-components/tables/EFWTable/utils/cache.js +40 -49
  160. package/dist/react-components/tables/EFWTable/utils/filterFunctions.d.ts +16 -0
  161. package/dist/react-components/tables/EFWTable/utils/filterFunctions.js +52 -0
  162. package/dist/react-components/tables/EFWTable/utils/hashing.d.ts +2 -2
  163. package/dist/react-components/tables/EFWTable/utils/hashing.js +2 -2
  164. package/dist/react-components/tables/EFWTable/utils/index.d.ts +1 -0
  165. package/dist/react-components/tables/EFWTable/utils/index.js +13 -10
  166. package/dist/react-components/tables/EFWTable/utils/typeHelpers.d.ts +24 -0
  167. package/dist/react-components/tables/EFWTable/utils/typeHelpers.js +11 -0
  168. package/package.json +27 -19
  169. package/dist/react-components/fields/EFWAttachments/EFWAttachments.js +0 -125
  170. package/dist/react-components/fields/EFWAttachments/EFWAttachmentsCard/EFWAttachmentsCard.js +0 -107
  171. package/dist/react-components/fields/EFWAttachments/EFWAttachmentsCard/index.d.ts +0 -1
  172. package/dist/react-components/fields/EFWAttachments/EFWAttachmentsCard/index.js +0 -0
  173. package/dist/react-components/fields/EFWAttachments/index.d.ts +0 -2
  174. package/dist/react-components/fields/EFWAttachments/index.js +0 -4
  175. package/dist/react-components/fields/EFWAttachmentsField/EFWAttachmentsField.js +0 -57
  176. package/dist/react-components/fields/EFWAttachmentsField/index.d.ts +0 -2
  177. package/dist/react-components/fields/EFWAttachmentsField/index.js +0 -4
  178. package/dist/react-components/fields/EFWDatePicker/EFWDatePicker.js +0 -114
  179. package/dist/react-components/fields/EFWDatePicker/EFWDatePicker.utils.d.ts +0 -24
  180. package/dist/react-components/fields/EFWDatePicker/EFWDatePicker.utils.js +0 -90
  181. package/dist/react-components/fields/EFWDatePicker/index.d.ts +0 -2
  182. package/dist/react-components/fields/EFWDatePicker/index.js +0 -4
  183. package/dist/react-components/fields/EFWDatePickerField/EFWDatePickerField.js +0 -65
  184. package/dist/react-components/fields/EFWDatePickerField/EFWDatePickerField.types.d.ts +0 -7
  185. package/dist/react-components/fields/EFWDatePickerField/index.d.ts +0 -2
  186. package/dist/react-components/fields/EFWDatePickerField/index.js +0 -4
  187. package/dist/react-components/fields/EFWField/EFWField.js +0 -96
  188. package/dist/react-components/fields/EFWField/EFWField.utils.js +0 -17
  189. package/dist/react-components/fields/EFWInput/EFWInput.js +0 -119
  190. package/dist/react-components/fields/EFWInput/EFWInput.utils.js +0 -83
  191. package/dist/react-components/fields/EFWInput/index.d.ts +0 -2
  192. package/dist/react-components/fields/EFWInput/index.js +0 -4
  193. package/dist/react-components/fields/EFWInputField/EFWInputField.js +0 -73
  194. package/dist/react-components/fields/EFWInputField/EFWInputField.utils.d.ts +0 -1
  195. package/dist/react-components/fields/EFWInputField/EFWInputField.utils.js +0 -0
  196. package/dist/react-components/fields/EFWInputField/index.d.ts +0 -2
  197. package/dist/react-components/fields/EFWInputField/index.js +0 -4
  198. package/dist/react-components/fields/EFWNumberInput/EFWNumberInput.js +0 -198
  199. package/dist/react-components/fields/EFWNumberInput/index.d.ts +0 -2
  200. package/dist/react-components/fields/EFWNumberInput/index.js +0 -4
  201. package/dist/react-components/fields/EFWNumberInputField/EFWNumberInputField.js +0 -67
  202. package/dist/react-components/fields/EFWNumberInputField/EFWNumberInputField.utils.d.ts +0 -1
  203. package/dist/react-components/fields/EFWNumberInputField/EFWNumberInputField.utils.js +0 -0
  204. package/dist/react-components/fields/EFWNumberInputField/index.d.ts +0 -2
  205. package/dist/react-components/fields/EFWNumberInputField/index.js +0 -4
  206. package/dist/react-components/fields/EFWSwitch/EFWSwitch.js +0 -55
  207. package/dist/react-components/fields/EFWSwitch/index.d.ts +0 -2
  208. package/dist/react-components/fields/EFWSwitch/index.js +0 -4
  209. package/dist/react-components/fields/EFWSwitchField/EFWSwitchField.js +0 -55
  210. package/dist/react-components/fields/EFWSwitchField/index.d.ts +0 -2
  211. package/dist/react-components/fields/EFWSwitchField/index.js +0 -4
  212. package/dist/react-components/fields/EFWTagPicker/EFWTagPicker.js +0 -244
  213. package/dist/react-components/fields/EFWTagPicker/index.d.ts +0 -2
  214. package/dist/react-components/fields/EFWTagPicker/index.js +0 -4
  215. package/dist/react-components/fields/EFWTagPickerField/EFWTagPickerField.js +0 -74
  216. package/dist/react-components/fields/EFWTagPickerField/EFWTagPickerField.utils.d.ts +0 -1
  217. package/dist/react-components/fields/EFWTagPickerField/EFWTagPickerField.utils.js +0 -0
  218. package/dist/react-components/fields/EFWTagPickerField/index.d.ts +0 -2
  219. package/dist/react-components/fields/EFWTagPickerField/index.js +0 -4
  220. package/dist/react-components/fields/EFWTextArea/EFWTextArea.js +0 -105
  221. package/dist/react-components/fields/EFWTextArea/EFWTextArea.utils.d.ts +0 -1
  222. package/dist/react-components/fields/EFWTextArea/EFWTextArea.utils.js +0 -0
  223. package/dist/react-components/fields/EFWTextArea/index.d.ts +0 -2
  224. package/dist/react-components/fields/EFWTextArea/index.js +0 -4
  225. package/dist/react-components/fields/EFWTextAreaField/EFWTextAreaField.js +0 -71
  226. package/dist/react-components/fields/EFWTextAreaField/EFWTextAreaField.utils.d.ts +0 -1
  227. package/dist/react-components/fields/EFWTextAreaField/EFWTextAreaField.utils.js +0 -0
  228. package/dist/react-components/fields/EFWTextAreaField/index.d.ts +0 -2
  229. package/dist/react-components/fields/EFWTextAreaField/index.js +0 -4
  230. package/dist/react-components/fields/types.d.ts +0 -1
  231. package/dist/react-components/fields/types.js +0 -0
  232. package/dist/react-components/tables/EFWTable/hooks/useTableController/useTableController.types copy.d.ts +0 -16
  233. package/dist/react-components/tables/EFWTable/hooks/useTableController/useTableController.types copy.js +0 -0
  234. package/dist/utils/htmlConverter.d.ts +0 -15
  235. package/dist/utils/htmlConverter.js +0 -12
  236. /package/dist/react-components/fields/{EFWAttachments → Attachments}/EFWAttachments.d.ts +0 -0
  237. /package/dist/react-components/fields/{EFWAttachmentsField → Attachments}/EFWAttachmentsField.d.ts +0 -0
  238. /package/dist/react-components/fields/{EFWDatePickerField → DatePicker}/EFWDatePickerField.d.ts +0 -0
  239. /package/dist/react-components/fields/{EFWInputField → Input}/EFWInputField.d.ts +0 -0
  240. /package/dist/react-components/fields/{EFWNumberInput → NumberInput}/EFWNumberInput.d.ts +0 -0
  241. /package/dist/react-components/fields/{EFWNumberInputField → NumberInput}/EFWNumberInputField.d.ts +0 -0
  242. /package/dist/react-components/fields/{EFWSwitch → Switch}/EFWSwitch.d.ts +0 -0
  243. /package/dist/react-components/fields/{EFWSwitchField → Switch}/EFWSwitchField.d.ts +0 -0
  244. /package/dist/react-components/fields/{EFWTagPicker → TagPicker}/EFWTagPicker.d.ts +0 -0
  245. /package/dist/react-components/fields/{EFWTagPickerField → TagPicker}/EFWTagPickerField.d.ts +0 -0
  246. /package/dist/react-components/fields/{EFWTextArea → TextArea}/EFWTextArea.d.ts +0 -0
  247. /package/dist/react-components/fields/{EFWTextAreaField → TextArea}/EFWTextAreaField.d.ts +0 -0
  248. /package/dist/react-components/fields/{EFWField → _shared/EFWField}/EFWField.d.ts +0 -0
  249. /package/dist/react-components/fields/{EFWField → _shared/EFWField}/EFWField.utils.d.ts +0 -0
  250. /package/dist/react-components/fields/{EFWField → _shared/EFWField}/index.d.ts +0 -0
  251. /package/dist/react-components/fields/{EFWField → _shared/EFWField}/index.js +0 -0
package/README.md CHANGED
@@ -10,10 +10,10 @@ Estos componentes cumplen con los siguientes criterios:
10
10
 
11
11
  ## Instalación
12
12
 
13
- Porygon es compatible con **React 17**, **18** y **19**. Instala el paquete con npm:
13
+ Porygon es compatible con **React 17**, **18** y **19**. Instala el paquete con pnpm:
14
14
 
15
15
  ```bash
16
- npm install @grupoenvision/porygon
16
+ pnpm add @grupoenvision/porygon
17
17
  ```
18
18
 
19
19
  ## Configuración inicial
@@ -66,4 +66,4 @@ root.render(
66
66
  <App />
67
67
  </FluentProvider>
68
68
  );
69
- ```
69
+ ```
package/dist/index.d.ts CHANGED
@@ -2,23 +2,17 @@ export * from './react-components/buttons/EFWButton';
2
2
  export * from './react-components/buttons/EFWDrawerButton';
3
3
  export * from './react-components/buttons/EFWGroupButton';
4
4
  export * from './react-components/commons/utils';
5
- export * from './react-components/fields/EFWAttachments';
6
- export * from './react-components/fields/EFWAttachmentsField';
7
- export * from './react-components/fields/EFWDatePicker';
8
- export * from './react-components/fields/EFWDatePickerField';
9
- export * from './react-components/fields/EFWField';
10
- export * from './react-components/fields/EFWInput';
11
- export * from './react-components/fields/EFWInputField';
12
- export * from './react-components/fields/EFWNumberInput';
13
- export * from './react-components/fields/EFWNumberInputField';
14
- export * from './react-components/fields/EFWSwitch';
15
- export * from './react-components/fields/EFWSwitchField';
16
- export * from './react-components/fields/EFWTagPicker';
17
- export * from './react-components/fields/EFWTagPickerField';
18
- export * from './react-components/fields/EFWTextArea';
19
- export * from './react-components/fields/EFWTextAreaField';
5
+ export * from './react-components/fields/_shared/EFWField';
6
+ export * from './react-components/fields/Attachments';
7
+ export * from './react-components/fields/DatePicker';
8
+ export * from './react-components/fields/Input';
9
+ export * from './react-components/fields/NumberInput';
10
+ export * from './react-components/fields/Switch';
11
+ export * from './react-components/fields/TagPicker';
12
+ export * from './react-components/fields/TextArea';
20
13
  export * from './react-components/forms/EFWForm';
21
14
  export * from './react-components/forms/EFWFormMessageBarGroup';
22
15
  export * from './react-components/forms/EFWMessageBarManager/EFWMessageBarManager';
23
16
  export * from './react-components/hooks/useDrawer';
17
+ export * from './react-components/i18n';
24
18
  export * from './react-components/tables/EFWTable';
package/dist/index.js CHANGED
@@ -1,63 +1,103 @@
1
1
  import { formatFileSize as o, getErrorMessage as t, getFileIconUrl as F } from "./react-components/commons/utils.js";
2
- import { EFWMessageBarManager as p } from "./react-components/forms/EFWMessageBarManager/EFWMessageBarManager.js";
3
- import { EFWButton as f } from "./react-components/buttons/EFWButton/EFWButton.js";
4
- import { useEFWButton as W } from "./react-components/buttons/EFWButton/EFWButton.hooks.js";
5
- import { EFWDrawerButton as l } from "./react-components/buttons/EFWDrawerButton/EFWDrawerButton.js";
6
- import { EFWGroupButton as u } from "./react-components/buttons/EFWGroupButton/EFWGroupButton.js";
7
- import { EFWAttachment as s } from "./react-components/fields/EFWAttachments/EFWAttachments.js";
8
- import { EFWAttachmentsField as d } from "./react-components/fields/EFWAttachmentsField/EFWAttachmentsField.js";
9
- import { EFWDatePicker as T } from "./react-components/fields/EFWDatePicker/EFWDatePicker.js";
10
- import { EFWDatePickerField as B } from "./react-components/fields/EFWDatePickerField/EFWDatePickerField.js";
11
- import { EFWField as I } from "./react-components/fields/EFWField/EFWField.js";
12
- import { EFWInput as k } from "./react-components/fields/EFWInput/EFWInput.js";
13
- import { EFWInputField as A } from "./react-components/fields/EFWInputField/EFWInputField.js";
14
- import { EFWNumberInput as P } from "./react-components/fields/EFWNumberInput/EFWNumberInput.js";
15
- import { EFWNumberInputField as S } from "./react-components/fields/EFWNumberInputField/EFWNumberInputField.js";
16
- import { EFWSwitch as G } from "./react-components/fields/EFWSwitch/EFWSwitch.js";
17
- import { EFWSwitchField as v } from "./react-components/fields/EFWSwitchField/EFWSwitchField.js";
18
- import { EFWTagPicker as O } from "./react-components/fields/EFWTagPicker/EFWTagPicker.js";
19
- import { EFWTagPickerField as j } from "./react-components/fields/EFWTagPickerField/EFWTagPickerField.js";
20
- import { EFWTextArea as H } from "./react-components/fields/EFWTextArea/EFWTextArea.js";
21
- import { EFWTextAreaField as K } from "./react-components/fields/EFWTextAreaField/EFWTextAreaField.js";
22
- import { getEFWFormFieldDisplayText as Q } from "./react-components/forms/EFWForm/EFWForm.converter.js";
23
- import { useFormController as V } from "./react-components/forms/EFWForm/EFWForm.hooks.js";
24
- import { EFWForm as Y } from "./react-components/forms/EFWForm/EFWForm.js";
25
- import { EFWFormMessageBarGroup as _ } from "./react-components/forms/EFWFormMessageBarGroup/EFWFormMessageBarGroup.js";
26
- import { useDrawer as rr } from "./react-components/hooks/useDrawer/useDrawer.js";
27
- import { EFWTable as or } from "./react-components/tables/EFWTable/EFWTable.js";
28
- import { useTableController as Fr } from "./react-components/tables/EFWTable/hooks/useTableController/useTableController.js";
29
- import { EFWTableEmpty as pr, EFWTableOverlay as xr } from "./react-components/tables/EFWTable/components/EFWTableOverlay/EFWTableOverlay.js";
2
+ import { EFWMessageBarManager as a } from "./react-components/forms/EFWMessageBarManager/EFWMessageBarManager.js";
3
+ import { EFWButton as p } from "./react-components/buttons/EFWButton/EFWButton.js";
4
+ import { useEFWButton as l } from "./react-components/buttons/EFWButton/EFWButton.hooks.js";
5
+ import { EFWDrawerButton as u } from "./react-components/buttons/EFWDrawerButton/EFWDrawerButton.js";
6
+ import { EFWGroupButton as i } from "./react-components/buttons/EFWGroupButton/EFWGroupButton.js";
7
+ import { EFWField as L } from "./react-components/fields/_shared/EFWField/EFWField.js";
8
+ import { EFWAttachment as s } from "./react-components/fields/Attachments/EFWAttachments.js";
9
+ import { getAttachmentsFormattedValue as g } from "./react-components/fields/Attachments/EFWAttachments.utils.js";
10
+ import { EFWAttachmentsField as d } from "./react-components/fields/Attachments/EFWAttachmentsField.js";
11
+ import { EFWDatePicker as O } from "./react-components/fields/DatePicker/EFWDatePicker.js";
12
+ import { enLocalizedStrings as D, esLocalizedStrings as B, getDatePickerFormattedValue as C, ptLocalizedStrings as S } from "./react-components/fields/DatePicker/EFWDatePicker.utils.js";
13
+ import { EFWDatePickerField as N } from "./react-components/fields/DatePicker/EFWDatePickerField.js";
14
+ import { EFWInput as b } from "./react-components/fields/Input/EFWInput.js";
15
+ import { getInputFormattedValue as k } from "./react-components/fields/Input/EFWInput.utils.js";
16
+ import { EFWInputField as R } from "./react-components/fields/Input/EFWInputField.js";
17
+ import { EFWNumberInput as w } from "./react-components/fields/NumberInput/EFWNumberInput.js";
18
+ import { getNumberInputFormattedValue as M } from "./react-components/fields/NumberInput/EFWNumberInput.utils.js";
19
+ import { EFWNumberInputField as X } from "./react-components/fields/NumberInput/EFWNumberInputField.js";
20
+ import { EFWSwitch as v } from "./react-components/fields/Switch/EFWSwitch.js";
21
+ import { getSwitchFormattedValue as q } from "./react-components/fields/Switch/EFWSwitch.utils.js";
22
+ import { EFWSwitchField as J } from "./react-components/fields/Switch/EFWSwitchField.js";
23
+ import { EFWTagPicker as Q } from "./react-components/fields/TagPicker/EFWTagPicker.js";
24
+ import { getTagPickerFormattedValue as $ } from "./react-components/fields/TagPicker/EFWTagPicker.utils.js";
25
+ import { EFWTagPickerField as re } from "./react-components/fields/TagPicker/EFWTagPickerField.js";
26
+ import { EFWTextArea as te } from "./react-components/fields/TextArea/EFWTextArea.js";
27
+ import { getTextAreaFormattedValue as me } from "./react-components/fields/TextArea/EFWTextArea.utils.js";
28
+ import { EFWTextAreaField as Ee } from "./react-components/fields/TextArea/EFWTextAreaField.js";
29
+ import { getFormFieldDisplayText as xe } from "./react-components/forms/EFWForm/EFWForm.converter.js";
30
+ import { useFormController as fe } from "./react-components/forms/EFWForm/EFWForm.hooks.js";
31
+ import { EFWForm as Te } from "./react-components/forms/EFWForm/EFWForm.js";
32
+ import { EFWConversionError as We, EFWValuesToFlat as Le, flatToEFWValues as ne } from "./react-components/forms/EFWForm/EFWForm.flatConverter.js";
33
+ import { EFWFormMessageBarGroup as _e } from "./react-components/forms/EFWFormMessageBarGroup/EFWFormMessageBarGroup.js";
34
+ import { useDrawer as ce } from "./react-components/hooks/useDrawer/useDrawer.js";
35
+ import { PorygonI18nProvider as Ae, useButtonsLocaleText as Oe, useFieldsLocaleText as Pe, useFormLocaleText as De, usePorygonLocaleText as Be, useTableLocaleText as Ce } from "./react-components/i18n/PorygonI18nProvider.js";
36
+ import { DEFAULT_EFW_BUTTONS_LOCALE_TEXT as Ie, DEFAULT_EFW_FIELDS_LOCALE_TEXT as Ne, DEFAULT_EFW_FORM_LOCALE_TEXT as Ve, DEFAULT_EFW_TABLE_LOCALE_TEXT as be } from "./react-components/i18n/defaultLocaleText.js";
37
+ import { PORYGON_LOCALES as ke, PORYGON_LOCALE_EN as Ge, PORYGON_LOCALE_ES as Re, PORYGON_LOCALE_PT_BR as Ue } from "./react-components/i18n/localePresets.js";
38
+ import { EFWTable as ye } from "./react-components/tables/EFWTable/EFWTable.js";
39
+ import { useTableController as ze } from "./react-components/tables/EFWTable/hooks/useTableController/useTableController.js";
40
+ import { useDefaultFilterButton as Ye } from "./react-components/tables/EFWTable/hooks/useDefaultFilterButton/useDefaultFilterButton.js";
41
+ import { EFWTableEmpty as je, EFWTableOverlay as qe } from "./react-components/tables/EFWTable/components/EFWTableOverlay/EFWTableOverlay.js";
30
42
  export {
43
+ Ie as DEFAULT_EFW_BUTTONS_LOCALE_TEXT,
44
+ Ne as DEFAULT_EFW_FIELDS_LOCALE_TEXT,
45
+ Ve as DEFAULT_EFW_FORM_LOCALE_TEXT,
46
+ be as DEFAULT_EFW_TABLE_LOCALE_TEXT,
31
47
  s as EFWAttachment,
32
48
  d as EFWAttachmentsField,
33
- f as EFWButton,
34
- T as EFWDatePicker,
35
- B as EFWDatePickerField,
36
- l as EFWDrawerButton,
37
- I as EFWField,
38
- Y as EFWForm,
39
- _ as EFWFormMessageBarGroup,
40
- u as EFWGroupButton,
41
- k as EFWInput,
42
- A as EFWInputField,
43
- p as EFWMessageBarManager,
44
- P as EFWNumberInput,
45
- S as EFWNumberInputField,
46
- G as EFWSwitch,
47
- v as EFWSwitchField,
48
- or as EFWTable,
49
- pr as EFWTableEmpty,
50
- xr as EFWTableOverlay,
51
- O as EFWTagPicker,
52
- j as EFWTagPickerField,
53
- H as EFWTextArea,
54
- K as EFWTextAreaField,
49
+ p as EFWButton,
50
+ We as EFWConversionError,
51
+ O as EFWDatePicker,
52
+ N as EFWDatePickerField,
53
+ u as EFWDrawerButton,
54
+ L as EFWField,
55
+ Te as EFWForm,
56
+ _e as EFWFormMessageBarGroup,
57
+ i as EFWGroupButton,
58
+ b as EFWInput,
59
+ R as EFWInputField,
60
+ a as EFWMessageBarManager,
61
+ w as EFWNumberInput,
62
+ X as EFWNumberInputField,
63
+ v as EFWSwitch,
64
+ J as EFWSwitchField,
65
+ ye as EFWTable,
66
+ je as EFWTableEmpty,
67
+ qe as EFWTableOverlay,
68
+ Q as EFWTagPicker,
69
+ re as EFWTagPickerField,
70
+ te as EFWTextArea,
71
+ Ee as EFWTextAreaField,
72
+ Le as EFWValuesToFlat,
73
+ ke as PORYGON_LOCALES,
74
+ Ge as PORYGON_LOCALE_EN,
75
+ Re as PORYGON_LOCALE_ES,
76
+ Ue as PORYGON_LOCALE_PT_BR,
77
+ Ae as PorygonI18nProvider,
78
+ D as enLocalizedStrings,
79
+ B as esLocalizedStrings,
80
+ ne as flatToEFWValues,
55
81
  o as formatFileSize,
56
- Q as getEFWFormFieldDisplayText,
82
+ g as getAttachmentsFormattedValue,
83
+ C as getDatePickerFormattedValue,
57
84
  t as getErrorMessage,
58
85
  F as getFileIconUrl,
59
- rr as useDrawer,
60
- W as useEFWButton,
61
- V as useFormController,
62
- Fr as useTableController
86
+ xe as getFormFieldDisplayText,
87
+ k as getInputFormattedValue,
88
+ M as getNumberInputFormattedValue,
89
+ q as getSwitchFormattedValue,
90
+ $ as getTagPickerFormattedValue,
91
+ me as getTextAreaFormattedValue,
92
+ S as ptLocalizedStrings,
93
+ Oe as useButtonsLocaleText,
94
+ Ye as useDefaultFilterButton,
95
+ ce as useDrawer,
96
+ l as useEFWButton,
97
+ Pe as useFieldsLocaleText,
98
+ fe as useFormController,
99
+ De as useFormLocaleText,
100
+ Be as usePorygonLocaleText,
101
+ ze as useTableController,
102
+ Ce as useTableLocaleText
63
103
  };
@@ -32,7 +32,7 @@ import * as React from "react";
32
32
  * return { success: false, error: error.message };
33
33
  * }
34
34
  * }}
35
- * loadingText="Procesando datos..."
35
+ * labels={{ loadingText: "Procesando datos..." }}
36
36
  * autoLoading={true}
37
37
  * successConfig={{
38
38
  * text: "¡Completado!",
@@ -1,61 +1,62 @@
1
1
  import * as t from "react";
2
- const w = (T = {}) => {
2
+ const y = (p = {}) => {
3
3
  const {
4
- onError: k,
5
- onSuccess: m,
4
+ onError: C,
5
+ onSuccess: E,
6
6
  successTimeout: i = 2e3,
7
7
  errorTimeout: f = 2e3,
8
- autoReset: a = !0
9
- } = T, [E, s] = t.useState("idle"), [p, l] = t.useState(null), c = t.useRef(null), r = t.useCallback(() => {
8
+ autoReset: u = !0,
9
+ fallbackErrorMessage: g = "Operation failed"
10
+ } = p, [m, o] = t.useState("idle"), [R, l] = t.useState(null), c = t.useRef(null), r = t.useCallback(() => {
10
11
  c.current && (clearTimeout(c.current), c.current = null);
11
12
  }, []), n = t.useCallback(() => {
12
- s("idle"), l(null), r();
13
+ o("idle"), l(null), r();
13
14
  }, [r]), b = t.useCallback(() => {
14
- s("loading"), l(null), r();
15
+ o("loading"), l(null), r();
15
16
  }, [r]), d = t.useCallback(() => {
16
- s((e) => e === "loading" ? "idle" : e), r();
17
- }, [r]), C = t.useCallback(() => {
18
- s("success"), l(null), m?.(), a && i > 0 && (r(), c.current = setTimeout(n, i));
19
- }, [m, a, i, n, r]), u = t.useCallback(
17
+ o((e) => e === "loading" ? "idle" : e), r();
18
+ }, [r]), k = t.useCallback(() => {
19
+ o("success"), l(null), E?.(), u && i > 0 && (r(), c.current = setTimeout(n, i));
20
+ }, [E, u, i, n, r]), a = t.useCallback(
20
21
  (e) => {
21
- l(e), s("error"), k?.(e), a && f > 0 && (r(), c.current = setTimeout(n, f));
22
+ l(e), o("error"), C?.(e), u && f > 0 && (r(), c.current = setTimeout(n, f));
22
23
  },
23
- [k, a, f, n, r]
24
+ [C, u, f, n, r]
24
25
  ), S = t.useCallback(
25
26
  (e) => {
26
27
  if (!e)
27
28
  d();
28
29
  else if (typeof e == "object")
29
30
  if (e.success)
30
- C();
31
+ k();
31
32
  else {
32
- const o = e.error instanceof Error ? e.error : new Error(String(e.error || "Operation failed"));
33
- u(o);
33
+ const s = e.error instanceof Error ? e.error : new Error(String(e.error || g));
34
+ a(s);
34
35
  }
35
36
  },
36
- [C, u, d]
37
- ), R = t.useCallback(
37
+ [k, a, d, g]
38
+ ), w = t.useCallback(
38
39
  async (e) => {
39
40
  try {
40
41
  b();
41
- const o = await e();
42
- S(o);
43
- } catch (o) {
44
- const g = o instanceof Error ? o : new Error(String(o));
45
- throw u(g), g;
42
+ const s = await e();
43
+ S(s);
44
+ } catch (s) {
45
+ const T = s instanceof Error ? s : new Error(String(s));
46
+ throw a(T), T;
46
47
  }
47
48
  },
48
- [b, S, u]
49
+ [b, S, a]
49
50
  );
50
51
  return t.useEffect(() => () => {
51
52
  r();
52
53
  }, [r]), {
53
54
  /** Estado actual del botón */
54
- currentState: E,
55
+ currentState: m,
55
56
  /** Indica si el botón está en estado de carga */
56
- isLoading: E === "loading",
57
+ isLoading: m === "loading",
57
58
  /** Error actual o null */
58
- error: p,
59
+ error: R,
59
60
  /** Función para resetear el estado */
60
61
  reset: n,
61
62
  /** Función para iniciar estado de carga */
@@ -63,13 +64,13 @@ const w = (T = {}) => {
63
64
  /** Función para detener estado de carga */
64
65
  stopLoading: d,
65
66
  /** Función para establecer estado de éxito */
66
- setSuccess: C,
67
+ setSuccess: k,
67
68
  /** Función para establecer estado de error */
68
- setError: u,
69
+ setError: a,
69
70
  /** Función para ejecutar operaciones asíncronas */
70
- executeAsync: R
71
+ executeAsync: w
71
72
  };
72
73
  };
73
74
  export {
74
- w as useEFWButton
75
+ y as useEFWButton
75
76
  };
@@ -1,9 +1,10 @@
1
- import { jsx as s } from "react/jsx-runtime";
2
- import * as C from "react";
3
- import { makeStyles as q, tokens as t, Tooltip as v, Spinner as K, Button as Q } from "@fluentui/react-components";
4
- import { ErrorCircleRegular as U, CheckmarkRegular as V } from "@fluentui/react-icons";
5
- import { useEFWButton as X } from "./EFWButton.hooks.js";
6
- const Y = q({
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import * as y from "react";
3
+ import { makeStyles as ne, tokens as t, Tooltip as se, Spinner as ae, Button as ie } from "@fluentui/react-components";
4
+ import { ErrorCircleRegular as ce, CheckmarkRegular as le } from "@fluentui/react-icons";
5
+ import { useEFWButton as ue } from "./EFWButton.hooks.js";
6
+ import { useButtonsLocaleText as de } from "../../i18n/PorygonI18nProvider.js";
7
+ const ge = ne({
7
8
  /**
8
9
  * Estilo para botón no interactivo (estado de carga con deshabilitación).
9
10
  * Aplica opacidad reducida y deshabilita eventos de puntero.
@@ -39,126 +40,193 @@ const Y = q({
39
40
  "& .ms-Button-icon": {
40
41
  color: `${t.colorStatusSuccessForeground1} !important`
41
42
  }
43
+ },
44
+ /**
45
+ * Oculta el label cuando el contenedor padre es ≤ 480px.
46
+ * Requiere que un ancestro tenga `container-type: inline-size`.
47
+ */
48
+ collapseLabelXs: {
49
+ "@container (max-width: 480px)": {
50
+ padding: "5px",
51
+ "& .efw-button__label": { display: "none" },
52
+ "& .fui-Button__icon": { marginRight: 0 },
53
+ minWidth: "auto"
54
+ }
55
+ },
56
+ /**
57
+ * Oculta el label cuando el contenedor padre es ≤ 640px.
58
+ * Requiere que un ancestro tenga `container-type: inline-size`.
59
+ */
60
+ collapseLabelSm: {
61
+ "@container (max-width: 640px)": {
62
+ padding: "5px",
63
+ "& .efw-button__label": { display: "none" },
64
+ "& .fui-Button__icon": { marginRight: 0 },
65
+ minWidth: "auto"
66
+ }
67
+ },
68
+ /**
69
+ * Oculta el label cuando el contenedor padre es ≤ 768px.
70
+ * Requiere que un ancestro tenga `container-type: inline-size`.
71
+ */
72
+ collapseLabelMd: {
73
+ "@container (max-width: 768px)": {
74
+ padding: "5px",
75
+ "& .efw-button__label": { display: "none" },
76
+ "& .fui-Button__icon": { marginRight: 0 },
77
+ minWidth: "auto"
78
+ }
79
+ },
80
+ /**
81
+ * Oculta el label cuando el contenedor padre es ≤ 1024px.
82
+ * Requiere que un ancestro tenga `container-type: inline-size`.
83
+ */
84
+ collapseLabelLg: {
85
+ "@container (max-width: 1024px)": {
86
+ padding: "5px",
87
+ "& .efw-button__label": { display: "none" },
88
+ "& .fui-Button__icon": { marginRight: 0 },
89
+ minWidth: "auto"
90
+ }
42
91
  }
43
92
  });
44
- function Z(r) {
45
- return r instanceof Error ? r : _(r) ? r === void 0 ? new Error("Operación fallida sin detalles (void)") : r.success ? new Error("Operación reportada como exitosa en un error") : r.error instanceof Error ? r.error : new Error(r.error || "Operación fallida sin mensaje") : new Error(String(r) || "Error desconocido");
93
+ function pe(e, r) {
94
+ return e instanceof Error ? e : fe(e) ? e === void 0 ? new Error(r.operationFailedMessage) : e.success ? new Error(r.operationFailedMessage) : e.error instanceof Error ? e.error : new Error(e.error || r.operationFailedMessage) : new Error(String(e) || r.unknownErrorMessage);
46
95
  }
47
- function _(r) {
48
- return r === void 0 ? !0 : typeof r == "object" && r !== null && "success" in r && typeof r.success == "boolean" && (r.error === void 0 || typeof r.error == "string" || r.error instanceof Error);
96
+ function fe(e) {
97
+ return e === void 0 ? !0 : typeof e == "object" && e !== null && "success" in e && typeof e.success == "boolean" && (e.error === void 0 || typeof e.error == "string" || e.error instanceof Error);
49
98
  }
50
- const L = (r) => {
51
- if (!r) return "Ha ocurrido un error";
52
- if (r instanceof Error) return r.message;
53
- if (typeof r == "string") return r;
54
- if (typeof r == "object" && r !== null) {
55
- const n = r;
56
- if (typeof n.message == "string") return n.message;
57
- if (typeof n.error == "string") return n.error;
99
+ const me = (e, r) => {
100
+ if (!e) return r.defaultErrorMessage;
101
+ if (e instanceof Error) return e.message || r.defaultErrorMessage;
102
+ if (typeof e == "string") return e;
103
+ if (typeof e == "object" && e !== null) {
104
+ const n = e;
105
+ if (typeof n.message == "string") return n.message || r.defaultErrorMessage;
106
+ if (typeof n.error == "string") return n.error || r.defaultErrorMessage;
58
107
  try {
59
- return JSON.stringify(r);
108
+ return JSON.stringify(e);
60
109
  } catch {
61
- return "Error: No es posible parsear error";
110
+ return r.parseErrorMessage;
62
111
  }
63
112
  }
64
- return String(r) || "Ha ocurrido un error";
65
- }, sr = ({
66
- onClick: r,
67
- loadingText: n = "Procesando...",
68
- disableOnLoading: u = !0,
69
- autoLoading: l = !1,
70
- successConfig: $ = {},
71
- errorConfig: h = {},
72
- tooltips: c,
73
- showStatusIcons: d = !0,
74
- autoReset: R = !0,
75
- children: f,
76
- disabled: m,
77
- className: F,
78
- appearance: P = "secondary",
79
- icon: i,
80
- ...T
113
+ return String(e) || r.defaultErrorMessage;
114
+ }, Ee = {}, be = {}, Fe = ({
115
+ onClick: e,
116
+ disableOnLoading: r = !0,
117
+ autoLoading: n = !1,
118
+ successConfig: I = Ee,
119
+ errorConfig: U = be,
120
+ labels: l,
121
+ tooltips: g,
122
+ showStatusIcons: E = !0,
123
+ autoReset: v = !0,
124
+ collapseLabel: p,
125
+ children: b,
126
+ disabled: M,
127
+ className: X,
128
+ appearance: Y = "secondary",
129
+ icon: u,
130
+ ...z
81
131
  }) => {
82
- const p = Y(), { onSuccess: x, timeout: w = 2e3, text: O } = $, { onError: W, timeout: G = 2e3, text: D } = h, { currentState: y, isLoading: g, error: H, setLoading: k, stopLoading: S, setSuccess: N, setError: a } = X({
83
- onError: W,
84
- onSuccess: x,
85
- successTimeout: w,
86
- errorTimeout: G,
87
- autoReset: R
88
- }), b = C.useCallback(
132
+ const s = ge(), d = de().button.labels, _ = d.loadingText, w = d.defaultErrorMessage, F = d.operationFailedMessage, S = d.unknownErrorMessage, T = d.parseErrorMessage, B = l?.loadingText, C = l?.defaultErrorMessage, N = l?.operationFailedMessage, R = l?.unknownErrorMessage, L = l?.parseErrorMessage, a = y.useMemo(() => ({
133
+ loadingText: B ?? _,
134
+ defaultErrorMessage: C ?? w,
135
+ operationFailedMessage: N ?? F,
136
+ unknownErrorMessage: R ?? S,
137
+ parseErrorMessage: L ?? T
138
+ }), [
139
+ B,
140
+ C,
141
+ N,
142
+ R,
143
+ L,
144
+ _,
145
+ w,
146
+ F,
147
+ S,
148
+ T
149
+ ]), { onSuccess: A, timeout: J = 2e3, text: q } = I, { onError: H, timeout: K = 2e3, text: Q } = U, { currentState: j, isLoading: x, error: V, setLoading: P, stopLoading: $, setSuccess: W, setError: f } = ue({
150
+ onError: H,
151
+ onSuccess: A,
152
+ successTimeout: J,
153
+ errorTimeout: K,
154
+ autoReset: v,
155
+ fallbackErrorMessage: a.operationFailedMessage
156
+ }), k = y.useCallback(
89
157
  (o) => {
90
158
  if (!o)
91
- S();
159
+ $();
92
160
  else if (typeof o == "object")
93
161
  if (o.success)
94
- N();
162
+ W();
95
163
  else {
96
- const e = o.error instanceof Error ? o.error : new Error(String(o.error || "Operación fallida"));
97
- a(e);
164
+ const i = o.error instanceof Error ? o.error : new Error(String(o.error || a.operationFailedMessage));
165
+ f(i);
98
166
  }
99
167
  },
100
- [S, N, a]
101
- ), z = C.useCallback(async (o) => {
102
- if (!(!r || g || m))
168
+ [$, W, f, a.operationFailedMessage]
169
+ ), Z = y.useCallback(async (o) => {
170
+ if (!(!e || x || M))
103
171
  try {
104
- const e = r(o);
105
- if (e instanceof Promise) {
106
- l && k();
107
- const E = await e;
108
- l && b(E);
172
+ const i = e(o);
173
+ if (i instanceof Promise) {
174
+ n && P();
175
+ const h = await i;
176
+ n && k(h);
109
177
  } else
110
- b(e);
111
- } catch (e) {
112
- const E = Z(e);
113
- a(E);
178
+ k(i);
179
+ } catch (i) {
180
+ const h = pe(i, a);
181
+ f(h);
114
182
  }
115
- }, [r, g, m, l, k, b, a]), A = () => {
116
- const o = [F].filter(Boolean);
117
- switch (y) {
183
+ }, [e, x, M, n, P, k, f, a]), O = u && p ? p === "sm" ? s.collapseLabelSm : p === "md" ? s.collapseLabelMd : p === "lg" ? s.collapseLabelLg : s.collapseLabelXs : void 0, m = (o) => O ? o ? /* @__PURE__ */ c("span", { className: "efw-button__label", children: o }) : void 0 : o, ee = () => {
184
+ const o = [X, O].filter(Boolean);
185
+ switch (j) {
118
186
  case "loading":
119
187
  return {
120
- content: n,
121
- icon: d ? /* @__PURE__ */ s(K, { size: "tiny" }) : i,
122
- className: u ? [...o, p.buttonNonInteractive].join(" ") : o.join(" "),
123
- tooltip: c?.loading
188
+ content: m(a.loadingText),
189
+ icon: E ? /* @__PURE__ */ c(ae, { size: "tiny" }) : u,
190
+ className: r ? [...o, s.buttonNonInteractive].join(" ") : o.join(" "),
191
+ tooltip: g?.loading
124
192
  };
125
193
  case "success":
126
194
  return {
127
- content: O ?? f,
128
- icon: d ? /* @__PURE__ */ s(V, {}) : i,
129
- className: [...o, p.buttonSuccess].join(" "),
130
- tooltip: c?.success
195
+ content: m(q ?? b),
196
+ icon: E ? /* @__PURE__ */ c(le, {}) : u,
197
+ className: [...o, s.buttonSuccess].join(" "),
198
+ tooltip: g?.success
131
199
  };
132
200
  case "error":
133
201
  return {
134
- content: D ?? f,
135
- icon: d ? /* @__PURE__ */ s(U, {}) : i,
136
- className: [...o, p.buttonError].join(" "),
137
- tooltip: c?.error ?? L(H)
202
+ content: m(Q ?? b),
203
+ icon: E ? /* @__PURE__ */ c(ce, {}) : u,
204
+ className: [...o, s.buttonError].join(" "),
205
+ tooltip: g?.error ?? me(V, a)
138
206
  };
139
207
  default:
140
208
  return {
141
- content: f,
142
- icon: i,
209
+ content: m(b),
210
+ icon: u,
143
211
  className: o.join(" "),
144
- tooltip: c?.idle
212
+ tooltip: g?.idle
145
213
  };
146
214
  }
147
- }, { content: I, icon: J, className: M, tooltip: B } = A(), j = /* @__PURE__ */ s(
148
- Q,
215
+ }, { content: oe, icon: re, className: te, tooltip: G } = ee(), D = /* @__PURE__ */ c(
216
+ ie,
149
217
  {
150
- ...T,
151
- appearance: P,
152
- className: M,
153
- disabled: m || u && g,
154
- disabledFocusable: y === "loading" && u,
155
- icon: J,
156
- onClick: z,
157
- children: I
218
+ ...z,
219
+ appearance: Y,
220
+ className: te,
221
+ disabled: M || r && x,
222
+ disabledFocusable: j === "loading" && r,
223
+ icon: re,
224
+ onClick: Z,
225
+ children: oe
158
226
  }
159
227
  );
160
- return B ? /* @__PURE__ */ s(v, { content: B, relationship: "label", children: j }) : j;
228
+ return G ? /* @__PURE__ */ c(se, { content: G, relationship: "label", children: D }) : D;
161
229
  };
162
230
  export {
163
- sr as EFWButton
231
+ Fe as EFWButton
164
232
  };