@pareto-engineering/design-system 2.0.0-alpha.38 → 2.0.0-alpha.40

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.
@@ -24,6 +24,14 @@ export const Base = () => (
24
24
 
25
25
  export const Color = () => ALL_COLORS.map((color) => <Logo color={color} key={color} />)
26
26
 
27
+ export const Square = () => ALL_COLORS.map((color) => (
28
+ <Logo
29
+ square
30
+ color={color}
31
+ key={color}
32
+ />
33
+ ))
34
+
27
35
  // export const Animated = () => (
28
36
  // <Logo animated />
29
37
  // )
@@ -29,14 +29,14 @@ export default {
29
29
 
30
30
  export const Base = () => (
31
31
  <>
32
- <RatingsInput ratingCount={5} name="ratings" />
32
+ <RatingsInput ratingCount={5} name="ratings" label="Your Rating" />
33
33
  <FormDebugger />
34
34
  </>
35
35
  )
36
36
 
37
37
  export const Numbers = () => (
38
38
  <>
39
- <RatingsInput ratingCount={10} name="ratings" showRatingValue />
39
+ <RatingsInput ratingCount={10} name="ratings" showRatingValue label="Your Rating" />
40
40
  <FormDebugger />
41
41
  </>
42
42
  )
@@ -44,6 +44,7 @@ export const Numbers = () => (
44
44
  export const Labels = () => (
45
45
  <>
46
46
  <RatingsInput
47
+ label="Your Rating"
47
48
  labelMax="very satisfied."
48
49
  labelMin="not satisfied."
49
50
  ratingCount={10}
@@ -15,7 +15,22 @@ const baseClassName = styleNames.base
15
15
 
16
16
  const componentClassName = 'logo'
17
17
 
18
- const defaultTargets = [
18
+ const defaultTargetssquare = [
19
+ {
20
+ id :'logo',
21
+ target:'logo',
22
+ },
23
+ ]
24
+
25
+ const contentMapSquare = {
26
+ default:{
27
+ sprite :'/logo_square.svg',
28
+ viewBox:'0 0 39 39',
29
+ targets:defaultTargetssquare,
30
+ },
31
+ }
32
+
33
+ const defaultTargetsWithName = [
19
34
  {
20
35
  id :'logo_squares',
21
36
  target:'logo_squares',
@@ -26,11 +41,11 @@ const defaultTargets = [
26
41
  },
27
42
  ]
28
43
 
29
- const contentMap = {
44
+ const contentMapWithName = {
30
45
  default:{
31
46
  sprite :'/logo.svg',
32
47
  viewBox:'0 0 156 30',
33
- targets:defaultTargets,
48
+ targets:defaultTargetsWithName,
34
49
  },
35
50
  }
36
51
 
@@ -46,12 +61,14 @@ const Logo = ({
46
61
  width,
47
62
  variant,
48
63
  strokeColor,
64
+ square,
49
65
  // ...otherProps
50
66
  }) => {
51
67
  useLayoutEffect(() => {
52
68
  import('./styles.scss')
53
69
  }, [])
54
70
 
71
+ const contentMap = square ? contentMapSquare : contentMapWithName
55
72
  const svgConfig = useMemo(() => contentMap[variant], [variant])
56
73
 
57
74
  return (
@@ -117,6 +134,11 @@ Logo.propTypes = {
117
134
  * The color of the svg stroke
118
135
  */
119
136
  strokeColor:PropTypes.string,
137
+
138
+ /**
139
+ * Whether the logo should have a name.
140
+ */
141
+ square:PropTypes.bool,
120
142
  }
121
143
 
122
144
  Logo.defaultProps = {
@@ -124,6 +146,7 @@ Logo.defaultProps = {
124
146
  height :'2em',
125
147
  variant :'default',
126
148
  strokeColor:'transparent',
149
+ square :false,
127
150
  }
128
151
 
129
152
  export default Logo
@@ -10,6 +10,7 @@ import styleNames from '@pareto-engineering/bem'
10
10
  // Local Definitions
11
11
 
12
12
  import { Rating } from './common'
13
+ import { FormLabel } from '../../common'
13
14
 
14
15
  const baseClassName = styleNames.base
15
16
 
@@ -25,9 +26,12 @@ const RatingsInput = ({
25
26
  name,
26
27
  ratingCount,
27
28
  showRatingValue,
29
+ oneInputLabel,
30
+ label,
28
31
  labelMax,
29
32
  labelMin,
30
33
  displayRatingsLabel,
34
+ optional,
31
35
  // ...otherProps
32
36
  }) => {
33
37
  useLayoutEffect(() => {
@@ -47,24 +51,35 @@ const RatingsInput = ({
47
51
  .filter((e) => e)
48
52
  .join(' ')}
49
53
  style={style}
50
- // {...otherProps}
51
54
  >
52
- {displayRatingsLabel && <p className="label-text md-s-1 s-2 x-metadata c-x">{labelMin}</p>}
53
- {[...Array(ratingCount)].map((_, index) => {
54
- const ratingValue = index + 1
55
- return (
56
- <Rating
57
- key={ratingValue}
58
- ratingId={`${name}-${ratingValue}`}
59
- value={ratingValue}
60
- name={name}
61
- hover={hover}
62
- setHover={setHover}
63
- showRatingValue={showRatingValue}
64
- />
65
- )
66
- })}
67
- {displayRatingsLabel && <p className="label-text md-s-1 s-2 x-metadata c-x">{labelMax}</p>}
55
+ <FormLabel
56
+ className={[
57
+ 'input-label', oneInputLabel ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v']
58
+ .filter((e) => e)
59
+ .join(' ')}
60
+ name={name}
61
+ optional={optional}
62
+ >
63
+ { label }
64
+ </FormLabel>
65
+ <div className="stars">
66
+ {displayRatingsLabel && <p className="label-text md-s-1 s-2 x-metadata c-x">{labelMin}</p>}
67
+ {[...Array(ratingCount)].map((_, index) => {
68
+ const ratingValue = index + 1
69
+ return (
70
+ <Rating
71
+ key={ratingValue}
72
+ ratingId={`${name}-${ratingValue}`}
73
+ value={ratingValue}
74
+ name={name}
75
+ hover={hover}
76
+ setHover={setHover}
77
+ showRatingValue={showRatingValue}
78
+ />
79
+ )
80
+ })}
81
+ {displayRatingsLabel && <p className="label-text md-s-1 s-2 x-metadata c-x">{labelMax}</p>}
82
+ </div>
68
83
  </div>
69
84
  )
70
85
  }
@@ -97,6 +112,10 @@ RatingsInput.propTypes = {
97
112
  * Determines if the rating start value should be shown
98
113
  */
99
114
  showRatingValue :PropTypes.bool,
115
+ /**
116
+ * The label of the ratings input
117
+ */
118
+ label :PropTypes.string.isRequired,
100
119
  /**
101
120
  * description for the highest rating value
102
121
  */
@@ -109,6 +128,14 @@ RatingsInput.propTypes = {
109
128
  * If the rating lables should be shown
110
129
  */
111
130
  displayRatingsLabel:PropTypes.bool,
131
+ /**
132
+ * Whether the input is optional or not
133
+ */
134
+ optional :PropTypes.bool,
135
+ /**
136
+ * If the slide will only have one input
137
+ */
138
+ oneInputLabel :PropTypes.bool,
112
139
  }
113
140
 
114
141
  RatingsInput.defaultProps = {
@@ -7,34 +7,43 @@ $default-transition: all .2s;
7
7
 
8
8
  .#{bem.$base}.ratings-input {
9
9
  display: flex;
10
+ flex-direction: column;
10
11
 
11
- >:not(:last-child) {
12
- margin-right: $default-rating-icon-margin;
12
+ p {
13
+ padding: $default-padding;
13
14
  }
14
15
 
15
- .#{bem.$base}.rating {
16
+ .stars {
16
17
  display: flex;
17
18
 
18
- input {
19
- opacity: 0;
20
- position: absolute;
21
- visibility: none;
22
- z-index: -1;
19
+ >:not(:last-child) {
20
+ margin-right: $default-rating-icon-margin;
23
21
  }
24
-
25
- label {
22
+
23
+ .#{bem.$base}.rating {
26
24
  display: flex;
27
- flex-direction: column;
28
- align-items: center;
29
- padding: $default-padding;
30
- transition: $default-transition;
31
- cursor: pointer;
25
+
26
+ input {
27
+ opacity: 0;
28
+ position: absolute;
29
+ visibility: none;
30
+ z-index: -1;
31
+ }
32
+
33
+ label {
34
+ display: flex;
35
+ flex-direction: column;
36
+ align-items: center;
37
+ padding: $default-padding;
38
+ transition: $default-transition;
39
+ cursor: pointer;
40
+ }
41
+ }
42
+
43
+ .label-text {
44
+ margin-bottom: 0;
45
+ align-self: flex-end;
32
46
  }
33
- }
34
-
35
- .label-text {
36
- margin-bottom: 0;
37
- align-self: flex-end;
38
47
  }
39
48
  }
40
49
 
@@ -1,24 +1,24 @@
1
1
  module.exports = {
2
- extends: [
2
+ extends:[
3
3
  'stylelint-config-palantir',
4
4
  'stylelint-config-palantir/sass.js',
5
5
  ],
6
- rules: {
7
- indentation: 2,
8
- 'number-leading-zero': 'never',
9
- 'at-rule-no-unknown': [true,
6
+ rules:{
7
+ indentation :2,
8
+ 'number-leading-zero':'never',
9
+ 'at-rule-no-unknown' :[true,
10
10
  {
11
- ignoreAtRules: [
11
+ ignoreAtRules:[
12
12
  // additional scss at-rules:
13
13
  'content', 'each', 'else', 'error', 'extend', 'for', 'function', 'if', 'include', 'mixin', 'return', 'use', 'forward',
14
14
  ],
15
15
  },
16
16
  ],
17
- 'at-rule-empty-line-before': ['always', {
18
- except: ['after-same-name', 'inside-block'],
19
- ignoreAtRules: ['include', 'mixin', 'function'],
17
+ 'at-rule-empty-line-before':['always', {
18
+ except :['after-same-name', 'inside-block'],
19
+ ignoreAtRules:['include', 'mixin', 'function'],
20
20
  }],
21
- 'order/order': [
21
+ 'order/order':[
22
22
  [
23
23
  'custom-properties',
24
24
  'at-variables',
@@ -34,12 +34,12 @@ module.exports = {
34
34
  ],
35
35
  { unspecified: 'ignore' },
36
36
  ],
37
- 'property-no-unknown': [
37
+ 'property-no-unknown':[
38
38
  true,
39
39
  {
40
- ignoreProperties: ['text-stroke', 'font-smooth'],
40
+ ignoreProperties:['text-stroke', 'font-smooth'],
41
41
  },
42
42
  ],
43
- 'max-nesting-depth': 5,
43
+ 'max-nesting-depth':5,
44
44
  },
45
45
  }