@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.
- package/README.md +3 -3
- package/dist/index.d.ts +9 -15
- package/dist/index.js +95 -55
- package/dist/react-components/buttons/EFWButton/EFWButton.d.ts +1 -1
- package/dist/react-components/buttons/EFWButton/EFWButton.hooks.js +32 -31
- package/dist/react-components/buttons/EFWButton/EFWButton.js +158 -90
- package/dist/react-components/buttons/EFWButton/EFWButton.types.d.ts +32 -6
- package/dist/react-components/buttons/EFWButton/index.d.ts +1 -1
- package/dist/react-components/buttons/EFWDrawerButton/EFWDrawerButton.d.ts +1 -1
- package/dist/react-components/buttons/EFWDrawerButton/EFWDrawerButton.types.d.ts +1 -1
- package/dist/react-components/buttons/EFWGroupButton/EFWGroupButton.d.ts +1 -1
- package/dist/react-components/buttons/EFWGroupButton/EFWGroupButton.js +69 -62
- package/dist/react-components/buttons/EFWGroupButton/EFWGroupButton.types.d.ts +7 -1
- package/dist/react-components/buttons/EFWGroupButton/index.d.ts +1 -1
- package/dist/react-components/commons/utils.d.ts +1 -1
- package/dist/react-components/commons/utils.js +1 -1
- package/dist/react-components/commons/valueNormalization.d.ts +17 -0
- package/dist/react-components/commons/valueNormalization.js +7 -0
- package/dist/react-components/fields/Attachments/EFWAttachments.js +175 -0
- package/dist/react-components/fields/{EFWAttachments → Attachments}/EFWAttachments.types.d.ts +32 -2
- package/dist/react-components/fields/Attachments/EFWAttachments.utils.d.ts +8 -0
- package/dist/react-components/fields/Attachments/EFWAttachments.utils.js +4 -0
- package/dist/react-components/fields/{EFWAttachments/EFWAttachmentsCard → Attachments}/EFWAttachmentsCard.d.ts +2 -11
- package/dist/react-components/fields/Attachments/EFWAttachmentsCard.js +110 -0
- package/dist/react-components/fields/{EFWAttachments/EFWAttachmentsCard → Attachments}/EFWAttachmentsCard.types.d.ts +21 -1
- package/dist/react-components/fields/Attachments/EFWAttachmentsField.js +70 -0
- package/dist/react-components/fields/{EFWAttachmentsField → Attachments}/EFWAttachmentsField.types.d.ts +2 -2
- package/dist/react-components/fields/Attachments/index.d.ts +5 -0
- package/dist/react-components/fields/Attachments/index.js +8 -0
- package/dist/react-components/fields/{EFWDatePicker → DatePicker}/EFWDatePicker.d.ts +1 -3
- package/dist/react-components/fields/DatePicker/EFWDatePicker.js +134 -0
- package/dist/react-components/fields/{EFWDatePicker → DatePicker}/EFWDatePicker.types.d.ts +19 -7
- package/dist/react-components/fields/DatePicker/EFWDatePicker.utils.d.ts +19 -0
- package/dist/react-components/fields/DatePicker/EFWDatePicker.utils.js +179 -0
- package/dist/react-components/fields/DatePicker/EFWDatePickerField.js +251 -0
- package/dist/react-components/fields/DatePicker/EFWDatePickerField.types.d.ts +15 -0
- package/dist/react-components/fields/DatePicker/index.d.ts +6 -0
- package/dist/react-components/fields/DatePicker/index.js +11 -0
- package/dist/react-components/fields/{EFWInput → Input}/EFWInput.d.ts +0 -1
- package/dist/react-components/fields/Input/EFWInput.js +199 -0
- package/dist/react-components/fields/{EFWInput → Input}/EFWInput.types.d.ts +66 -16
- package/dist/react-components/fields/{EFWInput → Input}/EFWInput.utils.d.ts +13 -3
- package/dist/react-components/fields/Input/EFWInput.utils.js +93 -0
- package/dist/react-components/fields/Input/EFWInputField.js +84 -0
- package/dist/react-components/fields/{EFWInputField → Input}/EFWInputField.types.d.ts +2 -2
- package/dist/react-components/fields/Input/index.d.ts +5 -0
- package/dist/react-components/fields/Input/index.js +8 -0
- package/dist/react-components/fields/NumberInput/EFWNumberInput.js +231 -0
- package/dist/react-components/fields/{EFWNumberInput → NumberInput}/EFWNumberInput.types.d.ts +33 -14
- package/dist/react-components/fields/{EFWNumberInput → NumberInput}/EFWNumberInput.utils.d.ts +10 -14
- package/dist/react-components/fields/{EFWNumberInput → NumberInput}/EFWNumberInput.utils.js +30 -27
- package/dist/react-components/fields/NumberInput/EFWNumberInputField.js +84 -0
- package/dist/react-components/fields/{EFWNumberInputField → NumberInput}/EFWNumberInputField.types.d.ts +2 -2
- package/dist/react-components/fields/NumberInput/index.d.ts +5 -0
- package/dist/react-components/fields/NumberInput/index.js +8 -0
- package/dist/react-components/fields/Switch/EFWSwitch.js +75 -0
- package/dist/react-components/fields/{EFWSwitch → Switch}/EFWSwitch.types.d.ts +18 -10
- package/dist/react-components/fields/Switch/EFWSwitch.utils.d.ts +9 -0
- package/dist/react-components/fields/Switch/EFWSwitch.utils.js +4 -0
- package/dist/react-components/fields/Switch/EFWSwitchField.js +62 -0
- package/dist/react-components/fields/{EFWSwitchField → Switch}/EFWSwitchField.types.d.ts +6 -2
- package/dist/react-components/fields/Switch/index.d.ts +5 -0
- package/dist/react-components/fields/Switch/index.js +8 -0
- package/dist/react-components/fields/TagPicker/EFWTagPicker.js +329 -0
- package/dist/react-components/fields/{EFWTagPicker → TagPicker}/EFWTagPicker.types.d.ts +30 -17
- package/dist/react-components/fields/TagPicker/EFWTagPicker.utils.d.ts +6 -0
- package/dist/react-components/fields/TagPicker/EFWTagPicker.utils.js +4 -0
- package/dist/react-components/fields/TagPicker/EFWTagPickerField.js +83 -0
- package/dist/react-components/fields/{EFWTagPickerField → TagPicker}/EFWTagPickerField.types.d.ts +2 -2
- package/dist/react-components/fields/TagPicker/index.d.ts +5 -0
- package/dist/react-components/fields/TagPicker/index.js +8 -0
- package/dist/react-components/fields/TextArea/EFWTextArea.js +153 -0
- package/dist/react-components/fields/{EFWTextArea → TextArea}/EFWTextArea.types.d.ts +26 -8
- package/dist/react-components/fields/TextArea/EFWTextArea.utils.d.ts +6 -0
- package/dist/react-components/fields/TextArea/EFWTextArea.utils.js +4 -0
- package/dist/react-components/fields/TextArea/EFWTextAreaField.js +80 -0
- package/dist/react-components/fields/{EFWTextAreaField → TextArea}/EFWTextAreaField.types.d.ts +2 -2
- package/dist/react-components/fields/TextArea/index.d.ts +5 -0
- package/dist/react-components/fields/TextArea/index.js +8 -0
- package/dist/react-components/fields/_shared/EFWField/EFWField.js +115 -0
- package/dist/react-components/fields/{EFWField → _shared/EFWField}/EFWField.types.d.ts +24 -13
- package/dist/react-components/fields/_shared/EFWField/EFWField.utils.js +20 -0
- package/dist/react-components/forms/EFWForm/EFWForm.converter.d.ts +16 -1
- package/dist/react-components/forms/EFWForm/EFWForm.converter.js +38 -16
- package/dist/react-components/forms/EFWForm/EFWForm.d.ts +1 -1
- package/dist/react-components/forms/EFWForm/EFWForm.flatConverter.d.ts +130 -0
- package/dist/react-components/forms/EFWForm/EFWForm.flatConverter.js +279 -0
- package/dist/react-components/forms/EFWForm/EFWForm.hooks.js +21 -18
- package/dist/react-components/forms/EFWForm/EFWForm.js +531 -309
- package/dist/react-components/forms/EFWForm/EFWForm.types.d.ts +172 -42
- package/dist/react-components/forms/EFWForm/EFWForm.utils.d.ts +6 -4
- package/dist/react-components/forms/EFWForm/EFWForm.utils.js +308 -229
- package/dist/react-components/forms/EFWForm/index.d.ts +5 -2
- package/dist/react-components/forms/EFWForm/index.js +10 -6
- package/dist/react-components/forms/EFWFormMessageBarGroup/EFWFormMessageBarGroup.js +36 -38
- package/dist/react-components/hooks/useDrawer/component/EFWDrawer/EFWDrawer.js +49 -47
- package/dist/react-components/hooks/useDrawer/component/EFWDrawer/EFWDrawer.types.d.ts +1 -0
- package/dist/react-components/hooks/useDrawer/component/EFWDrawerLoader/EFWDrawerLoader.d.ts +5 -3
- package/dist/react-components/hooks/useDrawer/component/EFWDrawerLoader/EFWDrawerLoader.js +6 -6
- package/dist/react-components/hooks/useDrawer/index.d.ts +1 -1
- package/dist/react-components/hooks/useDrawer/useDrawer.d.ts +4 -2
- package/dist/react-components/hooks/useDrawer/useDrawer.js +216 -111
- package/dist/react-components/hooks/useDrawer/useDrawer.types.d.ts +15 -2
- package/dist/react-components/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts +42 -0
- package/dist/react-components/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +5 -0
- package/dist/react-components/i18n/PorygonI18nProvider.d.ts +13 -0
- package/dist/react-components/i18n/PorygonI18nProvider.js +145 -0
- package/dist/react-components/i18n/defaultLocaleText.d.ts +6 -0
- package/dist/react-components/i18n/defaultLocaleText.js +176 -0
- package/dist/react-components/i18n/index.d.ts +4 -0
- package/dist/react-components/i18n/index.js +19 -0
- package/dist/react-components/i18n/localePresets.d.ts +10 -0
- package/dist/react-components/i18n/localePresets.js +362 -0
- package/dist/react-components/i18n/porygonI18n.types.d.ts +168 -0
- package/dist/react-components/layout/MainNavItems/MainNavItems.js +13 -13
- package/dist/react-components/tables/EFWTable/EFWTable.d.ts +3 -5
- package/dist/react-components/tables/EFWTable/EFWTable.js +955 -530
- package/dist/react-components/tables/EFWTable/EFWTable.types.d.ts +344 -86
- package/dist/react-components/tables/EFWTable/components/EFWTableBody/EFWTableBody.d.ts +5 -1
- package/dist/react-components/tables/EFWTable/components/EFWTableBody/EFWTableBody.js +97 -52
- package/dist/react-components/tables/EFWTable/components/EFWTableBody/EFWTableBody.types.d.ts +6 -2
- package/dist/react-components/tables/EFWTable/components/EFWTableCell/EFWTableCell.d.ts +6 -13
- package/dist/react-components/tables/EFWTable/components/EFWTableCell/EFWTableCell.js +36 -25
- package/dist/react-components/tables/EFWTable/components/EFWTableCell/EFWTableCell.types.d.ts +13 -0
- package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/EFWTableCommandBar.d.ts +4 -2
- package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/EFWTableCommandBar.js +90 -65
- package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/EFWTableCommandBar.types.d.ts +23 -32
- package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/EFWTableCommandBar.utils.d.ts +3 -3
- package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/index.d.ts +1 -1
- package/dist/react-components/tables/EFWTable/components/EFWTableHeader/EFWTableHeader.d.ts +1 -1
- package/dist/react-components/tables/EFWTable/components/EFWTableHeader/EFWTableHeader.js +170 -83
- package/dist/react-components/tables/EFWTable/components/EFWTableHeader/EFWTableHeader.types.d.ts +3 -0
- package/dist/react-components/tables/EFWTable/components/EFWTableOverlay/EFWTableOverlay.js +90 -88
- package/dist/react-components/tables/EFWTable/components/EFWTableOverlay/EFWTableOverlay.types.d.ts +54 -0
- package/dist/react-components/tables/EFWTable/components/EFWTableOverlay/index.d.ts +1 -1
- package/dist/react-components/tables/EFWTable/components/EFWTableRow/EFWTableRow.d.ts +7 -19
- package/dist/react-components/tables/EFWTable/components/EFWTableRow/EFWTableRow.js +83 -45
- package/dist/react-components/tables/EFWTable/components/EFWTableRow/EFWTableRow.types.d.ts +23 -0
- package/dist/react-components/tables/EFWTable/hooks/useDefaultAddButton/useDefaultAddButton.d.ts +3 -1
- package/dist/react-components/tables/EFWTable/hooks/useDefaultAddButton/useDefaultAddButton.js +67 -50
- package/dist/react-components/tables/EFWTable/hooks/useDefaultDeleteButton/useDefaultDeleteButton.d.ts +3 -1
- package/dist/react-components/tables/EFWTable/hooks/useDefaultDeleteButton/useDefaultDeleteButton.js +72 -49
- package/dist/react-components/tables/EFWTable/hooks/useDefaultFilterButton/useDefaultFilterButton.d.ts +17 -0
- package/dist/react-components/tables/EFWTable/hooks/useDefaultFilterButton/useDefaultFilterButton.js +255 -0
- package/dist/react-components/tables/EFWTable/hooks/useDefaultUpdateButton/useDefaultUpdateButton.d.ts +3 -1
- package/dist/react-components/tables/EFWTable/hooks/useDefaultUpdateButton/useDefaultUpdateButton.js +70 -49
- package/dist/react-components/tables/EFWTable/hooks/useStableColumnRenderers/useStableColumnRenderers.d.ts +10 -0
- package/dist/react-components/tables/EFWTable/hooks/useStableColumnRenderers/useStableColumnRenderers.js +28 -0
- package/dist/react-components/tables/EFWTable/hooks/useTableController/useTableController.d.ts +1 -1
- package/dist/react-components/tables/EFWTable/hooks/useTableController/useTableController.js +156 -117
- package/dist/react-components/tables/EFWTable/hooks/useTableController/useTableController.types.d.ts +3 -3
- package/dist/react-components/tables/EFWTable/hooks/useTableSelection/useTableSelection.d.ts +2 -1
- package/dist/react-components/tables/EFWTable/hooks/useTableSelection/useTableSelection.js +100 -53
- package/dist/react-components/tables/EFWTable/hooks/useTableSelection/useTableSelection.types.d.ts +10 -6
- package/dist/react-components/tables/EFWTable/index.d.ts +5 -2
- package/dist/react-components/tables/EFWTable/index.js +7 -5
- package/dist/react-components/tables/EFWTable/utils/CellRenderer/CellRenderer.js +26 -23
- package/dist/react-components/tables/EFWTable/utils/cache.d.ts +1 -8
- package/dist/react-components/tables/EFWTable/utils/cache.js +40 -49
- package/dist/react-components/tables/EFWTable/utils/filterFunctions.d.ts +16 -0
- package/dist/react-components/tables/EFWTable/utils/filterFunctions.js +52 -0
- package/dist/react-components/tables/EFWTable/utils/hashing.d.ts +2 -2
- package/dist/react-components/tables/EFWTable/utils/hashing.js +2 -2
- package/dist/react-components/tables/EFWTable/utils/index.d.ts +1 -0
- package/dist/react-components/tables/EFWTable/utils/index.js +13 -10
- package/dist/react-components/tables/EFWTable/utils/typeHelpers.d.ts +24 -0
- package/dist/react-components/tables/EFWTable/utils/typeHelpers.js +11 -0
- package/package.json +27 -19
- package/dist/react-components/fields/EFWAttachments/EFWAttachments.js +0 -125
- package/dist/react-components/fields/EFWAttachments/EFWAttachmentsCard/EFWAttachmentsCard.js +0 -107
- package/dist/react-components/fields/EFWAttachments/EFWAttachmentsCard/index.d.ts +0 -1
- package/dist/react-components/fields/EFWAttachments/EFWAttachmentsCard/index.js +0 -0
- package/dist/react-components/fields/EFWAttachments/index.d.ts +0 -2
- package/dist/react-components/fields/EFWAttachments/index.js +0 -4
- package/dist/react-components/fields/EFWAttachmentsField/EFWAttachmentsField.js +0 -57
- package/dist/react-components/fields/EFWAttachmentsField/index.d.ts +0 -2
- package/dist/react-components/fields/EFWAttachmentsField/index.js +0 -4
- package/dist/react-components/fields/EFWDatePicker/EFWDatePicker.js +0 -114
- package/dist/react-components/fields/EFWDatePicker/EFWDatePicker.utils.d.ts +0 -24
- package/dist/react-components/fields/EFWDatePicker/EFWDatePicker.utils.js +0 -90
- package/dist/react-components/fields/EFWDatePicker/index.d.ts +0 -2
- package/dist/react-components/fields/EFWDatePicker/index.js +0 -4
- package/dist/react-components/fields/EFWDatePickerField/EFWDatePickerField.js +0 -65
- package/dist/react-components/fields/EFWDatePickerField/EFWDatePickerField.types.d.ts +0 -7
- package/dist/react-components/fields/EFWDatePickerField/index.d.ts +0 -2
- package/dist/react-components/fields/EFWDatePickerField/index.js +0 -4
- package/dist/react-components/fields/EFWField/EFWField.js +0 -96
- package/dist/react-components/fields/EFWField/EFWField.utils.js +0 -17
- package/dist/react-components/fields/EFWInput/EFWInput.js +0 -119
- package/dist/react-components/fields/EFWInput/EFWInput.utils.js +0 -83
- package/dist/react-components/fields/EFWInput/index.d.ts +0 -2
- package/dist/react-components/fields/EFWInput/index.js +0 -4
- package/dist/react-components/fields/EFWInputField/EFWInputField.js +0 -73
- package/dist/react-components/fields/EFWInputField/EFWInputField.utils.d.ts +0 -1
- package/dist/react-components/fields/EFWInputField/EFWInputField.utils.js +0 -0
- package/dist/react-components/fields/EFWInputField/index.d.ts +0 -2
- package/dist/react-components/fields/EFWInputField/index.js +0 -4
- package/dist/react-components/fields/EFWNumberInput/EFWNumberInput.js +0 -198
- package/dist/react-components/fields/EFWNumberInput/index.d.ts +0 -2
- package/dist/react-components/fields/EFWNumberInput/index.js +0 -4
- package/dist/react-components/fields/EFWNumberInputField/EFWNumberInputField.js +0 -67
- package/dist/react-components/fields/EFWNumberInputField/EFWNumberInputField.utils.d.ts +0 -1
- package/dist/react-components/fields/EFWNumberInputField/EFWNumberInputField.utils.js +0 -0
- package/dist/react-components/fields/EFWNumberInputField/index.d.ts +0 -2
- package/dist/react-components/fields/EFWNumberInputField/index.js +0 -4
- package/dist/react-components/fields/EFWSwitch/EFWSwitch.js +0 -55
- package/dist/react-components/fields/EFWSwitch/index.d.ts +0 -2
- package/dist/react-components/fields/EFWSwitch/index.js +0 -4
- package/dist/react-components/fields/EFWSwitchField/EFWSwitchField.js +0 -55
- package/dist/react-components/fields/EFWSwitchField/index.d.ts +0 -2
- package/dist/react-components/fields/EFWSwitchField/index.js +0 -4
- package/dist/react-components/fields/EFWTagPicker/EFWTagPicker.js +0 -244
- package/dist/react-components/fields/EFWTagPicker/index.d.ts +0 -2
- package/dist/react-components/fields/EFWTagPicker/index.js +0 -4
- package/dist/react-components/fields/EFWTagPickerField/EFWTagPickerField.js +0 -74
- package/dist/react-components/fields/EFWTagPickerField/EFWTagPickerField.utils.d.ts +0 -1
- package/dist/react-components/fields/EFWTagPickerField/EFWTagPickerField.utils.js +0 -0
- package/dist/react-components/fields/EFWTagPickerField/index.d.ts +0 -2
- package/dist/react-components/fields/EFWTagPickerField/index.js +0 -4
- package/dist/react-components/fields/EFWTextArea/EFWTextArea.js +0 -105
- package/dist/react-components/fields/EFWTextArea/EFWTextArea.utils.d.ts +0 -1
- package/dist/react-components/fields/EFWTextArea/EFWTextArea.utils.js +0 -0
- package/dist/react-components/fields/EFWTextArea/index.d.ts +0 -2
- package/dist/react-components/fields/EFWTextArea/index.js +0 -4
- package/dist/react-components/fields/EFWTextAreaField/EFWTextAreaField.js +0 -71
- package/dist/react-components/fields/EFWTextAreaField/EFWTextAreaField.utils.d.ts +0 -1
- package/dist/react-components/fields/EFWTextAreaField/EFWTextAreaField.utils.js +0 -0
- package/dist/react-components/fields/EFWTextAreaField/index.d.ts +0 -2
- package/dist/react-components/fields/EFWTextAreaField/index.js +0 -4
- package/dist/react-components/fields/types.d.ts +0 -1
- package/dist/react-components/fields/types.js +0 -0
- package/dist/react-components/tables/EFWTable/hooks/useTableController/useTableController.types copy.d.ts +0 -16
- package/dist/react-components/tables/EFWTable/hooks/useTableController/useTableController.types copy.js +0 -0
- package/dist/utils/htmlConverter.d.ts +0 -15
- package/dist/utils/htmlConverter.js +0 -12
- /package/dist/react-components/fields/{EFWAttachments → Attachments}/EFWAttachments.d.ts +0 -0
- /package/dist/react-components/fields/{EFWAttachmentsField → Attachments}/EFWAttachmentsField.d.ts +0 -0
- /package/dist/react-components/fields/{EFWDatePickerField → DatePicker}/EFWDatePickerField.d.ts +0 -0
- /package/dist/react-components/fields/{EFWInputField → Input}/EFWInputField.d.ts +0 -0
- /package/dist/react-components/fields/{EFWNumberInput → NumberInput}/EFWNumberInput.d.ts +0 -0
- /package/dist/react-components/fields/{EFWNumberInputField → NumberInput}/EFWNumberInputField.d.ts +0 -0
- /package/dist/react-components/fields/{EFWSwitch → Switch}/EFWSwitch.d.ts +0 -0
- /package/dist/react-components/fields/{EFWSwitchField → Switch}/EFWSwitchField.d.ts +0 -0
- /package/dist/react-components/fields/{EFWTagPicker → TagPicker}/EFWTagPicker.d.ts +0 -0
- /package/dist/react-components/fields/{EFWTagPickerField → TagPicker}/EFWTagPickerField.d.ts +0 -0
- /package/dist/react-components/fields/{EFWTextArea → TextArea}/EFWTextArea.d.ts +0 -0
- /package/dist/react-components/fields/{EFWTextAreaField → TextArea}/EFWTextAreaField.d.ts +0 -0
- /package/dist/react-components/fields/{EFWField → _shared/EFWField}/EFWField.d.ts +0 -0
- /package/dist/react-components/fields/{EFWField → _shared/EFWField}/EFWField.utils.d.ts +0 -0
- /package/dist/react-components/fields/{EFWField → _shared/EFWField}/index.d.ts +0 -0
- /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
|
|
13
|
+
Porygon es compatible con **React 17**, **18** y **19**. Instala el paquete con pnpm:
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
|
|
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/
|
|
6
|
-
export * from './react-components/fields/
|
|
7
|
-
export * from './react-components/fields/
|
|
8
|
-
export * from './react-components/fields/
|
|
9
|
-
export * from './react-components/fields/
|
|
10
|
-
export * from './react-components/fields/
|
|
11
|
-
export * from './react-components/fields/
|
|
12
|
-
export * from './react-components/fields/
|
|
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
|
|
3
|
-
import { EFWButton as
|
|
4
|
-
import { useEFWButton as
|
|
5
|
-
import { EFWDrawerButton as
|
|
6
|
-
import { EFWGroupButton as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
v as
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
82
|
+
g as getAttachmentsFormattedValue,
|
|
83
|
+
C as getDatePickerFormattedValue,
|
|
57
84
|
t as getErrorMessage,
|
|
58
85
|
F as getFileIconUrl,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
|
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
|
|
2
|
+
const y = (p = {}) => {
|
|
3
3
|
const {
|
|
4
|
-
onError:
|
|
5
|
-
onSuccess:
|
|
4
|
+
onError: C,
|
|
5
|
+
onSuccess: E,
|
|
6
6
|
successTimeout: i = 2e3,
|
|
7
7
|
errorTimeout: f = 2e3,
|
|
8
|
-
autoReset:
|
|
9
|
-
|
|
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
|
-
|
|
13
|
+
o("idle"), l(null), r();
|
|
13
14
|
}, [r]), b = t.useCallback(() => {
|
|
14
|
-
|
|
15
|
+
o("loading"), l(null), r();
|
|
15
16
|
}, [r]), d = t.useCallback(() => {
|
|
16
|
-
|
|
17
|
-
}, [r]),
|
|
18
|
-
|
|
19
|
-
}, [
|
|
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),
|
|
22
|
+
l(e), o("error"), C?.(e), u && f > 0 && (r(), c.current = setTimeout(n, f));
|
|
22
23
|
},
|
|
23
|
-
[
|
|
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
|
-
|
|
31
|
+
k();
|
|
31
32
|
else {
|
|
32
|
-
const
|
|
33
|
-
|
|
33
|
+
const s = e.error instanceof Error ? e.error : new Error(String(e.error || g));
|
|
34
|
+
a(s);
|
|
34
35
|
}
|
|
35
36
|
},
|
|
36
|
-
[
|
|
37
|
-
),
|
|
37
|
+
[k, a, d, g]
|
|
38
|
+
), w = t.useCallback(
|
|
38
39
|
async (e) => {
|
|
39
40
|
try {
|
|
40
41
|
b();
|
|
41
|
-
const
|
|
42
|
-
S(
|
|
43
|
-
} catch (
|
|
44
|
-
const
|
|
45
|
-
throw
|
|
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,
|
|
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:
|
|
55
|
+
currentState: m,
|
|
55
56
|
/** Indica si el botón está en estado de carga */
|
|
56
|
-
isLoading:
|
|
57
|
+
isLoading: m === "loading",
|
|
57
58
|
/** Error actual o null */
|
|
58
|
-
error:
|
|
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:
|
|
67
|
+
setSuccess: k,
|
|
67
68
|
/** Función para establecer estado de error */
|
|
68
|
-
setError:
|
|
69
|
+
setError: a,
|
|
69
70
|
/** Función para ejecutar operaciones asíncronas */
|
|
70
|
-
executeAsync:
|
|
71
|
+
executeAsync: w
|
|
71
72
|
};
|
|
72
73
|
};
|
|
73
74
|
export {
|
|
74
|
-
|
|
75
|
+
y as useEFWButton
|
|
75
76
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import { makeStyles as
|
|
4
|
-
import { ErrorCircleRegular as
|
|
5
|
-
import { useEFWButton as
|
|
6
|
-
|
|
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
|
|
45
|
-
return
|
|
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
|
|
48
|
-
return
|
|
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
|
|
51
|
-
if (!
|
|
52
|
-
if (
|
|
53
|
-
if (typeof
|
|
54
|
-
if (typeof
|
|
55
|
-
const n =
|
|
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(
|
|
108
|
+
return JSON.stringify(e);
|
|
60
109
|
} catch {
|
|
61
|
-
return
|
|
110
|
+
return r.parseErrorMessage;
|
|
62
111
|
}
|
|
63
112
|
}
|
|
64
|
-
return String(
|
|
65
|
-
},
|
|
66
|
-
onClick:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
tooltips:
|
|
73
|
-
showStatusIcons:
|
|
74
|
-
autoReset:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}),
|
|
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
|
-
|
|
159
|
+
$();
|
|
92
160
|
else if (typeof o == "object")
|
|
93
161
|
if (o.success)
|
|
94
|
-
|
|
162
|
+
W();
|
|
95
163
|
else {
|
|
96
|
-
const
|
|
97
|
-
|
|
164
|
+
const i = o.error instanceof Error ? o.error : new Error(String(o.error || a.operationFailedMessage));
|
|
165
|
+
f(i);
|
|
98
166
|
}
|
|
99
167
|
},
|
|
100
|
-
[
|
|
101
|
-
),
|
|
102
|
-
if (!(!
|
|
168
|
+
[$, W, f, a.operationFailedMessage]
|
|
169
|
+
), Z = y.useCallback(async (o) => {
|
|
170
|
+
if (!(!e || x || M))
|
|
103
171
|
try {
|
|
104
|
-
const
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
|
|
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
|
-
|
|
111
|
-
} catch (
|
|
112
|
-
const
|
|
113
|
-
|
|
178
|
+
k(i);
|
|
179
|
+
} catch (i) {
|
|
180
|
+
const h = pe(i, a);
|
|
181
|
+
f(h);
|
|
114
182
|
}
|
|
115
|
-
}, [
|
|
116
|
-
const o = [
|
|
117
|
-
switch (
|
|
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:
|
|
121
|
-
icon:
|
|
122
|
-
className:
|
|
123
|
-
tooltip:
|
|
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:
|
|
128
|
-
icon:
|
|
129
|
-
className: [...o,
|
|
130
|
-
tooltip:
|
|
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:
|
|
135
|
-
icon:
|
|
136
|
-
className: [...o,
|
|
137
|
-
tooltip:
|
|
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:
|
|
142
|
-
icon:
|
|
209
|
+
content: m(b),
|
|
210
|
+
icon: u,
|
|
143
211
|
className: o.join(" "),
|
|
144
|
-
tooltip:
|
|
212
|
+
tooltip: g?.idle
|
|
145
213
|
};
|
|
146
214
|
}
|
|
147
|
-
}, { content:
|
|
148
|
-
|
|
215
|
+
}, { content: oe, icon: re, className: te, tooltip: G } = ee(), D = /* @__PURE__ */ c(
|
|
216
|
+
ie,
|
|
149
217
|
{
|
|
150
|
-
...
|
|
151
|
-
appearance:
|
|
152
|
-
className:
|
|
153
|
-
disabled:
|
|
154
|
-
disabledFocusable:
|
|
155
|
-
icon:
|
|
156
|
-
onClick:
|
|
157
|
-
children:
|
|
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
|
|
228
|
+
return G ? /* @__PURE__ */ c(se, { content: G, relationship: "label", children: D }) : D;
|
|
161
229
|
};
|
|
162
230
|
export {
|
|
163
|
-
|
|
231
|
+
Fe as EFWButton
|
|
164
232
|
};
|