@pareto-engineering/design-system 2.0.0-alpha.55 → 2.0.0-alpha.57

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/Alert/Alert.js +141 -0
  2. package/dist/cjs/a/Alert/index.js +15 -0
  3. package/dist/cjs/a/Alert/styles.scss +74 -0
  4. package/dist/cjs/a/index.js +9 -1
  5. package/dist/cjs/f/fields/IntlTelInput/IntlTelInput.js +170 -0
  6. package/dist/cjs/f/fields/IntlTelInput/index.js +15 -0
  7. package/dist/cjs/f/fields/IntlTelInput/styles.scss +37 -0
  8. package/dist/cjs/f/fields/PhoneIntlTelInput/PhoneIntlTelInput.js +180 -0
  9. package/dist/cjs/f/fields/PhoneIntlTelInput/index.js +15 -0
  10. package/dist/cjs/f/fields/PhoneIntlTelInput/styles.scss +43 -0
  11. package/dist/cjs/f/fields/QueryCombobox/QueryCombobox.js +2 -1
  12. package/dist/cjs/f/fields/QueryCombobox/common/Combobox/Combobox.js +10 -3
  13. package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +10 -3
  14. package/dist/es/a/Alert/Alert.js +118 -0
  15. package/dist/es/a/Alert/index.js +2 -0
  16. package/dist/es/a/Alert/styles.scss +74 -0
  17. package/dist/es/a/index.js +2 -1
  18. package/dist/es/f/fields/IntlTelInput/IntlTelInput.js +152 -0
  19. package/dist/es/f/fields/IntlTelInput/index.js +2 -0
  20. package/dist/es/f/fields/IntlTelInput/styles.scss +37 -0
  21. package/dist/es/f/fields/PhoneIntlTelInput/PhoneIntlTelInput.js +163 -0
  22. package/dist/es/f/fields/PhoneIntlTelInput/index.js +2 -0
  23. package/dist/es/f/fields/PhoneIntlTelInput/styles.scss +43 -0
  24. package/dist/es/f/fields/QueryCombobox/QueryCombobox.js +2 -1
  25. package/dist/es/f/fields/QueryCombobox/common/Combobox/Combobox.js +10 -3
  26. package/dist/es/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +10 -3
  27. package/package.json +2 -2
  28. package/src/__snapshots__/Storyshots.test.js.snap +330 -26
  29. package/src/stories/a/Alert.stories.jsx +75 -0
  30. package/src/stories/a/DotInfo.stories.jsx +2 -1
  31. package/src/stories/a/ProgressBar.stories.jsx +4 -1
  32. package/src/stories/a/Timestamp.stories.jsx +3 -1
  33. package/src/stories/b/Logo.stories.jsx +2 -1
  34. package/src/stories/b/QuestionDropdown.stories.jsx +3 -0
  35. package/src/stories/b/SocialMediaButton.stories.jsx +2 -1
  36. package/src/stories/b/Title.stories.jsx +2 -2
  37. package/src/stories/c/ContentSlides.stories.jsx +3 -1
  38. package/src/stories/c/Shortener.stories.jsx +9 -3
  39. package/src/stories/c/SocialMediaShareButton.stories.jsx +14 -6
  40. package/src/stories/f/ChoicesInput.stories.jsx +4 -1
  41. package/src/stories/f/Description.stories.jsx +11 -3
  42. package/src/stories/f/QueryCombobox.stories.jsx +7 -3
  43. package/src/stories/f/QuerySelect.stories.jsx +2 -1
  44. package/src/stories/f/RatingsInput.stories.jsx +8 -1
  45. package/src/stories/f/SelectInput.stories.jsx +2 -1
  46. package/src/stories/f/TextInput.stories.jsx +7 -1
  47. package/src/stories/f/TextareaInput.stories.jsx +6 -1
  48. package/src/ui/a/Alert/Alert.jsx +144 -0
  49. package/src/ui/a/Alert/index.js +2 -0
  50. package/src/ui/a/Alert/styles.scss +74 -0
  51. package/src/ui/a/index.js +1 -0
  52. package/src/ui/f/fields/QueryCombobox/QueryCombobox.jsx +1 -0
  53. package/src/ui/f/fields/QueryCombobox/common/Combobox/Combobox.jsx +7 -1
  54. package/src/ui/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.jsx +6 -0
@@ -13,8 +13,8 @@ export default {
13
13
  // storyfn => <div className="">{ storyfn() }</div>,
14
14
  ],
15
15
  argTypes:{
16
- // heading :{ control: 'string' },
17
- // subtitle:{ control: 'string' },
16
+ heading :{ control: 'text' },
17
+ subtitle:{ control: 'text' },
18
18
  },
19
19
  }
20
20
 
@@ -38,7 +38,9 @@ export default {
38
38
  ),
39
39
  ],
40
40
  argTypes:{
41
- backgroundColor:{ control: 'color' },
41
+ // backgroundColor:{ control: 'color' },
42
+ isSimple :{ control: 'boolean' },
43
+ hasBackgroundShape:{ control: 'boolean' },
42
44
  },
43
45
  }
44
46
 
@@ -13,16 +13,22 @@ export default {
13
13
  // storyfn => <div className="">{ storyfn() }</div>,
14
14
  ],
15
15
  argTypes:{
16
- backgroundColor:{ control: 'color' },
16
+ // backgroundColor:{ control: 'color' },
17
+ // limit:{ control: 'number' },
17
18
  },
18
19
  }
19
20
 
20
- export const Base = () => (
21
+ const Template = (args) => (
21
22
  <Shortener
22
- limit={10}
23
23
  style={{ maxWidth: '300px' }}
24
+ {...args}
24
25
  >
25
26
  Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
26
27
  incididunt ut labore et dolore magna aliqua.
27
28
  </Shortener>
28
29
  )
30
+
31
+ export const Base = Template.bind({})
32
+ Base.args = {
33
+ limit:10,
34
+ }
@@ -13,13 +13,21 @@ export default {
13
13
  (storyfn) => <Router>{storyfn()}</Router>,
14
14
  ],
15
15
  argTypes:{
16
- backgroundColor:{ control: 'color' },
16
+ // backgroundColor:{ control: 'color' },
17
+ type:{ control: 'select', options: ['twitter', 'facebook'] },
17
18
  },
18
19
  }
19
20
 
20
- export const Base = () => (
21
- <div>
22
- <SocialMediaShareButton type="facebook" />
23
- <SocialMediaShareButton type="twitter" />
24
- </div>
21
+ const Template = (args) => (
22
+ <SocialMediaShareButton {...args} />
25
23
  )
24
+
25
+ export const Facebook = Template.bind({})
26
+ Facebook.args = {
27
+ type:'facebook',
28
+ }
29
+
30
+ export const Twitter = Template.bind({})
31
+ Twitter.args = {
32
+ type:'twitter',
33
+ }
@@ -22,7 +22,10 @@ export default {
22
22
  ),
23
23
  ],
24
24
  argTypes:{
25
- backgroundColor:{ control: 'color' },
25
+ // backgroundColor:{ control: 'color' },
26
+ multiple :{ control: 'boolean' },
27
+ gridColumnsDesktop:{ control: 'number' },
28
+ disabled :{ control: 'boolean' },
26
29
  },
27
30
  }
28
31
 
@@ -23,10 +23,18 @@ export default {
23
23
  ),
24
24
  ],
25
25
  argTypes:{
26
- backgroundColor:{ control: 'color' },
26
+ // backgroundColor:{ control: 'color' },
27
+ description:{ control: 'text' },
28
+ name :{ control: 'text' },
27
29
  },
28
30
  }
29
31
 
30
- export const Base = () => (
31
- <Description description="Sample Description" name="email" />
32
+ const Template = (args) => (
33
+ <Description {...args} />
32
34
  )
35
+
36
+ export const Base = Template.bind({})
37
+ Base.args = {
38
+ description:'Sample Description',
39
+ name :'email',
40
+ }
@@ -29,7 +29,9 @@ export default {
29
29
  ),
30
30
  ],
31
31
  argTypes:{
32
- backgroundColor:{ control: 'color' },
32
+ // backgroundColor:{ control: 'color' },
33
+ multiple:{ control: 'boolean' },
34
+ disabled:{ control: 'boolean' },
33
35
  },
34
36
  }
35
37
 
@@ -80,11 +82,13 @@ const FETCH_TEAMS_QUERY = graphql`
80
82
  `
81
83
 
82
84
  // eslint-disable-next-line react/prop-types
83
- const ResolvedTemplate = ({ multiple, defaultFormikState }) => {
85
+ const ResolvedTemplate = ({ defaultFormikState, ...otherProps }) => {
84
86
  mockRelayOperation(allTeamsMockData)
85
87
  mockRelayOperation(allTeamsMockData)
86
88
  mockRelayOperation(allTeamsMockData)
87
89
 
90
+ const { multiple } = otherProps
91
+
88
92
  const Content = () => {
89
93
  const name = multiple ? 'teams' : 'team'
90
94
 
@@ -128,8 +132,8 @@ const ResolvedTemplate = ({ multiple, defaultFormikState }) => {
128
132
  accessor:'allTeams',
129
133
  }}
130
134
  name={name}
131
- multiple={multiple}
132
135
  searchVariable="name_Icontains"
136
+ {...otherProps}
133
137
  />
134
138
  <div
135
139
  style={{
@@ -28,7 +28,8 @@ export default {
28
28
  ),
29
29
  ],
30
30
  argTypes:{
31
- backgroundColor:{ control: 'color' },
31
+ // backgroundColor:{ control: 'color' },
32
+ isLoading:{ control: 'boolean' },
32
33
  },
33
34
  }
34
35
  const statuses = [
@@ -23,7 +23,14 @@ export default {
23
23
  ),
24
24
  ],
25
25
  argTypes:{
26
- backgroundColor:{ control: 'color' },
26
+ // backgroundColor:{ control: 'color' },
27
+ ratingCount :{ control: 'number' },
28
+ name :{ control: 'text' },
29
+ label :{ control: 'text' },
30
+ showRatingValue :{ control: 'boolean' },
31
+ displayRatingsLabel:{ control: 'boolean' },
32
+ labelMax :{ control: 'text' },
33
+ labelMin :{ control: 'text' },
27
34
  },
28
35
  }
29
36
 
@@ -22,7 +22,8 @@ export default {
22
22
  ),
23
23
  ],
24
24
  argTypes:{
25
- backgroundColor:{ control: 'color' },
25
+ // backgroundColor:{ control: 'color' },
26
+ disabled:{ control: 'boolean' },
26
27
  },
27
28
  }
28
29
 
@@ -26,7 +26,13 @@ export default {
26
26
  ),
27
27
  ],
28
28
  argTypes:{
29
- backgroundColor:{ control: 'color' },
29
+ // backgroundColor:{ control: 'color' },
30
+ placeholder :{ control: 'text' },
31
+ autoComplete:{ control: 'select', options: ['off', 'on'] },
32
+ disabled :{ control: 'boolean' },
33
+ type :{ control: 'text' },
34
+ name :{ control: 'text' },
35
+ label :{ control: 'text' },
30
36
  },
31
37
  }
32
38
 
@@ -24,7 +24,12 @@ export default {
24
24
  ),
25
25
  ],
26
26
  argTypes:{
27
- backgroundColor:{ control: 'color' },
27
+ // backgroundColor:{ control: 'color' },
28
+ name :{ control: 'text' },
29
+ label :{ control: 'text' },
30
+ placeholder :{ control: 'text' },
31
+ disabled :{ control: 'boolean' },
32
+ labelAsDescription:{ control: 'boolean' },
28
33
  },
29
34
  }
30
35
 
@@ -0,0 +1,144 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ import * as React from 'react'
3
+
4
+ import { useState, useEffect, useLayoutEffect } from 'react'
5
+
6
+ import PropTypes from 'prop-types'
7
+
8
+ import { Button } from 'ui/b'
9
+
10
+ import styleNames from '@pareto-engineering/bem'
11
+
12
+ // Local Definitions
13
+
14
+ const baseClassName = styleNames.base
15
+
16
+ const componentClassName = 'alert'
17
+
18
+ /**
19
+ * This is the component description.
20
+ */
21
+ const Alert = ({
22
+ id,
23
+ className:userClassName,
24
+ style,
25
+ children,
26
+ type,
27
+ withCloseIcon,
28
+ primaryPosition,
29
+ secondaryPosition,
30
+ autoCloseMs,
31
+ width,
32
+ // ...otherProps
33
+ }) => {
34
+ useLayoutEffect(() => {
35
+ import('./styles.scss')
36
+ }, [])
37
+
38
+ const [hideAlert, setHideAlert] = useState(false)
39
+
40
+ const handleCloseAlert = () => setHideAlert(true)
41
+
42
+ useEffect(() => {
43
+ if (autoCloseMs) {
44
+ setTimeout(() => {
45
+ setHideAlert(true)
46
+ }, autoCloseMs)
47
+ }
48
+ }, [autoCloseMs])
49
+
50
+ return (
51
+ <div
52
+ id={id}
53
+ className={[
54
+
55
+ baseClassName,
56
+
57
+ componentClassName,
58
+ userClassName,
59
+ `x-${type}`,
60
+ hideAlert && 'hide',
61
+ primaryPosition,
62
+ secondaryPosition,
63
+ ]
64
+ .filter((e) => e)
65
+ .join(' ')}
66
+ style={{
67
+ ...style,
68
+ '--width':width,
69
+ }}
70
+ // {...otherProps}
71
+ >
72
+ <div className="bar" />
73
+ {withCloseIcon && (
74
+ <div className="close">
75
+ <Button isSimple color="heading" onClick={handleCloseAlert}>
76
+ <span className="f-icons">Y</span>
77
+ </Button>
78
+ </div>
79
+ )}
80
+ <div className="content">
81
+ {children}
82
+ </div>
83
+ </div>
84
+ )
85
+ }
86
+
87
+ Alert.propTypes = {
88
+ /**
89
+ * The HTML id for this element
90
+ */
91
+ id:PropTypes.string,
92
+
93
+ /**
94
+ * The HTML class names for this element
95
+ */
96
+ className:PropTypes.string,
97
+
98
+ /**
99
+ * The React-written, css properties for this element.
100
+ */
101
+ style:PropTypes.objectOf(PropTypes.string),
102
+
103
+ /**
104
+ * The children JSX
105
+ */
106
+ children:PropTypes.node,
107
+
108
+ /**
109
+ * Whether the alert should have a close Icon
110
+ */
111
+ withCloseIcon:PropTypes.bool,
112
+
113
+ /**
114
+ * The primary position of the alert
115
+ */
116
+ primaryPosition:PropTypes.oneOf(['top', 'bottom', 'center']),
117
+
118
+ /**
119
+ * The secondary position of the alert
120
+ */
121
+ secondaryPosition:PropTypes.oneOf(['left', 'right']),
122
+
123
+ /**
124
+ * The number milisseconds to wait for before closing the alert
125
+ */
126
+ autoCloseMs:PropTypes.number,
127
+
128
+ /**
129
+ * The type of the alert
130
+ */
131
+ type:PropTypes.oneOf(['success', 'warning', 'error']),
132
+
133
+ /**
134
+ * The width of the alert
135
+ */
136
+ width:PropTypes.number,
137
+ }
138
+
139
+ Alert.defaultProps = {
140
+ withCloseIcon :true,
141
+ primaryPosition:'top',
142
+ }
143
+
144
+ export default Alert
@@ -0,0 +1,2 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ export { default as Alert } from './Alert'
@@ -0,0 +1,74 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ @use "@pareto-engineering/bem";
3
+ @use "@aztlan/stylebook/src/mixins";
4
+ @use "@aztlan/stylebook/src/globals" as *;
5
+
6
+ $default-padding: 1em;
7
+ $default-bar-height: .3em;
8
+ $default-alert-desktop-width: var(--width, 30em);
9
+
10
+ .#{bem.$base}.alert {
11
+ border: var(--theme-border);
12
+ padding-bottom: $default-padding * 1.5;
13
+ width: 100%;
14
+ position: absolute;
15
+ z-index: 1;
16
+
17
+ &.center {
18
+ top: 50%;
19
+ left: 50%;
20
+ transform: translate(-50%, -50%);
21
+ }
22
+
23
+ &.top {
24
+ top: 0;
25
+ }
26
+
27
+ &.bottom {
28
+ bottom: 0;
29
+ }
30
+
31
+ &.right {
32
+ right: 0;
33
+ }
34
+
35
+ &.left {
36
+ left: 0;
37
+ }
38
+
39
+ &.hide {
40
+ display: none;
41
+ }
42
+
43
+ >.bar {
44
+ background-color: var(--x);
45
+ height: $default-bar-height;
46
+ }
47
+
48
+ >.close {
49
+ display: flex;
50
+ justify-content: flex-end;
51
+
52
+ span {
53
+ padding: $default-padding / 2;
54
+ font-size: calc(var(--s-2) * 1em);
55
+ }
56
+ }
57
+
58
+ .bar+.content {
59
+ padding-top: $default-padding * 1.5;
60
+ }
61
+
62
+ >.content {
63
+ padding-inline: $default-padding;
64
+
65
+ .icon {
66
+ color: var(--x)
67
+ }
68
+ }
69
+
70
+ // Desktop styles
71
+ @include mixins.media($from: $sm-md) {
72
+ width: $default-alert-desktop-width;
73
+ }
74
+ }
package/src/ui/a/index.js CHANGED
@@ -29,3 +29,4 @@ export { SnapScroller } from './SnapScroller'
29
29
  export { BackgroundGradient } from './BackgroundGradient'
30
30
  export { ContentTree } from './ContentTree'
31
31
  export { Popover } from './Popover'
32
+ export { Alert } from './Alert'
@@ -221,6 +221,7 @@ QueryCombobox.defaultProps = {
221
221
  searchVariable :'search',
222
222
  transformSearch:(search) => search,
223
223
  minLength :2,
224
+ disabled :false,
224
225
  }
225
226
 
226
227
  export default QueryCombobox
@@ -39,6 +39,7 @@ const Combobox = ({
39
39
  minLength,
40
40
  isFetching,
41
41
  transformSearch,
42
+ disabled,
42
43
  // ...otherProps
43
44
  }) => {
44
45
  const {
@@ -101,7 +102,7 @@ const Combobox = ({
101
102
  </FormLabel>
102
103
 
103
104
  <div {...getComboboxProps()} className="input-wrapper">
104
- <input {...getInputProps()} className="input" />
105
+ <input {...getInputProps()} className="input" disabled={disabled} />
105
106
  {isFetching && (
106
107
  <LoadingCircle className="x-main2" />
107
108
  )}
@@ -203,6 +204,11 @@ Combobox.propTypes = {
203
204
  * The function to transform the search input
204
205
  */
205
206
  transformSearch:PropTypes.func,
207
+
208
+ /**
209
+ * Whether the input filed shpuld be disabled
210
+ */
211
+ disabled:PropTypes.bool,
206
212
  }
207
213
 
208
214
  Combobox.defaultProps = {
@@ -52,6 +52,7 @@ const MultipleCombobox = ({
52
52
  isFetching,
53
53
  minLength,
54
54
  transformSearch,
55
+ disabled,
55
56
  // ...otherProps
56
57
  }) => {
57
58
  const [searchInputValue, setSearchInputValue] = useState('')
@@ -193,6 +194,7 @@ const MultipleCombobox = ({
193
194
  getDropdownProps({ preventKeyAction: isOpen }),
194
195
  )}
195
196
  className="input"
197
+ disabled={disabled}
196
198
  />
197
199
  {isFetching && (
198
200
  <LoadingCircle className="x-main2" />
@@ -299,6 +301,10 @@ MultipleCombobox.propTypes = {
299
301
  */
300
302
  transformSearch:PropTypes.func,
301
303
 
304
+ /**
305
+ * Whether the input filed shpuld be disabled
306
+ */
307
+ disabled:PropTypes.bool,
302
308
  }
303
309
 
304
310
  MultipleCombobox.defaultProps = {