@pareto-engineering/design-system 2.0.0-alpha.13 → 2.0.0-alpha.17

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 (54) hide show
  1. package/dist/cjs/a/BackgroundGradient/styles.scss +2 -2
  2. package/dist/cjs/a/Conversation/Conversation.js +15 -8
  3. package/dist/cjs/a/Conversation/common/Message/Message.js +33 -6
  4. package/dist/cjs/a/Conversation/styles.scss +139 -32
  5. package/dist/cjs/b/Button/styles.scss +43 -18
  6. package/dist/cjs/c/ContentSlides/common/Navigator/Navigator.js +4 -3
  7. package/dist/cjs/f/common/Debugger/Debugger.js +1 -1
  8. package/dist/cjs/f/common/Label/Label.js +1 -1
  9. package/dist/cjs/f/fields/ChoicesInput/ChoicesInput.js +1 -1
  10. package/dist/cjs/f/fields/SelectInput/SelectInput.js +25 -6
  11. package/dist/cjs/f/fields/SelectInput/styles.scss +4 -4
  12. package/dist/cjs/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +1 -1
  13. package/dist/cjs/f/fields/TextInput/TextInput.js +18 -4
  14. package/dist/cjs/f/fields/TextInput/styles.scss +4 -4
  15. package/dist/cjs/f/fields/TextareaInput/TextareaInput.js +1 -1
  16. package/dist/es/a/BackgroundGradient/styles.scss +2 -2
  17. package/dist/es/a/Conversation/Conversation.js +15 -8
  18. package/dist/es/a/Conversation/common/Message/Message.js +33 -6
  19. package/dist/es/a/Conversation/styles.scss +139 -32
  20. package/dist/es/b/Button/styles.scss +43 -18
  21. package/dist/es/c/ContentSlides/common/Navigator/Navigator.js +4 -3
  22. package/dist/es/f/common/Debugger/Debugger.js +1 -1
  23. package/dist/es/f/common/Label/Label.js +1 -1
  24. package/dist/es/f/fields/ChoicesInput/ChoicesInput.js +1 -1
  25. package/dist/es/f/fields/SelectInput/SelectInput.js +25 -6
  26. package/dist/es/f/fields/SelectInput/styles.scss +4 -4
  27. package/dist/es/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +1 -1
  28. package/dist/es/f/fields/TextInput/TextInput.js +18 -4
  29. package/dist/es/f/fields/TextInput/styles.scss +4 -4
  30. package/dist/es/f/fields/TextareaInput/TextareaInput.js +1 -1
  31. package/package.json +2 -2
  32. package/src/__snapshots__/Storyshots.test.js.snap +401 -91
  33. package/src/local.scss +1 -0
  34. package/src/stories/a/BackgroundGradient.stories.jsx +2 -3
  35. package/src/stories/a/Conversation.stories.jsx +78 -1
  36. package/src/stories/b/Button.stories.jsx +5 -4
  37. package/src/stories/f/SelectInput.stories.jsx +29 -0
  38. package/src/stories/f/TextInput.stories.jsx +10 -0
  39. package/src/ui/a/BackgroundGradient/styles.scss +2 -2
  40. package/src/ui/a/Conversation/Conversation.jsx +15 -7
  41. package/src/ui/a/Conversation/common/Message/Message.jsx +40 -7
  42. package/src/ui/a/Conversation/styles.scss +139 -32
  43. package/src/ui/b/Button/Button.jsx +2 -1
  44. package/src/ui/b/Button/styles.scss +43 -18
  45. package/src/ui/c/ContentSlides/common/Navigator/Navigator.jsx +3 -2
  46. package/src/ui/f/common/Debugger/Debugger.jsx +1 -1
  47. package/src/ui/f/common/Label/Label.jsx +1 -1
  48. package/src/ui/f/fields/ChoicesInput/ChoicesInput.jsx +1 -1
  49. package/src/ui/f/fields/SelectInput/SelectInput.jsx +35 -5
  50. package/src/ui/f/fields/SelectInput/styles.scss +4 -4
  51. package/src/ui/f/fields/TaskRecommendationInput/TaskRecommendationInput.jsx +1 -1
  52. package/src/ui/f/fields/TextInput/TextInput.jsx +14 -0
  53. package/src/ui/f/fields/TextInput/styles.scss +4 -4
  54. package/src/ui/f/fields/TextareaInput/TextareaInput.jsx +1 -1
@@ -77,6 +77,7 @@ const Navigator = ({
77
77
  setNextStepIndex(stepsForward)
78
78
  }
79
79
  }}
80
+ isCompact
80
81
  >
81
82
  Next
82
83
  </Button>
@@ -140,8 +141,8 @@ Navigator.propTypes = {
140
141
 
141
142
  Navigator.defaultProps = {
142
143
  canMoveForward:true,
143
- previousColor :'main1',
144
- nextColor :'main1',
144
+ previousColor :'main2',
145
+ nextColor :'main2',
145
146
  stepsForward :1,
146
147
  stepsBackwards:1,
147
148
  }
@@ -41,7 +41,7 @@ const Debugger = ({
41
41
  .join(' ')}
42
42
  style={style}
43
43
  >
44
- <Button onClick={toggleDebugger} color="main1">
44
+ <Button onClick={toggleDebugger} color="main2">
45
45
  { isOpen
46
46
  ? 'Close FormDebugger'
47
47
  : 'Open FormDebugger'}
@@ -90,7 +90,7 @@ Label.propTypes = {
90
90
  Label.defaultProps = {
91
91
  // someProp:false
92
92
  as :'label',
93
- color:'main1',
93
+ color:'main2',
94
94
  }
95
95
 
96
96
  export default Label
@@ -148,7 +148,7 @@ ChoicesInput.defaultProps = {
148
148
  gridColumnsMobile :2,
149
149
  gridColumnsDesktop:3,
150
150
  color :'background2',
151
- colorChecked :'main1',
151
+ colorChecked :'main2',
152
152
  disabled :false,
153
153
  }
154
154
 
@@ -27,6 +27,8 @@ const SelectInput = ({
27
27
  name,
28
28
  label,
29
29
  options,
30
+ validate,
31
+ description,
30
32
  disabled,
31
33
  // ...otherProps
32
34
  }) => {
@@ -34,7 +36,7 @@ const SelectInput = ({
34
36
  import('./styles.scss')
35
37
  }, [])
36
38
 
37
- const [field, meta] = useField(name)
39
+ const [field, meta] = useField({ name, validate })
38
40
 
39
41
  return (
40
42
  <div
@@ -52,18 +54,30 @@ const SelectInput = ({
52
54
  // {...otherProps}
53
55
  >
54
56
  <FormLabel className="input-label" name={name}>{label}</FormLabel>
55
- <select className="input v25 pv-v" {...field} id={name} disabled={disabled}>
57
+ <select className="input v25 pv-v" {...field} value={field.value || ''} id={name} disabled={disabled}>
56
58
  {
57
59
  options.map((option) => {
58
60
  // i.e if option is a string like "blah", return { value: "blah", label: "blah" }
59
61
  const newOption = typeof option === 'string' ? { value: option, label: option } : option
62
+
60
63
  return (
61
- <option key={newOption.value} value={newOption.value}>{newOption.label}</option>
64
+ <option
65
+ key={newOption.value}
66
+ value={newOption.value}
67
+ disabled={newOption?.disabled || false}
68
+ >
69
+ {newOption.label}
70
+ </option>
62
71
  )
63
72
  })
64
73
  }
65
74
  </select>
66
- {meta.error && meta.touched && <FormDescription error>{meta.error}</FormDescription>}
75
+ {(description || (meta.touched && meta.error))
76
+ && (
77
+ <FormDescription isError={!!meta.error} className="v50 mt-v s-1">
78
+ { meta.error || description }
79
+ </FormDescription>
80
+ )}
67
81
  </div>
68
82
  )
69
83
  }
@@ -93,12 +107,28 @@ SelectInput.propTypes = {
93
107
  */
94
108
  label:PropTypes.string,
95
109
 
110
+ /**
111
+ * The input field validator function
112
+ */
113
+ validate:PropTypes.func,
114
+
115
+ /**
116
+ * The select input description
117
+ */
118
+ description:PropTypes.string,
119
+
96
120
  /**
97
121
  * The options of the select input
98
122
  */
99
123
  options:PropTypes.arrayOf(
100
124
  PropTypes.oneOfType(
101
- [PropTypes.string, PropTypes.shape({ value: PropTypes.string, label: PropTypes.string })],
125
+ [
126
+ PropTypes.string,
127
+ PropTypes.shape({
128
+ value :PropTypes.string,
129
+ label :PropTypes.string,
130
+ disabled:PropTypes.bool,
131
+ })],
102
132
  ),
103
133
  ),
104
134
  /**
@@ -14,16 +14,16 @@ $default-padding: 0.75em 0.75em 0.55em;
14
14
 
15
15
 
16
16
  .input-label {
17
- color: var(--main1);
17
+ color: var(--main2);
18
18
  }
19
19
 
20
20
  .input {
21
- background: var(--light-background1);
22
- color: var(--on-background1);
21
+ background: var(--light-background2);
22
+ color: var(--on-background2);
23
23
  padding: $default-padding;
24
24
 
25
25
  &:focus {
26
- background: var(--dark-background1);
26
+ background: var(--dark-background2);
27
27
  }
28
28
  }
29
29
  }
@@ -124,7 +124,7 @@ TaskRecommendationInput.propTypes = {
124
124
  }
125
125
 
126
126
  TaskRecommendationInput.defaultProps = {
127
- color:'main1',
127
+ color:'main2',
128
128
  }
129
129
 
130
130
  export default memo(TaskRecommendationInput)
@@ -27,10 +27,12 @@ const TextInput = ({
27
27
  type,
28
28
  name,
29
29
  label,
30
+ labelColor,
30
31
  validate,
31
32
  oneInputLabel,
32
33
  description,
33
34
  disabled,
35
+ placeholder,
34
36
  // ...otherProps
35
37
  }) => {
36
38
  useLayoutEffect(() => {
@@ -58,6 +60,7 @@ const TextInput = ({
58
60
  .filter((e) => e)
59
61
  .join(' ')}
60
62
  name={name}
63
+ color={labelColor}
61
64
  >
62
65
  { label }
63
66
  </FormLabel>
@@ -66,6 +69,7 @@ const TextInput = ({
66
69
  className={`input ${meta.touched && meta.error ? 'input-border-error' : 'input-border'}`}
67
70
  type={type}
68
71
  disabled={disabled}
72
+ placeholder={placeholder}
69
73
  {...field}
70
74
  />
71
75
  {(description || (meta.touched && meta.error))
@@ -104,6 +108,11 @@ TextInput.propTypes = {
104
108
  */
105
109
  label:PropTypes.string.isRequired,
106
110
 
111
+ /**
112
+ * The input label color
113
+ */
114
+ labelColor:PropTypes.string,
115
+
107
116
  /**
108
117
  * The type of the input (html)
109
118
  */
@@ -136,6 +145,11 @@ TextInput.propTypes = {
136
145
  * Whether the text input should be disabled
137
146
  */
138
147
  disabled :PropTypes.bool,
148
+
149
+ /**
150
+ * The placeholder text for the input
151
+ */
152
+ placeholder:PropTypes.string,
139
153
  }
140
154
 
141
155
  TextInput.defaultProps = {
@@ -10,16 +10,16 @@ $default-padding: 0.75em 0.75em 0.55em;
10
10
  flex-direction: column;
11
11
 
12
12
  .input-label {
13
- color: var(--main1);
13
+ color: var(--main2);
14
14
  }
15
15
 
16
16
  .input {
17
- background: var(--light-background1);
18
- color: var(--on-background1);
17
+ background: var(--light-background2);
18
+ color: var(--on-background2);
19
19
  padding: $default-padding;
20
20
 
21
21
  &:focus {
22
- background: var(--dark-background1);
22
+ background: var(--dark-background2);
23
23
  }
24
24
  }
25
25
  }
@@ -152,7 +152,7 @@ TextareaInput.propTypes = {
152
152
  TextareaInput.defaultProps = {
153
153
  rows :3,
154
154
  textAreaColor:'background1',
155
- labelColor :'main1',
155
+ labelColor :'main2',
156
156
  disabled :false,
157
157
  }
158
158