@platformatic/ui-components 0.1.49 → 0.1.51
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/dist/api-icon-closed.svg +6 -0
- package/dist/api-icon.svg +9 -0
- package/dist/assets/Montserrat-Regular.dcfe8df2.ttf +0 -0
- package/dist/assets/index.691ca940.css +1 -0
- package/dist/assets/index.ff0dadfc.js +797 -0
- package/dist/index.html +14 -0
- package/dist/stats.html +6177 -0
- package/dist/vite.svg +1 -0
- 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 +35 -36
- package/src/components/DropDown.module.css +25 -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 +151 -153
- package/src/components/Sidebar.module.css +70 -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/AddIcon.jsx +78 -0
- package/src/components/icons/AlertIcon.jsx +81 -0
- package/src/components/icons/AllInOneIcon.jsx +111 -0
- package/src/components/icons/ApiCloudIcon.jsx +93 -0
- package/src/components/icons/ApiEmptyIcon.jsx +107 -107
- package/src/components/icons/ApiIcon.jsx +84 -29
- package/src/components/icons/ApiIconClosed.jsx +19 -19
- package/src/components/icons/AppEmptyIcon.jsx +94 -94
- package/src/components/icons/AppIcon.jsx +85 -38
- package/src/components/icons/AppListIcon.jsx +73 -73
- package/src/components/icons/ArrowDownFullIcon.jsx +76 -0
- package/src/components/icons/ArrowDownIcon.jsx +75 -0
- package/src/components/icons/ArrowLeftIcon.jsx +75 -0
- package/src/components/icons/ArrowRightIcon.jsx +75 -0
- package/src/components/icons/ArrowUpIcon.jsx +75 -0
- package/src/components/icons/Calendar1DayIcon.jsx +90 -0
- package/src/components/icons/Calendar7DaysIcon.jsx +88 -0
- package/src/components/icons/CalendarIcon.jsx +102 -56
- package/src/components/icons/CircleAddIcon.jsx +81 -40
- package/src/components/icons/CircleBackIcon.jsx +51 -51
- package/src/components/icons/{Calendar1Icon.jsx → CircleCheckMarkIcon.jsx} +66 -54
- 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 +79 -31
- package/src/components/icons/CopyPasteIcon.jsx +81 -0
- package/src/components/icons/DatabaseIcon.jsx +81 -0
- package/src/components/icons/EditIcon.jsx +81 -38
- package/src/components/icons/GearIcon.jsx +78 -40
- package/src/components/icons/Icons.module.css +46 -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/StopIcon.jsx +21 -21
- package/src/components/icons/TerminalIcon.jsx +22 -22
- package/src/components/icons/UpgradeIcon.jsx +48 -48
- package/src/components/icons/Users2Icon.jsx +84 -0
- package/src/components/icons/WorkspaceDynamicIcon.jsx +87 -0
- package/src/components/icons/WorkspaceReadyIcon.jsx +144 -0
- package/src/components/icons/WorkspaceStaticIcon.jsx +84 -0
- package/src/components/icons/index.js +83 -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 +57 -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 +68 -74
- package/src/styles/main.css +22 -15
- package/tailwind.config.cjs +60 -60
- package/vite.config.js +6 -6
- package/vitest.config.js +14 -14
- package/dist/main.css +0 -704
- package/src/components/icons/Calendar7Icon.jsx +0 -55
- package/src/components/icons/CopyIcon.jsx +0 -75
- package/src/components/icons/CreatedWorkspaceIcon.jsx +0 -70
- package/src/components/icons/DynamicWorkspaceIcon.jsx +0 -125
- package/src/components/icons/StaticWorkspaceIcon.jsx +0 -119
- package/src/components/icons/TriangleExclamationIcon.jsx +0 -26
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
import SimpleMetric from '../components/SimpleMetric'
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'Platformatic/Metrics/SimpleMetric',
|
|
7
|
-
component: SimpleMetric
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const Template = (args) => <SimpleMetric {...args} />
|
|
11
|
-
|
|
12
|
-
export const Green = Template.bind({})
|
|
13
|
-
|
|
14
|
-
Green.args = {
|
|
15
|
-
title: 'Requests',
|
|
16
|
-
color: 'green',
|
|
17
|
-
unit: 'ms',
|
|
18
|
-
value: 120,
|
|
19
|
-
tooltip: 'This is a tooltip for the metric'
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export const Red = Template.bind({})
|
|
23
|
-
|
|
24
|
-
Red.args = {
|
|
25
|
-
title: 'Requests',
|
|
26
|
-
color: 'red',
|
|
27
|
-
unit: 'ms',
|
|
28
|
-
value: 120,
|
|
29
|
-
tooltip: 'This is a tooltip for the metric'
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export const WithPrefix = Template.bind({})
|
|
33
|
-
|
|
34
|
-
WithPrefix.args = {
|
|
35
|
-
title: 'Requests',
|
|
36
|
-
color: 'green',
|
|
37
|
-
unit: 'ms',
|
|
38
|
-
value: 120,
|
|
39
|
-
pre: 'P90',
|
|
40
|
-
tooltip: 'This is a tooltip for the metric'
|
|
41
|
-
}
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import SimpleMetric from '../components/SimpleMetric'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Platformatic/Metrics/SimpleMetric',
|
|
7
|
+
component: SimpleMetric
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const Template = (args) => <SimpleMetric {...args} />
|
|
11
|
+
|
|
12
|
+
export const Green = Template.bind({})
|
|
13
|
+
|
|
14
|
+
Green.args = {
|
|
15
|
+
title: 'Requests',
|
|
16
|
+
color: 'green',
|
|
17
|
+
unit: 'ms',
|
|
18
|
+
value: 120,
|
|
19
|
+
tooltip: 'This is a tooltip for the metric'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const Red = Template.bind({})
|
|
23
|
+
|
|
24
|
+
Red.args = {
|
|
25
|
+
title: 'Requests',
|
|
26
|
+
color: 'red',
|
|
27
|
+
unit: 'ms',
|
|
28
|
+
value: 120,
|
|
29
|
+
tooltip: 'This is a tooltip for the metric'
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const WithPrefix = Template.bind({})
|
|
33
|
+
|
|
34
|
+
WithPrefix.args = {
|
|
35
|
+
title: 'Requests',
|
|
36
|
+
color: 'green',
|
|
37
|
+
unit: 'ms',
|
|
38
|
+
value: 120,
|
|
39
|
+
pre: 'P90',
|
|
40
|
+
tooltip: 'This is a tooltip for the metric'
|
|
41
|
+
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
import Status from '../components/Status'
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Platformatic/Status',
|
|
6
|
-
component: Status,
|
|
7
|
-
argTypes: {}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const Template = (args) => <Status {...args} />
|
|
11
|
-
|
|
12
|
-
export const White = Template.bind({})
|
|
13
|
-
|
|
14
|
-
White.args = {
|
|
15
|
-
color: 'white',
|
|
16
|
-
status: 'available'
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const Green = Template.bind({})
|
|
20
|
-
|
|
21
|
-
Green.args = {
|
|
22
|
-
color: 'green',
|
|
23
|
-
status: 'online'
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const Red = Template.bind({})
|
|
27
|
-
|
|
28
|
-
Red.args = {
|
|
29
|
-
color: 'red',
|
|
30
|
-
status: 'offline'
|
|
31
|
-
}
|
|
1
|
+
'use strict'
|
|
2
|
+
import Status from '../components/Status'
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Platformatic/Status',
|
|
6
|
+
component: Status,
|
|
7
|
+
argTypes: {}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const Template = (args) => <Status {...args} />
|
|
11
|
+
|
|
12
|
+
export const White = Template.bind({})
|
|
13
|
+
|
|
14
|
+
White.args = {
|
|
15
|
+
color: 'white',
|
|
16
|
+
status: 'available'
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const Green = Template.bind({})
|
|
20
|
+
|
|
21
|
+
Green.args = {
|
|
22
|
+
color: 'green',
|
|
23
|
+
status: 'online'
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const Red = Template.bind({})
|
|
27
|
+
|
|
28
|
+
Red.args = {
|
|
29
|
+
color: 'red',
|
|
30
|
+
status: 'offline'
|
|
31
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
import TextWithLabel from '../components/TextWithLabel'
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Platformatic/TextWithLabel',
|
|
6
|
-
component: TextWithLabel,
|
|
7
|
-
argTypes: {
|
|
8
|
-
label: { control: 'text' },
|
|
9
|
-
text: { control: 'text' }
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
const Template = (args) => <TextWithLabel {...args} />
|
|
13
|
-
|
|
14
|
-
export const Standard = Template.bind({})
|
|
15
|
-
|
|
16
|
-
Standard.args = {
|
|
17
|
-
label: 'Created By',
|
|
18
|
-
text: 'Platformatic Team'
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const WithLink = (args) => <TextWithLabel {...args}><a href='https://example.com'>Standard Link</a></TextWithLabel>
|
|
22
|
-
|
|
23
|
-
WithLink.args = {
|
|
24
|
-
label: 'External Link'
|
|
25
|
-
}
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import TextWithLabel from '../components/TextWithLabel'
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Platformatic/TextWithLabel',
|
|
6
|
+
component: TextWithLabel,
|
|
7
|
+
argTypes: {
|
|
8
|
+
label: { control: 'text' },
|
|
9
|
+
text: { control: 'text' }
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
const Template = (args) => <TextWithLabel {...args} />
|
|
13
|
+
|
|
14
|
+
export const Standard = Template.bind({})
|
|
15
|
+
|
|
16
|
+
Standard.args = {
|
|
17
|
+
label: 'Created By',
|
|
18
|
+
text: 'Platformatic Team'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const WithLink = (args) => <TextWithLabel {...args}><a href='https://example.com'>Standard Link</a></TextWithLabel>
|
|
22
|
+
|
|
23
|
+
WithLink.args = {
|
|
24
|
+
label: 'External Link'
|
|
25
|
+
}
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
import TwoColumnsLayout from '../components/layouts/TwoColumnsLayout'
|
|
3
|
-
import BorderedBox from '../components/BorderedBox'
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Platformatic/TwoColumnsLayout',
|
|
6
|
-
component: TwoColumnsLayout
|
|
7
|
-
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
|
|
8
|
-
/* argTypes: {
|
|
9
|
-
gridTemplate: {
|
|
10
|
-
type: 'string',
|
|
11
|
-
control: {
|
|
12
|
-
type: 'radio',
|
|
13
|
-
options: ['Default', 'Columns', 'Rows', 'Responsive' ],
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
} */
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
|
|
20
|
-
const Template = (args) => <TwoColumnsLayout {...args}><BorderedBox>1st</BorderedBox><BorderedBox>2nd</BorderedBox></TwoColumnsLayout>
|
|
21
|
-
|
|
22
|
-
export const Default = Template.bind({})
|
|
23
|
-
|
|
24
|
-
Default.args = { }
|
|
25
|
-
|
|
26
|
-
export const Columns = Template.bind({})
|
|
27
|
-
|
|
28
|
-
Columns.args = {
|
|
29
|
-
gridTemplate: 'columns'
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export const Rows = Template.bind({})
|
|
33
|
-
|
|
34
|
-
Rows.args = {
|
|
35
|
-
gridTemplate: 'rows'
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export const Responsive = Template.bind({})
|
|
39
|
-
|
|
40
|
-
Responsive.args = {
|
|
41
|
-
gridTemplate: 'responsive'
|
|
42
|
-
}
|
|
1
|
+
'use strict'
|
|
2
|
+
import TwoColumnsLayout from '../components/layouts/TwoColumnsLayout'
|
|
3
|
+
import BorderedBox from '../components/BorderedBox'
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Platformatic/TwoColumnsLayout',
|
|
6
|
+
component: TwoColumnsLayout
|
|
7
|
+
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
|
|
8
|
+
/* argTypes: {
|
|
9
|
+
gridTemplate: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
control: {
|
|
12
|
+
type: 'radio',
|
|
13
|
+
options: ['Default', 'Columns', 'Rows', 'Responsive' ],
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
} */
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
|
|
20
|
+
const Template = (args) => <TwoColumnsLayout {...args}><BorderedBox>1st</BorderedBox><BorderedBox>2nd</BorderedBox></TwoColumnsLayout>
|
|
21
|
+
|
|
22
|
+
export const Default = Template.bind({})
|
|
23
|
+
|
|
24
|
+
Default.args = { }
|
|
25
|
+
|
|
26
|
+
export const Columns = Template.bind({})
|
|
27
|
+
|
|
28
|
+
Columns.args = {
|
|
29
|
+
gridTemplate: 'columns'
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const Rows = Template.bind({})
|
|
33
|
+
|
|
34
|
+
Rows.args = {
|
|
35
|
+
gridTemplate: 'rows'
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const Responsive = Template.bind({})
|
|
39
|
+
|
|
40
|
+
Responsive.args = {
|
|
41
|
+
gridTemplate: 'responsive'
|
|
42
|
+
}
|
|
@@ -1,81 +1,89 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
import Field from '../../components/forms/Field'
|
|
3
|
-
import Button from '../../components/Button'
|
|
4
|
-
import Input from '../../components/forms/Input'
|
|
5
|
-
|
|
6
|
-
const divStyle = {
|
|
7
|
-
width: '100%',
|
|
8
|
-
height: 'auto',
|
|
9
|
-
padding: '10px',
|
|
10
|
-
backgroundColor: 'white'
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default {
|
|
14
|
-
title: 'Platformatic/Forms/Field',
|
|
15
|
-
component: Field,
|
|
16
|
-
parameters: {
|
|
17
|
-
backgrounds: {
|
|
18
|
-
default: 'white'
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const SimpleTemplate = (args) => <div style={divStyle}><Field {...args} /></div>
|
|
24
|
-
|
|
25
|
-
export const BasicField = SimpleTemplate.bind({})
|
|
26
|
-
|
|
27
|
-
BasicField.args = {
|
|
28
|
-
title: 'Field basic',
|
|
29
|
-
helper: 'A very very very very very very very very very very very very very very simple helper'
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const InputTemplate = (args) => {
|
|
33
|
-
function renderChild (combinationSelected) {
|
|
34
|
-
let rendered = <></>
|
|
35
|
-
|
|
36
|
-
switch (combinationSelected) {
|
|
37
|
-
case 'button':
|
|
38
|
-
rendered = (<Button label='Button for a purpose' color='error-red' onClick={() => { alert('clicked') }} />)
|
|
39
|
-
break
|
|
40
|
-
case 'input-buttons':
|
|
41
|
-
rendered =
|
|
42
|
-
(
|
|
43
|
-
<>
|
|
44
|
-
<Input name='test' placeholder='Platformatic' errorMessage='this is an error message' />
|
|
45
|
-
<Button label='Button for some purposes' color='main-dark-blue' onClick={() => { alert('clicked') }} />
|
|
46
|
-
<Button label='Button for other purposes' color='error-red' onClick={() => { alert('clicked') }} />
|
|
47
|
-
</>
|
|
48
|
-
)
|
|
49
|
-
break
|
|
50
|
-
case 'input':
|
|
51
|
-
rendered = (<Input name='test' placeholder='Platformatic' />)
|
|
52
|
-
break
|
|
53
|
-
case 'input-button':
|
|
54
|
-
rendered =
|
|
55
|
-
(
|
|
56
|
-
<>
|
|
57
|
-
<Input name='test' placeholder='Platformatic' />
|
|
58
|
-
<Button label='Button Simple' color='main-dark-blue' onClick={() => { alert('clicked') }} />
|
|
59
|
-
</>
|
|
60
|
-
)
|
|
61
|
-
break
|
|
62
|
-
default:
|
|
63
|
-
break
|
|
64
|
-
}
|
|
65
|
-
return rendered
|
|
66
|
-
}
|
|
67
|
-
return (
|
|
68
|
-
<div style={divStyle}>
|
|
69
|
-
{['input', 'input-button', 'input-buttons', 'button'].map(how => {
|
|
70
|
-
return (<Field key={how} {...args}>{renderChild(how)}</Field>)
|
|
71
|
-
})}
|
|
72
|
-
</div>
|
|
73
|
-
)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export const WithInput = InputTemplate.bind({})
|
|
77
|
-
|
|
78
|
-
WithInput.args = {
|
|
79
|
-
title: 'Different cases',
|
|
80
|
-
helper: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'
|
|
81
|
-
}
|
|
1
|
+
'use strict'
|
|
2
|
+
import Field from '../../components/forms/Field'
|
|
3
|
+
import Button from '../../components/Button'
|
|
4
|
+
import Input from '../../components/forms/Input'
|
|
5
|
+
|
|
6
|
+
const divStyle = {
|
|
7
|
+
width: '100%',
|
|
8
|
+
height: 'auto',
|
|
9
|
+
padding: '10px',
|
|
10
|
+
backgroundColor: 'white'
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
title: 'Platformatic/Forms/Field',
|
|
15
|
+
component: Field,
|
|
16
|
+
parameters: {
|
|
17
|
+
backgrounds: {
|
|
18
|
+
default: 'white'
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const SimpleTemplate = (args) => <div style={divStyle}><Field {...args} /></div>
|
|
24
|
+
|
|
25
|
+
export const BasicField = SimpleTemplate.bind({})
|
|
26
|
+
|
|
27
|
+
BasicField.args = {
|
|
28
|
+
title: 'Field basic',
|
|
29
|
+
helper: 'A very very very very very very very very very very very very very very simple helper'
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const InputTemplate = (args) => {
|
|
33
|
+
function renderChild (combinationSelected) {
|
|
34
|
+
let rendered = <></>
|
|
35
|
+
|
|
36
|
+
switch (combinationSelected) {
|
|
37
|
+
case 'button':
|
|
38
|
+
rendered = (<Button label='Button for a purpose' color='error-red' onClick={() => { alert('clicked') }} />)
|
|
39
|
+
break
|
|
40
|
+
case 'input-buttons':
|
|
41
|
+
rendered =
|
|
42
|
+
(
|
|
43
|
+
<>
|
|
44
|
+
<Input name='test' placeholder='Platformatic' errorMessage='this is an error message' />
|
|
45
|
+
<Button label='Button for some purposes' color='main-dark-blue' onClick={() => { alert('clicked') }} />
|
|
46
|
+
<Button label='Button for other purposes' color='error-red' onClick={() => { alert('clicked') }} />
|
|
47
|
+
</>
|
|
48
|
+
)
|
|
49
|
+
break
|
|
50
|
+
case 'input':
|
|
51
|
+
rendered = (<Input name='test' placeholder='Platformatic' />)
|
|
52
|
+
break
|
|
53
|
+
case 'input-button':
|
|
54
|
+
rendered =
|
|
55
|
+
(
|
|
56
|
+
<>
|
|
57
|
+
<Input name='test' placeholder='Platformatic' />
|
|
58
|
+
<Button label='Button Simple' color='main-dark-blue' onClick={() => { alert('clicked') }} />
|
|
59
|
+
</>
|
|
60
|
+
)
|
|
61
|
+
break
|
|
62
|
+
default:
|
|
63
|
+
break
|
|
64
|
+
}
|
|
65
|
+
return rendered
|
|
66
|
+
}
|
|
67
|
+
return (
|
|
68
|
+
<div style={divStyle}>
|
|
69
|
+
{['input', 'input-button', 'input-buttons', 'button'].map(how => {
|
|
70
|
+
return (<Field key={how} {...args}>{renderChild(how)}</Field>)
|
|
71
|
+
})}
|
|
72
|
+
</div>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const WithInput = InputTemplate.bind({})
|
|
77
|
+
|
|
78
|
+
WithInput.args = {
|
|
79
|
+
title: 'Different cases',
|
|
80
|
+
helper: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export const RedTitledField = SimpleTemplate.bind({})
|
|
84
|
+
|
|
85
|
+
RedTitledField.args = {
|
|
86
|
+
title: 'Red Field Title',
|
|
87
|
+
titleColor: 'error-red',
|
|
88
|
+
helper: 'A very very very very very very very very very very very very very very simple helper'
|
|
89
|
+
}
|
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
import React, { useState } from 'react'
|
|
3
|
-
import Input from '../../components/forms/Input'
|
|
4
|
-
|
|
5
|
-
const divStyle = {
|
|
6
|
-
width: '100%',
|
|
7
|
-
height: 'auto',
|
|
8
|
-
padding: '20px',
|
|
9
|
-
backgroundColor: 'white'
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default {
|
|
13
|
-
title: 'Platformatic/Forms/Input',
|
|
14
|
-
component: Input,
|
|
15
|
-
decorators: [
|
|
16
|
-
(Story) => (
|
|
17
|
-
<div style={divStyle}>
|
|
18
|
-
<Story />
|
|
19
|
-
</div>
|
|
20
|
-
)
|
|
21
|
-
]
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const Template = (args) => <Input {...args} />
|
|
25
|
-
|
|
26
|
-
export const Default = Template.bind({})
|
|
27
|
-
|
|
28
|
-
Default.args = {
|
|
29
|
-
name: 'test',
|
|
30
|
-
placeholder: 'Platformatic'
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const TemplateBorderMainDarkBlue = (args) => <div style={{ backgroundColor: 'white', padding: '2px' }}><Input {...args} /></div>
|
|
34
|
-
|
|
35
|
-
export const BorderMainDarkBlue = TemplateBorderMainDarkBlue.bind({})
|
|
36
|
-
|
|
37
|
-
BorderMainDarkBlue.args = {
|
|
38
|
-
name: 'test',
|
|
39
|
-
placeholder: 'Platformatic',
|
|
40
|
-
borderColor: 'main-dark-blue'
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export const DefaultInvalid = Template.bind({})
|
|
44
|
-
|
|
45
|
-
DefaultInvalid.args = {
|
|
46
|
-
name: 'test',
|
|
47
|
-
placeholder: 'Platformatic',
|
|
48
|
-
borderColor: 'main-dark-blue',
|
|
49
|
-
errorMessage: 'This is an error message'
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const TemplateValuedAndAlertChange = (args) => {
|
|
53
|
-
const [value, setValue] = useState('Initial value')
|
|
54
|
-
|
|
55
|
-
function handleChange (event) {
|
|
56
|
-
setValue(event.target.value)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<>
|
|
61
|
-
<p>Value of the input {value}</p>
|
|
62
|
-
<Input {...args} value={value} onChange={handleChange} />
|
|
63
|
-
</>
|
|
64
|
-
)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export const ValuedAndAlertChange = TemplateValuedAndAlertChange.bind({})
|
|
68
|
-
|
|
69
|
-
ValuedAndAlertChange.args = {
|
|
70
|
-
name: 'test',
|
|
71
|
-
placeholder: 'Platformatic'
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export const IconBeforeAndAfter = Template.bind({})
|
|
75
|
-
|
|
76
|
-
IconBeforeAndAfter.args = {
|
|
77
|
-
name: 'test',
|
|
78
|
-
placeholder: 'Platformatic',
|
|
79
|
-
beforeIcon: {
|
|
80
|
-
iconName: '
|
|
81
|
-
color: 'main-dark-blue',
|
|
82
|
-
size: 'small',
|
|
83
|
-
onClick: () => { alert('clicked') }
|
|
84
|
-
},
|
|
85
|
-
afterIcon: {
|
|
86
|
-
iconName: 'CircleAddIcon',
|
|
87
|
-
color: 'red'
|
|
88
|
-
}
|
|
89
|
-
}
|
|
1
|
+
'use strict'
|
|
2
|
+
import React, { useState } from 'react'
|
|
3
|
+
import Input from '../../components/forms/Input'
|
|
4
|
+
|
|
5
|
+
const divStyle = {
|
|
6
|
+
width: '100%',
|
|
7
|
+
height: 'auto',
|
|
8
|
+
padding: '20px',
|
|
9
|
+
backgroundColor: 'white'
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
title: 'Platformatic/Forms/Input',
|
|
14
|
+
component: Input,
|
|
15
|
+
decorators: [
|
|
16
|
+
(Story) => (
|
|
17
|
+
<div style={divStyle}>
|
|
18
|
+
<Story />
|
|
19
|
+
</div>
|
|
20
|
+
)
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const Template = (args) => <Input {...args} />
|
|
25
|
+
|
|
26
|
+
export const Default = Template.bind({})
|
|
27
|
+
|
|
28
|
+
Default.args = {
|
|
29
|
+
name: 'test',
|
|
30
|
+
placeholder: 'Platformatic'
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const TemplateBorderMainDarkBlue = (args) => <div style={{ backgroundColor: 'white', padding: '2px' }}><Input {...args} /></div>
|
|
34
|
+
|
|
35
|
+
export const BorderMainDarkBlue = TemplateBorderMainDarkBlue.bind({})
|
|
36
|
+
|
|
37
|
+
BorderMainDarkBlue.args = {
|
|
38
|
+
name: 'test',
|
|
39
|
+
placeholder: 'Platformatic',
|
|
40
|
+
borderColor: 'main-dark-blue'
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const DefaultInvalid = Template.bind({})
|
|
44
|
+
|
|
45
|
+
DefaultInvalid.args = {
|
|
46
|
+
name: 'test',
|
|
47
|
+
placeholder: 'Platformatic',
|
|
48
|
+
borderColor: 'main-dark-blue',
|
|
49
|
+
errorMessage: 'This is an error message'
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const TemplateValuedAndAlertChange = (args) => {
|
|
53
|
+
const [value, setValue] = useState('Initial value')
|
|
54
|
+
|
|
55
|
+
function handleChange (event) {
|
|
56
|
+
setValue(event.target.value)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<>
|
|
61
|
+
<p>Value of the input {value}</p>
|
|
62
|
+
<Input {...args} value={value} onChange={handleChange} />
|
|
63
|
+
</>
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const ValuedAndAlertChange = TemplateValuedAndAlertChange.bind({})
|
|
68
|
+
|
|
69
|
+
ValuedAndAlertChange.args = {
|
|
70
|
+
name: 'test',
|
|
71
|
+
placeholder: 'Platformatic'
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const IconBeforeAndAfter = Template.bind({})
|
|
75
|
+
|
|
76
|
+
IconBeforeAndAfter.args = {
|
|
77
|
+
name: 'test',
|
|
78
|
+
placeholder: 'Platformatic',
|
|
79
|
+
beforeIcon: {
|
|
80
|
+
iconName: 'CopyPasteIcon',
|
|
81
|
+
color: 'main-dark-blue',
|
|
82
|
+
size: 'small',
|
|
83
|
+
onClick: () => { alert('clicked') }
|
|
84
|
+
},
|
|
85
|
+
afterIcon: {
|
|
86
|
+
iconName: 'CircleAddIcon',
|
|
87
|
+
color: 'red'
|
|
88
|
+
}
|
|
89
|
+
}
|