@registrucentras/rc-ses-react-components 1.7.1 → 1.9.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/dist/assets/icons/CheckCircleFillIcon.d.ts +1 -1
- package/dist/assets/icons/CopyIcon.d.ts +3 -0
- package/dist/assets/icons/InfoFillIcon.d.ts +1 -1
- package/dist/assets/icons/QuestionFillIcon.d.ts +1 -1
- package/dist/assets/icons/WarningFillIcon.d.ts +1 -1
- package/dist/components/common/Button/index.d.ts +1 -1
- package/dist/components/loaders/FullPageLoader/index.d.ts +9 -0
- package/dist/components/loaders/Loader/index.d.ts +26 -0
- package/dist/components/loaders/LoadingSpinner/index.d.ts +10 -0
- package/dist/components/overlays/Dialog/index.d.ts +11 -0
- package/dist/components/overlays/Modal/index.d.ts +16 -0
- package/dist/library/icons.d.ts +2 -1
- package/dist/library/index.d.ts +6 -1
- package/dist/library/types.d.ts +8 -1
- package/dist/registrucentras-rc-ses-react-components.cjs +10 -10
- package/dist/registrucentras-rc-ses-react-components.js +2009 -1680
- package/dist/stories/components/actions/Button.stories.d.ts +26 -0
- package/dist/stories/components/loaders/FullPageLoader.stories.d.ts +37 -0
- package/dist/stories/components/loaders/Loader.stories.d.ts +36 -0
- package/dist/stories/components/loaders/LoadingSpinner.stories.d.ts +62 -0
- package/dist/stories/components/overlays/Dialog.stories.d.ts +9 -0
- package/dist/stories/components/overlays/Modal.stories.d.ts +10 -0
- package/package.json +1 -1
- package/src/assets/icons/CheckCircleFillIcon.tsx +8 -2
- package/src/assets/icons/CopyIcon.tsx +23 -0
- package/src/assets/icons/InfoFillIcon.tsx +8 -2
- package/src/assets/icons/QuestionFillIcon.tsx +8 -2
- package/src/assets/icons/WarningFillIcon.tsx +8 -2
- package/src/components/common/Button/index.test.tsx +175 -0
- package/src/components/common/Button/index.tsx +46 -4
- package/src/components/common/Snackbar/index.test.tsx +10 -4
- package/src/components/form/inputs/CheckboxFormControl.test.tsx +11 -7
- package/src/components/loaders/FullPageLoader/index.test.tsx +80 -0
- package/src/components/loaders/FullPageLoader/index.tsx +68 -0
- package/src/components/loaders/Loader/index.test.tsx +58 -0
- package/src/components/loaders/Loader/index.tsx +65 -0
- package/src/components/loaders/LoadingSpinner/index.test.tsx +48 -0
- package/src/components/loaders/LoadingSpinner/index.tsx +70 -0
- package/src/components/overlays/Dialog/index.test.tsx +85 -0
- package/src/components/overlays/Dialog/index.tsx +85 -0
- package/src/components/overlays/Modal/index.test.tsx +94 -0
- package/src/components/overlays/Modal/index.tsx +116 -0
- package/src/i18n/namespaces/common/en.json +6 -0
- package/src/i18n/namespaces/common/lt.json +6 -0
- package/src/i18n/namespaces/input/en.json +18 -0
- package/src/i18n/namespaces/input/lt.json +18 -0
- package/src/library/icons.ts +2 -0
- package/src/library/index.ts +10 -0
- package/src/library/types.ts +19 -0
- package/src/setupTests.ts +13 -0
- package/src/stories/components/actions/Button.stories.tsx +201 -0
- package/src/stories/components/icons/Icons.stories.tsx +5 -0
- package/src/stories/components/loaders/FullPageLoader.stories.tsx +126 -0
- package/src/stories/components/loaders/Loader.stories.tsx +76 -0
- package/src/stories/components/loaders/LoadingSpinner.stories.tsx +126 -0
- package/src/stories/components/overlays/Dialog.stories.tsx +271 -0
- package/src/stories/components/overlays/Modal.stories.tsx +98 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
|
|
3
|
+
import RcSesLoader from '@/components/loaders/Loader'
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'components/loaders/Loader/Loader',
|
|
7
|
+
component: RcSesLoader,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
parameters: {
|
|
10
|
+
controls: {
|
|
11
|
+
include: ['label', 'showLabel', 'size'],
|
|
12
|
+
},
|
|
13
|
+
docs: {
|
|
14
|
+
description: {
|
|
15
|
+
component:
|
|
16
|
+
'Reusable loader built on top of RcSesLoadingSpinner. Supports three standard sizes for inline (small), section (medium), and full-page (large) loading states.',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
argTypes: {
|
|
21
|
+
label: {
|
|
22
|
+
control: 'text',
|
|
23
|
+
},
|
|
24
|
+
showLabel: {
|
|
25
|
+
control: 'boolean',
|
|
26
|
+
},
|
|
27
|
+
size: {
|
|
28
|
+
control: 'radio',
|
|
29
|
+
options: ['small', 'medium', 'large'],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
} satisfies Meta<typeof RcSesLoader>
|
|
33
|
+
|
|
34
|
+
export default meta
|
|
35
|
+
|
|
36
|
+
type Story = StoryObj<typeof meta>
|
|
37
|
+
|
|
38
|
+
export const Default: Story = {
|
|
39
|
+
args: {
|
|
40
|
+
label: 'Kraunama...',
|
|
41
|
+
showLabel: true,
|
|
42
|
+
size: 'medium',
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const Small: Story = {
|
|
47
|
+
args: {
|
|
48
|
+
label: 'Kraunama...',
|
|
49
|
+
showLabel: true,
|
|
50
|
+
size: 'small',
|
|
51
|
+
},
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export const Medium: Story = {
|
|
55
|
+
args: {
|
|
56
|
+
label: 'Kraunama...',
|
|
57
|
+
showLabel: true,
|
|
58
|
+
size: 'medium',
|
|
59
|
+
},
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const Large: Story = {
|
|
63
|
+
args: {
|
|
64
|
+
label: 'Kraunama...',
|
|
65
|
+
showLabel: true,
|
|
66
|
+
size: 'large',
|
|
67
|
+
},
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export const WithoutLabel: Story = {
|
|
71
|
+
args: {
|
|
72
|
+
label: 'Kraunama...',
|
|
73
|
+
showLabel: false,
|
|
74
|
+
size: 'medium',
|
|
75
|
+
},
|
|
76
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
|
|
3
|
+
import RcSesLoadingSpinner, {
|
|
4
|
+
RcSesSpinnerColor,
|
|
5
|
+
} from '@/components/loaders/LoadingSpinner'
|
|
6
|
+
|
|
7
|
+
const colorOptions: RcSesSpinnerColor[] = [
|
|
8
|
+
'primary',
|
|
9
|
+
'secondary',
|
|
10
|
+
'error',
|
|
11
|
+
'warning',
|
|
12
|
+
'info',
|
|
13
|
+
'success',
|
|
14
|
+
'inherit',
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
const sizeOptions = ['small', 'medium', 'large']
|
|
18
|
+
|
|
19
|
+
const meta = {
|
|
20
|
+
title: 'components/loaders/LoadingSpinner/LoadingSpinner',
|
|
21
|
+
component: RcSesLoadingSpinner,
|
|
22
|
+
parameters: {
|
|
23
|
+
layout: 'centered',
|
|
24
|
+
docs: {
|
|
25
|
+
description: {
|
|
26
|
+
component:
|
|
27
|
+
'A customizable loading spinner component that displays a rotating circular progress indicator. Supports multiple colors and sizes with accessible animations that respect user motion preferences.',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
argTypes: {
|
|
32
|
+
color: {
|
|
33
|
+
description: 'The color of the spinner',
|
|
34
|
+
options: colorOptions,
|
|
35
|
+
mapping: colorOptions,
|
|
36
|
+
control: {
|
|
37
|
+
type: 'select',
|
|
38
|
+
labels: colorOptions,
|
|
39
|
+
},
|
|
40
|
+
table: {
|
|
41
|
+
defaultValue: { summary: 'inherit' },
|
|
42
|
+
type: { summary: 'SpinnerColor' },
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
size: {
|
|
46
|
+
description: 'The size of the spinner',
|
|
47
|
+
options: sizeOptions,
|
|
48
|
+
mapping: sizeOptions,
|
|
49
|
+
control: {
|
|
50
|
+
type: 'select',
|
|
51
|
+
labels: sizeOptions,
|
|
52
|
+
},
|
|
53
|
+
table: {
|
|
54
|
+
defaultValue: { summary: 'medium' },
|
|
55
|
+
type: { summary: '"small" | "medium" | "large" | string' },
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
tags: ['autodocs'],
|
|
60
|
+
} satisfies Meta<typeof RcSesLoadingSpinner>
|
|
61
|
+
|
|
62
|
+
export default meta
|
|
63
|
+
type Story = StoryObj<typeof meta>
|
|
64
|
+
|
|
65
|
+
export const Default: Story = {
|
|
66
|
+
args: {
|
|
67
|
+
color: 'inherit',
|
|
68
|
+
size: 'medium',
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export const Small: Story = {
|
|
73
|
+
args: {
|
|
74
|
+
color: 'inherit',
|
|
75
|
+
size: 'small',
|
|
76
|
+
},
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const Large: Story = {
|
|
80
|
+
args: {
|
|
81
|
+
color: 'inherit',
|
|
82
|
+
size: 'large',
|
|
83
|
+
},
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export const Primary: Story = {
|
|
87
|
+
args: {
|
|
88
|
+
color: 'primary',
|
|
89
|
+
size: 'medium',
|
|
90
|
+
},
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export const Secondary: Story = {
|
|
94
|
+
args: {
|
|
95
|
+
color: 'secondary',
|
|
96
|
+
size: 'medium',
|
|
97
|
+
},
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export const Error: Story = {
|
|
101
|
+
args: {
|
|
102
|
+
color: 'error',
|
|
103
|
+
size: 'medium',
|
|
104
|
+
},
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export const Success: Story = {
|
|
108
|
+
args: {
|
|
109
|
+
color: 'success',
|
|
110
|
+
size: 'medium',
|
|
111
|
+
},
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export const Warning: Story = {
|
|
115
|
+
args: {
|
|
116
|
+
color: 'warning',
|
|
117
|
+
size: 'medium',
|
|
118
|
+
},
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export const Info: Story = {
|
|
122
|
+
args: {
|
|
123
|
+
color: 'info',
|
|
124
|
+
size: 'medium',
|
|
125
|
+
},
|
|
126
|
+
}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { Typography } from '@mui/material'
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react'
|
|
3
|
+
import { useState } from 'react'
|
|
4
|
+
|
|
5
|
+
import RcSesButton from '@/components/common/Button'
|
|
6
|
+
import RcSesDialog, { RcSesDialogProps } from '@/components/overlays/Dialog'
|
|
7
|
+
|
|
8
|
+
const meta: Meta<typeof RcSesDialog> = {
|
|
9
|
+
component: RcSesDialog,
|
|
10
|
+
title: 'components/overlays/Dialog',
|
|
11
|
+
parameters: {
|
|
12
|
+
layout: 'centered',
|
|
13
|
+
},
|
|
14
|
+
tags: ['autodocs'],
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default meta
|
|
18
|
+
type Story = StoryObj<typeof RcSesDialog>
|
|
19
|
+
|
|
20
|
+
function DialogStory({
|
|
21
|
+
dialogTitle,
|
|
22
|
+
size,
|
|
23
|
+
children,
|
|
24
|
+
...props
|
|
25
|
+
}: RcSesDialogProps & { children: React.ReactNode }) {
|
|
26
|
+
const [open, setOpen] = useState(false)
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<>
|
|
30
|
+
<RcSesButton onClick={() => setOpen(true)} variant='contained'>
|
|
31
|
+
Open Dialog
|
|
32
|
+
</RcSesButton>
|
|
33
|
+
<RcSesDialog
|
|
34
|
+
{...props}
|
|
35
|
+
open={open}
|
|
36
|
+
onClose={() => setOpen(false)}
|
|
37
|
+
dialogTitle={dialogTitle}
|
|
38
|
+
size={size}
|
|
39
|
+
actions={
|
|
40
|
+
<>
|
|
41
|
+
<RcSesButton onClick={() => setOpen(false)} color='grey' variant='outlined'>
|
|
42
|
+
Cancel
|
|
43
|
+
</RcSesButton>
|
|
44
|
+
<RcSesButton onClick={() => setOpen(false)} variant='contained'>
|
|
45
|
+
Confirm
|
|
46
|
+
</RcSesButton>
|
|
47
|
+
</>
|
|
48
|
+
}
|
|
49
|
+
>
|
|
50
|
+
{children}
|
|
51
|
+
</RcSesDialog>
|
|
52
|
+
</>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export const Basic: Story = {
|
|
57
|
+
render: (args) => (
|
|
58
|
+
<DialogStory {...args}>
|
|
59
|
+
<Typography>Are you sure you want to proceed?</Typography>
|
|
60
|
+
</DialogStory>
|
|
61
|
+
),
|
|
62
|
+
args: {
|
|
63
|
+
dialogTitle: 'Confirm Action',
|
|
64
|
+
},
|
|
65
|
+
parameters: {
|
|
66
|
+
docs: {
|
|
67
|
+
source: {
|
|
68
|
+
code: `import { useState } from 'react'
|
|
69
|
+
import { Typography } from '@mui/material'
|
|
70
|
+
import { RcSesButton, RcSesDialog } from '@registrucentras/rc-ses-react-components'
|
|
71
|
+
|
|
72
|
+
export function BasicDialog() {
|
|
73
|
+
const [open, setOpen] = useState(false)
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<>
|
|
77
|
+
<RcSesButton onClick={() => setOpen(true)} variant='contained'>
|
|
78
|
+
Open Dialog
|
|
79
|
+
</RcSesButton>
|
|
80
|
+
<RcSesDialog
|
|
81
|
+
open={open}
|
|
82
|
+
onClose={() => setOpen(false)}
|
|
83
|
+
dialogTitle='Confirm Action'
|
|
84
|
+
actions={
|
|
85
|
+
<>
|
|
86
|
+
<RcSesButton onClick={() => setOpen(false)} color='grey' variant='outlined'>
|
|
87
|
+
Cancel
|
|
88
|
+
</RcSesButton>
|
|
89
|
+
<RcSesButton onClick={() => setOpen(false)} variant='contained'>
|
|
90
|
+
Confirm
|
|
91
|
+
</RcSesButton>
|
|
92
|
+
</>
|
|
93
|
+
}
|
|
94
|
+
>
|
|
95
|
+
<Typography>Are you sure you want to proceed?</Typography>
|
|
96
|
+
</RcSesDialog>
|
|
97
|
+
</>
|
|
98
|
+
)
|
|
99
|
+
}`,
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export const SmallDialog: Story = {
|
|
106
|
+
render: (args) => (
|
|
107
|
+
<DialogStory {...args}>
|
|
108
|
+
<Typography>
|
|
109
|
+
This is a <b>small</b> dialog (480px width).
|
|
110
|
+
</Typography>
|
|
111
|
+
</DialogStory>
|
|
112
|
+
),
|
|
113
|
+
args: {
|
|
114
|
+
dialogTitle: 'Small Dialog',
|
|
115
|
+
size: 'sm',
|
|
116
|
+
},
|
|
117
|
+
parameters: {
|
|
118
|
+
docs: {
|
|
119
|
+
description: {
|
|
120
|
+
story: 'Small size dialog (480px width).',
|
|
121
|
+
},
|
|
122
|
+
source: {
|
|
123
|
+
code: `import { useState } from 'react'
|
|
124
|
+
import { Typography } from '@mui/material'
|
|
125
|
+
import { RcSesButton, RcSesDialog } from '@registrucentras/rc-ses-react-components'
|
|
126
|
+
|
|
127
|
+
export function SmallDialog() {
|
|
128
|
+
const [open, setOpen] = useState(false)
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<>
|
|
132
|
+
<RcSesButton onClick={() => setOpen(true)} variant='contained'>
|
|
133
|
+
Open Dialog
|
|
134
|
+
</RcSesButton>
|
|
135
|
+
<RcSesDialog
|
|
136
|
+
open={open}
|
|
137
|
+
onClose={() => setOpen(false)}
|
|
138
|
+
dialogTitle='Small Dialog'
|
|
139
|
+
size='sm'
|
|
140
|
+
actions={
|
|
141
|
+
<>
|
|
142
|
+
<RcSesButton onClick={() => setOpen(false)} color='grey' variant='outlined'>
|
|
143
|
+
Cancel
|
|
144
|
+
</RcSesButton>
|
|
145
|
+
<RcSesButton onClick={() => setOpen(false)} variant='contained'>
|
|
146
|
+
Confirm
|
|
147
|
+
</RcSesButton>
|
|
148
|
+
</>
|
|
149
|
+
}
|
|
150
|
+
>
|
|
151
|
+
<Typography>This is a small dialog (480px width).</Typography>
|
|
152
|
+
</RcSesDialog>
|
|
153
|
+
</>
|
|
154
|
+
)
|
|
155
|
+
}`,
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export const MediumDialog: Story = {
|
|
162
|
+
render: (args) => (
|
|
163
|
+
<DialogStory {...args}>
|
|
164
|
+
<Typography>
|
|
165
|
+
This is a <b>medium</b> dialog (600px width).
|
|
166
|
+
</Typography>
|
|
167
|
+
</DialogStory>
|
|
168
|
+
),
|
|
169
|
+
args: {
|
|
170
|
+
dialogTitle: 'Medium Dialog',
|
|
171
|
+
size: 'md',
|
|
172
|
+
},
|
|
173
|
+
parameters: {
|
|
174
|
+
docs: {
|
|
175
|
+
description: {
|
|
176
|
+
story: 'Medium size (600px width) dialog. This is the default size.',
|
|
177
|
+
},
|
|
178
|
+
source: {
|
|
179
|
+
code: `import { useState } from 'react'
|
|
180
|
+
import { Typography } from '@mui/material'
|
|
181
|
+
import { RcSesButton, RcSesDialog } from '@registrucentras/rc-ses-react-components'
|
|
182
|
+
|
|
183
|
+
export function MediumDialog() {
|
|
184
|
+
const [open, setOpen] = useState(false)
|
|
185
|
+
|
|
186
|
+
return (
|
|
187
|
+
<>
|
|
188
|
+
<RcSesButton onClick={() => setOpen(true)} variant='contained'>
|
|
189
|
+
Open Dialog
|
|
190
|
+
</RcSesButton>
|
|
191
|
+
<RcSesDialog
|
|
192
|
+
open={open}
|
|
193
|
+
onClose={() => setOpen(false)}
|
|
194
|
+
dialogTitle='Medium Dialog'
|
|
195
|
+
size='md'
|
|
196
|
+
actions={
|
|
197
|
+
<>
|
|
198
|
+
<RcSesButton onClick={() => setOpen(false)} color='grey' variant='outlined'>
|
|
199
|
+
Cancel
|
|
200
|
+
</RcSesButton>
|
|
201
|
+
<RcSesButton onClick={() => setOpen(false)} variant='contained'>
|
|
202
|
+
Confirm
|
|
203
|
+
</RcSesButton>
|
|
204
|
+
</>
|
|
205
|
+
}
|
|
206
|
+
>
|
|
207
|
+
<Typography>This is a medium dialog (600px width).</Typography>
|
|
208
|
+
</RcSesDialog>
|
|
209
|
+
</>
|
|
210
|
+
)
|
|
211
|
+
}`,
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export const LargeDialog: Story = {
|
|
218
|
+
render: (args) => (
|
|
219
|
+
<DialogStory {...args}>
|
|
220
|
+
<Typography>
|
|
221
|
+
This is a <b>large</b> dialog (800px width).
|
|
222
|
+
</Typography>
|
|
223
|
+
</DialogStory>
|
|
224
|
+
),
|
|
225
|
+
args: {
|
|
226
|
+
dialogTitle: 'Large Dialog',
|
|
227
|
+
size: 'lg',
|
|
228
|
+
},
|
|
229
|
+
parameters: {
|
|
230
|
+
docs: {
|
|
231
|
+
description: {
|
|
232
|
+
story: 'Large size (800px width) dialog for content-heavy forms or information.',
|
|
233
|
+
},
|
|
234
|
+
source: {
|
|
235
|
+
code: `import { useState } from 'react'
|
|
236
|
+
import { Typography } from '@mui/material'
|
|
237
|
+
import { RcSesButton, RcSesDialog } from '@registrucentras/rc-ses-react-components'
|
|
238
|
+
|
|
239
|
+
export function LargeDialog() {
|
|
240
|
+
const [open, setOpen] = useState(false)
|
|
241
|
+
|
|
242
|
+
return (
|
|
243
|
+
<>
|
|
244
|
+
<RcSesButton onClick={() => setOpen(true)} variant='contained'>
|
|
245
|
+
Open Dialog
|
|
246
|
+
</RcSesButton>
|
|
247
|
+
<RcSesDialog
|
|
248
|
+
open={open}
|
|
249
|
+
onClose={() => setOpen(false)}
|
|
250
|
+
dialogTitle='Large Dialog'
|
|
251
|
+
size='lg'
|
|
252
|
+
actions={
|
|
253
|
+
<>
|
|
254
|
+
<RcSesButton onClick={() => setOpen(false)} color='grey' variant='outlined'>
|
|
255
|
+
Cancel
|
|
256
|
+
</RcSesButton>
|
|
257
|
+
<RcSesButton onClick={() => setOpen(false)} variant='contained'>
|
|
258
|
+
Confirm
|
|
259
|
+
</RcSesButton>
|
|
260
|
+
</>
|
|
261
|
+
}
|
|
262
|
+
>
|
|
263
|
+
<Typography>This is a large dialog (800px width).</Typography>
|
|
264
|
+
</RcSesDialog>
|
|
265
|
+
</>
|
|
266
|
+
)
|
|
267
|
+
}`,
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Button } from '@mui/material'
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react'
|
|
3
|
+
import { useState } from 'react'
|
|
4
|
+
|
|
5
|
+
import RcSesModal from '@/components/overlays/Modal'
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof RcSesModal> = {
|
|
8
|
+
component: RcSesModal,
|
|
9
|
+
title: 'components/overlays/Modal',
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: 'centered',
|
|
12
|
+
},
|
|
13
|
+
tags: ['autodocs'],
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default meta
|
|
17
|
+
type Story = StoryObj<typeof RcSesModal>
|
|
18
|
+
|
|
19
|
+
function ModalDemo(args: any) {
|
|
20
|
+
const [open, setOpen] = useState(false)
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<>
|
|
24
|
+
<Button onClick={() => setOpen(true)} variant='contained'>
|
|
25
|
+
Open Modal
|
|
26
|
+
</Button>
|
|
27
|
+
<RcSesModal
|
|
28
|
+
{...args}
|
|
29
|
+
open={open}
|
|
30
|
+
onClose={() => setOpen(false)}
|
|
31
|
+
onPrimaryAction={() => setOpen(false)}
|
|
32
|
+
onSecondaryAction={() => setOpen(false)}
|
|
33
|
+
/>
|
|
34
|
+
</>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const Destructive: Story = {
|
|
39
|
+
render: (args) => <ModalDemo {...args} />,
|
|
40
|
+
args: {
|
|
41
|
+
title: 'Ar tikrai norite pašalinti?',
|
|
42
|
+
message: 'Aprašymo tekstas.',
|
|
43
|
+
variant: 'destructive',
|
|
44
|
+
secondaryActionLabel: 'Atšaukti',
|
|
45
|
+
showIcon: true,
|
|
46
|
+
|
|
47
|
+
primaryActionLabel: 'Pašalinti',
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const Confirm: Story = {
|
|
52
|
+
render: (args) => <ModalDemo {...args} />,
|
|
53
|
+
args: {
|
|
54
|
+
title: 'Ar tikrai norite tęsti?',
|
|
55
|
+
message: 'Aprašymo tekstas.',
|
|
56
|
+
variant: 'confirm',
|
|
57
|
+
showIcon: true,
|
|
58
|
+
|
|
59
|
+
secondaryActionLabel: 'Atšaukti',
|
|
60
|
+
primaryActionLabel: 'Tęsti',
|
|
61
|
+
},
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const Success: Story = {
|
|
65
|
+
render: (args) => <ModalDemo {...args} />,
|
|
66
|
+
args: {
|
|
67
|
+
title: 'Pavyko!',
|
|
68
|
+
message: 'Aprašymo tekstas.',
|
|
69
|
+
variant: 'success',
|
|
70
|
+
showIcon: true,
|
|
71
|
+
|
|
72
|
+
primaryActionLabel: 'Uždaryti',
|
|
73
|
+
},
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const Info: Story = {
|
|
77
|
+
render: (args) => <ModalDemo {...args} />,
|
|
78
|
+
args: {
|
|
79
|
+
title: 'Informacija',
|
|
80
|
+
message: 'Aprašymo tekstas.',
|
|
81
|
+
variant: 'info',
|
|
82
|
+
showIcon: true,
|
|
83
|
+
|
|
84
|
+
primaryActionLabel: 'Suprantu',
|
|
85
|
+
},
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export const WithoutIcon: Story = {
|
|
89
|
+
render: (args) => <ModalDemo {...args} />,
|
|
90
|
+
args: {
|
|
91
|
+
title: 'Ar tikrai norite pašalinti?',
|
|
92
|
+
message: 'Aprašymo tekstas.',
|
|
93
|
+
variant: 'destructive',
|
|
94
|
+
showIcon: false,
|
|
95
|
+
secondaryActionLabel: 'Atšaukti',
|
|
96
|
+
primaryActionLabel: 'Pašalinti',
|
|
97
|
+
},
|
|
98
|
+
}
|