@antscorp/antsomi-ui 2.0.109 → 2.0.111
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 +78 -78
- package/es/__mocks__/1000_city.json +802 -802
- package/es/__mocks__/sql-query.json +56 -56
- package/es/assets/css/main.scss +8 -6
- package/es/assets/images/feedback.svg +3 -3
- package/es/assets/svg/mobile-frame.svg +3 -3
- package/es/assets/svg/warning-icon.svg +5 -5
- package/es/components/atoms/Alert/Alert.js +28 -28
- package/es/components/atoms/ContentEditable/styled.js +16 -16
- package/es/components/atoms/DividerPure/styled.js +35 -35
- package/es/components/atoms/Eyedropper/Eyedropper.d.ts +2 -0
- package/es/components/atoms/Eyedropper/Eyedropper.js +53 -0
- package/es/components/atoms/Eyedropper/index.d.ts +0 -0
- package/es/components/atoms/Eyedropper/index.js +1 -0
- package/es/components/atoms/Eyedropper/styled.d.ts +9 -0
- package/es/components/atoms/Eyedropper/styled.js +45 -0
- package/es/components/atoms/Eyedropper/types.d.ts +5 -0
- package/es/components/atoms/Eyedropper/types.js +1 -0
- package/es/components/atoms/Icon/index.js +19 -19
- package/es/components/atoms/Iframe/Iframe.js +18 -18
- package/es/components/atoms/Input/styled.js +104 -104
- package/es/components/atoms/InputDynamic/styled.js +284 -284
- package/es/components/atoms/MobileBrandingBar/styled.js +21 -21
- package/es/components/atoms/MobileFrame/styled.js +30 -30
- package/es/components/atoms/MobileFrameV2/styled.js +42 -42
- package/es/components/atoms/MobileFrameV3/styled.js +31 -31
- package/es/components/atoms/NotificationStatus/styled.js +10 -10
- package/es/components/atoms/PreviewTabs/styled.js +69 -69
- package/es/components/atoms/Radio/index.js +16 -16
- package/es/components/atoms/ReactIframe/ReactIframe.js +5 -5
- package/es/components/atoms/ReactIframe/styled.js +9 -9
- package/es/components/atoms/RequiredLabel/styled.js +3 -3
- package/es/components/atoms/ScrollBox/index.js +5 -5
- package/es/components/atoms/Scrollbars/styled.js +21 -21
- package/es/components/atoms/SlideBar/styled.js +194 -194
- package/es/components/atoms/Slider/styled.js +31 -31
- package/es/components/atoms/Space/Space.js +4 -4
- package/es/components/atoms/Spin/styled.js +11 -11
- package/es/components/atoms/Steps/styled.js +244 -244
- package/es/components/atoms/Switch/styled.js +56 -56
- package/es/components/atoms/Tag/Tag.js +10 -10
- package/es/components/atoms/Text/styled.js +34 -34
- package/es/components/icons/ALignRightIcon.d.ts +3 -0
- package/es/components/icons/ALignRightIcon.js +7 -0
- package/es/components/icons/AlignCenterIcon.d.ts +3 -0
- package/es/components/icons/AlignCenterIcon.js +7 -0
- package/es/components/icons/AlignJustifyIcon.d.ts +3 -0
- package/es/components/icons/AlignJustifyIcon.js +7 -0
- package/es/components/icons/AlignLeftIcon.d.ts +3 -0
- package/es/components/icons/AlignLeftIcon.js +7 -0
- package/es/components/icons/ArrowDropDownIcon.d.ts +3 -0
- package/es/components/icons/ArrowDropDownIcon.js +7 -0
- package/es/components/icons/ChevronRightIcon.d.ts +3 -0
- package/es/components/icons/ChevronRightIcon.js +7 -0
- package/es/components/icons/ColorizeIcon.d.ts +3 -0
- package/es/components/icons/ColorizeIcon.js +7 -0
- package/es/components/icons/DomainManagementIcon.js +1 -1
- package/es/components/icons/LazyIcon/LazyIcon.d.ts +9 -0
- package/es/components/icons/LazyIcon/LazyIcon.js +9 -0
- package/es/components/icons/LinkOffIcon.d.ts +3 -0
- package/es/components/icons/LinkOffIcon.js +7 -0
- package/es/components/icons/LoadingIcon.js +33 -33
- package/es/components/icons/MinusIcon.d.ts +3 -0
- package/es/components/icons/MinusIcon.js +7 -0
- package/es/components/icons/document/styled.js +43 -43
- package/es/components/icons/index.d.ts +9 -0
- package/es/components/icons/index.js +9 -0
- package/es/components/index.scss +2 -1
- package/es/components/molecules/AccessDenied/styled.js +28 -28
- package/es/components/molecules/AccountSelection/styled.js +110 -110
- package/es/components/molecules/AddDynamicContent/styled.js +23 -23
- package/es/components/molecules/AlignSetting/styled.js +4 -4
- package/es/components/molecules/ApplyPopupContent/styled.js +32 -32
- package/es/components/molecules/CalendarSelection/components/AutoUpdateTo/styled.js +8 -8
- package/es/components/molecules/CalendarSelection/components/CustomPicker/styled.js +79 -79
- package/es/components/molecules/CalendarSelection/components/Footer/styled.js +4 -4
- package/es/components/molecules/CalendarSelection/components/RangePicker/styled.js +21 -21
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/Option/Option.js +26 -26
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/styled.js +30 -30
- package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/styled.js +26 -26
- package/es/components/molecules/CalendarSelection/styled.js +8 -8
- package/es/components/molecules/CaptureScreen/components/CommentBox/styled.js +119 -119
- package/es/components/molecules/CaptureScreen/components/Cursor/styled.js +67 -67
- package/es/components/molecules/CaptureScreen/styled.js +240 -240
- package/es/components/molecules/ChartTab/components/styled.js +24 -24
- package/es/components/molecules/ChartTab/styled.js +20 -20
- package/es/components/molecules/ChatBox/AntsomiAI.js +8 -8
- package/es/components/molecules/ChatBox/ChatBoxInsight/QuestionItem.js +9 -9
- package/es/components/molecules/ChatBox/ChatBoxInsight/styled.js +365 -365
- package/es/components/molecules/ChatBox/styled.js +324 -324
- package/es/components/molecules/CodeStructure/styled.js +5 -5
- package/es/components/molecules/ColorPicker/ChromePicker/styled.js +10 -10
- package/es/components/molecules/ColorPicker/CustomPicker/styled.js +89 -89
- package/es/components/molecules/ColorPicker/SketchPicker/styled.js +5 -5
- package/es/components/molecules/ColorPicker/styled.js +7 -7
- package/es/components/molecules/ColorSetting/styled.js +39 -39
- package/es/components/molecules/DatePicker/components/AdvancedPicker/styled.js +110 -110
- package/es/components/molecules/DatePickerV2/styled.js +6 -6
- package/es/components/molecules/DisplayFormat/styled.js +12 -12
- package/es/components/molecules/DrawerDetail/components/ToggleDrawerSizeButton.js +24 -24
- package/es/components/molecules/DrawerDetail/styled.js +109 -109
- package/es/components/molecules/Dropdown/style.scss +11 -11
- package/es/components/molecules/Dropdown/styled.js +28 -28
- package/es/components/molecules/EdgeSetting/styled.js +10 -10
- package/es/components/molecules/EditableName/styled.js +70 -70
- package/es/components/molecules/EditingList/styled.js +29 -29
- package/es/components/molecules/EditingListV2/components/List/List.js +9 -9
- package/es/components/molecules/EditorTab/styled.js +156 -156
- package/es/components/molecules/EmojiCollections/CommonCollection/index.js +2 -2
- package/es/components/molecules/EmojiCollections/styled.js +22 -22
- package/es/components/molecules/EmojiCollections/types.d.ts +1 -0
- package/es/components/molecules/EmojiPopover/EmojiPopover.d.ts +2 -0
- package/es/components/molecules/EmojiPopover/EmojiPopover.js +10 -6
- package/es/components/molecules/EmojiPopover/styled.js +5 -5
- package/es/components/molecules/EmptyData/styled.js +53 -53
- package/es/components/molecules/EyedropperButton/EyedropperButton.d.ts +11 -0
- package/es/components/molecules/EyedropperButton/EyedropperButton.js +34 -0
- package/es/components/molecules/EyedropperButton/index.d.ts +0 -0
- package/es/components/molecules/EyedropperButton/index.js +1 -0
- package/es/components/molecules/EyedropperButton/styled.d.ts +7 -0
- package/es/components/molecules/EyedropperButton/styled.js +23 -0
- package/es/components/molecules/FontSizeInput/FontSizeInput.d.ts +3 -0
- package/es/components/molecules/FontSizeInput/FontSizeInput.js +134 -0
- package/es/components/molecules/FontSizeInput/components/FontSizeControl.d.ts +8 -0
- package/es/components/molecules/FontSizeInput/components/FontSizeControl.js +14 -0
- package/es/components/molecules/FontSizeInput/components/FontSizeDropdown.d.ts +21 -0
- package/es/components/molecules/FontSizeInput/components/FontSizeDropdown.js +19 -0
- package/es/components/molecules/FontSizeInput/constants.d.ts +2 -0
- package/es/components/molecules/FontSizeInput/constants.js +5 -0
- package/es/components/molecules/FontSizeInput/index.d.ts +2 -0
- package/es/components/molecules/FontSizeInput/index.js +1 -0
- package/es/components/molecules/FontSizeInput/index.scss +15 -15
- package/es/components/molecules/FontSizeInput/styled.d.ts +7 -0
- package/es/components/molecules/FontSizeInput/styled.js +39 -0
- package/es/components/molecules/FontSizeInput/types.d.ts +23 -0
- package/es/components/molecules/FontSizeInput/types.js +1 -0
- package/es/components/molecules/FontSizeInput/utils.d.ts +7 -0
- package/es/components/molecules/FontSizeInput/utils.js +9 -0
- package/es/components/molecules/GradientSetting/styled.js +57 -57
- package/es/components/molecules/HeaderV2/styled.js +70 -70
- package/es/components/molecules/IconSelection/styled.js +69 -69
- package/es/components/molecules/ImageEditor/components/ModalShortcut.js +21 -21
- package/es/components/molecules/ImageEditor/styled.js +5 -5
- package/es/components/molecules/ImagePreview/styled.js +3 -3
- package/es/components/molecules/InputNumberWithUnit/styled.js +14 -14
- package/es/components/molecules/InputSearch/styled.js +41 -41
- package/es/components/molecules/ItemNotFound/styled.js +26 -26
- package/es/components/molecules/MatchAnySelect/components/ExtendValuePopup.js +8 -8
- package/es/components/molecules/MatchAnySelect/styled.js +247 -247
- package/es/components/molecules/Modal/styled.js +63 -63
- package/es/components/molecules/ModalSelect/styled.js +152 -152
- package/es/components/molecules/ModalV2/styled.js +27 -27
- package/es/components/molecules/PopupDraggable/styled.js +57 -57
- package/es/components/molecules/PreviewModal/styled.js +26 -26
- package/es/components/molecules/ProcessLoading/styled.js +2 -2
- package/es/components/molecules/QuillEditor/CustomToolbar.js +3165 -3165
- package/es/components/molecules/QuillEditor/EditorToolbar.js +7 -7
- package/es/components/molecules/QuillEditor/styled.js +25 -25
- package/es/components/molecules/RadioGroup/styled.js +9 -9
- package/es/components/molecules/RequestAccess/styled.js +38 -38
- package/es/components/molecules/ResizeGrid/components/Cell/styled.js +77 -77
- package/es/components/molecules/ResizeGrid/styled.js +50 -50
- package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuCell/styled.js +118 -118
- package/es/components/molecules/RichMenu/RichMenuBlock/styled.js +13 -13
- package/es/components/molecules/RichMenu/RichMenuChatBar/TypingChat/styled.js +40 -40
- package/es/components/molecules/RichMenu/RichMenuChatBar/styled.js +27 -27
- package/es/components/molecules/RichMenu/RichMenuMobileView/RichMenuMobileView.js +2 -2
- package/es/components/molecules/RichMenu/RichMenuMobileView/styled.js +38 -38
- package/es/components/molecules/SearchPopover/SearchPopover.d.ts +2 -1
- package/es/components/molecules/SearchPopover/SearchPopover.js +3 -3
- package/es/components/molecules/SearchPopover/components/PopoverSelect/styled.js +36 -36
- package/es/components/molecules/SearchPopover/components/PopoverSelect/styles.scss +7 -7
- package/es/components/molecules/SearchPopover/styled.d.ts +12 -1
- package/es/components/molecules/SearchPopover/styled.js +32 -33
- package/es/components/molecules/SearchPopover/types.d.ts +4 -3
- package/es/components/molecules/Select/styled.js +32 -32
- package/es/components/molecules/SelectAccount/styled.js +147 -147
- package/es/components/molecules/SelectEventAttribute/styled.js +8 -8
- package/es/components/molecules/SelectMulti/styled.js +62 -62
- package/es/components/molecules/SelectV2/styled.js +124 -124
- package/es/components/molecules/SettingWrapper/styled.js +12 -12
- package/es/components/molecules/ShareAccess/components/GeneralAccess/styled.js +56 -56
- package/es/components/molecules/ShareAccess/components/LayoutContent/styled.js +5 -5
- package/es/components/molecules/ShareAccess/components/ModalTransferOwnerShip/styled.js +15 -15
- package/es/components/molecules/ShareAccess/components/PeopleAccess/styled.js +63 -63
- package/es/components/molecules/ShareAccess/components/SearchUser/styled.js +31 -31
- package/es/components/molecules/SliderWithInputNumber/styled.js +2 -2
- package/es/components/molecules/Tabs/Tabs.js +11 -11
- package/es/components/molecules/TagifyInput/TagifyInput.js +50 -50
- package/es/components/molecules/TagifyInput/styled.js +37 -37
- package/es/components/molecules/TagifyInput/utils.js +13 -13
- package/es/components/molecules/TagifyInput/utils.style.js +218 -218
- package/es/components/molecules/TemplateSaveAs/components/Category/Category.js +5 -5
- package/es/components/molecules/TemplateSaveAs/components/ImageSlider/styled.js +276 -276
- package/es/components/molecules/TemplateSaveAs/styled.js +134 -134
- package/es/components/molecules/ThumbnailCard/styled.js +92 -92
- package/es/components/molecules/Tree/styled.js +38 -38
- package/es/components/molecules/UnsubscribePreferences/styled.js +7 -7
- package/es/components/molecules/UnsubscribePreview/components/styled.js +53 -53
- package/es/components/molecules/UnsubscribePreview/styled.js +48 -48
- package/es/components/molecules/UploadImage/styled.js +114 -114
- package/es/components/molecules/VirtualizedMenu/VirtualizedMenu.d.ts +1 -0
- package/es/components/molecules/VirtualizedMenu/components/Item/Item.js +6 -8
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.d.ts +10 -10
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.js +49 -289
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/index.d.ts +9 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/index.js +5 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useFocusManagement.d.ts +23 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useFocusManagement.js +81 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useItemInteraction.d.ts +24 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useItemInteraction.js +32 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useKeyboardNavigation.d.ts +26 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useKeyboardNavigation.js +93 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useTreeState.d.ts +24 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useTreeState.js +94 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useVisibleItems.d.ts +7 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/hooks/useVisibleItems.js +132 -0
- package/es/components/molecules/VirtualizedMenu/styled.js +103 -82
- package/es/components/molecules/VirtualizedMenu/types.d.ts +2 -0
- package/es/components/molecules/VirtualizedMenu/utils.d.ts +2 -0
- package/es/components/molecules/VirtualizedMenu/utils.js +2 -0
- package/es/components/molecules/index.d.ts +1 -0
- package/es/components/molecules/index.js +1 -0
- package/es/components/molecules/index.scss +1 -0
- package/es/components/organism/AccountProfile/components/AccountSetting/components/EditableInput/styles.js +98 -98
- package/es/components/organism/AccountProfile/components/AccountSetting/components/LanguageSelector/styles.js +18 -18
- package/es/components/organism/AccountProfile/components/AccountSetting/styled.js +543 -543
- package/es/components/organism/AccountProfile/components/AccountSetting/styles.scss +39 -39
- package/es/components/organism/AccountSharing/styled.js +336 -336
- package/es/components/organism/ActivityTimeline/ActivityTimeline.js +3 -3
- package/es/components/organism/ActivityTimeline/__mocks__/event_tracking.json +1290 -1290
- package/es/components/organism/ActivityTimeline/__mocks__/timeline.json +1896 -3059
- package/es/components/organism/ActivityTimeline/components/ActionHistory/styled.js +28 -28
- package/es/components/organism/ActivityTimeline/components/CardMember/styled.js +60 -60
- package/es/components/organism/ActivityTimeline/components/ItemEvent/ItemEvent.js +7 -1
- package/es/components/organism/ActivityTimeline/components/ItemGroupEvent/ItemGroupEvent.js +14 -2
- package/es/components/organism/ActivityTimeline/components/ItemGroupEvent/styled.js +4 -4
- package/es/components/organism/ActivityTimeline/components/List/styled.js +77 -77
- package/es/components/organism/ActivityTimeline/components/ListItem/styled.js +37 -37
- package/es/components/organism/ActivityTimeline/components/ProductCard/styled.js +92 -92
- package/es/components/organism/ActivityTimeline/components/Redeem/styled.js +7 -7
- package/es/components/organism/ActivityTimeline/components/Slide/styled.js +20 -20
- package/es/components/organism/ActivityTimeline/components/TimeLineTitle/styled.js +7 -7
- package/es/components/organism/ActivityTimeline/components/TimelineSection/styled.js +69 -69
- package/es/components/organism/ActivityTimeline/constants.d.ts +18 -18
- package/es/components/organism/ActivityTimeline/constants.js +7 -8
- package/es/components/organism/ActivityTimeline/index.d.ts +530 -1
- package/es/components/organism/ActivityTimeline/index.js +9 -1
- package/es/components/organism/ActivityTimeline/styled.js +43 -39
- package/es/components/organism/ActivityTimeline/utils.d.ts +7 -1
- package/es/components/organism/ActivityTimeline/utils.js +224 -162
- package/es/components/organism/AlgorithmsSetting/styled.js +35 -35
- package/es/components/organism/BasicLogin/components/ChooseMethod/styled.js +19 -19
- package/es/components/organism/BasicLogin/components/LoginWithEmail/styled.js +3 -3
- package/es/components/organism/BasicLogin/components/LoginWithGG/styled.js +3 -3
- package/es/components/organism/BasicLogin/components/SignIn/styled.js +8 -8
- package/es/components/organism/BasicLogin/components/WidgetLayout/styled.js +18 -18
- package/es/components/organism/BasicLogin/styled.js +107 -107
- package/es/components/organism/ContentSources/styled.js +50 -50
- package/es/components/organism/DataTable/components/AddButton/index.js +8 -8
- package/es/components/organism/DataTable/components/ModifyColumn/styled.js +18 -18
- package/es/components/organism/DataTable/components/Pagination/styled.js +26 -26
- package/es/components/organism/DataTable/components/Table/styled.js +135 -135
- package/es/components/organism/DataTable/components/Toolbar/SearchPopover.js +17 -17
- package/es/components/organism/DataTable/components/Toolbar/styled.js +70 -70
- package/es/components/organism/DataTable/styled/index.js +84 -84
- package/es/components/organism/Filter/components/FilterCondition/styled.js +34 -34
- package/es/components/organism/Filter/styled.js +109 -109
- package/es/components/organism/FilterSetting/components/common/InputArray/styled.js +5 -5
- package/es/components/organism/FilterSetting/components/common/InputOrSelect/index.js +63 -63
- package/es/components/organism/FilterSetting/components/common/InputSelectMulti/ColumnSuggestion/index.js +31 -31
- package/es/components/organism/FilterSetting/components/common/InputSelectMulti/Tree/index.js +22 -22
- package/es/components/organism/FilterSetting/components/common/InputSelectMulti/index.js +55 -55
- package/es/components/organism/FilterSetting/styled.js +19 -19
- package/es/components/organism/Help/styled.js +267 -267
- package/es/components/organism/LeftMenu/components/HomeMenu/styled.js +39 -39
- package/es/components/organism/LeftMenu/components/common/ChildMenu/components/MenuItemImage/styled.js +16 -16
- package/es/components/organism/LeftMenu/components/common/ChildMenu/styled.js +156 -156
- package/es/components/organism/LeftMenu/styled.js +214 -214
- package/es/components/organism/Login/components/ChooseMethod/styled.js +19 -19
- package/es/components/organism/Login/components/ForgotPassword/styled.js +8 -8
- package/es/components/organism/Login/components/LoginSelectPortal/Item/styled.js +31 -31
- package/es/components/organism/Login/components/LoginSelectPortal/styled.js +3 -3
- package/es/components/organism/Login/components/LoginWithEmail/styled.js +3 -3
- package/es/components/organism/Login/components/LoginWithGG/styled.js +3 -3
- package/es/components/organism/Login/components/SetupGGAuthenticator/styled.js +7 -7
- package/es/components/organism/Login/components/SignIn/styled.js +8 -8
- package/es/components/organism/Login/components/VerifyAccount/styled.js +13 -13
- package/es/components/organism/Login/components/WidgetLayout/styled.js +18 -18
- package/es/components/organism/Login/styled.js +115 -115
- package/es/components/organism/Menu/styled.js +6 -6
- package/es/components/organism/ModifyColumnModal/styled.js +132 -132
- package/es/components/organism/Notification/styled.js +155 -155
- package/es/components/organism/PreviewCollections/Messages/SkeletonMessage/styled.js +14 -14
- package/es/components/organism/PreviewCollections/WhatsappMessage/CarouselMessage/styled.js +63 -63
- package/es/components/organism/PreviewCollections/constants.js +50 -50
- package/es/components/organism/PreviewCollections/styled.js +16 -16
- package/es/components/organism/PreviewTemplateModal/components/Banner/styled.js +78 -78
- package/es/components/organism/PreviewTemplateModal/components/Information/styled.js +52 -52
- package/es/components/organism/PreviewTemplateModal/components/SimilarTemplate/styled.js +18 -18
- package/es/components/organism/PreviewTemplateModal/components/ThumbnailSlider/styled.js +77 -77
- package/es/components/organism/PreviewTemplateModal/styled.js +21 -21
- package/es/components/organism/SQLGeneration/components/styled.js +354 -354
- package/es/components/organism/SQLGeneration/index.scss +1 -1
- package/es/components/organism/SQLGeneration/integrations/AceEditor/index.scss +4 -4
- package/es/components/organism/Table/CrossTabTable/components/CustomCell/styled.js +11 -11
- package/es/components/organism/Table/CrossTabTable/styled.js +11 -11
- package/es/components/organism/Table/ExplorePivotTable/components/CustomCell/styled.js +17 -17
- package/es/components/organism/Table/ExplorePivotTable/styled.js +11 -11
- package/es/components/organism/TextEditor/TextEditor.d.ts +10 -0
- package/es/components/organism/TextEditor/TextEditor.js +388 -0
- package/es/components/organism/TextEditor/__mocks__/text-block.settings.json +320 -0
- package/es/components/organism/TextEditor/__mocks__/text-contennt.d.ts +1 -0
- package/es/components/organism/TextEditor/__mocks__/text-contennt.js +47 -0
- package/es/components/organism/TextEditor/constants.d.ts +196 -0
- package/es/components/organism/TextEditor/constants.js +398 -0
- package/es/components/organism/TextEditor/extensions/BackgroundColor.d.ts +25 -0
- package/es/components/organism/TextEditor/extensions/BackgroundColor.js +43 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.d.ts +18 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.js +81 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.d.ts +15 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.js +35 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/index.d.ts +2 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/index.js +2 -0
- package/es/components/organism/TextEditor/extensions/ClearFormatting.d.ts +16 -0
- package/es/components/organism/TextEditor/extensions/ClearFormatting.js +30 -0
- package/es/components/organism/TextEditor/extensions/Color.d.ts +6 -0
- package/es/components/organism/TextEditor/extensions/Color.js +34 -0
- package/es/components/organism/TextEditor/extensions/Emoji.d.ts +57 -0
- package/es/components/organism/TextEditor/extensions/Emoji.js +184 -0
- package/es/components/organism/TextEditor/extensions/FontFamily.d.ts +6 -0
- package/es/components/organism/TextEditor/extensions/FontFamily.js +36 -0
- package/es/components/organism/TextEditor/extensions/FontSize.d.ts +31 -0
- package/es/components/organism/TextEditor/extensions/FontSize.js +46 -0
- package/es/components/organism/TextEditor/extensions/FontWeight.d.ts +23 -0
- package/es/components/organism/TextEditor/extensions/FontWeight.js +41 -0
- package/es/components/organism/TextEditor/extensions/Indent.d.ts +21 -0
- package/es/components/organism/TextEditor/extensions/Indent.js +63 -0
- package/es/components/organism/TextEditor/extensions/LetterSpacing.d.ts +32 -0
- package/es/components/organism/TextEditor/extensions/LetterSpacing.js +48 -0
- package/es/components/organism/TextEditor/extensions/LineHeight.d.ts +20 -0
- package/es/components/organism/TextEditor/extensions/LineHeight.js +101 -0
- package/es/components/organism/TextEditor/extensions/Link.d.ts +22 -0
- package/es/components/organism/TextEditor/extensions/Link.js +178 -0
- package/es/components/organism/TextEditor/extensions/ListItem.d.ts +10 -0
- package/es/components/organism/TextEditor/extensions/ListItem.js +93 -0
- package/es/components/organism/TextEditor/extensions/ListItemMarker.d.ts +13 -0
- package/es/components/organism/TextEditor/extensions/ListItemMarker.js +174 -0
- package/es/components/organism/TextEditor/extensions/OrderedList.d.ts +56 -0
- package/es/components/organism/TextEditor/extensions/OrderedList.js +187 -0
- package/es/components/organism/TextEditor/extensions/SmartTag.d.ts +28 -0
- package/es/components/organism/TextEditor/extensions/SmartTag.js +103 -0
- package/es/components/organism/TextEditor/extensions/StyleMemory.d.ts +36 -0
- package/es/components/organism/TextEditor/extensions/StyleMemory.js +163 -0
- package/es/components/organism/TextEditor/extensions/TextTransform.d.ts +30 -0
- package/es/components/organism/TextEditor/extensions/TextTransform.js +36 -0
- package/es/components/organism/TextEditor/extensions/UnorderedList.d.ts +55 -0
- package/es/components/organism/TextEditor/extensions/UnorderedList.js +176 -0
- package/es/components/organism/TextEditor/hooks/index.d.ts +6 -0
- package/es/components/organism/TextEditor/hooks/index.js +6 -0
- package/es/components/organism/TextEditor/hooks/useColorSet.d.ts +4 -0
- package/es/components/organism/TextEditor/hooks/useColorSet.js +29 -0
- package/es/components/organism/TextEditor/hooks/useDocumentState.d.ts +18 -0
- package/es/components/organism/TextEditor/hooks/useDocumentState.js +42 -0
- package/es/components/organism/TextEditor/hooks/useMarkTracking.d.ts +26 -0
- package/es/components/organism/TextEditor/hooks/useMarkTracking.js +69 -0
- package/es/components/organism/TextEditor/hooks/usePersistence.d.ts +31 -0
- package/es/components/organism/TextEditor/hooks/usePersistence.js +169 -0
- package/es/components/organism/TextEditor/hooks/useStyleMemory.d.ts +6 -0
- package/es/components/organism/TextEditor/hooks/useStyleMemory.js +42 -0
- package/es/components/organism/TextEditor/hooks/useStylePresets.d.ts +34 -0
- package/es/components/organism/TextEditor/hooks/useStylePresets.js +83 -0
- package/es/components/organism/TextEditor/index.d.ts +18 -0
- package/es/components/organism/TextEditor/index.js +8 -0
- package/es/components/organism/TextEditor/index.scss +65 -0
- package/es/components/organism/TextEditor/provider.d.ts +15 -0
- package/es/components/organism/TextEditor/provider.js +36 -0
- package/es/components/organism/TextEditor/store.d.ts +20 -0
- package/es/components/organism/TextEditor/store.js +40 -0
- package/es/components/organism/TextEditor/stories/WithOldDynAndLink/froala-legacy-format.settings.json +95 -0
- package/es/components/organism/TextEditor/stories/WithOldDynAndLink/shared.d.ts +111 -0
- package/es/components/organism/TextEditor/stories/WithOldDynAndLink/shared.js +82 -0
- package/es/components/organism/TextEditor/stories/shared.d.ts +64 -0
- package/es/components/organism/TextEditor/stories/shared.js +57 -0
- package/es/components/organism/TextEditor/styled.d.ts +9 -0
- package/es/components/organism/TextEditor/styled.js +61 -0
- package/es/components/organism/TextEditor/types.d.ts +311 -0
- package/es/components/organism/TextEditor/types.js +6 -0
- package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.d.ts +3 -0
- package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.js +114 -0
- package/es/components/organism/TextEditor/ui/BubbleMenu/index.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/BubbleMenu/index.js +1 -0
- package/es/components/organism/TextEditor/ui/Button/Button.d.ts +9 -0
- package/es/components/organism/TextEditor/ui/Button/Button.js +35 -0
- package/es/components/organism/TextEditor/ui/Button/index.d.ts +2 -0
- package/es/components/organism/TextEditor/ui/Button/index.js +1 -0
- package/es/components/organism/TextEditor/ui/Button/types.d.ts +10 -0
- package/es/components/organism/TextEditor/ui/Button/types.js +1 -0
- package/es/components/organism/TextEditor/ui/ColorPicker/ColorPicker.d.ts +39 -0
- package/es/components/organism/TextEditor/ui/ColorPicker/ColorPicker.js +131 -0
- package/es/components/organism/TextEditor/ui/ColorPicker/index.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/ColorPicker/index.js +1 -0
- package/es/components/organism/TextEditor/ui/DropdownButton/DropdownButton.d.ts +17 -0
- package/es/components/organism/TextEditor/ui/DropdownButton/DropdownButton.js +51 -0
- package/es/components/organism/TextEditor/ui/DropdownButton/index.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/DropdownButton/index.js +1 -0
- package/es/components/organism/TextEditor/ui/Emoji/EmojiList.d.ts +11 -0
- package/es/components/organism/TextEditor/ui/Emoji/EmojiList.js +66 -0
- package/es/components/organism/TextEditor/ui/Emoji/index.d.ts +2 -0
- package/es/components/organism/TextEditor/ui/Emoji/index.js +2 -0
- package/es/components/organism/TextEditor/ui/Emoji/suggestion.d.ts +4 -0
- package/es/components/organism/TextEditor/ui/Emoji/suggestion.js +71 -0
- package/es/components/organism/TextEditor/ui/FontPopover/FontItem.d.ts +2 -0
- package/es/components/organism/TextEditor/ui/FontPopover/FontItem.js +27 -0
- package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.d.ts +16 -0
- package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.js +102 -0
- package/es/components/organism/TextEditor/ui/FontPopover/styled.d.ts +2 -0
- package/es/components/organism/TextEditor/ui/FontPopover/styled.js +36 -0
- package/es/components/organism/TextEditor/ui/FontPopover/types.d.ts +35 -0
- package/es/components/organism/TextEditor/ui/FontPopover/types.js +1 -0
- package/es/components/organism/TextEditor/ui/LinkInsertForm/LinkInsertForm.d.ts +16 -0
- package/es/components/organism/TextEditor/ui/LinkInsertForm/LinkInsertForm.js +61 -0
- package/es/components/organism/TextEditor/ui/LinkInsertForm/index.d.ts +2 -0
- package/es/components/organism/TextEditor/ui/LinkInsertForm/index.js +1 -0
- package/es/components/organism/TextEditor/ui/LinkPopover/LinkPopover.d.ts +9 -0
- package/es/components/organism/TextEditor/ui/LinkPopover/LinkPopover.js +126 -0
- package/es/components/organism/TextEditor/ui/LinkPopover/index.d.ts +2 -0
- package/es/components/organism/TextEditor/ui/LinkPopover/index.js +1 -0
- package/es/components/organism/TextEditor/ui/Popover/Popover.d.ts +6 -0
- package/es/components/organism/TextEditor/ui/Popover/Popover.js +9 -0
- package/es/components/organism/TextEditor/ui/Popover/index.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/Popover/index.js +1 -0
- package/es/components/organism/TextEditor/ui/Select/Select.d.ts +4 -0
- package/es/components/organism/TextEditor/ui/Select/Select.js +7 -0
- package/es/components/organism/TextEditor/ui/Select/index.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/Select/index.js +1 -0
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/SplitButtonDropdown.d.ts +2 -0
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/SplitButtonDropdown.js +44 -0
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/index.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/index.js +1 -0
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/styled.d.ts +2 -0
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/styled.js +58 -0
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/types.d.ts +19 -0
- package/es/components/organism/TextEditor/ui/SplitButtonDropdown/types.js +1 -0
- package/es/components/organism/TextEditor/ui/TextAlignSelect/TextAlignSelect.d.ts +30 -0
- package/es/components/organism/TextEditor/ui/TextAlignSelect/TextAlignSelect.js +75 -0
- package/es/components/organism/TextEditor/ui/TextAlignSelect/index.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/TextAlignSelect/index.js +1 -0
- package/es/components/organism/TextEditor/ui/Toolbar/FormattingToolbar.d.ts +19 -0
- package/es/components/organism/TextEditor/ui/Toolbar/FormattingToolbar.js +85 -0
- package/es/components/organism/TextEditor/ui/Toolbar/LinkPreviewToolbar.d.ts +10 -0
- package/es/components/organism/TextEditor/ui/Toolbar/LinkPreviewToolbar.js +39 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BoldAction.d.ts +6 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BoldAction.js +19 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BulletListAction.d.ts +6 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BulletListAction.js +93 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ClearFormattingAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ClearFormattingAction.js +20 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.d.ts +4 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.js +32 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.d.ts +18 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.js +41 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.d.ts +8 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.js +51 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/HistoryAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/HistoryAction.js +21 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/IndentAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/IndentAction.js +17 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ItalicAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ItalicAction.js +18 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/LetterSpacing.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/LetterSpacing.js +28 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/LineSpacingAction.d.ts +10 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/LineSpacingAction.js +45 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/LinkAction.d.ts +6 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/LinkAction.js +17 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OrderedListAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OrderedListAction.js +67 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OutdentAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OutdentAction.js +17 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SmartTagAction.d.ts +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SmartTagAction.js +18 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/StrikeAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/StrikeAction.js +18 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SubscriptAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SubscriptAction.js +26 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SuperscriptAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SuperscriptAction.js +26 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextAlignAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextAlignAction.js +3 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextBackgroundColorAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextBackgroundColorAction.js +29 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextColorAction.d.ts +14 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextColorAction.js +22 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextTransformAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextTransformAction.js +36 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnderlineAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnderlineAction.js +18 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnsetLink.d.ts +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnsetLink.js +18 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/index.d.ts +24 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/index.js +24 -0
- package/es/components/organism/TextEditor/ui/Toolbar/index.d.ts +2 -0
- package/es/components/organism/TextEditor/ui/Toolbar/index.js +2 -0
- package/es/components/organism/TextEditor/utils/documentState.d.ts +73 -0
- package/es/components/organism/TextEditor/utils/documentState.js +149 -0
- package/es/components/organism/TextEditor/utils/font.d.ts +74 -0
- package/es/components/organism/TextEditor/utils/font.js +147 -0
- package/es/components/organism/TextEditor/utils/htmlProcessing.d.ts +87 -0
- package/es/components/organism/TextEditor/utils/htmlProcessing.js +460 -0
- package/es/components/organism/TextEditor/utils/indent.d.ts +11 -0
- package/es/components/organism/TextEditor/utils/indent.js +56 -0
- package/es/components/organism/TextEditor/utils/index.d.ts +8 -0
- package/es/components/organism/TextEditor/utils/index.js +16 -0
- package/es/components/organism/TextEditor/utils/link.d.ts +116 -0
- package/es/components/organism/TextEditor/utils/link.js +304 -0
- package/es/components/organism/TextEditor/utils/menu.d.ts +134 -0
- package/es/components/organism/TextEditor/utils/menu.js +321 -0
- package/es/components/organism/TextEditor/utils/selection.d.ts +25 -0
- package/es/components/organism/TextEditor/utils/selection.js +58 -0
- package/es/components/organism/TextEditor/utils/shared.d.ts +13 -0
- package/es/components/organism/TextEditor/utils/shared.js +52 -0
- package/es/components/organism/TextEditor/utils/smartTag.d.ts +49 -0
- package/es/components/organism/TextEditor/utils/smartTag.js +90 -0
- package/es/components/organism/TextEditor/utils/style.d.ts +78 -0
- package/es/components/organism/TextEditor/utils/style.js +193 -0
- package/es/components/organism/TicketEditor/styled.js +850 -850
- package/es/components/organism/TicketEditorV2/styled.js +839 -839
- package/es/components/organism/index.d.ts +1 -0
- package/es/components/organism/index.js +1 -0
- package/es/components/organism/index.scss +2 -1
- package/es/components/template/Layout/Layout.js +10 -10
- package/es/components/template/Layout/components/RecommendationWorkspace/components/MenuMapping/components/OldLeftMenu/styled.js +73 -73
- package/es/components/template/Layout/components/RecommendationWorkspace/components/MenuMapping/styled.js +39 -39
- package/es/components/template/Layout/components/RecommendationWorkspace/components/RecommendationImage/styled.js +61 -61
- package/es/components/template/Layout/components/RecommendationWorkspace/styled.js +16 -16
- package/es/components/template/Layout/styled.js +84 -84
- package/es/components/template/TemplateListing/components/BlankTemplate/styled.js +21 -21
- package/es/components/template/TemplateListing/components/CategoryListing/styled.js +123 -123
- package/es/components/template/TemplateListing/components/Empty/styled.js +20 -20
- package/es/components/template/TemplateListing/stories/demo/styled.js +4 -4
- package/es/components/template/TemplateListing/styled/index.js +40 -40
- package/es/constants/index.d.ts +1 -0
- package/es/constants/index.js +1 -0
- package/es/constants/web.d.ts +8 -0
- package/es/constants/web.js +57 -0
- package/es/hooks/index.d.ts +4 -0
- package/es/hooks/index.js +4 -0
- package/es/hooks/useBroadcastedLocalStorage.d.ts +5 -0
- package/es/hooks/useBroadcastedLocalStorage.js +71 -0
- package/es/hooks/useElementSize.d.ts +7 -0
- package/es/hooks/useElementSize.js +56 -0
- package/es/hooks/useEyedropper/attach.d.ts +4 -0
- package/es/hooks/useEyedropper/attach.js +9 -0
- package/es/hooks/useEyedropper/eyedropper.d.ts +69 -0
- package/es/hooks/useEyedropper/eyedropper.js +205 -0
- package/es/hooks/useEyedropper/index.d.ts +2 -0
- package/es/hooks/useEyedropper/index.js +7 -0
- package/es/hooks/useEyedropper/support.d.ts +1 -0
- package/es/hooks/useEyedropper/support.js +3 -0
- package/es/hooks/useEyedropper/types.d.ts +9 -0
- package/es/hooks/useEyedropper/types.js +1 -0
- package/es/hooks/useEyedropper/useEyedropper.d.ts +8 -0
- package/es/hooks/useEyedropper/useEyedropper.js +50 -0
- package/es/hooks/useEyedropper/utils.d.ts +11 -0
- package/es/hooks/useEyedropper/utils.js +17 -0
- package/es/hooks/useIsMounted.d.ts +1 -0
- package/es/hooks/useIsMounted.js +11 -0
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/locales/en/google-sheet.json +109 -8
- package/es/locales/i18n.d.ts +307 -4
- package/es/locales/ja/google-sheet.json +301 -200
- package/es/locales/vi/google-sheet.json +118 -17
- package/es/providers/ConfigProvider/GlobalStyle.js +1249 -1249
- package/es/styled/common.js +51 -51
- package/es/tests/styled.js +4 -4
- package/es/types/index.d.ts +9 -0
- package/es/utils/common.d.ts +15 -9
- package/es/utils/common.js +62 -24
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +1 -0
- package/es/utils/variables.js +7 -7
- package/es/utils/web.d.ts +80 -0
- package/es/utils/web.js +226 -0
- package/package.json +276 -266
- package/CHANGELOG.md +0 -63
package/es/styled/common.js
CHANGED
|
@@ -4,56 +4,56 @@ import styled from 'styled-components';
|
|
|
4
4
|
import { globalToken } from '../constants';
|
|
5
5
|
// Components
|
|
6
6
|
import { Button } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
7
|
-
export const IconButton = styled.div `
|
|
8
|
-
width: 20px;
|
|
9
|
-
height: 20px;
|
|
10
|
-
display: flex;
|
|
11
|
-
align-items: center;
|
|
12
|
-
justify-content: center;
|
|
13
|
-
transition: all 200ms;
|
|
14
|
-
flex-shrink: 0;
|
|
15
|
-
|
|
16
|
-
i {
|
|
17
|
-
font-size: 14px;
|
|
18
|
-
color: ${globalToken?.bw8};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
&:hover {
|
|
22
|
-
i {
|
|
23
|
-
color: ${globalToken?.bw10};
|
|
24
|
-
}
|
|
25
|
-
}
|
|
7
|
+
export const IconButton = styled.div `
|
|
8
|
+
width: 20px;
|
|
9
|
+
height: 20px;
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
transition: all 200ms;
|
|
14
|
+
flex-shrink: 0;
|
|
15
|
+
|
|
16
|
+
i {
|
|
17
|
+
font-size: 14px;
|
|
18
|
+
color: ${globalToken?.bw8};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&:hover {
|
|
22
|
+
i {
|
|
23
|
+
color: ${globalToken?.bw10};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
26
|
`;
|
|
27
|
-
export const ActionButton = styled(Button) `
|
|
28
|
-
display: flex !important;
|
|
29
|
-
flex-direction: column;
|
|
30
|
-
align-items: center;
|
|
31
|
-
height: 43px !important;
|
|
32
|
-
width: 50px !important;
|
|
33
|
-
gap: 4px !important;
|
|
34
|
-
padding: 3px 0px !important;
|
|
35
|
-
font-size: 8px !important;
|
|
36
|
-
line-height: 1 !important;
|
|
37
|
-
color: ${globalToken?.bw8} !important;
|
|
38
|
-
|
|
39
|
-
${props => props.$hide && `visibility: hidden !important;`}
|
|
40
|
-
|
|
41
|
-
.action-icon {
|
|
42
|
-
display: flex;
|
|
43
|
-
align-items: center;
|
|
44
|
-
justify-content: center;
|
|
45
|
-
flex-shrink: 0;
|
|
46
|
-
> i {
|
|
47
|
-
font-size: 24px !important;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/* &:hover, */
|
|
52
|
-
&:active {
|
|
53
|
-
color: ${globalToken?.colorPrimary} !important;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
&:disabled {
|
|
57
|
-
background-color: ${globalToken?.bw2} !important;
|
|
58
|
-
}
|
|
27
|
+
export const ActionButton = styled(Button) `
|
|
28
|
+
display: flex !important;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
align-items: center;
|
|
31
|
+
height: 43px !important;
|
|
32
|
+
width: 50px !important;
|
|
33
|
+
gap: 4px !important;
|
|
34
|
+
padding: 3px 0px !important;
|
|
35
|
+
font-size: 8px !important;
|
|
36
|
+
line-height: 1 !important;
|
|
37
|
+
color: ${globalToken?.bw8} !important;
|
|
38
|
+
|
|
39
|
+
${props => props.$hide && `visibility: hidden !important;`}
|
|
40
|
+
|
|
41
|
+
.action-icon {
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
flex-shrink: 0;
|
|
46
|
+
> i {
|
|
47
|
+
font-size: 24px !important;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* &:hover, */
|
|
52
|
+
&:active {
|
|
53
|
+
color: ${globalToken?.colorPrimary} !important;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&:disabled {
|
|
57
|
+
background-color: ${globalToken?.bw2} !important;
|
|
58
|
+
}
|
|
59
59
|
`;
|
package/es/tests/styled.js
CHANGED
package/es/types/index.d.ts
CHANGED
|
@@ -3,6 +3,15 @@ export type THandleErrorPayload = {
|
|
|
3
3
|
name: string;
|
|
4
4
|
args: Record<string, any>;
|
|
5
5
|
};
|
|
6
|
+
/** Generic data attributes to set on components */
|
|
7
|
+
export type DataAttribute = {
|
|
8
|
+
/** The key for the attribute */
|
|
9
|
+
key: `data-${string}`;
|
|
10
|
+
/** The value */
|
|
11
|
+
value: string;
|
|
12
|
+
};
|
|
13
|
+
/** An array of data attributes */
|
|
14
|
+
export type DataAttributes = DataAttribute[];
|
|
6
15
|
export type TLocale = 'en' | 'vi';
|
|
7
16
|
export type GenericFunction = (...args: any[]) => any;
|
|
8
17
|
export type TConfigErrorInfo = {
|
package/es/utils/common.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DataAttributes } from '../types';
|
|
1
2
|
/**
|
|
2
3
|
* Function to reorder list
|
|
3
4
|
* @param {Object[]} list - list of item want to reorder
|
|
@@ -66,17 +67,14 @@ export declare const searchParamsToObject: (searchParams?: string) => Record<str
|
|
|
66
67
|
export declare const getShuffleArray: <T>(array: T[]) => T[];
|
|
67
68
|
export declare const snakeCaseToCamelCase: <T = Record<string, any>>(object: Record<string, any> | Record<string, any>[], recursive?: boolean) => T;
|
|
68
69
|
export declare const camelCaseToSnakeCase: <T = Record<string, any>>(object: Record<string, any>, recursive?: boolean) => T;
|
|
69
|
-
export declare function generateKey():
|
|
70
|
+
export declare function generateKey(): string;
|
|
70
71
|
export declare const formatUserId: (userId?: number) => string;
|
|
71
72
|
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
/** Remove all accents and convert string to lower case, remove leading and trailing white space */
|
|
78
|
-
export declare const simplifyString: (str: string) => string;
|
|
79
|
-
/**
|
|
73
|
+
* Checks string matching based on a query, supporting fuzzy matching,
|
|
74
|
+
* where the query characters must appear in order within the target string.
|
|
75
|
+
* Allows for missing characters in the query relative to the target,
|
|
76
|
+
* and ignores case, diacritics, and spaces.
|
|
77
|
+
*
|
|
80
78
|
* @param str target string
|
|
81
79
|
* @param queryStr search query
|
|
82
80
|
* @returns true if target string includes search query
|
|
@@ -165,5 +163,13 @@ export declare const convertNumberByDisplayFormat: (value: number | string, grou
|
|
|
165
163
|
export declare function numberWithCommas(n: number): string;
|
|
166
164
|
export declare const multiPercentageValue: (value?: string) => string;
|
|
167
165
|
export declare const antsomiClsx: (componentName: string) => (className: string) => string;
|
|
166
|
+
/**
|
|
167
|
+
* Take an array of data attribute key/value pairs and return an object which
|
|
168
|
+
* can be spread into a component's definition
|
|
169
|
+
*
|
|
170
|
+
* @param attributes
|
|
171
|
+
* @returns A spreadable object of data-attributes
|
|
172
|
+
*/
|
|
173
|
+
export declare const dataAttrArrayToObject: (attributes?: DataAttributes) => Record<string, string>;
|
|
168
174
|
export declare function arrayToMapByProperty<T extends object, K extends keyof T>(array: T[], propertyName: K): Map<T[K], T>;
|
|
169
175
|
export declare function compareStrings(a: any, b: any): number;
|
package/es/utils/common.js
CHANGED
|
@@ -6,7 +6,7 @@ import uniqid from 'uniqid';
|
|
|
6
6
|
import { MESSAGES, PORTAL_KEYS } from '@antscorp/antsomi-ui/es/services/constants';
|
|
7
7
|
// Utils
|
|
8
8
|
import { handleError } from './handleError';
|
|
9
|
-
import { keyBy, sortBy } from 'lodash';
|
|
9
|
+
import { kebabCase, keyBy, sortBy, toString } from 'lodash';
|
|
10
10
|
import clsx from 'clsx';
|
|
11
11
|
import { ANTSOMI_COMPONENT_PREFIX_CLS } from '../constants';
|
|
12
12
|
const PATH = 'src/utils/common.ts';
|
|
@@ -430,35 +430,57 @@ export function generateKey() {
|
|
|
430
430
|
}
|
|
431
431
|
export const formatUserId = (userId) => String(userId || '').replace(/(\d{3})(\d{3})(\d{0,})/, `$1-$2-$3`);
|
|
432
432
|
/**
|
|
433
|
-
*
|
|
434
|
-
*
|
|
435
|
-
*
|
|
433
|
+
* Normalizes a string for searching by:
|
|
434
|
+
* 1. Converting to NFD Unicode form and removing diacritics.
|
|
435
|
+
* 2. Converting to lowercase.
|
|
436
|
+
* 3. Removing all whitespace.
|
|
437
|
+
* @param str The string to normalize.
|
|
438
|
+
* @returns The normalized string.
|
|
436
439
|
*/
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
str = str.replace(/[ÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠ]/g, 'O');
|
|
449
|
-
str = str.replace(/Ù|Ú|Ụ|Ủ|Ũ|Ư|Ừ|Ứ|Ự|Ử|Ữ/g, 'U');
|
|
450
|
-
str = str.replace(/Ỳ|Ý|Ỵ|Ỷ|Ỹ/g, 'Y');
|
|
451
|
-
str = str.replace(/Đ/g, 'D');
|
|
452
|
-
return str;
|
|
453
|
-
};
|
|
454
|
-
/** Remove all accents and convert string to lower case, remove leading and trailing white space */
|
|
455
|
-
export const simplifyString = (str) => removeAccent(`${str || ''}`.toLowerCase().trim()) || '';
|
|
440
|
+
function normalizeStringForSearch(str) {
|
|
441
|
+
const normalizedStr = typeof str !== 'string' ? toString(str) : str;
|
|
442
|
+
if (!normalizedStr) {
|
|
443
|
+
return ''; // Handle null, undefined, or empty string inputs
|
|
444
|
+
}
|
|
445
|
+
return normalizedStr
|
|
446
|
+
.normalize('NFD') // Decompose accented characters (e.g., "á" -> "a" + "´")
|
|
447
|
+
.replace(/[\u0300-\u036f]/g, '') // Remove diacritical marks
|
|
448
|
+
.toLowerCase() // Convert to lowercase
|
|
449
|
+
.replace(/\s+/g, ''); // Remove all whitespace
|
|
450
|
+
}
|
|
456
451
|
/**
|
|
452
|
+
* Checks string matching based on a query, supporting fuzzy matching,
|
|
453
|
+
* where the query characters must appear in order within the target string.
|
|
454
|
+
* Allows for missing characters in the query relative to the target,
|
|
455
|
+
* and ignores case, diacritics, and spaces.
|
|
456
|
+
*
|
|
457
457
|
* @param str target string
|
|
458
458
|
* @param queryStr search query
|
|
459
459
|
* @returns true if target string includes search query
|
|
460
460
|
*/
|
|
461
|
-
export const searchStringQuery = (str, queryStr) =>
|
|
461
|
+
export const searchStringQuery = (str, queryStr) => {
|
|
462
|
+
const normalizedQuery = normalizeStringForSearch(queryStr);
|
|
463
|
+
const normalizedItem = normalizeStringForSearch(str);
|
|
464
|
+
// Optimization: if normalized query is longer than normalized item,
|
|
465
|
+
// it cannot be a subsequence.
|
|
466
|
+
if (normalizedQuery.length > normalizedItem.length) {
|
|
467
|
+
return false;
|
|
468
|
+
}
|
|
469
|
+
// Subsequence check:
|
|
470
|
+
// Iterate through both normalized strings.
|
|
471
|
+
// If characters match, advance the query pointer.
|
|
472
|
+
// Always advance the item pointer.
|
|
473
|
+
let queryIndex = 0;
|
|
474
|
+
let itemIndex = 0;
|
|
475
|
+
while (queryIndex < normalizedQuery.length && itemIndex < normalizedItem.length) {
|
|
476
|
+
if (normalizedQuery[queryIndex] === normalizedItem[itemIndex]) {
|
|
477
|
+
queryIndex++;
|
|
478
|
+
}
|
|
479
|
+
itemIndex++;
|
|
480
|
+
}
|
|
481
|
+
// If queryIndex reached the end of normalizedQuery, all its characters were found in order.
|
|
482
|
+
return queryIndex === normalizedQuery.length;
|
|
483
|
+
};
|
|
462
484
|
/**
|
|
463
485
|
* Checks if any of the provided values match the search value.
|
|
464
486
|
*
|
|
@@ -742,6 +764,22 @@ export const antsomiClsx = (componentName) => (className) => {
|
|
|
742
764
|
});
|
|
743
765
|
return clsx(classNames);
|
|
744
766
|
};
|
|
767
|
+
/**
|
|
768
|
+
* Take an array of data attribute key/value pairs and return an object which
|
|
769
|
+
* can be spread into a component's definition
|
|
770
|
+
*
|
|
771
|
+
* @param attributes
|
|
772
|
+
* @returns A spreadable object of data-attributes
|
|
773
|
+
*/
|
|
774
|
+
export const dataAttrArrayToObject = (attributes = []) => attributes.reduce((output, current) => {
|
|
775
|
+
// Ensure we follow the correct syntax so we will just return the output if not
|
|
776
|
+
if (!/^data-([a-z]+-)*[a-z]+$/g.test(kebabCase(current.key)))
|
|
777
|
+
return output;
|
|
778
|
+
// Assign the key/value pair to the output object
|
|
779
|
+
output[kebabCase(current.key)] = current.value;
|
|
780
|
+
// return the object
|
|
781
|
+
return output;
|
|
782
|
+
}, {});
|
|
745
783
|
export function arrayToMapByProperty(array, propertyName) {
|
|
746
784
|
// Đảm bảo đầu vào là một mảng và không rỗng
|
|
747
785
|
if (!Array.isArray(array) || array.length === 0) {
|
package/es/utils/index.d.ts
CHANGED
package/es/utils/index.js
CHANGED
package/es/utils/variables.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { css } from 'styled-components';
|
|
2
|
-
export const breakdownMd = style => css `
|
|
3
|
-
/* @media (max-width: 1600px) {
|
|
4
|
-
${style};
|
|
5
|
-
} */
|
|
6
|
-
${style}/* @media (max-width: 1500px) {
|
|
7
|
-
${style};
|
|
8
|
-
} */
|
|
2
|
+
export const breakdownMd = style => css `
|
|
3
|
+
/* @media (max-width: 1600px) {
|
|
4
|
+
${style};
|
|
5
|
+
} */
|
|
6
|
+
${style}/* @media (max-width: 1500px) {
|
|
7
|
+
${style};
|
|
8
|
+
} */
|
|
9
9
|
`;
|
package/es/utils/web.d.ts
CHANGED
|
@@ -1,4 +1,70 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
* Parses a font family string and extracts individual font names
|
|
4
|
+
* Handles quoted fonts, fallbacks, and CSS font-family syntax
|
|
5
|
+
* @param fontFamily - Font family string (e.g., "'Roboto', Arial, sans-serif")
|
|
6
|
+
* @returns Array of individual font names
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseFontFamily(fontFamily: string): string[];
|
|
9
|
+
/**
|
|
10
|
+
* Checks if a given font name is considered a web safe font
|
|
11
|
+
* @param fontName - The font name to check (case insensitive)
|
|
12
|
+
* @param includeGeneric - Whether to consider generic font families as web safe (default: false)
|
|
13
|
+
* @returns boolean - True if the font is web safe, false otherwise
|
|
14
|
+
*/
|
|
15
|
+
export declare function isWebSafeFont(fontName: string, includeGeneric?: boolean): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Extracts the primary font from a font-family string
|
|
18
|
+
* @param fontFamily Font family string (may contain fallbacks)
|
|
19
|
+
* @returns Primary font name
|
|
20
|
+
*/
|
|
21
|
+
export declare function getPrimaryFontFamily(fontFamily: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Checks if the first font in a font family string is web safe
|
|
24
|
+
* @param fontFamily - Font family string
|
|
25
|
+
* @returns boolean - True if the primary font is web safe
|
|
26
|
+
*/
|
|
27
|
+
export declare function isPrimaryFontWebSafe(fontFamily: string): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Checks if a font name is a generic font family (CSS keyword)
|
|
30
|
+
* @param fontName - The font name to check
|
|
31
|
+
* @returns boolean - True if it's a generic font family
|
|
32
|
+
*/
|
|
33
|
+
export declare function isGenericFontFamily(fontName: string): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Checks if a font family string (with potential fallbacks) contains any web safe fonts
|
|
36
|
+
* @param fontFamily - Font family string with potential fallbacks (e.g., "'Custom Font', Arial, sans-serif")
|
|
37
|
+
* @param options - Configuration options
|
|
38
|
+
* @returns Object with detailed analysis
|
|
39
|
+
*/
|
|
40
|
+
export declare function analyzeFontFamily(fontFamily: string, options?: {
|
|
41
|
+
includeGenericAsWebSafe?: boolean;
|
|
42
|
+
}): {
|
|
43
|
+
hasWebSafeFonts: boolean;
|
|
44
|
+
webSafeFonts: string[];
|
|
45
|
+
nonWebSafeFonts: string[];
|
|
46
|
+
genericFonts: string[];
|
|
47
|
+
allFonts: string[];
|
|
48
|
+
isFullyWebSafe: boolean;
|
|
49
|
+
isPrimaryFontWebSafe: boolean;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Gets all available web safe fonts
|
|
53
|
+
* @returns Array of web safe font names
|
|
54
|
+
*/
|
|
55
|
+
export declare function getWebSafeFonts(): readonly string[];
|
|
56
|
+
/**
|
|
57
|
+
* Finds web safe font alternatives for a given font
|
|
58
|
+
* @param fontName - The font name to find alternatives for
|
|
59
|
+
* @returns Array of similar web safe fonts
|
|
60
|
+
*/
|
|
61
|
+
export declare function getWebSafeFontAlternatives(fontName: string): string[];
|
|
62
|
+
/**
|
|
63
|
+
* Creates a font stack with appropriate fallbacks
|
|
64
|
+
* @param primaryFont Primary font family
|
|
65
|
+
* @returns Complete font stack string
|
|
66
|
+
*/
|
|
67
|
+
export declare function createFontStack(primaryFont: string): string;
|
|
2
68
|
/**
|
|
3
69
|
* Function to parse search params string to object
|
|
4
70
|
* @param {string} searchParams - search params
|
|
@@ -21,3 +87,17 @@ export declare const isLinux: () => boolean;
|
|
|
21
87
|
* @returns Platform-appropriate modifier key
|
|
22
88
|
*/
|
|
23
89
|
export declare const getModifierKey: () => "⌘" | "Ctrl";
|
|
90
|
+
/**
|
|
91
|
+
* Formats a hotkey string with the appropriate modifier
|
|
92
|
+
* @param key The key to format
|
|
93
|
+
* @returns Formatted hotkey string
|
|
94
|
+
*/
|
|
95
|
+
export declare const formatHotkey: (key: string) => string;
|
|
96
|
+
/**
|
|
97
|
+
* Chuyển đổi giá trị CSS 'px' thành số nguyên.
|
|
98
|
+
* Ví dụ: "16px" => 16
|
|
99
|
+
*
|
|
100
|
+
* @param fontSizeString - Chuỗi kích thước font, ví dụ: "16px".
|
|
101
|
+
* @returns Số nguyên hoặc null nếu chuỗi không hợp lệ.
|
|
102
|
+
*/
|
|
103
|
+
export declare function convertPxToNumber(fontSizeString: unknown): number | null;
|
package/es/utils/web.js
CHANGED
|
@@ -1,4 +1,199 @@
|
|
|
1
1
|
import { VALUE_C, VALUE_CONTROL, VALUE_LEFT_WINDOW, VALUE_V, VALUE_X, VALUE_Z, } from '@antscorp/antsomi-ui/es/constants/keyCode';
|
|
2
|
+
import { GENERIC_FONT_FAMILIES, WEB_SAFE_FONTS } from '../constants';
|
|
3
|
+
/**
|
|
4
|
+
* Parses a font family string and extracts individual font names
|
|
5
|
+
* Handles quoted fonts, fallbacks, and CSS font-family syntax
|
|
6
|
+
* @param fontFamily - Font family string (e.g., "'Roboto', Arial, sans-serif")
|
|
7
|
+
* @returns Array of individual font names
|
|
8
|
+
*/
|
|
9
|
+
export function parseFontFamily(fontFamily) {
|
|
10
|
+
if (!fontFamily || typeof fontFamily !== 'string') {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
// Split by comma and clean up each font name
|
|
14
|
+
return fontFamily
|
|
15
|
+
.split(',')
|
|
16
|
+
.map(font => font.trim())
|
|
17
|
+
.map(font =>
|
|
18
|
+
// Remove quotes (single or double)
|
|
19
|
+
font.replace(/^['"]|['"]$/g, ''))
|
|
20
|
+
.map(font => font.trim())
|
|
21
|
+
.filter(font => font.length > 0);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Checks if a given font name is considered a web safe font
|
|
25
|
+
* @param fontName - The font name to check (case insensitive)
|
|
26
|
+
* @param includeGeneric - Whether to consider generic font families as web safe (default: false)
|
|
27
|
+
* @returns boolean - True if the font is web safe, false otherwise
|
|
28
|
+
*/
|
|
29
|
+
export function isWebSafeFont(fontName, includeGeneric = false) {
|
|
30
|
+
if (!fontName || typeof fontName !== 'string') {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
// Normalize the font name: trim whitespace and convert to lowercase
|
|
34
|
+
const normalizedFontName = fontName.trim().toLowerCase();
|
|
35
|
+
// Check if it's a specific web safe font
|
|
36
|
+
const isSpecificWebSafe = WEB_SAFE_FONTS.some(f => f === normalizedFontName);
|
|
37
|
+
// If including generic fonts, also check if it's a generic font family
|
|
38
|
+
if (includeGeneric) {
|
|
39
|
+
const isGeneric = GENERIC_FONT_FAMILIES.some(f => f === normalizedFontName);
|
|
40
|
+
return isSpecificWebSafe || isGeneric;
|
|
41
|
+
}
|
|
42
|
+
return isSpecificWebSafe;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Extracts the primary font from a font-family string
|
|
46
|
+
* @param fontFamily Font family string (may contain fallbacks)
|
|
47
|
+
* @returns Primary font name
|
|
48
|
+
*/
|
|
49
|
+
export function getPrimaryFontFamily(fontFamily) {
|
|
50
|
+
if (!fontFamily)
|
|
51
|
+
return '';
|
|
52
|
+
const fonts = parseFontFamily(fontFamily);
|
|
53
|
+
const primaryFont = fonts[0].trim();
|
|
54
|
+
// Remove quotes if present
|
|
55
|
+
return primaryFont.replace(/^["']|["']$/g, '');
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Checks if the first font in a font family string is web safe
|
|
59
|
+
* @param fontFamily - Font family string
|
|
60
|
+
* @returns boolean - True if the primary font is web safe
|
|
61
|
+
*/
|
|
62
|
+
export function isPrimaryFontWebSafe(fontFamily) {
|
|
63
|
+
const fonts = parseFontFamily(fontFamily);
|
|
64
|
+
return fonts.length > 0 ? isWebSafeFont(fonts[0]) : false;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Checks if a font name is a generic font family (CSS keyword)
|
|
68
|
+
* @param fontName - The font name to check
|
|
69
|
+
* @returns boolean - True if it's a generic font family
|
|
70
|
+
*/
|
|
71
|
+
export function isGenericFontFamily(fontName) {
|
|
72
|
+
if (!fontName || typeof fontName !== 'string') {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
const normalizedFontName = fontName.trim().toLowerCase();
|
|
76
|
+
return GENERIC_FONT_FAMILIES.includes(normalizedFontName);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Checks if a font family string (with potential fallbacks) contains any web safe fonts
|
|
80
|
+
* @param fontFamily - Font family string with potential fallbacks (e.g., "'Custom Font', Arial, sans-serif")
|
|
81
|
+
* @param options - Configuration options
|
|
82
|
+
* @returns Object with detailed analysis
|
|
83
|
+
*/
|
|
84
|
+
export function analyzeFontFamily(fontFamily, options = {}) {
|
|
85
|
+
const { includeGenericAsWebSafe = false } = options;
|
|
86
|
+
const fonts = parseFontFamily(fontFamily);
|
|
87
|
+
const webSafeFonts = [];
|
|
88
|
+
const nonWebSafeFonts = [];
|
|
89
|
+
const genericFonts = [];
|
|
90
|
+
fonts.forEach(font => {
|
|
91
|
+
if (isGenericFontFamily(font)) {
|
|
92
|
+
genericFonts.push(font);
|
|
93
|
+
}
|
|
94
|
+
else if (isWebSafeFont(font)) {
|
|
95
|
+
webSafeFonts.push(font);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
nonWebSafeFonts.push(font);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
// Calculate web safety based on options
|
|
102
|
+
let isFullyWebSafe;
|
|
103
|
+
let hasWebSafeFonts;
|
|
104
|
+
if (includeGenericAsWebSafe) {
|
|
105
|
+
// Include generic fonts as web safe
|
|
106
|
+
hasWebSafeFonts = webSafeFonts.length > 0 || genericFonts.length > 0;
|
|
107
|
+
isFullyWebSafe =
|
|
108
|
+
nonWebSafeFonts.length === 0 && (webSafeFonts.length > 0 || genericFonts.length > 0);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
// Only specific web safe fonts count
|
|
112
|
+
hasWebSafeFonts = webSafeFonts.length > 0;
|
|
113
|
+
// Must have NO non-web-safe fonts AND NO generic fonts for strict mode
|
|
114
|
+
isFullyWebSafe =
|
|
115
|
+
nonWebSafeFonts.length === 0 && genericFonts.length === 0 && webSafeFonts.length > 0;
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
hasWebSafeFonts,
|
|
119
|
+
webSafeFonts,
|
|
120
|
+
nonWebSafeFonts,
|
|
121
|
+
genericFonts,
|
|
122
|
+
allFonts: fonts,
|
|
123
|
+
isFullyWebSafe,
|
|
124
|
+
isPrimaryFontWebSafe: isPrimaryFontWebSafe(fontFamily),
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Gets all available web safe fonts
|
|
129
|
+
* @returns Array of web safe font names
|
|
130
|
+
*/
|
|
131
|
+
export function getWebSafeFonts() {
|
|
132
|
+
return WEB_SAFE_FONTS;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Finds web safe font alternatives for a given font
|
|
136
|
+
* @param fontName - The font name to find alternatives for
|
|
137
|
+
* @returns Array of similar web safe fonts
|
|
138
|
+
*/
|
|
139
|
+
export function getWebSafeFontAlternatives(fontName) {
|
|
140
|
+
const normalizedFontName = fontName.trim().toLowerCase();
|
|
141
|
+
// Define font categories and their alternatives
|
|
142
|
+
const fontCategories = {
|
|
143
|
+
serif: [
|
|
144
|
+
'times new roman',
|
|
145
|
+
'times',
|
|
146
|
+
'georgia',
|
|
147
|
+
'garamond',
|
|
148
|
+
'book antiqua',
|
|
149
|
+
'palatino linotype',
|
|
150
|
+
'palatino',
|
|
151
|
+
],
|
|
152
|
+
sansSerif: ['arial', 'helvetica', 'verdana', 'tahoma', 'geneva', 'lucida sans'],
|
|
153
|
+
monospace: ['courier new', 'courier', 'monaco', 'menlo', 'consolas', 'lucida console'],
|
|
154
|
+
cursive: ['comic sans ms', 'brush script mt'],
|
|
155
|
+
fantasy: ['papyrus', 'copperplate', 'fantasy'],
|
|
156
|
+
};
|
|
157
|
+
// If it's already web safe, return similar fonts from the same category
|
|
158
|
+
if (isWebSafeFont(normalizedFontName)) {
|
|
159
|
+
for (const [_category, fonts] of Object.entries(fontCategories)) {
|
|
160
|
+
if (fonts.includes(normalizedFontName)) {
|
|
161
|
+
return fonts.filter(font => font !== normalizedFontName);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
// For non-web-safe fonts, suggest based on common patterns
|
|
166
|
+
if (normalizedFontName.includes('serif') && !normalizedFontName.includes('sans')) {
|
|
167
|
+
return fontCategories.serif;
|
|
168
|
+
}
|
|
169
|
+
if (normalizedFontName.includes('sans') ||
|
|
170
|
+
normalizedFontName.includes('arial') ||
|
|
171
|
+
normalizedFontName.includes('helvetica')) {
|
|
172
|
+
return fontCategories.sansSerif;
|
|
173
|
+
}
|
|
174
|
+
if (normalizedFontName.includes('mono') ||
|
|
175
|
+
normalizedFontName.includes('courier') ||
|
|
176
|
+
normalizedFontName.includes('code')) {
|
|
177
|
+
return fontCategories.monospace;
|
|
178
|
+
}
|
|
179
|
+
if (normalizedFontName.includes('script') ||
|
|
180
|
+
normalizedFontName.includes('cursive') ||
|
|
181
|
+
normalizedFontName.includes('comic')) {
|
|
182
|
+
return fontCategories.cursive;
|
|
183
|
+
}
|
|
184
|
+
// Default fallback to common sans-serif fonts
|
|
185
|
+
return fontCategories.sansSerif;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Creates a font stack with appropriate fallbacks
|
|
189
|
+
* @param primaryFont Primary font family
|
|
190
|
+
* @returns Complete font stack string
|
|
191
|
+
*/
|
|
192
|
+
export function createFontStack(primaryFont) {
|
|
193
|
+
const fallbacks = getWebSafeFontAlternatives(primaryFont);
|
|
194
|
+
const stack = [primaryFont, ...fallbacks];
|
|
195
|
+
return stack.join(', ');
|
|
196
|
+
}
|
|
2
197
|
/**
|
|
3
198
|
* Function to parse search params string to object
|
|
4
199
|
* @param {string} searchParams - search params
|
|
@@ -57,3 +252,34 @@ export const isLinux = () => getPlatform() === 'linux';
|
|
|
57
252
|
* @returns Platform-appropriate modifier key
|
|
58
253
|
*/
|
|
59
254
|
export const getModifierKey = () => (isMacOS() ? '⌘' : 'Ctrl');
|
|
255
|
+
/**
|
|
256
|
+
* Formats a hotkey string with the appropriate modifier
|
|
257
|
+
* @param key The key to format
|
|
258
|
+
* @returns Formatted hotkey string
|
|
259
|
+
*/
|
|
260
|
+
export const formatHotkey = (key) => {
|
|
261
|
+
const modifier = getModifierKey();
|
|
262
|
+
return `${modifier}+${key}`;
|
|
263
|
+
};
|
|
264
|
+
/**
|
|
265
|
+
* Chuyển đổi giá trị CSS 'px' thành số nguyên.
|
|
266
|
+
* Ví dụ: "16px" => 16
|
|
267
|
+
*
|
|
268
|
+
* @param fontSizeString - Chuỗi kích thước font, ví dụ: "16px".
|
|
269
|
+
* @returns Số nguyên hoặc null nếu chuỗi không hợp lệ.
|
|
270
|
+
*/
|
|
271
|
+
export function convertPxToNumber(fontSizeString) {
|
|
272
|
+
// Kiểm tra xem đầu vào có phải là chuỗi không
|
|
273
|
+
if (typeof fontSizeString !== 'string') {
|
|
274
|
+
return null;
|
|
275
|
+
}
|
|
276
|
+
// Sử dụng parseInt để lấy phần số.
|
|
277
|
+
// parseInt sẽ dừng lại khi gặp ký tự không phải số, ví dụ 'p' trong 'px'.
|
|
278
|
+
const numberValue = parseInt(fontSizeString, 10);
|
|
279
|
+
// Kiểm tra xem kết quả có phải là một số hợp lệ không
|
|
280
|
+
// (isNaN - Is Not a Number)
|
|
281
|
+
if (isNaN(numberValue)) {
|
|
282
|
+
return null;
|
|
283
|
+
}
|
|
284
|
+
return numberValue;
|
|
285
|
+
}
|