@pareto-engineering/design-system 2.0.0-alpha.5 → 2.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/.env.scripts.example +4 -0
- package/.eslintrc.js +25 -1
- package/babel.config.js +1 -0
- package/dist/cjs/a/BackgroundGradient/BackgroundGradient.js +77 -0
- package/dist/cjs/a/BackgroundGradient/index.js +15 -0
- package/dist/cjs/a/BackgroundGradient/styles.scss +16 -0
- package/dist/cjs/a/ContentTree/ContentTree.js +83 -0
- package/dist/cjs/a/ContentTree/common/Tree/Tree.js +116 -0
- package/dist/cjs/a/ContentTree/common/Tree/index.js +15 -0
- package/dist/cjs/a/ContentTree/common/index.js +31 -0
- package/dist/cjs/a/ContentTree/common/useContentTree.js +82 -0
- package/dist/cjs/a/ContentTree/common/useFirstVisibleNode.js +65 -0
- package/dist/cjs/a/ContentTree/index.js +15 -0
- package/dist/cjs/a/ContentTree/styles.scss +33 -0
- package/dist/cjs/a/Conversation/Conversation.js +14 -8
- package/dist/cjs/a/Conversation/common/Message/Message.js +32 -6
- package/dist/cjs/a/Conversation/styles.scss +132 -33
- package/dist/cjs/a/OvalIllustration/OvalIllustration.js +133 -0
- package/dist/cjs/a/OvalIllustration/index.js +15 -0
- package/dist/cjs/a/OvalIllustration/styles.scss +102 -0
- package/dist/cjs/a/Popover/Popover.js +134 -0
- package/dist/cjs/a/Popover/common/Divider/Divider.js +67 -0
- package/dist/cjs/a/Popover/common/Divider/index.js +15 -0
- package/dist/cjs/a/Popover/common/Item/Item.js +67 -0
- package/dist/cjs/a/Popover/common/Item/index.js +15 -0
- package/dist/cjs/a/Popover/common/index.js +21 -0
- package/dist/cjs/a/Popover/index.js +15 -0
- package/dist/cjs/a/Popover/styles.scss +33 -0
- package/dist/cjs/a/Shapes/Shapes.js +39 -9
- package/dist/cjs/a/Shapes/styles.scss +79 -23
- package/dist/cjs/a/SnapScroller/SnapScroller.js +77 -0
- package/dist/cjs/a/SnapScroller/index.js +15 -0
- package/dist/cjs/a/SnapScroller/styles.scss +38 -0
- package/dist/cjs/a/index.js +41 -1
- package/dist/cjs/b/Button/Button.js +10 -4
- package/dist/cjs/b/Button/styles.scss +55 -10
- package/dist/cjs/b/Logo/Logo.js +41 -41
- package/dist/cjs/b/Logo/styles.scss +0 -138
- package/dist/cjs/b/Page/common/Section/Section.js +35 -7
- package/dist/cjs/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +16 -9
- package/dist/cjs/c/ContentSlides/common/Navigator/Navigator.js +4 -3
- package/dist/cjs/c/ContentSlides/styles.scss +10 -4
- package/dist/cjs/c/SocialMediaShareButton/SocialMediaShareButton.js +105 -0
- package/dist/cjs/c/SocialMediaShareButton/index.js +15 -0
- package/dist/cjs/c/SocialMediaShareButton/styles.scss +39 -0
- package/dist/cjs/c/index.js +9 -1
- package/dist/cjs/f/FormInput/FormInput.js +20 -3
- package/dist/cjs/f/FormInput/styles.scss +11 -0
- package/dist/cjs/f/common/Debugger/Debugger.js +1 -1
- package/dist/cjs/f/common/Label/Label.js +1 -1
- package/dist/cjs/f/common/Label/styles.scss +1 -1
- package/dist/cjs/f/fields/ChoicesInput/ChoicesInput.js +1 -1
- package/dist/cjs/f/fields/ChoicesInput/styles.scss +17 -2
- package/dist/cjs/f/fields/QueryCombobox/QueryCombobox.js +236 -0
- package/dist/cjs/f/fields/QueryCombobox/common/Combobox/Combobox.js +205 -0
- package/dist/cjs/f/fields/QueryCombobox/common/Combobox/index.js +15 -0
- package/dist/cjs/f/fields/QueryCombobox/common/Menu/Menu.js +103 -0
- package/dist/cjs/f/fields/QueryCombobox/common/Menu/index.js +15 -0
- package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +304 -0
- package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/index.js +15 -0
- package/dist/cjs/f/fields/QueryCombobox/common/index.js +29 -0
- package/dist/cjs/f/fields/QueryCombobox/index.js +15 -0
- package/dist/cjs/f/fields/QueryCombobox/styles.scss +90 -0
- package/dist/cjs/f/fields/QuerySelect/QuerySelect.js +201 -0
- package/dist/cjs/f/fields/QuerySelect/index.js +15 -0
- package/dist/cjs/f/fields/QuerySelect/styles.scss +21 -0
- package/dist/cjs/f/fields/RatingsInput/RatingsInput.js +39 -6
- package/dist/cjs/f/fields/RatingsInput/styles.scss +29 -20
- package/dist/cjs/f/fields/SelectInput/SelectInput.js +50 -13
- package/dist/cjs/f/fields/SelectInput/styles.scss +33 -13
- package/dist/cjs/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +1 -1
- package/dist/cjs/f/fields/TextInput/TextInput.js +35 -7
- package/dist/cjs/f/fields/TextInput/styles.scss +16 -7
- package/dist/cjs/f/fields/TextareaInput/TextareaInput.js +15 -8
- package/dist/cjs/f/fields/TextareaInput/styles.scss +19 -6
- package/dist/cjs/f/fields/index.js +15 -23
- package/dist/cjs/form-reset.scss +1 -1
- package/dist/cjs/index.js +26 -0
- package/dist/cjs/test/QueryLoader/QueryLoader.js +41 -0
- package/dist/cjs/test/QueryLoader/__generated__/QueryLoaderHelloQuery.graphql.js +71 -0
- package/dist/cjs/test/QueryLoader/common/PreloadedTestData/PreloadedTestData.js +49 -0
- package/dist/cjs/test/QueryLoader/common/PreloadedTestData/index.js +15 -0
- package/dist/cjs/test/QueryLoader/common/index.js +13 -0
- package/dist/cjs/test/QueryLoader/index.js +15 -0
- package/dist/cjs/test/QueryLoader/styles.scss +9 -0
- package/dist/cjs/test/index.js +13 -0
- package/dist/cjs/utils/hooks/index.js +23 -0
- package/dist/cjs/utils/hooks/useDynamicPosition.js +107 -0
- package/dist/cjs/utils/hooks/useWindowSize.js +39 -0
- package/dist/cjs/utils/index.js +19 -0
- package/dist/es/a/BackgroundGradient/BackgroundGradient.js +55 -0
- package/dist/es/a/BackgroundGradient/index.js +2 -0
- package/dist/es/a/BackgroundGradient/styles.scss +16 -0
- package/dist/es/a/ContentTree/ContentTree.js +67 -0
- package/dist/es/a/ContentTree/common/Tree/Tree.js +98 -0
- package/dist/es/a/ContentTree/common/Tree/index.js +2 -0
- package/dist/es/a/ContentTree/common/index.js +3 -0
- package/dist/es/a/ContentTree/common/useContentTree.js +74 -0
- package/dist/es/a/ContentTree/common/useFirstVisibleNode.js +54 -0
- package/dist/es/a/ContentTree/index.js +2 -0
- package/dist/es/a/ContentTree/styles.scss +33 -0
- package/dist/es/a/Conversation/Conversation.js +14 -8
- package/dist/es/a/Conversation/common/Message/Message.js +32 -6
- package/dist/es/a/Conversation/styles.scss +132 -33
- package/dist/es/a/OvalIllustration/OvalIllustration.js +111 -0
- package/dist/es/a/OvalIllustration/index.js +2 -0
- package/dist/es/a/OvalIllustration/styles.scss +102 -0
- package/dist/es/a/Popover/Popover.js +118 -0
- package/dist/es/a/Popover/common/Divider/Divider.js +47 -0
- package/dist/es/a/Popover/common/Divider/index.js +2 -0
- package/dist/es/a/Popover/common/Item/Item.js +47 -0
- package/dist/es/a/Popover/common/Item/index.js +2 -0
- package/dist/es/a/Popover/common/index.js +2 -0
- package/dist/es/a/Popover/index.js +2 -0
- package/dist/es/a/Popover/styles.scss +33 -0
- package/dist/es/a/Shapes/Shapes.js +39 -9
- package/dist/es/a/Shapes/styles.scss +79 -23
- package/dist/es/a/SnapScroller/SnapScroller.js +61 -0
- package/dist/es/a/SnapScroller/index.js +2 -0
- package/dist/es/a/SnapScroller/styles.scss +38 -0
- package/dist/es/a/index.js +6 -1
- package/dist/es/b/Button/Button.js +8 -2
- package/dist/es/b/Button/styles.scss +55 -10
- package/dist/es/b/Logo/Logo.js +41 -41
- package/dist/es/b/Logo/styles.scss +0 -138
- package/dist/es/b/Page/common/Section/Section.js +34 -6
- package/dist/es/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +16 -9
- package/dist/es/c/ContentSlides/common/Navigator/Navigator.js +4 -3
- package/dist/es/c/ContentSlides/styles.scss +10 -4
- package/dist/es/c/SocialMediaShareButton/SocialMediaShareButton.js +89 -0
- package/dist/es/c/SocialMediaShareButton/index.js +2 -0
- package/dist/es/c/SocialMediaShareButton/styles.scss +39 -0
- package/dist/es/c/index.js +2 -1
- package/dist/es/f/FormInput/FormInput.js +20 -3
- package/dist/es/f/FormInput/styles.scss +11 -0
- package/dist/es/f/common/Debugger/Debugger.js +1 -1
- package/dist/es/f/common/Label/Label.js +1 -1
- package/dist/es/f/common/Label/styles.scss +1 -1
- package/dist/es/f/fields/ChoicesInput/ChoicesInput.js +1 -1
- package/dist/es/f/fields/ChoicesInput/styles.scss +17 -2
- package/dist/es/f/fields/QueryCombobox/QueryCombobox.js +213 -0
- package/dist/es/f/fields/QueryCombobox/common/Combobox/Combobox.js +185 -0
- package/dist/es/f/fields/QueryCombobox/common/Combobox/index.js +2 -0
- package/dist/es/f/fields/QueryCombobox/common/Menu/Menu.js +77 -0
- package/dist/es/f/fields/QueryCombobox/common/Menu/index.js +2 -0
- package/dist/es/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +276 -0
- package/dist/es/f/fields/QueryCombobox/common/MultipleCombobox/index.js +2 -0
- package/dist/es/f/fields/QueryCombobox/common/index.js +3 -0
- package/dist/es/f/fields/QueryCombobox/index.js +2 -0
- package/dist/es/f/fields/QueryCombobox/styles.scss +90 -0
- package/dist/es/f/fields/QuerySelect/QuerySelect.js +179 -0
- package/dist/es/f/fields/QuerySelect/index.js +2 -0
- package/dist/es/f/fields/QuerySelect/styles.scss +21 -0
- package/dist/es/f/fields/RatingsInput/RatingsInput.js +38 -6
- package/dist/es/f/fields/RatingsInput/styles.scss +29 -20
- package/dist/es/f/fields/SelectInput/SelectInput.js +49 -13
- package/dist/es/f/fields/SelectInput/styles.scss +33 -13
- package/dist/es/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +1 -1
- package/dist/es/f/fields/TextInput/TextInput.js +35 -7
- package/dist/es/f/fields/TextInput/styles.scss +16 -7
- package/dist/es/f/fields/TextareaInput/TextareaInput.js +15 -8
- package/dist/es/f/fields/TextareaInput/styles.scss +19 -6
- package/dist/es/f/fields/index.js +3 -4
- package/dist/es/form-reset.scss +1 -1
- package/dist/es/index.js +3 -1
- package/dist/es/test/QueryLoader/QueryLoader.js +29 -0
- package/dist/es/test/QueryLoader/__generated__/QueryLoaderHelloQuery.graphql.js +71 -0
- package/dist/es/test/QueryLoader/common/PreloadedTestData/PreloadedTestData.js +31 -0
- package/dist/es/test/QueryLoader/common/PreloadedTestData/index.js +2 -0
- package/dist/es/test/QueryLoader/common/index.js +1 -0
- package/dist/es/test/QueryLoader/index.js +2 -0
- package/dist/es/test/QueryLoader/styles.scss +9 -0
- package/dist/es/test/index.js +1 -0
- package/dist/es/utils/hooks/index.js +2 -0
- package/dist/es/utils/hooks/useDynamicPosition.js +93 -0
- package/dist/es/utils/hooks/useWindowSize.js +27 -0
- package/dist/es/utils/index.js +1 -0
- package/package.json +18 -4
- package/relay.config.js +12 -0
- package/schema.graphql +4075 -0
- package/scripts/fetchSchema.js +74 -0
- package/src/__snapshots__/Storyshots.test.js.snap +7018 -3507
- package/src/local.scss +4 -2
- package/src/stories/StyleGuide/Sprites.stories.mdx +25 -0
- package/src/stories/StyleGuide/helpers.js +16 -0
- package/src/stories/a/BackgroundGradient.stories.jsx +38 -0
- package/src/stories/a/ContentTree.stories.jsx +662 -0
- package/src/stories/a/Conversation.stories.jsx +78 -1
- package/src/stories/a/OvalIllustration.stories.jsx +59 -0
- package/src/stories/a/Popover.stories.jsx +106 -0
- package/src/stories/a/Shapes.stories.jsx +74 -43
- package/src/stories/a/SnapScroller.stories.jsx +98 -0
- package/src/stories/b/Button.stories.jsx +27 -4
- package/src/stories/b/Logo.stories.jsx +17 -9
- package/src/stories/b/Page.stories.jsx +27 -2
- package/src/stories/c/ContentSlides.stories.jsx +154 -2
- package/src/stories/c/SocialMediaShareButton.stories.jsx +25 -0
- package/src/stories/f/FormInput.stories.jsx +233 -0
- package/src/stories/f/QueryCombobox.stories.jsx +269 -0
- package/src/stories/f/QuerySelect.stories.jsx +134 -0
- package/src/stories/f/RatingsInput.stories.jsx +3 -2
- package/src/stories/f/SelectInput.stories.jsx +36 -5
- package/src/stories/f/TextInput.stories.jsx +15 -4
- package/src/stories/f/TextareaInput.stories.jsx +42 -6
- package/src/stories/f/__generated__/FormInputAllTaskStatusesQuery.graphql.js +122 -0
- package/src/stories/f/__generated__/FormInputAllTeamsQuery.graphql.js +139 -0
- package/src/stories/f/__generated__/QueryComboboxAllTeamsQuery.graphql.js +139 -0
- package/src/stories/f/__generated__/QuerySelectAllTaskStatusesQuery.graphql.js +122 -0
- package/src/stories/test/QueryLoader.stories.jsx +36 -0
- package/src/stories/utils/generateNodeId.js +12 -0
- package/src/stories/utils/lorem.js +15 -0
- package/src/stories/utils/relay/EnvironmentProvider.jsx +14 -0
- package/src/stories/utils/relay/environment.js +5 -0
- package/src/stories/utils/relay/index.js +4 -0
- package/src/stories/utils/relay/mockRelayOperation.js +14 -0
- package/src/stories/utils/relay/mockResolvers.js +299 -0
- package/src/stories/utils/testData.js +63 -0
- package/src/ui/a/BackgroundGradient/BackgroundGradient.jsx +76 -0
- package/src/ui/a/BackgroundGradient/index.js +2 -0
- package/src/ui/a/BackgroundGradient/styles.scss +16 -0
- package/src/ui/a/ContentTree/ContentTree.jsx +88 -0
- package/src/ui/a/ContentTree/common/Tree/Tree.jsx +138 -0
- package/src/ui/a/ContentTree/common/Tree/index.js +2 -0
- package/src/ui/a/ContentTree/common/index.js +3 -0
- package/src/ui/a/ContentTree/common/useContentTree.js +83 -0
- package/src/ui/a/ContentTree/common/useFirstVisibleNode.js +59 -0
- package/src/ui/a/ContentTree/index.js +2 -0
- package/src/ui/a/ContentTree/styles.scss +33 -0
- package/src/ui/a/Conversation/Conversation.jsx +15 -7
- package/src/ui/a/Conversation/common/Message/Message.jsx +38 -6
- package/src/ui/a/Conversation/styles.scss +132 -33
- package/src/ui/a/OvalIllustration/OvalIllustration.jsx +134 -0
- package/src/ui/a/OvalIllustration/index.js +2 -0
- package/src/ui/a/OvalIllustration/styles.scss +102 -0
- package/src/ui/a/Popover/Popover.jsx +157 -0
- package/src/ui/a/Popover/index.js +2 -0
- package/src/ui/a/Popover/styles.scss +33 -0
- package/src/ui/a/Shapes/Shapes.jsx +44 -7
- package/src/ui/a/Shapes/styles.scss +79 -23
- package/src/ui/a/SnapScroller/SnapScroller.jsx +83 -0
- package/src/ui/a/SnapScroller/index.js +2 -0
- package/src/ui/a/SnapScroller/styles.scss +38 -0
- package/src/ui/a/index.js +5 -0
- package/src/ui/b/Button/Button.jsx +9 -1
- package/src/ui/b/Button/styles.scss +55 -10
- package/src/ui/b/Logo/Logo.jsx +41 -41
- package/src/ui/b/Logo/styles.scss +0 -138
- package/src/ui/b/Page/common/Section/Section.jsx +39 -5
- package/src/ui/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.jsx +12 -5
- package/src/ui/c/ContentSlides/common/Navigator/Navigator.jsx +3 -2
- package/src/ui/c/ContentSlides/styles.scss +10 -4
- package/src/ui/c/SocialMediaShareButton/SocialMediaShareButton.jsx +113 -0
- package/src/ui/c/SocialMediaShareButton/index.js +2 -0
- package/src/ui/c/SocialMediaShareButton/styles.scss +39 -0
- package/src/ui/c/index.js +1 -0
- package/src/ui/f/FormInput/FormInput.jsx +26 -1
- package/src/ui/f/FormInput/styles.scss +11 -0
- package/src/ui/f/common/Debugger/Debugger.jsx +1 -1
- package/src/ui/f/common/Label/Label.jsx +1 -1
- package/src/ui/f/common/Label/styles.scss +1 -1
- package/src/ui/f/fields/ChoicesInput/ChoicesInput.jsx +1 -1
- package/src/ui/f/fields/ChoicesInput/styles.scss +17 -2
- package/src/ui/f/fields/QueryCombobox/QueryCombobox.jsx +227 -0
- package/src/ui/f/fields/QueryCombobox/common/Combobox/Combobox.jsx +222 -0
- package/src/ui/f/fields/QueryCombobox/common/Combobox/index.js +2 -0
- package/src/ui/f/fields/QueryCombobox/common/Menu/Menu.jsx +103 -0
- package/src/ui/f/fields/QueryCombobox/common/Menu/index.js +2 -0
- package/src/ui/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.jsx +318 -0
- package/src/ui/f/fields/QueryCombobox/common/MultipleCombobox/index.js +2 -0
- package/src/ui/f/fields/QueryCombobox/common/index.js +3 -0
- package/src/ui/f/fields/QueryCombobox/index.js +2 -0
- package/src/ui/f/fields/QueryCombobox/styles.scss +90 -0
- package/src/ui/f/fields/QuerySelect/QuerySelect.jsx +200 -0
- package/src/ui/f/fields/QuerySelect/index.js +2 -0
- package/src/ui/f/fields/RatingsInput/RatingsInput.jsx +54 -19
- package/src/ui/f/fields/RatingsInput/styles.scss +29 -20
- package/src/ui/f/fields/SelectInput/SelectInput.jsx +59 -8
- package/src/ui/f/fields/SelectInput/styles.scss +33 -13
- package/src/ui/f/fields/TextInput/TextInput.jsx +31 -3
- package/src/ui/f/fields/TextInput/styles.scss +16 -7
- package/src/ui/f/fields/TextareaInput/TextareaInput.jsx +24 -13
- package/src/ui/f/fields/TextareaInput/styles.scss +19 -6
- package/src/ui/f/fields/index.js +2 -3
- package/src/ui/form-reset.scss +1 -1
- package/src/ui/index.js +2 -0
- package/src/ui/test/QueryLoader/QueryLoader.jsx +41 -0
- package/src/ui/test/QueryLoader/__generated__/QueryLoaderHelloQuery.graphql.js +68 -0
- package/src/ui/test/QueryLoader/common/PreloadedTestData/PreloadedTestData.jsx +51 -0
- package/src/ui/test/QueryLoader/common/PreloadedTestData/index.js +2 -0
- package/src/ui/test/QueryLoader/common/index.js +1 -0
- package/src/ui/test/QueryLoader/index.js +2 -0
- package/src/ui/test/index.js +1 -0
- package/src/ui/utils/hooks/index.js +2 -0
- package/src/ui/utils/hooks/useDynamicPosition.js +104 -0
- package/src/ui/utils/hooks/useWindowSize.js +32 -0
- package/src/ui/utils/index.js +1 -0
- package/stylelint.config.js +13 -13
- package/src/stories/f/CheckboxInput.stories.jsx +0 -37
- package/src/stories/f/RadioInput.stories.jsx +0 -37
- package/src/stories/f/TaskRecommendationInput.stories.jsx +0 -38
- package/src/ui/f/fields/CheckboxInput/CheckboxInput.jsx +0 -107
- package/src/ui/f/fields/CheckboxInput/index.js +0 -2
- package/src/ui/f/fields/CheckboxInput/styles.scss +0 -28
- package/src/ui/f/fields/RadioInput/RadioInput.jsx +0 -112
- package/src/ui/f/fields/RadioInput/index.js +0 -2
- package/src/ui/f/fields/RadioInput/styles.scss +0 -26
- package/src/ui/f/fields/TaskRecommendationInput/TaskRecommendationInput.jsx +0 -130
- package/src/ui/f/fields/TaskRecommendationInput/index.js +0 -2
- package/src/ui/f/fields/TaskRecommendationInput/styles.scss +0 -41
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
|
|
4
|
+
import { useLayoutEffect } from 'react'
|
|
5
|
+
|
|
6
|
+
import PropTypes from 'prop-types'
|
|
7
|
+
|
|
8
|
+
import styleNames from '@pareto-engineering/bem'
|
|
9
|
+
|
|
10
|
+
// Local Definitions
|
|
11
|
+
|
|
12
|
+
const baseClassName = styleNames.base
|
|
13
|
+
|
|
14
|
+
const componentClassName = 'social-media-share-button'
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* This is the component description.
|
|
18
|
+
*/
|
|
19
|
+
const SocialMediaShareButton = ({
|
|
20
|
+
id,
|
|
21
|
+
className:userClassName,
|
|
22
|
+
style,
|
|
23
|
+
icon,
|
|
24
|
+
// children,
|
|
25
|
+
type,
|
|
26
|
+
color,
|
|
27
|
+
}) => {
|
|
28
|
+
useLayoutEffect(() => {
|
|
29
|
+
import('./styles.scss')
|
|
30
|
+
}, [])
|
|
31
|
+
|
|
32
|
+
const isServer = typeof window === 'undefined'
|
|
33
|
+
|
|
34
|
+
const title = isServer ? '' : document.title
|
|
35
|
+
const link = isServer ? '' : window.location.href
|
|
36
|
+
|
|
37
|
+
const defaultsMap = {
|
|
38
|
+
facebook:{
|
|
39
|
+
icon:'f',
|
|
40
|
+
link:`https://www.facebook.com/sharer/sharer.php?u=${link}"e=${title}`,
|
|
41
|
+
},
|
|
42
|
+
twitter:{
|
|
43
|
+
icon:'t',
|
|
44
|
+
link:`https://twitter.com/intent/tweet?text=${title}&url=${link}`,
|
|
45
|
+
},
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<a
|
|
50
|
+
href={defaultsMap[type].link}
|
|
51
|
+
target="_blank"
|
|
52
|
+
rel="noreferrer"
|
|
53
|
+
id={id}
|
|
54
|
+
className={[
|
|
55
|
+
baseClassName,
|
|
56
|
+
componentClassName,
|
|
57
|
+
`x-${color || type}`,
|
|
58
|
+
userClassName,
|
|
59
|
+
]
|
|
60
|
+
.filter((e) => e)
|
|
61
|
+
.join(' ')}
|
|
62
|
+
style={style}
|
|
63
|
+
>
|
|
64
|
+
<button type="button">
|
|
65
|
+
{ icon || defaultsMap[type].icon }
|
|
66
|
+
</button>
|
|
67
|
+
</a>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
SocialMediaShareButton.propTypes = {
|
|
72
|
+
/**
|
|
73
|
+
* The HTML id for this element
|
|
74
|
+
*/
|
|
75
|
+
id:PropTypes.string,
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The HTML class names for this element
|
|
79
|
+
*/
|
|
80
|
+
className:PropTypes.string,
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The React-written, css properties for this element.
|
|
84
|
+
*/
|
|
85
|
+
style:PropTypes.objectOf(PropTypes.string),
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The children JSX
|
|
89
|
+
*/
|
|
90
|
+
// children:PropTypes.node,
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* The Social Media to Target.
|
|
94
|
+
* If blank, you need to provide both an icon letter (from glyphter) and a link.
|
|
95
|
+
*/
|
|
96
|
+
type:PropTypes.oneOf(['twitter', 'facebook']),
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* The icon of the social media
|
|
100
|
+
*/
|
|
101
|
+
icon:PropTypes.string,
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The button color
|
|
105
|
+
*/
|
|
106
|
+
color:PropTypes.string,
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
SocialMediaShareButton.defaultProps = {
|
|
110
|
+
// someProp:false
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export default SocialMediaShareButton
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
|
|
3
|
+
@use "@pareto-engineering/bem";
|
|
4
|
+
@use "@aztlan/stylebook/src/mixins";
|
|
5
|
+
@use "@aztlan/stylebook/src/globals" as *;
|
|
6
|
+
|
|
7
|
+
$default-dimensions: 2em;
|
|
8
|
+
$mobile-dimensions: 2.75em;
|
|
9
|
+
|
|
10
|
+
.#{bem.$base}.social-media-share-button{
|
|
11
|
+
|
|
12
|
+
> button {
|
|
13
|
+
appearance: none;
|
|
14
|
+
background: transparent;
|
|
15
|
+
border: 0;
|
|
16
|
+
border-radius: 3em;
|
|
17
|
+
color: var(--x);
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
font-family: "icons", sans-serif;
|
|
20
|
+
height: $default-dimensions;
|
|
21
|
+
transition: all .3s;
|
|
22
|
+
width: $default-dimensions;
|
|
23
|
+
|
|
24
|
+
@include mixins.media($to:$sm-md) {
|
|
25
|
+
height: $mobile-dimensions;
|
|
26
|
+
width: $mobile-dimensions;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&:hover {
|
|
30
|
+
background: var(--x);
|
|
31
|
+
color: var(--on-x);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&:focus, &:active {
|
|
35
|
+
background: var(--light-x);
|
|
36
|
+
color: var(--on-x);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
package/src/ui/c/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
2
|
import * as React from 'react'
|
|
3
3
|
|
|
4
|
-
import { memo } from 'react'
|
|
4
|
+
import { memo, useLayoutEffect } from 'react'
|
|
5
5
|
|
|
6
6
|
import PropTypes from 'prop-types'
|
|
7
7
|
|
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
TextareaInput,
|
|
11
11
|
ChoicesInput,
|
|
12
12
|
SelectInput,
|
|
13
|
+
QueryCombobox,
|
|
14
|
+
QuerySelect,
|
|
13
15
|
} from '../fields'
|
|
14
16
|
|
|
15
17
|
// Local Definitions
|
|
@@ -28,6 +30,10 @@ const FormInput = ({
|
|
|
28
30
|
disabled,
|
|
29
31
|
...otherProps
|
|
30
32
|
}) => {
|
|
33
|
+
useLayoutEffect(() => {
|
|
34
|
+
import('./styles.scss')
|
|
35
|
+
}, [])
|
|
36
|
+
|
|
31
37
|
const newClassName = [
|
|
32
38
|
className,
|
|
33
39
|
componentClassName,
|
|
@@ -60,6 +66,24 @@ const FormInput = ({
|
|
|
60
66
|
/>
|
|
61
67
|
)
|
|
62
68
|
}
|
|
69
|
+
if (type === 'query-combobox') {
|
|
70
|
+
return (
|
|
71
|
+
<QueryCombobox
|
|
72
|
+
className={newClassName}
|
|
73
|
+
disabled={disabled}
|
|
74
|
+
{...otherProps}
|
|
75
|
+
/>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
if (type === 'query-select') {
|
|
79
|
+
return (
|
|
80
|
+
<QuerySelect
|
|
81
|
+
className={newClassName}
|
|
82
|
+
disabled={disabled}
|
|
83
|
+
{...otherProps}
|
|
84
|
+
/>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
63
87
|
if (extraTypes?.[type]) {
|
|
64
88
|
const Component = extraTypes[type]
|
|
65
89
|
return (
|
|
@@ -102,6 +126,7 @@ FormInput.propTypes = {
|
|
|
102
126
|
'select',
|
|
103
127
|
'choices',
|
|
104
128
|
'textarea',
|
|
129
|
+
'query-combobox',
|
|
105
130
|
// to be removed
|
|
106
131
|
'extendedTypeInput',
|
|
107
132
|
]),
|
|
@@ -29,10 +29,21 @@ $default-transition:all .3s;
|
|
|
29
29
|
z-index: -1;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
input:disabled + label {
|
|
33
|
+
background-color: var(--dark-x);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
input:not(:disabled) + label {
|
|
37
|
+
&:hover {
|
|
38
|
+
border-color: var(--light-y);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
32
42
|
label {
|
|
33
|
-
|
|
34
|
-
|
|
43
|
+
border: var(--theme-border-style) var(--dark-x);
|
|
44
|
+
background: var(--light-x);
|
|
35
45
|
color: var(--on-x);
|
|
46
|
+
border-radius: var(--theme-border-radius);
|
|
36
47
|
display: block;
|
|
37
48
|
height: 100%;
|
|
38
49
|
padding: $default-padding;
|
|
@@ -44,6 +55,10 @@ $default-transition:all .3s;
|
|
|
44
55
|
input:checked + label {
|
|
45
56
|
background: var(--y);
|
|
46
57
|
color: var(--on-y);
|
|
58
|
+
|
|
59
|
+
&:hover {
|
|
60
|
+
border-color: var(--y);
|
|
61
|
+
}
|
|
47
62
|
}
|
|
48
63
|
}
|
|
49
64
|
}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
|
|
4
|
+
import { useState, useLayoutEffect } from 'react'
|
|
5
|
+
|
|
6
|
+
import { useField } from 'formik'
|
|
7
|
+
|
|
8
|
+
import { useRelayEnvironment, fetchQuery } from 'react-relay'
|
|
9
|
+
|
|
10
|
+
import PropTypes from 'prop-types'
|
|
11
|
+
|
|
12
|
+
// Local Definitions
|
|
13
|
+
|
|
14
|
+
import { Combobox, MultipleCombobox } from './common'
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* This is the component description.
|
|
18
|
+
*/
|
|
19
|
+
const QueryCombobox = ({
|
|
20
|
+
id,
|
|
21
|
+
style,
|
|
22
|
+
className,
|
|
23
|
+
query,
|
|
24
|
+
multiple,
|
|
25
|
+
name,
|
|
26
|
+
label,
|
|
27
|
+
color,
|
|
28
|
+
description,
|
|
29
|
+
disabled,
|
|
30
|
+
debounceMs,
|
|
31
|
+
searchVariable,
|
|
32
|
+
extraVariables,
|
|
33
|
+
optionsKeyMap,
|
|
34
|
+
minLength,
|
|
35
|
+
transformSearch,
|
|
36
|
+
// ...otherProps
|
|
37
|
+
}) => {
|
|
38
|
+
useLayoutEffect(() => {
|
|
39
|
+
import('./styles.scss')
|
|
40
|
+
}, [])
|
|
41
|
+
|
|
42
|
+
const [, meta, helpers] = useField(name)
|
|
43
|
+
|
|
44
|
+
const { setValue, setError } = helpers
|
|
45
|
+
|
|
46
|
+
const { error, value } = meta
|
|
47
|
+
|
|
48
|
+
const environment = useRelayEnvironment()
|
|
49
|
+
|
|
50
|
+
const [isFetching, setIsFetching] = useState(false)
|
|
51
|
+
|
|
52
|
+
const [options, setOptions] = useState([])
|
|
53
|
+
|
|
54
|
+
const { graphql, accessor } = query
|
|
55
|
+
|
|
56
|
+
const getOptions = (inputValue) => {
|
|
57
|
+
if (isFetching) return
|
|
58
|
+
|
|
59
|
+
let variables = { [searchVariable]: inputValue }
|
|
60
|
+
|
|
61
|
+
if (extraVariables) {
|
|
62
|
+
variables = {
|
|
63
|
+
...variables,
|
|
64
|
+
...extraVariables,
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
fetchQuery(
|
|
69
|
+
environment,
|
|
70
|
+
graphql,
|
|
71
|
+
variables,
|
|
72
|
+
)
|
|
73
|
+
.subscribe({
|
|
74
|
+
start:() => {
|
|
75
|
+
setIsFetching(true)
|
|
76
|
+
},
|
|
77
|
+
complete:() => {
|
|
78
|
+
setIsFetching(false)
|
|
79
|
+
},
|
|
80
|
+
error:(fetchError) => {
|
|
81
|
+
setIsFetching(false)
|
|
82
|
+
if (setError)setError(fetchError.message)
|
|
83
|
+
},
|
|
84
|
+
next:(data) => {
|
|
85
|
+
setOptions(data[accessor].edges.map(({ node }) => ({
|
|
86
|
+
value:node[optionsKeyMap.value],
|
|
87
|
+
label:optionsKeyMap.getLabel(node),
|
|
88
|
+
})))
|
|
89
|
+
},
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const comboboxProps = {
|
|
94
|
+
id,
|
|
95
|
+
style,
|
|
96
|
+
options,
|
|
97
|
+
getOptions,
|
|
98
|
+
debounceMs,
|
|
99
|
+
disabled,
|
|
100
|
+
name,
|
|
101
|
+
label,
|
|
102
|
+
description,
|
|
103
|
+
setValue,
|
|
104
|
+
error,
|
|
105
|
+
value,
|
|
106
|
+
color,
|
|
107
|
+
isFetching,
|
|
108
|
+
className,
|
|
109
|
+
minLength,
|
|
110
|
+
transformSearch,
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const Input = multiple ? MultipleCombobox : Combobox
|
|
114
|
+
|
|
115
|
+
return <Input {...comboboxProps} />
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
QueryCombobox.propTypes = {
|
|
119
|
+
/**
|
|
120
|
+
* The HTML id for this element
|
|
121
|
+
*/
|
|
122
|
+
id:PropTypes.string,
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The HTML class names for this element
|
|
126
|
+
*/
|
|
127
|
+
className:PropTypes.string,
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* The React-written, css properties for this element.
|
|
131
|
+
*/
|
|
132
|
+
style:PropTypes.objectOf(PropTypes.string),
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* The name of the custom select input
|
|
136
|
+
*/
|
|
137
|
+
name:PropTypes.string,
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* The label of the custom select input
|
|
141
|
+
*/
|
|
142
|
+
label:PropTypes.string,
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* The custom select input description
|
|
146
|
+
*/
|
|
147
|
+
description:PropTypes.string,
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Whether the input should be disabled
|
|
151
|
+
*/
|
|
152
|
+
disabled:PropTypes.bool,
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* The base color of the custom select input
|
|
156
|
+
*/
|
|
157
|
+
color:PropTypes.string,
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* The debounce time in milliseconds
|
|
161
|
+
*/
|
|
162
|
+
debounceMs:PropTypes.number,
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* The graphql query to fetch the options and the accessor to destructure the results from
|
|
166
|
+
*/
|
|
167
|
+
query:PropTypes.shape({
|
|
168
|
+
accessor:PropTypes.string,
|
|
169
|
+
graphql :PropTypes.oneOfType([
|
|
170
|
+
PropTypes.string,
|
|
171
|
+
PropTypes.object,
|
|
172
|
+
]).isRequired,
|
|
173
|
+
}),
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* The extra variables required to be used in the query.
|
|
177
|
+
*/
|
|
178
|
+
extraVariables:PropTypes.objectOf(PropTypes.string),
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* The select option keys to be used to map the data to the select options.
|
|
182
|
+
* i.e `{ value: 'id', label: 'name' }`
|
|
183
|
+
*/
|
|
184
|
+
optionsKeyMap:PropTypes.shape({
|
|
185
|
+
value :PropTypes.string.isRequired,
|
|
186
|
+
getLabel:PropTypes.func.isRequired,
|
|
187
|
+
}),
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Whether to allow multiple items selection
|
|
191
|
+
*/
|
|
192
|
+
multiple:PropTypes.bool,
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* The graphql node to be used to destructure the fetched data
|
|
196
|
+
*/
|
|
197
|
+
graphQlNode:PropTypes.string.isRequired,
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* The variable to be used to search the data
|
|
201
|
+
*/
|
|
202
|
+
searchVariable:PropTypes.string,
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* The minimum length of the search input to start fetching the options
|
|
206
|
+
*/
|
|
207
|
+
minLength:PropTypes.number,
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* The function to transform the search input
|
|
211
|
+
*/
|
|
212
|
+
transformSearch:PropTypes.func,
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
QueryCombobox.defaultProps = {
|
|
216
|
+
optionsKeyMap:{
|
|
217
|
+
value :'id',
|
|
218
|
+
getLabel:(node) => node.name,
|
|
219
|
+
},
|
|
220
|
+
multiple :false,
|
|
221
|
+
color :'background2',
|
|
222
|
+
searchVariable :'search',
|
|
223
|
+
transformSearch:(search) => search,
|
|
224
|
+
minLength :2,
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export default QueryCombobox
|