@registrucentras/rc-ses-react-components 1.7.1 → 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/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 +1897 -1662
- package/dist/stories/components/actions/Button.stories.d.ts +26 -0
- 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/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/icons/Icons.stories.tsx +5 -0
- 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
|
+
}
|
|
@@ -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),
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
|
|
3
|
+
import RcSesLoadingSpinner, {
|
|
4
|
+
RcSesSpinnerColor,
|
|
5
|
+
} from '@/components/LoadingSpinner/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/actions/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
|
+
}
|