@pareto-engineering/design-system 2.0.0-alpha.15 → 2.0.0-alpha.19

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.
@@ -6,7 +6,7 @@
6
6
 
7
7
  $default-padding: var(--u);
8
8
  $default-conversation-background: var(--y);
9
- $default-message-max-width: calc(100% - #{$default-padding});
9
+ $default-message-max-width: calc(100% - 4 * #{$default-padding});
10
10
  $default-message-min-width: 12em;
11
11
  $default-message-border: var(--theme-border);
12
12
  $triangle-border-size: 15px;
@@ -147,15 +147,3 @@ $triangle-after-side:25px;
147
147
  }
148
148
  }
149
149
  }
150
-
151
- //@keyframes fadeIn {
152
- // from {
153
- // opacity: 0;
154
- // transform: translate3d(0, 50%, 0);
155
- // }
156
- //
157
- // to {
158
- // opacity: 1;
159
- // transform: translate3d(0, 0, 0);
160
- // }
161
- //}
@@ -38,13 +38,18 @@ var SelectInput = _ref => {
38
38
  name,
39
39
  label,
40
40
  options,
41
+ validate,
42
+ description,
41
43
  disabled // ...otherProps
42
44
 
43
45
  } = _ref;
44
46
  (0, React.useLayoutEffect)(() => {
45
47
  Promise.resolve().then(() => _interopRequireWildcard(require("./styles.scss")));
46
48
  }, []);
47
- var [field, meta] = (0, _formik.useField)(name);
49
+ var [field, meta] = (0, _formik.useField)({
50
+ name,
51
+ validate
52
+ });
48
53
  return /*#__PURE__*/React.createElement("div", {
49
54
  id: id,
50
55
  className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
@@ -56,6 +61,7 @@ var SelectInput = _ref => {
56
61
  }, label), /*#__PURE__*/React.createElement("select", _extends({
57
62
  className: "input v25 pv-v"
58
63
  }, field, {
64
+ value: field.value || '',
59
65
  id: name,
60
66
  disabled: disabled
61
67
  }), options.map(option => {
@@ -66,11 +72,13 @@ var SelectInput = _ref => {
66
72
  } : option;
67
73
  return /*#__PURE__*/React.createElement("option", {
68
74
  key: newOption.value,
69
- value: newOption.value
75
+ value: newOption.value,
76
+ disabled: (newOption === null || newOption === void 0 ? void 0 : newOption.disabled) || false
70
77
  }, newOption.label);
71
- })), meta.error && meta.touched && /*#__PURE__*/React.createElement(_common.FormDescription, {
72
- error: true
73
- }, meta.error));
78
+ })), (description || meta.touched && meta.error) && /*#__PURE__*/React.createElement(_common.FormDescription, {
79
+ isError: !!meta.error,
80
+ className: "v50 mt-v s-1"
81
+ }, meta.error || description));
74
82
  };
75
83
 
76
84
  SelectInput.propTypes = {
@@ -99,12 +107,23 @@ SelectInput.propTypes = {
99
107
  */
100
108
  label: _propTypes.default.string,
101
109
 
110
+ /**
111
+ * The input field validator function
112
+ */
113
+ validate: _propTypes.default.func,
114
+
115
+ /**
116
+ * The select input description
117
+ */
118
+ description: _propTypes.default.string,
119
+
102
120
  /**
103
121
  * The options of the select input
104
122
  */
105
123
  options: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.shape({
106
124
  value: _propTypes.default.string,
107
- label: _propTypes.default.string
125
+ label: _propTypes.default.string,
126
+ disabled: _propTypes.default.bool
108
127
  })])),
109
128
 
110
129
  /**
@@ -18,12 +18,12 @@ $default-padding: 0.75em 0.75em 0.55em;
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
  }
@@ -38,10 +38,12 @@ var TextInput = _ref => {
38
38
  type,
39
39
  name,
40
40
  label,
41
+ labelColor,
41
42
  validate,
42
43
  oneInputLabel,
43
44
  description,
44
- disabled // ...otherProps
45
+ disabled,
46
+ placeholder // ...otherProps
45
47
 
46
48
  } = _ref;
47
49
  (0, React.useLayoutEffect)(() => {
@@ -57,13 +59,15 @@ var TextInput = _ref => {
57
59
  style: style // {...otherProps}
58
60
 
59
61
  }, /*#__PURE__*/React.createElement(_common.FormLabel, {
60
- className: ['input-label', oneInputLabel ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v'].filter(e => e).join(' '),
61
- name: name
62
+ className: [oneInputLabel ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v'].filter(e => e).join(' '),
63
+ name: name,
64
+ color: labelColor
62
65
  }, label), /*#__PURE__*/React.createElement("input", _extends({
63
66
  id: name,
64
67
  className: "input ".concat(meta.touched && meta.error ? 'input-border-error' : 'input-border'),
65
68
  type: type,
66
- disabled: disabled
69
+ disabled: disabled,
70
+ placeholder: placeholder
67
71
  }, field)), (description || meta.touched && meta.error) && /*#__PURE__*/React.createElement(_common.FormDescription, {
68
72
  isError: !!meta.error,
69
73
  className: "v50 mt-v s-1"
@@ -96,6 +100,11 @@ TextInput.propTypes = {
96
100
  */
97
101
  label: _propTypes.default.string.isRequired,
98
102
 
103
+ /**
104
+ * The input label color
105
+ */
106
+ labelColor: _propTypes.default.string,
107
+
99
108
  /**
100
109
  * The type of the input (html)
101
110
  */
@@ -119,7 +128,12 @@ TextInput.propTypes = {
119
128
  /**
120
129
  * Whether the text input should be disabled
121
130
  */
122
- disabled: _propTypes.default.bool
131
+ disabled: _propTypes.default.bool,
132
+
133
+ /**
134
+ * The placeholder text for the input
135
+ */
136
+ placeholder: _propTypes.default.string
123
137
  };
124
138
  TextInput.defaultProps = {
125
139
  type: 'text',
@@ -9,10 +9,6 @@ $default-padding: 0.75em 0.75em 0.55em;
9
9
  display: flex;
10
10
  flex-direction: column;
11
11
 
12
- .input-label {
13
- color: var(--main2);
14
- }
15
-
16
12
  .input {
17
13
  background: var(--light-background2);
18
14
  color: var(--on-background2);
@@ -43,7 +43,8 @@ var TextareaInput = _ref => {
43
43
  textAreaColor,
44
44
  labelColor,
45
45
  description,
46
- disabled // ...otherProps
46
+ disabled,
47
+ placeholder // ...otherProps
47
48
 
48
49
  } = _ref;
49
50
  (0, React.useLayoutEffect)(() => {
@@ -55,16 +56,18 @@ var TextareaInput = _ref => {
55
56
  });
56
57
  return /*#__PURE__*/React.createElement("div", {
57
58
  id: id,
58
- className: [baseClassName, componentClassName, userClassName, "x-".concat(textAreaColor), "y-".concat(labelColor)].filter(e => e).join(' '),
59
+ className: [baseClassName, componentClassName, userClassName, "x-".concat(textAreaColor)].filter(e => e).join(' '),
59
60
  style: style // {...otherProps}
60
61
 
61
62
  }, /*#__PURE__*/React.createElement(_common.FormLabel, {
62
- className: ['c-y', labelAsDescription ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v'].filter(e => e).join(' '),
63
- name: name
63
+ className: [labelAsDescription ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v'].filter(e => e).join(' '),
64
+ name: name,
65
+ color: labelColor
64
66
  }, label), /*#__PURE__*/React.createElement("textarea", _extends({
65
67
  id: textAreaId,
66
68
  className: "textarea v50 pv-v ".concat(meta.touched && meta.error ? 'input-border-error' : 'input-border')
67
69
  }, field, {
70
+ placeholder: placeholder,
68
71
  rows: rows,
69
72
  disabled: disabled
70
73
  })), (description || meta.touched && meta.error) && /*#__PURE__*/React.createElement(_common.FormDescription, {
@@ -137,12 +140,16 @@ TextareaInput.propTypes = {
137
140
  /**
138
141
  * Whether the text area should be disabled
139
142
  */
140
- disabled: _propTypes.default.bool
143
+ disabled: _propTypes.default.bool,
144
+
145
+ /**
146
+ * The textarea placeholder text
147
+ */
148
+ placeholder: _propTypes.default.string
141
149
  };
142
150
  TextareaInput.defaultProps = {
143
151
  rows: 3,
144
152
  textAreaColor: 'background1',
145
- labelColor: 'main2',
146
153
  disabled: false
147
154
  };
148
155
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  $default-padding: var(--u);
8
8
  $default-conversation-background: var(--y);
9
- $default-message-max-width: calc(100% - #{$default-padding});
9
+ $default-message-max-width: calc(100% - 4 * #{$default-padding});
10
10
  $default-message-min-width: 12em;
11
11
  $default-message-border: var(--theme-border);
12
12
  $triangle-border-size: 15px;
@@ -147,15 +147,3 @@ $triangle-after-side:25px;
147
147
  }
148
148
  }
149
149
  }
150
-
151
- //@keyframes fadeIn {
152
- // from {
153
- // opacity: 0;
154
- // transform: translate3d(0, 50%, 0);
155
- // }
156
- //
157
- // to {
158
- // opacity: 1;
159
- // transform: translate3d(0, 0, 0);
160
- // }
161
- //}
@@ -21,13 +21,18 @@ const SelectInput = ({
21
21
  name,
22
22
  label,
23
23
  options,
24
+ validate,
25
+ description,
24
26
  disabled // ...otherProps
25
27
 
26
28
  }) => {
27
29
  useLayoutEffect(() => {
28
30
  import("./styles.scss");
29
31
  }, []);
30
- const [field, meta] = useField(name);
32
+ const [field, meta] = useField({
33
+ name,
34
+ validate
35
+ });
31
36
  return /*#__PURE__*/React.createElement("div", {
32
37
  id: id,
33
38
  className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
@@ -39,6 +44,7 @@ const SelectInput = ({
39
44
  }, label), /*#__PURE__*/React.createElement("select", _extends({
40
45
  className: "input v25 pv-v"
41
46
  }, field, {
47
+ value: field.value || '',
42
48
  id: name,
43
49
  disabled: disabled
44
50
  }), options.map(option => {
@@ -49,11 +55,13 @@ const SelectInput = ({
49
55
  } : option;
50
56
  return /*#__PURE__*/React.createElement("option", {
51
57
  key: newOption.value,
52
- value: newOption.value
58
+ value: newOption.value,
59
+ disabled: (newOption === null || newOption === void 0 ? void 0 : newOption.disabled) || false
53
60
  }, newOption.label);
54
- })), meta.error && meta.touched && /*#__PURE__*/React.createElement(FormDescription, {
55
- error: true
56
- }, meta.error));
61
+ })), (description || meta.touched && meta.error) && /*#__PURE__*/React.createElement(FormDescription, {
62
+ isError: !!meta.error,
63
+ className: "v50 mt-v s-1"
64
+ }, meta.error || description));
57
65
  };
58
66
 
59
67
  SelectInput.propTypes = {
@@ -82,12 +90,23 @@ SelectInput.propTypes = {
82
90
  */
83
91
  label: PropTypes.string,
84
92
 
93
+ /**
94
+ * The input field validator function
95
+ */
96
+ validate: PropTypes.func,
97
+
98
+ /**
99
+ * The select input description
100
+ */
101
+ description: PropTypes.string,
102
+
85
103
  /**
86
104
  * The options of the select input
87
105
  */
88
106
  options: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
89
107
  value: PropTypes.string,
90
- label: PropTypes.string
108
+ label: PropTypes.string,
109
+ disabled: PropTypes.bool
91
110
  })])),
92
111
 
93
112
  /**
@@ -18,12 +18,12 @@ $default-padding: 0.75em 0.75em 0.55em;
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
  }
@@ -21,10 +21,12 @@ const TextInput = ({
21
21
  type,
22
22
  name,
23
23
  label,
24
+ labelColor,
24
25
  validate,
25
26
  oneInputLabel,
26
27
  description,
27
- disabled // ...otherProps
28
+ disabled,
29
+ placeholder // ...otherProps
28
30
 
29
31
  }) => {
30
32
  useLayoutEffect(() => {
@@ -40,13 +42,15 @@ const TextInput = ({
40
42
  style: style // {...otherProps}
41
43
 
42
44
  }, /*#__PURE__*/React.createElement(FormLabel, {
43
- className: ['input-label', oneInputLabel ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v'].filter(e => e).join(' '),
44
- name: name
45
+ className: [oneInputLabel ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v'].filter(e => e).join(' '),
46
+ name: name,
47
+ color: labelColor
45
48
  }, label), /*#__PURE__*/React.createElement("input", _extends({
46
49
  id: name,
47
50
  className: `input ${meta.touched && meta.error ? 'input-border-error' : 'input-border'}`,
48
51
  type: type,
49
- disabled: disabled
52
+ disabled: disabled,
53
+ placeholder: placeholder
50
54
  }, field)), (description || meta.touched && meta.error) && /*#__PURE__*/React.createElement(FormDescription, {
51
55
  isError: !!meta.error,
52
56
  className: "v50 mt-v s-1"
@@ -79,6 +83,11 @@ TextInput.propTypes = {
79
83
  */
80
84
  label: PropTypes.string.isRequired,
81
85
 
86
+ /**
87
+ * The input label color
88
+ */
89
+ labelColor: PropTypes.string,
90
+
82
91
  /**
83
92
  * The type of the input (html)
84
93
  */
@@ -102,7 +111,12 @@ TextInput.propTypes = {
102
111
  /**
103
112
  * Whether the text input should be disabled
104
113
  */
105
- disabled: PropTypes.bool
114
+ disabled: PropTypes.bool,
115
+
116
+ /**
117
+ * The placeholder text for the input
118
+ */
119
+ placeholder: PropTypes.string
106
120
  };
107
121
  TextInput.defaultProps = {
108
122
  type: 'text',
@@ -9,10 +9,6 @@ $default-padding: 0.75em 0.75em 0.55em;
9
9
  display: flex;
10
10
  flex-direction: column;
11
11
 
12
- .input-label {
13
- color: var(--main2);
14
- }
15
-
16
12
  .input {
17
13
  background: var(--light-background2);
18
14
  color: var(--on-background2);
@@ -27,7 +27,8 @@ const TextareaInput = ({
27
27
  textAreaColor,
28
28
  labelColor,
29
29
  description,
30
- disabled // ...otherProps
30
+ disabled,
31
+ placeholder // ...otherProps
31
32
 
32
33
  }) => {
33
34
  useLayoutEffect(() => {
@@ -39,16 +40,18 @@ const TextareaInput = ({
39
40
  });
40
41
  return /*#__PURE__*/React.createElement("div", {
41
42
  id: id,
42
- className: [baseClassName, componentClassName, userClassName, `x-${textAreaColor}`, `y-${labelColor}`].filter(e => e).join(' '),
43
+ className: [baseClassName, componentClassName, userClassName, `x-${textAreaColor}`].filter(e => e).join(' '),
43
44
  style: style // {...otherProps}
44
45
 
45
46
  }, /*#__PURE__*/React.createElement(FormLabel, {
46
- className: ['c-y', labelAsDescription ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v'].filter(e => e).join(' '),
47
- name: name
47
+ className: [labelAsDescription ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v'].filter(e => e).join(' '),
48
+ name: name,
49
+ color: labelColor
48
50
  }, label), /*#__PURE__*/React.createElement("textarea", _extends({
49
51
  id: textAreaId,
50
52
  className: `textarea v50 pv-v ${meta.touched && meta.error ? 'input-border-error' : 'input-border'}`
51
53
  }, field, {
54
+ placeholder: placeholder,
52
55
  rows: rows,
53
56
  disabled: disabled
54
57
  })), (description || meta.touched && meta.error) && /*#__PURE__*/React.createElement(FormDescription, {
@@ -121,12 +124,16 @@ TextareaInput.propTypes = {
121
124
  /**
122
125
  * Whether the text area should be disabled
123
126
  */
124
- disabled: PropTypes.bool
127
+ disabled: PropTypes.bool,
128
+
129
+ /**
130
+ * The textarea placeholder text
131
+ */
132
+ placeholder: PropTypes.string
125
133
  };
126
134
  TextareaInput.defaultProps = {
127
135
  rows: 3,
128
136
  textAreaColor: 'background1',
129
- labelColor: 'main2',
130
137
  disabled: false
131
138
  };
132
139
  export default /*#__PURE__*/memo(TextareaInput);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pareto-engineering/design-system",
3
- "version": "2.0.0-alpha.15",
3
+ "version": "2.0.0-alpha.19",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/es/index.js",