@envisiongroup/porygon 1.0.0-rc.9 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +384 -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
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsx as u, Fragment as I } from "react/jsx-runtime";
|
|
2
|
+
import { makeStyles as U, tokens as n, mergeClasses as B, Text as j, Switch as z } from "@fluentui/react-components";
|
|
3
|
+
import { useMemo as D, useId as M, useState as O, useEffect as R, useCallback as W } from "react";
|
|
4
|
+
import { getSwitchFormattedValue as p } from "./EFWSwitch.utils.js";
|
|
5
|
+
import { useFieldsLocaleText as q } from "../../i18n/PorygonI18nProvider.js";
|
|
6
|
+
const A = U({
|
|
7
|
+
efwSwitch: {
|
|
8
|
+
"& [disabled]": {
|
|
9
|
+
"&~ .fui-Switch__indicator": {
|
|
10
|
+
backgroundColor: n.colorNeutralBackground3,
|
|
11
|
+
color: n.colorNeutralForeground4
|
|
12
|
+
},
|
|
13
|
+
"&~ .fui-Switch__label": {
|
|
14
|
+
color: n.colorNeutralForeground2
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
// Afectar el span que contiene el input disabled
|
|
18
|
+
"& :has(span + [disabled])": {
|
|
19
|
+
backgroundColor: n.colorNeutralBackground3
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}), X = (C) => {
|
|
23
|
+
const {
|
|
24
|
+
value: h,
|
|
25
|
+
defaultValue: g,
|
|
26
|
+
onChange: i,
|
|
27
|
+
className: w = "",
|
|
28
|
+
editable: y = !0,
|
|
29
|
+
disabled: N = !1,
|
|
30
|
+
labels: s,
|
|
31
|
+
readOnlyRenderer: v
|
|
32
|
+
} = C, a = q().switch.labels, k = a.checkedText, x = a.uncheckedText, m = a.emptyState, T = s?.checkedText, f = s?.uncheckedText, b = s?.emptyState, e = D(() => ({
|
|
33
|
+
checkedText: T ?? k,
|
|
34
|
+
uncheckedText: f ?? x,
|
|
35
|
+
emptyState: b ?? m
|
|
36
|
+
}), [
|
|
37
|
+
T,
|
|
38
|
+
f,
|
|
39
|
+
b,
|
|
40
|
+
k,
|
|
41
|
+
x,
|
|
42
|
+
m
|
|
43
|
+
]), F = A(), V = M(), l = g ?? !1, o = h !== void 0, [E, S] = O(l);
|
|
44
|
+
R(() => {
|
|
45
|
+
o || S((t) => t === l ? t : l);
|
|
46
|
+
}, [o, l]);
|
|
47
|
+
const d = o ? !!h : E, r = p(d, { checkedText: e.checkedText, uncheckedText: e.uncheckedText }), L = W((t) => {
|
|
48
|
+
const c = t.currentTarget.checked;
|
|
49
|
+
o || S(c), i?.(c, p(c, { checkedText: e.checkedText, uncheckedText: e.uncheckedText }));
|
|
50
|
+
}, [e.checkedText, e.uncheckedText, i, o]), _ = B(
|
|
51
|
+
F.efwSwitch,
|
|
52
|
+
w
|
|
53
|
+
);
|
|
54
|
+
if (!y) {
|
|
55
|
+
const t = r || e.emptyState, c = v?.(
|
|
56
|
+
d,
|
|
57
|
+
t
|
|
58
|
+
);
|
|
59
|
+
return c != null ? /* @__PURE__ */ u(I, { children: c }) : /* @__PURE__ */ u(j, { style: r ? void 0 : { opacity: 0.7 }, children: t });
|
|
60
|
+
}
|
|
61
|
+
return /* @__PURE__ */ u(
|
|
62
|
+
z,
|
|
63
|
+
{
|
|
64
|
+
className: _,
|
|
65
|
+
id: V,
|
|
66
|
+
disabled: N,
|
|
67
|
+
checked: d,
|
|
68
|
+
onChange: L,
|
|
69
|
+
label: r
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
export {
|
|
74
|
+
X as EFWSwitch
|
|
75
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { EFWFieldChildrenProps } from '../EFWField/EFWField.types';
|
|
1
|
+
import { EFWFieldChildrenProps } from '../_shared/EFWField/EFWField.types';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Tipo que representa el valor de un switch (interruptor).
|
|
@@ -13,6 +14,12 @@ export type EFWSwitchValue = boolean;
|
|
|
13
14
|
* @returns {void}
|
|
14
15
|
*/
|
|
15
16
|
export type EFWSwitchOnChange = (value: EFWSwitchValue, displayValue?: string) => void;
|
|
17
|
+
export type EFWSwitchNonEditableRenderer = (value: EFWSwitchValue, displayValue: string) => ReactNode;
|
|
18
|
+
export interface EFWSwitchLabels {
|
|
19
|
+
checkedText?: string;
|
|
20
|
+
uncheckedText?: string;
|
|
21
|
+
emptyState?: string;
|
|
22
|
+
}
|
|
16
23
|
/**
|
|
17
24
|
* Propiedades del componente EFWSwitch.
|
|
18
25
|
* @interface EFWSwitchProps
|
|
@@ -20,7 +27,8 @@ export type EFWSwitchOnChange = (value: EFWSwitchValue, displayValue?: string) =
|
|
|
20
27
|
*/
|
|
21
28
|
export interface EFWSwitchProps extends Partial<EFWFieldChildrenProps> {
|
|
22
29
|
/**
|
|
23
|
-
* Valor
|
|
30
|
+
* Valor controlado del switch.
|
|
31
|
+
* Si se omite, el componente opera en modo uncontrolled.
|
|
24
32
|
*/
|
|
25
33
|
value?: EFWSwitchValue;
|
|
26
34
|
/**
|
|
@@ -39,17 +47,17 @@ export interface EFWSwitchProps extends Partial<EFWFieldChildrenProps> {
|
|
|
39
47
|
*/
|
|
40
48
|
className?: string;
|
|
41
49
|
/**
|
|
42
|
-
*
|
|
43
|
-
* @default Sí
|
|
50
|
+
* Función callback que se ejecuta cuando el usuario cambia el estado del switch.
|
|
44
51
|
*/
|
|
45
|
-
|
|
52
|
+
onChange?: EFWSwitchOnChange;
|
|
46
53
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
54
|
+
* Textos personalizables de la UI del campo.
|
|
55
|
+
* Permite sobreescribir los textos por defecto para internacionalización.
|
|
49
56
|
*/
|
|
50
|
-
|
|
57
|
+
labels?: EFWSwitchLabels;
|
|
51
58
|
/**
|
|
52
|
-
*
|
|
59
|
+
* Renderiza contenido custom cuando `editable={false}`.
|
|
60
|
+
* Si retorna `null` o `undefined`, se utiliza el render no editable por defecto.
|
|
53
61
|
*/
|
|
54
|
-
|
|
62
|
+
readOnlyRenderer?: EFWSwitchNonEditableRenderer;
|
|
55
63
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EFWSwitchValue } from './EFWSwitch.types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Retorna el valor formateado que EFWSwitch muestra cuando no está en modo editable.
|
|
5
|
+
*/
|
|
6
|
+
export declare const getSwitchFormattedValue: (value: EFWSwitchValue | undefined | null, options?: {
|
|
7
|
+
checkedText?: string;
|
|
8
|
+
uncheckedText?: string;
|
|
9
|
+
}) => string;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { EFWField as W } from "../_shared/EFWField/EFWField.js";
|
|
3
|
+
import { EFWSwitch as x } from "./EFWSwitch.js";
|
|
4
|
+
import { mergeClasses as y } from "@griffel/react";
|
|
5
|
+
const q = (l) => {
|
|
6
|
+
const {
|
|
7
|
+
title: i,
|
|
8
|
+
infoLabel: s,
|
|
9
|
+
hint: t,
|
|
10
|
+
className: n,
|
|
11
|
+
style: o = {},
|
|
12
|
+
required: r = !1,
|
|
13
|
+
validationState: d,
|
|
14
|
+
validationMessage: m,
|
|
15
|
+
validationMessageIcon: f,
|
|
16
|
+
value: h,
|
|
17
|
+
defaultValue: c,
|
|
18
|
+
editable: e = !0,
|
|
19
|
+
disabled: g = !1,
|
|
20
|
+
hidden: u = !1,
|
|
21
|
+
labels: b,
|
|
22
|
+
readOnlyRenderer: p,
|
|
23
|
+
onChange: C,
|
|
24
|
+
onValidationChange: w,
|
|
25
|
+
...F
|
|
26
|
+
} = l, v = (N, S) => {
|
|
27
|
+
C?.(N, S);
|
|
28
|
+
}, E = y(n, "efw-switch-field");
|
|
29
|
+
return /* @__PURE__ */ a(
|
|
30
|
+
W,
|
|
31
|
+
{
|
|
32
|
+
className: E,
|
|
33
|
+
style: o,
|
|
34
|
+
title: i,
|
|
35
|
+
infoLabel: s,
|
|
36
|
+
weightLabel: e ? "regular" : "semibold",
|
|
37
|
+
hint: t,
|
|
38
|
+
required: r,
|
|
39
|
+
validationState: d,
|
|
40
|
+
validationMessage: m,
|
|
41
|
+
validationMessageIcon: f,
|
|
42
|
+
onValidationChange: w,
|
|
43
|
+
hidden: u,
|
|
44
|
+
...F,
|
|
45
|
+
children: /* @__PURE__ */ a(
|
|
46
|
+
x,
|
|
47
|
+
{
|
|
48
|
+
value: h,
|
|
49
|
+
defaultValue: c,
|
|
50
|
+
editable: e,
|
|
51
|
+
onChange: v,
|
|
52
|
+
disabled: g,
|
|
53
|
+
labels: b,
|
|
54
|
+
readOnlyRenderer: p
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
export {
|
|
61
|
+
q as EFWSwitchField
|
|
62
|
+
};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { EFWFieldProps } from '../EFWField/EFWField.types';
|
|
2
|
-
import { EFWSwitchProps, EFWSwitchValue, EFWSwitchOnChange } from '
|
|
1
|
+
import { EFWFieldProps } from '../_shared/EFWField/EFWField.types';
|
|
2
|
+
import { EFWSwitchProps, EFWSwitchValue, EFWSwitchOnChange } from './EFWSwitch.types';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* `undefined` se conserva por compatibilidad con EFWForm cuando aún no existe valor
|
|
6
|
+
* inicial para el campo. En runtime el componente resuelve a estado booleano.
|
|
7
|
+
*/
|
|
4
8
|
export type EFWSwitchFieldValue = EFWSwitchValue | undefined;
|
|
5
9
|
export type EFWSwitchFieldOnChange = EFWSwitchOnChange;
|
|
6
10
|
export interface EFWSwitchFieldProps extends Omit<EFWFieldProps, 'children'>, EFWSwitchProps {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { EFWSwitch } from './EFWSwitch';
|
|
2
|
+
export { getSwitchFormattedValue } from './EFWSwitch.utils';
|
|
3
|
+
export type { EFWSwitchProps, EFWSwitchValue, EFWSwitchOnChange, EFWSwitchNonEditableRenderer } from './EFWSwitch.types';
|
|
4
|
+
export { EFWSwitchField } from './EFWSwitchField';
|
|
5
|
+
export type { EFWSwitchFieldProps, EFWSwitchFieldValue, EFWSwitchFieldOnChange } from './EFWSwitchField.types';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EFWSwitch as o } from "./EFWSwitch.js";
|
|
2
|
+
import { getSwitchFormattedValue as i } from "./EFWSwitch.utils.js";
|
|
3
|
+
import { EFWSwitchField as F } from "./EFWSwitchField.js";
|
|
4
|
+
export {
|
|
5
|
+
o as EFWSwitch,
|
|
6
|
+
F as EFWSwitchField,
|
|
7
|
+
i as getSwitchFormattedValue
|
|
8
|
+
};
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
import { jsx as a, jsxs as _, Fragment as Ie } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as v, useState as w, useMemo as p, useEffect as A, useCallback as u } from "react";
|
|
3
|
+
import { makeStyles as ze, tokens as n, useTagPickerFilter as De, TagPickerOption as B, Spinner as Ve, mergeClasses as Fe, Text as _e, TagPicker as Qe, TagPickerControl as je, TagPickerGroup as qe, Tag as Ge, TagPickerInput as We, Button as Xe, TagPickerList as He, Avatar as Je } from "@fluentui/react-components";
|
|
4
|
+
import { getTagPickerFormattedValue as pe } from "./EFWTagPicker.utils.js";
|
|
5
|
+
import { normalizeArrayValue as Ke } from "../../commons/valueNormalization.js";
|
|
6
|
+
import { CollectionsEmpty20Regular as Ye, Eraser20Regular as $e } from "@fluentui/react-icons";
|
|
7
|
+
import { useFieldsLocaleText as Ue } from "../../i18n/PorygonI18nProvider.js";
|
|
8
|
+
const Q = [], ue = (x) => /* @__PURE__ */ a(Je, { shape: "square", "aria-hidden": !0, name: x.text, color: "colorful" }), Ze = ze({
|
|
9
|
+
efwTagPickerControlError: {
|
|
10
|
+
backgroundColor: n.colorPaletteRedBackground1,
|
|
11
|
+
"::after": {
|
|
12
|
+
borderBottomColor: n.colorPaletteRedBorder2,
|
|
13
|
+
borderBottomStyle: "solid",
|
|
14
|
+
borderBottomWidth: "2px"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
efwTagPickerControl: {
|
|
18
|
+
"& [disabled]": {
|
|
19
|
+
backgroundColor: n.colorNeutralBackground3,
|
|
20
|
+
color: n.colorNeutralForeground2,
|
|
21
|
+
"&::placeholder": {
|
|
22
|
+
color: "transparent"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
// Afectar el span que contiene el input disabled
|
|
26
|
+
// Aumentar especificidad repitiendo el selector
|
|
27
|
+
"&&:has([disabled])": {
|
|
28
|
+
backgroundColor: n.colorNeutralBackground3,
|
|
29
|
+
borderTopColor: n.colorNeutralStrokeDisabled,
|
|
30
|
+
borderBottomColor: n.colorNeutralStrokeDisabled,
|
|
31
|
+
borderLeftColor: n.colorNeutralStrokeDisabled,
|
|
32
|
+
borderRightColor: n.colorNeutralStrokeDisabled,
|
|
33
|
+
"& button": {
|
|
34
|
+
borderBottomColor: n.colorNeutralStrokeDisabled,
|
|
35
|
+
borderTopColor: n.colorNeutralStrokeDisabled,
|
|
36
|
+
borderLeftColor: n.colorNeutralStrokeDisabled,
|
|
37
|
+
borderRightColor: n.colorNeutralStrokeDisabled,
|
|
38
|
+
paddingRight: "5px",
|
|
39
|
+
"& .fui-Tag__dismissIcon": {
|
|
40
|
+
display: "none"
|
|
41
|
+
//visibility: 'hidden'
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"& .fui-TagPickerGroup, & input": {
|
|
46
|
+
padding: `${n.spacingVerticalXXS} 0`
|
|
47
|
+
},
|
|
48
|
+
"& .fui-Tag__primaryText": {
|
|
49
|
+
whiteSpace: "normal"
|
|
50
|
+
},
|
|
51
|
+
"& .fui-Tag": {
|
|
52
|
+
height: "auto"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
efwTagPickerOptionContentNoMedia: {
|
|
56
|
+
display: "flex",
|
|
57
|
+
flexDirection: "column",
|
|
58
|
+
alignItems: "flex-start"
|
|
59
|
+
},
|
|
60
|
+
efwTagPickerOptionSecondaryNoMedia: {
|
|
61
|
+
color: n.colorNeutralForeground3,
|
|
62
|
+
fontSize: "12px",
|
|
63
|
+
lineHeight: "16px"
|
|
64
|
+
}
|
|
65
|
+
}), st = (x) => {
|
|
66
|
+
const {
|
|
67
|
+
labels: f,
|
|
68
|
+
className: ge = "",
|
|
69
|
+
minQueryLength: m = 0,
|
|
70
|
+
options: r = Q,
|
|
71
|
+
hidden: fe = !1,
|
|
72
|
+
disabled: j = !1,
|
|
73
|
+
editable: me = !0,
|
|
74
|
+
selectedOptions: q = Q,
|
|
75
|
+
defaultSelectedOptions: R = Q,
|
|
76
|
+
noPopover: be = !1,
|
|
77
|
+
tagSize: he = "medium",
|
|
78
|
+
tagShape: Se = "rounded",
|
|
79
|
+
tagAppearance: ye = "brand",
|
|
80
|
+
onChange: P,
|
|
81
|
+
beforeRenderOptions: O,
|
|
82
|
+
renderOptionMedia: E,
|
|
83
|
+
showOptionMediaInSelectedTags: G = !1,
|
|
84
|
+
readOnlyRenderer: Oe,
|
|
85
|
+
multiple: W = !0,
|
|
86
|
+
validationState: X = "none",
|
|
87
|
+
validationMessage: Ce,
|
|
88
|
+
setParentComponentState: I
|
|
89
|
+
} = x, Te = v(X), ke = v(Ce), [s, H] = w(""), c = x.selectedOptions !== void 0, J = (c ? q : R) ?? [], [Me, z] = w(J), i = c ? q ?? [] : Me, N = p(
|
|
90
|
+
() => new Map(i.map((e) => [e.key, e])),
|
|
91
|
+
[i]
|
|
92
|
+
), b = p(
|
|
93
|
+
() => i.map((e) => e.key),
|
|
94
|
+
[i]
|
|
95
|
+
), K = p(
|
|
96
|
+
() => new Set(b),
|
|
97
|
+
[b]
|
|
98
|
+
), [Y, C] = w({ available: [], loading: !1 }), L = Y.available, ve = p(
|
|
99
|
+
() => L.map((e) => e.key.toString()),
|
|
100
|
+
[L]
|
|
101
|
+
), l = p(
|
|
102
|
+
() => new Map(L.map((e) => [e.key, e])),
|
|
103
|
+
[L]
|
|
104
|
+
), xe = Y.loading, [D, T] = w(!1), $ = p(() => s.toLowerCase(), [s]), k = v(), g = v(null);
|
|
105
|
+
g.current === null && (g.current = Object.fromEntries(
|
|
106
|
+
J.map((e) => [e.key, e])
|
|
107
|
+
));
|
|
108
|
+
const V = v(
|
|
109
|
+
E ?? ue
|
|
110
|
+
), U = p(
|
|
111
|
+
() => R ?? [],
|
|
112
|
+
[R]
|
|
113
|
+
), h = Ue().tagPicker.labels, Z = h.placeholder, ee = h.noMatchesMessage, te = h.loadingMessage, oe = h.emptyState, ae = h.selectedItemsAriaLabel, ne = h.inputAriaLabel, re = f?.placeholder, le = f?.noMatchesMessage, ie = f?.loadingMessage, se = f?.emptyState, ce = f?.selectedItemsAriaLabel, de = f?.inputAriaLabel, S = p(() => ({
|
|
114
|
+
placeholder: re ?? Z,
|
|
115
|
+
noMatchesMessage: le ?? ee,
|
|
116
|
+
loadingMessage: ie ?? te,
|
|
117
|
+
emptyState: se ?? oe,
|
|
118
|
+
selectedItemsAriaLabel: ce ?? ae,
|
|
119
|
+
inputAriaLabel: de ?? ne
|
|
120
|
+
}), [
|
|
121
|
+
re,
|
|
122
|
+
le,
|
|
123
|
+
ie,
|
|
124
|
+
se,
|
|
125
|
+
ce,
|
|
126
|
+
de,
|
|
127
|
+
Z,
|
|
128
|
+
ee,
|
|
129
|
+
te,
|
|
130
|
+
oe,
|
|
131
|
+
ae,
|
|
132
|
+
ne
|
|
133
|
+
]);
|
|
134
|
+
A(() => {
|
|
135
|
+
i.forEach((e) => {
|
|
136
|
+
g.current[e.key] = e;
|
|
137
|
+
});
|
|
138
|
+
}, [i]), A(() => {
|
|
139
|
+
V.current = E ?? ue;
|
|
140
|
+
}, [E]);
|
|
141
|
+
const y = Ze(), Pe = u(
|
|
142
|
+
(e) => (N.get(e) || l.get(e) || g.current[e])?.text || e,
|
|
143
|
+
[N, l]
|
|
144
|
+
), Ne = u(
|
|
145
|
+
(e) => {
|
|
146
|
+
if (!G)
|
|
147
|
+
return;
|
|
148
|
+
const t = N.get(e) || l.get(e) || g.current[e];
|
|
149
|
+
if (!t)
|
|
150
|
+
return;
|
|
151
|
+
const o = V.current(t);
|
|
152
|
+
if (!(o == null || o === !1 || typeof o == "boolean"))
|
|
153
|
+
return o;
|
|
154
|
+
},
|
|
155
|
+
[
|
|
156
|
+
G,
|
|
157
|
+
N,
|
|
158
|
+
l
|
|
159
|
+
]
|
|
160
|
+
);
|
|
161
|
+
A(() => D ? (k.current?.abort(), k.current = new AbortController(), (async () => {
|
|
162
|
+
if (typeof r != "function") {
|
|
163
|
+
const t = O ? O(r) : r;
|
|
164
|
+
C((o) => ({ ...o, available: t }));
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
I?.(
|
|
168
|
+
Te.current,
|
|
169
|
+
ke.current
|
|
170
|
+
);
|
|
171
|
+
try {
|
|
172
|
+
C({ available: [], loading: !0 });
|
|
173
|
+
const t = await r(s, {
|
|
174
|
+
signal: k.current.signal
|
|
175
|
+
}), o = O ? O(t) : t;
|
|
176
|
+
C({ available: o, loading: !1 });
|
|
177
|
+
} catch (t) {
|
|
178
|
+
k.current?.signal.aborted || (console.error("Error loading options:", t), C({ available: [], loading: !1 }), I?.("error", JSON.stringify(t)));
|
|
179
|
+
}
|
|
180
|
+
})(), () => k.current?.abort()) : void 0, [
|
|
181
|
+
D,
|
|
182
|
+
r,
|
|
183
|
+
s,
|
|
184
|
+
O,
|
|
185
|
+
I,
|
|
186
|
+
m
|
|
187
|
+
]);
|
|
188
|
+
const Le = u(() => {
|
|
189
|
+
c || z([]), P?.([], "");
|
|
190
|
+
}, [c, P]), we = u(
|
|
191
|
+
(e, t) => {
|
|
192
|
+
if (t.open && typeof r == "function" && s.length < m) {
|
|
193
|
+
T(!1);
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
t.open && typeof r == "function" && C({ available: [], loading: !0 }), T(t.open);
|
|
197
|
+
},
|
|
198
|
+
[r, s, m]
|
|
199
|
+
), Ae = u(
|
|
200
|
+
(e) => {
|
|
201
|
+
const t = e.target.value;
|
|
202
|
+
H(t), typeof r == "function" && t.length < m && T(!1);
|
|
203
|
+
},
|
|
204
|
+
[r, m]
|
|
205
|
+
), Be = u(
|
|
206
|
+
(e, t) => {
|
|
207
|
+
if (t.value === "no-matches") return;
|
|
208
|
+
let o;
|
|
209
|
+
W ? o = t.selectedOptions : (o = t.selectedOptions.slice(-1), T(!1)), H(""), typeof r == "function" && m > 0 && T(!1);
|
|
210
|
+
const M = o.map((d) => {
|
|
211
|
+
const F = l.get(d) || g.current[d];
|
|
212
|
+
return F && (g.current[d] = F), F || { key: d, text: d };
|
|
213
|
+
});
|
|
214
|
+
c || z(M), P?.(
|
|
215
|
+
M,
|
|
216
|
+
pe(Ke(M))
|
|
217
|
+
);
|
|
218
|
+
},
|
|
219
|
+
[l, P, W, c]
|
|
220
|
+
), Re = De({
|
|
221
|
+
// La consulta actual ingresada por el usuario para filtrar opciones.
|
|
222
|
+
query: s,
|
|
223
|
+
// Lista de claves (como strings) de las opciones disponibles, obtenidas de 'availableOptions'.
|
|
224
|
+
options: ve,
|
|
225
|
+
// Elemento a mostrar cuando no hay opciones disponibles.
|
|
226
|
+
noOptionsElement: xe ? (
|
|
227
|
+
// Si está cargando ('isLoading' es true), muestra un spinner pequeño.
|
|
228
|
+
/* @__PURE__ */ a(
|
|
229
|
+
Ve,
|
|
230
|
+
{
|
|
231
|
+
style: { height: "30px" },
|
|
232
|
+
size: "extra-tiny",
|
|
233
|
+
appearance: "primary",
|
|
234
|
+
label: {
|
|
235
|
+
size: "small",
|
|
236
|
+
children: S.loadingMessage
|
|
237
|
+
// Mensaje como "Buscando información...".
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
)
|
|
241
|
+
) : (
|
|
242
|
+
// Si no está cargando y no hay opciones, muestra un mensaje de "sin coincidencias".
|
|
243
|
+
/* @__PURE__ */ a(
|
|
244
|
+
B,
|
|
245
|
+
{
|
|
246
|
+
value: "no-matches",
|
|
247
|
+
media: /* @__PURE__ */ a(Ye, {}),
|
|
248
|
+
children: S.noMatchesMessage
|
|
249
|
+
}
|
|
250
|
+
)
|
|
251
|
+
),
|
|
252
|
+
/**
|
|
253
|
+
* Función para renderizar una opción individual en la lista.
|
|
254
|
+
* @param {string} optionKey - Clave de la opción a renderizar.
|
|
255
|
+
* @returns {JSX.Element} - Elemento JSX que representa la opción.
|
|
256
|
+
*/
|
|
257
|
+
renderOption: u(
|
|
258
|
+
(e) => {
|
|
259
|
+
const t = l.get(e);
|
|
260
|
+
if (t) {
|
|
261
|
+
const o = V.current(t), M = o != null && o !== !1, d = typeof o == "boolean" ? void 0 : o;
|
|
262
|
+
return !M && t.secondaryContent ? /* @__PURE__ */ a(
|
|
263
|
+
B,
|
|
264
|
+
{
|
|
265
|
+
media: d,
|
|
266
|
+
text: t.text,
|
|
267
|
+
value: t.key,
|
|
268
|
+
children: /* @__PURE__ */ _("div", { className: y.efwTagPickerOptionContentNoMedia, children: [
|
|
269
|
+
/* @__PURE__ */ a("span", { children: t.text }),
|
|
270
|
+
/* @__PURE__ */ a("span", { className: y.efwTagPickerOptionSecondaryNoMedia, children: t.secondaryContent })
|
|
271
|
+
] })
|
|
272
|
+
},
|
|
273
|
+
t.key
|
|
274
|
+
) : /* @__PURE__ */ a(
|
|
275
|
+
B,
|
|
276
|
+
{
|
|
277
|
+
secondaryContent: t.secondaryContent || "",
|
|
278
|
+
media: d,
|
|
279
|
+
text: t.text,
|
|
280
|
+
value: t.key,
|
|
281
|
+
children: t.text
|
|
282
|
+
},
|
|
283
|
+
t.key
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
return (
|
|
287
|
+
// Si no se encuentra la opción, renderiza una versión básica con solo la clave.
|
|
288
|
+
/* @__PURE__ */ a(B, { value: e, children: e }, e)
|
|
289
|
+
);
|
|
290
|
+
},
|
|
291
|
+
[
|
|
292
|
+
l,
|
|
293
|
+
y.efwTagPickerOptionContentNoMedia,
|
|
294
|
+
y.efwTagPickerOptionSecondaryNoMedia
|
|
295
|
+
]
|
|
296
|
+
),
|
|
297
|
+
// Dependencia: se recrea solo si cambia el set de opciones disponibles.
|
|
298
|
+
/**
|
|
299
|
+
* Función de filtrado para determinar qué opciones mostrar.
|
|
300
|
+
* @param {string} optionKey - Clave de la opción a evaluar.
|
|
301
|
+
* @returns {boolean} - True si la opción debe mostrarse, false si no.
|
|
302
|
+
*/
|
|
303
|
+
filter: u(
|
|
304
|
+
(e) => {
|
|
305
|
+
const t = l.get(e);
|
|
306
|
+
return t ? !K.has(e) && t.text.toLowerCase().includes($) : !1;
|
|
307
|
+
},
|
|
308
|
+
[l, K, $]
|
|
309
|
+
)
|
|
310
|
+
}), Ee = Fe(
|
|
311
|
+
ge,
|
|
312
|
+
y.efwTagPickerControl,
|
|
313
|
+
X === "error" && y.efwTagPickerControlError
|
|
314
|
+
);
|
|
315
|
+
if (A(() => {
|
|
316
|
+
c || z(U);
|
|
317
|
+
}, [c, U]), fe) return null;
|
|
318
|
+
if (!me) {
|
|
319
|
+
const e = pe(i) || S.emptyState, t = Oe?.(
|
|
320
|
+
i,
|
|
321
|
+
e
|
|
322
|
+
);
|
|
323
|
+
return t != null ? /* @__PURE__ */ a(Ie, { children: t }) : /* @__PURE__ */ a(_e, { style: i.length ? void 0 : { opacity: 0.7 }, children: e });
|
|
324
|
+
}
|
|
325
|
+
return /* @__PURE__ */ _(
|
|
326
|
+
Qe,
|
|
327
|
+
{
|
|
328
|
+
open: D,
|
|
329
|
+
size: he,
|
|
330
|
+
disabled: j,
|
|
331
|
+
onOptionSelect: Be,
|
|
332
|
+
onOpenChange: we,
|
|
333
|
+
selectedOptions: b,
|
|
334
|
+
noPopover: be,
|
|
335
|
+
children: [
|
|
336
|
+
/* @__PURE__ */ _(
|
|
337
|
+
je,
|
|
338
|
+
{
|
|
339
|
+
className: Ee,
|
|
340
|
+
secondaryAction: !j && b.length ? /* @__PURE__ */ a(
|
|
341
|
+
Xe,
|
|
342
|
+
{
|
|
343
|
+
appearance: "transparent",
|
|
344
|
+
size: "small",
|
|
345
|
+
shape: "rounded",
|
|
346
|
+
onClick: Le,
|
|
347
|
+
icon: /* @__PURE__ */ a($e, {}),
|
|
348
|
+
iconPosition: "before"
|
|
349
|
+
}
|
|
350
|
+
) : void 0,
|
|
351
|
+
children: [
|
|
352
|
+
/* @__PURE__ */ a(qe, { "aria-label": S.selectedItemsAriaLabel, children: b.map((e) => /* @__PURE__ */ a(
|
|
353
|
+
Ge,
|
|
354
|
+
{
|
|
355
|
+
style: { paddingTop: "0px", paddingBottom: "0px" },
|
|
356
|
+
shape: Se,
|
|
357
|
+
appearance: ye,
|
|
358
|
+
media: Ne(e),
|
|
359
|
+
value: e,
|
|
360
|
+
children: Pe(e)
|
|
361
|
+
},
|
|
362
|
+
e
|
|
363
|
+
)) }),
|
|
364
|
+
/* @__PURE__ */ a(
|
|
365
|
+
We,
|
|
366
|
+
{
|
|
367
|
+
placeholder: b.length ? "" : S.placeholder,
|
|
368
|
+
autoComplete: "off",
|
|
369
|
+
"aria-label": S.inputAriaLabel,
|
|
370
|
+
value: s,
|
|
371
|
+
onChange: Ae
|
|
372
|
+
}
|
|
373
|
+
)
|
|
374
|
+
]
|
|
375
|
+
}
|
|
376
|
+
),
|
|
377
|
+
/* @__PURE__ */ a(He, { children: Re })
|
|
378
|
+
]
|
|
379
|
+
}
|
|
380
|
+
);
|
|
381
|
+
};
|
|
382
|
+
export {
|
|
383
|
+
st as EFWTagPicker
|
|
384
|
+
};
|