@platformatic/ui-components 0.3.6 → 0.4.0
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/.nvmrc +1 -1
- package/dist/assets/{index-BJ-rQoWR.css → index-K_bDNror.css} +1 -1
- package/dist/index.html +2 -2
- package/dist/main.css +14 -4
- package/package.json +11 -10
- package/src/stories/BorderedBox.stories.jsx +3 -1
- package/src/stories/Button.stories.jsx +224 -47
- package/src/stories/ButtonFullRounded.stories.jsx +31 -6
- package/src/stories/ButtonOnlyIcon.stories.jsx +13 -3
- package/src/stories/DropDown.stories.jsx +43 -20
- package/src/stories/InfoBox.stories.jsx +12 -3
- package/src/stories/{Introduction.stories.mdx → Introduction.mdx} +115 -117
- package/src/stories/List.stories.jsx +28 -5
- package/src/stories/ListElement.stories.jsx +2 -1
- package/src/stories/Loadable.stories.jsx +6 -5
- package/src/stories/LoadingSpinner.stories.jsx +4 -2
- package/src/stories/LogoDropDown.stories.jsx +38 -24
- package/src/stories/Modal.stories.jsx +72 -17
- package/src/stories/ModalDirectional.stories.jsx +12 -2
- package/src/stories/ModalStepsForward.stories.jsx +82 -13
- package/src/stories/PlatformaticIcon.stories.jsx +44 -9
- package/src/stories/SearchBar.stories.jsx +0 -1
- package/src/stories/SearchBarV2.stories.jsx +0 -1
- package/src/stories/Sidebar.stories.jsx +41 -10
- package/src/stories/TabbedWindow.stories.jsx +71 -31
- package/src/stories/TextWithLabel.stories.jsx +5 -1
- package/src/stories/Tooltip.stories.jsx +10 -2
- package/src/stories/TwoColumnsLayout.stories.jsx +7 -2
- package/src/stories/forms/Field.stories.jsx +53 -15
- package/src/stories/forms/Input.stories.jsx +8 -2
- package/src/stories/forms/InputWithSeparator.stories.jsx +31 -9
- package/src/stories/forms/Password.stories.jsx +5 -1
- package/src/stories/forms/Preview.stories.jsx +6 -1
- package/src/stories/forms/RadioGroup.stories.jsx +5 -1
- package/src/stories/forms/Select.stories.jsx +60 -38
- package/src/stories/forms/SelectWithInput.stories.jsx +78 -41
- package/src/stories/forms/ToggleSwitch.stories.jsx +14 -4
- package/src/stories/icons/Icons.stories.jsx +40 -13
- package/src/stories/logos/Logos.stories.jsx +9 -2
- /package/dist/assets/{index-YI7s19_T.js → index-DxEcxprd.js} +0 -0
|
@@ -18,7 +18,11 @@ Standard.args = {
|
|
|
18
18
|
text: 'Platformatic Team'
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export const WithLink = (args) =>
|
|
21
|
+
export const WithLink = (args) => (
|
|
22
|
+
<TextWithLabel {...args}>
|
|
23
|
+
<a href='https://example.com'>Standard Link</a>
|
|
24
|
+
</TextWithLabel>
|
|
25
|
+
)
|
|
22
26
|
|
|
23
27
|
WithLink.args = {
|
|
24
28
|
label: 'External Link'
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import Tooltip from '../components/Tooltip'
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
ANTI_FLASH_WHITE,
|
|
6
|
+
CHANGE_BACKGROUND_COLOR,
|
|
7
|
+
COLORS_BUTTON,
|
|
8
|
+
HOVER_EFFECTS_BUTTONS,
|
|
9
|
+
RICH_BLACK,
|
|
10
|
+
SIZES,
|
|
11
|
+
WHITE
|
|
12
|
+
} from '../components/constants'
|
|
5
13
|
import Button from '../components/Button'
|
|
6
14
|
|
|
7
15
|
const divStyle = {
|
|
@@ -79,7 +87,7 @@ const TemplateWithButton = (args) => (
|
|
|
79
87
|
export const TooltipBase = TemplateWithButton.bind({})
|
|
80
88
|
// More on args: https://storybook.js.org/docs/react/writing-stories/args
|
|
81
89
|
TooltipBase.args = {
|
|
82
|
-
content:
|
|
90
|
+
content: <span>I'm a tooltip over a button</span>,
|
|
83
91
|
delay: 100,
|
|
84
92
|
offset: 44
|
|
85
93
|
}
|
|
@@ -17,11 +17,16 @@ export default {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
|
|
20
|
-
const Template = (args) =>
|
|
20
|
+
const Template = (args) => (
|
|
21
|
+
<TwoColumnsLayout {...args}>
|
|
22
|
+
<BorderedBox>1st</BorderedBox>
|
|
23
|
+
<BorderedBox>2nd</BorderedBox>
|
|
24
|
+
</TwoColumnsLayout>
|
|
25
|
+
)
|
|
21
26
|
|
|
22
27
|
export const Default = Template.bind({})
|
|
23
28
|
|
|
24
|
-
Default.args = {
|
|
29
|
+
Default.args = {}
|
|
25
30
|
|
|
26
31
|
export const Columns = Template.bind({})
|
|
27
32
|
|
|
@@ -20,13 +20,18 @@ export default {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
const SimpleTemplate = (args) =>
|
|
23
|
+
const SimpleTemplate = (args) => (
|
|
24
|
+
<div style={divStyle}>
|
|
25
|
+
<Field {...args} />
|
|
26
|
+
</div>
|
|
27
|
+
)
|
|
24
28
|
|
|
25
29
|
export const BasicField = SimpleTemplate.bind({})
|
|
26
30
|
|
|
27
31
|
BasicField.args = {
|
|
28
32
|
title: 'Field basic',
|
|
29
|
-
helper:
|
|
33
|
+
helper:
|
|
34
|
+
'A very very very very very very very very very very very very very very simple helper'
|
|
30
35
|
}
|
|
31
36
|
|
|
32
37
|
const InputTemplate = (args) => {
|
|
@@ -35,27 +40,55 @@ const InputTemplate = (args) => {
|
|
|
35
40
|
|
|
36
41
|
switch (combinationSelected) {
|
|
37
42
|
case 'button':
|
|
38
|
-
rendered = (
|
|
43
|
+
rendered = (
|
|
44
|
+
<Button
|
|
45
|
+
label='Button for a purpose'
|
|
46
|
+
color='error-red'
|
|
47
|
+
onClick={() => {
|
|
48
|
+
alert('clicked')
|
|
49
|
+
}}
|
|
50
|
+
/>
|
|
51
|
+
)
|
|
39
52
|
break
|
|
40
53
|
case 'input-buttons':
|
|
41
|
-
rendered =
|
|
42
|
-
(
|
|
54
|
+
rendered = (
|
|
43
55
|
<>
|
|
44
|
-
<Input
|
|
45
|
-
|
|
46
|
-
|
|
56
|
+
<Input
|
|
57
|
+
name='test'
|
|
58
|
+
placeholder='Platformatic'
|
|
59
|
+
errorMessage='this is an error message'
|
|
60
|
+
/>
|
|
61
|
+
<Button
|
|
62
|
+
label='Button for some purposes'
|
|
63
|
+
color='main-dark-blue'
|
|
64
|
+
onClick={() => {
|
|
65
|
+
alert('clicked')
|
|
66
|
+
}}
|
|
67
|
+
/>
|
|
68
|
+
<Button
|
|
69
|
+
label='Button for other purposes'
|
|
70
|
+
color='error-red'
|
|
71
|
+
onClick={() => {
|
|
72
|
+
alert('clicked')
|
|
73
|
+
}}
|
|
74
|
+
/>
|
|
47
75
|
</>
|
|
48
76
|
)
|
|
49
77
|
break
|
|
50
78
|
case 'input':
|
|
51
|
-
rendered =
|
|
79
|
+
rendered = <Input name='test' placeholder='Platformatic' />
|
|
52
80
|
break
|
|
53
81
|
case 'input-button':
|
|
54
|
-
rendered =
|
|
55
|
-
(
|
|
82
|
+
rendered = (
|
|
56
83
|
<>
|
|
57
84
|
<Input name='test' placeholder='Platformatic' />
|
|
58
|
-
<Button
|
|
85
|
+
<Button
|
|
86
|
+
label='Button Simple'
|
|
87
|
+
color='main-dark-blue'
|
|
88
|
+
onClick={() => {
|
|
89
|
+
alert('clicked')
|
|
90
|
+
}}
|
|
91
|
+
/>
|
|
59
92
|
</>
|
|
60
93
|
)
|
|
61
94
|
break
|
|
@@ -66,8 +99,12 @@ const InputTemplate = (args) => {
|
|
|
66
99
|
}
|
|
67
100
|
return (
|
|
68
101
|
<div style={divStyle}>
|
|
69
|
-
{['input', 'input-button', 'input-buttons', 'button'].map(how => {
|
|
70
|
-
return (
|
|
102
|
+
{['input', 'input-button', 'input-buttons', 'button'].map((how) => {
|
|
103
|
+
return (
|
|
104
|
+
<Field key={how} {...args}>
|
|
105
|
+
{renderChild(how)}
|
|
106
|
+
</Field>
|
|
107
|
+
)
|
|
71
108
|
})}
|
|
72
109
|
</div>
|
|
73
110
|
)
|
|
@@ -86,5 +123,6 @@ export const RedTitledField = SimpleTemplate.bind({})
|
|
|
86
123
|
RedTitledField.args = {
|
|
87
124
|
title: 'Red Field Title',
|
|
88
125
|
titleColor: 'error-red',
|
|
89
|
-
helper:
|
|
126
|
+
helper:
|
|
127
|
+
'A very very very very very very very very very very very very very very simple helper'
|
|
90
128
|
}
|
|
@@ -31,7 +31,11 @@ Default.args = {
|
|
|
31
31
|
placeholder: 'Platformatic'
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
const TemplateBorderMainDarkBlue = (args) =>
|
|
34
|
+
const TemplateBorderMainDarkBlue = (args) => (
|
|
35
|
+
<div style={{ backgroundColor: 'white', padding: '2px' }}>
|
|
36
|
+
<Input {...args} />
|
|
37
|
+
</div>
|
|
38
|
+
)
|
|
35
39
|
|
|
36
40
|
export const BorderMainDarkBlue = TemplateBorderMainDarkBlue.bind({})
|
|
37
41
|
|
|
@@ -81,7 +85,9 @@ IconBeforeAndAfter.args = {
|
|
|
81
85
|
iconName: 'CopyPasteIcon',
|
|
82
86
|
color: 'main-dark-blue',
|
|
83
87
|
size: 'small',
|
|
84
|
-
onClick: () => {
|
|
88
|
+
onClick: () => {
|
|
89
|
+
alert('clicked')
|
|
90
|
+
}
|
|
85
91
|
},
|
|
86
92
|
afterIcon: {
|
|
87
93
|
iconName: 'CircleAddIcon',
|
|
@@ -37,8 +37,20 @@ const TemplateDefault = (args) => {
|
|
|
37
37
|
<>
|
|
38
38
|
<p>Chunks: {chunks.toString()} </p>
|
|
39
39
|
<p>Value inserted: {value} </p>
|
|
40
|
-
<label>
|
|
41
|
-
|
|
40
|
+
<label>
|
|
41
|
+
Add Error message:{' '}
|
|
42
|
+
<input
|
|
43
|
+
type='checkbox'
|
|
44
|
+
onChange={() =>
|
|
45
|
+
setErrorMessage(errorMessage === '' ? 'custom message' : '')}
|
|
46
|
+
/>
|
|
47
|
+
</label>
|
|
48
|
+
<InputWithSeparator
|
|
49
|
+
{...args}
|
|
50
|
+
value={value}
|
|
51
|
+
onChange={handleChange}
|
|
52
|
+
errorMessage={errorMessage}
|
|
53
|
+
/>
|
|
42
54
|
</>
|
|
43
55
|
)
|
|
44
56
|
}
|
|
@@ -53,7 +65,7 @@ Default.args = {
|
|
|
53
65
|
afterIcon: {
|
|
54
66
|
iconName: 'AddIcon',
|
|
55
67
|
color: ERROR_RED,
|
|
56
|
-
handleClick: () => alert(
|
|
68
|
+
handleClick: () => alert("I'm an AddIcon")
|
|
57
69
|
}
|
|
58
70
|
}
|
|
59
71
|
|
|
@@ -72,8 +84,20 @@ const TemplateDefaultWithValues = (args) => {
|
|
|
72
84
|
<>
|
|
73
85
|
<p>Chunks: {chunks.toString()} </p>
|
|
74
86
|
<p>Value inserted: {value} </p>
|
|
75
|
-
<label>
|
|
76
|
-
|
|
87
|
+
<label>
|
|
88
|
+
Add Error message:{' '}
|
|
89
|
+
<input
|
|
90
|
+
type='checkbox'
|
|
91
|
+
onChange={() =>
|
|
92
|
+
setErrorMessage(errorMessage === '' ? 'custom message' : '')}
|
|
93
|
+
/>
|
|
94
|
+
</label>
|
|
95
|
+
<InputWithSeparator
|
|
96
|
+
{...args}
|
|
97
|
+
value={value}
|
|
98
|
+
onChange={handleChange}
|
|
99
|
+
errorMessage={errorMessage}
|
|
100
|
+
/>
|
|
77
101
|
</>
|
|
78
102
|
)
|
|
79
103
|
}
|
|
@@ -89,9 +113,8 @@ PredefinedValues.args = {
|
|
|
89
113
|
afterIcon: {
|
|
90
114
|
iconName: 'AddIcon',
|
|
91
115
|
color: ERROR_RED,
|
|
92
|
-
handleClick: () => alert(
|
|
116
|
+
handleClick: () => alert("I'm an AddIcon")
|
|
93
117
|
}
|
|
94
|
-
|
|
95
118
|
}
|
|
96
119
|
|
|
97
120
|
export const DifferentsSeparators = TemplateDefaultWithValues.bind({})
|
|
@@ -105,7 +128,6 @@ DifferentsSeparators.args = {
|
|
|
105
128
|
afterIcon: {
|
|
106
129
|
iconName: 'AddIcon',
|
|
107
130
|
color: ERROR_RED,
|
|
108
|
-
handleClick: () => alert(
|
|
131
|
+
handleClick: () => alert("I'm an AddIcon")
|
|
109
132
|
}
|
|
110
|
-
|
|
111
133
|
}
|
|
@@ -43,7 +43,11 @@ Default.args = {
|
|
|
43
43
|
placeholder: 'Platformatic'
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
const TemplateBorderMainDarkBlue = (args) =>
|
|
46
|
+
const TemplateBorderMainDarkBlue = (args) => (
|
|
47
|
+
<div style={{ backgroundColor: 'white', padding: '2px' }}>
|
|
48
|
+
<Password {...args} />
|
|
49
|
+
</div>
|
|
50
|
+
)
|
|
47
51
|
|
|
48
52
|
export const BorderMainDarkBlue = TemplateBorderMainDarkBlue.bind({})
|
|
49
53
|
|
|
@@ -37,7 +37,12 @@ WithLink.args = {
|
|
|
37
37
|
isLink: true
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
const TemplateWithChildren = (args) =>
|
|
40
|
+
const TemplateWithChildren = (args) => (
|
|
41
|
+
<Preview {...args}>
|
|
42
|
+
<p>1st paragraph</p>
|
|
43
|
+
<p>2nd paragraph</p>
|
|
44
|
+
</Preview>
|
|
45
|
+
)
|
|
41
46
|
|
|
42
47
|
export const WithChildren = TemplateWithChildren.bind({})
|
|
43
48
|
|
|
@@ -9,7 +9,11 @@ const divStyle = {
|
|
|
9
9
|
backgroundColor: 'white'
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
const radios = [
|
|
12
|
+
const radios = [
|
|
13
|
+
{ label: 'One', value: '1' },
|
|
14
|
+
{ label: 'Two', value: '2' },
|
|
15
|
+
{ label: 'Three', value: '3' }
|
|
16
|
+
]
|
|
13
17
|
|
|
14
18
|
export default {
|
|
15
19
|
title: 'Platformatic/Forms/RadioGroup',
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
import React, { useState } from 'react'
|
|
3
3
|
import Select from '../../components/forms/Select'
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
MAIN_DARK_BLUE,
|
|
6
|
+
MAIN_GREEN,
|
|
7
|
+
RICH_BLACK,
|
|
8
|
+
WHITE
|
|
9
|
+
} from '../../components/constants'
|
|
5
10
|
|
|
6
11
|
const divStyle = {
|
|
7
12
|
width: '100%',
|
|
@@ -60,7 +65,6 @@ const TemplateBorderMainDarkBlue2 = (args) => {
|
|
|
60
65
|
<Select {...args} value={value} onSelect={handleSelect} />
|
|
61
66
|
<br />
|
|
62
67
|
<Select placeholder='Disabled' disabled />
|
|
63
|
-
|
|
64
68
|
</div>
|
|
65
69
|
</>
|
|
66
70
|
)
|
|
@@ -71,7 +75,11 @@ export const BorderMainDarkBlue = TemplateBorderMainDarkBlue.bind({})
|
|
|
71
75
|
BorderMainDarkBlue.args = {
|
|
72
76
|
name: 'test',
|
|
73
77
|
placeholder: 'Defaul option',
|
|
74
|
-
options: [...Array(20).keys()].map(ele => ({
|
|
78
|
+
options: [...Array(20).keys()].map((ele) => ({
|
|
79
|
+
label: `Option ${ele}`,
|
|
80
|
+
value: `Value${ele}`,
|
|
81
|
+
iconName: 'SocialGitHubIcon'
|
|
82
|
+
})),
|
|
75
83
|
borderColor: MAIN_DARK_BLUE
|
|
76
84
|
}
|
|
77
85
|
|
|
@@ -80,7 +88,11 @@ export const DefaultInvalid = TemplateBorderMainDarkBlue.bind({})
|
|
|
80
88
|
DefaultInvalid.args = {
|
|
81
89
|
name: 'test',
|
|
82
90
|
placeholder: 'Platformatic empty select',
|
|
83
|
-
options: [
|
|
91
|
+
options: [
|
|
92
|
+
{ label: 'Option 1', value: '1' },
|
|
93
|
+
{ label: 'Option 2', value: '2' },
|
|
94
|
+
{ label: 'Option 3', value: '3' }
|
|
95
|
+
],
|
|
84
96
|
borderColor: MAIN_GREEN,
|
|
85
97
|
errorMessage: 'This is an error message'
|
|
86
98
|
}
|
|
@@ -90,22 +102,25 @@ export const withDifferentOptions = TemplateBorderMainDarkBlue2.bind({})
|
|
|
90
102
|
withDifferentOptions.args = {
|
|
91
103
|
name: 'test',
|
|
92
104
|
placeholder: 'Platformatic',
|
|
93
|
-
options: [...Array(20).keys()]
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
options: [...Array(20).keys()]
|
|
106
|
+
.map((ele) => ({
|
|
107
|
+
label: `Option ${ele}`,
|
|
108
|
+
value: `Value${ele}`,
|
|
109
|
+
iconName: 'SocialGitHubIcon'
|
|
110
|
+
}))
|
|
111
|
+
.concat({
|
|
112
|
+
label: 'Last but not least',
|
|
113
|
+
iconName: 'AddIcon',
|
|
114
|
+
value: 123123,
|
|
115
|
+
notSelectable: true,
|
|
116
|
+
onClick: () => alert('you clicked last but not least')
|
|
117
|
+
})
|
|
118
|
+
.concat({
|
|
119
|
+
label: 'Play',
|
|
120
|
+
iconName: 'PlayIcon',
|
|
121
|
+
value: 123123,
|
|
122
|
+
notSelectable: true
|
|
123
|
+
}),
|
|
109
124
|
borderColor: MAIN_DARK_BLUE
|
|
110
125
|
}
|
|
111
126
|
|
|
@@ -114,23 +129,26 @@ export const githubRepoExample = TemplateBorderMainDarkBlue2.bind({})
|
|
|
114
129
|
githubRepoExample.args = {
|
|
115
130
|
name: 'test',
|
|
116
131
|
placeholder: 'Platformatic',
|
|
117
|
-
options: [...Array(4).keys()]
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
options: [...Array(4).keys()]
|
|
133
|
+
.map((ele) => ({
|
|
134
|
+
label: `GitHub Repo ${ele}`,
|
|
135
|
+
value: `Value${ele}`,
|
|
136
|
+
iconName: 'SocialGitHubIcon'
|
|
137
|
+
}))
|
|
138
|
+
.concat({
|
|
139
|
+
label: 'this is an option that is not selectable',
|
|
140
|
+
iconName: 'AddIcon',
|
|
141
|
+
value: 123123,
|
|
142
|
+
notSelectable: true,
|
|
143
|
+
onClick: () => alert('you clicked last but not least')
|
|
144
|
+
})
|
|
145
|
+
.concat({
|
|
146
|
+
label: 'Add Github repo',
|
|
147
|
+
iconName: 'PlayIcon',
|
|
148
|
+
value: 123123,
|
|
149
|
+
notSelectable: true,
|
|
150
|
+
notFilterable: true
|
|
151
|
+
}),
|
|
134
152
|
borderColor: MAIN_DARK_BLUE
|
|
135
153
|
}
|
|
136
154
|
|
|
@@ -155,7 +173,11 @@ TemplateBackgroundTransparent.args = {
|
|
|
155
173
|
name: 'test',
|
|
156
174
|
placeholder: 'Defaul option',
|
|
157
175
|
optionsBorderedBottom: false,
|
|
158
|
-
options: [...Array(20).keys()].map(ele => ({
|
|
176
|
+
options: [...Array(20).keys()].map((ele) => ({
|
|
177
|
+
label: `Option ${ele}`,
|
|
178
|
+
value: `Value${ele}`,
|
|
179
|
+
iconName: 'OrganizationIcon'
|
|
180
|
+
})),
|
|
159
181
|
borderColor: WHITE,
|
|
160
182
|
mainColor: WHITE,
|
|
161
183
|
backgroundColor: RICH_BLACK,
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
import React, { useState } from 'react'
|
|
3
3
|
import SelectWithInput from '../../components/forms/SelectWithInput'
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
MAIN_DARK_BLUE,
|
|
6
|
+
MAIN_GREEN,
|
|
7
|
+
RICH_BLACK,
|
|
8
|
+
WHITE
|
|
9
|
+
} from '../../components/constants'
|
|
5
10
|
|
|
6
11
|
const divStyle = {
|
|
7
12
|
width: '100%',
|
|
@@ -46,7 +51,12 @@ const TemplateBorderMainDarkBlue = (args) => {
|
|
|
46
51
|
return (
|
|
47
52
|
<div style={{ backgroundColor: 'white', padding: '20px 10px' }}>
|
|
48
53
|
<p>Value of the input {value}</p>
|
|
49
|
-
<SelectWithInput
|
|
54
|
+
<SelectWithInput
|
|
55
|
+
{...args}
|
|
56
|
+
value={value}
|
|
57
|
+
onChange={handleChange}
|
|
58
|
+
onSelect={handleSelect}
|
|
59
|
+
/>
|
|
50
60
|
</div>
|
|
51
61
|
)
|
|
52
62
|
}
|
|
@@ -66,10 +76,14 @@ const TemplateBorderMainDarkBlue2 = (args) => {
|
|
|
66
76
|
<>
|
|
67
77
|
<div style={{ backgroundColor: 'white', padding: '20px 10px' }}>
|
|
68
78
|
<p>Value of the input {value}</p>
|
|
69
|
-
<SelectWithInput
|
|
79
|
+
<SelectWithInput
|
|
80
|
+
{...args}
|
|
81
|
+
value={value}
|
|
82
|
+
onChange={handleChange}
|
|
83
|
+
onSelect={handleSelect}
|
|
84
|
+
/>
|
|
70
85
|
<br />
|
|
71
86
|
<SelectWithInput placeholder='Disabled' disabled />
|
|
72
|
-
|
|
73
87
|
</div>
|
|
74
88
|
</>
|
|
75
89
|
)
|
|
@@ -80,7 +94,11 @@ export const BorderMainDarkBlue = TemplateBorderMainDarkBlue.bind({})
|
|
|
80
94
|
BorderMainDarkBlue.args = {
|
|
81
95
|
name: 'test',
|
|
82
96
|
placeholder: 'Defaul option',
|
|
83
|
-
options: [...Array(20).keys()].map(ele => ({
|
|
97
|
+
options: [...Array(20).keys()].map((ele) => ({
|
|
98
|
+
label: `Option ${ele}`,
|
|
99
|
+
value: `Value${ele}`,
|
|
100
|
+
iconName: 'SocialGitHubIcon'
|
|
101
|
+
})),
|
|
84
102
|
borderColor: MAIN_DARK_BLUE
|
|
85
103
|
}
|
|
86
104
|
|
|
@@ -89,7 +107,11 @@ export const DefaultInvalid = TemplateBorderMainDarkBlue.bind({})
|
|
|
89
107
|
DefaultInvalid.args = {
|
|
90
108
|
name: 'test',
|
|
91
109
|
placeholder: 'Platformatic empty select',
|
|
92
|
-
options: [
|
|
110
|
+
options: [
|
|
111
|
+
{ label: 'Option 1', value: '1' },
|
|
112
|
+
{ label: 'Option 2', value: '2' },
|
|
113
|
+
{ label: 'Option 3', value: '3' }
|
|
114
|
+
],
|
|
93
115
|
borderColor: MAIN_GREEN,
|
|
94
116
|
errorMessage: 'This is an error message'
|
|
95
117
|
}
|
|
@@ -99,22 +121,25 @@ export const withDifferentOptions = TemplateBorderMainDarkBlue2.bind({})
|
|
|
99
121
|
withDifferentOptions.args = {
|
|
100
122
|
name: 'test',
|
|
101
123
|
placeholder: 'Platformatic',
|
|
102
|
-
options: [...Array(20).keys()]
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
124
|
+
options: [...Array(20).keys()]
|
|
125
|
+
.map((ele) => ({
|
|
126
|
+
label: `Option ${ele}`,
|
|
127
|
+
value: `Value${ele}`,
|
|
128
|
+
iconName: 'SocialGitHubIcon'
|
|
129
|
+
}))
|
|
130
|
+
.concat({
|
|
131
|
+
label: 'Last but not least',
|
|
132
|
+
iconName: 'AddIcon',
|
|
133
|
+
value: 123123,
|
|
134
|
+
notSelectable: true,
|
|
135
|
+
onClick: () => alert('you clicked last but not least')
|
|
136
|
+
})
|
|
137
|
+
.concat({
|
|
138
|
+
label: 'Play',
|
|
139
|
+
iconName: 'PlayIcon',
|
|
140
|
+
value: 123123,
|
|
141
|
+
notSelectable: true
|
|
142
|
+
}),
|
|
118
143
|
borderColor: MAIN_DARK_BLUE
|
|
119
144
|
}
|
|
120
145
|
|
|
@@ -123,23 +148,26 @@ export const githubRepoExample = TemplateBorderMainDarkBlue2.bind({})
|
|
|
123
148
|
githubRepoExample.args = {
|
|
124
149
|
name: 'test',
|
|
125
150
|
placeholder: 'Platformatic',
|
|
126
|
-
options: [...Array(4).keys()]
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
151
|
+
options: [...Array(4).keys()]
|
|
152
|
+
.map((ele) => ({
|
|
153
|
+
label: `GitHub Repo ${ele}`,
|
|
154
|
+
value: `Value${ele}`,
|
|
155
|
+
iconName: 'SocialGitHubIcon'
|
|
156
|
+
}))
|
|
157
|
+
.concat({
|
|
158
|
+
label: 'this is an option that is not selectable',
|
|
159
|
+
iconName: 'AddIcon',
|
|
160
|
+
value: 123123,
|
|
161
|
+
notSelectable: true,
|
|
162
|
+
onClick: () => alert('you clicked last but not least')
|
|
163
|
+
})
|
|
164
|
+
.concat({
|
|
165
|
+
label: 'Add Github repo',
|
|
166
|
+
iconName: 'PlayIcon',
|
|
167
|
+
value: 123123,
|
|
168
|
+
notSelectable: true,
|
|
169
|
+
notFilterable: true
|
|
170
|
+
}),
|
|
143
171
|
borderColor: MAIN_DARK_BLUE
|
|
144
172
|
}
|
|
145
173
|
|
|
@@ -157,7 +185,12 @@ const TemplateTransparent = (args) => {
|
|
|
157
185
|
return (
|
|
158
186
|
<div style={{ padding: '20px 10px' }}>
|
|
159
187
|
<p>Value of the input {value}</p>
|
|
160
|
-
<SelectWithInput
|
|
188
|
+
<SelectWithInput
|
|
189
|
+
{...args}
|
|
190
|
+
value={value}
|
|
191
|
+
onChange={handleChange}
|
|
192
|
+
onSelect={handleSelect}
|
|
193
|
+
/>
|
|
161
194
|
</div>
|
|
162
195
|
)
|
|
163
196
|
}
|
|
@@ -168,7 +201,11 @@ TemplateBackgroundTransparent.args = {
|
|
|
168
201
|
name: 'test',
|
|
169
202
|
placeholder: 'Defaul option',
|
|
170
203
|
optionsBorderedBottom: false,
|
|
171
|
-
options: [...Array(20).keys()].map(ele => ({
|
|
204
|
+
options: [...Array(20).keys()].map((ele) => ({
|
|
205
|
+
label: `Option ${ele}`,
|
|
206
|
+
value: `Value${ele}`,
|
|
207
|
+
iconName: 'OrganizationIcon'
|
|
208
|
+
})),
|
|
172
209
|
borderColor: WHITE,
|
|
173
210
|
mainColor: WHITE,
|
|
174
211
|
backgroundColor: RICH_BLACK,
|
|
@@ -8,9 +8,15 @@ export default {
|
|
|
8
8
|
|
|
9
9
|
const Template = ({ checked, ...args }) => {
|
|
10
10
|
const [localChecked, setLocalChecked] = useState(checked)
|
|
11
|
-
const onChange = () => {
|
|
11
|
+
const onChange = () => {
|
|
12
|
+
setLocalChecked(!localChecked)
|
|
13
|
+
}
|
|
12
14
|
return (
|
|
13
|
-
<ToggleSwitch
|
|
15
|
+
<ToggleSwitch
|
|
16
|
+
{...args}
|
|
17
|
+
checked={localChecked}
|
|
18
|
+
onChange={() => onChange()}
|
|
19
|
+
/>
|
|
14
20
|
)
|
|
15
21
|
}
|
|
16
22
|
|
|
@@ -27,7 +33,9 @@ Checked.args = {
|
|
|
27
33
|
name: 'test',
|
|
28
34
|
label: 'This is a label',
|
|
29
35
|
checked: true,
|
|
30
|
-
onChange: () => {
|
|
36
|
+
onChange: () => {
|
|
37
|
+
alert('checked')
|
|
38
|
+
}
|
|
31
39
|
}
|
|
32
40
|
|
|
33
41
|
export const Disabled = Template.bind({})
|
|
@@ -36,6 +44,8 @@ Disabled.args = {
|
|
|
36
44
|
name: 'test',
|
|
37
45
|
label: 'This is a label',
|
|
38
46
|
checked: true,
|
|
39
|
-
onChange: () => {
|
|
47
|
+
onChange: () => {
|
|
48
|
+
alert('checked')
|
|
49
|
+
},
|
|
40
50
|
disabled: true
|
|
41
51
|
}
|