@erxes/ui 0.0.0-stage → 3.2.19-2
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/LICENSE.md +672 -0
- package/README.md +6 -2
- package/dist/components/accordion.d.ts +7 -0
- package/dist/components/alert-dialog.d.ts +20 -0
- package/dist/components/alert.d.ts +13 -0
- package/dist/components/avatar.d.ts +13 -0
- package/dist/components/background-gradient-animation.d.ts +16 -0
- package/dist/components/badge.d.ts +9 -0
- package/dist/components/breadcrumb.d.ts +19 -0
- package/dist/components/button.d.ts +10 -0
- package/dist/components/calendar.d.ts +5 -0
- package/dist/components/card.d.ts +8 -0
- package/dist/components/charts.d.ts +61 -0
- package/dist/components/checkbox.d.ts +3 -0
- package/dist/components/choicebox-group.d.ts +16 -0
- package/dist/components/collapsible.d.ts +10 -0
- package/dist/components/color-picker.d.ts +34 -0
- package/dist/components/combobox.d.ts +83 -0
- package/dist/components/command-bar.d.ts +17 -0
- package/dist/components/command.d.ts +205 -0
- package/dist/components/context-menu.d.ts +27 -0
- package/dist/components/copy-text.d.ts +7 -0
- package/dist/components/date-picker.d.ts +30 -0
- package/dist/components/dialog.d.ts +30 -0
- package/dist/components/drag-handle.d.ts +3 -0
- package/dist/components/dropdown-menu.d.ts +27 -0
- package/dist/components/empty.d.ts +18 -0
- package/dist/components/erxes-logo-icon.d.ts +1 -0
- package/dist/components/form.d.ts +25 -0
- package/dist/components/hover-card.d.ts +6 -0
- package/dist/components/index.d.ts +59 -0
- package/dist/components/info-card.d.ts +9 -0
- package/dist/components/input.d.ts +296 -0
- package/dist/components/kbd.d.ts +7 -0
- package/dist/components/label.d.ts +6 -0
- package/dist/components/multiselect.d.ts +72 -0
- package/dist/components/popover.d.ts +12 -0
- package/dist/components/radio-group.d.ts +6 -0
- package/dist/components/resizable.d.ts +24 -0
- package/dist/components/scroll-area.d.ts +13 -0
- package/dist/components/search-order-select.d.ts +8 -0
- package/dist/components/select.d.ts +14 -0
- package/dist/components/separator.d.ts +5 -0
- package/dist/components/sheet.d.ts +37 -0
- package/dist/components/sidebar/constants.d.ts +11 -0
- package/dist/components/sidebar/context.d.ts +26 -0
- package/dist/components/sidebar/group.d.ts +9 -0
- package/dist/components/sidebar/hooks.d.ts +2 -0
- package/dist/components/sidebar/layout.d.ts +11 -0
- package/dist/components/sidebar/menu-sub.d.ts +8 -0
- package/dist/components/sidebar/menu.d.ts +22 -0
- package/dist/components/sidebar/panel.d.ts +6 -0
- package/dist/components/sidebar/root.d.ts +9 -0
- package/dist/components/sidebar/trigger.d.ts +2 -0
- package/dist/components/sidebar-tree-indicator.d.ts +8 -0
- package/dist/components/sidebar.d.ts +78 -0
- package/dist/components/skeleton.d.ts +4 -0
- package/dist/components/slider.d.ts +6 -0
- package/dist/components/spinner.d.ts +14 -0
- package/dist/components/stepper.d.ts +28 -0
- package/dist/components/string-array.d.ts +16 -0
- package/dist/components/switch.d.ts +6 -0
- package/dist/components/table.d.ts +10 -0
- package/dist/components/tabs.d.ts +13 -0
- package/dist/components/text-overflow.d.ts +15 -0
- package/dist/components/textarea.d.ts +2 -0
- package/dist/components/time-picker.d.ts +11 -0
- package/dist/components/toaster.d.ts +1 -0
- package/dist/components/toasts.d.ts +19 -0
- package/dist/components/toggle-group.d.ts +12 -0
- package/dist/components/toggle.d.ts +11 -0
- package/dist/components/tooltip.d.ts +7 -0
- package/dist/components/upload-new.d.ts +16 -0
- package/dist/components/upload.d.ts +23 -0
- package/dist/constants/AttachmentGql.d.ts +1 -0
- package/dist/constants/CountryPhoneCodes.d.ts +2 -0
- package/dist/constants/CurrencyCodes.d.ts +6 -0
- package/dist/constants/EmailValidationStatusInfos.d.ts +11 -0
- package/dist/constants/GraphqlConstants.d.ts +3 -0
- package/dist/constants/IanaTimeZones.d.ts +5 -0
- package/dist/constants/IntlLanguages.d.ts +74 -0
- package/dist/constants/PhoneValidationStatusInfos.d.ts +12 -0
- package/dist/constants/SexCodes.d.ts +4 -0
- package/dist/constants/index.d.ts +5 -0
- package/dist/hooks/index.d.ts +9 -0
- package/dist/hooks/use-confirm.d.ts +29 -0
- package/dist/hooks/use-cursor-pagination.d.ts +10 -0
- package/dist/hooks/use-is-matching-location.d.ts +1 -0
- package/dist/hooks/use-media-query.d.ts +1 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-query-state.d.ts +13 -0
- package/dist/hooks/use-toast.d.ts +21 -0
- package/dist/hooks/use-upload-chunked.d.ts +13 -0
- package/dist/hooks/use-upload-new.d.ts +73 -0
- package/dist/hooks/use-upload.d.ts +45 -0
- package/dist/index.d.ts +8 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/utils.d.ts +11 -0
- package/dist/modules/attachments/attachments.d.ts +38 -0
- package/dist/modules/attachments/context.d.ts +12 -0
- package/dist/modules/attachments/index.d.ts +5 -0
- package/dist/modules/attachments/types.d.ts +19 -0
- package/dist/modules/blocks/components/BarcodeAttribute.d.ts +12 -0
- package/dist/modules/blocks/components/BlockEditor.d.ts +42 -0
- package/dist/modules/blocks/components/BlockEditorReadOnly.d.ts +5 -0
- package/dist/modules/blocks/components/CustomFileBlock.d.ts +40 -0
- package/dist/modules/blocks/components/CustomImageBlock.d.ts +79 -0
- package/dist/modules/blocks/components/CustomVideoBlock.d.ts +70 -0
- package/dist/modules/blocks/components/DocumentPlaceholderBlock.d.ts +40 -0
- package/dist/modules/blocks/components/Editor.d.ts +2 -0
- package/dist/modules/blocks/components/FontFamilyButton.d.ts +1 -0
- package/dist/modules/blocks/components/GalleryBlock.d.ts +30 -0
- package/dist/modules/blocks/components/ImageStyleButton.d.ts +1 -0
- package/dist/modules/blocks/components/SlashMenu.d.ts +2 -0
- package/dist/modules/blocks/components/SuggestionMenu.d.ts +7 -0
- package/dist/modules/blocks/components/TableHandleWithRemove.d.ts +2 -0
- package/dist/modules/blocks/components/Toolbar.d.ts +1 -0
- package/dist/modules/blocks/components/index.d.ts +6 -0
- package/dist/modules/blocks/constant/blockEditorSchema.d.ts +712 -0
- package/dist/modules/blocks/constant/index.d.ts +1 -0
- package/dist/modules/blocks/hooks/useBlockEditor.d.ts +7 -0
- package/dist/modules/blocks/index.d.ts +5 -0
- package/dist/modules/blocks/types/TextEditor.d.ts +28 -0
- package/dist/modules/blocks/types/index.d.ts +1 -0
- package/dist/modules/blocks/utils/getBlockAttachments.d.ts +12 -0
- package/dist/modules/blocks/utils/getMentionedUserIds.d.ts +2 -0
- package/dist/modules/blocks/utils/index.d.ts +3 -0
- package/dist/modules/blocks/utils/parseBlocks.d.ts +2 -0
- package/dist/modules/board/components/Board.d.ts +22 -0
- package/dist/modules/board/contexts/BoardContext.d.ts +2 -0
- package/dist/modules/board/index.d.ts +2 -0
- package/dist/modules/board/states/boardStates.d.ts +2 -0
- package/dist/modules/board/types/boardTypes.d.ts +42 -0
- package/dist/modules/chat-viz/components/ChatVizArea.d.ts +9 -0
- package/dist/modules/chat-viz/components/ChatVizBar.d.ts +9 -0
- package/dist/modules/chat-viz/components/ChatVizCartesianDecorations.d.ts +7 -0
- package/dist/modules/chat-viz/components/ChatVizLine.d.ts +9 -0
- package/dist/modules/chat-viz/components/ChatVizMessage.d.ts +16 -0
- package/dist/modules/chat-viz/components/ChatVizPie.d.ts +13 -0
- package/dist/modules/chat-viz/components/ChatVizSendButton.d.ts +17 -0
- package/dist/modules/chat-viz/hooks/useChatVizSend.d.ts +11 -0
- package/dist/modules/chat-viz/hooks/useIsClient.d.ts +8 -0
- package/dist/modules/chat-viz/index.d.ts +12 -0
- package/dist/modules/chat-viz/types/chatVizTypes.d.ts +53 -0
- package/dist/modules/chat-viz/utils/chartVizPresentation.d.ts +10 -0
- package/dist/modules/chat-viz/utils/chartVizTransforms.d.ts +19 -0
- package/dist/modules/chat-viz/utils/chatVizSanitize.d.ts +25 -0
- package/dist/modules/display/components/CurrencyDisplay.d.ts +15 -0
- package/dist/modules/display/components/EllipsisDisplay.d.ts +2 -0
- package/dist/modules/display/components/EmailDisplay.d.ts +2 -0
- package/dist/modules/display/components/PhoneDisplay.d.ts +2 -0
- package/dist/modules/display/components/RelativeDateDisplay.d.ts +288 -0
- package/dist/modules/display/components/SexDisplay.d.ts +4 -0
- package/dist/modules/display/index.d.ts +6 -0
- package/dist/modules/display/utils/formatEmails.d.ts +3 -0
- package/dist/modules/display/utils/formatPhones.d.ts +3 -0
- package/dist/modules/email-editor/components/EmailEditor.d.ts +3 -0
- package/dist/modules/email-editor/components/EmailPreviewDeviceToggle.d.ts +7 -0
- package/dist/modules/email-editor/components/EmailPreviewFrame.d.ts +8 -0
- package/dist/modules/email-editor/components/EmailTableBackground.d.ts +4 -0
- package/dist/modules/email-editor/components/EmailTableToolbar.d.ts +8 -0
- package/dist/modules/email-editor/components/index.d.ts +3 -0
- package/dist/modules/email-editor/constant/index.d.ts +4 -0
- package/dist/modules/email-editor/extensions/documentPlaceholder.d.ts +20 -0
- package/dist/modules/email-editor/extensions/documentPlaceholderBlock.d.ts +19 -0
- package/dist/modules/email-editor/extensions/table.d.ts +38 -0
- package/dist/modules/email-editor/extensions/tableBlock.d.ts +12 -0
- package/dist/modules/email-editor/hooks/useEmailHtml.d.ts +6 -0
- package/dist/modules/email-editor/index.d.ts +6 -0
- package/dist/modules/email-editor/types/index.d.ts +29 -0
- package/dist/modules/email-editor/utils/expandCustomNodes.d.ts +2 -0
- package/dist/modules/email-editor/utils/renderEmailHtml.d.ts +5 -0
- package/dist/modules/filter/components/Filter.d.ts +909 -0
- package/dist/modules/filter/context/FilterContext.d.ts +2 -0
- package/dist/modules/filter/date-filter/components/DateFilterCommand.d.ts +7 -0
- package/dist/modules/filter/date-filter/components/DialogDateView.d.ts +9 -0
- package/dist/modules/filter/date-filter/constants/dateTypes.d.ts +3 -0
- package/dist/modules/filter/date-filter/index.d.ts +2 -0
- package/dist/modules/filter/date-filter/utils/dateTokens.d.ts +8 -0
- package/dist/modules/filter/date-filter/utils/getActiveTab.d.ts +1 -0
- package/dist/modules/filter/date-filter/utils/getDisplayValue.d.ts +1 -0
- package/dist/modules/filter/date-filter/utils/getYears.d.ts +1 -0
- package/dist/modules/filter/date-filter/utils/parseDateRangeFromString.d.ts +4 -0
- package/dist/modules/filter/hooks/useFilterContext.d.ts +1 -0
- package/dist/modules/filter/hooks/useFilterQueryState.d.ts +4 -0
- package/dist/modules/filter/index.d.ts +5 -0
- package/dist/modules/filter/states/filterStates.d.ts +15 -0
- package/dist/modules/filter/types/filter.d.ts +23 -0
- package/dist/modules/focus-sheet/components/focus-sheet.d.ts +51 -0
- package/dist/modules/hotkey/components/PopoverScoped.d.ts +10 -0
- package/dist/modules/hotkey/constants/defaultHotkeysScopeCustomScopes.d.ts +2 -0
- package/dist/modules/hotkey/constants/initialHotkeysScope.d.ts +2 -0
- package/dist/modules/hotkey/hooks/usePreviousHotkeyScope.d.ts +5 -0
- package/dist/modules/hotkey/hooks/useScopedHotKeysCallback.d.ts +9 -0
- package/dist/modules/hotkey/hooks/useScopedHotkeys.d.ts +3 -0
- package/dist/modules/hotkey/hooks/useSequenceHotkeys.d.ts +4 -0
- package/dist/modules/hotkey/hooks/useSetHotkeyScope.d.ts +2 -0
- package/dist/modules/hotkey/index.d.ts +13 -0
- package/dist/modules/hotkey/states/internal/currentHotkeyScopeState.d.ts +4 -0
- package/dist/modules/hotkey/states/internal/internalHotkeysEnabledScopeState.d.ts +3 -0
- package/dist/modules/hotkey/states/internal/pendingHotkeyState.d.ts +2 -0
- package/dist/modules/hotkey/states/internal/previousHotkeyScopeState.d.ts +2 -0
- package/dist/modules/hotkey/states/setHotkeyScopeState.d.ts +5 -0
- package/dist/modules/hotkey/types/AppHotkeyScope.d.ts +7 -0
- package/dist/modules/hotkey/types/CustomHotkeyScope.d.ts +6 -0
- package/dist/modules/hotkey/types/HotkeyScope.d.ts +5 -0
- package/dist/modules/hotkey/utils/isNonTextWritingKey.d.ts +1 -0
- package/dist/modules/icons/components/IconComponent.d.ts +5 -0
- package/dist/modules/icons/components/IconPicker.d.ts +6 -0
- package/dist/modules/icons/components/TablerIcons.d.ts +292 -0
- package/dist/modules/icons/hooks/useIcons.d.ts +4 -0
- package/dist/modules/icons/index.d.ts +3 -0
- package/dist/modules/icons/providers/IconsProvider.d.ts +5 -0
- package/dist/modules/icons/states/iconsState.d.ts +4 -0
- package/dist/modules/index.d.ts +22 -0
- package/dist/modules/inputs/components/CurrencyField.d.ts +442 -0
- package/dist/modules/inputs/components/EmailField.d.ts +30 -0
- package/dist/modules/inputs/components/FullNameField.d.ts +9 -0
- package/dist/modules/inputs/components/LanguageSelect.d.ts +7 -0
- package/dist/modules/inputs/components/NumberField.d.ts +6 -0
- package/dist/modules/inputs/components/PhoneField.d.ts +56 -0
- package/dist/modules/inputs/components/SexField.d.ts +5 -0
- package/dist/modules/inputs/components/TimezoneSelect.d.ts +7 -0
- package/dist/modules/inputs/contexts/EmailFieldsContext.d.ts +8 -0
- package/dist/modules/inputs/contexts/FullNameFieldContext.d.ts +7 -0
- package/dist/modules/inputs/contexts/PhoneFieldsContext.d.ts +6 -0
- package/dist/modules/inputs/hooks/useEmailFields.d.ts +6 -0
- package/dist/modules/inputs/hooks/useFullNameField.d.ts +7 -0
- package/dist/modules/inputs/hooks/usePhoneFields.d.ts +5 -0
- package/dist/modules/inputs/index.d.ts +8 -0
- package/dist/modules/inputs/states/emailFieldStates.d.ts +8 -0
- package/dist/modules/inputs/states/phoneFieldStates.d.ts +8 -0
- package/dist/modules/inputs/validations/emailValidation.d.ts +8 -0
- package/dist/modules/inputs/validations/phoneValidation.d.ts +8 -0
- package/dist/modules/layout/components/Page.d.ts +5 -0
- package/dist/modules/layout/index.d.ts +1 -0
- package/dist/modules/motion/components/TextEffect.d.ts +26 -0
- package/dist/modules/motion/components/TextLoop.d.ts +12 -0
- package/dist/modules/motion/index.d.ts +2 -0
- package/dist/modules/navigation-menu/components/NavigationMenu.d.ts +55 -0
- package/dist/modules/navigation-menu/components/NavigationMenuItemControls.d.ts +11 -0
- package/dist/modules/navigation-menu/index.d.ts +3 -0
- package/dist/modules/navigation-menu/states/activePluginState.d.ts +1 -0
- package/dist/modules/preview/components/Preview.d.ts +43 -0
- package/dist/modules/preview/context/PreviewContext.d.ts +6 -0
- package/dist/modules/record-field/components/NumberField.d.ts +18 -0
- package/dist/modules/record-field/components/TextField.d.ts +17 -0
- package/dist/modules/record-field/index.d.ts +3 -0
- package/dist/modules/record-field/meta-inputs/components/EmailVerificationInput.d.ts +8 -0
- package/dist/modules/record-field/meta-inputs/components/PhoneInput.d.ts +13 -0
- package/dist/modules/record-field/meta-inputs/components/PhoneVerificationInput.d.ts +8 -0
- package/dist/modules/record-field/meta-inputs/components/TextFieldInput.d.ts +4 -0
- package/dist/modules/record-table/components/CheckboxColumn.d.ts +2 -0
- package/dist/modules/record-table/components/MoreColumn.d.ts +3 -0
- package/dist/modules/record-table/components/RecordTableArrowEffect.d.ts +4 -0
- package/dist/modules/record-table/components/RecordTableCell.d.ts +5 -0
- package/dist/modules/record-table/components/RecordTableCellInline.d.ts +14 -0
- package/dist/modules/record-table/components/RecordTableColumnSelector.d.ts +4 -0
- package/dist/modules/record-table/components/RecordTableContainer.d.ts +7 -0
- package/dist/modules/record-table/components/RecordTableCursor.d.ts +20 -0
- package/dist/modules/record-table/components/RecordTableDnDProvider.d.ts +8 -0
- package/dist/modules/record-table/components/RecordTableHead.d.ts +9 -0
- package/dist/modules/record-table/components/RecordTableHeader.d.ts +3 -0
- package/dist/modules/record-table/components/RecordTableHotkeyCell.d.ts +8 -0
- package/dist/modules/record-table/components/RecordTableInlineHead.d.ts +5 -0
- package/dist/modules/record-table/components/RecordTableProvider.d.ts +14 -0
- package/dist/modules/record-table/components/RecordTableRoot.d.ts +2 -0
- package/dist/modules/record-table/components/RecordTableRow.d.ts +6 -0
- package/dist/modules/record-table/components/RecordTableRowList.d.ts +5 -0
- package/dist/modules/record-table/components/RecordTableRowSkeleton.d.ts +6 -0
- package/dist/modules/record-table/components/RecordTableScroll.d.ts +4 -0
- package/dist/modules/record-table/components/RecordTableTree.d.ts +23 -0
- package/dist/modules/record-table/contexts/RecordTableCursorContext.d.ts +2 -0
- package/dist/modules/record-table/contexts/RecordTableHotkeyContext.d.ts +16 -0
- package/dist/modules/record-table/contexts/RecordTableTreeContext.d.ts +2 -0
- package/dist/modules/record-table/hooks/usePopoverOnEnter.d.ts +3 -0
- package/dist/modules/record-table/hooks/useRecordTableCursor.d.ts +6 -0
- package/dist/modules/record-table/hooks/useRecordTableCursorContext.d.ts +1 -0
- package/dist/modules/record-table/hooks/useRecordTableTree.d.ts +9 -0
- package/dist/modules/record-table/hooks/useTablePreferences.d.ts +11 -0
- package/dist/modules/record-table/states/EditModePositionComponentState.d.ts +3 -0
- package/dist/modules/record-table/states/RecordTableCursorState.d.ts +3 -0
- package/dist/modules/record-table/states/RecordTableTreeState.d.ts +3 -0
- package/dist/modules/record-table/types/RecordTableCursorTypes.d.ts +23 -0
- package/dist/modules/record-table/types/RecordTableScope.d.ts +3 -0
- package/dist/modules/record-table/types/RecordTableTreeTypes.d.ts +6 -0
- package/dist/modules/record-table/types/recordTableTypes.d.ts +7 -0
- package/dist/modules/record-table/utils/columnUtils.d.ts +4 -0
- package/dist/modules/record-table/utils/cursorUtils.d.ts +25 -0
- package/dist/modules/report/components/report-page-container.d.ts +4 -0
- package/dist/modules/report/components/report-table.d.ts +19 -0
- package/dist/modules/report/index.d.ts +2 -0
- package/dist/modules/report/states/reportSettingsState.d.ts +13 -0
- package/dist/modules/select-operation/components/SelectOperation.d.ts +17 -0
- package/dist/modules/select-operation/index.d.ts +1 -0
- package/dist/modules/select-tree/components/SelectTree.d.ts +63 -0
- package/dist/modules/select-tree/context/SelectTreeContext.d.ts +3 -0
- package/dist/modules/select-tree/hooks/useSelectTreeHide.d.ts +6 -0
- package/dist/modules/select-tree/index.d.ts +1 -0
- package/dist/modules/select-tree/states/selectTreeStates.d.ts +3 -0
- package/dist/modules/select-tree/types/selectTreeTypes.d.ts +11 -0
- package/dist/modules/side-menu/components/SideMenu.d.ts +34 -0
- package/dist/modules/side-menu/context/SideMenuContext.d.ts +8 -0
- package/dist/state/index.d.ts +2 -0
- package/dist/state/sidebarPanelState.d.ts +1 -0
- package/dist/state/themeState.d.ts +2 -0
- package/dist/types/CountryCode.d.ts +6 -0
- package/dist/types/CurrencyCode.d.ts +159 -0
- package/dist/types/Displays.d.ts +5 -0
- package/dist/types/Gql.d.ts +14 -0
- package/dist/types/Key.d.ts +997 -0
- package/dist/types/Relations.d.ts +13 -0
- package/dist/types/SexCode.d.ts +6 -0
- package/dist/types/Theme.d.ts +2 -0
- package/dist/types/UIConfig.d.ts +167 -0
- package/dist/types/Utils.d.ts +11 -0
- package/dist/types/ValidationStatus.d.ts +4 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/utils/IsUndefinedOrNull.d.ts +1 -0
- package/dist/utils/colors.d.ts +7 -0
- package/dist/utils/config/index.d.ts +14 -0
- package/dist/utils/cookie-storage.d.ts +9 -0
- package/dist/utils/core.d.ts +2 -0
- package/dist/utils/fixOrder.d.ts +4 -0
- package/dist/utils/format/formatAmount.d.ts +1 -0
- package/dist/utils/format/formatPhoneNumber.d.ts +5 -0
- package/dist/utils/format/index.d.ts +2 -0
- package/dist/utils/getPluginAssetsUrl.d.ts +1 -0
- package/dist/utils/highlightMatch.d.ts +1 -0
- package/dist/utils/index.d.ts +18 -0
- package/dist/utils/isAnObject.d.ts +1 -0
- package/dist/utils/isDeeplyEqual.d.ts +3 -0
- package/dist/utils/isDefined.d.ts +1 -0
- package/dist/utils/isEnabled.d.ts +1 -0
- package/dist/utils/localization/detectTimeZone.d.ts +5 -0
- package/dist/utils/localization/formatDateISOStringToRelativeDate.d.ts +2 -0
- package/dist/utils/localization/formatTimeZoneLabel.d.ts +7 -0
- package/dist/utils/localization/index.d.ts +3 -0
- package/dist/utils/logDebug.d.ts +1 -0
- package/dist/utils/regex/index.d.ts +1 -0
- package/dist/utils/regex/passwordRegex.d.ts +1 -0
- package/dist/utils/searchProvider.d.ts +9 -0
- package/dist/utils/string-array.d.ts +6 -0
- package/dist/utils/stripHtml.d.ts +5 -0
- package/dist/utils/urlParser.d.ts +8 -0
- package/dist/utils/videoEmbed.d.ts +14 -0
- package/package.json +106 -4
- package/src/components/__stories__/accordion.stories.tsx +69 -0
- package/src/components/__stories__/alert-dialog.stories.tsx +39 -0
- package/src/components/__stories__/avatar.stories.tsx +32 -0
- package/src/components/__stories__/badge.stories.tsx +46 -0
- package/src/components/__stories__/breadcrumb.stories.tsx +50 -0
- package/src/components/__stories__/button.stories.tsx +22 -0
- package/src/components/__stories__/calendar.stories.tsx +47 -0
- package/src/components/__stories__/calendarTwoMonths.stories.tsx +47 -0
- package/src/components/__stories__/card.stories.tsx +60 -0
- package/src/components/__stories__/checkbox.stories.tsx +74 -0
- package/src/components/__stories__/collapsible.stories.tsx +78 -0
- package/src/components/__stories__/combobox.stories.tsx +158 -0
- package/src/components/__stories__/command.stories.tsx +78 -0
- package/src/components/__stories__/commandbar.stories.tsx +42 -0
- package/src/components/__stories__/date-picker.stories.tsx +83 -0
- package/src/components/__stories__/dialog.stories.tsx +53 -0
- package/src/components/__stories__/dropdown-menu.stories.tsx +140 -0
- package/src/components/__stories__/form.stories.tsx +166 -0
- package/src/components/__stories__/hover-card.stories.tsx +50 -0
- package/src/components/__stories__/input.stories.tsx +75 -0
- package/src/components/__stories__/inputnumber.stories.tsx +35 -0
- package/src/components/__stories__/kbd.stories.tsx +91 -0
- package/src/components/__stories__/label.stories.tsx +82 -0
- package/src/components/__stories__/multiselect.stories.tsx +178 -0
- package/src/components/__stories__/popover.stories.tsx +106 -0
- package/src/components/__stories__/radio-group.stories.tsx +97 -0
- package/src/components/__stories__/resizeble.stories.tsx +76 -0
- package/src/components/__stories__/scroll-area.stories.tsx +36 -0
- package/src/components/__stories__/select.stories.tsx +107 -0
- package/src/components/__stories__/separator.stories.tsx +53 -0
- package/src/components/__stories__/sheet.stories.tsx +62 -0
- package/src/components/__stories__/sidebar.stories.tsx +104 -0
- package/src/components/__stories__/skeleton.stories.tsx +27 -0
- package/src/components/__stories__/slider.stories.tsx +71 -0
- package/src/components/__stories__/spinner.stories.tsx +39 -0
- package/src/components/__stories__/switch.stories.tsx +63 -0
- package/src/components/__stories__/table.stories.tsx +140 -0
- package/src/components/__stories__/tabs.stories.tsx +76 -0
- package/src/components/__stories__/text-overflow.stories.tsx +32 -0
- package/src/components/__stories__/textarea.stories.tsx +75 -0
- package/src/components/__stories__/time-picker.stories.tsx +0 -0
- package/src/components/__stories__/toaster.stories.tsx +53 -0
- package/src/components/__stories__/toggle-group.stories.tsx +50 -0
- package/src/components/__stories__/toggle.stories.tsx +38 -0
- package/src/components/__stories__/tooltip.stories.tsx +90 -0
- package/src/components/accordion.tsx +64 -0
- package/src/components/alert-dialog.tsx +139 -0
- package/src/components/alert.tsx +71 -0
- package/src/components/avatar.tsx +75 -0
- package/src/components/background-gradient-animation.tsx +192 -0
- package/src/components/badge.tsx +61 -0
- package/src/components/breadcrumb.tsx +118 -0
- package/src/components/button.tsx +58 -0
- package/src/components/calendar.tsx +178 -0
- package/src/components/card.tsx +85 -0
- package/src/components/charts.tsx +363 -0
- package/src/components/checkbox.tsx +50 -0
- package/src/components/choicebox-group.tsx +103 -0
- package/src/components/collapsible.tsx +46 -0
- package/src/components/color-picker.tsx +195 -0
- package/src/components/combobox.tsx +212 -0
- package/src/components/command-bar.tsx +108 -0
- package/src/components/command.tsx +261 -0
- package/src/components/context-menu.tsx +183 -0
- package/src/components/copy-text.tsx +52 -0
- package/src/components/date-picker.tsx +418 -0
- package/src/components/dialog.tsx +169 -0
- package/src/components/drag-handle.tsx +30 -0
- package/src/components/dropdown-menu.tsx +186 -0
- package/src/components/empty.tsx +102 -0
- package/src/components/erxes-logo-icon.tsx +16 -0
- package/src/components/form.tsx +174 -0
- package/src/components/hover-card.tsx +27 -0
- package/src/components/index.ts +59 -0
- package/src/components/info-card.tsx +70 -0
- package/src/components/input.tsx +95 -0
- package/src/components/kbd.tsx +30 -0
- package/src/components/label.tsx +35 -0
- package/src/components/multiselect.tsx +647 -0
- package/src/components/popover.tsx +57 -0
- package/src/components/radio-group.tsx +54 -0
- package/src/components/resizable.tsx +47 -0
- package/src/components/scroll-area.tsx +81 -0
- package/src/components/search-order-select.tsx +30 -0
- package/src/components/select.tsx +156 -0
- package/src/components/separator.tsx +50 -0
- package/src/components/sheet.tsx +184 -0
- package/src/components/sidebar/constants.ts +19 -0
- package/src/components/sidebar/context.tsx +206 -0
- package/src/components/sidebar/group.tsx +79 -0
- package/src/components/sidebar/hooks.ts +21 -0
- package/src/components/sidebar/layout.tsx +91 -0
- package/src/components/sidebar/menu-sub.tsx +66 -0
- package/src/components/sidebar/menu.tsx +216 -0
- package/src/components/sidebar/panel.tsx +160 -0
- package/src/components/sidebar/root.tsx +169 -0
- package/src/components/sidebar/trigger.tsx +39 -0
- package/src/components/sidebar-tree-indicator.tsx +125 -0
- package/src/components/sidebar.tsx +66 -0
- package/src/components/skeleton.tsx +29 -0
- package/src/components/slider.tsx +30 -0
- package/src/components/spinner.tsx +168 -0
- package/src/components/stepper.tsx +304 -0
- package/src/components/string-array.tsx +72 -0
- package/src/components/switch.tsx +50 -0
- package/src/components/table.tsx +116 -0
- package/src/components/tabs.tsx +93 -0
- package/src/components/text-overflow.tsx +128 -0
- package/src/components/textarea.tsx +21 -0
- package/src/components/time-picker.tsx +89 -0
- package/src/components/toaster.tsx +42 -0
- package/src/components/toasts.tsx +140 -0
- package/src/components/toggle-group.tsx +68 -0
- package/src/components/toggle.tsx +39 -0
- package/src/components/tooltip.tsx +36 -0
- package/src/components/upload-new.tsx +301 -0
- package/src/components/upload.tsx +335 -0
- package/src/constants/AttachmentGql.ts +9 -0
- package/src/constants/CountryPhoneCodes.ts +360 -0
- package/src/constants/CurrencyCodes.ts +214 -0
- package/src/constants/EmailValidationStatusInfos.tsx +46 -0
- package/src/constants/GraphqlConstants.ts +23 -0
- package/src/constants/IanaTimeZones.ts +600 -0
- package/src/constants/IntlLanguages.ts +74 -0
- package/src/constants/PhoneValidationStatusInfos.tsx +57 -0
- package/src/constants/SexCodes.ts +16 -0
- package/src/constants/index.ts +5 -0
- package/src/hooks/index.ts +9 -0
- package/src/hooks/use-confirm.tsx +212 -0
- package/src/hooks/use-cursor-pagination.tsx +42 -0
- package/src/hooks/use-is-matching-location.tsx +17 -0
- package/src/hooks/use-media-query.tsx +26 -0
- package/src/hooks/use-mobile.tsx +7 -0
- package/src/hooks/use-query-state.tsx +193 -0
- package/src/hooks/use-toast.tsx +188 -0
- package/src/hooks/use-upload-chunked.ts +173 -0
- package/src/hooks/use-upload-new.ts +242 -0
- package/src/hooks/use-upload.tsx +223 -0
- package/src/index.ts +8 -0
- package/src/lib/index.ts +1 -0
- package/src/lib/utils.ts +74 -0
- package/src/modules/__stories__/IconPicker.stories.tsx +19 -0
- package/src/modules/__stories__/RelativeDateDisplay.stories.tsx +97 -0
- package/src/modules/__stories__/blocks.stories.tsx +132 -0
- package/src/modules/__stories__/currencyDisplay.stories.tsx +78 -0
- package/src/modules/__stories__/icons.stories.tsx +29 -0
- package/src/modules/__stories__/preview.stories.tsx +55 -0
- package/src/modules/attachments/attachments.tsx +743 -0
- package/src/modules/attachments/context.tsx +116 -0
- package/src/modules/attachments/index.ts +11 -0
- package/src/modules/attachments/types.ts +72 -0
- package/src/modules/blocks/components/BarcodeAttribute.tsx +142 -0
- package/src/modules/blocks/components/BlockEditor.tsx +248 -0
- package/src/modules/blocks/components/BlockEditorReadOnly.tsx +67 -0
- package/src/modules/blocks/components/CustomFileBlock.tsx +85 -0
- package/src/modules/blocks/components/CustomImageBlock.tsx +366 -0
- package/src/modules/blocks/components/CustomVideoBlock.tsx +118 -0
- package/src/modules/blocks/components/DocumentPlaceholderBlock.tsx +114 -0
- package/src/modules/blocks/components/Editor.tsx +156 -0
- package/src/modules/blocks/components/FontFamilyButton.tsx +121 -0
- package/src/modules/blocks/components/GalleryBlock.tsx +380 -0
- package/src/modules/blocks/components/ImageStyleButton.tsx +100 -0
- package/src/modules/blocks/components/SlashMenu.tsx +76 -0
- package/src/modules/blocks/components/SuggestionMenu.tsx +57 -0
- package/src/modules/blocks/components/TableHandleWithRemove.tsx +238 -0
- package/src/modules/blocks/components/Toolbar.tsx +67 -0
- package/src/modules/blocks/components/index.ts +6 -0
- package/src/modules/blocks/constant/blockEditorSchema.ts +56 -0
- package/src/modules/blocks/constant/index.ts +1 -0
- package/src/modules/blocks/hooks/useBlockEditor.tsx +65 -0
- package/src/modules/blocks/index.ts +5 -0
- package/src/modules/blocks/types/TextEditor.ts +37 -0
- package/src/modules/blocks/types/index.ts +1 -0
- package/src/modules/blocks/utils/getBlockAttachments.ts +68 -0
- package/src/modules/blocks/utils/getMentionedUserIds.ts +22 -0
- package/src/modules/blocks/utils/index.ts +3 -0
- package/src/modules/blocks/utils/parseBlocks.ts +33 -0
- package/src/modules/board/components/Board.tsx +301 -0
- package/src/modules/board/contexts/BoardContext.ts +8 -0
- package/src/modules/board/index.ts +2 -0
- package/src/modules/board/states/boardStates.ts +8 -0
- package/src/modules/board/types/boardTypes.ts +61 -0
- package/src/modules/chat-viz/components/ChatVizArea.tsx +69 -0
- package/src/modules/chat-viz/components/ChatVizBar.tsx +62 -0
- package/src/modules/chat-viz/components/ChatVizCartesianDecorations.tsx +42 -0
- package/src/modules/chat-viz/components/ChatVizLine.tsx +68 -0
- package/src/modules/chat-viz/components/ChatVizMessage.tsx +210 -0
- package/src/modules/chat-viz/components/ChatVizPie.tsx +104 -0
- package/src/modules/chat-viz/components/ChatVizSendButton.tsx +49 -0
- package/src/modules/chat-viz/hooks/useChatVizSend.ts +22 -0
- package/src/modules/chat-viz/hooks/useIsClient.ts +16 -0
- package/src/modules/chat-viz/index.ts +31 -0
- package/src/modules/chat-viz/types/chatVizTypes.ts +59 -0
- package/src/modules/chat-viz/utils/chartVizPresentation.ts +34 -0
- package/src/modules/chat-viz/utils/chartVizTransforms.ts +177 -0
- package/src/modules/chat-viz/utils/chatVizInteractive.test.ts +152 -0
- package/src/modules/chat-viz/utils/chatVizSanitize.ts +276 -0
- package/src/modules/display/components/CurrencyDisplay.tsx +78 -0
- package/src/modules/display/components/EllipsisDisplay.tsx +18 -0
- package/src/modules/display/components/EmailDisplay.tsx +36 -0
- package/src/modules/display/components/PhoneDisplay.tsx +37 -0
- package/src/modules/display/components/RelativeDateDisplay.tsx +53 -0
- package/src/modules/display/components/SexDisplay.tsx +10 -0
- package/src/modules/display/index.ts +6 -0
- package/src/modules/display/utils/formatEmails.ts +29 -0
- package/src/modules/display/utils/formatPhones.ts +29 -0
- package/src/modules/email-editor/components/EmailEditor.tsx +165 -0
- package/src/modules/email-editor/components/EmailPreviewDeviceToggle.tsx +33 -0
- package/src/modules/email-editor/components/EmailPreviewFrame.tsx +35 -0
- package/src/modules/email-editor/components/EmailTableBackground.tsx +134 -0
- package/src/modules/email-editor/components/EmailTableToolbar.tsx +82 -0
- package/src/modules/email-editor/components/index.ts +3 -0
- package/src/modules/email-editor/constant/index.ts +63 -0
- package/src/modules/email-editor/extensions/documentPlaceholder.ts +114 -0
- package/src/modules/email-editor/extensions/documentPlaceholderBlock.tsx +36 -0
- package/src/modules/email-editor/extensions/table.ts +352 -0
- package/src/modules/email-editor/extensions/tableBlock.tsx +13 -0
- package/src/modules/email-editor/hooks/useEmailHtml.ts +36 -0
- package/src/modules/email-editor/index.ts +6 -0
- package/src/modules/email-editor/maily-subpaths.d.ts +90 -0
- package/src/modules/email-editor/types/index.ts +37 -0
- package/src/modules/email-editor/utils/expandCustomNodes.ts +190 -0
- package/src/modules/email-editor/utils/renderEmailHtml.ts +52 -0
- package/src/modules/filter/components/Filter.tsx +568 -0
- package/src/modules/filter/context/FilterContext.tsx +6 -0
- package/src/modules/filter/date-filter/components/DateFilterCommand.tsx +59 -0
- package/src/modules/filter/date-filter/components/DialogDateView.tsx +270 -0
- package/src/modules/filter/date-filter/constants/dateTypes.tsx +25 -0
- package/src/modules/filter/date-filter/index.ts +2 -0
- package/src/modules/filter/date-filter/utils/dateTokens.ts +28 -0
- package/src/modules/filter/date-filter/utils/getActiveTab.ts +17 -0
- package/src/modules/filter/date-filter/utils/getDisplayValue.ts +49 -0
- package/src/modules/filter/date-filter/utils/getYears.ts +13 -0
- package/src/modules/filter/date-filter/utils/parseDateRangeFromString.ts +101 -0
- package/src/modules/filter/hooks/useFilterContext.tsx +6 -0
- package/src/modules/filter/hooks/useFilterQueryState.tsx +24 -0
- package/src/modules/filter/index.ts +5 -0
- package/src/modules/filter/states/filterStates.ts +14 -0
- package/src/modules/filter/types/filter.ts +29 -0
- package/src/modules/focus-sheet/components/focus-sheet.tsx +335 -0
- package/src/modules/hotkey/components/PopoverScoped.tsx +77 -0
- package/src/modules/hotkey/constants/defaultHotkeysScopeCustomScopes.ts +6 -0
- package/src/modules/hotkey/constants/initialHotkeysScope.ts +12 -0
- package/src/modules/hotkey/hooks/usePreviousHotkeyScope.tsx +59 -0
- package/src/modules/hotkey/hooks/useScopedHotKeysCallback.tsx +83 -0
- package/src/modules/hotkey/hooks/useScopedHotkeys.tsx +61 -0
- package/src/modules/hotkey/hooks/useSequenceHotkeys.tsx +79 -0
- package/src/modules/hotkey/hooks/useSetHotkeyScope.tsx +27 -0
- package/src/modules/hotkey/index.ts +18 -0
- package/src/modules/hotkey/states/internal/currentHotkeyScopeState.ts +6 -0
- package/src/modules/hotkey/states/internal/internalHotkeysEnabledScopeState.ts +3 -0
- package/src/modules/hotkey/states/internal/pendingHotkeyState.ts +4 -0
- package/src/modules/hotkey/states/internal/previousHotkeyScopeState.ts +4 -0
- package/src/modules/hotkey/states/setHotkeyScopeState.ts +92 -0
- package/src/modules/hotkey/types/AppHotkeyScope.ts +7 -0
- package/src/modules/hotkey/types/CustomHotkeyScope.ts +6 -0
- package/src/modules/hotkey/types/HotkeyScope.ts +6 -0
- package/src/modules/hotkey/utils/isNonTextWritingKey.ts +57 -0
- package/src/modules/icons/components/IconComponent.tsx +13 -0
- package/src/modules/icons/components/IconPicker.tsx +55 -0
- package/src/modules/icons/components/TablerIcons.ts +585 -0
- package/src/modules/icons/hooks/useIcons.ts +23 -0
- package/src/modules/icons/index.ts +3 -0
- package/src/modules/icons/providers/IconsProvider.tsx +20 -0
- package/src/modules/icons/states/iconsState.ts +4 -0
- package/src/modules/index.ts +22 -0
- package/src/modules/inputs/components/CurrencyField.tsx +217 -0
- package/src/modules/inputs/components/EmailField.tsx +425 -0
- package/src/modules/inputs/components/FullNameField.tsx +121 -0
- package/src/modules/inputs/components/LanguageSelect.tsx +46 -0
- package/src/modules/inputs/components/NumberField.tsx +29 -0
- package/src/modules/inputs/components/PhoneField.tsx +491 -0
- package/src/modules/inputs/components/SexField.tsx +31 -0
- package/src/modules/inputs/components/TimezoneSelect.tsx +48 -0
- package/src/modules/inputs/contexts/EmailFieldsContext.tsx +15 -0
- package/src/modules/inputs/contexts/FullNameFieldContext.tsx +9 -0
- package/src/modules/inputs/contexts/PhoneFieldsContext.tsx +12 -0
- package/src/modules/inputs/hooks/useEmailFields.tsx +4 -0
- package/src/modules/inputs/hooks/useFullNameField.tsx +12 -0
- package/src/modules/inputs/hooks/usePhoneFields.tsx +4 -0
- package/src/modules/inputs/index.ts +8 -0
- package/src/modules/inputs/states/emailFieldStates.ts +15 -0
- package/src/modules/inputs/states/phoneFieldStates.ts +15 -0
- package/src/modules/inputs/validations/emailValidation.ts +7 -0
- package/src/modules/inputs/validations/phoneValidation.ts +12 -0
- package/src/modules/layout/components/Page.tsx +37 -0
- package/src/modules/layout/index.ts +1 -0
- package/src/modules/motion/components/TextEffect.tsx +288 -0
- package/src/modules/motion/components/TextLoop.tsx +71 -0
- package/src/modules/motion/index.ts +2 -0
- package/src/modules/navigation-menu/components/NavigationMenu.tsx +182 -0
- package/src/modules/navigation-menu/components/NavigationMenuItemControls.tsx +18 -0
- package/src/modules/navigation-menu/index.ts +3 -0
- package/src/modules/navigation-menu/states/activePluginState.tsx +10 -0
- package/src/modules/preview/components/Preview.tsx +108 -0
- package/src/modules/preview/context/PreviewContext.tsx +16 -0
- package/src/modules/record-field/components/NumberField.tsx +124 -0
- package/src/modules/record-field/components/TextField.tsx +103 -0
- package/src/modules/record-field/index.ts +3 -0
- package/src/modules/record-field/meta-inputs/components/EmailVerificationInput.tsx +95 -0
- package/src/modules/record-field/meta-inputs/components/PhoneInput.tsx +217 -0
- package/src/modules/record-field/meta-inputs/components/PhoneVerificationInput.tsx +80 -0
- package/src/modules/record-field/meta-inputs/components/TextFieldInput.tsx +17 -0
- package/src/modules/record-table/components/CheckboxColumn.tsx +107 -0
- package/src/modules/record-table/components/MoreColumn.tsx +26 -0
- package/src/modules/record-table/components/RecordTableArrowEffect.tsx +67 -0
- package/src/modules/record-table/components/RecordTableCell.tsx +43 -0
- package/src/modules/record-table/components/RecordTableCellInline.tsx +104 -0
- package/src/modules/record-table/components/RecordTableColumnSelector.tsx +204 -0
- package/src/modules/record-table/components/RecordTableContainer.tsx +70 -0
- package/src/modules/record-table/components/RecordTableCursor.tsx +143 -0
- package/src/modules/record-table/components/RecordTableDnDProvider.tsx +63 -0
- package/src/modules/record-table/components/RecordTableHead.tsx +143 -0
- package/src/modules/record-table/components/RecordTableHeader.tsx +91 -0
- package/src/modules/record-table/components/RecordTableHotkeyCell.tsx +97 -0
- package/src/modules/record-table/components/RecordTableInlineHead.tsx +13 -0
- package/src/modules/record-table/components/RecordTableProvider.tsx +201 -0
- package/src/modules/record-table/components/RecordTableRoot.tsx +17 -0
- package/src/modules/record-table/components/RecordTableRow.tsx +42 -0
- package/src/modules/record-table/components/RecordTableRowList.tsx +47 -0
- package/src/modules/record-table/components/RecordTableRowSkeleton.tsx +66 -0
- package/src/modules/record-table/components/RecordTableScroll.tsx +23 -0
- package/src/modules/record-table/components/RecordTableTree.tsx +135 -0
- package/src/modules/record-table/contexts/RecordTableCursorContext.tsx +5 -0
- package/src/modules/record-table/contexts/RecordTableHotkeyContext.tsx +56 -0
- package/src/modules/record-table/contexts/RecordTableTreeContext.tsx +6 -0
- package/src/modules/record-table/hooks/usePopoverOnEnter.tsx +38 -0
- package/src/modules/record-table/hooks/useRecordTableCursor.tsx +22 -0
- package/src/modules/record-table/hooks/useRecordTableCursorContext.tsx +12 -0
- package/src/modules/record-table/hooks/useRecordTableTree.tsx +44 -0
- package/src/modules/record-table/hooks/useTablePreferences.ts +45 -0
- package/src/modules/record-table/index.ts +52 -0
- package/src/modules/record-table/states/EditModePositionComponentState.ts +7 -0
- package/src/modules/record-table/states/RecordTableCursorState.ts +6 -0
- package/src/modules/record-table/states/RecordTableTreeState.ts +6 -0
- package/src/modules/record-table/types/RecordTableCursorTypes.ts +26 -0
- package/src/modules/record-table/types/RecordTableScope.ts +3 -0
- package/src/modules/record-table/types/RecordTableTreeTypes.ts +6 -0
- package/src/modules/record-table/types/recordTableTypes.ts +8 -0
- package/src/modules/record-table/utils/columnUtils.ts +10 -0
- package/src/modules/record-table/utils/cursorUtils.ts +66 -0
- package/src/modules/report/components/report-page-container.tsx +179 -0
- package/src/modules/report/components/report-table.tsx +123 -0
- package/src/modules/report/index.ts +2 -0
- package/src/modules/report/states/reportSettingsState.ts +9 -0
- package/src/modules/select-operation/components/SelectOperation.tsx +167 -0
- package/src/modules/select-operation/index.ts +1 -0
- package/src/modules/select-tree/components/SelectTree.tsx +182 -0
- package/src/modules/select-tree/context/SelectTreeContext.tsx +15 -0
- package/src/modules/select-tree/hooks/useSelectTreeHide.tsx +29 -0
- package/src/modules/select-tree/index.ts +1 -0
- package/src/modules/select-tree/states/selectTreeStates.tsx +5 -0
- package/src/modules/select-tree/types/selectTreeTypes.ts +14 -0
- package/src/modules/side-menu/components/SideMenu.tsx +143 -0
- package/src/modules/side-menu/context/SideMenuContext.tsx +20 -0
- package/src/state/index.ts +2 -0
- package/src/state/sidebarPanelState.ts +8 -0
- package/src/state/themeState.ts +4 -0
- package/src/theme.css +275 -0
- package/src/types/CountryCode.ts +6 -0
- package/src/types/CurrencyCode.ts +161 -0
- package/src/types/Displays.ts +6 -0
- package/src/types/Gql.ts +34 -0
- package/src/types/Key.ts +1312 -0
- package/src/types/Relations.ts +14 -0
- package/src/types/SexCode.ts +6 -0
- package/src/types/Theme.ts +2 -0
- package/src/types/UIConfig.ts +198 -0
- package/src/types/Utils.ts +12 -0
- package/src/types/ValidationStatus.ts +4 -0
- package/src/types/index.ts +11 -0
- package/src/utils/IsUndefinedOrNull.ts +4 -0
- package/src/utils/colors.ts +68 -0
- package/src/utils/config/index.ts +83 -0
- package/src/utils/cookie-storage.ts +29 -0
- package/src/utils/core.ts +82 -0
- package/src/utils/fixOrder.ts +16 -0
- package/src/utils/format/formatAmount.ts +17 -0
- package/src/utils/format/formatPhoneNumber.ts +11 -0
- package/src/utils/format/index.ts +2 -0
- package/src/utils/getPluginAssetsUrl.ts +16 -0
- package/src/utils/highlightMatch.tsx +35 -0
- package/src/utils/index.ts +18 -0
- package/src/utils/isAnObject.ts +3 -0
- package/src/utils/isDeeplyEqual.ts +4 -0
- package/src/utils/isDefined.ts +4 -0
- package/src/utils/isEnabled.ts +7 -0
- package/src/utils/localization/detectTimeZone.ts +6 -0
- package/src/utils/localization/formatDateISOStringToRelativeDate.ts +39 -0
- package/src/utils/localization/formatTimeZoneLabel.ts +29 -0
- package/src/utils/localization/index.ts +3 -0
- package/src/utils/logDebug.ts +4 -0
- package/src/utils/regex/index.ts +1 -0
- package/src/utils/regex/passwordRegex.ts +1 -0
- package/src/utils/searchProvider.ts +77 -0
- package/src/utils/string-array.ts +24 -0
- package/src/utils/stripHtml.ts +15 -0
- package/src/utils/urlParser.ts +66 -0
- package/src/utils/videoEmbed.ts +56 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
import { useBlockEditor } from '../hooks/useBlockEditor';
|
|
3
|
+
import { BlockEditor } from './BlockEditor';
|
|
4
|
+
import { Block } from '@blocknote/core';
|
|
5
|
+
import { BlockEditorProps, IEditorProps } from '../types';
|
|
6
|
+
import { cn } from 'erxes-ui/lib';
|
|
7
|
+
import { parseBlocks } from '../utils';
|
|
8
|
+
|
|
9
|
+
export const Editor = ({
|
|
10
|
+
onChange,
|
|
11
|
+
initialContent,
|
|
12
|
+
scope,
|
|
13
|
+
className,
|
|
14
|
+
isHTML = false,
|
|
15
|
+
uploadFile,
|
|
16
|
+
...props
|
|
17
|
+
}: Omit<BlockEditorProps, 'editor' | 'onChange'> & IEditorProps) => {
|
|
18
|
+
const skipNextOnChangeRef = useRef(false);
|
|
19
|
+
const debounceTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
20
|
+
const lastEditorOutputRef = useRef<string>('');
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
return () => {
|
|
24
|
+
if (debounceTimerRef.current) clearTimeout(debounceTimerRef.current);
|
|
25
|
+
};
|
|
26
|
+
}, []);
|
|
27
|
+
const parsedInitialContent = parseBlocks(initialContent ?? '');
|
|
28
|
+
const editor = useBlockEditor({
|
|
29
|
+
initialContent: parsedInitialContent || undefined,
|
|
30
|
+
uploadFile,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (!isHTML || !initialContent) return;
|
|
35
|
+
|
|
36
|
+
let isActive = true;
|
|
37
|
+
|
|
38
|
+
const syncHTMLContent = async () => {
|
|
39
|
+
// Skip if this change was emitted by the editor itself — no need to re-sync
|
|
40
|
+
if (initialContent === lastEditorOutputRef.current) return;
|
|
41
|
+
|
|
42
|
+
// Support legacy JSON content stored before isHTML mode was introduced
|
|
43
|
+
const parsed = parseBlocks(initialContent);
|
|
44
|
+
if (parsed) {
|
|
45
|
+
const currentSerialized = JSON.stringify(editor.document);
|
|
46
|
+
const nextSerialized = JSON.stringify(parsed);
|
|
47
|
+
if (isActive && currentSerialized !== nextSerialized) {
|
|
48
|
+
skipNextOnChangeRef.current = true;
|
|
49
|
+
editor.replaceBlocks(editor.document, parsed);
|
|
50
|
+
}
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
try {
|
|
55
|
+
const blocks = await editor.tryParseHTMLToBlocks(initialContent);
|
|
56
|
+
if (!isActive) return;
|
|
57
|
+
|
|
58
|
+
const currentSerialized = JSON.stringify(editor.document);
|
|
59
|
+
const nextSerialized = JSON.stringify(blocks);
|
|
60
|
+
if (currentSerialized !== nextSerialized) {
|
|
61
|
+
skipNextOnChangeRef.current = true;
|
|
62
|
+
editor.replaceBlocks(editor.document, blocks);
|
|
63
|
+
}
|
|
64
|
+
} catch {
|
|
65
|
+
// ignore
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
syncHTMLContent();
|
|
70
|
+
|
|
71
|
+
return () => {
|
|
72
|
+
isActive = false;
|
|
73
|
+
};
|
|
74
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
75
|
+
}, [editor, initialContent, isHTML]);
|
|
76
|
+
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
if (isHTML) return;
|
|
79
|
+
|
|
80
|
+
let isActive = true;
|
|
81
|
+
const syncContent = async () => {
|
|
82
|
+
const parsed = parseBlocks(initialContent ?? '');
|
|
83
|
+
if (parsed) {
|
|
84
|
+
const currentSerialized = JSON.stringify(editor.document);
|
|
85
|
+
const nextSerialized = JSON.stringify(parsed);
|
|
86
|
+
|
|
87
|
+
if (!isActive) return;
|
|
88
|
+
|
|
89
|
+
if (currentSerialized !== nextSerialized) {
|
|
90
|
+
skipNextOnChangeRef.current = true;
|
|
91
|
+
editor.replaceBlocks(editor.document, parsed);
|
|
92
|
+
}
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (typeof initialContent !== 'string' || !initialContent.trim()) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
try {
|
|
101
|
+
const blocks = await editor.tryParseHTMLToBlocks(initialContent);
|
|
102
|
+
if (!isActive) return;
|
|
103
|
+
|
|
104
|
+
const currentSerialized = JSON.stringify(editor.document);
|
|
105
|
+
const nextSerialized = JSON.stringify(blocks);
|
|
106
|
+
|
|
107
|
+
if (currentSerialized !== nextSerialized) {
|
|
108
|
+
skipNextOnChangeRef.current = true;
|
|
109
|
+
editor.replaceBlocks(editor.document, blocks);
|
|
110
|
+
}
|
|
111
|
+
} catch {
|
|
112
|
+
// ignore parsing errors for legacy/plain text content
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
syncContent();
|
|
117
|
+
|
|
118
|
+
return () => {
|
|
119
|
+
isActive = false;
|
|
120
|
+
};
|
|
121
|
+
}, [editor, initialContent, isHTML]);
|
|
122
|
+
|
|
123
|
+
const handleChange = useCallback(() => {
|
|
124
|
+
if (skipNextOnChangeRef.current) {
|
|
125
|
+
skipNextOnChangeRef.current = false;
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (debounceTimerRef.current) clearTimeout(debounceTimerRef.current);
|
|
130
|
+
|
|
131
|
+
debounceTimerRef.current = setTimeout(async () => {
|
|
132
|
+
const content = editor?.document;
|
|
133
|
+
if (!content) return;
|
|
134
|
+
if (isHTML) {
|
|
135
|
+
const htmlContent = await editor.blocksToHTMLLossy(content as Block[]);
|
|
136
|
+
lastEditorOutputRef.current = htmlContent;
|
|
137
|
+
onChange(htmlContent);
|
|
138
|
+
} else {
|
|
139
|
+
onChange(JSON.stringify(content));
|
|
140
|
+
}
|
|
141
|
+
}, 300);
|
|
142
|
+
}, [editor, isHTML, onChange]);
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<BlockEditor
|
|
146
|
+
variant="outline"
|
|
147
|
+
className={cn(
|
|
148
|
+
'min-w-0 w-full overflow-x-hidden overflow-y-auto h-28 rounded-md min-h-28 styled-scroll shadow-xs transition-[color,box-shadow] pt-1',
|
|
149
|
+
className,
|
|
150
|
+
)}
|
|
151
|
+
{...props}
|
|
152
|
+
editor={editor}
|
|
153
|
+
onChange={handleChange}
|
|
154
|
+
/>
|
|
155
|
+
);
|
|
156
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useBlockNoteEditor,
|
|
3
|
+
useComponentsContext,
|
|
4
|
+
useEditorContentOrSelectionChange,
|
|
5
|
+
} from '@blocknote/react';
|
|
6
|
+
import { useState } from 'react';
|
|
7
|
+
import { IconTypography, IconCheck } from '@tabler/icons-react';
|
|
8
|
+
|
|
9
|
+
interface FontStyles {
|
|
10
|
+
fontFamily?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface BlockSpecConfig {
|
|
14
|
+
config?: { isFileBlock?: boolean };
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface EditorWithFontFamily {
|
|
18
|
+
addStyles(styles: FontStyles): void;
|
|
19
|
+
removeStyles(styles: FontStyles): void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const FONT_FAMILIES = [
|
|
23
|
+
{ name: 'Default', value: '' },
|
|
24
|
+
{ name: 'Arial', value: 'Arial, sans-serif' },
|
|
25
|
+
{ name: 'Helvetica', value: 'Helvetica, sans-serif' },
|
|
26
|
+
{ name: 'Times New Roman', value: '"Times New Roman", serif' },
|
|
27
|
+
{ name: 'Georgia', value: 'Georgia, serif' },
|
|
28
|
+
{ name: 'Garamond', value: 'Garamond, serif' },
|
|
29
|
+
{ name: 'Courier New', value: '"Courier New", monospace' },
|
|
30
|
+
{ name: 'Verdana', value: 'Verdana, sans-serif' },
|
|
31
|
+
{ name: 'Trebuchet MS', value: '"Trebuchet MS", sans-serif' },
|
|
32
|
+
{ name: 'Palatino', value: 'Palatino, serif' },
|
|
33
|
+
{ name: 'Tahoma', value: 'Tahoma, sans-serif' },
|
|
34
|
+
{ name: 'Century Gothic', value: '"Century Gothic", sans-serif' },
|
|
35
|
+
{ name: 'Lucida Sans', value: '"Lucida Sans", sans-serif' },
|
|
36
|
+
{ name: 'Monaco', value: 'Monaco, monospace' },
|
|
37
|
+
{ name: 'Consolas', value: 'Consolas, monospace' },
|
|
38
|
+
{ name: 'Calibri', value: 'Calibri, sans-serif' },
|
|
39
|
+
{ name: 'Cambria', value: 'Cambria, serif' },
|
|
40
|
+
{ name: 'Didot', value: 'Didot, serif' },
|
|
41
|
+
{ name: 'Rockwell', value: 'Rockwell, serif' },
|
|
42
|
+
{ name: 'Franklin Gothic', value: '"Franklin Gothic Medium", sans-serif' },
|
|
43
|
+
{ name: 'Impact', value: 'Impact, fantasy' },
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
export const FontFamilyButton = () => {
|
|
47
|
+
const editor = useBlockNoteEditor();
|
|
48
|
+
const Components = useComponentsContext();
|
|
49
|
+
const [currentFont, setCurrentFont] = useState('');
|
|
50
|
+
const [isFileBlock, setIsFileBlock] = useState(false);
|
|
51
|
+
|
|
52
|
+
useEditorContentOrSelectionChange(() => {
|
|
53
|
+
if (!editor) return;
|
|
54
|
+
try {
|
|
55
|
+
const styles = editor.getActiveStyles() as FontStyles;
|
|
56
|
+
setCurrentFont(styles?.fontFamily || '');
|
|
57
|
+
const block = editor.getTextCursorPosition()?.block;
|
|
58
|
+
const blockSpecs = editor.schema.blockSpecs as Record<
|
|
59
|
+
string,
|
|
60
|
+
BlockSpecConfig
|
|
61
|
+
>;
|
|
62
|
+
const blockSpec = block ? blockSpecs[block.type] : null;
|
|
63
|
+
setIsFileBlock(!!blockSpec?.config?.isFileBlock);
|
|
64
|
+
} catch {
|
|
65
|
+
// ignore
|
|
66
|
+
}
|
|
67
|
+
}, editor);
|
|
68
|
+
|
|
69
|
+
const handleFontChange = (fontValue: string) => {
|
|
70
|
+
if (!editor) return;
|
|
71
|
+
|
|
72
|
+
try {
|
|
73
|
+
const typedEditor = editor as unknown as EditorWithFontFamily;
|
|
74
|
+
if (fontValue === '') {
|
|
75
|
+
typedEditor.removeStyles({ fontFamily: '' });
|
|
76
|
+
} else {
|
|
77
|
+
typedEditor.addStyles({ fontFamily: fontValue });
|
|
78
|
+
}
|
|
79
|
+
editor.focus();
|
|
80
|
+
} catch (error) {
|
|
81
|
+
console.error('Error changing font:', error);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
if (!Components || isFileBlock) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const currentFontName =
|
|
90
|
+
FONT_FAMILIES.find((f) => f.value === currentFont)?.name || 'Default';
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<Components.Generic.Menu.Root>
|
|
94
|
+
<Components.Generic.Menu.Trigger>
|
|
95
|
+
<Components.FormattingToolbar.Button
|
|
96
|
+
className="bn-button"
|
|
97
|
+
label="Font"
|
|
98
|
+
mainTooltip="Font Family"
|
|
99
|
+
icon={<IconTypography size={16} />}
|
|
100
|
+
/>
|
|
101
|
+
</Components.Generic.Menu.Trigger>
|
|
102
|
+
<Components.Generic.Menu.Dropdown className="bn-menu-dropdown bn-drag-handle-menu">
|
|
103
|
+
{FONT_FAMILIES.map((font) => (
|
|
104
|
+
<Components.Generic.Menu.Item
|
|
105
|
+
key={font.value || 'default'}
|
|
106
|
+
onClick={() => handleFontChange(font.value)}
|
|
107
|
+
>
|
|
108
|
+
<div
|
|
109
|
+
className="flex items-center gap-2 w-full"
|
|
110
|
+
style={{ fontFamily: font.value }}
|
|
111
|
+
>
|
|
112
|
+
{currentFont === font.value && <IconCheck size={14} />}
|
|
113
|
+
{currentFont !== font.value && <span className="w-[14px]" />}
|
|
114
|
+
{font.name}
|
|
115
|
+
</div>
|
|
116
|
+
</Components.Generic.Menu.Item>
|
|
117
|
+
))}
|
|
118
|
+
</Components.Generic.Menu.Dropdown>
|
|
119
|
+
</Components.Generic.Menu.Root>
|
|
120
|
+
);
|
|
121
|
+
};
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DefaultInlineContentSchema,
|
|
3
|
+
DefaultStyleSchema,
|
|
4
|
+
} from '@blocknote/core';
|
|
5
|
+
import {
|
|
6
|
+
createReactBlockSpec,
|
|
7
|
+
ReactCustomBlockRenderProps,
|
|
8
|
+
useResolveUrl,
|
|
9
|
+
} from '@blocknote/react';
|
|
10
|
+
import {
|
|
11
|
+
IconLayoutGrid,
|
|
12
|
+
IconPhoto,
|
|
13
|
+
IconPlus,
|
|
14
|
+
IconX,
|
|
15
|
+
IconLoader2,
|
|
16
|
+
} from '@tabler/icons-react';
|
|
17
|
+
import { FC, useRef, useState } from 'react';
|
|
18
|
+
import { cn } from 'erxes-ui/lib';
|
|
19
|
+
import { readImage } from 'erxes-ui/utils';
|
|
20
|
+
import { Button, Spinner } from 'erxes-ui/components';
|
|
21
|
+
import { Attachments } from 'erxes-ui/modules/attachments';
|
|
22
|
+
import { useToast } from 'erxes-ui/hooks';
|
|
23
|
+
|
|
24
|
+
export interface GalleryImage {
|
|
25
|
+
url: string;
|
|
26
|
+
caption?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const COLUMN_OPTIONS = [2, 3, 4] as const;
|
|
30
|
+
|
|
31
|
+
const galleryBlockConfig = {
|
|
32
|
+
type: 'gallery' as const,
|
|
33
|
+
propSchema: {
|
|
34
|
+
images: {
|
|
35
|
+
default: '[]' as string,
|
|
36
|
+
},
|
|
37
|
+
columns: {
|
|
38
|
+
default: '3' as string,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
content: 'none' as const,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
type GalleryRenderProps = ReactCustomBlockRenderProps<
|
|
45
|
+
typeof galleryBlockConfig,
|
|
46
|
+
DefaultInlineContentSchema,
|
|
47
|
+
DefaultStyleSchema
|
|
48
|
+
>;
|
|
49
|
+
|
|
50
|
+
const parseImages = (raw: string): GalleryImage[] => {
|
|
51
|
+
try {
|
|
52
|
+
const parsed = JSON.parse(raw);
|
|
53
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
54
|
+
} catch {
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const GalleryItem: FC<{
|
|
60
|
+
image: GalleryImage;
|
|
61
|
+
readonly: boolean;
|
|
62
|
+
onRemove: () => void;
|
|
63
|
+
onPreview: () => void;
|
|
64
|
+
}> = ({ image, readonly, onRemove, onPreview }) => {
|
|
65
|
+
const { loadingState, downloadUrl } = useResolveUrl(image.url);
|
|
66
|
+
const isResolving = loadingState === 'loading';
|
|
67
|
+
const src = downloadUrl ?? image.url;
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<div className="relative group aspect-square overflow-hidden rounded-md bg-muted">
|
|
71
|
+
{isResolving ? (
|
|
72
|
+
<div className="flex h-full w-full items-center justify-center">
|
|
73
|
+
<Spinner size="sm" />
|
|
74
|
+
</div>
|
|
75
|
+
) : (
|
|
76
|
+
<Button
|
|
77
|
+
variant="ghost"
|
|
78
|
+
aria-label="Preview image"
|
|
79
|
+
className="h-full w-full p-0 rounded-none"
|
|
80
|
+
onClick={onPreview}
|
|
81
|
+
>
|
|
82
|
+
<img
|
|
83
|
+
src={src}
|
|
84
|
+
alt={image.caption ?? ''}
|
|
85
|
+
style={{
|
|
86
|
+
width: '100%',
|
|
87
|
+
height: '100%',
|
|
88
|
+
objectFit: 'cover',
|
|
89
|
+
display: 'block',
|
|
90
|
+
}}
|
|
91
|
+
draggable={false}
|
|
92
|
+
/>
|
|
93
|
+
</Button>
|
|
94
|
+
)}
|
|
95
|
+
|
|
96
|
+
{!readonly && (
|
|
97
|
+
<Button
|
|
98
|
+
variant="ghost"
|
|
99
|
+
aria-label="Remove image"
|
|
100
|
+
className="absolute top-1 right-1 h-5 w-5 p-0 rounded-full bg-black/50 text-white opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-opacity [&>svg]:size-3"
|
|
101
|
+
onMouseDown={(e) => e.preventDefault()}
|
|
102
|
+
onClick={onRemove}
|
|
103
|
+
>
|
|
104
|
+
<IconX />
|
|
105
|
+
</Button>
|
|
106
|
+
)}
|
|
107
|
+
{image.caption && (
|
|
108
|
+
<div className="absolute bottom-0 inset-x-0 bg-black/50 text-white text-xs px-1.5 py-0.5 truncate">
|
|
109
|
+
{image.caption}
|
|
110
|
+
</div>
|
|
111
|
+
)}
|
|
112
|
+
</div>
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const GalleryBlockContent: FC<GalleryRenderProps> = ({ block, editor }) => {
|
|
117
|
+
const [uploading, setUploading] = useState(false);
|
|
118
|
+
const { toast } = useToast();
|
|
119
|
+
const inputRef = useRef<HTMLInputElement>(null);
|
|
120
|
+
|
|
121
|
+
const images = parseImages(block.props.images);
|
|
122
|
+
const columns = Math.max(2, Math.min(4, parseInt(block.props.columns) || 3));
|
|
123
|
+
const readonly = !editor.isEditable;
|
|
124
|
+
const uploadFile = editor.uploadFile;
|
|
125
|
+
const canUpload = Boolean(uploadFile);
|
|
126
|
+
|
|
127
|
+
const updateBlock = (patch: Partial<typeof block.props>) => {
|
|
128
|
+
editor.updateBlock(block, { props: patch });
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const handleFiles = async (files: FileList | null) => {
|
|
132
|
+
if (!files?.length || !uploadFile) return;
|
|
133
|
+
setUploading(true);
|
|
134
|
+
try {
|
|
135
|
+
const results = await Promise.allSettled(
|
|
136
|
+
Array.from(files).map(async (file) => {
|
|
137
|
+
const uploadedFile = await uploadFile(file);
|
|
138
|
+
const url =
|
|
139
|
+
typeof uploadedFile === 'string'
|
|
140
|
+
? uploadedFile
|
|
141
|
+
: uploadedFile.props?.url;
|
|
142
|
+
if (typeof url !== 'string' || !url) {
|
|
143
|
+
throw new Error(`Failed to upload ${file.name}`);
|
|
144
|
+
}
|
|
145
|
+
return { url };
|
|
146
|
+
}),
|
|
147
|
+
);
|
|
148
|
+
const uploaded = results.flatMap((result) =>
|
|
149
|
+
result.status === 'fulfilled' ? [result.value] : [],
|
|
150
|
+
);
|
|
151
|
+
const currentBlock = editor.getBlock(block.id);
|
|
152
|
+
if (uploaded.length && currentBlock) {
|
|
153
|
+
updateBlock({
|
|
154
|
+
images: JSON.stringify([
|
|
155
|
+
...parseImages(currentBlock.props.images),
|
|
156
|
+
...uploaded,
|
|
157
|
+
]),
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
const failedNames = Array.from(files)
|
|
161
|
+
.filter((_, index) => results[index].status === 'rejected')
|
|
162
|
+
.map((file) => file.name);
|
|
163
|
+
if (failedNames.length) {
|
|
164
|
+
toast({
|
|
165
|
+
title: 'Failed to upload gallery images',
|
|
166
|
+
description: failedNames.join(', '),
|
|
167
|
+
variant: 'destructive',
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
} catch (error) {
|
|
171
|
+
toast({
|
|
172
|
+
title: 'Failed to upload gallery images',
|
|
173
|
+
description:
|
|
174
|
+
error instanceof Error ? error.message : 'Please try again.',
|
|
175
|
+
variant: 'destructive',
|
|
176
|
+
});
|
|
177
|
+
} finally {
|
|
178
|
+
setUploading(false);
|
|
179
|
+
if (inputRef.current) inputRef.current.value = '';
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
const removeImage = (index: number) => {
|
|
184
|
+
updateBlock({
|
|
185
|
+
images: JSON.stringify(images.filter((_, i) => i !== index)),
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
const setColumns = (n: number) => {
|
|
190
|
+
updateBlock({ columns: String(n) });
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
let uploadButtonLabel = 'Add more';
|
|
194
|
+
let uploadButtonIcon = <IconPlus size={15} />;
|
|
195
|
+
if (uploading) {
|
|
196
|
+
uploadButtonLabel = 'Uploading...';
|
|
197
|
+
uploadButtonIcon = <IconLoader2 size={15} className="animate-spin" />;
|
|
198
|
+
} else if (images.length === 0) {
|
|
199
|
+
uploadButtonLabel = 'Add images to gallery';
|
|
200
|
+
uploadButtonIcon = <IconPhoto size={15} />;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (readonly && images.length === 0) return null;
|
|
204
|
+
|
|
205
|
+
return (
|
|
206
|
+
<div className="w-full my-1 select-none" contentEditable={false}>
|
|
207
|
+
{images.length > 0 && (
|
|
208
|
+
<Attachments.Root
|
|
209
|
+
initialAttachments={images.map((image) => ({
|
|
210
|
+
url: image.url,
|
|
211
|
+
name: image.caption ?? '',
|
|
212
|
+
type: 'image/*',
|
|
213
|
+
size: 0,
|
|
214
|
+
}))}
|
|
215
|
+
>
|
|
216
|
+
<Attachments.Preview
|
|
217
|
+
heading=""
|
|
218
|
+
className="p-0"
|
|
219
|
+
renderThumbnails={(openPreview) => (
|
|
220
|
+
<div
|
|
221
|
+
className="grid gap-2"
|
|
222
|
+
style={{ gridTemplateColumns: `repeat(${columns}, 1fr)` }}
|
|
223
|
+
>
|
|
224
|
+
{images.map((img, i) => (
|
|
225
|
+
<GalleryItem
|
|
226
|
+
key={`${img.url}-${i}`}
|
|
227
|
+
image={img}
|
|
228
|
+
readonly={readonly}
|
|
229
|
+
onRemove={() => removeImage(i)}
|
|
230
|
+
onPreview={() => openPreview(i)}
|
|
231
|
+
/>
|
|
232
|
+
))}
|
|
233
|
+
</div>
|
|
234
|
+
)}
|
|
235
|
+
/>
|
|
236
|
+
</Attachments.Root>
|
|
237
|
+
)}
|
|
238
|
+
|
|
239
|
+
{!readonly && (
|
|
240
|
+
<div className="flex items-center gap-2 mt-2">
|
|
241
|
+
<input
|
|
242
|
+
ref={inputRef}
|
|
243
|
+
type="file"
|
|
244
|
+
accept="image/*"
|
|
245
|
+
multiple
|
|
246
|
+
className="hidden"
|
|
247
|
+
onChange={(e) => handleFiles(e.target.files)}
|
|
248
|
+
/>
|
|
249
|
+
|
|
250
|
+
{canUpload ? (
|
|
251
|
+
<Button
|
|
252
|
+
variant="ghost"
|
|
253
|
+
disabled={uploading}
|
|
254
|
+
className="flex-1 h-auto gap-1.5 py-2 text-muted-foreground border border-dashed rounded-md hover:bg-muted"
|
|
255
|
+
onMouseDown={(e) => e.preventDefault()}
|
|
256
|
+
onClick={() => inputRef.current?.click()}
|
|
257
|
+
>
|
|
258
|
+
{uploadButtonIcon}
|
|
259
|
+
<span>{uploadButtonLabel}</span>
|
|
260
|
+
</Button>
|
|
261
|
+
) : (
|
|
262
|
+
images.length === 0 && (
|
|
263
|
+
<div className="flex flex-1 items-center justify-center gap-1.5 text-sm text-muted-foreground border border-dashed rounded-md px-3 py-2">
|
|
264
|
+
<IconPhoto size={15} />
|
|
265
|
+
<span>No upload handler configured</span>
|
|
266
|
+
</div>
|
|
267
|
+
)
|
|
268
|
+
)}
|
|
269
|
+
|
|
270
|
+
{images.length > 0 && (
|
|
271
|
+
<div className="flex items-center gap-1 shrink-0">
|
|
272
|
+
<IconLayoutGrid size={14} className="text-muted-foreground" />
|
|
273
|
+
{COLUMN_OPTIONS.map((n) => (
|
|
274
|
+
<Button
|
|
275
|
+
key={n}
|
|
276
|
+
variant="ghost"
|
|
277
|
+
aria-label={`${n} columns`}
|
|
278
|
+
aria-pressed={columns === n}
|
|
279
|
+
className={cn(
|
|
280
|
+
'h-6 w-6 p-0 text-xs',
|
|
281
|
+
columns === n
|
|
282
|
+
? 'bg-primary text-primary-foreground hover:bg-primary'
|
|
283
|
+
: 'text-muted-foreground hover:bg-muted',
|
|
284
|
+
)}
|
|
285
|
+
onMouseDown={(e) => e.preventDefault()}
|
|
286
|
+
onClick={() => setColumns(n)}
|
|
287
|
+
>
|
|
288
|
+
{n}
|
|
289
|
+
</Button>
|
|
290
|
+
))}
|
|
291
|
+
</div>
|
|
292
|
+
)}
|
|
293
|
+
</div>
|
|
294
|
+
)}
|
|
295
|
+
</div>
|
|
296
|
+
);
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
const GalleryExternalHTML: FC<GalleryRenderProps> = ({ block }) => {
|
|
300
|
+
const images = parseImages(block.props.images);
|
|
301
|
+
const columns = Math.max(2, Math.min(4, parseInt(block.props.columns) || 3));
|
|
302
|
+
|
|
303
|
+
return (
|
|
304
|
+
<div
|
|
305
|
+
className="erxes-editor-gallery"
|
|
306
|
+
data-columns={String(columns)}
|
|
307
|
+
style={
|
|
308
|
+
images.length > 0
|
|
309
|
+
? {
|
|
310
|
+
display: 'grid',
|
|
311
|
+
gridTemplateColumns: `repeat(${columns}, 1fr)`,
|
|
312
|
+
gap: '8px',
|
|
313
|
+
}
|
|
314
|
+
: { display: 'none' }
|
|
315
|
+
}
|
|
316
|
+
>
|
|
317
|
+
{images.map((img, i) =>
|
|
318
|
+
img.caption ? (
|
|
319
|
+
<figure key={`${img.url}-${i}`} style={{ margin: 0 }}>
|
|
320
|
+
<img
|
|
321
|
+
src={readImage(img.url)}
|
|
322
|
+
alt={img.caption}
|
|
323
|
+
style={{
|
|
324
|
+
width: '100%',
|
|
325
|
+
aspectRatio: '1 / 1',
|
|
326
|
+
objectFit: 'cover',
|
|
327
|
+
display: 'block',
|
|
328
|
+
}}
|
|
329
|
+
/>
|
|
330
|
+
<figcaption>{img.caption}</figcaption>
|
|
331
|
+
</figure>
|
|
332
|
+
) : (
|
|
333
|
+
<img
|
|
334
|
+
key={`${img.url}-${i}`}
|
|
335
|
+
src={readImage(img.url)}
|
|
336
|
+
alt=""
|
|
337
|
+
style={{
|
|
338
|
+
width: '100%',
|
|
339
|
+
aspectRatio: '1 / 1',
|
|
340
|
+
objectFit: 'cover',
|
|
341
|
+
display: 'block',
|
|
342
|
+
}}
|
|
343
|
+
/>
|
|
344
|
+
),
|
|
345
|
+
)}
|
|
346
|
+
</div>
|
|
347
|
+
);
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
export const galleryBlock = createReactBlockSpec(galleryBlockConfig, {
|
|
351
|
+
render: GalleryBlockContent,
|
|
352
|
+
toExternalHTML: GalleryExternalHTML,
|
|
353
|
+
parse: (element) => {
|
|
354
|
+
if (
|
|
355
|
+
element.tagName === 'DIV' &&
|
|
356
|
+
element.classList.contains('erxes-editor-gallery')
|
|
357
|
+
) {
|
|
358
|
+
const columns = element.getAttribute('data-columns') ?? '3';
|
|
359
|
+
const images: GalleryImage[] = [];
|
|
360
|
+
|
|
361
|
+
element.querySelectorAll('figure, img').forEach((el) => {
|
|
362
|
+
if (el.closest('figure') && el.tagName !== 'FIGURE') return;
|
|
363
|
+
if (el.tagName === 'FIGURE') {
|
|
364
|
+
const img = el.querySelector('img') as HTMLImageElement | null;
|
|
365
|
+
if (img?.src)
|
|
366
|
+
images.push({
|
|
367
|
+
url: img.src,
|
|
368
|
+
caption: el.querySelector('figcaption')?.textContent ?? undefined,
|
|
369
|
+
});
|
|
370
|
+
} else {
|
|
371
|
+
const img = el as HTMLImageElement;
|
|
372
|
+
if (img.src) images.push({ url: img.src });
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
return { images: JSON.stringify(images), columns };
|
|
377
|
+
}
|
|
378
|
+
return undefined;
|
|
379
|
+
},
|
|
380
|
+
});
|