@pareto-engineering/design-system 2.0.0-alpha.17 → 2.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.
@@ -59,7 +59,7 @@ var TextInput = _ref => {
59
59
  style: style // {...otherProps}
60
60
 
61
61
  }, /*#__PURE__*/React.createElement(_common.FormLabel, {
62
- className: ['input-label', oneInputLabel ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v'].filter(e => e).join(' '),
62
+ className: [oneInputLabel ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v'].filter(e => e).join(' '),
63
63
  name: name,
64
64
  color: labelColor
65
65
  }, label), /*#__PURE__*/React.createElement("input", _extends({
@@ -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
 
@@ -42,7 +42,7 @@ const TextInput = ({
42
42
  style: style // {...otherProps}
43
43
 
44
44
  }, /*#__PURE__*/React.createElement(FormLabel, {
45
- className: ['input-label', oneInputLabel ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v'].filter(e => e).join(' '),
45
+ className: [oneInputLabel ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v'].filter(e => e).join(' '),
46
46
  name: name,
47
47
  color: labelColor
48
48
  }, label), /*#__PURE__*/React.createElement("input", _extends({
@@ -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.17",
3
+ "version": "2.0.0-alpha.18",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/es/index.js",
@@ -9130,7 +9130,7 @@ exports[`Storyshots f/FormInput Base 1`] = `
9130
9130
  className="base text-input form-input"
9131
9131
  >
9132
9132
  <label
9133
- className="base label input-label v50 mb-v x-main2"
9133
+ className="base label v50 mb-v x-main2"
9134
9134
  htmlFor="firstName"
9135
9135
  >
9136
9136
  What's your first name ?
@@ -9150,7 +9150,7 @@ exports[`Storyshots f/FormInput Base 1`] = `
9150
9150
  className="base text-input form-input"
9151
9151
  >
9152
9152
  <label
9153
- className="base label input-label v50 mb-v x-main2"
9153
+ className="base label v50 mb-v x-main2"
9154
9154
  htmlFor="lastName"
9155
9155
  >
9156
9156
  What's your last name ?
@@ -9166,10 +9166,10 @@ exports[`Storyshots f/FormInput Base 1`] = `
9166
9166
  />
9167
9167
  </div>
9168
9168
  <div
9169
- className="base text-area-input form-input x-background1 y-main2"
9169
+ className="base text-area-input form-input x-background1"
9170
9170
  >
9171
9171
  <label
9172
- className="base label c-y v50 mb-v x-main2"
9172
+ className="base label v50 mb-v x-main2"
9173
9173
  htmlFor="description"
9174
9174
  >
9175
9175
  Describe yourself in a few sentences
@@ -9319,7 +9319,7 @@ exports[`Storyshots f/FormInput Disabled Form Input 1`] = `
9319
9319
  className="base text-input form-input"
9320
9320
  >
9321
9321
  <label
9322
- className="base label input-label v50 mb-v x-main2"
9322
+ className="base label v50 mb-v x-main2"
9323
9323
  htmlFor="firstName"
9324
9324
  >
9325
9325
  What's your first name ?
@@ -9339,7 +9339,7 @@ exports[`Storyshots f/FormInput Disabled Form Input 1`] = `
9339
9339
  className="base text-input form-input"
9340
9340
  >
9341
9341
  <label
9342
- className="base label input-label v50 mb-v x-main2"
9342
+ className="base label v50 mb-v x-main2"
9343
9343
  htmlFor="lastName"
9344
9344
  >
9345
9345
  What's your last name ?
@@ -9355,10 +9355,10 @@ exports[`Storyshots f/FormInput Disabled Form Input 1`] = `
9355
9355
  />
9356
9356
  </div>
9357
9357
  <div
9358
- className="base text-area-input form-input x-background1 y-main2"
9358
+ className="base text-area-input form-input x-background1"
9359
9359
  >
9360
9360
  <label
9361
- className="base label c-y v50 mb-v x-main2"
9361
+ className="base label v50 mb-v x-main2"
9362
9362
  htmlFor="description"
9363
9363
  >
9364
9364
  Describe yourself in a few sentences
@@ -9508,7 +9508,7 @@ exports[`Storyshots f/FormInput Extensible Form Input 1`] = `
9508
9508
  className="base text-input form-input"
9509
9509
  >
9510
9510
  <label
9511
- className="base label input-label v50 mb-v x-main2"
9511
+ className="base label v50 mb-v x-main2"
9512
9512
  htmlFor="extended"
9513
9513
  >
9514
9514
  Extended type input
@@ -11483,7 +11483,7 @@ exports[`Storyshots f/fields/TextInput Base 1`] = `
11483
11483
  className="base text-input"
11484
11484
  >
11485
11485
  <label
11486
- className="base label input-label v50 mb-v x-main2"
11486
+ className="base label v50 mb-v x-main2"
11487
11487
  htmlFor="firstName"
11488
11488
  >
11489
11489
  What's your first name ?
@@ -11527,7 +11527,7 @@ exports[`Storyshots f/fields/TextInput Date Time 1`] = `
11527
11527
  className="base text-input"
11528
11528
  >
11529
11529
  <label
11530
- className="base label input-label v50 mb-v x-main2"
11530
+ className="base label v50 mb-v x-main2"
11531
11531
  htmlFor="date"
11532
11532
  >
11533
11533
  Select date
@@ -11547,7 +11547,7 @@ exports[`Storyshots f/fields/TextInput Date Time 1`] = `
11547
11547
  className="base text-input"
11548
11548
  >
11549
11549
  <label
11550
- className="base label input-label v50 mb-v x-main2"
11550
+ className="base label v50 mb-v x-main2"
11551
11551
  htmlFor="time"
11552
11552
  >
11553
11553
  Select time
@@ -11591,7 +11591,7 @@ exports[`Storyshots f/fields/TextInput Disabled Text Input 1`] = `
11591
11591
  className="base text-input"
11592
11592
  >
11593
11593
  <label
11594
- className="base label input-label v50 mb-v x-main2"
11594
+ className="base label v50 mb-v x-main2"
11595
11595
  htmlFor="firstName"
11596
11596
  >
11597
11597
  What's your first name ?
@@ -11624,7 +11624,7 @@ exports[`Storyshots f/fields/TextInput Text Input With Place Holder 1`] = `
11624
11624
  className="base text-input"
11625
11625
  >
11626
11626
  <label
11627
- className="base label input-label v50 mb-v x-main2"
11627
+ className="base label v50 mb-v x-main2"
11628
11628
  htmlFor="firstName"
11629
11629
  >
11630
11630
  What's your first name ?
@@ -11655,18 +11655,18 @@ exports[`Storyshots f/fields/TextareaInput Base 1`] = `
11655
11655
  className="y-background1 b-dark-y"
11656
11656
  >
11657
11657
  <div
11658
- className="base text-area-input x-background1 y-main2"
11658
+ className="base text-area-input x-background1"
11659
11659
  >
11660
11660
  <label
11661
- className="base label c-y v50 mb-v x-main2"
11662
- htmlFor="feedBack"
11661
+ className="base label v50 mb-v x-main2"
11662
+ htmlFor="feedback"
11663
11663
  >
11664
11664
  What can we improve on?
11665
11665
  </label>
11666
11666
  <textarea
11667
11667
  className="textarea v50 pv-v input-border"
11668
11668
  disabled={false}
11669
- name="feedBack"
11669
+ name="feedback"
11670
11670
  onBlur={[Function]}
11671
11671
  onChange={[Function]}
11672
11672
  rows={3}
@@ -11689,7 +11689,7 @@ exports[`Storyshots f/fields/TextareaInput Base 1`] = `
11689
11689
  </form>
11690
11690
  `;
11691
11691
 
11692
- exports[`Storyshots f/fields/TextareaInput Disabled Textarea Input 1`] = `
11692
+ exports[`Storyshots f/fields/TextareaInput Disabled 1`] = `
11693
11693
  <form
11694
11694
  action="#"
11695
11695
  onReset={[Function]}
@@ -11699,18 +11699,18 @@ exports[`Storyshots f/fields/TextareaInput Disabled Textarea Input 1`] = `
11699
11699
  className="y-background1 b-dark-y"
11700
11700
  >
11701
11701
  <div
11702
- className="base text-area-input x-background1 y-main2"
11702
+ className="base text-area-input x-background1"
11703
11703
  >
11704
11704
  <label
11705
- className="base label c-y v50 mb-v x-main2"
11706
- htmlFor="feedBack"
11705
+ className="base label v50 mb-v x-main2"
11706
+ htmlFor="feedback"
11707
11707
  >
11708
11708
  What can we improve on?
11709
11709
  </label>
11710
11710
  <textarea
11711
11711
  className="textarea v50 pv-v input-border"
11712
11712
  disabled={true}
11713
- name="feedBack"
11713
+ name="feedback"
11714
11714
  onBlur={[Function]}
11715
11715
  onChange={[Function]}
11716
11716
  rows={3}
@@ -11733,6 +11733,96 @@ exports[`Storyshots f/fields/TextareaInput Disabled Textarea Input 1`] = `
11733
11733
  </form>
11734
11734
  `;
11735
11735
 
11736
+ exports[`Storyshots f/fields/TextareaInput Placeholder 1`] = `
11737
+ <form
11738
+ action="#"
11739
+ onReset={[Function]}
11740
+ onSubmit={[Function]}
11741
+ >
11742
+ <div
11743
+ className="y-background1 b-dark-y"
11744
+ >
11745
+ <div
11746
+ className="base text-area-input x-background1"
11747
+ >
11748
+ <label
11749
+ className="base label v50 mb-v x-main2"
11750
+ htmlFor="feedback"
11751
+ >
11752
+ What can we improve on?
11753
+ </label>
11754
+ <textarea
11755
+ className="textarea v50 pv-v input-border"
11756
+ disabled={false}
11757
+ name="feedback"
11758
+ onBlur={[Function]}
11759
+ onChange={[Function]}
11760
+ placeholder="Type your feedback here..."
11761
+ rows={3}
11762
+ value=""
11763
+ />
11764
+
11765
+ </div>
11766
+ <div
11767
+ className="debugger"
11768
+ >
11769
+ <button
11770
+ className="base button x-main2"
11771
+ onClick={[Function]}
11772
+ type="button"
11773
+ >
11774
+ Open FormDebugger
11775
+ </button>
11776
+ </div>
11777
+ </div>
11778
+ </form>
11779
+ `;
11780
+
11781
+ exports[`Storyshots f/fields/TextareaInput Validation 1`] = `
11782
+ <form
11783
+ action="#"
11784
+ onReset={[Function]}
11785
+ onSubmit={[Function]}
11786
+ >
11787
+ <div
11788
+ className="y-background1 b-dark-y"
11789
+ >
11790
+ <div
11791
+ className="base text-area-input x-background1"
11792
+ >
11793
+ <label
11794
+ className="base label v50 mb-v x-main2"
11795
+ htmlFor="feedback"
11796
+ >
11797
+ What can we improve on?
11798
+ </label>
11799
+ <textarea
11800
+ className="textarea v50 pv-v input-border"
11801
+ disabled={false}
11802
+ name="feedback"
11803
+ onBlur={[Function]}
11804
+ onChange={[Function]}
11805
+ placeholder="Type your feedback here..."
11806
+ rows={3}
11807
+ value=""
11808
+ />
11809
+
11810
+ </div>
11811
+ <div
11812
+ className="debugger"
11813
+ >
11814
+ <button
11815
+ className="base button x-main2"
11816
+ onClick={[Function]}
11817
+ type="button"
11818
+ >
11819
+ Open FormDebugger
11820
+ </button>
11821
+ </div>
11822
+ </div>
11823
+ </form>
11824
+ `;
11825
+
11736
11826
  exports[`Storyshots r/SwitchRouteMap Base 1`] = `"This component does not need a visual test."`;
11737
11827
 
11738
11828
  exports[`Storyshots r/common/PrivateRoute Base 1`] = `"This component does not need a visual test."`;
@@ -14,7 +14,7 @@ export default {
14
14
  decorators:[
15
15
  (storyfn) => (
16
16
  <Formik
17
- initialValues={{ feedBack: '' }}
17
+ initialValues={{ feedback: '' }}
18
18
  >
19
19
  <Form>
20
20
 
@@ -31,16 +31,52 @@ export default {
31
31
  export const Base = () => (
32
32
  <div className="y-background1 b-dark-y">
33
33
  <TextareaInput
34
- name="feedBack"
34
+ name="feedback"
35
35
  label="What can we improve on?"
36
36
  />
37
37
  <FormDebugger />
38
38
  </div>
39
39
  )
40
- export const DisabledTextareaInput = () => (
40
+
41
+ export const Placeholder = () => (
42
+ <div className="y-background1 b-dark-y">
43
+ <TextareaInput
44
+ name="feedback"
45
+ label="What can we improve on?"
46
+ placeholder="Type your feedback here..."
47
+ />
48
+ <FormDebugger />
49
+ </div>
50
+ )
51
+
52
+ export const Validation = () => {
53
+ const validate = (value) => {
54
+ let errorMessage = ''
55
+ const isValid = value.length > 3
56
+
57
+ if (!isValid) {
58
+ errorMessage = 'Value should be greater than 3 characters'
59
+ }
60
+ return errorMessage
61
+ }
62
+
63
+ return (
64
+ <div className="y-background1 b-dark-y">
65
+ <TextareaInput
66
+ name="feedback"
67
+ label="What can we improve on?"
68
+ placeholder="Type your feedback here..."
69
+ validate={validate}
70
+ />
71
+ <FormDebugger />
72
+ </div>
73
+ )
74
+ }
75
+
76
+ export const Disabled = () => (
41
77
  <div className="y-background1 b-dark-y">
42
78
  <TextareaInput
43
- name="feedBack"
79
+ name="feedback"
44
80
  label="What can we improve on?"
45
81
  disabled
46
82
  />
@@ -55,8 +55,7 @@ const TextInput = ({
55
55
  // {...otherProps}
56
56
  >
57
57
  <FormLabel
58
- className={[
59
- 'input-label', oneInputLabel ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v']
58
+ className={[oneInputLabel ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v']
60
59
  .filter((e) => e)
61
60
  .join(' ')}
62
61
  name={name}
@@ -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);
@@ -34,6 +34,7 @@ const TextareaInput = ({
34
34
  labelColor,
35
35
  description,
36
36
  disabled,
37
+ placeholder,
37
38
  // ...otherProps
38
39
  }) => {
39
40
  useLayoutEffect(() => {
@@ -52,7 +53,6 @@ const TextareaInput = ({
52
53
  componentClassName,
53
54
  userClassName,
54
55
  `x-${textAreaColor}`,
55
- `y-${labelColor}`,
56
56
  ]
57
57
  .filter((e) => e)
58
58
  .join(' ')}
@@ -60,11 +60,11 @@ const TextareaInput = ({
60
60
  // {...otherProps}
61
61
  >
62
62
  <FormLabel
63
- className={[
64
- 'c-y', labelAsDescription ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v']
63
+ className={[labelAsDescription ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v']
65
64
  .filter((e) => e)
66
65
  .join(' ')}
67
66
  name={name}
67
+ color={labelColor}
68
68
  >
69
69
  { label }
70
70
  </FormLabel>
@@ -72,6 +72,7 @@ const TextareaInput = ({
72
72
  id={textAreaId}
73
73
  className={`textarea v50 pv-v ${meta.touched && meta.error ? 'input-border-error' : 'input-border'}`}
74
74
  {...field}
75
+ placeholder={placeholder}
75
76
  rows={rows}
76
77
  disabled={disabled}
77
78
  >
@@ -123,36 +124,46 @@ TextareaInput.propTypes = {
123
124
  * If the text area depends on it's label's text as the default description
124
125
  */
125
126
  labelAsDescription:PropTypes.bool,
127
+
126
128
  /**
127
129
  * The textarea id
128
130
  */
129
- textAreaId :PropTypes.string,
131
+ textAreaId:PropTypes.string,
132
+
130
133
  /**
131
134
  * The number of rows int the text area
132
135
  */
133
- rows :PropTypes.number,
136
+ rows:PropTypes.number,
137
+
134
138
  /**
135
139
  * Text area base color
136
140
  */
137
- textAreaColor :PropTypes.string,
141
+ textAreaColor:PropTypes.string,
142
+
138
143
  /**
139
144
  * Label base color
140
145
  */
141
- labelColor :PropTypes.string,
146
+ labelColor:PropTypes.string,
147
+
142
148
  /**
143
149
  * Text area description
144
150
  */
145
- description :PropTypes.string,
151
+ description:PropTypes.string,
152
+
146
153
  /**
147
154
  * Whether the text area should be disabled
148
155
  */
149
- disabled :PropTypes.bool,
156
+ disabled:PropTypes.bool,
157
+
158
+ /**
159
+ * The textarea placeholder text
160
+ */
161
+ placeholder:PropTypes.string,
150
162
  }
151
163
 
152
164
  TextareaInput.defaultProps = {
153
165
  rows :3,
154
166
  textAreaColor:'background1',
155
- labelColor :'main2',
156
167
  disabled :false,
157
168
  }
158
169