@registrucentras/rc-ses-react-components 1.7.0 → 1.8.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/LoadingSpinner/LoadingSpinner.d.ts +10 -0
- package/dist/components/common/Button/index.d.ts +1 -1
- package/dist/components/common/Snackbar/config.d.ts +1 -0
- package/dist/components/layout/ServiceHeader.d.ts +2 -2
- 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 +4 -1
- package/dist/library/types.d.ts +6 -1
- package/dist/registrucentras-rc-ses-react-components.cjs +10 -10
- package/dist/registrucentras-rc-ses-react-components.js +2170 -1929
- package/dist/stories/components/actions/Button.stories.d.ts +26 -0
- package/dist/stories/components/layout/ServiceHeader.stories.d.ts +1 -1
- package/dist/stories/components/overlays/Dialog.stories.d.ts +9 -0
- package/dist/stories/components/overlays/Modal.stories.d.ts +10 -0
- package/dist/stories/components/spinner/LoadingSpinner.stories.d.ts +62 -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/LoadingSpinner/LoadingSpinner.test.tsx +48 -0
- package/src/components/LoadingSpinner/LoadingSpinner.tsx +70 -0
- package/src/components/common/Button/index.test.tsx +175 -0
- package/src/components/common/Button/index.tsx +48 -4
- package/src/components/common/Snackbar/config.ts +5 -0
- package/src/components/common/Snackbar/index.tsx +25 -10
- package/src/components/layout/ServiceHeader.tsx +5 -7
- 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 +3 -0
- package/src/i18n/namespaces/common/lt.json +3 -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 +6 -0
- package/src/library/types.ts +10 -0
- package/src/stories/components/actions/Button.stories.tsx +201 -0
- package/src/stories/components/feedback/Snackbar.stories.tsx +1 -1
- package/src/stories/components/icons/Icons.stories.tsx +5 -0
- package/src/stories/components/layout/ServiceHeader.stories.tsx +8 -15
- package/src/stories/components/overlays/Dialog.stories.tsx +271 -0
- package/src/stories/components/overlays/Modal.stories.tsx +98 -0
- package/src/stories/components/spinner/LoadingSpinner.stories.tsx +126 -0
|
@@ -71,6 +71,14 @@ const meta = {
|
|
|
71
71
|
defaultValue: {},
|
|
72
72
|
},
|
|
73
73
|
},
|
|
74
|
+
loading: {
|
|
75
|
+
control: {
|
|
76
|
+
type: 'boolean',
|
|
77
|
+
},
|
|
78
|
+
table: {
|
|
79
|
+
defaultValue: { summary: 'false' },
|
|
80
|
+
},
|
|
81
|
+
},
|
|
74
82
|
},
|
|
75
83
|
tags: ['autodocs'],
|
|
76
84
|
args: {
|
|
@@ -364,3 +372,196 @@ export const GhostOutlinedIconOnlyDisabled: Story = {
|
|
|
364
372
|
),
|
|
365
373
|
],
|
|
366
374
|
}
|
|
375
|
+
|
|
376
|
+
// Loading states
|
|
377
|
+
export const PrimaryContainedLoading: Story = {
|
|
378
|
+
args: {
|
|
379
|
+
variant: 'contained',
|
|
380
|
+
color: 'primary',
|
|
381
|
+
loading: true,
|
|
382
|
+
},
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
export const PrimaryContainedLoadingWithIcon: Story = {
|
|
386
|
+
args: {
|
|
387
|
+
variant: 'contained',
|
|
388
|
+
color: 'primary',
|
|
389
|
+
loading: true,
|
|
390
|
+
startIcon: <PlusBoldIcon />,
|
|
391
|
+
},
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
export const PrimaryContainedLoadingWithEndIcon: Story = {
|
|
395
|
+
args: {
|
|
396
|
+
variant: 'contained',
|
|
397
|
+
color: 'primary',
|
|
398
|
+
loading: true,
|
|
399
|
+
endIcon: <PlusBoldIcon />,
|
|
400
|
+
},
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
export const PrimaryContainedIconOnlyLoading: Story = {
|
|
404
|
+
args: {
|
|
405
|
+
'aria-label': 'Add',
|
|
406
|
+
children: <PlusBoldIcon />,
|
|
407
|
+
color: 'primary',
|
|
408
|
+
iconOnly: true,
|
|
409
|
+
variant: 'contained',
|
|
410
|
+
loading: true,
|
|
411
|
+
},
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
export const PrimaryOutlinedLoading: Story = {
|
|
415
|
+
parameters: disableColorContrast,
|
|
416
|
+
args: {
|
|
417
|
+
color: 'primary',
|
|
418
|
+
variant: 'outlined',
|
|
419
|
+
loading: true,
|
|
420
|
+
},
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
export const SecondaryContainedLoading: Story = {
|
|
424
|
+
args: {
|
|
425
|
+
color: 'secondary',
|
|
426
|
+
variant: 'contained',
|
|
427
|
+
loading: true,
|
|
428
|
+
},
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
export const SecondaryOutlinedLoading: Story = {
|
|
432
|
+
parameters: disableColorContrast,
|
|
433
|
+
args: {
|
|
434
|
+
color: 'secondary',
|
|
435
|
+
variant: 'outlined',
|
|
436
|
+
loading: true,
|
|
437
|
+
},
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
export const GreyContainedLoading: Story = {
|
|
441
|
+
args: {
|
|
442
|
+
color: 'grey',
|
|
443
|
+
variant: 'contained',
|
|
444
|
+
loading: true,
|
|
445
|
+
},
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
export const GreyOutlinedLoading: Story = {
|
|
449
|
+
parameters: disableColorContrast,
|
|
450
|
+
args: {
|
|
451
|
+
color: 'grey',
|
|
452
|
+
variant: 'outlined',
|
|
453
|
+
loading: true,
|
|
454
|
+
},
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
export const WarningContainedLoading: Story = {
|
|
458
|
+
args: {
|
|
459
|
+
variant: 'contained',
|
|
460
|
+
color: 'warning',
|
|
461
|
+
loading: true,
|
|
462
|
+
},
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
export const WarningOutlinedLoading: Story = {
|
|
466
|
+
parameters: disableColorContrast,
|
|
467
|
+
args: {
|
|
468
|
+
variant: 'outlined',
|
|
469
|
+
color: 'warning',
|
|
470
|
+
loading: true,
|
|
471
|
+
},
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
export const ErrorContainedLoading: Story = {
|
|
475
|
+
args: {
|
|
476
|
+
color: 'error',
|
|
477
|
+
variant: 'contained',
|
|
478
|
+
loading: true,
|
|
479
|
+
},
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
export const ErrorOutlinedLoading: Story = {
|
|
483
|
+
parameters: disableColorContrast,
|
|
484
|
+
args: {
|
|
485
|
+
color: 'error',
|
|
486
|
+
variant: 'outlined',
|
|
487
|
+
loading: true,
|
|
488
|
+
},
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
export const LightOutlinedLoading: Story = {
|
|
492
|
+
args: {
|
|
493
|
+
variant: 'outlined',
|
|
494
|
+
color: 'light' as any,
|
|
495
|
+
children: 'Light Button',
|
|
496
|
+
loading: true,
|
|
497
|
+
},
|
|
498
|
+
decorators: [
|
|
499
|
+
(Story) => (
|
|
500
|
+
<div
|
|
501
|
+
style={{
|
|
502
|
+
backgroundColor: grey[900],
|
|
503
|
+
padding: '0.5rem',
|
|
504
|
+
borderRadius: '0.5rem',
|
|
505
|
+
display: 'inline-flex',
|
|
506
|
+
alignItems: 'center',
|
|
507
|
+
justifyContent: 'center',
|
|
508
|
+
}}
|
|
509
|
+
>
|
|
510
|
+
<Story />
|
|
511
|
+
</div>
|
|
512
|
+
),
|
|
513
|
+
],
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
export const LightOutlinedWithIconLoading: Story = {
|
|
517
|
+
args: {
|
|
518
|
+
variant: 'outlined',
|
|
519
|
+
color: 'light' as any,
|
|
520
|
+
startIcon: <PlusBoldIcon />,
|
|
521
|
+
children: 'Light Button with Icon',
|
|
522
|
+
loading: true,
|
|
523
|
+
},
|
|
524
|
+
decorators: [
|
|
525
|
+
(Story) => (
|
|
526
|
+
<div
|
|
527
|
+
style={{
|
|
528
|
+
backgroundColor: grey[900],
|
|
529
|
+
padding: '0.5rem',
|
|
530
|
+
borderRadius: '0.5rem',
|
|
531
|
+
display: 'inline-flex',
|
|
532
|
+
alignItems: 'center',
|
|
533
|
+
justifyContent: 'center',
|
|
534
|
+
}}
|
|
535
|
+
>
|
|
536
|
+
<Story />
|
|
537
|
+
</div>
|
|
538
|
+
),
|
|
539
|
+
],
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
export const GhostOutlinedIconOnlyLoading: Story = {
|
|
543
|
+
args: {
|
|
544
|
+
'aria-label': 'Close',
|
|
545
|
+
children: <PlusBoldIcon />,
|
|
546
|
+
color: 'ghost' as any,
|
|
547
|
+
iconOnly: true,
|
|
548
|
+
variant: 'outlined',
|
|
549
|
+
loading: true,
|
|
550
|
+
},
|
|
551
|
+
decorators: [
|
|
552
|
+
(Story) => (
|
|
553
|
+
<div
|
|
554
|
+
style={{
|
|
555
|
+
backgroundColor: grey[900],
|
|
556
|
+
padding: '0.5rem',
|
|
557
|
+
borderRadius: '0.5rem',
|
|
558
|
+
display: 'inline-flex',
|
|
559
|
+
alignItems: 'center',
|
|
560
|
+
justifyContent: 'center',
|
|
561
|
+
}}
|
|
562
|
+
>
|
|
563
|
+
<Story />
|
|
564
|
+
</div>
|
|
565
|
+
),
|
|
566
|
+
],
|
|
567
|
+
}
|
|
@@ -463,7 +463,7 @@ function SnackbarDemoLongText() {
|
|
|
463
463
|
showSnackbar({
|
|
464
464
|
state: 'info',
|
|
465
465
|
message:
|
|
466
|
-
'Tai yra labai ilgas pranešimas kuris turėtų būti trumpintas su elipsu jei nepakanka vietos komponente. Šis tekstas skirtas testuoti teksto
|
|
466
|
+
'Tai yra labai ilgas pranešimas kuris turėtų būti trumpintas su elipsu jei nepakanka vietos komponente. Šis tekstas skirtas testuoti teksto trumpinimą, tai yra labai labai labai ilgas tekstas testavimui.',
|
|
467
467
|
showClose: true,
|
|
468
468
|
})
|
|
469
469
|
}
|
|
@@ -25,6 +25,7 @@ import CheckUncheckedBoldIcon from '@/assets/icons/CheckUncheckedBoldIcon'
|
|
|
25
25
|
import CircleFilledIcon from '@/assets/icons/CircleFilledIcon'
|
|
26
26
|
import CloseIcon from '@/assets/icons/CloseIcon'
|
|
27
27
|
import CollapseChevronsIcon from '@/assets/icons/CollapseChevronsIcon'
|
|
28
|
+
import CopyIcon from '@/assets/icons/CopyIcon'
|
|
28
29
|
import DotCircleFilledIcon from '@/assets/icons/DotCircleFilledIcon'
|
|
29
30
|
import ExpandChevronsIcon from '@/assets/icons/ExpandChevronsIcon'
|
|
30
31
|
import InfoFillIcon from '@/assets/icons/InfoFillIcon'
|
|
@@ -182,6 +183,10 @@ const iconItems: IconStoryItem[] = [
|
|
|
182
183
|
name: 'CollapseChevronsIcon',
|
|
183
184
|
render: renderIcon(CollapseChevronsIcon),
|
|
184
185
|
},
|
|
186
|
+
{
|
|
187
|
+
name: 'CopyIcon',
|
|
188
|
+
render: renderIcon(CopyIcon),
|
|
189
|
+
},
|
|
185
190
|
{
|
|
186
191
|
name: 'DotCircleFilledIcon',
|
|
187
192
|
render: renderIcon(DotCircleFilledIcon),
|
|
@@ -3,8 +3,7 @@ import { Meta, StoryObj } from '@storybook/react'
|
|
|
3
3
|
import React from 'react'
|
|
4
4
|
|
|
5
5
|
import RcSesServiceHeader from '@/components/layout/ServiceHeader'
|
|
6
|
-
|
|
7
|
-
type ServiceHeaderProps = React.ComponentProps<typeof RcSesServiceHeader>
|
|
6
|
+
import { common, grey } from '@/theme/palette'
|
|
8
7
|
|
|
9
8
|
const meta: Meta<typeof RcSesServiceHeader> = {
|
|
10
9
|
title: 'components/layout/ServiceHeader',
|
|
@@ -13,13 +12,7 @@ const meta: Meta<typeof RcSesServiceHeader> = {
|
|
|
13
12
|
argTypes: {
|
|
14
13
|
title: { control: 'text' },
|
|
15
14
|
children: { control: 'text' },
|
|
16
|
-
backgroundColor: {
|
|
17
|
-
control: 'inline-radio',
|
|
18
|
-
options: ['primary', 'white'],
|
|
19
|
-
table: {
|
|
20
|
-
defaultValue: { summary: 'primary' },
|
|
21
|
-
},
|
|
22
|
-
},
|
|
15
|
+
backgroundColor: { control: 'text' },
|
|
23
16
|
},
|
|
24
17
|
}
|
|
25
18
|
|
|
@@ -39,31 +32,31 @@ export const Default: Story = {
|
|
|
39
32
|
title: 'Service Title',
|
|
40
33
|
children: 'This is a description of the service.',
|
|
41
34
|
breadcrumbsProps: breadcrumbs,
|
|
42
|
-
backgroundColor:
|
|
35
|
+
backgroundColor: common.white,
|
|
43
36
|
},
|
|
44
37
|
render: (args) => (
|
|
45
38
|
<RcSesServiceHeader
|
|
46
39
|
title={args.title}
|
|
47
40
|
breadcrumbsProps={args.breadcrumbsProps}
|
|
48
|
-
backgroundColor={args.backgroundColor
|
|
41
|
+
backgroundColor={args.backgroundColor}
|
|
49
42
|
>
|
|
50
43
|
{args.children && <Typography variant='body1'>{args.children}</Typography>}
|
|
51
44
|
</RcSesServiceHeader>
|
|
52
45
|
),
|
|
53
46
|
}
|
|
54
47
|
|
|
55
|
-
export const
|
|
48
|
+
export const CustomBackground: Story = {
|
|
56
49
|
args: {
|
|
57
50
|
title: 'Service Title',
|
|
58
|
-
children: 'This is a description of the service.',
|
|
51
|
+
children: 'This is a description of the service with custom background.',
|
|
59
52
|
breadcrumbsProps: breadcrumbs,
|
|
60
|
-
backgroundColor: '
|
|
53
|
+
backgroundColor: grey['100'],
|
|
61
54
|
},
|
|
62
55
|
render: (args) => (
|
|
63
56
|
<RcSesServiceHeader
|
|
64
57
|
title={args.title}
|
|
65
58
|
breadcrumbsProps={args.breadcrumbsProps}
|
|
66
|
-
backgroundColor={args.backgroundColor
|
|
59
|
+
backgroundColor={args.backgroundColor}
|
|
67
60
|
>
|
|
68
61
|
{args.children && <Typography variant='body1'>{args.children}</Typography>}
|
|
69
62
|
</RcSesServiceHeader>
|
|
@@ -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
|
+
}
|