@envisiongroup/porygon 1.0.0-rc.9 → 1.0.1
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 +50 -14
- 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 -63
- package/dist/react-components/buttons/EFWGroupButton/EFWGroupButton.js +120 -85
- 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/caretPositioning.d.ts +35 -0
- package/dist/react-components/commons/caretPositioning.js +28 -0
- 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 +28 -0
- package/dist/react-components/commons/valueNormalization.js +6 -0
- package/dist/react-components/fields/Attachments/EFWAttachments.js +205 -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 +164 -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/Input/EFWInput.d.ts +10 -0
- package/dist/react-components/fields/Input/EFWInput.js +260 -0
- package/dist/react-components/fields/{EFWInput → Input}/EFWInput.types.d.ts +120 -25
- package/dist/react-components/fields/Input/EFWInput.utils.d.ts +101 -0
- package/dist/react-components/fields/Input/EFWInput.utils.js +222 -0
- package/dist/react-components/fields/Input/EFWInput.validation.d.ts +20 -0
- package/dist/react-components/fields/Input/EFWInput.validation.js +72 -0
- package/dist/react-components/fields/Input/EFWInputField.js +86 -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 +339 -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 +20 -14
- package/dist/react-components/fields/NumberInput/EFWNumberInput.utils.js +86 -0
- 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 +388 -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 +119 -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/fields/_shared/EFWField/useSyncedValidationState.d.ts +50 -0
- package/dist/react-components/fields/_shared/EFWField/useSyncedValidationState.js +41 -0
- package/dist/react-components/fields/test-utils/testUtils.js +10 -0
- package/dist/react-components/forms/EFWForm/EFWForm.converter.d.ts +16 -1
- package/dist/react-components/forms/EFWForm/EFWForm.converter.js +51 -20
- 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 +866 -403
- package/dist/react-components/forms/EFWForm/EFWForm.types.d.ts +213 -89
- package/dist/react-components/forms/EFWForm/EFWForm.utils.d.ts +10 -5
- package/dist/react-components/forms/EFWForm/EFWForm.utils.js +356 -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 +55 -55
- package/dist/react-components/forms/EFWMessageBarManager/EFWMessageBarManager.js +38 -29
- 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 +366 -0
- package/dist/react-components/i18n/porygonI18n.types.d.ts +169 -0
- package/dist/react-components/layout/MainNavItems/MainNavItems.js +13 -13
- package/dist/react-components/tables/EFWTable/EFWTable.d.ts +2 -5
- package/dist/react-components/tables/EFWTable/EFWTable.js +916 -525
- package/dist/react-components/tables/EFWTable/EFWTable.types.d.ts +256 -62
- 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 +4 -1
- package/dist/react-components/tables/EFWTable/components/EFWTableCell/EFWTableCell.d.ts +1 -12
- package/dist/react-components/tables/EFWTable/components/EFWTableCell/EFWTableCell.js +47 -22
- 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 +1 -1
- package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/EFWTableCommandBar.js +94 -69
- package/dist/react-components/tables/EFWTable/components/EFWTableCommandBar/EFWTableCommandBar.types.d.ts +7 -16
- 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 +218 -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 +5 -0
- package/dist/react-components/tables/EFWTable/components/EFWTableRow/EFWTableRow.d.ts +1 -18
- 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 +2 -1
- package/dist/react-components/tables/EFWTable/hooks/useDefaultAddButton/useDefaultAddButton.js +65 -48
- package/dist/react-components/tables/EFWTable/hooks/useDefaultDeleteButton/useDefaultDeleteButton.d.ts +2 -1
- package/dist/react-components/tables/EFWTable/hooks/useDefaultDeleteButton/useDefaultDeleteButton.js +71 -48
- 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 +2 -1
- package/dist/react-components/tables/EFWTable/hooks/useDefaultUpdateButton/useDefaultUpdateButton.js +72 -52
- 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.js +151 -115
- package/dist/react-components/tables/EFWTable/hooks/useTableSelection/useTableSelection.d.ts +1 -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 +5 -1
- package/dist/react-components/tables/EFWTable/index.d.ts +4 -1
- 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/package.json +49 -22
- 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/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.d.ts +0 -26
- package/dist/react-components/fields/EFWInput/EFWInput.js +0 -119
- package/dist/react-components/fields/EFWInput/EFWInput.utils.d.ts +0 -20
- 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/EFWNumberInput.utils.js +0 -76
- 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/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/dist/{react-components/fields/EFWAttachments/EFWAttachmentsCard/index.js → vite-raw.d.js} +0 -0
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsx as
|
|
5
|
-
import * as
|
|
6
|
-
import { createPortal as
|
|
7
|
-
import { motionTokens as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
var te = Object.defineProperty;
|
|
2
|
+
var ne = (n, t, r) => t in n ? te(n, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : n[t] = r;
|
|
3
|
+
var d = (n, t, r) => ne(n, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { jsx as S } from "react/jsx-runtime";
|
|
5
|
+
import * as s from "react";
|
|
6
|
+
import { createPortal as re } from "react-dom";
|
|
7
|
+
import { motionTokens as b } from "@fluentui/react-components";
|
|
8
|
+
import { useButtonsLocaleText as se } from "../../i18n/PorygonI18nProvider.js";
|
|
9
|
+
import { EFWDrawerLoader as q } from "./component/EFWDrawerLoader/EFWDrawerLoader.js";
|
|
10
|
+
import { EFWDrawer as oe } from "./component/EFWDrawer/EFWDrawer.js";
|
|
11
|
+
const ie = {
|
|
12
|
+
small: b.durationGentle,
|
|
13
|
+
medium: b.durationSlow,
|
|
14
|
+
large: b.durationSlower,
|
|
15
|
+
full: b.durationUltraSlow
|
|
16
|
+
}, ue = 1e3, h = class h {
|
|
16
17
|
constructor() {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
d(this, "listenerCount", 0);
|
|
19
|
+
d(this, "doc", null);
|
|
20
|
+
d(this, "supportsPointerEvents", null);
|
|
21
|
+
d(this, "supportsWeakRef", typeof WeakRef < "u");
|
|
22
|
+
d(this, "lastTargetRef", null);
|
|
23
|
+
d(this, "lastTargetTime", 0);
|
|
24
|
+
d(this, "handleInteraction", (t) => {
|
|
24
25
|
const r = t.target;
|
|
25
26
|
r instanceof HTMLElement && (this.lastTargetRef = this.supportsWeakRef ? new WeakRef(r) : r, this.lastTargetTime = Date.now());
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
29
|
static getInstance() {
|
|
29
|
-
return
|
|
30
|
+
return h.instance || (h.instance = new h()), h.instance;
|
|
30
31
|
}
|
|
31
32
|
register(t) {
|
|
32
33
|
if (this.listenerCount += 1, this.listenerCount === 1) {
|
|
@@ -48,35 +49,99 @@ const j = {
|
|
|
48
49
|
consumeLastTarget() {
|
|
49
50
|
if (!this.lastTargetRef)
|
|
50
51
|
return null;
|
|
51
|
-
const t = this.supportsWeakRef ? this.lastTargetRef.deref() : this.lastTargetRef, r = t && Date.now() - this.lastTargetTime <=
|
|
52
|
+
const t = this.supportsWeakRef ? this.lastTargetRef.deref() : this.lastTargetRef, r = t && Date.now() - this.lastTargetTime <= ue;
|
|
52
53
|
return this.lastTargetRef = null, r ? t : null;
|
|
53
54
|
}
|
|
54
55
|
};
|
|
55
|
-
|
|
56
|
-
let
|
|
57
|
-
const
|
|
56
|
+
d(h, "instance", null);
|
|
57
|
+
let A = h;
|
|
58
|
+
const G = A.getInstance(), H = (n) => {
|
|
59
|
+
if (n === null || typeof n != "object") return !1;
|
|
60
|
+
const t = Object.getPrototypeOf(n);
|
|
61
|
+
return t === Object.prototype || t === null;
|
|
62
|
+
}, ae = (n, t) => !s.isValidElement(n) || !s.isValidElement(t) ? !1 : n.type === t.type && n.key === t.key, k = (n, t) => {
|
|
63
|
+
if (Object.is(n, t) || ae(n, t))
|
|
64
|
+
return !0;
|
|
65
|
+
if (Array.isArray(n) && Array.isArray(t)) {
|
|
66
|
+
if (n.length !== t.length) return !1;
|
|
67
|
+
for (let r = 0; r < n.length; r += 1)
|
|
68
|
+
if (!k(n[r], t[r]))
|
|
69
|
+
return !1;
|
|
70
|
+
return !0;
|
|
71
|
+
}
|
|
72
|
+
if (H(n) && H(t)) {
|
|
73
|
+
const r = /* @__PURE__ */ new Set([...Object.keys(n), ...Object.keys(t)]);
|
|
74
|
+
for (const i of r)
|
|
75
|
+
if (!k(n[i], t[i]))
|
|
76
|
+
return !1;
|
|
77
|
+
return !0;
|
|
78
|
+
}
|
|
79
|
+
return !1;
|
|
80
|
+
}, le = (n, t) => {
|
|
81
|
+
if (n.length !== t.length) return !1;
|
|
82
|
+
for (let r = 0; r < n.length; r += 1) {
|
|
83
|
+
const i = n[r], u = t[r];
|
|
84
|
+
if (i.kind !== u.kind || !k(i.props, u.props))
|
|
85
|
+
return !1;
|
|
86
|
+
}
|
|
87
|
+
return !0;
|
|
88
|
+
}, M = (n, t) => {
|
|
89
|
+
if (!t)
|
|
90
|
+
return n;
|
|
91
|
+
const r = Object.entries(t);
|
|
92
|
+
if (r.length === 0)
|
|
93
|
+
return n;
|
|
94
|
+
let i = !1;
|
|
95
|
+
const u = { ...n };
|
|
96
|
+
for (const [p, c] of r)
|
|
97
|
+
Object.is(n[p], c) || (i = !0, u[p] = c);
|
|
98
|
+
return i ? u : n;
|
|
99
|
+
}, Y = (n, t) => {
|
|
100
|
+
const r = Object.entries(t);
|
|
101
|
+
if (r.length === 0) return !1;
|
|
102
|
+
for (const [i, u] of r) {
|
|
103
|
+
const p = n[i];
|
|
104
|
+
if (i === "buttons") {
|
|
105
|
+
if (!le(p ?? [], u ?? []))
|
|
106
|
+
return !0;
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
if (i === "labels") {
|
|
110
|
+
const c = p ?? {};
|
|
111
|
+
if (M(c, u) !== c)
|
|
112
|
+
return !0;
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
if (!Object.is(p, u))
|
|
116
|
+
return !0;
|
|
117
|
+
}
|
|
118
|
+
return !1;
|
|
119
|
+
}, ce = (n, t) => {
|
|
58
120
|
switch (t.type) {
|
|
59
|
-
case "OPEN":
|
|
121
|
+
case "OPEN": {
|
|
122
|
+
const i = t.payload ?? {}, u = M(n.labels, i.labels);
|
|
60
123
|
return {
|
|
61
|
-
...
|
|
124
|
+
...n,
|
|
62
125
|
isOpen: !0,
|
|
63
126
|
isMounted: !0,
|
|
64
127
|
isClosing: !1,
|
|
65
128
|
isContentReady: !1,
|
|
66
129
|
wasContentShown: !1,
|
|
67
|
-
...
|
|
130
|
+
...i,
|
|
131
|
+
labels: u
|
|
68
132
|
};
|
|
133
|
+
}
|
|
69
134
|
case "START_CLOSE":
|
|
70
135
|
return {
|
|
71
|
-
...
|
|
136
|
+
...n,
|
|
72
137
|
isOpen: !1,
|
|
73
138
|
isClosing: !0,
|
|
74
139
|
// Mantener el estado de qué se estaba mostrando
|
|
75
|
-
wasContentShown:
|
|
140
|
+
wasContentShown: n.isContentReady
|
|
76
141
|
};
|
|
77
142
|
case "FINISH_CLOSE":
|
|
78
143
|
return {
|
|
79
|
-
...
|
|
144
|
+
...n,
|
|
80
145
|
isClosing: !1,
|
|
81
146
|
isMounted: !1,
|
|
82
147
|
isContentReady: !1,
|
|
@@ -84,62 +149,76 @@ const A = E.getInstance(), V = (o, t) => {
|
|
|
84
149
|
};
|
|
85
150
|
case "CONTENT_READY":
|
|
86
151
|
return {
|
|
87
|
-
...
|
|
152
|
+
...n,
|
|
88
153
|
isContentReady: !0,
|
|
89
154
|
wasContentShown: !0
|
|
90
155
|
};
|
|
91
156
|
case "UPDATE_CONTENT":
|
|
157
|
+
if (!t.payload || !Y(n, t.payload))
|
|
158
|
+
return n;
|
|
159
|
+
const r = M(n.labels, t.payload.labels);
|
|
92
160
|
return {
|
|
93
|
-
...
|
|
94
|
-
...t.payload
|
|
161
|
+
...n,
|
|
162
|
+
...t.payload,
|
|
163
|
+
labels: r
|
|
95
164
|
};
|
|
96
165
|
default:
|
|
97
|
-
return
|
|
166
|
+
return n;
|
|
98
167
|
}
|
|
99
168
|
};
|
|
100
|
-
function
|
|
101
|
-
title:
|
|
169
|
+
function Ce({
|
|
170
|
+
title: n = "",
|
|
102
171
|
content: t,
|
|
103
172
|
buttons: r = [],
|
|
104
|
-
size:
|
|
105
|
-
position:
|
|
106
|
-
modalType:
|
|
107
|
-
drawerOnOpen:
|
|
108
|
-
drawerOnClose:
|
|
109
|
-
deferContentRendering:
|
|
110
|
-
contentRenderDelay:
|
|
173
|
+
size: i = "small",
|
|
174
|
+
position: u = "end",
|
|
175
|
+
modalType: p = "modal",
|
|
176
|
+
drawerOnOpen: c,
|
|
177
|
+
drawerOnClose: g,
|
|
178
|
+
deferContentRendering: X = !1,
|
|
179
|
+
contentRenderDelay: Z = 500,
|
|
180
|
+
labels: J
|
|
111
181
|
}) {
|
|
112
|
-
const
|
|
182
|
+
const N = se(), a = s.useRef(null), [v, K] = s.useState(null), f = s.useRef(), m = s.useRef(), O = s.useRef(null), T = s.useRef(null), R = s.useRef(null), w = s.useRef(!1), I = s.useRef(i), P = s.useRef(!1), _ = s.useRef(g), j = s.useRef(c), [e, C] = s.useReducer(ce, {
|
|
113
183
|
isOpen: !1,
|
|
114
184
|
isMounted: !1,
|
|
115
185
|
isClosing: !1,
|
|
116
186
|
isContentReady: !1,
|
|
117
187
|
wasContentShown: !1,
|
|
118
|
-
title:
|
|
188
|
+
title: n,
|
|
119
189
|
content: t,
|
|
120
190
|
buttons: r,
|
|
121
|
-
size:
|
|
122
|
-
position:
|
|
123
|
-
modalType:
|
|
124
|
-
deferContentRendering:
|
|
125
|
-
contentRenderDelay:
|
|
126
|
-
|
|
127
|
-
|
|
191
|
+
size: i,
|
|
192
|
+
position: u,
|
|
193
|
+
modalType: p,
|
|
194
|
+
deferContentRendering: X,
|
|
195
|
+
contentRenderDelay: Z,
|
|
196
|
+
labels: J ?? {}
|
|
197
|
+
}), U = s.useRef(e), E = s.useMemo(
|
|
198
|
+
() => ({
|
|
199
|
+
...N.drawer.labels,
|
|
200
|
+
...e.labels ?? {}
|
|
201
|
+
}),
|
|
202
|
+
[N.drawer.labels, e.labels]
|
|
203
|
+
);
|
|
204
|
+
s.useLayoutEffect(() => {
|
|
128
205
|
if (!(typeof document > "u"))
|
|
129
|
-
return
|
|
130
|
-
|
|
206
|
+
return a.current || (a.current = document.createElement("div"), a.current.className = "drawer-portal-container", document.body.appendChild(a.current), K(a.current)), () => {
|
|
207
|
+
a.current && document.body.contains(a.current) && (document.body.removeChild(a.current), a.current = null), f.current && clearTimeout(f.current), m.current && clearTimeout(m.current), R.current !== null && typeof window < "u" && (window.cancelAnimationFrame(R.current), R.current = null), T.current = null, w.current = !1;
|
|
131
208
|
};
|
|
132
|
-
}, []),
|
|
209
|
+
}, []), s.useEffect(() => {
|
|
133
210
|
if (!(typeof document > "u"))
|
|
134
|
-
return
|
|
135
|
-
}, []),
|
|
136
|
-
|
|
137
|
-
}, [e
|
|
138
|
-
|
|
139
|
-
}, [
|
|
140
|
-
|
|
141
|
-
},
|
|
142
|
-
|
|
211
|
+
return G.register(document);
|
|
212
|
+
}, []), s.useLayoutEffect(() => {
|
|
213
|
+
U.current = e;
|
|
214
|
+
}, [e]), s.useLayoutEffect(() => {
|
|
215
|
+
I.current = e.size, P.current = e.isOpen;
|
|
216
|
+
}, [e.size, e.isOpen]), s.useLayoutEffect(() => {
|
|
217
|
+
_.current = g, j.current = c;
|
|
218
|
+
}, [g, c]), s.useEffect(() => (e.isOpen && !e.isContentReady && !e.isClosing && (f.current && clearTimeout(f.current), e.deferContentRendering && e.contentRenderDelay > 0 ? f.current = setTimeout(() => {
|
|
219
|
+
C({ type: "CONTENT_READY" });
|
|
220
|
+
}, e.contentRenderDelay) : C({ type: "CONTENT_READY" })), () => {
|
|
221
|
+
f.current && clearTimeout(f.current);
|
|
143
222
|
}), [
|
|
144
223
|
e.isOpen,
|
|
145
224
|
e.isContentReady,
|
|
@@ -147,42 +226,65 @@ function $({
|
|
|
147
226
|
e.deferContentRendering,
|
|
148
227
|
e.contentRenderDelay
|
|
149
228
|
]);
|
|
150
|
-
const
|
|
229
|
+
const F = s.useCallback(() => {
|
|
151
230
|
if (typeof document > "u") return;
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
}, []),
|
|
231
|
+
const l = G.consumeLastTarget() ?? document.activeElement;
|
|
232
|
+
l instanceof HTMLElement && l !== document.body ? O.current = l : O.current = null;
|
|
233
|
+
}, []), W = s.useCallback(() => {
|
|
155
234
|
if (typeof document > "u") return;
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
}, []),
|
|
159
|
-
(
|
|
160
|
-
|
|
235
|
+
const o = O.current;
|
|
236
|
+
O.current = null, !(!o || !o.isConnected) && (a.current && a.current.contains(o) || o.focus?.());
|
|
237
|
+
}, []), z = s.useCallback(
|
|
238
|
+
(o) => {
|
|
239
|
+
m.current && (clearTimeout(m.current), m.current = void 0), F(), C({ type: "OPEN", payload: o }), j.current?.()?.catch?.(console.error);
|
|
161
240
|
},
|
|
162
|
-
[
|
|
163
|
-
),
|
|
164
|
-
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
},
|
|
169
|
-
}, [
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
241
|
+
[F]
|
|
242
|
+
), y = s.useCallback(() => {
|
|
243
|
+
f.current && (clearTimeout(f.current), f.current = void 0), m.current && clearTimeout(m.current), C({ type: "START_CLOSE" }), _.current?.()?.catch?.(console.error);
|
|
244
|
+
const o = ie[I.current] ?? b.durationGentle;
|
|
245
|
+
m.current = setTimeout(() => {
|
|
246
|
+
W(), C({ type: "FINISH_CLOSE" });
|
|
247
|
+
}, o);
|
|
248
|
+
}, [W]), D = s.useCallback(() => {
|
|
249
|
+
R.current = null;
|
|
250
|
+
const o = T.current;
|
|
251
|
+
T.current = null;
|
|
252
|
+
const l = w.current === !0;
|
|
253
|
+
w.current = !1, o && (!l && !Y(U.current, o) || C({ type: "UPDATE_CONTENT", payload: o }));
|
|
254
|
+
}, []), L = s.useCallback((o, l) => {
|
|
255
|
+
const V = {
|
|
256
|
+
...T.current ?? {},
|
|
257
|
+
...o
|
|
258
|
+
};
|
|
259
|
+
T.current = V;
|
|
260
|
+
const ee = l?.force === !0 || w.current === !0;
|
|
261
|
+
if (w.current = ee, R.current === null) {
|
|
262
|
+
if (typeof window > "u" || typeof window.requestAnimationFrame != "function") {
|
|
263
|
+
D();
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
R.current = window.requestAnimationFrame(() => {
|
|
267
|
+
D();
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
}, [D]), Q = s.useMemo(() => {
|
|
271
|
+
const o = (l) => z(l);
|
|
272
|
+
return o.updateDrawer = L, o;
|
|
273
|
+
}, [z, L]), x = s.useCallback(
|
|
274
|
+
(o, l) => {
|
|
275
|
+
!l.open && P.current && y();
|
|
174
276
|
},
|
|
175
|
-
[
|
|
176
|
-
),
|
|
277
|
+
[y]
|
|
278
|
+
), B = s.useMemo(() => {
|
|
177
279
|
if (!e.isMounted || !e.content)
|
|
178
280
|
return null;
|
|
179
281
|
if (e.isClosing)
|
|
180
|
-
return e.wasContentShown ? typeof e.content == "function" ? e.content(
|
|
282
|
+
return e.wasContentShown ? typeof e.content == "function" ? e.content(y) : e.content : e.deferContentRendering && !e.wasContentShown ? /* @__PURE__ */ S(q, { loadingText: E.loadingContentText }) : null;
|
|
181
283
|
if (e.isOpen) {
|
|
182
284
|
if (e.deferContentRendering && !e.isContentReady)
|
|
183
|
-
return /* @__PURE__ */
|
|
285
|
+
return /* @__PURE__ */ S(q, { loadingText: E.loadingContentText });
|
|
184
286
|
if (e.isContentReady)
|
|
185
|
-
return typeof e.content == "function" ? e.content(
|
|
287
|
+
return typeof e.content == "function" ? e.content(y) : e.content;
|
|
186
288
|
}
|
|
187
289
|
return null;
|
|
188
290
|
}, [
|
|
@@ -194,23 +296,25 @@ function $({
|
|
|
194
296
|
e.wasContentShown,
|
|
195
297
|
e.deferContentRendering,
|
|
196
298
|
e.contentRenderDelay,
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
299
|
+
y,
|
|
300
|
+
E.loadingContentText
|
|
301
|
+
]), $ = s.useMemo(() => !e.isMounted || !v ? null : re(
|
|
302
|
+
/* @__PURE__ */ S(
|
|
303
|
+
oe,
|
|
201
304
|
{
|
|
202
305
|
isOpen: e.isOpen,
|
|
203
|
-
onClose:
|
|
204
|
-
onOpenChange:
|
|
306
|
+
onClose: y,
|
|
307
|
+
onOpenChange: x,
|
|
205
308
|
title: e.title,
|
|
206
|
-
content:
|
|
309
|
+
content: B,
|
|
207
310
|
buttons: e.buttons,
|
|
208
311
|
size: e.size,
|
|
209
312
|
position: e.position,
|
|
210
|
-
modalType: e.modalType
|
|
313
|
+
modalType: e.modalType,
|
|
314
|
+
labels: E
|
|
211
315
|
}
|
|
212
316
|
),
|
|
213
|
-
|
|
317
|
+
v
|
|
214
318
|
), [
|
|
215
319
|
e.isMounted,
|
|
216
320
|
e.isOpen,
|
|
@@ -219,20 +323,21 @@ function $({
|
|
|
219
323
|
e.size,
|
|
220
324
|
e.position,
|
|
221
325
|
e.modalType,
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
326
|
+
B,
|
|
327
|
+
v,
|
|
328
|
+
y,
|
|
329
|
+
x,
|
|
330
|
+
E
|
|
226
331
|
]);
|
|
227
332
|
return {
|
|
228
|
-
openDrawer:
|
|
229
|
-
closeDrawer:
|
|
230
|
-
updateDrawer:
|
|
333
|
+
openDrawer: Q,
|
|
334
|
+
closeDrawer: y,
|
|
335
|
+
updateDrawer: L,
|
|
231
336
|
isOpen: e.isOpen,
|
|
232
337
|
isContentReady: e.isContentReady,
|
|
233
|
-
DrawerElement:
|
|
338
|
+
DrawerElement: $
|
|
234
339
|
};
|
|
235
340
|
}
|
|
236
341
|
export {
|
|
237
|
-
|
|
342
|
+
Ce as useDrawer
|
|
238
343
|
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { EFWGroupButtonConfig } from '../../buttons/EFWGroupButton';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
export interface UseDrawerLabels {
|
|
4
|
+
closeButtonAriaLabel?: string;
|
|
5
|
+
loadingContentText?: string;
|
|
6
|
+
}
|
|
3
7
|
/**
|
|
4
8
|
* Interfaz que define las propiedades base para el componente Drawer.
|
|
5
9
|
* @interface DrawerBase
|
|
@@ -10,7 +14,7 @@ import * as React from 'react';
|
|
|
10
14
|
* @property {'start' | 'end' | 'bottom'} position - Posición del drawer en la pantalla.
|
|
11
15
|
* @property {'small' | 'medium' | 'large' | 'full'} size - Tamaño del drawer.
|
|
12
16
|
*/
|
|
13
|
-
|
|
17
|
+
interface DrawerBase {
|
|
14
18
|
title?: React.ReactNode;
|
|
15
19
|
content?: React.ReactNode | ((closeDrawer: DrawerCloseHandler) => React.ReactNode);
|
|
16
20
|
buttons?: EFWGroupButtonConfig<DrawerCloseHandler>[];
|
|
@@ -19,6 +23,7 @@ export interface DrawerBase {
|
|
|
19
23
|
size?: 'small' | 'medium' | 'large' | 'full';
|
|
20
24
|
deferContentRendering?: boolean;
|
|
21
25
|
contentRenderDelay?: number;
|
|
26
|
+
labels?: UseDrawerLabels;
|
|
22
27
|
}
|
|
23
28
|
/**
|
|
24
29
|
* Interfaz para las opciones de apertura del drawer.
|
|
@@ -43,7 +48,13 @@ export interface UseDrawerProps extends DrawerBase {
|
|
|
43
48
|
* @typedef {function} DrawerOpenHandler
|
|
44
49
|
* @param {DrawerOpenOptions} [options] - Opciones para abrir el drawer.
|
|
45
50
|
*/
|
|
46
|
-
export type
|
|
51
|
+
export type DrawerUpdateHandler = (updates: Partial<DrawerState>, options?: {
|
|
52
|
+
force?: boolean;
|
|
53
|
+
}) => void;
|
|
54
|
+
export interface DrawerOpenHandler {
|
|
55
|
+
(options?: DrawerOpenOptions): void;
|
|
56
|
+
updateDrawer?: DrawerUpdateHandler;
|
|
57
|
+
}
|
|
47
58
|
/**
|
|
48
59
|
* Tipo para la función que cierra el drawer.
|
|
49
60
|
* @typedef {function} DrawerCloseHandler
|
|
@@ -73,4 +84,6 @@ export interface DrawerState {
|
|
|
73
84
|
isContentReady: boolean;
|
|
74
85
|
deferContentRendering: boolean;
|
|
75
86
|
contentRenderDelay: number;
|
|
87
|
+
labels: UseDrawerLabels;
|
|
76
88
|
}
|
|
89
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Hook que usa `useLayoutEffect` en el cliente y `useEffect` en el servidor (SSR).
|
|
5
|
+
*
|
|
6
|
+
* ## Por que existe
|
|
7
|
+
*
|
|
8
|
+
* `useLayoutEffect` ejecuta sincronicamente despues del render y **antes** del paint del
|
|
9
|
+
* navegador, lo cual es necesario cuando el efecto debe completarse antes de que el usuario
|
|
10
|
+
* vea la pantalla (ej. registrar callbacks, medir DOM, prevenir parpadeos visuales).
|
|
11
|
+
*
|
|
12
|
+
* Sin embargo, en SSR no existe DOM ni paint, asi que React emite un warning si detecta
|
|
13
|
+
* `useLayoutEffect` en el servidor. Este hook resuelve el problema eligiendo automaticamente
|
|
14
|
+
* el hook correcto segun el entorno.
|
|
15
|
+
*
|
|
16
|
+
* ## Cuando usarlo
|
|
17
|
+
*
|
|
18
|
+
* - Registrar funciones/refs que otros layout effects necesitan en el mismo ciclo de commit.
|
|
19
|
+
* - Leer o mutar el DOM antes del paint (medir dimensiones, scroll, focus).
|
|
20
|
+
* - Sincronizar estado que debe estar listo antes de que el usuario vea el frame.
|
|
21
|
+
*
|
|
22
|
+
* Para efectos que no requieren timing pre-paint (fetch, suscripciones, logging),
|
|
23
|
+
* usa `useEffect` directamente.
|
|
24
|
+
*
|
|
25
|
+
* ## Ejemplo
|
|
26
|
+
*
|
|
27
|
+
* ```tsx
|
|
28
|
+
* import { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect';
|
|
29
|
+
*
|
|
30
|
+
* // Registrar un callback antes de que el padre lo use en su propio layout effect
|
|
31
|
+
* useIsomorphicLayoutEffect(() => {
|
|
32
|
+
* registerUpdateProps(field.internalName, updateProps);
|
|
33
|
+
* }, [field.internalName, registerUpdateProps, updateProps]);
|
|
34
|
+
*
|
|
35
|
+
* // Medir un elemento del DOM sin parpadeo visual
|
|
36
|
+
* useIsomorphicLayoutEffect(() => {
|
|
37
|
+
* const { height } = ref.current.getBoundingClientRect();
|
|
38
|
+
* setHeight(height);
|
|
39
|
+
* }, [dependency]);
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare const useIsomorphicLayoutEffect: typeof useEffect;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { EFWFormLocaleText, EFWFieldsLocaleText, EFWButtonsLocaleText, EFWTableLocaleText, PorygonLocaleText } from './porygonI18n.types';
|
|
3
|
+
|
|
4
|
+
export interface PorygonI18nProviderProps {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
localeText?: PorygonLocaleText;
|
|
7
|
+
}
|
|
8
|
+
export declare const PorygonI18nProvider: ({ children, localeText }: PorygonI18nProviderProps) => React.ReactElement;
|
|
9
|
+
export declare const usePorygonLocaleText: () => PorygonLocaleText;
|
|
10
|
+
export declare const useFormLocaleText: (localeText?: Partial<EFWFormLocaleText>) => EFWFormLocaleText;
|
|
11
|
+
export declare const useFieldsLocaleText: () => EFWFieldsLocaleText;
|
|
12
|
+
export declare const useButtonsLocaleText: () => EFWButtonsLocaleText;
|
|
13
|
+
export declare const useTableLocaleText: (localeText?: Partial<EFWTableLocaleText>) => EFWTableLocaleText;
|