@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,116 @@
|
|
|
1
|
+
import { Button, Typography } from '@mui/material'
|
|
2
|
+
import { ReactNode } from 'react'
|
|
3
|
+
import { useTranslation } from 'react-i18next'
|
|
4
|
+
|
|
5
|
+
import CheckCircleFillIcon from '@/assets/icons/CheckCircleFillIcon'
|
|
6
|
+
import InfoFillIcon from '@/assets/icons/InfoFillIcon'
|
|
7
|
+
import QuestionFillIcon from '@/assets/icons/QuestionFillIcon'
|
|
8
|
+
import WarningFillIcon from '@/assets/icons/WarningFillIcon'
|
|
9
|
+
import palette from '@/theme/palette'
|
|
10
|
+
|
|
11
|
+
import RcSesDialog, { RcSesDialogProps } from '../Dialog'
|
|
12
|
+
|
|
13
|
+
export type ModalVariant = 'destructive' | 'confirm' | 'success' | 'info'
|
|
14
|
+
|
|
15
|
+
const VARIANT_CONFIG: Record<ModalVariant, { icon: ReactNode }> = {
|
|
16
|
+
destructive: {
|
|
17
|
+
icon: <WarningFillIcon size={36} weight='regular' fillColor={palette.error['600']} />,
|
|
18
|
+
},
|
|
19
|
+
confirm: {
|
|
20
|
+
icon: <QuestionFillIcon size={36} weight='regular' fillColor={palette.grey['700']} />,
|
|
21
|
+
},
|
|
22
|
+
success: {
|
|
23
|
+
icon: (
|
|
24
|
+
<CheckCircleFillIcon
|
|
25
|
+
size={36}
|
|
26
|
+
weight='regular'
|
|
27
|
+
fillColor={palette.secondary['600']}
|
|
28
|
+
/>
|
|
29
|
+
),
|
|
30
|
+
},
|
|
31
|
+
info: {
|
|
32
|
+
icon: <InfoFillIcon size={36} weight='regular' fillColor={palette.primary['500']} />,
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface RcSesModalProps
|
|
37
|
+
extends Omit<RcSesDialogProps, 'children' | 'dialogTitle' | 'actions'> {
|
|
38
|
+
title: string
|
|
39
|
+
message: ReactNode
|
|
40
|
+
variant?: ModalVariant
|
|
41
|
+
showIcon?: boolean
|
|
42
|
+
onPrimaryAction?: () => void
|
|
43
|
+
onSecondaryAction?: () => void
|
|
44
|
+
primaryActionLabel?: string
|
|
45
|
+
secondaryActionLabel?: string
|
|
46
|
+
actions?: ReactNode
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function RcSesModal({
|
|
50
|
+
title,
|
|
51
|
+
message,
|
|
52
|
+
variant = 'info',
|
|
53
|
+
showIcon = false,
|
|
54
|
+
onPrimaryAction,
|
|
55
|
+
onSecondaryAction,
|
|
56
|
+
primaryActionLabel,
|
|
57
|
+
secondaryActionLabel,
|
|
58
|
+
actions: customActions,
|
|
59
|
+
...props
|
|
60
|
+
}: RcSesModalProps) {
|
|
61
|
+
const { t } = useTranslation('input', { keyPrefix: 'components.Modal' })
|
|
62
|
+
const config = VARIANT_CONFIG[variant]
|
|
63
|
+
|
|
64
|
+
const getPrimaryLabel = () => {
|
|
65
|
+
if (primaryActionLabel) return primaryActionLabel
|
|
66
|
+
return t(`actions.${variant}.primary`)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const getSecondaryLabel = () => {
|
|
70
|
+
if (secondaryActionLabel) return secondaryActionLabel
|
|
71
|
+
return t('actions.cancel')
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const titleContent = showIcon ? (
|
|
75
|
+
<div
|
|
76
|
+
style={{
|
|
77
|
+
display: 'flex',
|
|
78
|
+
flexDirection: 'column',
|
|
79
|
+
alignItems: 'flex-start',
|
|
80
|
+
gap: 8,
|
|
81
|
+
}}
|
|
82
|
+
>
|
|
83
|
+
<div aria-hidden='true'>{config.icon}</div>
|
|
84
|
+
{title}
|
|
85
|
+
</div>
|
|
86
|
+
) : (
|
|
87
|
+
title
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
const defaultActions = (
|
|
91
|
+
<>
|
|
92
|
+
{(variant === 'destructive' || variant === 'confirm') && (
|
|
93
|
+
<Button onClick={onSecondaryAction} variant='outlined' color='grey'>
|
|
94
|
+
{getSecondaryLabel()}
|
|
95
|
+
</Button>
|
|
96
|
+
)}
|
|
97
|
+
<Button
|
|
98
|
+
onClick={onPrimaryAction}
|
|
99
|
+
variant='contained'
|
|
100
|
+
color={variant === 'destructive' ? 'error' : 'primary'}
|
|
101
|
+
>
|
|
102
|
+
{getPrimaryLabel()}
|
|
103
|
+
</Button>
|
|
104
|
+
</>
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
const actions = customActions || defaultActions
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<RcSesDialog dialogTitle={titleContent} actions={actions} {...props}>
|
|
111
|
+
<Typography variant='body1'>{message}</Typography>
|
|
112
|
+
</RcSesDialog>
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export default RcSesModal
|
|
@@ -59,6 +59,24 @@
|
|
|
59
59
|
"aria": {
|
|
60
60
|
"close": "Close notification"
|
|
61
61
|
}
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
"Modal": {
|
|
65
|
+
"actions": {
|
|
66
|
+
"destructive": {
|
|
67
|
+
"primary": "Remove"
|
|
68
|
+
},
|
|
69
|
+
"confirm": {
|
|
70
|
+
"primary": "Continue"
|
|
71
|
+
},
|
|
72
|
+
"success": {
|
|
73
|
+
"primary": "Close"
|
|
74
|
+
},
|
|
75
|
+
"info": {
|
|
76
|
+
"primary": "I understand"
|
|
77
|
+
},
|
|
78
|
+
"cancel": "Cancel"
|
|
79
|
+
}
|
|
62
80
|
}
|
|
63
81
|
}
|
|
64
82
|
}
|
|
@@ -59,6 +59,24 @@
|
|
|
59
59
|
"aria": {
|
|
60
60
|
"close": "Uždaryti pranešimą"
|
|
61
61
|
}
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
"Modal": {
|
|
65
|
+
"actions": {
|
|
66
|
+
"destructive": {
|
|
67
|
+
"primary": "Pašalinti"
|
|
68
|
+
},
|
|
69
|
+
"confirm": {
|
|
70
|
+
"primary": "Tęsti"
|
|
71
|
+
},
|
|
72
|
+
"success": {
|
|
73
|
+
"primary": "Uždaryti"
|
|
74
|
+
},
|
|
75
|
+
"info": {
|
|
76
|
+
"primary": "Suprantu"
|
|
77
|
+
},
|
|
78
|
+
"cancel": "Atšaukti"
|
|
79
|
+
}
|
|
62
80
|
}
|
|
63
81
|
}
|
|
64
82
|
}
|
package/src/library/icons.ts
CHANGED
|
@@ -19,6 +19,7 @@ import CheckUncheckedBoldIcon from '@/assets/icons/CheckUncheckedBoldIcon'
|
|
|
19
19
|
import CircleFilledIcon from '@/assets/icons/CircleFilledIcon'
|
|
20
20
|
import CloseIcon from '@/assets/icons/CloseIcon'
|
|
21
21
|
import CollapseChevronsIcon from '@/assets/icons/CollapseChevronsIcon'
|
|
22
|
+
import CopyIcon from '@/assets/icons/CopyIcon'
|
|
22
23
|
import DotCircleFilledIcon from '@/assets/icons/DotCircleFilledIcon'
|
|
23
24
|
import ExpandChevronsIcon from '@/assets/icons/ExpandChevronsIcon'
|
|
24
25
|
import InfoFillIcon from '@/assets/icons/InfoFillIcon'
|
|
@@ -62,6 +63,7 @@ export {
|
|
|
62
63
|
CircleFilledIcon,
|
|
63
64
|
CloseIcon,
|
|
64
65
|
CollapseChevronsIcon,
|
|
66
|
+
CopyIcon,
|
|
65
67
|
DotCircleFilledIcon,
|
|
66
68
|
ExpandChevronsIcon,
|
|
67
69
|
InfoFillIcon,
|
package/src/library/index.ts
CHANGED
|
@@ -46,6 +46,11 @@ import RcSesCardFormContainer from '@/components/layout/ServiceFormContainer/Car
|
|
|
46
46
|
import RcSesServiceHeader from '@/components/layout/ServiceHeader'
|
|
47
47
|
import RcSesServicePage from '@/components/layout/ServicePage'
|
|
48
48
|
import ServiceWizardStepper from '@/components/layout/ServiceWizardStepper'
|
|
49
|
+
import RcSesFullPageLoader from '@/components/loaders/FullPageLoader'
|
|
50
|
+
import RcSesLoader from '@/components/loaders/Loader'
|
|
51
|
+
import RcSesLoadingSpinner from '@/components/loaders/LoadingSpinner'
|
|
52
|
+
import RcSesDialog from '@/components/overlays/Dialog'
|
|
53
|
+
import RcSesModal from '@/components/overlays/Modal'
|
|
49
54
|
import RcSesTheme from '@/theme/light'
|
|
50
55
|
import RcSesPalette from '@/theme/palette'
|
|
51
56
|
|
|
@@ -64,11 +69,16 @@ export {
|
|
|
64
69
|
RcSesBreadcrumbs,
|
|
65
70
|
RcSesButton,
|
|
66
71
|
RcSesButtonWithPopover,
|
|
72
|
+
RcSesFullPageLoader,
|
|
73
|
+
RcSesLoader,
|
|
74
|
+
RcSesLoadingSpinner,
|
|
67
75
|
RcSesCard,
|
|
76
|
+
RcSesDialog,
|
|
68
77
|
RcSesFooter,
|
|
69
78
|
RcSesImageCard,
|
|
70
79
|
RcSesSnackbar,
|
|
71
80
|
RcSesSnackbarProvider,
|
|
81
|
+
RcSesModal,
|
|
72
82
|
}
|
|
73
83
|
export { RcSesCheckbox, RcSesCheckboxFormControl, RcSesSimpleCheckbox }
|
|
74
84
|
export { useSnackbar }
|
package/src/library/types.ts
CHANGED
|
@@ -5,15 +5,34 @@ import { RcSesFormControlLabelProps } from '@/components/form/inputs/FormControl
|
|
|
5
5
|
import { SimpleCheckboxProps } from '@/components/form/inputs/SimpleCheckbox'
|
|
6
6
|
import { RcSesCardFormContainerProps } from '@/components/layout/ServiceFormContainer/CardFormContainer'
|
|
7
7
|
import { ServiceWizardStepperProps } from '@/components/layout/ServiceWizardStepper'
|
|
8
|
+
import {
|
|
9
|
+
RcSesFullPageLoaderProps,
|
|
10
|
+
RcSesLoaderBackdrop,
|
|
11
|
+
} from '@/components/loaders/FullPageLoader'
|
|
12
|
+
import { RcSesLoaderProps, RcSesLoaderSize } from '@/components/loaders/Loader'
|
|
13
|
+
import {
|
|
14
|
+
RcSesLoadingSpinnerProps,
|
|
15
|
+
RcSesSpinnerColor,
|
|
16
|
+
} from '@/components/loaders/LoadingSpinner'
|
|
17
|
+
import { DialogSize, RcSesDialogProps } from '@/components/overlays/Dialog'
|
|
18
|
+
import { ModalVariant, RcSesModalProps } from '@/components/overlays/Modal'
|
|
8
19
|
import { ButtonProps } from '@/types/buttons/ButtonProps'
|
|
9
20
|
|
|
10
21
|
export type { ListWithIconsProps, ListWithIconsItemData }
|
|
11
22
|
export type { ButtonProps }
|
|
12
23
|
|
|
13
24
|
export type {
|
|
25
|
+
RcSesFullPageLoaderProps,
|
|
26
|
+
RcSesLoaderBackdrop,
|
|
27
|
+
RcSesLoaderProps,
|
|
28
|
+
RcSesLoaderSize,
|
|
14
29
|
RcSesCardFormContainerProps,
|
|
15
30
|
RcSesCardProps,
|
|
16
31
|
ServiceWizardStepperProps,
|
|
17
32
|
SimpleCheckboxProps,
|
|
18
33
|
RcSesFormControlLabelProps,
|
|
34
|
+
RcSesLoadingSpinnerProps,
|
|
35
|
+
RcSesSpinnerColor,
|
|
19
36
|
}
|
|
37
|
+
export type { RcSesDialogProps, DialogSize }
|
|
38
|
+
export type { RcSesModalProps, ModalVariant }
|
package/src/setupTests.ts
CHANGED
|
@@ -1 +1,14 @@
|
|
|
1
1
|
import '@testing-library/jest-dom/vitest'
|
|
2
|
+
import i18n from 'i18next'
|
|
3
|
+
import { initReactI18next } from 'react-i18next'
|
|
4
|
+
|
|
5
|
+
if (!i18n.isInitialized) {
|
|
6
|
+
i18n.use(initReactI18next).init({
|
|
7
|
+
fallbackLng: 'lt',
|
|
8
|
+
interpolation: { escapeValue: false },
|
|
9
|
+
lng: 'lt',
|
|
10
|
+
resources: {
|
|
11
|
+
lt: { translation: {} },
|
|
12
|
+
},
|
|
13
|
+
})
|
|
14
|
+
}
|
|
@@ -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,126 @@
|
|
|
1
|
+
import { Box, Stack } from '@mui/material'
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
3
|
+
|
|
4
|
+
import RcSesFullPageLoader from '@/components/loaders/FullPageLoader'
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'components/loaders/FullPageLoader/FullPageLoader',
|
|
8
|
+
component: RcSesFullPageLoader,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
parameters: {
|
|
11
|
+
controls: {
|
|
12
|
+
include: ['backdrop', 'label', 'showLabel'],
|
|
13
|
+
},
|
|
14
|
+
docs: {
|
|
15
|
+
story: {
|
|
16
|
+
inline: false,
|
|
17
|
+
height: 400,
|
|
18
|
+
},
|
|
19
|
+
description: {
|
|
20
|
+
component:
|
|
21
|
+
'Full-page loader overlay built on top of RcSesLoader with two backdrop variants: dark and light.',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
argTypes: {
|
|
26
|
+
backdrop: {
|
|
27
|
+
control: 'radio',
|
|
28
|
+
options: ['dark', 'light'],
|
|
29
|
+
},
|
|
30
|
+
label: {
|
|
31
|
+
control: 'text',
|
|
32
|
+
},
|
|
33
|
+
showLabel: {
|
|
34
|
+
control: 'boolean',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
} satisfies Meta<typeof RcSesFullPageLoader>
|
|
38
|
+
|
|
39
|
+
export default meta
|
|
40
|
+
|
|
41
|
+
type Story = StoryObj<typeof meta>
|
|
42
|
+
|
|
43
|
+
const FULL_PAGE_LOADER_USAGE_EXAMPLE =
|
|
44
|
+
"<RcSesFullPageLoader label='Kraunama...' showLabel />"
|
|
45
|
+
|
|
46
|
+
const FULL_PAGE_LOADER_DARK_USAGE_EXAMPLE =
|
|
47
|
+
"<RcSesFullPageLoader backdrop='dark' label='Kraunama...' showLabel />"
|
|
48
|
+
|
|
49
|
+
function PageMock() {
|
|
50
|
+
return (
|
|
51
|
+
<Stack spacing={2} sx={{ p: 4 }}>
|
|
52
|
+
<Box
|
|
53
|
+
sx={{ backgroundColor: 'grey.200', borderRadius: 1, height: 12, width: '35%' }}
|
|
54
|
+
/>
|
|
55
|
+
<Box
|
|
56
|
+
sx={{ backgroundColor: 'grey.200', borderRadius: 1, height: 12, width: '48%' }}
|
|
57
|
+
/>
|
|
58
|
+
<Box
|
|
59
|
+
sx={{ backgroundColor: 'grey.200', borderRadius: 1, height: 12, width: '42%' }}
|
|
60
|
+
/>
|
|
61
|
+
<Box
|
|
62
|
+
sx={{
|
|
63
|
+
backgroundColor: 'grey.200',
|
|
64
|
+
borderRadius: 1,
|
|
65
|
+
height: 112,
|
|
66
|
+
mt: 1,
|
|
67
|
+
width: '100%',
|
|
68
|
+
}}
|
|
69
|
+
/>
|
|
70
|
+
<Box
|
|
71
|
+
sx={{ backgroundColor: 'grey.200', borderRadius: 1, height: 88, width: '100%' }}
|
|
72
|
+
/>
|
|
73
|
+
<Box
|
|
74
|
+
sx={{ backgroundColor: 'grey.200', borderRadius: 1, height: 56, width: '65%' }}
|
|
75
|
+
/>
|
|
76
|
+
</Stack>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const renderPreview: Story['render'] = (args) => (
|
|
81
|
+
<Stack spacing={1.5} sx={{ width: '100%' }}>
|
|
82
|
+
<Box
|
|
83
|
+
sx={{
|
|
84
|
+
backgroundColor: '#f4f6f8',
|
|
85
|
+
borderRadius: 1,
|
|
86
|
+
minHeight: 360,
|
|
87
|
+
overflow: 'hidden',
|
|
88
|
+
position: 'relative',
|
|
89
|
+
width: '100%',
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
<PageMock />
|
|
93
|
+
<RcSesFullPageLoader {...args} />
|
|
94
|
+
</Box>
|
|
95
|
+
</Stack>
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
export const Default: Story = {
|
|
99
|
+
render: renderPreview,
|
|
100
|
+
parameters: {
|
|
101
|
+
docs: {
|
|
102
|
+
source: {
|
|
103
|
+
code: FULL_PAGE_LOADER_USAGE_EXAMPLE,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
args: {
|
|
108
|
+
label: 'Kraunama...',
|
|
109
|
+
showLabel: true,
|
|
110
|
+
},
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export const DarkBackdrop: Story = {
|
|
114
|
+
render: renderPreview,
|
|
115
|
+
parameters: {
|
|
116
|
+
docs: {
|
|
117
|
+
source: {
|
|
118
|
+
code: FULL_PAGE_LOADER_DARK_USAGE_EXAMPLE,
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
args: {
|
|
123
|
+
backdrop: 'dark',
|
|
124
|
+
label: 'Kraunama...',
|
|
125
|
+
},
|
|
126
|
+
}
|