@pareto-engineering/design-system 4.0.0-alpha.16 → 4.0.0-alpha.18
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/AnimatedGradient/AnimatedGradient.js +5 -1
- package/dist/cjs/a/AppContext/useTheme.js +0 -4
- package/dist/cjs/a/Conversation/Conversation.js +9 -14
- package/dist/cjs/a/Conversation/common/Message/Message.js +11 -12
- package/dist/cjs/a/Conversation/styles.scss +16 -120
- package/dist/cjs/a/SnapScroller/styles.scss +8 -0
- package/dist/cjs/b/Button/Button.js +6 -1
- package/dist/cjs/b/Button/styles.scss +7 -2
- package/dist/cjs/b/Page/Page.js +5 -1
- package/dist/cjs/b/Page/common/Section/Section.js +2 -2
- package/dist/cjs/b/ThemeSelector/ThemeSelector.js +3 -10
- package/dist/cjs/b/ThemeSelector/styles.scss +3 -2
- package/dist/cjs/f/fields/TextInput/TextInput.js +12 -3
- package/dist/cjs/f/fields/TextInput/styles.scss +20 -0
- package/dist/es/a/AnimatedGradient/AnimatedGradient.js +5 -1
- package/dist/es/a/AppContext/useTheme.js +0 -4
- package/dist/es/a/Conversation/Conversation.js +9 -14
- package/dist/es/a/Conversation/common/Message/Message.js +11 -12
- package/dist/es/a/Conversation/styles.scss +16 -120
- package/dist/es/a/SnapScroller/styles.scss +8 -0
- package/dist/es/b/Button/Button.js +6 -1
- package/dist/es/b/Button/styles.scss +7 -2
- package/dist/es/b/Page/Page.js +5 -1
- package/dist/es/b/Page/common/Section/Section.js +2 -2
- package/dist/es/b/ThemeSelector/ThemeSelector.js +3 -10
- package/dist/es/b/ThemeSelector/styles.scss +3 -2
- package/dist/es/f/fields/TextInput/TextInput.js +12 -3
- package/dist/es/f/fields/TextInput/styles.scss +20 -0
- package/package.json +3 -3
- package/src/stories/a/Conversation.stories.jsx +8 -43
- package/src/stories/b/Button/Button.stories.jsx +11 -8
- package/src/stories/colors.js +17 -5
- package/src/stories/f/TextInput.stories.jsx +7 -0
- package/src/ui/a/AnimatedGradient/AnimatedGradient.jsx +5 -1
- package/src/ui/a/AppContext/useTheme.js +0 -4
- package/src/ui/a/Conversation/Conversation.jsx +11 -17
- package/src/ui/a/Conversation/common/Message/Message.jsx +11 -8
- package/src/ui/a/Conversation/styles.scss +16 -120
- package/src/ui/a/SnapScroller/styles.scss +8 -0
- package/src/ui/b/Button/Button.jsx +7 -0
- package/src/ui/b/Button/styles.scss +7 -2
- package/src/ui/b/Page/Page.jsx +4 -0
- package/src/ui/b/Page/common/Section/Section.jsx +2 -2
- package/src/ui/b/ThemeSelector/ThemeSelector.jsx +3 -10
- package/src/ui/b/ThemeSelector/styles.scss +3 -2
- package/src/ui/f/fields/TextInput/TextInput.jsx +12 -1
- package/src/ui/f/fields/TextInput/styles.scss +20 -0
- package/tests/__snapshots__/Storyshots.test.js.snap +6073 -2491
package/src/stories/colors.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
const THEME = [
|
|
2
2
|
'main',
|
|
3
|
-
'
|
|
4
|
-
'
|
|
3
|
+
'main-80',
|
|
4
|
+
'main-50',
|
|
5
5
|
'main2',
|
|
6
|
-
'
|
|
7
|
-
'
|
|
6
|
+
'interactive',
|
|
7
|
+
'interactive-icons',
|
|
8
|
+
'shadow',
|
|
8
9
|
]
|
|
9
10
|
|
|
10
11
|
/*
|
|
@@ -26,19 +27,30 @@ const MODALS = [
|
|
|
26
27
|
'success',
|
|
27
28
|
'warning',
|
|
28
29
|
'error',
|
|
30
|
+
'blocked',
|
|
31
|
+
'backlog',
|
|
32
|
+
'in-progress',
|
|
33
|
+
'in-review',
|
|
34
|
+
'requested',
|
|
35
|
+
'completed',
|
|
29
36
|
]
|
|
30
37
|
|
|
31
38
|
const UI = [
|
|
32
39
|
'background-far',
|
|
33
40
|
'background-near',
|
|
34
41
|
'background-cards',
|
|
42
|
+
'background-cards-80',
|
|
43
|
+
'background-cards-50',
|
|
44
|
+
'background-inputs',
|
|
35
45
|
'background-mesh',
|
|
36
46
|
'heading',
|
|
37
47
|
'paragraph',
|
|
38
48
|
'subtitle',
|
|
39
49
|
'metadata',
|
|
40
50
|
'link',
|
|
41
|
-
'
|
|
51
|
+
'transparent',
|
|
52
|
+
'highlighted',
|
|
53
|
+
'disabled',
|
|
42
54
|
]
|
|
43
55
|
|
|
44
56
|
const SM = [
|
|
@@ -34,6 +34,7 @@ export default {
|
|
|
34
34
|
name :{ control: 'text' },
|
|
35
35
|
label :{ control: 'text' },
|
|
36
36
|
optional :{ control: 'boolean' },
|
|
37
|
+
symbol :{ control: 'text' },
|
|
37
38
|
},
|
|
38
39
|
}
|
|
39
40
|
|
|
@@ -104,3 +105,9 @@ Time.args = {
|
|
|
104
105
|
name :'time',
|
|
105
106
|
label:'Select time',
|
|
106
107
|
}
|
|
108
|
+
|
|
109
|
+
export const HasSymbol = Template.bind({})
|
|
110
|
+
HasSymbol.args = {
|
|
111
|
+
...Base.args,
|
|
112
|
+
symbol:"'$'",
|
|
113
|
+
}
|
|
@@ -10,6 +10,8 @@ import PropTypes from 'prop-types'
|
|
|
10
10
|
|
|
11
11
|
import styleNames from '@pareto-engineering/bem/exports'
|
|
12
12
|
|
|
13
|
+
import { useApp } from 'ui/a'
|
|
14
|
+
|
|
13
15
|
import { Gradient } from './webGIRenderer'
|
|
14
16
|
|
|
15
17
|
// Local Definitions
|
|
@@ -29,6 +31,8 @@ const AnimatedGradient = ({
|
|
|
29
31
|
import('./styles.scss')
|
|
30
32
|
}, [])
|
|
31
33
|
|
|
34
|
+
const { userTheme } = useApp()
|
|
35
|
+
|
|
32
36
|
const isClient = typeof window !== 'undefined'
|
|
33
37
|
|
|
34
38
|
useEffect(() => {
|
|
@@ -37,7 +41,7 @@ const AnimatedGradient = ({
|
|
|
37
41
|
const gradient = new Gradient()
|
|
38
42
|
gradient.initGradient('#gradient-canvas')
|
|
39
43
|
}
|
|
40
|
-
}, [])
|
|
44
|
+
}, [userTheme])
|
|
41
45
|
|
|
42
46
|
return (
|
|
43
47
|
<canvas
|
|
@@ -14,9 +14,7 @@ export default (
|
|
|
14
14
|
const storage = window.localStorage
|
|
15
15
|
if (isClient) {
|
|
16
16
|
const storedTheme = window.localStorage.getItem(storageKey)
|
|
17
|
-
// console.log(storedTheme, storedTheme != userTheme)
|
|
18
17
|
if (storedTheme && (storedTheme !== userTheme)) {
|
|
19
|
-
// console.warn('Theme load')
|
|
20
18
|
setPreferredTheme(storedTheme)
|
|
21
19
|
setUserTheme(storedTheme)
|
|
22
20
|
} else if (preferredTheme && preferredTheme.length && preferredTheme !== 'system') {
|
|
@@ -25,11 +23,9 @@ export default (
|
|
|
25
23
|
storageKey,
|
|
26
24
|
preferredTheme,
|
|
27
25
|
)
|
|
28
|
-
// console.warn('theme change', preferredTheme)
|
|
29
26
|
} else {
|
|
30
27
|
setUserTheme(window.matchMedia('(prefers-color-scheme:dark)').matches ? 'dark' : 'light')
|
|
31
28
|
storage.removeItem(storageKey)
|
|
32
|
-
// console.warn('theme reset')
|
|
33
29
|
}
|
|
34
30
|
} else {
|
|
35
31
|
setUserTheme('light')
|
|
@@ -7,6 +7,8 @@ import PropTypes from 'prop-types'
|
|
|
7
7
|
|
|
8
8
|
import styleNames from '@pareto-engineering/bem/exports'
|
|
9
9
|
|
|
10
|
+
import { Card } from 'ui'
|
|
11
|
+
|
|
10
12
|
// Local Definitions
|
|
11
13
|
|
|
12
14
|
import { Message } from './common'
|
|
@@ -24,11 +26,10 @@ const Conversation = ({
|
|
|
24
26
|
id,
|
|
25
27
|
className:userClassName,
|
|
26
28
|
style,
|
|
27
|
-
backgroundColor,
|
|
28
29
|
ourColor,
|
|
29
30
|
theirColor,
|
|
30
31
|
children,
|
|
31
|
-
|
|
32
|
+
backgroundColor,
|
|
32
33
|
// ...otherProps
|
|
33
34
|
}) => {
|
|
34
35
|
useInsertionEffect(() => {
|
|
@@ -42,22 +43,20 @@ const Conversation = ({
|
|
|
42
43
|
theirColor,
|
|
43
44
|
}}
|
|
44
45
|
>
|
|
45
|
-
<
|
|
46
|
+
<Card
|
|
46
47
|
id={id}
|
|
47
48
|
className={[
|
|
48
49
|
baseClassName,
|
|
49
50
|
componentClassName,
|
|
50
51
|
userClassName,
|
|
51
|
-
hasTriangle && 'has-triangle',
|
|
52
52
|
`y-${backgroundColor}`,
|
|
53
|
-
'u1',
|
|
54
53
|
]
|
|
55
54
|
.filter((e) => e)
|
|
56
55
|
.join(' ')}
|
|
57
56
|
style={style}
|
|
58
57
|
>
|
|
59
58
|
{children}
|
|
60
|
-
</
|
|
59
|
+
</Card>
|
|
61
60
|
</ConversationContext.Provider>
|
|
62
61
|
)
|
|
63
62
|
}
|
|
@@ -88,26 +87,21 @@ Conversation.propTypes = {
|
|
|
88
87
|
*/
|
|
89
88
|
theirColor:PropTypes.string,
|
|
90
89
|
|
|
91
|
-
/**
|
|
92
|
-
* The component background color
|
|
93
|
-
*/
|
|
94
|
-
backgroundColor:PropTypes.string,
|
|
95
90
|
/**
|
|
96
91
|
* The children JSX
|
|
97
92
|
*/
|
|
98
|
-
children
|
|
93
|
+
children:PropTypes.node,
|
|
99
94
|
|
|
100
95
|
/**
|
|
101
|
-
*
|
|
96
|
+
* The background color
|
|
102
97
|
*/
|
|
103
|
-
|
|
98
|
+
backgroundColor:PropTypes.string,
|
|
104
99
|
}
|
|
105
100
|
|
|
106
101
|
Conversation.defaultProps = {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
hasTriangle :false,
|
|
102
|
+
ourColor :'main',
|
|
103
|
+
theirColor :'main2',
|
|
104
|
+
backgroundColor:'background-near',
|
|
111
105
|
}
|
|
112
106
|
|
|
113
107
|
Conversation.Message = Message
|
|
@@ -5,6 +5,8 @@ import PropTypes from 'prop-types'
|
|
|
5
5
|
|
|
6
6
|
import styleNames from '@pareto-engineering/bem/exports'
|
|
7
7
|
|
|
8
|
+
import { Card } from 'ui'
|
|
9
|
+
|
|
8
10
|
// Local Definitions
|
|
9
11
|
|
|
10
12
|
import useConversation from '../../useConversation'
|
|
@@ -31,7 +33,7 @@ const Message = ({
|
|
|
31
33
|
const { ourColor, theirColor } = useConversation()
|
|
32
34
|
|
|
33
35
|
return (
|
|
34
|
-
<
|
|
36
|
+
<Card.Section
|
|
35
37
|
id={id}
|
|
36
38
|
className={[
|
|
37
39
|
baseClassName,
|
|
@@ -39,31 +41,32 @@ const Message = ({
|
|
|
39
41
|
userClassName,
|
|
40
42
|
`x-${from === 'ours' ? ourColor : theirColor}`,
|
|
41
43
|
from === 'ours' && 'ours',
|
|
42
|
-
'v1',
|
|
43
44
|
]
|
|
44
45
|
.filter((e) => e)
|
|
45
46
|
.join(' ')}
|
|
46
47
|
style={style}
|
|
47
48
|
>
|
|
48
|
-
|
|
49
|
-
<p className="sender
|
|
49
|
+
{sender && (
|
|
50
|
+
<p className="sender">
|
|
50
51
|
{sender}
|
|
51
52
|
:
|
|
52
53
|
</p>
|
|
54
|
+
)}
|
|
55
|
+
<div className="message-content">
|
|
53
56
|
<p>
|
|
54
57
|
{message}
|
|
55
58
|
</p>
|
|
56
59
|
{attachment
|
|
57
60
|
&& (
|
|
58
61
|
<div className={`attachment y-${attachmentColor}`}>
|
|
59
|
-
<span className="
|
|
60
|
-
<p
|
|
62
|
+
<span className="icon">{attachmentIcon}</span>
|
|
63
|
+
<p>
|
|
61
64
|
{attachment}
|
|
62
65
|
</p>
|
|
63
66
|
</div>
|
|
64
67
|
)}
|
|
65
68
|
</div>
|
|
66
|
-
</
|
|
69
|
+
</Card.Section>
|
|
67
70
|
)
|
|
68
71
|
}
|
|
69
72
|
Message.propTypes = {
|
|
@@ -116,7 +119,7 @@ Message.propTypes = {
|
|
|
116
119
|
Message.defaultProps = {
|
|
117
120
|
from :'theirs',
|
|
118
121
|
attachmentIcon :'A',
|
|
119
|
-
attachmentColor:'
|
|
122
|
+
attachmentColor:'interactive',
|
|
120
123
|
}
|
|
121
124
|
|
|
122
125
|
export default Message
|
|
@@ -1,154 +1,50 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
-
/* stylelint-disable selector-max-compound-selectors -- exception */
|
|
3
2
|
|
|
4
3
|
@use "@pareto-engineering/bem";
|
|
5
4
|
@use "@pareto-engineering/styles/src/mixins";
|
|
6
5
|
@use "@pareto-engineering/styles/src/globals" as *;
|
|
7
6
|
|
|
8
|
-
$default-
|
|
9
|
-
$default-
|
|
7
|
+
$default-border-radius: var(--theme-default-border-radius);
|
|
8
|
+
$default-padding: var(--gap);
|
|
10
9
|
$default-message-max-width: calc(100% - 4 * #{$default-padding});
|
|
11
10
|
$default-message-min-width: 12em;
|
|
12
|
-
$default-message-border: var(--
|
|
13
|
-
$triangle-border-size: 15px;
|
|
14
|
-
$triangle-border-style: $triangle-border-size solid;
|
|
15
|
-
$triangle-border-style-subtracted: ($triangle-border-size - 1px) solid;
|
|
16
|
-
$triangle-border1: $triangle-border-style var(--paragraph);
|
|
17
|
-
$triangle-border2: $triangle-border-style transparent;
|
|
18
|
-
$triangle-border3: $triangle-border-style-subtracted var(--x);
|
|
19
|
-
$triangle-border4: $triangle-border-style-subtracted transparent;
|
|
20
|
-
$triangle-before-side:24px;
|
|
21
|
-
$triangle-before-bottom:-30px;
|
|
22
|
-
$triangle-after-bottom:-27px;
|
|
23
|
-
$triangle-after-side:25px;
|
|
11
|
+
$default-message-border: 1px solid var(--hard-background-cards);
|
|
24
12
|
|
|
25
13
|
.#{bem.$base}.conversation {
|
|
26
|
-
background
|
|
27
|
-
border-radius: var(--theme-border-radius);
|
|
14
|
+
background: var(--y);
|
|
28
15
|
display: flex;
|
|
29
16
|
flex-direction: column;
|
|
30
17
|
padding: $default-padding;
|
|
31
18
|
|
|
32
|
-
|
|
33
|
-
margin-bottom: $default-padding;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// >:nth-child(1) {
|
|
37
|
-
// animation-delay: 1s;
|
|
38
|
-
// }
|
|
39
|
-
// >:nth-child(2) {
|
|
40
|
-
// animation-delay: 3s;
|
|
41
|
-
// }
|
|
42
|
-
|
|
43
|
-
&.has-triangle {
|
|
44
|
-
padding-bottom: calc(#{$default-padding} * 2);
|
|
45
|
-
.#{bem.$base}.message {
|
|
46
|
-
::before {
|
|
47
|
-
border-bottom: $triangle-border2;
|
|
48
|
-
border-left: $triangle-border2;
|
|
49
|
-
border-right: $triangle-border1;
|
|
50
|
-
border-top: $triangle-border1;
|
|
51
|
-
bottom: $triangle-before-bottom;
|
|
52
|
-
content: "";
|
|
53
|
-
height: 0;
|
|
54
|
-
position: absolute;
|
|
55
|
-
right: $triangle-before-side;
|
|
56
|
-
width: 0;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
::after {
|
|
60
|
-
border-bottom: $triangle-border4;
|
|
61
|
-
border-left: $triangle-border4;
|
|
62
|
-
border-right: $triangle-border3;
|
|
63
|
-
border-top: $triangle-border3;
|
|
64
|
-
bottom: $triangle-after-bottom;
|
|
65
|
-
content: "";
|
|
66
|
-
height: 0;
|
|
67
|
-
position: absolute;
|
|
68
|
-
right: $triangle-after-side;
|
|
69
|
-
width: 0;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
&:not(.ours) {
|
|
73
|
-
::before {
|
|
74
|
-
border-bottom: $triangle-border2;
|
|
75
|
-
border-left: $triangle-border1;
|
|
76
|
-
border-right: $triangle-border2;
|
|
77
|
-
border-top: $triangle-border1;
|
|
78
|
-
bottom: $triangle-before-bottom;
|
|
79
|
-
content: "";
|
|
80
|
-
height: 0;
|
|
81
|
-
left: $triangle-before-side;
|
|
82
|
-
position: absolute;
|
|
83
|
-
width: 0;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
::after {
|
|
87
|
-
border-bottom: $triangle-border4;
|
|
88
|
-
border-left: $triangle-border3;
|
|
89
|
-
border-right: $triangle-border4;
|
|
90
|
-
border-top: $triangle-border3;
|
|
91
|
-
bottom: $triangle-after-bottom;
|
|
92
|
-
content: "";
|
|
93
|
-
height: 0;
|
|
94
|
-
left: $triangle-after-side;
|
|
95
|
-
position: absolute;
|
|
96
|
-
width: 0;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.#{bem.$base}.message {
|
|
19
|
+
> .#{bem.$base}.message {
|
|
103
20
|
align-self: flex-start;
|
|
104
|
-
background-color: var(--x);
|
|
105
|
-
// animation: fadeIn 1s ease-in both;
|
|
106
|
-
border: $default-message-border;
|
|
107
|
-
border-radius: var(--theme-border-radius);
|
|
108
21
|
max-width: $default-message-max-width;
|
|
109
22
|
min-width: $default-message-min-width;
|
|
110
|
-
padding: $default-padding;
|
|
111
23
|
position: relative;
|
|
112
24
|
|
|
113
|
-
|
|
25
|
+
> .message-content {
|
|
26
|
+
background-color: var(--x);
|
|
27
|
+
border: $default-message-border;
|
|
28
|
+
border-radius: $default-border-radius;
|
|
114
29
|
display: flex;
|
|
115
30
|
flex-direction: column;
|
|
31
|
+
padding: 0 $default-padding;
|
|
116
32
|
|
|
117
|
-
>p {
|
|
33
|
+
> p {
|
|
118
34
|
color: var(--on-x);
|
|
119
35
|
}
|
|
120
36
|
|
|
121
|
-
.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.attachment {
|
|
127
|
-
align-self: baseline;
|
|
128
|
-
background-color: var(--y);
|
|
37
|
+
> .attachment {
|
|
38
|
+
align-items: center;
|
|
39
|
+
align-self: flex-end;
|
|
129
40
|
display: flex;
|
|
130
41
|
flex-direction: row;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
> p {
|
|
134
|
-
margin-bottom: 0;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
> img {
|
|
138
|
-
width: 40px;
|
|
139
|
-
}
|
|
42
|
+
gap: calc($default-padding / 2);
|
|
140
43
|
}
|
|
141
44
|
}
|
|
45
|
+
|
|
142
46
|
&.#{bem.$base}.ours {
|
|
143
47
|
align-self: flex-end;
|
|
144
48
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
// mobile style
|
|
148
|
-
@include mixins.media($to:$sm-md) {
|
|
149
|
-
.message {
|
|
150
|
-
margin-top: 2em;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
49
|
}
|
|
154
50
|
}
|
|
@@ -27,6 +27,10 @@ $default-spacing: var(--gap, 1em);
|
|
|
27
27
|
&:first-child {
|
|
28
28
|
margin-left: $default-spacing;
|
|
29
29
|
}
|
|
30
|
+
|
|
31
|
+
&:last-child {
|
|
32
|
+
margin-right: $default-spacing;
|
|
33
|
+
}
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
@include mixins.media($from: $sm-md) {
|
|
@@ -42,6 +46,10 @@ $default-spacing: var(--gap, 1em);
|
|
|
42
46
|
&:first-child {
|
|
43
47
|
margin-left: unset;
|
|
44
48
|
}
|
|
49
|
+
|
|
50
|
+
&:last-child {
|
|
51
|
+
margin-right: unset;
|
|
52
|
+
}
|
|
45
53
|
}
|
|
46
54
|
}
|
|
47
55
|
}
|
|
@@ -24,6 +24,7 @@ const Button = ({
|
|
|
24
24
|
isGhost,
|
|
25
25
|
isSimple,
|
|
26
26
|
isGradient,
|
|
27
|
+
isSpaced,
|
|
27
28
|
arrowDirection,
|
|
28
29
|
...otherProps
|
|
29
30
|
}) => {
|
|
@@ -43,6 +44,7 @@ const Button = ({
|
|
|
43
44
|
isCompact && styleNames.modifierCompact,
|
|
44
45
|
isSimple && styleNames.modifierSimple,
|
|
45
46
|
isGradient && styleNames.modifierGradient,
|
|
47
|
+
isSpaced && styleNames.modifierSpaced,
|
|
46
48
|
arrowDirection && `arrow-${arrowDirection}`,
|
|
47
49
|
]
|
|
48
50
|
.filter((e) => e)
|
|
@@ -104,6 +106,11 @@ Button.propTypes = {
|
|
|
104
106
|
*/
|
|
105
107
|
isGradient:PropTypes.bool,
|
|
106
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Should this button be spaced
|
|
111
|
+
*/
|
|
112
|
+
isSpaced:PropTypes.bool,
|
|
113
|
+
|
|
107
114
|
/**
|
|
108
115
|
* The button color
|
|
109
116
|
*/
|
|
@@ -30,7 +30,7 @@ $default-animation-time: .31s;
|
|
|
30
30
|
vertical-align: middle;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
&:hover {
|
|
33
|
+
&:hover:not(:disabled) {
|
|
34
34
|
&::after {
|
|
35
35
|
--final-position: 50%;
|
|
36
36
|
animation: animateArrow $default-animation-time forwards;
|
|
@@ -46,7 +46,7 @@ $default-animation-time: .31s;
|
|
|
46
46
|
vertical-align: middle;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
&:hover {
|
|
49
|
+
&:hover:not(:disabled) {
|
|
50
50
|
&::before {
|
|
51
51
|
--final-position: -50%;
|
|
52
52
|
animation: animateArrow $default-animation-time forwards;
|
|
@@ -104,6 +104,11 @@ $default-animation-time: .31s;
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
&.#{bem.$modifier-spaced} {
|
|
108
|
+
margin-bottom: var(--spacing-2);
|
|
109
|
+
margin-top: var(--spacing-2);
|
|
110
|
+
}
|
|
111
|
+
|
|
107
112
|
&.#{bem.$modifier-simple} {
|
|
108
113
|
background: transparent;
|
|
109
114
|
border: 1px solid transparent;
|
package/src/ui/b/Page/Page.jsx
CHANGED
|
@@ -3,6 +3,7 @@ import * as React from 'react'
|
|
|
3
3
|
import { useInsertionEffect, useEffect } from 'react'
|
|
4
4
|
import PropTypes from 'prop-types'
|
|
5
5
|
import styleNames from '@pareto-engineering/bem/exports'
|
|
6
|
+
import { useApp } from 'ui/a'
|
|
6
7
|
|
|
7
8
|
// Imports from the component folder
|
|
8
9
|
import { PageHelmet, Section } from './common'
|
|
@@ -33,6 +34,8 @@ const Page = ({
|
|
|
33
34
|
import('./styles.scss')
|
|
34
35
|
}, [])
|
|
35
36
|
|
|
37
|
+
const { userTheme } = useApp()
|
|
38
|
+
|
|
36
39
|
useEffect(() => {
|
|
37
40
|
// If we're on the client, we make sure to scroll up when the page loads
|
|
38
41
|
// This is a necessary transform to make react apt for website pages
|
|
@@ -54,6 +57,7 @@ const Page = ({
|
|
|
54
57
|
baseClassName,
|
|
55
58
|
componentClassName,
|
|
56
59
|
userClassName,
|
|
60
|
+
userTheme && `ui-${userTheme}`,
|
|
57
61
|
]
|
|
58
62
|
.filter((e) => e)
|
|
59
63
|
.join(' ')}
|
|
@@ -14,7 +14,7 @@ const Section = ({
|
|
|
14
14
|
className:userClassName,
|
|
15
15
|
style,
|
|
16
16
|
children,
|
|
17
|
-
|
|
17
|
+
isSpaced,
|
|
18
18
|
padded,
|
|
19
19
|
...otherProps
|
|
20
20
|
}) => {
|
|
@@ -30,7 +30,7 @@ const Section = ({
|
|
|
30
30
|
baseClassName,
|
|
31
31
|
componentClassName,
|
|
32
32
|
userClassName,
|
|
33
|
-
|
|
33
|
+
isSpaced && styleNames.modifierSpaced,
|
|
34
34
|
padded && 'padded',
|
|
35
35
|
'grid',
|
|
36
36
|
]
|
|
@@ -19,8 +19,6 @@ const ThemeSelector = ({
|
|
|
19
19
|
id,
|
|
20
20
|
className:userClassName,
|
|
21
21
|
style,
|
|
22
|
-
// children
|
|
23
|
-
|
|
24
22
|
themes,
|
|
25
23
|
iconMap,
|
|
26
24
|
}) => {
|
|
@@ -53,7 +51,7 @@ const ThemeSelector = ({
|
|
|
53
51
|
style={style}
|
|
54
52
|
onClick={loopThemes}
|
|
55
53
|
>
|
|
56
|
-
<span className="
|
|
54
|
+
<span className="icon">
|
|
57
55
|
{ iconMap[userTheme] }
|
|
58
56
|
</span>
|
|
59
57
|
<span>
|
|
@@ -79,11 +77,6 @@ ThemeSelector.propTypes = {
|
|
|
79
77
|
*/
|
|
80
78
|
style:PropTypes.objectOf(PropTypes.string),
|
|
81
79
|
|
|
82
|
-
/**
|
|
83
|
-
* The children JSX
|
|
84
|
-
*/
|
|
85
|
-
// children: PropTypes.node,
|
|
86
|
-
|
|
87
80
|
/**
|
|
88
81
|
* The themes and the order in which they appear
|
|
89
82
|
*/
|
|
@@ -99,8 +92,8 @@ ThemeSelector.propTypes = {
|
|
|
99
92
|
ThemeSelector.defaultProps = {
|
|
100
93
|
themes :['light', 'dark'],
|
|
101
94
|
iconMap:{
|
|
102
|
-
dark :'
|
|
103
|
-
light:'
|
|
95
|
+
dark :'d', // sun,
|
|
96
|
+
light:'T', // moon,
|
|
104
97
|
},
|
|
105
98
|
}
|
|
106
99
|
|
|
@@ -36,6 +36,7 @@ const TextInput = ({
|
|
|
36
36
|
placeholder,
|
|
37
37
|
optional,
|
|
38
38
|
autoComplete,
|
|
39
|
+
symbol,
|
|
39
40
|
// ...otherProps
|
|
40
41
|
}) => {
|
|
41
42
|
useInsertionEffect(() => {
|
|
@@ -43,6 +44,9 @@ const TextInput = ({
|
|
|
43
44
|
}, [])
|
|
44
45
|
|
|
45
46
|
const [field] = useField({ name, validate })
|
|
47
|
+
const symbolStyle = symbol
|
|
48
|
+
? { '--symbol': symbol }
|
|
49
|
+
: {}
|
|
46
50
|
|
|
47
51
|
return (
|
|
48
52
|
<div
|
|
@@ -68,7 +72,10 @@ const TextInput = ({
|
|
|
68
72
|
>
|
|
69
73
|
{ label }
|
|
70
74
|
</FormLabel>
|
|
71
|
-
<div
|
|
75
|
+
<div
|
|
76
|
+
className={`input-wrapper with-faded-border ${symbol ? 'has-symbol' : ''}`}
|
|
77
|
+
style={symbolStyle}
|
|
78
|
+
>
|
|
72
79
|
<input
|
|
73
80
|
id={name}
|
|
74
81
|
className="input"
|
|
@@ -171,6 +178,10 @@ TextInput.propTypes = {
|
|
|
171
178
|
* `https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete`
|
|
172
179
|
*/
|
|
173
180
|
autoComplete:PropTypes.string,
|
|
181
|
+
/**
|
|
182
|
+
* A symbol to be set inside the input field
|
|
183
|
+
*/
|
|
184
|
+
symbol :PropTypes.string,
|
|
174
185
|
}
|
|
175
186
|
|
|
176
187
|
TextInput.defaultProps = {
|
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
@use "../../../form.scss";
|
|
5
5
|
|
|
6
6
|
$default-padding: .75em .75em .55em;
|
|
7
|
+
$default-symbol-left: 3em;
|
|
8
|
+
$default-padding-with-symbol:
|
|
9
|
+
.75em
|
|
10
|
+
calc($default-symbol-left - 1em)
|
|
11
|
+
.55em
|
|
12
|
+
calc($default-symbol-left + 1em);
|
|
7
13
|
$default-input-border-radius: var(--theme-default-input-border-radius);
|
|
8
14
|
|
|
9
15
|
|
|
@@ -18,6 +24,20 @@ $default-input-border-radius: var(--theme-default-input-border-radius);
|
|
|
18
24
|
border-radius: $default-input-border-radius;
|
|
19
25
|
}
|
|
20
26
|
|
|
27
|
+
&.has-symbol {
|
|
28
|
+
&::before {
|
|
29
|
+
color: var(--interactive);
|
|
30
|
+
content: var(--symbol);
|
|
31
|
+
left: $default-symbol-left;
|
|
32
|
+
position: absolute;
|
|
33
|
+
top: .5em;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
input {
|
|
37
|
+
padding: $default-padding-with-symbol;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
21
41
|
> input {
|
|
22
42
|
background-color: var(--background-inputs);
|
|
23
43
|
border-radius: $default-input-border-radius;
|