@platformatic/ui-components 0.1.49 → 0.1.50
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.
- package/.github/workflows/ci.yml +26 -26
- package/.nvmrc +1 -1
- package/LICENSE +201 -201
- package/README.md +30 -30
- package/fonts/Montserrat/README.txt +81 -81
- package/index.html +12 -12
- package/index.js +71 -71
- package/package.json +76 -76
- package/postcss.config.cjs +8 -8
- package/public/api-icon-closed.svg +6 -6
- package/public/api-icon.svg +9 -9
- package/src/App.jsx +12 -12
- package/src/components/BorderedBox.jsx +18 -18
- package/src/components/BorderedBox.module.css +8 -8
- package/src/components/BorderedText.jsx +8 -8
- package/src/components/BorderedText.module.css +2 -2
- package/src/components/Box.jsx +14 -14
- package/src/components/Box.module.css +7 -7
- package/src/components/Button.jsx +95 -95
- package/src/components/Button.module.css +127 -127
- package/src/components/ButtonFullRounded.jsx +17 -17
- package/src/components/ButtonFullRounded.module.css +28 -28
- package/src/components/Checkbox.jsx +11 -11
- package/src/components/Checkbox.module.css +18 -18
- package/src/components/Common.module.css +28 -28
- package/src/components/DetailedMetric.jsx +32 -32
- package/src/components/DetailedMetric.module.css +2 -2
- package/src/components/DropDown.jsx +36 -36
- package/src/components/DropDown.module.css +27 -27
- package/src/components/FollowUs.jsx +35 -35
- package/src/components/FollowUs.module.css +11 -11
- package/src/components/GHLoginButton.jsx +14 -14
- package/src/components/HorizontalSeparator.jsx +15 -15
- package/src/components/HorizontalSeparator.module.css +26 -26
- package/src/components/InfoBox.jsx +50 -50
- package/src/components/InfoBox.module.css +5 -5
- package/src/components/List.jsx +20 -20
- package/src/components/List.module.css +11 -11
- package/src/components/ListElement.jsx +23 -23
- package/src/components/ListElement.module.css +23 -23
- package/src/components/Loadable.jsx +34 -34
- package/src/components/Loadable.module.css +13 -13
- package/src/components/Loader.jsx +22 -22
- package/src/components/Loader.module.css +13 -13
- package/src/components/LoginButton.jsx +17 -17
- package/src/components/LoginButton.module.css +7 -7
- package/src/components/LoginButton.test.jsx +25 -25
- package/src/components/Logo.jsx +62 -62
- package/src/components/Logo.module.css +5 -5
- package/src/components/Main.jsx +33 -33
- package/src/components/MetricValue.jsx +15 -15
- package/src/components/MetricValue.module.css +9 -9
- package/src/components/Modal.jsx +93 -93
- package/src/components/Modal.module.css +50 -50
- package/src/components/PlatformaticIcon.jsx +57 -57
- package/src/components/PlatformaticIcon.module.css +2 -2
- package/src/components/Playground.jsx +9 -9
- package/src/components/SearchBar.jsx +63 -63
- package/src/components/SearchBar.module.css +20 -20
- package/src/components/Sidebar.jsx +153 -153
- package/src/components/Sidebar.module.css +66 -66
- package/src/components/SimpleMetric.jsx +28 -28
- package/src/components/SimpleMetric.module.css +6 -6
- package/src/components/Status.jsx +26 -26
- package/src/components/TabbedWindow.jsx +39 -39
- package/src/components/TabbedWindow.module.css +16 -16
- package/src/components/TextWithLabel.jsx +11 -11
- package/src/components/TextWithLabel.module.css +8 -8
- package/src/components/Versions.jsx +9 -9
- package/src/components/VerticalSeparator.jsx +5 -5
- package/src/components/forms/Field.jsx +53 -20
- package/src/components/forms/Field.module.css +23 -17
- package/src/components/forms/Input.jsx +80 -80
- package/src/components/forms/Input.module.css +28 -28
- package/src/components/forms/Preview.jsx +75 -77
- package/src/components/forms/Preview.module.css +14 -14
- package/src/components/forms/ToggleSwitch.jsx +18 -18
- package/src/components/forms/ToggleSwitch.module.css +42 -42
- package/src/components/forms/index.js +8 -8
- package/src/components/icons/ApiEmptyIcon.jsx +107 -107
- package/src/components/icons/ApiIcon.jsx +29 -29
- package/src/components/icons/ApiIconClosed.jsx +19 -19
- package/src/components/icons/AppEmptyIcon.jsx +94 -94
- package/src/components/icons/AppIcon.jsx +38 -38
- package/src/components/icons/AppListIcon.jsx +73 -73
- package/src/components/icons/Calendar1Icon.jsx +54 -54
- package/src/components/icons/Calendar7Icon.jsx +55 -55
- package/src/components/icons/CalendarIcon.jsx +56 -56
- package/src/components/icons/CircleAddIcon.jsx +40 -40
- package/src/components/icons/CircleBackIcon.jsx +51 -51
- package/src/components/icons/CircleCheckMarkIcon.jsx +66 -0
- package/src/components/icons/CircleCloseHoverIcon.jsx +42 -42
- package/src/components/icons/CircleCloseIcon.jsx +32 -32
- package/src/components/icons/CircleExclamationIcon.jsx +29 -29
- package/src/components/icons/CloseIcon.jsx +31 -31
- package/src/components/icons/CopyIcon.jsx +75 -75
- package/src/components/icons/CreatedWorkspaceIcon.jsx +70 -70
- package/src/components/icons/DynamicWorkspaceIcon.jsx +125 -125
- package/src/components/icons/EditIcon.jsx +38 -38
- package/src/components/icons/GearIcon.jsx +40 -40
- package/src/components/icons/Icons.module.css +29 -29
- package/src/components/icons/LiveIcon.jsx +43 -43
- package/src/components/icons/MetricsIcon.jsx +52 -52
- package/src/components/icons/PlayIcon.jsx +20 -20
- package/src/components/icons/PullRequestIcon.jsx +35 -35
- package/src/components/icons/StaticWorkspaceIcon.jsx +119 -119
- package/src/components/icons/StopIcon.jsx +21 -21
- package/src/components/icons/TerminalIcon.jsx +22 -22
- package/src/components/icons/TriangleExclamationIcon.jsx +26 -26
- package/src/components/icons/UpgradeIcon.jsx +48 -48
- package/src/components/icons/index.js +63 -61
- package/src/components/layouts/Layout.jsx +11 -11
- package/src/components/layouts/TwoColumnsLayout.jsx +12 -12
- package/src/components/layouts/TwoColumnsLayout.module.css +9 -9
- package/src/hooks/useEscapeKey.js +20 -20
- package/src/lib/utils.js +23 -23
- package/src/main.jsx +9 -9
- package/src/stories/BorderedBox.stories.jsx +33 -33
- package/src/stories/BorderedText.stories.jsx +24 -24
- package/src/stories/Button.stories.jsx +114 -114
- package/src/stories/ButtonFullRounded.stories.jsx +61 -61
- package/src/stories/Checkbox.stories.jsx +27 -27
- package/src/stories/DetailedMetric.stories.jsx +33 -33
- package/src/stories/DropDown.stories.jsx +62 -62
- package/src/stories/FollowUs.stories.jsx +14 -14
- package/src/stories/GHLoginButton.stories.jsx +14 -14
- package/src/stories/HorizontalSeparator.stories.jsx +12 -12
- package/src/stories/InfoBox.stories.jsx +46 -46
- package/src/stories/Introduction.stories.mdx +211 -211
- package/src/stories/List.stories.jsx +29 -29
- package/src/stories/ListElement.stories.jsx +15 -15
- package/src/stories/Loadable.stories.jsx +75 -75
- package/src/stories/Loader.stories.jsx +44 -44
- package/src/stories/LoginButton.stories.jsx +15 -15
- package/src/stories/Logo.stories.jsx +17 -17
- package/src/stories/Modal.stories.jsx +100 -100
- package/src/stories/PlatformaticIcon.stories.jsx +51 -35
- package/src/stories/SearchBar.stories.jsx +28 -28
- package/src/stories/Sidebar.stories.jsx +61 -61
- package/src/stories/SimpleMetric.stories.jsx +41 -41
- package/src/stories/Status.stories.jsx +31 -31
- package/src/stories/TextWithLabel.stories.jsx +25 -25
- package/src/stories/TwoColumnsLayout.stories.jsx +42 -42
- package/src/stories/forms/Field.stories.jsx +89 -81
- package/src/stories/forms/Input.stories.jsx +89 -89
- package/src/stories/forms/Preview.stories.jsx +57 -57
- package/src/stories/forms/ToggleSwitch.stories.jsx +15 -15
- package/src/stories/icons/Icons.stories.jsx +74 -74
- package/src/styles/main.css +15 -15
- package/tailwind.config.cjs +60 -60
- package/vite.config.js +6 -6
- package/vitest.config.js +14 -14
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
.tabbed-container {
|
|
2
|
-
@apply bg-main-dark-blue;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.tabs-header {
|
|
6
|
-
@apply flex justify-start text-white uppercase hover:cursor-pointer mb-4 tracking-super-widest h-[2rem];
|
|
7
|
-
}
|
|
8
|
-
.tab {
|
|
9
|
-
@apply mx-8 min-w-[105px] text-center text-sm first:ml-0 last:mr-0;
|
|
10
|
-
}
|
|
11
|
-
.selected-tab {
|
|
12
|
-
@apply underline text-main-green underline-offset-8 font-bold;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.tabs-content {
|
|
16
|
-
@apply h-screen
|
|
1
|
+
.tabbed-container {
|
|
2
|
+
@apply bg-main-dark-blue;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.tabs-header {
|
|
6
|
+
@apply flex justify-start text-white uppercase hover:cursor-pointer mb-4 tracking-super-widest h-[2rem];
|
|
7
|
+
}
|
|
8
|
+
.tab {
|
|
9
|
+
@apply mx-8 min-w-[105px] text-center text-sm first:ml-0 last:mr-0;
|
|
10
|
+
}
|
|
11
|
+
.selected-tab {
|
|
12
|
+
@apply underline text-main-green underline-offset-8 font-bold;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.tabs-content {
|
|
16
|
+
@apply h-screen
|
|
17
17
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import styles from './TextWithLabel.module.css'
|
|
3
|
-
export default function TextWithLabel ({ label, text, children }) {
|
|
4
|
-
return (
|
|
5
|
-
<div className={styles.container}>
|
|
6
|
-
<span className={styles.label}>{label}:</span>
|
|
7
|
-
{text && <span className={styles.text}>{text}</span>}
|
|
8
|
-
{children && <span>{children}</span>}
|
|
9
|
-
</div>
|
|
10
|
-
)
|
|
11
|
-
}
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import styles from './TextWithLabel.module.css'
|
|
3
|
+
export default function TextWithLabel ({ label, text, children }) {
|
|
4
|
+
return (
|
|
5
|
+
<div className={styles.container}>
|
|
6
|
+
<span className={styles.label}>{label}:</span>
|
|
7
|
+
{text && <span className={styles.text}>{text}</span>}
|
|
8
|
+
{children && <span>{children}</span>}
|
|
9
|
+
</div>
|
|
10
|
+
)
|
|
11
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
.container {
|
|
2
|
-
@apply text-white
|
|
3
|
-
}
|
|
4
|
-
.label {
|
|
5
|
-
@apply font-thin mr-2;
|
|
6
|
-
}
|
|
7
|
-
.text {
|
|
8
|
-
@apply font-semibold;
|
|
1
|
+
.container {
|
|
2
|
+
@apply text-white
|
|
3
|
+
}
|
|
4
|
+
.label {
|
|
5
|
+
@apply font-thin mr-2;
|
|
6
|
+
}
|
|
7
|
+
.text {
|
|
8
|
+
@apply font-semibold;
|
|
9
9
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import BorderedBox from './BorderedBox'
|
|
4
|
-
|
|
5
|
-
export default function Versions () {
|
|
6
|
-
return (
|
|
7
|
-
<BorderedBox color='green'>Versions</BorderedBox>
|
|
8
|
-
)
|
|
9
|
-
}
|
|
1
|
+
'use strict'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import BorderedBox from './BorderedBox'
|
|
4
|
+
|
|
5
|
+
export default function Versions () {
|
|
6
|
+
return (
|
|
7
|
+
<BorderedBox color='green'>Versions</BorderedBox>
|
|
8
|
+
)
|
|
9
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
export default function VerticalSeparator () {
|
|
4
|
-
return <span className='text-dark-green m-3'> | </span>
|
|
5
|
-
}
|
|
1
|
+
'use strict'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
export default function VerticalSeparator () {
|
|
4
|
+
return <span className='text-dark-green m-3'> | </span>
|
|
5
|
+
}
|
|
@@ -1,20 +1,53 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
let className = `${styles.container}`
|
|
7
|
-
if (disabled) className += ` ${styles.disabled}`
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
)
|
|
20
|
-
}
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import styles from './Field.module.css'
|
|
4
|
+
|
|
5
|
+
function Field ({ title, titleColor, helper, children, disabled }) {
|
|
6
|
+
let className = `${styles.container}`
|
|
7
|
+
if (disabled) className += ` ${styles.disabled}`
|
|
8
|
+
let classnameTitle = `${styles.title} `
|
|
9
|
+
classnameTitle += styles[`text-color-${titleColor}`]
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<div className={className}>
|
|
13
|
+
<p className={classnameTitle}>{title}</p>
|
|
14
|
+
<p className={styles.helper}>{helper}</p>
|
|
15
|
+
<div className={styles.content}>
|
|
16
|
+
{children}
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
Field.propTypes = {
|
|
23
|
+
/**
|
|
24
|
+
* title
|
|
25
|
+
*/
|
|
26
|
+
title: PropTypes.string,
|
|
27
|
+
/**
|
|
28
|
+
* titleColor
|
|
29
|
+
*/
|
|
30
|
+
titleColor: PropTypes.oneOf(['error-red', 'main-dark-blue']),
|
|
31
|
+
/**
|
|
32
|
+
* helper
|
|
33
|
+
*/
|
|
34
|
+
helper: PropTypes.string,
|
|
35
|
+
/**
|
|
36
|
+
* color of border
|
|
37
|
+
*/
|
|
38
|
+
children: PropTypes.node,
|
|
39
|
+
/**
|
|
40
|
+
* disabled
|
|
41
|
+
*/
|
|
42
|
+
disabled: PropTypes.bool
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
Field.defaultProps = {
|
|
46
|
+
title: '',
|
|
47
|
+
titleColor: 'main-dark-blue',
|
|
48
|
+
helper: '',
|
|
49
|
+
children: null,
|
|
50
|
+
disabled: false
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export default Field
|
|
@@ -1,18 +1,24 @@
|
|
|
1
|
-
.container {
|
|
2
|
-
@apply flex flex-col;
|
|
3
|
-
}
|
|
4
|
-
.title{
|
|
5
|
-
@apply text-xl font-semibold
|
|
6
|
-
}
|
|
7
|
-
.
|
|
8
|
-
@apply text-
|
|
9
|
-
}
|
|
10
|
-
.
|
|
11
|
-
@apply
|
|
12
|
-
}
|
|
13
|
-
.
|
|
14
|
-
@apply
|
|
15
|
-
}
|
|
16
|
-
.
|
|
17
|
-
@apply
|
|
1
|
+
.container {
|
|
2
|
+
@apply flex flex-col;
|
|
3
|
+
}
|
|
4
|
+
.title {
|
|
5
|
+
@apply text-xl font-semibold;
|
|
6
|
+
}
|
|
7
|
+
.text-color-main-dark-blue {
|
|
8
|
+
@apply text-main-dark-blue;
|
|
9
|
+
}
|
|
10
|
+
.text-color-error-red {
|
|
11
|
+
@apply text-error-red;
|
|
12
|
+
}
|
|
13
|
+
.helper{
|
|
14
|
+
@apply text-sm pb-4;
|
|
15
|
+
}
|
|
16
|
+
.content {
|
|
17
|
+
@apply flex gap-x-1 w-full;
|
|
18
|
+
}
|
|
19
|
+
.content button {
|
|
20
|
+
@apply shrink-0;
|
|
21
|
+
}
|
|
22
|
+
.disabled {
|
|
23
|
+
@apply opacity-20;
|
|
18
24
|
}
|
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import PropTypes from 'prop-types'
|
|
4
|
-
import styles from './Input.module.css'
|
|
5
|
-
import commonStyles from '../Common.module.css'
|
|
6
|
-
import PlatformaticIcon from '../PlatformaticIcon'
|
|
7
|
-
|
|
8
|
-
function Input ({ placeholder, value, name, borderColor, errorMessage, onChange, disabled, beforeIcon, afterIcon }) {
|
|
9
|
-
let className = styles.inputContainer + ' ' + commonStyles[`bordered--${borderColor}`] + ' ' + commonStyles[`text--${borderColor}`] + ' ' + commonStyles.padded
|
|
10
|
-
const showError = errorMessage.length > 0
|
|
11
|
-
if (showError) className += ' ' + commonStyles['bordered--error-red']
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<div className={styles.container}>
|
|
15
|
-
<div className={className}>
|
|
16
|
-
{beforeIcon && <PlatformaticIcon iconName={beforeIcon.iconName} classes={styles.beforeInputIcon} size='small' data-testid='before-icon' color={beforeIcon.color} onClick={() => beforeIcon.onClick()} />}
|
|
17
|
-
<input type='text' name={name} value={value} placeholder={placeholder} className={styles.fullWidth} onChange={onChange} disabled={disabled} />
|
|
18
|
-
{afterIcon && <PlatformaticIcon iconName={afterIcon.iconName} color={afterIcon.color} data-testid='after-icon' onClick={null} />}
|
|
19
|
-
</div>
|
|
20
|
-
{showError && <span className={commonStyles['error-message']}>{errorMessage}</span>}
|
|
21
|
-
</div>
|
|
22
|
-
)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
Input.propTypes = {
|
|
26
|
-
/**
|
|
27
|
-
* placeholder
|
|
28
|
-
*/
|
|
29
|
-
placeholder: PropTypes.string,
|
|
30
|
-
/**
|
|
31
|
-
* value
|
|
32
|
-
*/
|
|
33
|
-
value: PropTypes.string,
|
|
34
|
-
/**
|
|
35
|
-
* name
|
|
36
|
-
*/
|
|
37
|
-
name: PropTypes.string,
|
|
38
|
-
/**
|
|
39
|
-
* color of border
|
|
40
|
-
*/
|
|
41
|
-
borderColor: PropTypes.oneOf(['main-green', 'main-dark-blue']),
|
|
42
|
-
/**
|
|
43
|
-
* onChange
|
|
44
|
-
*/
|
|
45
|
-
onChange: PropTypes.func,
|
|
46
|
-
/**
|
|
47
|
-
* Disabled
|
|
48
|
-
*/
|
|
49
|
-
disabled: PropTypes.bool,
|
|
50
|
-
/**
|
|
51
|
-
* beforeIcon: PlatformaticIcon props
|
|
52
|
-
*/
|
|
53
|
-
beforeIcon: PropTypes.shape({
|
|
54
|
-
iconName: PropTypes.string,
|
|
55
|
-
color: PropTypes.string,
|
|
56
|
-
onClick: PropTypes.func
|
|
57
|
-
}),
|
|
58
|
-
/**
|
|
59
|
-
* afterIcon: PlatformaticIcon props
|
|
60
|
-
*/
|
|
61
|
-
afterIcon: PropTypes.shape({
|
|
62
|
-
iconName: PropTypes.string,
|
|
63
|
-
color: PropTypes.string,
|
|
64
|
-
onClick: PropTypes.func
|
|
65
|
-
})
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
Input.defaultProps = {
|
|
69
|
-
placeholder: '',
|
|
70
|
-
value: '',
|
|
71
|
-
name: '',
|
|
72
|
-
borderColor: 'main-green',
|
|
73
|
-
errorMessage: '',
|
|
74
|
-
onChange: () => {},
|
|
75
|
-
disabled: false,
|
|
76
|
-
beforeIcon: null,
|
|
77
|
-
afterIcon: null
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export default Input
|
|
1
|
+
'use strict'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import PropTypes from 'prop-types'
|
|
4
|
+
import styles from './Input.module.css'
|
|
5
|
+
import commonStyles from '../Common.module.css'
|
|
6
|
+
import PlatformaticIcon from '../PlatformaticIcon'
|
|
7
|
+
|
|
8
|
+
function Input ({ placeholder, value, name, borderColor, errorMessage, onChange, disabled, beforeIcon, afterIcon }) {
|
|
9
|
+
let className = styles.inputContainer + ' ' + commonStyles[`bordered--${borderColor}`] + ' ' + commonStyles[`text--${borderColor}`] + ' ' + commonStyles.padded
|
|
10
|
+
const showError = errorMessage.length > 0
|
|
11
|
+
if (showError) className += ' ' + commonStyles['bordered--error-red']
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<div className={styles.container}>
|
|
15
|
+
<div className={className}>
|
|
16
|
+
{beforeIcon && <PlatformaticIcon iconName={beforeIcon.iconName} classes={styles.beforeInputIcon} size='small' data-testid='before-icon' color={beforeIcon.color} onClick={() => beforeIcon.onClick()} />}
|
|
17
|
+
<input type='text' name={name} value={value} placeholder={placeholder} className={styles.fullWidth} onChange={onChange} disabled={disabled} />
|
|
18
|
+
{afterIcon && <PlatformaticIcon iconName={afterIcon.iconName} color={afterIcon.color} data-testid='after-icon' onClick={null} />}
|
|
19
|
+
</div>
|
|
20
|
+
{showError && <span className={commonStyles['error-message']}>{errorMessage}</span>}
|
|
21
|
+
</div>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
Input.propTypes = {
|
|
26
|
+
/**
|
|
27
|
+
* placeholder
|
|
28
|
+
*/
|
|
29
|
+
placeholder: PropTypes.string,
|
|
30
|
+
/**
|
|
31
|
+
* value
|
|
32
|
+
*/
|
|
33
|
+
value: PropTypes.string,
|
|
34
|
+
/**
|
|
35
|
+
* name
|
|
36
|
+
*/
|
|
37
|
+
name: PropTypes.string,
|
|
38
|
+
/**
|
|
39
|
+
* color of border
|
|
40
|
+
*/
|
|
41
|
+
borderColor: PropTypes.oneOf(['main-green', 'main-dark-blue']),
|
|
42
|
+
/**
|
|
43
|
+
* onChange
|
|
44
|
+
*/
|
|
45
|
+
onChange: PropTypes.func,
|
|
46
|
+
/**
|
|
47
|
+
* Disabled
|
|
48
|
+
*/
|
|
49
|
+
disabled: PropTypes.bool,
|
|
50
|
+
/**
|
|
51
|
+
* beforeIcon: PlatformaticIcon props
|
|
52
|
+
*/
|
|
53
|
+
beforeIcon: PropTypes.shape({
|
|
54
|
+
iconName: PropTypes.string,
|
|
55
|
+
color: PropTypes.string,
|
|
56
|
+
onClick: PropTypes.func
|
|
57
|
+
}),
|
|
58
|
+
/**
|
|
59
|
+
* afterIcon: PlatformaticIcon props
|
|
60
|
+
*/
|
|
61
|
+
afterIcon: PropTypes.shape({
|
|
62
|
+
iconName: PropTypes.string,
|
|
63
|
+
color: PropTypes.string,
|
|
64
|
+
onClick: PropTypes.func
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
Input.defaultProps = {
|
|
69
|
+
placeholder: '',
|
|
70
|
+
value: '',
|
|
71
|
+
name: '',
|
|
72
|
+
borderColor: 'main-green',
|
|
73
|
+
errorMessage: '',
|
|
74
|
+
onChange: () => {},
|
|
75
|
+
disabled: false,
|
|
76
|
+
beforeIcon: null,
|
|
77
|
+
afterIcon: null
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export default Input
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
.container {
|
|
2
|
-
@apply flex flex-col w-full relative;
|
|
3
|
-
}
|
|
4
|
-
.inputContainer {
|
|
5
|
-
@apply flex h-10 border border-solid box-border rounded-md;
|
|
6
|
-
}
|
|
7
|
-
.fullWidth {
|
|
8
|
-
@apply w-full;
|
|
9
|
-
}
|
|
10
|
-
.input {
|
|
11
|
-
@apply focus:outline-none focus-within:outline-none focus-visible:outline-none;
|
|
12
|
-
}
|
|
13
|
-
.beforeInputIcon {
|
|
14
|
-
@apply ml-1 mr-3;
|
|
15
|
-
}
|
|
16
|
-
.color-main-dark-blue {
|
|
17
|
-
@apply text-main-dark-blue;
|
|
18
|
-
}
|
|
19
|
-
.color-error-red{
|
|
20
|
-
@apply text-error-red;
|
|
21
|
-
}
|
|
22
|
-
.color-white{
|
|
23
|
-
@apply text-white;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
[type='text']:focus {
|
|
27
|
-
outline: none;
|
|
28
|
-
}
|
|
1
|
+
.container {
|
|
2
|
+
@apply flex flex-col w-full relative;
|
|
3
|
+
}
|
|
4
|
+
.inputContainer {
|
|
5
|
+
@apply flex h-10 border border-solid box-border rounded-md;
|
|
6
|
+
}
|
|
7
|
+
.fullWidth {
|
|
8
|
+
@apply w-full;
|
|
9
|
+
}
|
|
10
|
+
.input {
|
|
11
|
+
@apply focus:outline-none focus-within:outline-none focus-visible:outline-none;
|
|
12
|
+
}
|
|
13
|
+
.beforeInputIcon {
|
|
14
|
+
@apply ml-1 mr-3;
|
|
15
|
+
}
|
|
16
|
+
.color-main-dark-blue {
|
|
17
|
+
@apply text-main-dark-blue;
|
|
18
|
+
}
|
|
19
|
+
.color-error-red{
|
|
20
|
+
@apply text-error-red;
|
|
21
|
+
}
|
|
22
|
+
.color-white{
|
|
23
|
+
@apply text-white;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
[type='text']:focus {
|
|
27
|
+
outline: none;
|
|
28
|
+
}
|
|
@@ -1,77 +1,75 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import styles from './Preview.module.css'
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
export default Preview
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import styles from './Preview.module.css'
|
|
4
|
+
import PlatformaticIcon from '../PlatformaticIcon'
|
|
5
|
+
|
|
6
|
+
function renderLink (value) {
|
|
7
|
+
return (<a className={styles.link} href={value} target='_blank' rel='noreferrer'>{value}</a>)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function renderParagraph (value, afterValueIcon, afterValueIconColor, onClickAfterValueIcon) {
|
|
11
|
+
return (
|
|
12
|
+
<>
|
|
13
|
+
<p className={styles.value}>
|
|
14
|
+
{value}
|
|
15
|
+
{afterValueIcon && (<PlatformaticIcon iconName={afterValueIcon} color={afterValueIconColor} classes={styles.afterIcon} onClick={() => onClickAfterValueIcon} />)}
|
|
16
|
+
</p>
|
|
17
|
+
</>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
function Preview ({ title, value, isLink, children, afterValueIcon, afterValueIconColor, onClickAfterValueIcon }) {
|
|
21
|
+
return (
|
|
22
|
+
<>
|
|
23
|
+
<div className={styles.container}>
|
|
24
|
+
<p className={styles.title}>{title}</p>
|
|
25
|
+
{isLink ? renderLink(value) : renderParagraph(value, afterValueIcon, afterValueIconColor, onClickAfterValueIcon)}
|
|
26
|
+
</div>
|
|
27
|
+
{children}
|
|
28
|
+
</>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
Preview.propTypes = {
|
|
33
|
+
/**
|
|
34
|
+
* title
|
|
35
|
+
*/
|
|
36
|
+
title: PropTypes.string,
|
|
37
|
+
/**
|
|
38
|
+
* value
|
|
39
|
+
*/
|
|
40
|
+
value: PropTypes.oneOfType([
|
|
41
|
+
PropTypes.string,
|
|
42
|
+
PropTypes.number
|
|
43
|
+
]),
|
|
44
|
+
/**
|
|
45
|
+
* isLink
|
|
46
|
+
*/
|
|
47
|
+
isLink: PropTypes.bool,
|
|
48
|
+
/**
|
|
49
|
+
* color of border
|
|
50
|
+
*/
|
|
51
|
+
children: PropTypes.node,
|
|
52
|
+
/**
|
|
53
|
+
* afterValueIcon
|
|
54
|
+
*/
|
|
55
|
+
afterValueIcon: PropTypes.string,
|
|
56
|
+
/**
|
|
57
|
+
* afterValueIconColor
|
|
58
|
+
*/
|
|
59
|
+
afterValueIconColor: PropTypes.oneOf(['error-red', 'main-dark-blue', 'white']),
|
|
60
|
+
/**
|
|
61
|
+
* onClickAfterValueIcon
|
|
62
|
+
*/
|
|
63
|
+
onClickAfterValueIcon: PropTypes.func
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
Preview.defaultProps = {
|
|
67
|
+
title: '',
|
|
68
|
+
value: '',
|
|
69
|
+
isLink: false,
|
|
70
|
+
afterValueIconColor: 'main-dark-blue',
|
|
71
|
+
afterValueIcon: null,
|
|
72
|
+
onClickAfterValueIcon: () => {}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export default Preview
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
.container {
|
|
2
|
-
@apply flex flex-col
|
|
3
|
-
}
|
|
4
|
-
.title {
|
|
5
|
-
@apply text-sm text-main-dark-blue pb-1;
|
|
6
|
-
}
|
|
7
|
-
.value {
|
|
8
|
-
@apply text-xl font-semibold text-main-dark-blue inline-flex;
|
|
9
|
-
}
|
|
10
|
-
.link {
|
|
11
|
-
@apply font-semibold;
|
|
12
|
-
}
|
|
13
|
-
.afterIcon {
|
|
14
|
-
@apply ml-3;
|
|
1
|
+
.container {
|
|
2
|
+
@apply flex flex-col
|
|
3
|
+
}
|
|
4
|
+
.title {
|
|
5
|
+
@apply text-sm text-main-dark-blue pb-1;
|
|
6
|
+
}
|
|
7
|
+
.value {
|
|
8
|
+
@apply text-xl font-semibold text-main-dark-blue inline-flex;
|
|
9
|
+
}
|
|
10
|
+
.link {
|
|
11
|
+
@apply font-semibold;
|
|
12
|
+
}
|
|
13
|
+
.afterIcon {
|
|
14
|
+
@apply ml-3;
|
|
15
15
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import styles from './ToggleSwitch.module.css'
|
|
4
|
-
import commonStyles from '../Common.module.css'
|
|
5
|
-
export default function ToggleSwitch ({ name, label, errorMessage = '', onChange = () => {} }) {
|
|
6
|
-
return (
|
|
7
|
-
<>
|
|
8
|
-
<div className={styles.container}>
|
|
9
|
-
<label className={styles.switch}>
|
|
10
|
-
<input type='checkbox' name={name} onChange={onChange} />
|
|
11
|
-
<span className={`${styles.slider} ${styles.round}`} />
|
|
12
|
-
</label>
|
|
13
|
-
<span className={styles.label}>{label}</span>
|
|
14
|
-
</div>
|
|
15
|
-
{errorMessage.length > 0 && <span className={commonStyles['error-message']}>{errorMessage}</span>}
|
|
16
|
-
</>
|
|
17
|
-
)
|
|
18
|
-
}
|
|
1
|
+
'use strict'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import styles from './ToggleSwitch.module.css'
|
|
4
|
+
import commonStyles from '../Common.module.css'
|
|
5
|
+
export default function ToggleSwitch ({ name, label, errorMessage = '', onChange = () => {} }) {
|
|
6
|
+
return (
|
|
7
|
+
<>
|
|
8
|
+
<div className={styles.container}>
|
|
9
|
+
<label className={styles.switch}>
|
|
10
|
+
<input type='checkbox' name={name} onChange={onChange} />
|
|
11
|
+
<span className={`${styles.slider} ${styles.round}`} />
|
|
12
|
+
</label>
|
|
13
|
+
<span className={styles.label}>{label}</span>
|
|
14
|
+
</div>
|
|
15
|
+
{errorMessage.length > 0 && <span className={commonStyles['error-message']}>{errorMessage}</span>}
|
|
16
|
+
</>
|
|
17
|
+
)
|
|
18
|
+
}
|