@pareto-engineering/design-system 4.0.0-alpha.5 → 4.0.0-alpha.50
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/dist/cjs/a/AnimatedBlobs/AnimatedBlobs.js +90 -0
- package/dist/cjs/a/AnimatedBlobs/index.js +13 -0
- package/dist/cjs/a/AnimatedBlobs/styles.scss +87 -0
- package/dist/cjs/a/AnimatedGradient/AnimatedGradient.js +60 -0
- package/dist/cjs/a/AnimatedGradient/index.js +13 -0
- package/dist/cjs/a/AnimatedGradient/styles.scss +14 -0
- package/dist/cjs/a/AnimatedGradient/webGIRenderer.js +528 -0
- package/dist/cjs/a/AppContext/ContextProvider.js +0 -2
- package/dist/cjs/a/AppContext/useTheme.js +0 -4
- package/dist/cjs/a/BlurOverlay/BlurOverlay.js +59 -0
- package/dist/cjs/a/BlurOverlay/index.js +13 -0
- package/dist/cjs/a/BlurOverlay/styles.scss +31 -0
- package/dist/cjs/a/ContentTree/ContentTree.js +10 -4
- package/dist/cjs/a/ContentTree/common/Tree/Tree.js +12 -5
- package/dist/cjs/a/ContentTree/styles.scss +34 -11
- package/dist/cjs/a/Conversation/Conversation.js +11 -16
- package/dist/cjs/a/Conversation/common/Message/Message.js +15 -12
- package/dist/cjs/a/Conversation/styles.scss +56 -124
- package/dist/cjs/a/DotInfo/DotInfo.js +1 -1
- package/dist/cjs/a/Figure/Figure.js +1 -1
- package/dist/cjs/a/HamburgerButton/HamburgerButton.js +1 -1
- package/dist/cjs/a/IconList/IconList.js +1 -1
- package/dist/cjs/a/IconList/common/Item/Item.js +1 -1
- package/dist/cjs/a/Label/Label.js +13 -5
- package/dist/cjs/a/Label/styles.scss +4 -4
- package/dist/cjs/a/LoadingCircle/LoadingCircle.js +1 -1
- package/dist/cjs/a/MetaCard/MetaCard.js +65 -0
- package/dist/cjs/a/MetaCard/index.js +13 -0
- package/dist/cjs/a/MetaCard/styles.scss +45 -0
- package/dist/cjs/a/People/People.js +1 -1
- package/dist/cjs/a/People/common/Person/Person.js +5 -5
- package/dist/cjs/a/People/styles.scss +10 -4
- package/dist/cjs/a/Popover/Popover.js +3 -3
- package/dist/cjs/a/Popover/styles.scss +1 -1
- package/dist/cjs/a/ProgressBar/ProgressBar.js +1 -1
- package/dist/cjs/a/Quote/Quote.js +1 -1
- package/dist/cjs/a/Removable/Removable.js +72 -0
- package/dist/cjs/a/Removable/index.js +13 -0
- package/dist/cjs/a/Removable/styles.scss +33 -0
- package/dist/cjs/a/SVG/SVG.js +1 -1
- package/dist/cjs/a/SnapScroller/SnapScroller.js +1 -1
- package/dist/cjs/a/SnapScroller/styles.scss +30 -10
- package/dist/cjs/a/Spinner/Spinner.js +1 -1
- package/dist/cjs/a/TextSteps/TextSteps.js +70 -0
- package/dist/cjs/a/TextSteps/index.js +13 -0
- package/dist/cjs/a/TextSteps/styles.scss +29 -0
- package/dist/cjs/a/Timestamp/Timestamp.js +1 -1
- package/dist/cjs/a/Tip/Tip.js +86 -0
- package/dist/cjs/a/Tip/index.js +13 -0
- package/dist/cjs/a/Tip/styles.scss +16 -0
- package/dist/cjs/a/index.js +50 -1
- package/dist/cjs/b/Button/Button.js +22 -9
- package/dist/cjs/b/Button/common/Group/Group.js +57 -0
- package/dist/cjs/b/Button/common/Group/index.js +13 -0
- package/dist/cjs/b/Button/common/Group/styles.scss +11 -0
- package/dist/cjs/b/Button/common/index.js +12 -0
- package/dist/cjs/b/Button/styles.scss +41 -11
- package/dist/cjs/b/Card/Card.js +74 -0
- package/dist/cjs/b/Card/common/Group/Group.js +73 -0
- package/dist/cjs/b/Card/common/Group/index.js +13 -0
- package/dist/cjs/b/Card/common/Group/styles.scss +35 -0
- package/dist/cjs/b/Card/common/Section/Section.js +59 -0
- package/dist/cjs/b/Card/common/Section/index.js +13 -0
- package/dist/cjs/b/Card/common/index.js +19 -0
- package/dist/cjs/b/Card/index.js +13 -0
- package/dist/cjs/b/Card/styles.scss +57 -0
- package/dist/cjs/b/Logo/Logo.js +1 -1
- package/dist/cjs/b/Page/Page.js +15 -5
- package/dist/cjs/b/Page/common/PageHelmet/PageHelmet.js +12 -2
- package/dist/cjs/b/Page/common/Section/Section.js +13 -3
- package/dist/cjs/b/Page/styles.scss +25 -4
- package/dist/cjs/b/SocialMediaButton/SocialMediaButton.js +6 -2
- package/dist/cjs/b/SocialMediaButton/styles.scss +0 -14
- package/dist/cjs/b/ThemeSelector/ThemeSelector.js +17 -27
- package/dist/cjs/b/ThemeSelector/styles.scss +44 -6
- package/dist/cjs/b/Title/Title.js +1 -2
- package/dist/cjs/b/index.js +8 -1
- package/dist/cjs/c/ContentSlides/ContentSlides.js +1 -1
- package/dist/cjs/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +1 -3
- package/dist/cjs/c/ContentSlides/common/Sidebar/Sidebar.js +0 -2
- package/dist/cjs/c/ContentSlides/styles.scss +2 -2
- package/dist/cjs/c/Modal/Modal.js +2 -2
- package/dist/cjs/c/Modal/common/ModalHeader/ModalHeader.js +1 -1
- package/dist/cjs/c/Modal/styles.scss +7 -12
- package/dist/cjs/c/Shortener/Shortener.js +1 -1
- package/dist/cjs/c/SocialMediaShareButton/SocialMediaShareButton.js +1 -1
- package/dist/cjs/f/FormInput/FormInput.js +13 -3
- package/dist/cjs/f/common/Debugger/Debugger.js +1 -1
- package/dist/cjs/f/common/Description/Description.js +6 -5
- package/dist/cjs/f/common/InputWrapper/InputWrapper.js +74 -0
- package/dist/cjs/f/common/InputWrapper/index.js +13 -0
- package/dist/cjs/f/common/InputWrapper/styles.scss +13 -0
- package/dist/cjs/f/common/Label/Label.js +19 -5
- package/dist/cjs/f/common/Label/styles.scss +8 -2
- package/dist/cjs/f/common/index.js +8 -1
- package/dist/cjs/f/fields/Checkbox/Checkbox.js +41 -11
- package/dist/cjs/f/fields/Checkbox/styles.scss +7 -8
- package/dist/cjs/f/fields/ChoicesInput/ChoicesInput.js +56 -25
- package/dist/cjs/f/fields/ChoicesInput/common/Choice/Choice.js +2 -2
- package/dist/cjs/f/fields/ChoicesInput/styles.scss +52 -43
- package/dist/cjs/f/fields/EditorInput/EditorInput.js +222 -0
- package/dist/cjs/f/fields/EditorInput/common/Toolbar.js +257 -0
- package/dist/cjs/f/fields/EditorInput/common/TreeViewPlugin.js +19 -0
- package/dist/cjs/f/fields/EditorInput/common/index.js +20 -0
- package/dist/cjs/f/fields/EditorInput/index.js +13 -0
- package/dist/cjs/f/fields/EditorInput/styles.scss +147 -0
- package/dist/cjs/f/fields/LinkInput/LinkInput.js +164 -0
- package/dist/cjs/f/fields/LinkInput/index.js +13 -0
- package/dist/cjs/f/fields/LinkInput/styles.scss +89 -0
- package/dist/cjs/f/fields/QueryChoices/QueryChoices.js +27 -3
- package/dist/cjs/f/fields/QueryCombobox/QueryCombobox.js +36 -6
- package/dist/cjs/f/fields/QueryCombobox/common/Combobox/Combobox.js +44 -17
- package/dist/cjs/f/fields/QueryCombobox/common/Menu/Menu.js +1 -1
- package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +36 -26
- package/dist/cjs/f/fields/QueryCombobox/styles.scss +64 -30
- package/dist/cjs/f/fields/QuerySelect/QuerySelect.js +17 -3
- package/dist/cjs/f/fields/RatingsInput/RatingsInput.js +42 -20
- package/dist/cjs/f/fields/RatingsInput/common/Rating/Rating.js +5 -5
- package/dist/cjs/f/fields/RatingsInput/styles.scss +6 -13
- package/dist/cjs/f/fields/SelectInput/SelectInput.js +46 -16
- package/dist/cjs/f/fields/SelectInput/styles.scss +60 -26
- package/dist/cjs/f/fields/TextInput/TextInput.js +51 -18
- package/dist/cjs/f/fields/TextInput/styles.scss +56 -20
- package/dist/cjs/f/fields/TextareaInput/TextareaInput.js +44 -23
- package/dist/cjs/f/fields/TextareaInput/styles.scss +42 -25
- package/dist/cjs/f/fields/index.js +15 -1
- package/dist/cjs/form.scss +1 -1
- package/dist/cjs/r/SwitchRouteMap/SwitchRouteMap.js +1 -1
- package/dist/cjs/r/common/PrivateRoute/PrivateRoute.js +1 -1
- package/dist/cjs/test/QueryLoader/QueryLoader.js +2 -0
- package/dist/es/a/AnimatedBlobs/AnimatedBlobs.js +82 -0
- package/dist/es/a/AnimatedBlobs/index.js +1 -0
- package/dist/es/a/AnimatedBlobs/styles.scss +87 -0
- package/dist/es/a/AnimatedGradient/AnimatedGradient.js +52 -0
- package/dist/es/a/AnimatedGradient/index.js +1 -0
- package/dist/es/a/AnimatedGradient/styles.scss +14 -0
- package/dist/es/a/AnimatedGradient/webGIRenderer.js +492 -0
- package/dist/es/a/AppContext/useTheme.js +0 -4
- package/dist/es/a/BlurOverlay/BlurOverlay.js +51 -0
- package/dist/es/a/BlurOverlay/index.js +2 -0
- package/dist/es/a/BlurOverlay/styles.scss +31 -0
- package/dist/es/a/ContentTree/ContentTree.js +9 -3
- package/dist/es/a/ContentTree/common/Tree/Tree.js +12 -5
- package/dist/es/a/ContentTree/styles.scss +34 -11
- package/dist/es/a/Conversation/Conversation.js +10 -15
- package/dist/es/a/Conversation/common/Message/Message.js +15 -12
- package/dist/es/a/Conversation/styles.scss +56 -124
- package/dist/es/a/Label/Label.js +12 -4
- package/dist/es/a/Label/styles.scss +4 -4
- package/dist/es/a/MetaCard/MetaCard.js +57 -0
- package/dist/es/a/MetaCard/index.js +1 -0
- package/dist/es/a/MetaCard/styles.scss +45 -0
- package/dist/es/a/People/common/Person/Person.js +5 -5
- package/dist/es/a/People/styles.scss +10 -4
- package/dist/es/a/Popover/Popover.js +2 -2
- package/dist/es/a/Popover/styles.scss +1 -1
- package/dist/es/a/Removable/Removable.js +64 -0
- package/dist/es/a/Removable/index.js +2 -0
- package/dist/es/a/Removable/styles.scss +33 -0
- package/dist/es/a/SnapScroller/styles.scss +30 -10
- package/dist/es/a/TextSteps/TextSteps.js +61 -0
- package/dist/es/a/TextSteps/index.js +1 -0
- package/dist/es/a/TextSteps/styles.scss +29 -0
- package/dist/es/a/Tip/Tip.js +78 -0
- package/dist/es/a/Tip/index.js +2 -0
- package/dist/es/a/Tip/styles.scss +16 -0
- package/dist/es/a/index.js +8 -1
- package/dist/es/b/Button/Button.js +22 -8
- package/dist/es/b/Button/common/Group/Group.js +49 -0
- package/dist/es/b/Button/common/Group/index.js +1 -0
- package/dist/es/b/Button/common/Group/styles.scss +11 -0
- package/dist/es/b/Button/common/index.js +1 -0
- package/dist/es/b/Button/styles.scss +41 -11
- package/dist/es/b/Card/Card.js +66 -0
- package/dist/es/b/Card/common/Group/Group.js +65 -0
- package/dist/es/b/Card/common/Group/index.js +1 -0
- package/dist/es/b/Card/common/Group/styles.scss +35 -0
- package/dist/es/b/Card/common/Section/Section.js +48 -0
- package/dist/es/b/Card/common/Section/index.js +1 -0
- package/dist/es/b/Card/common/index.js +2 -0
- package/dist/es/b/Card/index.js +1 -0
- package/dist/es/b/Card/styles.scss +57 -0
- package/dist/es/b/Page/Page.js +14 -3
- package/dist/es/b/Page/common/PageHelmet/PageHelmet.js +12 -2
- package/dist/es/b/Page/common/Section/Section.js +12 -2
- package/dist/es/b/Page/styles.scss +25 -4
- package/dist/es/b/SocialMediaButton/SocialMediaButton.js +5 -1
- package/dist/es/b/SocialMediaButton/styles.scss +0 -14
- package/dist/es/b/ThemeSelector/ThemeSelector.js +16 -27
- package/dist/es/b/ThemeSelector/styles.scss +44 -6
- package/dist/es/b/index.js +2 -1
- package/dist/es/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +1 -1
- package/dist/es/c/ContentSlides/styles.scss +2 -2
- package/dist/es/c/Modal/Modal.js +1 -1
- package/dist/es/c/Modal/common/ModalHeader/ModalHeader.js +1 -1
- package/dist/es/c/Modal/styles.scss +7 -12
- package/dist/es/f/FormInput/FormInput.js +13 -1
- package/dist/es/f/common/Description/Description.js +5 -4
- package/dist/es/f/common/InputWrapper/InputWrapper.js +66 -0
- package/dist/es/f/common/InputWrapper/index.js +2 -0
- package/dist/es/f/common/InputWrapper/styles.scss +13 -0
- package/dist/es/f/common/Label/Label.js +18 -4
- package/dist/es/f/common/Label/styles.scss +8 -2
- package/dist/es/f/common/index.js +2 -1
- package/dist/es/f/fields/Checkbox/Checkbox.js +41 -11
- package/dist/es/f/fields/Checkbox/styles.scss +7 -8
- package/dist/es/f/fields/ChoicesInput/ChoicesInput.js +56 -25
- package/dist/es/f/fields/ChoicesInput/common/Choice/Choice.js +1 -1
- package/dist/es/f/fields/ChoicesInput/styles.scss +52 -43
- package/dist/es/f/fields/EditorInput/EditorInput.js +217 -0
- package/dist/es/f/fields/EditorInput/common/Toolbar.js +246 -0
- package/dist/es/f/fields/EditorInput/common/TreeViewPlugin.js +11 -0
- package/dist/es/f/fields/EditorInput/common/index.js +2 -0
- package/dist/es/f/fields/EditorInput/index.js +2 -0
- package/dist/es/f/fields/EditorInput/styles.scss +147 -0
- package/dist/es/f/fields/LinkInput/LinkInput.js +156 -0
- package/dist/es/f/fields/LinkInput/index.js +2 -0
- package/dist/es/f/fields/LinkInput/styles.scss +89 -0
- package/dist/es/f/fields/QueryChoices/QueryChoices.js +26 -2
- package/dist/es/f/fields/QueryCombobox/QueryCombobox.js +35 -5
- package/dist/es/f/fields/QueryCombobox/common/Combobox/Combobox.js +43 -16
- package/dist/es/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +35 -25
- package/dist/es/f/fields/QueryCombobox/styles.scss +64 -30
- package/dist/es/f/fields/QuerySelect/QuerySelect.js +17 -3
- package/dist/es/f/fields/RatingsInput/RatingsInput.js +42 -20
- package/dist/es/f/fields/RatingsInput/common/Rating/Rating.js +4 -4
- package/dist/es/f/fields/RatingsInput/styles.scss +6 -13
- package/dist/es/f/fields/SelectInput/SelectInput.js +46 -16
- package/dist/es/f/fields/SelectInput/styles.scss +60 -26
- package/dist/es/f/fields/TextInput/TextInput.js +51 -18
- package/dist/es/f/fields/TextInput/styles.scss +56 -20
- package/dist/es/f/fields/TextareaInput/TextareaInput.js +44 -23
- package/dist/es/f/fields/TextareaInput/styles.scss +42 -25
- package/dist/es/f/fields/index.js +3 -1
- package/dist/es/form.scss +1 -1
- package/package.json +18 -15
- package/src/stories/a/AppContext.stories.jsx +4 -2
- package/src/stories/a/BlurOverlay.stories.jsx +39 -0
- package/src/stories/a/Conversation.stories.jsx +11 -42
- package/src/stories/a/MetaCard.stories.jsx +35 -0
- package/src/stories/a/People.stories.jsx +22 -2
- package/src/stories/a/Quote.stories.jsx +1 -1
- package/src/stories/a/Removable.stories.jsx +22 -0
- package/src/stories/a/SnapScroller.stories.jsx +2 -2
- package/src/stories/a/Spinner.stories.jsx +1 -1
- package/src/stories/a/TextSteps.stories.jsx +19 -0
- package/src/stories/a/Tip.stories.jsx +29 -0
- package/src/stories/b/{Button.stories.jsx → Button/Button.stories.jsx} +18 -0
- package/src/stories/b/Button/Group.stories.jsx +35 -0
- package/src/stories/b/Card/Card.stories.jsx +59 -0
- package/src/stories/b/Card/Group.stories.jsx +59 -0
- package/src/stories/b/Page.stories.jsx +19 -3
- package/src/stories/b/SocialMediaButton.stories.jsx +4 -2
- package/src/stories/b/ThemeSelector.stories.jsx +1 -5
- package/src/stories/b/Title.stories.jsx +1 -1
- package/src/stories/c/ContentSlides.stories.jsx +1 -1
- package/src/stories/colors.js +22 -28
- package/src/stories/f/Checkbox.stories.jsx +22 -7
- package/src/stories/f/ChoicesInput.stories.jsx +21 -7
- package/src/stories/f/EditorInput.stories.jsx +88 -0
- package/src/stories/f/LinkInput.stories.jsx +100 -0
- package/src/stories/f/QueryChoices.stories.jsx +20 -4
- package/src/stories/f/QueryCombobox.stories.jsx +25 -13
- package/src/stories/f/QuerySelect.stories.jsx +20 -5
- package/src/stories/f/RatingsInput.stories.jsx +16 -2
- package/src/stories/f/SelectInput.stories.jsx +27 -5
- package/src/stories/f/TextInput.stories.jsx +33 -12
- package/src/stories/f/TextareaInput.stories.jsx +16 -2
- package/src/ui/a/AnimatedBlobs/AnimatedBlobs.jsx +102 -0
- package/src/ui/a/AnimatedBlobs/index.js +1 -0
- package/src/ui/a/AnimatedBlobs/styles.scss +87 -0
- package/src/ui/a/AnimatedGradient/AnimatedGradient.jsx +73 -0
- package/src/ui/a/AnimatedGradient/index.js +1 -0
- package/src/ui/a/AnimatedGradient/styles.scss +14 -0
- package/src/ui/a/AnimatedGradient/webGIRenderer.js +541 -0
- package/src/ui/a/AppContext/useTheme.js +0 -4
- package/src/ui/a/BlurOverlay/BlurOverlay.jsx +75 -0
- package/src/ui/a/BlurOverlay/index.js +2 -0
- package/src/ui/a/BlurOverlay/styles.scss +31 -0
- package/src/ui/a/ContentTree/ContentTree.jsx +8 -4
- package/src/ui/a/ContentTree/common/Tree/Tree.jsx +19 -7
- package/src/ui/a/ContentTree/styles.scss +34 -11
- package/src/ui/a/Conversation/Conversation.jsx +14 -18
- package/src/ui/a/Conversation/common/Message/Message.jsx +18 -11
- package/src/ui/a/Conversation/styles.scss +56 -124
- package/src/ui/a/Label/Label.jsx +11 -2
- package/src/ui/a/Label/styles.scss +4 -4
- package/src/ui/a/MetaCard/MetaCard.jsx +81 -0
- package/src/ui/a/MetaCard/index.js +1 -0
- package/src/ui/a/MetaCard/styles.scss +45 -0
- package/src/ui/a/People/common/Person/Person.jsx +5 -5
- package/src/ui/a/People/styles.scss +10 -4
- package/src/ui/a/Popover/Popover.jsx +2 -2
- package/src/ui/a/Popover/styles.scss +1 -1
- package/src/ui/a/Removable/Removable.jsx +85 -0
- package/src/ui/a/Removable/index.js +2 -0
- package/src/ui/a/Removable/styles.scss +33 -0
- package/src/ui/a/SnapScroller/styles.scss +30 -10
- package/src/ui/a/TextSteps/TextSteps.jsx +87 -0
- package/src/ui/a/TextSteps/index.js +1 -0
- package/src/ui/a/TextSteps/styles.scss +29 -0
- package/src/ui/a/Tip/Tip.jsx +105 -0
- package/src/ui/a/Tip/index.js +2 -0
- package/src/ui/a/Tip/styles.scss +16 -0
- package/src/ui/a/index.js +7 -0
- package/src/ui/b/Button/Button.jsx +28 -8
- package/src/ui/b/Button/common/Group/Group.jsx +71 -0
- package/src/ui/b/Button/common/Group/index.js +1 -0
- package/src/ui/b/Button/common/Group/styles.scss +11 -0
- package/src/ui/b/Button/common/index.js +1 -0
- package/src/ui/b/Button/styles.scss +41 -11
- package/src/ui/b/Card/Card.jsx +94 -0
- package/src/ui/b/Card/common/Group/Group.jsx +91 -0
- package/src/ui/b/Card/common/Group/index.js +1 -0
- package/src/ui/b/Card/common/Group/styles.scss +35 -0
- package/src/ui/b/Card/common/Section/Section.jsx +70 -0
- package/src/ui/b/Card/common/Section/index.js +1 -0
- package/src/ui/b/Card/common/index.js +2 -0
- package/src/ui/b/Card/index.js +1 -0
- package/src/ui/b/Card/styles.scss +57 -0
- package/src/ui/b/Page/Page.jsx +11 -1
- package/src/ui/b/Page/common/PageHelmet/PageHelmet.jsx +14 -3
- package/src/ui/b/Page/common/Section/Section.jsx +16 -1
- package/src/ui/b/Page/styles.scss +25 -4
- package/src/ui/b/SocialMediaButton/SocialMediaButton.jsx +5 -1
- package/src/ui/b/SocialMediaButton/styles.scss +0 -14
- package/src/ui/b/ThemeSelector/ThemeSelector.jsx +16 -29
- package/src/ui/b/ThemeSelector/styles.scss +44 -6
- package/src/ui/b/index.js +1 -0
- package/src/ui/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.jsx +1 -1
- package/src/ui/c/ContentSlides/styles.scss +2 -2
- package/src/ui/c/Modal/Modal.jsx +1 -1
- package/src/ui/c/Modal/common/ModalHeader/ModalHeader.jsx +1 -1
- package/src/ui/c/Modal/styles.scss +7 -12
- package/src/ui/f/FormInput/FormInput.jsx +23 -0
- package/src/ui/f/common/Description/Description.jsx +5 -4
- package/src/ui/f/common/InputWrapper/InputWrapper.jsx +89 -0
- package/src/ui/f/common/InputWrapper/index.js +2 -0
- package/src/ui/f/common/InputWrapper/styles.scss +13 -0
- package/src/ui/f/common/Label/Label.jsx +18 -2
- package/src/ui/f/common/Label/styles.scss +8 -2
- package/src/ui/f/common/index.js +1 -0
- package/src/ui/f/fields/Checkbox/Checkbox.jsx +65 -27
- package/src/ui/f/fields/Checkbox/styles.scss +7 -8
- package/src/ui/f/fields/ChoicesInput/ChoicesInput.jsx +83 -48
- package/src/ui/f/fields/ChoicesInput/common/Choice/Choice.jsx +10 -3
- package/src/ui/f/fields/ChoicesInput/styles.scss +52 -43
- package/src/ui/f/fields/EditorInput/EditorInput.jsx +272 -0
- package/src/ui/f/fields/EditorInput/common/Toolbar.jsx +356 -0
- package/src/ui/f/fields/EditorInput/common/TreeViewPlugin.jsx +16 -0
- package/src/ui/f/fields/EditorInput/common/index.jsx +2 -0
- package/src/ui/f/fields/EditorInput/index.js +2 -0
- package/src/ui/f/fields/EditorInput/styles.scss +147 -0
- package/src/ui/f/fields/LinkInput/LinkInput.jsx +197 -0
- package/src/ui/f/fields/LinkInput/index.js +2 -0
- package/src/ui/f/fields/LinkInput/styles.scss +89 -0
- package/src/ui/f/fields/QueryChoices/QueryChoices.jsx +28 -0
- package/src/ui/f/fields/QueryCombobox/QueryCombobox.jsx +37 -2
- package/src/ui/f/fields/QueryCombobox/common/Combobox/Combobox.jsx +68 -38
- package/src/ui/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.jsx +81 -66
- package/src/ui/f/fields/QueryCombobox/styles.scss +64 -30
- package/src/ui/f/fields/QuerySelect/QuerySelect.jsx +16 -1
- package/src/ui/f/fields/RatingsInput/RatingsInput.jsx +55 -28
- package/src/ui/f/fields/RatingsInput/common/Rating/Rating.jsx +4 -4
- package/src/ui/f/fields/RatingsInput/styles.scss +6 -13
- package/src/ui/f/fields/SelectInput/SelectInput.jsx +88 -49
- package/src/ui/f/fields/SelectInput/styles.scss +60 -26
- package/src/ui/f/fields/TextInput/TextInput.jsx +71 -34
- package/src/ui/f/fields/TextInput/styles.scss +56 -20
- package/src/ui/f/fields/TextareaInput/TextareaInput.jsx +65 -43
- package/src/ui/f/fields/TextareaInput/styles.scss +42 -25
- package/src/ui/f/fields/index.js +2 -0
- package/src/ui/form.scss +1 -1
- package/tests/__snapshots__/Storyshots.test.js.snap +14253 -5695
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
/* eslint-disable import/no-extraneous-dependencies -- required here */
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { useInsertionEffect, memo } from 'react'
|
|
5
|
+
import { useFormikContext } from 'formik'
|
|
6
|
+
import { LexicalComposer } from '@lexical/react/LexicalComposer'
|
|
7
|
+
import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin'
|
|
8
|
+
import { ContentEditable } from '@lexical/react/LexicalContentEditable'
|
|
9
|
+
import { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin'
|
|
10
|
+
import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin'
|
|
11
|
+
import { LinkPlugin } from '@lexical/react/LexicalLinkPlugin'
|
|
12
|
+
import { ListPlugin } from '@lexical/react/LexicalListPlugin'
|
|
13
|
+
import { TabIndentationPlugin } from '@lexical/react/LexicalTabIndentationPlugin'
|
|
14
|
+
import { AutoLinkNode, LinkNode } from '@lexical/link'
|
|
15
|
+
import { ListItemNode, ListNode } from '@lexical/list'
|
|
16
|
+
|
|
17
|
+
import PropTypes from 'prop-types'
|
|
18
|
+
import styleNames from '@pareto-engineering/bem/exports'
|
|
19
|
+
|
|
20
|
+
// Local Definitions
|
|
21
|
+
|
|
22
|
+
import { FormLabel, FormDescription, InputWrapper } from '../../common'
|
|
23
|
+
import { Toolbar, TreeViewPlugin } from './common'
|
|
24
|
+
|
|
25
|
+
const baseClassName = styleNames.base
|
|
26
|
+
const componentClassName = 'editor-input'
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* This is the component description.
|
|
30
|
+
*/
|
|
31
|
+
const EditorInput = ({
|
|
32
|
+
id,
|
|
33
|
+
className:userClassName,
|
|
34
|
+
style,
|
|
35
|
+
name,
|
|
36
|
+
label,
|
|
37
|
+
// validate,
|
|
38
|
+
resize,
|
|
39
|
+
color,
|
|
40
|
+
rows,
|
|
41
|
+
optional,
|
|
42
|
+
labelColor,
|
|
43
|
+
description,
|
|
44
|
+
disabled,
|
|
45
|
+
labelSpan,
|
|
46
|
+
desktopLabelSpan,
|
|
47
|
+
inputSpan,
|
|
48
|
+
desktopInputSpan,
|
|
49
|
+
showDebugger,
|
|
50
|
+
// ...otherProps
|
|
51
|
+
}) => {
|
|
52
|
+
useInsertionEffect(() => {
|
|
53
|
+
import('./styles.scss')
|
|
54
|
+
}, [])
|
|
55
|
+
|
|
56
|
+
const formik = useFormikContext()
|
|
57
|
+
|
|
58
|
+
const setInitialValue = () => {
|
|
59
|
+
const value = formik.values[name]
|
|
60
|
+
try {
|
|
61
|
+
JSON.parse(value)
|
|
62
|
+
return value
|
|
63
|
+
} catch {
|
|
64
|
+
const defaultValue = {
|
|
65
|
+
root:{
|
|
66
|
+
children:[
|
|
67
|
+
{
|
|
68
|
+
children:[
|
|
69
|
+
{
|
|
70
|
+
detail :0,
|
|
71
|
+
format :0,
|
|
72
|
+
mode :'normal',
|
|
73
|
+
style :'',
|
|
74
|
+
text :'',
|
|
75
|
+
type :'text',
|
|
76
|
+
version:1,
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
direction:'ltr',
|
|
80
|
+
format :'',
|
|
81
|
+
indent :0,
|
|
82
|
+
type :'paragraph',
|
|
83
|
+
version :1,
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
direction:'ltr',
|
|
87
|
+
format :'',
|
|
88
|
+
indent :0,
|
|
89
|
+
type :'root',
|
|
90
|
+
version :1,
|
|
91
|
+
},
|
|
92
|
+
}
|
|
93
|
+
defaultValue.root.children[0].children[0].text = value
|
|
94
|
+
return JSON.stringify(defaultValue)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const onChange = (state) => {
|
|
99
|
+
formik.setValues({
|
|
100
|
+
...formik.values,
|
|
101
|
+
[name]:JSON.stringify(state),
|
|
102
|
+
})
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const initialConfig = {
|
|
106
|
+
nameSpace :name,
|
|
107
|
+
editable :!disabled,
|
|
108
|
+
editorState:setInitialValue(),
|
|
109
|
+
theme :{
|
|
110
|
+
text:{
|
|
111
|
+
italic :'italic',
|
|
112
|
+
strikethrough:'strikethrough',
|
|
113
|
+
underline :'underlined',
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
nodes:[
|
|
117
|
+
AutoLinkNode,
|
|
118
|
+
LinkNode,
|
|
119
|
+
ListNode,
|
|
120
|
+
ListItemNode,
|
|
121
|
+
],
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
<LexicalComposer
|
|
126
|
+
initialConfig={initialConfig}
|
|
127
|
+
>
|
|
128
|
+
<FormLabel
|
|
129
|
+
name={name}
|
|
130
|
+
color={labelColor}
|
|
131
|
+
optional={optional}
|
|
132
|
+
columnSpan={labelSpan}
|
|
133
|
+
desktopColumnSpan={desktopLabelSpan}
|
|
134
|
+
// {...otherProps}
|
|
135
|
+
>
|
|
136
|
+
{label}
|
|
137
|
+
</FormLabel>
|
|
138
|
+
<InputWrapper
|
|
139
|
+
id={id}
|
|
140
|
+
className={[
|
|
141
|
+
baseClassName,
|
|
142
|
+
componentClassName,
|
|
143
|
+
userClassName,
|
|
144
|
+
`y-${color}`,
|
|
145
|
+
disabled && 'disabled',
|
|
146
|
+
]
|
|
147
|
+
.filter((e) => e)
|
|
148
|
+
.join(' ')}
|
|
149
|
+
style={{
|
|
150
|
+
...style,
|
|
151
|
+
'--resize':resize,
|
|
152
|
+
'--rows' :`${rows}em`,
|
|
153
|
+
}}
|
|
154
|
+
columnSpan={inputSpan}
|
|
155
|
+
desktopColumnSpan={desktopInputSpan}
|
|
156
|
+
>
|
|
157
|
+
{ !disabled && <Toolbar /> }
|
|
158
|
+
<RichTextPlugin
|
|
159
|
+
contentEditable={(
|
|
160
|
+
<ContentEditable
|
|
161
|
+
id={name}
|
|
162
|
+
className="content-editable"
|
|
163
|
+
/>
|
|
164
|
+
)}
|
|
165
|
+
/>
|
|
166
|
+
<OnChangePlugin onChange={onChange} />
|
|
167
|
+
<LinkPlugin />
|
|
168
|
+
<ListPlugin />
|
|
169
|
+
<TabIndentationPlugin />
|
|
170
|
+
<HistoryPlugin />
|
|
171
|
+
<FormDescription className="s-1" description={description} name={name} />
|
|
172
|
+
{ showDebugger && <TreeViewPlugin />}
|
|
173
|
+
</InputWrapper>
|
|
174
|
+
</LexicalComposer>
|
|
175
|
+
)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
EditorInput.propTypes = {
|
|
179
|
+
/**
|
|
180
|
+
* The HTML id for this element
|
|
181
|
+
*/
|
|
182
|
+
id:PropTypes.string,
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* The HTML class names for this element
|
|
186
|
+
*/
|
|
187
|
+
className:PropTypes.string,
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* The React-written, css properties for this element.
|
|
191
|
+
*/
|
|
192
|
+
style:PropTypes.objectOf(PropTypes.string),
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* The input name (html - and Formik state)
|
|
196
|
+
*/
|
|
197
|
+
name:PropTypes.string.isRequired,
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* The input label
|
|
201
|
+
*/
|
|
202
|
+
label:PropTypes.string.isRequired,
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* The input value validator function
|
|
206
|
+
*/
|
|
207
|
+
// validate:PropTypes.func,
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* The number of rows int the text area
|
|
211
|
+
*/
|
|
212
|
+
rows:PropTypes.number,
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Color of the text
|
|
216
|
+
*/
|
|
217
|
+
color:PropTypes.string,
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Label base color
|
|
221
|
+
*/
|
|
222
|
+
labelColor:PropTypes.string,
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Text area description
|
|
226
|
+
*/
|
|
227
|
+
description:PropTypes.string,
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Whether the text area should be disabled
|
|
231
|
+
*/
|
|
232
|
+
disabled:PropTypes.bool,
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Whether the input is optional or not
|
|
236
|
+
*/
|
|
237
|
+
optional:PropTypes.bool,
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* The number of columns the label should span
|
|
241
|
+
*/
|
|
242
|
+
labelSpan:PropTypes.number,
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* The number of columns the input should span
|
|
246
|
+
*/
|
|
247
|
+
inputSpan:PropTypes.number,
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* The number of columns the label should span on desktop
|
|
251
|
+
*/
|
|
252
|
+
desktopLabelSpan:PropTypes.number,
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* The number of columns the input should span on desktop
|
|
256
|
+
*/
|
|
257
|
+
desktopInputSpan:PropTypes.number,
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* The resize property of the text area
|
|
261
|
+
*/
|
|
262
|
+
resize:PropTypes.oneOf(['none', 'both', 'horizontal', 'vertical']),
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
EditorInput.defaultProps = {
|
|
266
|
+
rows :10,
|
|
267
|
+
disabled:false,
|
|
268
|
+
color :'paragraph',
|
|
269
|
+
resize :'vertical',
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export default memo(EditorInput)
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
/* eslint-disable import/no-extraneous-dependencies -- required here */
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
useEffect,
|
|
6
|
+
useState,
|
|
7
|
+
useCallback,
|
|
8
|
+
useRef,
|
|
9
|
+
} from 'react'
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
$getSelection,
|
|
13
|
+
$isRangeSelection,
|
|
14
|
+
FORMAT_TEXT_COMMAND,
|
|
15
|
+
FORMAT_ELEMENT_COMMAND,
|
|
16
|
+
UNDO_COMMAND,
|
|
17
|
+
REDO_COMMAND,
|
|
18
|
+
COMMAND_PRIORITY_NORMAL,
|
|
19
|
+
createCommand,
|
|
20
|
+
} from 'lexical'
|
|
21
|
+
import {
|
|
22
|
+
INSERT_ORDERED_LIST_COMMAND,
|
|
23
|
+
INSERT_UNORDERED_LIST_COMMAND,
|
|
24
|
+
REMOVE_LIST_COMMAND,
|
|
25
|
+
$isListNode,
|
|
26
|
+
ListNode,
|
|
27
|
+
} from '@lexical/list'
|
|
28
|
+
import {
|
|
29
|
+
$isAtNodeEnd,
|
|
30
|
+
} from '@lexical/selection'
|
|
31
|
+
import {
|
|
32
|
+
$isLinkNode,
|
|
33
|
+
TOGGLE_LINK_COMMAND,
|
|
34
|
+
} from '@lexical/link'
|
|
35
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'
|
|
36
|
+
import { mergeRegister, $getNearestNodeOfType } from '@lexical/utils'
|
|
37
|
+
|
|
38
|
+
import { Popover } from 'ui'
|
|
39
|
+
|
|
40
|
+
import styleNames from '@pareto-engineering/bem/exports'
|
|
41
|
+
|
|
42
|
+
const baseClassName = styleNames.base
|
|
43
|
+
|
|
44
|
+
const componentClassName = 'toolbar'
|
|
45
|
+
|
|
46
|
+
const getSelectedNode = (selection) => {
|
|
47
|
+
const { anchor, focus } = selection
|
|
48
|
+
const anchorNode = selection.anchor.getNode()
|
|
49
|
+
const focusNode = selection.focus.getNode()
|
|
50
|
+
if (anchorNode === focusNode) {
|
|
51
|
+
return anchorNode
|
|
52
|
+
}
|
|
53
|
+
const isBackward = selection.isBackward()
|
|
54
|
+
if (isBackward) {
|
|
55
|
+
return $isAtNodeEnd(focus) ? anchorNode : focusNode
|
|
56
|
+
}
|
|
57
|
+
return $isAtNodeEnd(anchor) ? focusNode : anchorNode
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const defaultColor = 'var(--paragraph)'
|
|
61
|
+
|
|
62
|
+
const colorOptions = [
|
|
63
|
+
'red',
|
|
64
|
+
'blue',
|
|
65
|
+
'green',
|
|
66
|
+
'yellow',
|
|
67
|
+
'orange',
|
|
68
|
+
'purple',
|
|
69
|
+
'pink',
|
|
70
|
+
'brown',
|
|
71
|
+
]
|
|
72
|
+
|
|
73
|
+
const Toolbar = () => {
|
|
74
|
+
const [editor] = useLexicalComposerContext()
|
|
75
|
+
const [isBold, setIsBold] = useState(false)
|
|
76
|
+
const [isItalic, setIsItalic] = useState(false)
|
|
77
|
+
const [isStrikethrough, setIsStrikethrough] = useState(false)
|
|
78
|
+
const [blockType, setBlockType] = useState('paragraph')
|
|
79
|
+
const [isLink, setIsLink] = useState(false)
|
|
80
|
+
const [isUnderline, setIsUnderline] = useState(false)
|
|
81
|
+
const [color, setColor] = useState(defaultColor)
|
|
82
|
+
|
|
83
|
+
const colorMenuRef = useRef(false)
|
|
84
|
+
|
|
85
|
+
const formatBulletList = () => {
|
|
86
|
+
if (blockType !== 'ul') {
|
|
87
|
+
editor.dispatchCommand(INSERT_UNORDERED_LIST_COMMAND)
|
|
88
|
+
} else {
|
|
89
|
+
editor.dispatchCommand(REMOVE_LIST_COMMAND)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const formatNumberedList = () => {
|
|
94
|
+
if (blockType !== 'ol') {
|
|
95
|
+
editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND)
|
|
96
|
+
} else {
|
|
97
|
+
editor.dispatchCommand(REMOVE_LIST_COMMAND)
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const formatLink = useCallback(() => {
|
|
102
|
+
if (!isLink) {
|
|
103
|
+
// eslint-disable-next-line no-alert
|
|
104
|
+
const path = prompt('Enter the full URL. Ex: https://www.example.com')
|
|
105
|
+
editor.dispatchCommand(TOGGLE_LINK_COMMAND, path)
|
|
106
|
+
} else {
|
|
107
|
+
editor.dispatchCommand(TOGGLE_LINK_COMMAND, null)
|
|
108
|
+
}
|
|
109
|
+
}, [editor, isLink])
|
|
110
|
+
|
|
111
|
+
const updateToolbar = useCallback(() => {
|
|
112
|
+
const selection = $getSelection()
|
|
113
|
+
|
|
114
|
+
// Check list selection
|
|
115
|
+
if ($isRangeSelection(selection)) {
|
|
116
|
+
const anchorNode = selection.anchor.getNode()
|
|
117
|
+
const element = anchorNode.getKey() === 'root'
|
|
118
|
+
? anchorNode
|
|
119
|
+
: anchorNode.getTopLevelElementOrThrow()
|
|
120
|
+
if ($isListNode(element)) {
|
|
121
|
+
const parentList = $getNearestNodeOfType(anchorNode, ListNode)
|
|
122
|
+
const type = parentList ? parentList.getTag() : element.getTag()
|
|
123
|
+
setBlockType(type)
|
|
124
|
+
} else {
|
|
125
|
+
setBlockType(element)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Check nodes for color
|
|
129
|
+
const nodes = selection.getNodes().filter((node) => node.getType() === 'text')
|
|
130
|
+
nodes.forEach((node) => {
|
|
131
|
+
const style = node.getStyle()
|
|
132
|
+
const colorProperty = style.match(/color: ([^;]+)/)
|
|
133
|
+
if (colorProperty) {
|
|
134
|
+
setColor(colorProperty[1])
|
|
135
|
+
return
|
|
136
|
+
}
|
|
137
|
+
setColor(false)
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
// Check selection text styles
|
|
141
|
+
setIsBold(selection.hasFormat('bold'))
|
|
142
|
+
setIsItalic(selection.hasFormat('italic'))
|
|
143
|
+
setIsStrikethrough(selection.hasFormat('strikethrough'))
|
|
144
|
+
setIsUnderline(selection.hasFormat('underline'))
|
|
145
|
+
setIsLink(selection.hasFormat('link'))
|
|
146
|
+
|
|
147
|
+
// Check links
|
|
148
|
+
const node = getSelectedNode(selection)
|
|
149
|
+
const parent = node.getParent()
|
|
150
|
+
if ($isLinkNode(parent) || $isLinkNode(node)) {
|
|
151
|
+
setIsLink(true)
|
|
152
|
+
} else {
|
|
153
|
+
setIsLink(false)
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}, [editor])
|
|
157
|
+
|
|
158
|
+
const UPDATE_COLOR_COMMAND = createCommand()
|
|
159
|
+
|
|
160
|
+
editor.registerCommand(UPDATE_COLOR_COMMAND, (payload) => {
|
|
161
|
+
const selection = $getSelection()
|
|
162
|
+
const nodes = selection?.extract().filter((node) => node.getType() === 'text')
|
|
163
|
+
nodes?.forEach((node) => {
|
|
164
|
+
const style = node.getStyle()
|
|
165
|
+
const colorProperty = style?.match(/color: ([^;]+)/)
|
|
166
|
+
if (colorProperty && color !== payload) {
|
|
167
|
+
node.setStyle(style.replace(colorProperty[0], `color: ${payload}`))
|
|
168
|
+
} else if (colorProperty) {
|
|
169
|
+
node.setStyle(`color: ${defaultColor}`)
|
|
170
|
+
} else {
|
|
171
|
+
node.setStyle(`color: ${payload}`)
|
|
172
|
+
}
|
|
173
|
+
})
|
|
174
|
+
}, COMMAND_PRIORITY_NORMAL)
|
|
175
|
+
|
|
176
|
+
useEffect(() => mergeRegister(
|
|
177
|
+
editor.registerUpdateListener(({ editorState }) => {
|
|
178
|
+
editorState.read(() => {
|
|
179
|
+
updateToolbar()
|
|
180
|
+
})
|
|
181
|
+
}),
|
|
182
|
+
), [updateToolbar, editor])
|
|
183
|
+
|
|
184
|
+
const dispatchUpdateColor = useCallback((e, payload) => {
|
|
185
|
+
e.stopPropagation()
|
|
186
|
+
editor.dispatchCommand(UPDATE_COLOR_COMMAND, payload)
|
|
187
|
+
}, [editor])
|
|
188
|
+
|
|
189
|
+
return (
|
|
190
|
+
<div className={`${baseClassName} ${componentClassName}`}>
|
|
191
|
+
<div className="group">
|
|
192
|
+
<button
|
|
193
|
+
type="button"
|
|
194
|
+
className={isBold ? 'active' : undefined}
|
|
195
|
+
onClick={() => editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'bold')}
|
|
196
|
+
>
|
|
197
|
+
<span className="icon">
|
|
198
|
+
|
|
|
199
|
+
</span>
|
|
200
|
+
</button>
|
|
201
|
+
<button
|
|
202
|
+
type="button"
|
|
203
|
+
className={isItalic ? 'active' : undefined}
|
|
204
|
+
onClick={() => editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'italic')}
|
|
205
|
+
>
|
|
206
|
+
<span className="icon">
|
|
207
|
+
}
|
|
208
|
+
</span>
|
|
209
|
+
</button>
|
|
210
|
+
<button
|
|
211
|
+
type="button"
|
|
212
|
+
className={isUnderline ? 'active' : undefined}
|
|
213
|
+
onClick={() => editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'underline')}
|
|
214
|
+
>
|
|
215
|
+
<span className="icon">
|
|
216
|
+
~
|
|
217
|
+
</span>
|
|
218
|
+
</button>
|
|
219
|
+
<button
|
|
220
|
+
type="button"
|
|
221
|
+
className={isStrikethrough ? 'active' : undefined}
|
|
222
|
+
onClick={() => editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'strikethrough')}
|
|
223
|
+
>
|
|
224
|
+
<span className="icon">
|
|
225
|
+
?
|
|
226
|
+
</span>
|
|
227
|
+
</button>
|
|
228
|
+
<button
|
|
229
|
+
type="button"
|
|
230
|
+
className={color && color !== defaultColor ? 'active color-menu-button' : 'color-menu-button'}
|
|
231
|
+
onClick={() => editor.dispatchCommand(UPDATE_COLOR_COMMAND,
|
|
232
|
+
color !== defaultColor ? defaultColor : color)}
|
|
233
|
+
ref={colorMenuRef}
|
|
234
|
+
style={{ position: 'relative' }}
|
|
235
|
+
>
|
|
236
|
+
<span
|
|
237
|
+
className="icon"
|
|
238
|
+
style={{
|
|
239
|
+
color,
|
|
240
|
+
}}
|
|
241
|
+
>
|
|
242
|
+
Q
|
|
243
|
+
</span>
|
|
244
|
+
<Popover
|
|
245
|
+
parentRef={colorMenuRef}
|
|
246
|
+
>
|
|
247
|
+
<div className="color-menu">
|
|
248
|
+
{
|
|
249
|
+
colorOptions.map((option) => (
|
|
250
|
+
<span
|
|
251
|
+
role="button"
|
|
252
|
+
className="icon color-option"
|
|
253
|
+
style={{
|
|
254
|
+
color:option,
|
|
255
|
+
}}
|
|
256
|
+
onClick={(e) => dispatchUpdateColor(e, option)}
|
|
257
|
+
onKeyDown={(e) => dispatchUpdateColor(e, option)}
|
|
258
|
+
tabIndex={0}
|
|
259
|
+
key={option}
|
|
260
|
+
>
|
|
261
|
+
o
|
|
262
|
+
</span>
|
|
263
|
+
))
|
|
264
|
+
}
|
|
265
|
+
</div>
|
|
266
|
+
</Popover>
|
|
267
|
+
</button>
|
|
268
|
+
|
|
269
|
+
<button
|
|
270
|
+
type="button"
|
|
271
|
+
className={isLink ? 'active' : undefined}
|
|
272
|
+
onClick={() => formatLink()}
|
|
273
|
+
>
|
|
274
|
+
<span className="icon">
|
|
275
|
+
]
|
|
276
|
+
</span>
|
|
277
|
+
</button>
|
|
278
|
+
<button
|
|
279
|
+
type="button"
|
|
280
|
+
className={blockType === 'ul' ? 'active' : undefined}
|
|
281
|
+
onClick={() => formatBulletList()}
|
|
282
|
+
>
|
|
283
|
+
<span className="icon">
|
|
284
|
+
.
|
|
285
|
+
</span>
|
|
286
|
+
</button>
|
|
287
|
+
<button
|
|
288
|
+
type="button"
|
|
289
|
+
className={blockType === 'ol' ? 'active' : undefined}
|
|
290
|
+
onClick={() => formatNumberedList()}
|
|
291
|
+
>
|
|
292
|
+
<span className="icon">
|
|
293
|
+
-
|
|
294
|
+
</span>
|
|
295
|
+
</button>
|
|
296
|
+
</div>
|
|
297
|
+
|
|
298
|
+
<div className="group">
|
|
299
|
+
<button
|
|
300
|
+
type="button"
|
|
301
|
+
onClick={() => editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'left')}
|
|
302
|
+
>
|
|
303
|
+
<span className="icon">
|
|
304
|
+
^
|
|
305
|
+
</span>
|
|
306
|
+
</button>
|
|
307
|
+
<button
|
|
308
|
+
type="button"
|
|
309
|
+
onClick={() => editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'center')}
|
|
310
|
+
>
|
|
311
|
+
<span className="icon">
|
|
312
|
+
_
|
|
313
|
+
</span>
|
|
314
|
+
</button>
|
|
315
|
+
<button
|
|
316
|
+
type="button"
|
|
317
|
+
onClick={() => editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'right')}
|
|
318
|
+
>
|
|
319
|
+
<span className="icon">
|
|
320
|
+
`
|
|
321
|
+
</span>
|
|
322
|
+
</button>
|
|
323
|
+
<button
|
|
324
|
+
type="button"
|
|
325
|
+
onClick={() => editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'justify')}
|
|
326
|
+
>
|
|
327
|
+
<span className="icon">
|
|
328
|
+
{
|
|
329
|
+
</span>
|
|
330
|
+
</button>
|
|
331
|
+
</div>
|
|
332
|
+
|
|
333
|
+
<div className="group">
|
|
334
|
+
<button
|
|
335
|
+
type="button"
|
|
336
|
+
onClick={() => editor.dispatchCommand(UNDO_COMMAND)}
|
|
337
|
+
>
|
|
338
|
+
<span className="icon">
|
|
339
|
+
\
|
|
340
|
+
</span>
|
|
341
|
+
</button>
|
|
342
|
+
<button
|
|
343
|
+
type="button"
|
|
344
|
+
className="flip"
|
|
345
|
+
onClick={() => editor.dispatchCommand(REDO_COMMAND)}
|
|
346
|
+
>
|
|
347
|
+
<span className="icon">
|
|
348
|
+
\
|
|
349
|
+
</span>
|
|
350
|
+
</button>
|
|
351
|
+
</div>
|
|
352
|
+
</div>
|
|
353
|
+
)
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export default Toolbar
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'
|
|
3
|
+
import { TreeView } from '@lexical/react/LexicalTreeView'
|
|
4
|
+
|
|
5
|
+
const TreeViewPlugin = () => {
|
|
6
|
+
const [editor] = useLexicalComposerContext()
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<TreeView
|
|
10
|
+
viewClassName="tree-view-output"
|
|
11
|
+
editor={editor}
|
|
12
|
+
/>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default TreeViewPlugin
|