@platformatic/ui-components 0.5.0 → 0.5.1

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 (42) hide show
  1. package/dist/assets/index-hLMQmMDJ.js +40 -0
  2. package/dist/index.html +1 -1
  3. package/package.json +1 -1
  4. package/src/components/DropDown.jsx +10 -26
  5. package/src/components/FollowUs.jsx +18 -27
  6. package/src/components/InfoBox.jsx +8 -10
  7. package/src/components/ListElement.jsx +9 -11
  8. package/src/components/LoadingSpinner.jsx +1 -5
  9. package/src/components/LogoDropDown.jsx +7 -8
  10. package/src/components/ModalDirectional.jsx +9 -19
  11. package/src/components/ModalStepsForward.jsx +12 -24
  12. package/src/components/SearchBarV2.jsx +9 -22
  13. package/src/components/Sidebar.jsx +12 -26
  14. package/src/components/Status.jsx +5 -7
  15. package/src/components/TextWithLabel.jsx +7 -9
  16. package/src/components/Tooltip.jsx +8 -19
  17. package/src/components/TooltipAbsolute.jsx +10 -22
  18. package/src/components/VerticalSeparator.jsx +0 -4
  19. package/src/components/forms/Field.jsx +8 -19
  20. package/src/components/forms/Input.jsx +17 -37
  21. package/src/components/forms/InputWithSeparator.jsx +14 -31
  22. package/src/components/forms/Password.jsx +10 -18
  23. package/src/components/forms/Preview.jsx +10 -12
  24. package/src/components/forms/RadioGroup.jsx +9 -17
  25. package/src/components/forms/Select.jsx +19 -40
  26. package/src/components/forms/SelectWithInput.jsx +22 -46
  27. package/src/components/forms/TextArea.jsx +11 -25
  28. package/src/components/forms/ToggleSwitch.jsx +8 -19
  29. package/src/components/icons/BranchIcon.jsx +102 -0
  30. package/src/components/icons/DeploymentHistoryIcon.jsx +118 -0
  31. package/src/components/icons/FailureRateIcon.jsx +104 -0
  32. package/src/components/icons/K8SMetricsIcon.jsx +106 -0
  33. package/src/components/icons/MetricsLogsIcon.jsx +124 -0
  34. package/src/components/icons/NodeJSMetricsIcon.jsx +106 -0
  35. package/src/components/icons/NotCompliantServiceIcon.jsx +103 -0
  36. package/src/components/icons/OtherLogosGoogleIcon.jsx +69 -0
  37. package/src/components/icons/OutdatedServiceIcon.jsx +105 -0
  38. package/src/components/icons/ResourceIcon.jsx +111 -0
  39. package/src/components/icons/ZoomInIcon.jsx +99 -0
  40. package/src/components/icons/ZoomOutIcon.jsx +96 -0
  41. package/src/components/icons/index.js +25 -2
  42. package/dist/assets/index-BHLxMHb5.js +0 -40
@@ -7,23 +7,23 @@ import PlatformaticIcon from '../PlatformaticIcon'
7
7
  import { ERROR_RED, MAIN_DARK_BLUE, MAIN_GREEN, RICH_BLACK, TRANSPARENT, WHITE } from '../constants'
8
8
 
9
9
  function Input ({
10
- placeholder,
11
- value,
12
- name,
13
- borderColor,
14
- errorMessage,
15
- errorMessageTextClassName,
16
- onChange,
17
- disabled,
18
- beforeIcon,
19
- afterIcon,
20
- placeholderApart,
21
- backgroundColor,
22
- inputTextClassName,
23
- verticalPaddingClassName,
24
- dataAttrName,
25
- dataAttrValue,
26
- readOnly
10
+ placeholder = '',
11
+ value = '',
12
+ name = '',
13
+ borderColor = MAIN_GREEN,
14
+ errorMessage = '',
15
+ errorMessageTextClassName = '',
16
+ onChange = () => {},
17
+ disabled = false,
18
+ beforeIcon = null,
19
+ afterIcon = null,
20
+ placeholderApart = '',
21
+ backgroundColor = WHITE,
22
+ inputTextClassName = '',
23
+ verticalPaddingClassName = '',
24
+ dataAttrName = '',
25
+ dataAttrValue = '',
26
+ readOnly = false
27
27
  }) {
28
28
  let baseInputClassName = `${commonStyles.fullWidth} ${styles.input} ${inputTextClassName} `
29
29
  baseInputClassName += verticalPaddingClassName || ` ${styles.inputDefaultVerticalPadding} `
@@ -169,24 +169,4 @@ Input.propTypes = {
169
169
  errorMessageTextClassName: PropTypes.string
170
170
  }
171
171
 
172
- Input.defaultProps = {
173
- placeholder: '',
174
- value: '',
175
- name: '',
176
- borderColor: MAIN_GREEN,
177
- backgroundColor: WHITE,
178
- errorMessage: '',
179
- errorMessageTextClassName: '',
180
- onChange: () => {},
181
- disabled: false,
182
- beforeIcon: null,
183
- afterIcon: null,
184
- shadowPlaceholder: false,
185
- inputTextClassName: '',
186
- verticalPaddingClassName: '',
187
- dataAttrName: '',
188
- dataAttrValue: '',
189
- readOnly: false
190
- }
191
-
192
172
  export default Input
@@ -9,20 +9,20 @@ import BorderedBox from '../BorderedBox'
9
9
  import ButtonFullRounded from '../ButtonFullRounded'
10
10
 
11
11
  function InputWithSeparator ({
12
- placeholder,
13
- name,
14
- borderColor,
15
- backgroundColor,
16
- errorMessage,
17
- errorMessageTextClassName,
18
- onChange,
19
- disabled,
20
- afterIcon,
21
- defaultValue,
22
- defaultValueSeparator,
23
- value,
24
- separators,
25
- inputTextClassName
12
+ placeholder = '',
13
+ name = '',
14
+ value = '',
15
+ borderColor = MAIN_GREEN,
16
+ backgroundColor = WHITE,
17
+ errorMessage = '',
18
+ errorMessageTextClassName = '',
19
+ onChange = () => {},
20
+ disabled = false,
21
+ afterIcon = null,
22
+ defaultValue = '',
23
+ defaultValueSeparator = ',',
24
+ separators = [''],
25
+ inputTextClassName = ''
26
26
  }) {
27
27
  const showError = errorMessage.length > 0
28
28
  const [focus, setFocus] = useState(false)
@@ -235,21 +235,4 @@ InputWithSeparator.propTypes = {
235
235
  errorMessageTextClassName: PropTypes.string
236
236
  }
237
237
 
238
- InputWithSeparator.defaultProps = {
239
- placeholder: '',
240
- value: '',
241
- defaultValue: '',
242
- defaultValueSeparator: ',',
243
- name: '',
244
- borderColor: MAIN_GREEN,
245
- backgroundColor: WHITE,
246
- errorMessage: '',
247
- errorMessageTextClassName: '',
248
- onChange: () => {},
249
- disabled: false,
250
- afterIcon: null,
251
- separators: [''],
252
- inputTextClassName: ''
253
- }
254
-
255
238
  export default InputWithSeparator
@@ -6,7 +6,16 @@ import commonStyles from '../Common.module.css'
6
6
  import PlatformaticIcon from '../PlatformaticIcon'
7
7
  import { MAIN_DARK_BLUE, MAIN_GREEN } from '../constants'
8
8
 
9
- function Input ({ placeholder, value, name, borderColor, errorMessage, errorMessageTextClassName, onChange, disabled }) {
9
+ function Input ({
10
+ placeholder = '',
11
+ value = '',
12
+ name = '',
13
+ borderColor = MAIN_DARK_BLUE,
14
+ errorMessage = '',
15
+ errorMessageTextClassName = '',
16
+ onChange = () => {},
17
+ disabled = false
18
+ }) {
10
19
  const [type, setType] = useState('password')
11
20
  let passwordClassName = `${commonStyles.fullWidth} ${styles.password} `
12
21
  passwordClassName += commonStyles[`bordered--${borderColor}`] + ' ' + commonStyles[`text--${borderColor}`] + ' ' + styles.afterIconPadding
@@ -55,10 +64,6 @@ Input.propTypes = {
55
64
  * Disabled
56
65
  */
57
66
  disabled: PropTypes.bool,
58
- /**
59
- * addFocus
60
- */
61
- focused: PropTypes.bool,
62
67
  /**
63
68
  * placeholderApart
64
69
  */
@@ -73,17 +78,4 @@ Input.propTypes = {
73
78
  errorMessageTextClassName: PropTypes.string
74
79
  }
75
80
 
76
- Input.defaultProps = {
77
- placeholder: '',
78
- value: '',
79
- name: '',
80
- borderColor: MAIN_DARK_BLUE,
81
- errorMessage: '',
82
- errorMessageTextClassName: '',
83
- onChange: () => {},
84
- disabled: false,
85
- focused: false,
86
- shadowPlaceholder: false
87
- }
88
-
89
81
  export default Input
@@ -20,7 +20,16 @@ function renderParagraph (value, useCopyAndPaste, copyAndPaste, usePlatformaticI
20
20
  </>
21
21
  )
22
22
  }
23
- function Preview ({ title, value, isLink, children, useCopyAndPaste, copyAndPaste, usePlatformaticIcon, platformaticIcon }) {
23
+ function Preview ({
24
+ title = '',
25
+ value = '',
26
+ isLink = false,
27
+ children = null,
28
+ useCopyAndPaste = false,
29
+ copyAndPaste = null,
30
+ platformaticIcon = null,
31
+ usePlatformaticIcon = false
32
+ }) {
24
33
  return (
25
34
  <>
26
35
  <div className={styles.container}>
@@ -81,15 +90,4 @@ Preview.propTypes = {
81
90
  })
82
91
  }
83
92
 
84
- Preview.defaultProps = {
85
- title: '',
86
- value: '',
87
- isLink: false,
88
- children: null,
89
- useCopyAndPaste: false,
90
- copyAndPaste: null,
91
- platformaticIcon: null,
92
- usePlatformaticIcon: false
93
- }
94
-
95
93
  export default Preview
@@ -3,9 +3,16 @@ import React from 'react'
3
3
  import PropTypes from 'prop-types'
4
4
  import styles from './RadioGroup.module.css'
5
5
  import commonStyles from '../Common.module.css'
6
- import { MAIN_DARK_BLUE, MAIN_GREEN } from '../constants'
7
6
 
8
- function RadioGroup ({ name, radios, errorMessage, errorMessageTextClassName, onChange, disabled, value }) {
7
+ function RadioGroup ({
8
+ name = '',
9
+ radios = [],
10
+ errorMessage = '',
11
+ errorMessageTextClassName = '',
12
+ onChange = () => {},
13
+ disabled = false,
14
+ value = ''
15
+ }) {
9
16
  let radioContainerClass = styles.radioContainer
10
17
  const errorMessageClassName = errorMessageTextClassName || commonStyles['error-message']
11
18
 
@@ -55,25 +62,10 @@ RadioGroup.propTypes = {
55
62
  * Disabled
56
63
  */
57
64
  disabled: PropTypes.bool,
58
- /**
59
- * color
60
- */
61
- color: PropTypes.oneOf([MAIN_GREEN, MAIN_DARK_BLUE]),
62
65
  /**
63
66
  * value
64
67
  */
65
68
  value: PropTypes.string
66
69
  }
67
70
 
68
- RadioGroup.defaultProps = {
69
- name: '',
70
- radios: [],
71
- errorMessage: '',
72
- errorMessageTextClassName: '',
73
- onChange: () => {},
74
- disabled: false,
75
- color: MAIN_DARK_BLUE,
76
- value: ''
77
- }
78
-
79
71
  export default RadioGroup
@@ -7,24 +7,25 @@ import { MAIN_DARK_BLUE, MAIN_GREEN, RICH_BLACK, SMALL, WHITE } from '../constan
7
7
  import PlatformaticIcon from '../PlatformaticIcon'
8
8
 
9
9
  function Select ({
10
- defaultContainerClassName,
11
- placeholder,
12
- name,
13
- value,
14
- options,
15
- defaultOptionsClassName,
16
- optionsBorderedBottom,
17
- borderColor,
18
- borderListColor,
19
- errorMessage,
20
- errorMessageTextClassName,
21
- onSelect,
22
- disabled,
23
- mainColor,
24
- dataAttrName,
25
- dataAttrValue,
26
- backgroundColor,
27
- inputTextClassName
10
+ defaultContainerClassName = '',
11
+ placeholder = 'this is the default',
12
+ name = '',
13
+ value = '',
14
+ id = '',
15
+ options = [],
16
+ defaultOptionsClassName = '',
17
+ optionsBorderedBottom = true,
18
+ borderColor = MAIN_GREEN,
19
+ borderListColor = '',
20
+ errorMessage = '',
21
+ errorMessageTextClassName = '',
22
+ onSelect = () => {},
23
+ disabled = false,
24
+ mainColor = MAIN_DARK_BLUE,
25
+ dataAttrName = '',
26
+ dataAttrValue = '',
27
+ backgroundColor = WHITE,
28
+ inputTextClassName = ''
28
29
  }) {
29
30
  const inputRef = useRef()
30
31
  const [showOptions, setShowOptions] = useState(false)
@@ -262,26 +263,4 @@ Select.propTypes = {
262
263
  errorMessageTextClassName: PropTypes.string
263
264
  }
264
265
 
265
- Select.defaultProps = {
266
- defaultContainerClassName: '',
267
- placeholder: 'this is the default',
268
- name: '',
269
- value: '',
270
- id: '',
271
- options: [],
272
- defaultOptionsClassName: '',
273
- optionsBorderedBottom: true,
274
- borderColor: MAIN_GREEN,
275
- borderListColor: '',
276
- errorMessage: '',
277
- errorMessageTextClassName: '',
278
- onSelect: () => {},
279
- disabled: false,
280
- mainColor: MAIN_DARK_BLUE,
281
- dataAttrName: '',
282
- dataAttrValue: '',
283
- backgroundColor: WHITE,
284
- inputTextClassName: ''
285
- }
286
-
287
266
  export default Select
@@ -7,27 +7,28 @@ import { MAIN_DARK_BLUE, MAIN_GREEN, RICH_BLACK, SMALL, WHITE } from '../constan
7
7
  import PlatformaticIcon from '../PlatformaticIcon'
8
8
 
9
9
  function SelectWithInput ({
10
- defaultContainerClassName,
11
- placeholder,
12
- name,
13
- value,
14
- options,
15
- defaultOptionsClassName,
16
- optionsBorderedBottom,
17
- borderColor,
18
- borderListColor,
19
- errorMessage,
20
- errorMessageTextClassName,
21
- onChange,
22
- onSelect,
23
- onClear,
24
- disabled,
25
- mainColor,
26
- optionSelected,
27
- dataAttrName,
28
- dataAttrValue,
29
- backgroundColor,
30
- inputTextClassName
10
+ defaultContainerClassName = '',
11
+ placeholder = 'this is the default',
12
+ name = '',
13
+ value = '',
14
+ id = '',
15
+ options = [],
16
+ defaultOptionsClassName = '',
17
+ optionsBorderedBottom = true,
18
+ borderColor = MAIN_GREEN,
19
+ borderListColor = '',
20
+ errorMessage = '',
21
+ errorMessageTextClassName = '',
22
+ onChange = () => {},
23
+ onSelect = () => {},
24
+ onClear = () => {},
25
+ disabled = false,
26
+ mainColor = MAIN_DARK_BLUE,
27
+ optionSelected = null,
28
+ dataAttrName = '',
29
+ dataAttrValue = '',
30
+ backgroundColor = WHITE,
31
+ inputTextClassName = ''
31
32
  }) {
32
33
  const inputRef = useRef()
33
34
  const [showOptions, setShowOptions] = useState(false)
@@ -309,29 +310,4 @@ SelectWithInput.propTypes = {
309
310
  errorMessageTextClassName: PropTypes.string
310
311
  }
311
312
 
312
- SelectWithInput.defaultProps = {
313
- defaultContainerClassName: '',
314
- placeholder: 'this is the default',
315
- name: '',
316
- value: '',
317
- id: '',
318
- options: [],
319
- defaultOptionsClassName: '',
320
- optionsBorderedBottom: true,
321
- borderColor: MAIN_GREEN,
322
- borderListColor: '',
323
- errorMessage: '',
324
- errorMessageTextClassName: '',
325
- onChange: () => {},
326
- onSelect: () => {},
327
- onClear: () => {},
328
- disabled: false,
329
- mainColor: MAIN_DARK_BLUE,
330
- optionSelected: null,
331
- dataAttrName: '',
332
- dataAttrValue: '',
333
- backgroundColor: WHITE,
334
- inputTextClassName: ''
335
- }
336
-
337
313
  export default SelectWithInput
@@ -7,17 +7,17 @@ import PlatformaticIcon from '../PlatformaticIcon'
7
7
  import { MAIN_DARK_BLUE, MAIN_GREEN } from '../constants'
8
8
 
9
9
  function TextArea ({
10
- placeholder,
11
- value,
12
- name,
13
- borderColor,
14
- errorMessage,
15
- errorMessageTextClassName,
16
- onChange,
17
- disabled,
18
- afterIcon,
19
- rows,
20
- cols
10
+ placeholder = '',
11
+ value = '',
12
+ name = '',
13
+ borderColor = MAIN_DARK_BLUE,
14
+ errorMessage = '',
15
+ errorMessageTextClassName = '',
16
+ onChange = () => {},
17
+ disabled = false,
18
+ afterIcon = null,
19
+ rows = 5,
20
+ cols = 20
21
21
  }) {
22
22
  let className = styles.textAreaContainer + ' ' + commonStyles[`bordered--${borderColor}`] + ' ' + commonStyles[`text--${borderColor}`]
23
23
  const showError = errorMessage.length > 0
@@ -88,18 +88,4 @@ TextArea.propTypes = {
88
88
  errorMessageTextClassName: PropTypes.string
89
89
  }
90
90
 
91
- TextArea.defaultProps = {
92
- placeholder: '',
93
- value: '',
94
- name: '',
95
- borderColor: MAIN_DARK_BLUE,
96
- errorMessage: '',
97
- errorMessageTextClassName: '',
98
- onChange: () => {},
99
- disabled: false,
100
- afterIcon: null,
101
- rows: 5,
102
- cols: 20
103
- }
104
-
105
91
  export default TextArea
@@ -5,14 +5,14 @@ import styles from './ToggleSwitch.module.css'
5
5
  import commonStyles from '../Common.module.css'
6
6
 
7
7
  function ToggleSwitch ({
8
- name,
9
- label,
10
- labelClassName,
11
- errorMessage,
12
- errorMessageTextClassName,
13
- onChange,
14
- checked,
15
- disabled
8
+ name = '',
9
+ label = '',
10
+ labelClassName = '',
11
+ errorMessage = '',
12
+ errorMessageTextClassName = '',
13
+ onChange = () => {},
14
+ checked = false,
15
+ disabled = false
16
16
  }) {
17
17
  let className = `${styles.switch} `
18
18
  if (disabled) className += styles.disabled
@@ -69,15 +69,4 @@ ToggleSwitch.propTypes = {
69
69
 
70
70
  }
71
71
 
72
- ToggleSwitch.defaultProps = {
73
- name: '',
74
- label: '',
75
- errorMessage: '',
76
- errorMessageTextClassName: '',
77
- checked: false,
78
- disabled: false,
79
- onChange: () => {},
80
- labelClassName: ''
81
- }
82
-
83
72
  export default ToggleSwitch
@@ -0,0 +1,102 @@
1
+ import * as React from 'react'
2
+ import PropTypes from 'prop-types'
3
+ import styles from './Icons.module.css'
4
+ import { COLORS_ICON, SIZES, SMALL, MEDIUM, LARGE, MAIN_DARK_BLUE } from '../constants'
5
+
6
+ const BranchIcon = ({
7
+ color = MAIN_DARK_BLUE,
8
+ size = MEDIUM,
9
+ disabled = false,
10
+ inactive = false
11
+ }) => {
12
+ let className = `${styles.svgClassName} ` + styles[`${color}`]
13
+ if (disabled) {
14
+ className += ` ${styles.iconDisabled}`
15
+ }
16
+ if (inactive) {
17
+ className += ` ${styles.iconInactive}`
18
+ }
19
+ let icon = <></>
20
+
21
+ switch (size) {
22
+ case SMALL:
23
+ icon = (
24
+ <svg
25
+ width={16}
26
+ height={16}
27
+ viewBox='0 0 16 16'
28
+ fill='none'
29
+ xmlns='http://www.w3.org/2000/svg'
30
+ className={className}
31
+ >
32
+ <circle cx='3.8001' cy='4.8' r='1.8' transform='rotate(90 3.8001 4.8)' stroke='none' />
33
+ <circle cx='12.2' cy='4.8' r='1.8' transform='rotate(90 12.2 4.8)' stroke='none' />
34
+ <line x1='10.3999' y1='4.69995' x2='5.5999' y2='4.69995' stroke='none' />
35
+ <circle cx='11.8001' cy='10.8' r='1.8' transform='rotate(90 11.8001 10.8)' stroke='none' />
36
+ <path d='M6 5V5C7.10457 5 8 5.89543 8 7L8 9C8 10.1046 8.89543 11 10 11V11' stroke='none' strokeLinecap='round' strokeLinejoin='round' />
37
+ </svg>
38
+ )
39
+ break
40
+ case MEDIUM:
41
+ icon = (
42
+ <svg
43
+ width={24}
44
+ height={24}
45
+ viewBox='0 0 24 24'
46
+ fill='none'
47
+ xmlns='http://www.w3.org/2000/svg'
48
+ className={className}
49
+ >
50
+ <circle cx='5.6999' cy='7.2' r='2.7' transform='rotate(90 5.6999 7.2)' stroke='none' strokeWidth={1.5} />
51
+ <circle cx='18.3' cy='7.2' r='2.7' transform='rotate(90 18.3 7.2)' stroke='none' strokeWidth={1.5} />
52
+ <line x1='15.6001' y1='7.05005' x2='8.4001' y2='7.05005' stroke='none' strokeWidth={1.5} />
53
+ <circle cx='17.6999' cy='16.1999' r='2.7' transform='rotate(90 17.6999 16.1999)' stroke='none' strokeWidth={1.5} />
54
+ <path d='M8.99951 7.49988V7.49988C10.6564 7.49988 11.9995 8.84303 11.9995 10.4999L11.9995 13.4999C11.9995 15.1567 13.3427 16.4999 14.9995 16.4999V16.4999' stroke='none' strokeWidth={1.5} strokeLinecap='round' strokeLinejoin='round' />
55
+ </svg>
56
+ )
57
+ break
58
+ case LARGE:
59
+ icon = (
60
+ <svg
61
+ width={40}
62
+ height={40}
63
+ viewBox='0 0 40 40'
64
+ fill='none'
65
+ xmlns='http://www.w3.org/2000/svg'
66
+ className={className}
67
+ >
68
+ <circle cx='9.5' cy='12' r='4.5' transform='rotate(90 9.5 12)' stroke='none' strokeWidth={2} />
69
+ <circle cx='30.5' cy='12' r='4.5' transform='rotate(90 30.5 12)' stroke='none' strokeWidth={2} />
70
+ <line x1='26' y1='11.5' x2='14' y2='11.5' stroke='none' strokeWidth={2} />
71
+ <circle cx='29.5' cy='26.9999' r='4.5' transform='rotate(90 29.5 26.9999)' stroke='none' strokeWidth={2} />
72
+ <path d='M14.9995 12.4999V12.4999C17.7609 12.4999 19.9995 14.7385 19.9995 17.4999L19.9995 22.4999C19.9995 25.2613 22.2381 27.4999 24.9995 27.4999V27.4999' stroke='none' strokeWidth={2} strokeLinecap='round' strokeLinejoin='round' />
73
+ </svg>
74
+ )
75
+ break
76
+
77
+ default:
78
+ break
79
+ }
80
+ return icon
81
+ }
82
+
83
+ BranchIcon.propTypes = {
84
+ /**
85
+ * color of text, icon and borders
86
+ */
87
+ color: PropTypes.oneOf(COLORS_ICON),
88
+ /**
89
+ * Size
90
+ */
91
+ size: PropTypes.oneOf(SIZES),
92
+ /**
93
+ * disabled
94
+ */
95
+ disabled: PropTypes.bool,
96
+ /**
97
+ * inactive
98
+ */
99
+ inactive: PropTypes.bool
100
+ }
101
+
102
+ export default BranchIcon