@pareto-engineering/design-system 4.0.0-alpha.17 → 4.0.0-alpha.20

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.
Files changed (46) hide show
  1. package/dist/cjs/a/AnimatedGradient/AnimatedGradient.js +5 -1
  2. package/dist/cjs/a/AppContext/useTheme.js +0 -4
  3. package/dist/cjs/a/Conversation/Conversation.js +1 -1
  4. package/dist/cjs/a/Conversation/common/Message/Message.js +2 -3
  5. package/dist/cjs/a/Conversation/styles.scss +44 -28
  6. package/dist/cjs/a/SnapScroller/styles.scss +9 -4
  7. package/dist/cjs/b/Button/Button.js +10 -2
  8. package/dist/cjs/b/Button/styles.scss +27 -4
  9. package/dist/cjs/b/Page/Page.js +5 -1
  10. package/dist/cjs/b/Page/common/Section/Section.js +2 -2
  11. package/dist/cjs/b/ThemeSelector/ThemeSelector.js +15 -29
  12. package/dist/cjs/b/ThemeSelector/styles.scss +2 -7
  13. package/dist/cjs/f/fields/TextInput/TextInput.js +12 -3
  14. package/dist/cjs/f/fields/TextInput/styles.scss +20 -0
  15. package/dist/es/a/AnimatedGradient/AnimatedGradient.js +5 -1
  16. package/dist/es/a/AppContext/useTheme.js +0 -4
  17. package/dist/es/a/Conversation/Conversation.js +1 -1
  18. package/dist/es/a/Conversation/common/Message/Message.js +2 -3
  19. package/dist/es/a/Conversation/styles.scss +44 -28
  20. package/dist/es/a/SnapScroller/styles.scss +9 -4
  21. package/dist/es/b/Button/Button.js +10 -2
  22. package/dist/es/b/Button/styles.scss +27 -4
  23. package/dist/es/b/Page/Page.js +5 -1
  24. package/dist/es/b/Page/common/Section/Section.js +2 -2
  25. package/dist/es/b/ThemeSelector/ThemeSelector.js +15 -30
  26. package/dist/es/b/ThemeSelector/styles.scss +2 -7
  27. package/dist/es/f/fields/TextInput/TextInput.js +12 -3
  28. package/dist/es/f/fields/TextInput/styles.scss +20 -0
  29. package/package.json +4 -4
  30. package/src/stories/a/Conversation.stories.jsx +5 -1
  31. package/src/stories/f/TextInput.stories.jsx +7 -0
  32. package/src/ui/a/AnimatedGradient/AnimatedGradient.jsx +5 -1
  33. package/src/ui/a/AppContext/useTheme.js +0 -4
  34. package/src/ui/a/Conversation/Conversation.jsx +3 -1
  35. package/src/ui/a/Conversation/common/Message/Message.jsx +3 -5
  36. package/src/ui/a/Conversation/styles.scss +44 -28
  37. package/src/ui/a/SnapScroller/styles.scss +9 -4
  38. package/src/ui/b/Button/Button.jsx +11 -1
  39. package/src/ui/b/Button/styles.scss +27 -4
  40. package/src/ui/b/Page/Page.jsx +4 -0
  41. package/src/ui/b/Page/common/Section/Section.jsx +2 -2
  42. package/src/ui/b/ThemeSelector/ThemeSelector.jsx +8 -28
  43. package/src/ui/b/ThemeSelector/styles.scss +2 -7
  44. package/src/ui/f/fields/TextInput/TextInput.jsx +12 -1
  45. package/src/ui/f/fields/TextInput/styles.scss +20 -0
  46. package/tests/__snapshots__/Storyshots.test.js.snap +1701 -961
@@ -1,4 +1,5 @@
1
1
  /* @pareto-engineering/generator-front 1.0.12 */
2
+ /* stylelint-disable selector-max-compound-selectors -- Required here */
2
3
 
3
4
  @use "@pareto-engineering/bem";
4
5
  @use "@pareto-engineering/styles/src/mixins";
@@ -12,39 +13,54 @@ $default-message-border: 1px solid var(--hard-background-cards);
12
13
 
13
14
  .#{bem.$base}.conversation {
14
15
  background: var(--y);
15
- display: flex;
16
- flex-direction: column;
17
- padding: $default-padding;
18
-
19
- > .#{bem.$base}.message {
20
- align-self: flex-start;
21
- max-width: $default-message-max-width;
22
- min-width: $default-message-min-width;
23
- position: relative;
24
-
25
- > .message-content {
26
- background-color: var(--x);
27
- border: $default-message-border;
28
- border-radius: $default-border-radius;
29
- display: flex;
30
- flex-direction: column;
31
- padding: 0 $default-padding;
32
-
33
- > p {
34
- color: var(--on-x);
16
+
17
+ > .#{bem.$base}.section {
18
+ display: flex;
19
+ flex-direction: column;
20
+
21
+ > .#{bem.$base}.message + .#{bem.$base}.message {
22
+ padding-top: $default-padding;
23
+ }
24
+
25
+ > .#{bem.$base}.message.ours + .#{bem.$base}.message.ours,
26
+ > .#{bem.$base}.message.theirs + .#{bem.$base}.message.theirs {
27
+ padding-top: calc($default-padding / 2);
28
+ }
29
+
30
+ > .#{bem.$base}.message {
31
+ align-self: flex-start;
32
+ max-width: $default-message-max-width;
33
+ min-width: $default-message-min-width;
34
+ position: relative;
35
+
36
+ > .sender {
37
+ margin: 0;
35
38
  }
36
39
 
37
- > .attachment {
38
- align-items: center;
39
- align-self: flex-end;
40
+ > .message-content {
41
+ background-color: var(--x);
42
+ border: $default-message-border;
43
+ border-radius: $default-border-radius;
40
44
  display: flex;
41
- flex-direction: row;
42
- gap: calc($default-padding / 2);
45
+ flex-direction: column;
46
+ padding: 0 $default-padding;
47
+
48
+ > p {
49
+ color: var(--on-x);
50
+ }
51
+
52
+ > .attachment {
53
+ align-items: center;
54
+ align-self: flex-end;
55
+ display: flex;
56
+ flex-direction: row;
57
+ gap: calc($default-padding / 2);
58
+ }
43
59
  }
44
- }
45
60
 
46
- &.#{bem.$base}.ours {
47
- align-self: flex-end;
61
+ &.#{bem.$base}.ours {
62
+ align-self: flex-end;
63
+ }
48
64
  }
49
65
  }
50
66
  }
@@ -5,7 +5,7 @@
5
5
  @use "@pareto-engineering/styles/src/mixins";
6
6
  @use "@pareto-engineering/styles/src/globals" as *;
7
7
 
8
- $default-spacing: var(--gap, 1em);
8
+ $default-spacing: var(--gap);
9
9
 
10
10
  .#{bem.$base}.snap-scroller {
11
11
  display: flex;
@@ -27,10 +27,11 @@ $default-spacing: var(--gap, 1em);
27
27
  &:first-child {
28
28
  margin-left: $default-spacing;
29
29
  }
30
+ }
30
31
 
31
- &:last-child {
32
- margin-right: $default-spacing;
33
- }
32
+ &::after {
33
+ content: "";
34
+ min-width: calc($default-spacing / 2);
34
35
  }
35
36
 
36
37
  @include mixins.media($from: $sm-md) {
@@ -40,6 +41,10 @@ $default-spacing: var(--gap, 1em);
40
41
  scroll-snap-type: none;
41
42
  scrollbar-width: unset;
42
43
 
44
+ &::after {
45
+ display: none;
46
+ }
47
+
43
48
  >* {
44
49
  min-width: unset;
45
50
 
@@ -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
  }) => {
@@ -31,6 +32,9 @@ const Button = ({
31
32
  import('./styles.scss')
32
33
  }, [])
33
34
 
35
+ const buttonText = isSimple ? <span className={styleNames.modifierUnderlined}>{children}</span>
36
+ : children
37
+
34
38
  return (
35
39
  <button
36
40
  id={id}
@@ -43,6 +47,7 @@ const Button = ({
43
47
  isCompact && styleNames.modifierCompact,
44
48
  isSimple && styleNames.modifierSimple,
45
49
  isGradient && styleNames.modifierGradient,
50
+ isSpaced && styleNames.modifierSpaced,
46
51
  arrowDirection && `arrow-${arrowDirection}`,
47
52
  ]
48
53
  .filter((e) => e)
@@ -58,7 +63,7 @@ const Button = ({
58
63
  }}
59
64
  heightWidth="1.15em"
60
65
  />
61
- ) : children}
66
+ ) : buttonText}
62
67
  </button>
63
68
  )
64
69
  }
@@ -104,6 +109,11 @@ Button.propTypes = {
104
109
  */
105
110
  isGradient:PropTypes.bool,
106
111
 
112
+ /**
113
+ * Should this button be spaced
114
+ */
115
+ isSpaced:PropTypes.bool,
116
+
107
117
  /**
108
118
  * The button color
109
119
  */
@@ -20,7 +20,8 @@ $default-animation-time: .31s;
20
20
  font-weight: 400;
21
21
  justify-content: space-between;
22
22
  padding: $default-padding;
23
- transition: all .25s;//var(--theme-default-paragraph);
23
+ transition: all .25s;
24
+ white-space: nowrap;//var(--theme-default-paragraph);
24
25
 
25
26
  &.arrow-right {
26
27
  &::after {
@@ -57,7 +58,10 @@ $default-animation-time: .31s;
57
58
  &:not(:disabled) {
58
59
  cursor: pointer;
59
60
 
60
- &:hover {
61
+ &:hover
62
+ :not(.#{bem.$modifier-gradient})
63
+ :not(.#{bem.$modifier-ghost})
64
+ :not(.#{bem.$modifier-simple}) {
61
65
  background: var(--soft-x, var(--soft-#{$default-color}));
62
66
  }
63
67
 
@@ -67,8 +71,18 @@ $default-animation-time: .31s;
67
71
  }
68
72
 
69
73
  &.#{bem.$modifier-gradient} {
70
- background: linear-gradient(to left, var(--soft-x), var(--hard-x) 60%);
71
- transition: unset;
74
+ background-image: linear-gradient(
75
+ to right,
76
+ var(--hard-x) 30%,
77
+ var(--x) 50%,
78
+ var(--hard-x) 100%
79
+ );
80
+ background-position: left;
81
+ background-size: 200% auto;
82
+
83
+ &:not(:disabled):hover {
84
+ background-position: right center;
85
+ }
72
86
  }
73
87
 
74
88
  &.#{bem.$modifier-compact} {
@@ -104,12 +118,21 @@ $default-animation-time: .31s;
104
118
  }
105
119
  }
106
120
 
121
+ &.#{bem.$modifier-spaced} {
122
+ margin-bottom: var(--spacing-2);
123
+ margin-top: var(--spacing-2);
124
+ }
125
+
107
126
  &.#{bem.$modifier-simple} {
108
127
  background: transparent;
109
128
  border: 1px solid transparent;
110
129
  color: var(--x, var(--#{$default-color}));
111
130
  padding: 0;
112
131
 
132
+ > .#{bem.$modifier-underlined} {
133
+ text-decoration: underline;
134
+ }
135
+
113
136
  &:disabled,
114
137
  &:hover,
115
138
  &:focus {
@@ -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
- spaced,
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
- spaced && styleNames.modifierSpaced,
33
+ isSpaced && styleNames.modifierSpaced,
34
34
  padded && 'padded',
35
35
  'grid',
36
36
  ]
@@ -19,10 +19,7 @@ const ThemeSelector = ({
19
19
  id,
20
20
  className:userClassName,
21
21
  style,
22
- // children
23
-
24
22
  themes,
25
- iconMap,
26
23
  }) => {
27
24
  const {
28
25
  userTheme,
@@ -39,9 +36,11 @@ const ThemeSelector = ({
39
36
  },
40
37
  [userTheme])
41
38
 
39
+ const themeText = userTheme && userTheme.charAt(0).toUpperCase() + userTheme.slice(1)
40
+
42
41
  return (
43
- <button
44
- type="button"
42
+ // eslint-disable-next-line jsx-a11y/anchor-is-valid, jsx-a11y/no-static-element-interactions
43
+ <a
45
44
  className={[
46
45
  baseClassName,
47
46
  componentClassName,
@@ -52,14 +51,10 @@ const ThemeSelector = ({
52
51
  id={id}
53
52
  style={style}
54
53
  onClick={loopThemes}
54
+ onKeyDown={loopThemes}
55
55
  >
56
- <span className="v0 m-v icon">
57
- { iconMap[userTheme] }
58
- </span>
59
- <span>
60
- { userTheme }
61
- </span>
62
- </button>
56
+ {themeText}
57
+ </a>
63
58
  )
64
59
  }
65
60
 
@@ -79,29 +74,14 @@ ThemeSelector.propTypes = {
79
74
  */
80
75
  style:PropTypes.objectOf(PropTypes.string),
81
76
 
82
- /**
83
- * The children JSX
84
- */
85
- // children: PropTypes.node,
86
-
87
77
  /**
88
78
  * The themes and the order in which they appear
89
79
  */
90
80
  themes:PropTypes.arrayOf(PropTypes.string),
91
-
92
- /**
93
- * A map of the theme names with the icons that represent them. Uses the default font icon.
94
- */
95
- iconMap:PropTypes.objectOf(PropTypes.string),
96
-
97
81
  }
98
82
 
99
83
  ThemeSelector.defaultProps = {
100
- themes :['light', 'dark'],
101
- iconMap:{
102
- dark :'n', // sun,
103
- light:'m', // moon,
104
- },
84
+ themes:['light', 'dark'],
105
85
  }
106
86
 
107
87
  export default ThemeSelector
@@ -2,13 +2,8 @@
2
2
 
3
3
  @use "@pareto-engineering/bem";
4
4
 
5
- $default-color:var(--x, var(--contrast));
6
-
7
5
  .#{bem.$base}.theme-selector {
8
- background: transparent;
9
- border: none;
10
- color: $default-color;
11
6
  cursor: pointer;
7
+ display: block;
8
+ text-decoration: none;
12
9
  }
13
-
14
-
@@ -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 className="input-wrapper with-faded-border">
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;