@platformatic/ui-components 0.3.5 → 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/components/Button.module.css +3 -0
- package/src/components/ButtonOnlyIcon.jsx +1 -1
- package/src/components/TooltipAbsolute.module.css +2 -2
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta } from '@storybook/
|
|
1
|
+
import { Meta } from '@storybook/blocks';
|
|
2
2
|
import Code from './assets/code-brackets.svg';
|
|
3
3
|
import Colors from './assets/colors.svg';
|
|
4
4
|
import Comments from './assets/comments.svg';
|
|
@@ -12,106 +12,106 @@ import StackAlt from './assets/stackalt.svg';
|
|
|
12
12
|
|
|
13
13
|
<style>
|
|
14
14
|
{`
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
15
|
+
.subheading {
|
|
16
|
+
--mediumdark: '#999999';
|
|
17
|
+
font-weight: 900;
|
|
18
|
+
font-size: 13px;
|
|
19
|
+
color: #999;
|
|
20
|
+
letter-spacing: 6px;
|
|
21
|
+
line-height: 24px;
|
|
22
|
+
text-transform: uppercase;
|
|
23
|
+
margin-bottom: 12px;
|
|
24
|
+
margin-top: 40px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.link-list {
|
|
28
|
+
display: grid;
|
|
29
|
+
grid-template-columns: 1fr;
|
|
30
|
+
grid-template-rows: 1fr 1fr;
|
|
31
|
+
row-gap: 10px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@media (min-width: 620px) {
|
|
35
|
+
.link-list {
|
|
36
|
+
row-gap: 20px;
|
|
37
|
+
column-gap: 20px;
|
|
38
|
+
grid-template-columns: 1fr 1fr;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@media all and (-ms-high-contrast:none) {
|
|
35
43
|
.link-list {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
display: -ms-grid;
|
|
45
|
+
-ms-grid-columns: 1fr 1fr;
|
|
46
|
+
-ms-grid-rows: 1fr 1fr;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.link-item {
|
|
51
|
+
display: block;
|
|
52
|
+
padding: 20px 30px 20px 15px;
|
|
53
|
+
border: 1px solid #00000010;
|
|
54
|
+
border-radius: 5px;
|
|
55
|
+
transition: background 150ms ease-out, border 150ms ease-out, transform 150ms ease-out;
|
|
56
|
+
color: #333333;
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: flex-start;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.link-item:hover {
|
|
62
|
+
border-color: #1EA7FD50;
|
|
63
|
+
transform: translate3d(0, -3px, 0);
|
|
64
|
+
box-shadow: rgba(0, 0, 0, 0.08) 0 3px 10px 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.link-item:active {
|
|
68
|
+
border-color: #1EA7FD;
|
|
69
|
+
transform: translate3d(0, 0, 0);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.link-item strong {
|
|
73
|
+
font-weight: 700;
|
|
74
|
+
display: block;
|
|
75
|
+
margin-bottom: 2px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.link-item img {
|
|
79
|
+
height: 40px;
|
|
80
|
+
width: 40px;
|
|
81
|
+
margin-right: 15px;
|
|
82
|
+
flex: none;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.link-item span {
|
|
86
|
+
font-size: 14px;
|
|
87
|
+
line-height: 20px;
|
|
39
88
|
}
|
|
40
|
-
}
|
|
41
89
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
90
|
+
.tip {
|
|
91
|
+
display: inline-block;
|
|
92
|
+
border-radius: 1em;
|
|
93
|
+
font-size: 11px;
|
|
94
|
+
line-height: 12px;
|
|
95
|
+
font-weight: 700;
|
|
96
|
+
background: #E7FDD8;
|
|
97
|
+
color: #66BF3C;
|
|
98
|
+
padding: 4px 12px;
|
|
99
|
+
margin-right: 10px;
|
|
100
|
+
vertical-align: top;
|
|
47
101
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
.link-item:hover {
|
|
62
|
-
border-color: #1EA7FD50;
|
|
63
|
-
transform: translate3d(0, -3px, 0);
|
|
64
|
-
box-shadow: rgba(0, 0, 0, 0.08) 0 3px 10px 0;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.link-item:active {
|
|
68
|
-
border-color: #1EA7FD;
|
|
69
|
-
transform: translate3d(0, 0, 0);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.link-item strong {
|
|
73
|
-
font-weight: 700;
|
|
74
|
-
display: block;
|
|
75
|
-
margin-bottom: 2px;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.link-item img {
|
|
79
|
-
height: 40px;
|
|
80
|
-
width: 40px;
|
|
81
|
-
margin-right: 15px;
|
|
82
|
-
flex: none;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.link-item span {
|
|
86
|
-
font-size: 14px;
|
|
87
|
-
line-height: 20px;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.tip {
|
|
91
|
-
display: inline-block;
|
|
92
|
-
border-radius: 1em;
|
|
93
|
-
font-size: 11px;
|
|
94
|
-
line-height: 12px;
|
|
95
|
-
font-weight: 700;
|
|
96
|
-
background: #E7FDD8;
|
|
97
|
-
color: #66BF3C;
|
|
98
|
-
padding: 4px 12px;
|
|
99
|
-
margin-right: 10px;
|
|
100
|
-
vertical-align: top;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.tip-wrapper {
|
|
104
|
-
font-size: 13px;
|
|
105
|
-
line-height: 20px;
|
|
106
|
-
margin-top: 40px;
|
|
107
|
-
margin-bottom: 40px;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.tip-wrapper code {
|
|
111
|
-
font-size: 12px;
|
|
112
|
-
display: inline-block;
|
|
113
|
-
}
|
|
114
|
-
`}
|
|
102
|
+
|
|
103
|
+
.tip-wrapper {
|
|
104
|
+
font-size: 13px;
|
|
105
|
+
line-height: 20px;
|
|
106
|
+
margin-top: 40px;
|
|
107
|
+
margin-bottom: 40px;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.tip-wrapper code {
|
|
111
|
+
font-size: 12px;
|
|
112
|
+
display: inline-block;
|
|
113
|
+
}
|
|
114
|
+
`}
|
|
115
115
|
</style>
|
|
116
116
|
|
|
117
117
|
# Welcome to Storybook
|
|
@@ -126,45 +126,36 @@ We recommend building UIs with a [**component-driven**](https://componentdriven.
|
|
|
126
126
|
<div className="subheading">Configure</div>
|
|
127
127
|
|
|
128
128
|
<div className="link-list">
|
|
129
|
-
<a
|
|
130
|
-
className="link-item"
|
|
131
|
-
href="https://storybook.js.org/docs/react/addons/addon-types"
|
|
132
|
-
target="_blank"
|
|
133
|
-
>
|
|
129
|
+
<a className="link-item" href="https://storybook.js.org/docs/react/addons/addon-types" target="_blank">
|
|
134
130
|
<img src={Plugin} alt="plugin" />
|
|
131
|
+
|
|
135
132
|
<span>
|
|
136
133
|
<strong>Presets for popular tools</strong>
|
|
137
134
|
Easy setup for TypeScript, SCSS and more.
|
|
138
135
|
</span>
|
|
139
136
|
</a>
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
href="https://storybook.js.org/docs/react/configure/webpack"
|
|
143
|
-
target="_blank"
|
|
144
|
-
>
|
|
137
|
+
|
|
138
|
+
<a className="link-item" href="https://storybook.js.org/docs/react/configure/webpack" target="_blank">
|
|
145
139
|
<img src={StackAlt} alt="Build" />
|
|
140
|
+
|
|
146
141
|
<span>
|
|
147
142
|
<strong>Build configuration</strong>
|
|
148
143
|
How to customize webpack and Babel
|
|
149
144
|
</span>
|
|
150
145
|
</a>
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
href="https://storybook.js.org/docs/react/configure/styling-and-css"
|
|
154
|
-
target="_blank"
|
|
155
|
-
>
|
|
146
|
+
|
|
147
|
+
<a className="link-item" href="https://storybook.js.org/docs/react/configure/styling-and-css" target="_blank">
|
|
156
148
|
<img src={Colors} alt="colors" />
|
|
149
|
+
|
|
157
150
|
<span>
|
|
158
151
|
<strong>Styling</strong>
|
|
159
152
|
How to load and configure CSS libraries
|
|
160
153
|
</span>
|
|
161
154
|
</a>
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
href="https://storybook.js.org/docs/react/get-started/setup#configure-storybook-for-your-stack"
|
|
165
|
-
target="_blank"
|
|
166
|
-
>
|
|
155
|
+
|
|
156
|
+
<a className="link-item" href="https://storybook.js.org/docs/react/get-started/setup#configure-storybook-for-your-stack" target="_blank">
|
|
167
157
|
<img src={Flow} alt="flow" />
|
|
158
|
+
|
|
168
159
|
<span>
|
|
169
160
|
<strong>Data</strong>
|
|
170
161
|
Providers and mocking for data libraries
|
|
@@ -177,27 +168,34 @@ We recommend building UIs with a [**component-driven**](https://componentdriven.
|
|
|
177
168
|
<div className="link-list">
|
|
178
169
|
<a className="link-item" href="https://storybook.js.org/docs" target="_blank">
|
|
179
170
|
<img src={Repo} alt="repo" />
|
|
171
|
+
|
|
180
172
|
<span>
|
|
181
173
|
<strong>Storybook documentation</strong>
|
|
182
174
|
Configure, customize, and extend
|
|
183
175
|
</span>
|
|
184
176
|
</a>
|
|
177
|
+
|
|
185
178
|
<a className="link-item" href="https://storybook.js.org/tutorials/" target="_blank">
|
|
186
179
|
<img src={Direction} alt="direction" />
|
|
180
|
+
|
|
187
181
|
<span>
|
|
188
182
|
<strong>In-depth guides</strong>
|
|
189
183
|
Best practices from leading teams
|
|
190
184
|
</span>
|
|
191
185
|
</a>
|
|
186
|
+
|
|
192
187
|
<a className="link-item" href="https://github.com/storybookjs/storybook" target="_blank">
|
|
193
188
|
<img src={Code} alt="code" />
|
|
189
|
+
|
|
194
190
|
<span>
|
|
195
191
|
<strong>GitHub project</strong>
|
|
196
192
|
View the source and add issues
|
|
197
193
|
</span>
|
|
198
194
|
</a>
|
|
195
|
+
|
|
199
196
|
<a className="link-item" href="https://discord.gg/storybook" target="_blank">
|
|
200
197
|
<img src={Comments} alt="comments" />
|
|
198
|
+
|
|
201
199
|
<span>
|
|
202
200
|
<strong>Discord chat</strong>
|
|
203
201
|
Chat with maintainers and the community
|
|
@@ -23,8 +23,17 @@ ListWithNoElements.args = {
|
|
|
23
23
|
|
|
24
24
|
const TemplateWithElements = (args) => (
|
|
25
25
|
<List {...args}>
|
|
26
|
-
<ListElement
|
|
27
|
-
|
|
26
|
+
<ListElement
|
|
27
|
+
title='List Element 1'
|
|
28
|
+
detail='Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed et dui facilisis, molestie urna sed, volutpat nibh.'
|
|
29
|
+
/>
|
|
30
|
+
<ListElement
|
|
31
|
+
title='List Element 2'
|
|
32
|
+
detail='Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed et dui facilisis, molestie urna sed, volutpat nibh.'
|
|
33
|
+
detailColor={MAIN_DARK_BLUE}
|
|
34
|
+
titleColor={MAIN_DARK_BLUE}
|
|
35
|
+
semiBold={false}
|
|
36
|
+
/>
|
|
28
37
|
</List>
|
|
29
38
|
)
|
|
30
39
|
|
|
@@ -51,13 +60,27 @@ ListWithElementsVariants.args = {
|
|
|
51
60
|
const TemplateWithElementsOnWhiteDiv = (args) => (
|
|
52
61
|
<div style={divStyle}>
|
|
53
62
|
<List {...args}>
|
|
54
|
-
<ListElement
|
|
55
|
-
|
|
63
|
+
<ListElement
|
|
64
|
+
title='List Element 1'
|
|
65
|
+
marginSize='small'
|
|
66
|
+
detailColor={MAIN_DARK_BLUE}
|
|
67
|
+
titleColor={MAIN_DARK_BLUE}
|
|
68
|
+
semiBold={false}
|
|
69
|
+
/>
|
|
70
|
+
<ListElement
|
|
71
|
+
title='List Element 2'
|
|
72
|
+
marginSize='small'
|
|
73
|
+
detailColor={MAIN_DARK_BLUE}
|
|
74
|
+
titleColor={MAIN_DARK_BLUE}
|
|
75
|
+
semiBold={false}
|
|
76
|
+
/>
|
|
56
77
|
</List>
|
|
57
78
|
</div>
|
|
58
79
|
)
|
|
59
80
|
|
|
60
|
-
export const ListWithElementsOnWhiteDiv = TemplateWithElementsOnWhiteDiv.bind(
|
|
81
|
+
export const ListWithElementsOnWhiteDiv = TemplateWithElementsOnWhiteDiv.bind(
|
|
82
|
+
{}
|
|
83
|
+
)
|
|
61
84
|
ListWithElementsOnWhiteDiv.args = {
|
|
62
85
|
title: 'List Title on White div'
|
|
63
86
|
}
|
|
@@ -11,5 +11,6 @@ const Template = (args) => <ListElement {...args} />
|
|
|
11
11
|
export const ListElementFull = Template.bind({})
|
|
12
12
|
ListElementFull.args = {
|
|
13
13
|
title: 'List Element Title',
|
|
14
|
-
detail:
|
|
14
|
+
detail:
|
|
15
|
+
'Lorem Ipsum dolor sit amet consectetur adipiscing elit. Qui enim potest, nisi quis potest, negare'
|
|
15
16
|
}
|
|
@@ -15,10 +15,11 @@ const ContentThatLoads = ({ startLoading }) => {
|
|
|
15
15
|
return <BorderedBox>{loremIpsum}</BorderedBox>
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
export const Loading = args =>
|
|
18
|
+
export const Loading = (args) => (
|
|
19
19
|
<Loadable {...args}>
|
|
20
20
|
<ContentThatLoads />
|
|
21
21
|
</Loadable>
|
|
22
|
+
)
|
|
22
23
|
Loading.args = {}
|
|
23
24
|
|
|
24
25
|
const ContentThatLoadsAndStops = ({ startLoading, stopLoading }) => {
|
|
@@ -32,7 +33,7 @@ const ContentThatLoadsAndStops = ({ startLoading, stopLoading }) => {
|
|
|
32
33
|
return <BorderedBox>{loremIpsum}</BorderedBox>
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
export const LoadsAndStops = args => {
|
|
36
|
+
export const LoadsAndStops = (args) => {
|
|
36
37
|
return (
|
|
37
38
|
<Loadable {...args}>
|
|
38
39
|
<ContentThatLoadsAndStops />
|
|
@@ -41,7 +42,7 @@ export const LoadsAndStops = args => {
|
|
|
41
42
|
}
|
|
42
43
|
LoadsAndStops.args = {}
|
|
43
44
|
|
|
44
|
-
export const LoadsAndStops2 = args => {
|
|
45
|
+
export const LoadsAndStops2 = (args) => {
|
|
45
46
|
return (
|
|
46
47
|
<Loadable {...args}>
|
|
47
48
|
<ContentThatLoadsAndStops />
|
|
@@ -51,7 +52,7 @@ export const LoadsAndStops2 = args => {
|
|
|
51
52
|
}
|
|
52
53
|
LoadsAndStops2.args = {}
|
|
53
54
|
|
|
54
|
-
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
|
|
55
|
+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
|
|
55
56
|
const ContentThatToggle = ({ startLoading, stopLoading }) => {
|
|
56
57
|
useEffect(() => {
|
|
57
58
|
startLoading()
|
|
@@ -65,7 +66,7 @@ const ContentThatToggle = ({ startLoading, stopLoading }) => {
|
|
|
65
66
|
}, [])
|
|
66
67
|
return <BorderedBox>{loremIpsum}</BorderedBox>
|
|
67
68
|
}
|
|
68
|
-
export const Toggle = args => {
|
|
69
|
+
export const Toggle = (args) => {
|
|
69
70
|
return (
|
|
70
71
|
<Loadable {...args}>
|
|
71
72
|
<ContentThatToggle />
|
|
@@ -3,17 +3,19 @@ import LoadingSpinner from '../components/LoadingSpinner'
|
|
|
3
3
|
import Button from '../components/Button'
|
|
4
4
|
import BorderedBox from '../components/BorderedBox'
|
|
5
5
|
|
|
6
|
-
const loremIpsum =
|
|
6
|
+
const loremIpsum =
|
|
7
|
+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus est nisl, maximus aliquet urna eu, consequat semper nisi. Nam vel elit feugiat dui congue elementum. Sed turpis urna, egestas at pharetra et, lacinia ac mauris. Pellentesque cursus, ipsum nec malesuada ornare, dui purus ultrices elit, non blandit nisi quam non nisi. Suspendisse sapien leo, ultricies pretium vulputate sed, malesuada sed justo. Suspendisse euismod erat ut lacus feugiat malesuada. In tempor a eros et egestas. Nam pretium dolor sollicitudin, cursus sem vitae, elementum enim. Nam in nisi ipsum.'
|
|
7
8
|
|
|
8
9
|
export default {
|
|
9
10
|
title: 'Platformatic/LoadingSpinner',
|
|
10
11
|
component: LoadingSpinner
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
export const Loading = args =>
|
|
14
|
+
export const Loading = (args) => (
|
|
14
15
|
<LoadingSpinner {...args}>
|
|
15
16
|
<BorderedBox>{loremIpsum}</BorderedBox>
|
|
16
17
|
</LoadingSpinner>
|
|
18
|
+
)
|
|
17
19
|
|
|
18
20
|
Loading.args = {
|
|
19
21
|
loading: true
|
|
@@ -4,49 +4,63 @@ import LogoDropDown from '../components/LogoDropDown'
|
|
|
4
4
|
export default {
|
|
5
5
|
title: 'Platformatic/LogoDropDown',
|
|
6
6
|
component: LogoDropDown,
|
|
7
|
-
decorators: [dd => <div className='text-white'>{dd()}</div>]
|
|
7
|
+
decorators: [(dd) => <div className='text-white'>{dd()}</div>]
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
const Template = ({ items }) => {
|
|
11
11
|
const [selected, setSelected] = useState('1')
|
|
12
12
|
|
|
13
13
|
function getItems () {
|
|
14
|
-
return items.map(item => ({
|
|
14
|
+
return items.map((item) => ({
|
|
15
|
+
handleClick: () => setSelected(item.id),
|
|
16
|
+
...item
|
|
17
|
+
}))
|
|
15
18
|
}
|
|
16
19
|
return (
|
|
17
20
|
<div>
|
|
18
|
-
<LogoDropDown
|
|
21
|
+
<LogoDropDown
|
|
22
|
+
items={getItems()}
|
|
23
|
+
itemSelected={selected}
|
|
24
|
+
onClickItemSelected={() => alert(`id selected ${selected}`)}
|
|
25
|
+
/>
|
|
19
26
|
</div>
|
|
20
|
-
|
|
21
27
|
)
|
|
22
28
|
}
|
|
23
29
|
|
|
24
30
|
export const SingleItem = Template.bind({})
|
|
25
31
|
|
|
26
32
|
SingleItem.args = {
|
|
27
|
-
items: [
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
items: [
|
|
34
|
+
{
|
|
35
|
+
id: '1',
|
|
36
|
+
name: 'Single-item'
|
|
37
|
+
}
|
|
38
|
+
]
|
|
31
39
|
}
|
|
32
40
|
|
|
33
41
|
export const MultipleItem = Template.bind({})
|
|
34
42
|
|
|
35
43
|
MultipleItem.args = {
|
|
36
|
-
items: [
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
items: [
|
|
45
|
+
{
|
|
46
|
+
id: '1',
|
|
47
|
+
name: 'Organization-name-1'
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: '2',
|
|
51
|
+
name: 'Organization-name-name-name-name-name-name-2'
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: '3',
|
|
55
|
+
name: 'Organization-name-3'
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: '4',
|
|
59
|
+
name: 'Short-name'
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: '5',
|
|
63
|
+
name: 'abc'
|
|
64
|
+
}
|
|
65
|
+
]
|
|
52
66
|
}
|
|
@@ -4,7 +4,17 @@ import Button from '../components/Button'
|
|
|
4
4
|
import BorderedBox from '../components/BorderedBox'
|
|
5
5
|
import DropDown from '../components/DropDown'
|
|
6
6
|
import HorizontalSeparator from '../components/HorizontalSeparator'
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
FULL_WIDTH,
|
|
9
|
+
MAIN_DARK_BLUE,
|
|
10
|
+
MAIN_GREEN,
|
|
11
|
+
MODAL_COVER,
|
|
12
|
+
MODAL_FULL_DARK,
|
|
13
|
+
MODAL_FULL_LIGHT,
|
|
14
|
+
MODAL_LAYOUTS,
|
|
15
|
+
MODAL_POPUP_V2,
|
|
16
|
+
MODAL_SIZES
|
|
17
|
+
} from '../components/constants'
|
|
8
18
|
export default {
|
|
9
19
|
title: 'Platformatic/Modal',
|
|
10
20
|
component: Modal,
|
|
@@ -33,14 +43,32 @@ const Template = (args) => {
|
|
|
33
43
|
return (
|
|
34
44
|
<main style={{ height: '1440px', overflow: 'scroll' }}>
|
|
35
45
|
<BorderedBox>This Is another Content</BorderedBox>
|
|
36
|
-
<Button
|
|
37
|
-
|
|
46
|
+
<Button
|
|
47
|
+
color={MAIN_GREEN}
|
|
48
|
+
backgroundColor={MAIN_DARK_BLUE}
|
|
49
|
+
onClick={() => setIsOpen(true)}
|
|
50
|
+
label='Open Modal'
|
|
51
|
+
/>
|
|
52
|
+
{isOpen && (
|
|
53
|
+
<Modal setIsOpen={setIsOpen} {...rest}>
|
|
54
|
+
{text}
|
|
55
|
+
</Modal>
|
|
56
|
+
)}
|
|
38
57
|
|
|
39
58
|
<BorderedBox style={{ position: 'relative' }}>
|
|
40
59
|
<p>This Is another Component with Modal inside</p>
|
|
41
60
|
|
|
42
|
-
<Button
|
|
43
|
-
|
|
61
|
+
<Button
|
|
62
|
+
color={MAIN_GREEN}
|
|
63
|
+
backgroundColor={MAIN_DARK_BLUE}
|
|
64
|
+
onClick={() => setIsOpenInside(true)}
|
|
65
|
+
label='Open Modal Inside'
|
|
66
|
+
/>
|
|
67
|
+
{isOpenInside && (
|
|
68
|
+
<Modal setIsOpen={setIsOpenInside} {...rest}>
|
|
69
|
+
{text}
|
|
70
|
+
</Modal>
|
|
71
|
+
)}
|
|
44
72
|
</BorderedBox>
|
|
45
73
|
</main>
|
|
46
74
|
)
|
|
@@ -49,7 +77,11 @@ const Template = (args) => {
|
|
|
49
77
|
const ContentThatLoads = () => {
|
|
50
78
|
const [content, setContent] = useState(null)
|
|
51
79
|
setTimeout(() => {
|
|
52
|
-
setContent(
|
|
80
|
+
setContent(
|
|
81
|
+
<div className='mt-4'>
|
|
82
|
+
<BorderedBox>This is a Future Component</BorderedBox>
|
|
83
|
+
</div>
|
|
84
|
+
)
|
|
53
85
|
}, 1000)
|
|
54
86
|
|
|
55
87
|
return content
|
|
@@ -75,14 +107,26 @@ const MenuTemplate = () => {
|
|
|
75
107
|
const dropDownArgs = {
|
|
76
108
|
header: 'My Menu',
|
|
77
109
|
items: [
|
|
78
|
-
<span
|
|
110
|
+
<span
|
|
111
|
+
className='hover:cursor-pointer'
|
|
112
|
+
key='2'
|
|
113
|
+
onClick={() => setIsOpen(true)}
|
|
114
|
+
>
|
|
115
|
+
Show Modal
|
|
116
|
+
</span>
|
|
79
117
|
]
|
|
80
118
|
}
|
|
81
119
|
return (
|
|
82
120
|
<div>
|
|
83
|
-
<div className='text-white'
|
|
121
|
+
<div className='text-white'>
|
|
122
|
+
<DropDown {...dropDownArgs} />
|
|
123
|
+
</div>
|
|
84
124
|
<HorizontalSeparator />
|
|
85
|
-
{isOpen &&
|
|
125
|
+
{isOpen && (
|
|
126
|
+
<Modal setIsOpen={setIsOpen} title='Modal Title'>
|
|
127
|
+
Hello world!
|
|
128
|
+
</Modal>
|
|
129
|
+
)}
|
|
86
130
|
<ContentThatLoads />
|
|
87
131
|
</div>
|
|
88
132
|
)
|
|
@@ -115,15 +159,21 @@ const NestedModalsTemplate = () => {
|
|
|
115
159
|
|
|
116
160
|
return (
|
|
117
161
|
<main style={{ height: '1440px', overflow: 'scroll' }}>
|
|
118
|
-
<Button
|
|
162
|
+
<Button
|
|
163
|
+
color={MAIN_GREEN}
|
|
164
|
+
backgroundColor={MAIN_DARK_BLUE}
|
|
165
|
+
onClick={() => setIsOpen1(true)}
|
|
166
|
+
label='Open 1st Modal'
|
|
167
|
+
/>
|
|
119
168
|
{isOpen1 && (
|
|
120
|
-
<Modal
|
|
121
|
-
setIsOpen={setIsOpen1}
|
|
122
|
-
title='Fist One'
|
|
123
|
-
layout={MODAL_POPUP_V2}
|
|
124
|
-
>
|
|
169
|
+
<Modal setIsOpen={setIsOpen1} title='Fist One' layout={MODAL_POPUP_V2}>
|
|
125
170
|
<p style={{ color: 'white' }}>This Is the first</p>
|
|
126
|
-
<Button
|
|
171
|
+
<Button
|
|
172
|
+
color={MAIN_GREEN}
|
|
173
|
+
backgroundColor={MAIN_DARK_BLUE}
|
|
174
|
+
onClick={() => setIsOpen2(true)}
|
|
175
|
+
label='Open 2nd Modal'
|
|
176
|
+
/>
|
|
127
177
|
{isOpen2 && (
|
|
128
178
|
<Modal
|
|
129
179
|
setIsOpen={setIsOpen2}
|
|
@@ -131,7 +181,12 @@ const NestedModalsTemplate = () => {
|
|
|
131
181
|
layout={MODAL_POPUP_V2}
|
|
132
182
|
>
|
|
133
183
|
<p style={{ color: 'white' }}>This Is the second</p>
|
|
134
|
-
<Button
|
|
184
|
+
<Button
|
|
185
|
+
color={MAIN_GREEN}
|
|
186
|
+
backgroundColor={MAIN_DARK_BLUE}
|
|
187
|
+
onClick={() => setIsOpen3(true)}
|
|
188
|
+
label='Open 3rd Modal'
|
|
189
|
+
/>
|
|
135
190
|
{isOpen3 && (
|
|
136
191
|
<Modal
|
|
137
192
|
setIsOpen={setIsOpen3}
|
|
@@ -32,9 +32,19 @@ const Template = (args) => {
|
|
|
32
32
|
return (
|
|
33
33
|
<div style={divStyle}>
|
|
34
34
|
<div>
|
|
35
|
-
<Button
|
|
35
|
+
<Button
|
|
36
|
+
type='button'
|
|
37
|
+
color={MAIN_GREEN}
|
|
38
|
+
backgroundColor={MAIN_DARK_BLUE}
|
|
39
|
+
onClick={() => setIsOpen(true)}
|
|
40
|
+
label='Open Modal'
|
|
41
|
+
/>
|
|
36
42
|
</div>
|
|
37
|
-
{isOpen &&
|
|
43
|
+
{isOpen && (
|
|
44
|
+
<ModalDirectional setIsOpen={setIsOpen} {...rest}>
|
|
45
|
+
{text}
|
|
46
|
+
</ModalDirectional>
|
|
47
|
+
)}
|
|
38
48
|
</div>
|
|
39
49
|
)
|
|
40
50
|
}
|