@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.
Files changed (44) hide show
  1. package/dist/assets/icons/CheckCircleFillIcon.d.ts +1 -1
  2. package/dist/assets/icons/CopyIcon.d.ts +3 -0
  3. package/dist/assets/icons/InfoFillIcon.d.ts +1 -1
  4. package/dist/assets/icons/QuestionFillIcon.d.ts +1 -1
  5. package/dist/assets/icons/WarningFillIcon.d.ts +1 -1
  6. package/dist/components/LoadingSpinner/LoadingSpinner.d.ts +10 -0
  7. package/dist/components/common/Button/index.d.ts +1 -1
  8. package/dist/components/overlays/Dialog/index.d.ts +11 -0
  9. package/dist/components/overlays/Modal/index.d.ts +16 -0
  10. package/dist/library/icons.d.ts +2 -1
  11. package/dist/library/index.d.ts +4 -1
  12. package/dist/library/types.d.ts +6 -1
  13. package/dist/registrucentras-rc-ses-react-components.cjs +10 -10
  14. package/dist/registrucentras-rc-ses-react-components.js +1897 -1662
  15. package/dist/stories/components/actions/Button.stories.d.ts +26 -0
  16. package/dist/stories/components/overlays/Dialog.stories.d.ts +9 -0
  17. package/dist/stories/components/overlays/Modal.stories.d.ts +10 -0
  18. package/dist/stories/components/spinner/LoadingSpinner.stories.d.ts +62 -0
  19. package/package.json +1 -1
  20. package/src/assets/icons/CheckCircleFillIcon.tsx +8 -2
  21. package/src/assets/icons/CopyIcon.tsx +23 -0
  22. package/src/assets/icons/InfoFillIcon.tsx +8 -2
  23. package/src/assets/icons/QuestionFillIcon.tsx +8 -2
  24. package/src/assets/icons/WarningFillIcon.tsx +8 -2
  25. package/src/components/LoadingSpinner/LoadingSpinner.test.tsx +48 -0
  26. package/src/components/LoadingSpinner/LoadingSpinner.tsx +70 -0
  27. package/src/components/common/Button/index.test.tsx +175 -0
  28. package/src/components/common/Button/index.tsx +48 -4
  29. package/src/components/overlays/Dialog/index.test.tsx +85 -0
  30. package/src/components/overlays/Dialog/index.tsx +85 -0
  31. package/src/components/overlays/Modal/index.test.tsx +94 -0
  32. package/src/components/overlays/Modal/index.tsx +116 -0
  33. package/src/i18n/namespaces/common/en.json +3 -0
  34. package/src/i18n/namespaces/common/lt.json +3 -0
  35. package/src/i18n/namespaces/input/en.json +18 -0
  36. package/src/i18n/namespaces/input/lt.json +18 -0
  37. package/src/library/icons.ts +2 -0
  38. package/src/library/index.ts +6 -0
  39. package/src/library/types.ts +10 -0
  40. package/src/stories/components/actions/Button.stories.tsx +201 -0
  41. package/src/stories/components/icons/Icons.stories.tsx +5 -0
  42. package/src/stories/components/overlays/Dialog.stories.tsx +271 -0
  43. package/src/stories/components/overlays/Modal.stories.tsx +98 -0
  44. package/src/stories/components/spinner/LoadingSpinner.stories.tsx +126 -0
@@ -48,6 +48,16 @@ declare const meta: {
48
48
  defaultValue: {};
49
49
  };
50
50
  };
51
+ loading: {
52
+ control: {
53
+ type: "boolean";
54
+ };
55
+ table: {
56
+ defaultValue: {
57
+ summary: string;
58
+ };
59
+ };
60
+ };
51
61
  };
52
62
  tags: string[];
53
63
  args: {
@@ -78,3 +88,19 @@ export declare const LightOutlinedWithIcon: Story;
78
88
  export declare const LightOutlinedDisabled: Story;
79
89
  export declare const GhostOutlinedIconOnly: Story;
80
90
  export declare const GhostOutlinedIconOnlyDisabled: Story;
91
+ export declare const PrimaryContainedLoading: Story;
92
+ export declare const PrimaryContainedLoadingWithIcon: Story;
93
+ export declare const PrimaryContainedLoadingWithEndIcon: Story;
94
+ export declare const PrimaryContainedIconOnlyLoading: Story;
95
+ export declare const PrimaryOutlinedLoading: Story;
96
+ export declare const SecondaryContainedLoading: Story;
97
+ export declare const SecondaryOutlinedLoading: Story;
98
+ export declare const GreyContainedLoading: Story;
99
+ export declare const GreyOutlinedLoading: Story;
100
+ export declare const WarningContainedLoading: Story;
101
+ export declare const WarningOutlinedLoading: Story;
102
+ export declare const ErrorContainedLoading: Story;
103
+ export declare const ErrorOutlinedLoading: Story;
104
+ export declare const LightOutlinedLoading: Story;
105
+ export declare const LightOutlinedWithIconLoading: Story;
106
+ export declare const GhostOutlinedIconOnlyLoading: Story;
@@ -0,0 +1,9 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { default as RcSesDialog } from '../../../components/overlays/Dialog';
3
+ declare const meta: Meta<typeof RcSesDialog>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof RcSesDialog>;
6
+ export declare const Basic: Story;
7
+ export declare const SmallDialog: Story;
8
+ export declare const MediumDialog: Story;
9
+ export declare const LargeDialog: Story;
@@ -0,0 +1,10 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { default as RcSesModal } from '../../../components/overlays/Modal';
3
+ declare const meta: Meta<typeof RcSesModal>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof RcSesModal>;
6
+ export declare const Destructive: Story;
7
+ export declare const Confirm: Story;
8
+ export declare const Success: Story;
9
+ export declare const Info: Story;
10
+ export declare const WithoutIcon: Story;
@@ -0,0 +1,62 @@
1
+ import { StoryObj } from '@storybook/react';
2
+ import { default as RcSesLoadingSpinner } from '../../../components/LoadingSpinner/LoadingSpinner';
3
+ declare const meta: {
4
+ title: string;
5
+ component: typeof RcSesLoadingSpinner;
6
+ parameters: {
7
+ layout: string;
8
+ docs: {
9
+ description: {
10
+ component: string;
11
+ };
12
+ };
13
+ };
14
+ argTypes: {
15
+ color: {
16
+ description: string;
17
+ options: ("primary" | "secondary" | "error" | "warning" | "info" | "success" | "inherit")[];
18
+ mapping: ("primary" | "secondary" | "error" | "warning" | "info" | "success" | "inherit")[];
19
+ control: {
20
+ type: "select";
21
+ labels: ("primary" | "secondary" | "error" | "warning" | "info" | "success" | "inherit")[];
22
+ };
23
+ table: {
24
+ defaultValue: {
25
+ summary: string;
26
+ };
27
+ type: {
28
+ summary: string;
29
+ };
30
+ };
31
+ };
32
+ size: {
33
+ description: string;
34
+ options: string[];
35
+ mapping: string[];
36
+ control: {
37
+ type: "select";
38
+ labels: string[];
39
+ };
40
+ table: {
41
+ defaultValue: {
42
+ summary: string;
43
+ };
44
+ type: {
45
+ summary: string;
46
+ };
47
+ };
48
+ };
49
+ };
50
+ tags: string[];
51
+ };
52
+ export default meta;
53
+ type Story = StoryObj<typeof meta>;
54
+ export declare const Default: Story;
55
+ export declare const Small: Story;
56
+ export declare const Large: Story;
57
+ export declare const Primary: Story;
58
+ export declare const Secondary: Story;
59
+ export declare const Error: Story;
60
+ export declare const Success: Story;
61
+ export declare const Warning: Story;
62
+ export declare const Info: Story;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@registrucentras/rc-ses-react-components",
3
3
  "author": "VĮ REGISTRŲ CENTRAS",
4
- "version": "1.7.1",
4
+ "version": "1.8.0",
5
5
  "description": "RC SES React komponentų biblioteka",
6
6
  "type": "module",
7
7
  "private": false,
@@ -2,13 +2,19 @@ import { CheckCircleIcon as CheckCircleFillIcon } from '@phosphor-icons/react'
2
2
 
3
3
  import IconProps from '../IconProps'
4
4
 
5
- function CheckCircleIcon({ className, fillColor, size = 24, ...rest }: IconProps) {
5
+ function CheckCircleIcon({
6
+ className,
7
+ fillColor,
8
+ size = 24,
9
+ weight = 'fill',
10
+ ...rest
11
+ }: IconProps) {
6
12
  return (
7
13
  <CheckCircleFillIcon
8
14
  {...rest}
9
15
  className={className}
10
16
  size={size}
11
- weight='fill'
17
+ weight={weight}
12
18
  color={fillColor}
13
19
  />
14
20
  )
@@ -0,0 +1,23 @@
1
+ import { CopyIcon as CopyFillIcon } from '@phosphor-icons/react'
2
+
3
+ import IconProps from '../IconProps'
4
+
5
+ function CopyIcon({
6
+ className,
7
+ fillColor,
8
+ size = 24,
9
+ weight = 'regular',
10
+ ...rest
11
+ }: IconProps) {
12
+ return (
13
+ <CopyFillIcon
14
+ {...rest}
15
+ className={className}
16
+ size={size}
17
+ weight={weight}
18
+ color={fillColor}
19
+ />
20
+ )
21
+ }
22
+
23
+ export default CopyIcon
@@ -2,9 +2,15 @@ import { InfoIcon as Info } from '@phosphor-icons/react'
2
2
 
3
3
  import IconProps from '../IconProps'
4
4
 
5
- function InfoFillIcon({ className, size = 24, fillColor, ...rest }: IconProps) {
5
+ function InfoFillIcon({
6
+ className,
7
+ size = 24,
8
+ fillColor,
9
+ weight = 'fill',
10
+ ...rest
11
+ }: IconProps) {
6
12
  return (
7
- <Info {...rest} className={className} size={size} weight='fill' color={fillColor} />
13
+ <Info {...rest} className={className} size={size} weight={weight} color={fillColor} />
8
14
  )
9
15
  }
10
16
 
@@ -2,13 +2,19 @@ import { QuestionIcon as Question } from '@phosphor-icons/react'
2
2
 
3
3
  import IconProps from '../IconProps'
4
4
 
5
- function QuestionFillIcon({ className, size = 16, fillColor, ...rest }: IconProps) {
5
+ function QuestionFillIcon({
6
+ className,
7
+ size = 16,
8
+ fillColor,
9
+ weight = 'fill',
10
+ ...rest
11
+ }: IconProps) {
6
12
  return (
7
13
  <Question
8
14
  {...rest}
9
15
  className={className}
10
16
  size={size}
11
- weight='fill'
17
+ weight={weight}
12
18
  color={fillColor}
13
19
  />
14
20
  )
@@ -2,13 +2,19 @@ import { WarningIcon as Warning } from '@phosphor-icons/react'
2
2
 
3
3
  import IconProps from '../IconProps'
4
4
 
5
- function WarningFillIcon({ className, size = 24, fillColor, ...rest }: IconProps) {
5
+ function WarningFillIcon({
6
+ className,
7
+ size = 24,
8
+ fillColor,
9
+ weight = 'fill',
10
+ ...rest
11
+ }: IconProps) {
6
12
  return (
7
13
  <Warning
8
14
  {...rest}
9
15
  className={className}
10
16
  size={size}
11
- weight='fill'
17
+ weight={weight}
12
18
  color={fillColor}
13
19
  />
14
20
  )
@@ -0,0 +1,48 @@
1
+ import { render, screen } from '@testing-library/react'
2
+ import { describe, expect, it } from 'vitest'
3
+
4
+ import RcSesLoadingSpinner from './LoadingSpinner'
5
+
6
+ describe('RcSesLoadingSpinner', () => {
7
+ it('should render a progress bar', () => {
8
+ render(<RcSesLoadingSpinner />)
9
+
10
+ const progressbar = screen.getByRole('progressbar')
11
+ expect(progressbar).toBeInTheDocument()
12
+ })
13
+
14
+ it('should render with default color inherit', () => {
15
+ render(<RcSesLoadingSpinner />)
16
+
17
+ const progressbar = screen.getByRole('progressbar')
18
+ expect(progressbar).toHaveClass('MuiCircularProgress-colorInherit')
19
+ })
20
+
21
+ it('should render with custom color', () => {
22
+ render(<RcSesLoadingSpinner color='primary' />)
23
+
24
+ const progressbar = screen.getByRole('progressbar')
25
+ expect(progressbar).toHaveClass('MuiCircularProgress-colorPrimary')
26
+ })
27
+
28
+ it('should render with custom size', () => {
29
+ render(<RcSesLoadingSpinner size='small' />)
30
+
31
+ const progressbar = screen.getByRole('progressbar')
32
+ expect(progressbar).toHaveStyle({ width: '16px', height: '16px' })
33
+ })
34
+
35
+ it('should render with medium size by default', () => {
36
+ render(<RcSesLoadingSpinner />)
37
+
38
+ const progressbar = screen.getByRole('progressbar')
39
+ expect(progressbar).toHaveStyle({ width: '20px', height: '20px' })
40
+ })
41
+
42
+ it('should support custom pixel size string', () => {
43
+ render(<RcSesLoadingSpinner size='32px' />)
44
+
45
+ const progressbar = screen.getByRole('progressbar')
46
+ expect(progressbar).toHaveStyle({ width: '32px', height: '32px' })
47
+ })
48
+ })
@@ -0,0 +1,70 @@
1
+ import { ButtonOwnProps, CircularProgress } from '@mui/material'
2
+
3
+ const VALID_SPINNER_COLORS = [
4
+ 'primary',
5
+ 'secondary',
6
+ 'error',
7
+ 'warning',
8
+ 'info',
9
+ 'success',
10
+ 'inherit',
11
+ ] as const
12
+
13
+ export type RcSesSpinnerColor = (typeof VALID_SPINNER_COLORS)[number]
14
+
15
+ const SPINNER_SIZE_MAP = {
16
+ small: '16px',
17
+ medium: '20px',
18
+ large: '24px',
19
+ } as const
20
+
21
+ // Custom colors that aren't MUI standard map to inherit (uses parent color)
22
+ const CUSTOM_COLOR_MAP: Record<string, RcSesSpinnerColor> = {
23
+ light: 'inherit',
24
+ ghost: 'inherit',
25
+ dark: 'inherit',
26
+ }
27
+
28
+ export function getSpinnerColor(color: ButtonOwnProps['color']): RcSesSpinnerColor {
29
+ if (color && VALID_SPINNER_COLORS.includes(color as RcSesSpinnerColor)) {
30
+ return color as RcSesSpinnerColor
31
+ }
32
+ return CUSTOM_COLOR_MAP[color as string] ?? 'inherit'
33
+ }
34
+
35
+ export interface RcSesLoadingSpinnerProps {
36
+ color?: RcSesSpinnerColor
37
+ size?: 'small' | 'medium' | 'large' | string
38
+ }
39
+
40
+ function RcSesLoadingSpinner({
41
+ color = 'inherit',
42
+ size = 'medium',
43
+ }: RcSesLoadingSpinnerProps) {
44
+ const spinnerSize = SPINNER_SIZE_MAP[size as keyof typeof SPINNER_SIZE_MAP] ?? size
45
+
46
+ return (
47
+ <CircularProgress
48
+ size={spinnerSize}
49
+ color={color}
50
+ variant='determinate'
51
+ value={75}
52
+ sx={{
53
+ animation: 'spin 1s linear infinite',
54
+ '@keyframes spin': {
55
+ from: {
56
+ transform: 'rotate(0deg)',
57
+ },
58
+ to: {
59
+ transform: 'rotate(360deg)',
60
+ },
61
+ },
62
+ '@media (prefers-reduced-motion: reduce)': {
63
+ animationDuration: '2s',
64
+ },
65
+ }}
66
+ />
67
+ )
68
+ }
69
+
70
+ export default RcSesLoadingSpinner
@@ -0,0 +1,175 @@
1
+ import { fireEvent, render, screen } from '@testing-library/react'
2
+ import { describe, expect, it, vi } from 'vitest'
3
+
4
+ import Button from './index'
5
+
6
+ describe('Button Component', () => {
7
+ describe('Loading State', () => {
8
+ it('should render loading spinner when loading is true', () => {
9
+ render(<Button loading>Save</Button>)
10
+
11
+ const spinner = screen.getByRole('progressbar')
12
+ expect(spinner).toBeInTheDocument()
13
+ })
14
+
15
+ it('should set aria-busy attribute when loading', () => {
16
+ render(<Button loading>Save</Button>)
17
+
18
+ const button = screen.getByRole('button')
19
+ expect(button).toHaveAttribute('aria-busy', 'true')
20
+ })
21
+
22
+ it('should disable button when loading=true', () => {
23
+ render(<Button loading>Save</Button>)
24
+
25
+ const button = screen.getByRole('button')
26
+ expect(button).toBeDisabled()
27
+ })
28
+
29
+ it('should show spinner instead of children when loading', () => {
30
+ render(<Button loading>Save</Button>)
31
+
32
+ expect(screen.queryByText('Save')).not.toBeInTheDocument()
33
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
34
+ })
35
+
36
+ it('should replace startIcon with spinner when loading', () => {
37
+ render(
38
+ <Button loading startIcon={<span data-testid='start-icon'>+</span>}>
39
+ Add
40
+ </Button>,
41
+ )
42
+
43
+ expect(screen.queryByTestId('start-icon')).not.toBeInTheDocument()
44
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
45
+ })
46
+
47
+ it('should replace endIcon with spinner when loading', () => {
48
+ render(
49
+ <Button loading endIcon={<span data-testid='end-icon'>→</span>}>
50
+ Next
51
+ </Button>,
52
+ )
53
+
54
+ expect(screen.queryByTestId('end-icon')).not.toBeInTheDocument()
55
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
56
+ })
57
+
58
+ it('should prevent click when loading=true', () => {
59
+ const handleClick = vi.fn()
60
+ render(
61
+ <Button loading onClick={handleClick}>
62
+ Save
63
+ </Button>,
64
+ )
65
+
66
+ const button = screen.getByRole('button')
67
+ fireEvent.click(button)
68
+
69
+ expect(handleClick).not.toHaveBeenCalled()
70
+ })
71
+ })
72
+
73
+ describe('Disabled State', () => {
74
+ it('should disable button when disabled=true', () => {
75
+ render(<Button disabled>Save</Button>)
76
+
77
+ const button = screen.getByRole('button')
78
+ expect(button).toBeDisabled()
79
+ })
80
+
81
+ it('should prevent click when disabled=true', () => {
82
+ const handleClick = vi.fn()
83
+ render(
84
+ <Button disabled onClick={handleClick}>
85
+ Save
86
+ </Button>,
87
+ )
88
+
89
+ const button = screen.getByRole('button')
90
+ fireEvent.click(button)
91
+
92
+ expect(handleClick).not.toHaveBeenCalled()
93
+ })
94
+ })
95
+
96
+ describe('Loading + Disabled States', () => {
97
+ it('should show spinner and be disabled when both loading and disabled are true', () => {
98
+ const handleClick = vi.fn()
99
+ render(
100
+ <Button loading disabled onClick={handleClick}>
101
+ Save
102
+ </Button>,
103
+ )
104
+
105
+ const button = screen.getByRole('button')
106
+ expect(button).toBeDisabled()
107
+ expect(button).toHaveAttribute('aria-busy', 'true')
108
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
109
+ })
110
+ })
111
+
112
+ describe('Variants', () => {
113
+ it('should render contained variant by default', () => {
114
+ render(<Button>Save</Button>)
115
+
116
+ const button = screen.getByRole('button')
117
+ expect(button).toHaveClass('MuiButton-contained')
118
+ })
119
+
120
+ it('should render outlined variant when specified', () => {
121
+ render(<Button variant='outlined'>Save</Button>)
122
+
123
+ const button = screen.getByRole('button')
124
+ expect(button).toHaveClass('MuiButton-outlined')
125
+ })
126
+
127
+ it('should render text variant when specified', () => {
128
+ render(<Button variant='text'>Save</Button>)
129
+
130
+ const button = screen.getByRole('button')
131
+ expect(button).toHaveClass('MuiButton-textPrimary')
132
+ })
133
+ })
134
+
135
+ describe('Icon Only Buttons', () => {
136
+ it('should show spinner in place of icon when loading and iconOnly', () => {
137
+ render(
138
+ <Button
139
+ loading
140
+ iconOnly
141
+ variant='contained'
142
+ startIcon={<span data-testid='icon'>+</span>}
143
+ >
144
+ Add
145
+ </Button>,
146
+ )
147
+
148
+ expect(screen.queryByTestId('icon')).not.toBeInTheDocument()
149
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
150
+ })
151
+ })
152
+
153
+ describe('Size Props', () => {
154
+ it('should render small button', () => {
155
+ render(<Button size='small'>Save</Button>)
156
+
157
+ const button = screen.getByRole('button')
158
+ expect(button).toHaveClass('MuiButton-sizeSmall')
159
+ })
160
+
161
+ it('should render medium button by default', () => {
162
+ render(<Button>Save</Button>)
163
+
164
+ const button = screen.getByRole('button')
165
+ expect(button).toHaveClass('MuiButton-sizeMedium')
166
+ })
167
+
168
+ it('should render large button', () => {
169
+ render(<Button size='large'>Save</Button>)
170
+
171
+ const button = screen.getByRole('button')
172
+ expect(button).toHaveClass('MuiButton-sizeLarge')
173
+ })
174
+ })
175
+ })
@@ -1,5 +1,9 @@
1
1
  import { Button as MuiButton, ButtonProps as MuiButtonProps } from '@mui/material'
2
+ import { useTranslation } from 'react-i18next'
2
3
 
4
+ import RcSesLoadingSpinner, {
5
+ getSpinnerColor,
6
+ } from '@/components/LoadingSpinner/LoadingSpinner'
3
7
  import { ButtonProps } from '@/types/buttons/ButtonProps'
4
8
 
5
9
  const defaultProps: Partial<MuiButtonProps> = {
@@ -14,21 +18,61 @@ const ICON_ONLY_SIZE_MAP = {
14
18
  large: '3rem',
15
19
  } as const
16
20
 
17
- type Props = ButtonProps & { to?: string }
21
+ // TODO: use MUI's loading prop when MUI lib upgrade is done
22
+ type Props = ButtonProps & {
23
+ loading?: boolean
24
+ }
18
25
 
19
26
  function RcSesButton(props: Props) {
20
- const { children, iconOnly, size = 'medium', sx, variant, ...rest } = props
27
+ const { t } = useTranslation('common')
28
+ const {
29
+ children,
30
+ iconOnly,
31
+ loading = false,
32
+ size = 'medium',
33
+ sx,
34
+ variant,
35
+ ...rest
36
+ } = props
21
37
 
22
38
  const currentVariant = variant ?? defaultProps.variant
23
39
  const isIconOnly =
24
40
  !!iconOnly && (currentVariant === 'contained' || currentVariant === 'outlined')
25
41
 
42
+ const showSpinnerInContent = loading && !isIconOnly && !rest.startIcon && !rest.endIcon
43
+ const showSpinnerAsIcon = loading && isIconOnly
44
+
45
+ const spinnerColor = getSpinnerColor(rest.color)
46
+ const spinner = <RcSesLoadingSpinner color={spinnerColor} size={size} />
47
+
48
+ const getIconDisplay = (icon: React.ReactNode) => {
49
+ if (showSpinnerAsIcon) return undefined
50
+ if (loading && !isIconOnly && icon) return spinner
51
+ return icon
52
+ }
53
+
54
+ const displayIcon = getIconDisplay(rest.startIcon)
55
+ const displayEndIcon = getIconDisplay(rest.endIcon)
56
+
57
+ let displayContent = children
58
+ if (showSpinnerInContent || showSpinnerAsIcon) displayContent = spinner
59
+
26
60
  return (
27
61
  <MuiButton
28
62
  {...defaultProps}
29
63
  {...rest}
64
+ // TODO: use loading prop when MUI lib upgrade is done
65
+ disabled={loading || rest.disabled}
30
66
  size={size}
31
- variant={variant}
67
+ variant={currentVariant}
68
+ aria-busy={loading || undefined}
69
+ aria-label={
70
+ loading && rest['aria-label']
71
+ ? `${rest['aria-label']} – ${t('components.Button.loading')}`
72
+ : rest['aria-label']
73
+ }
74
+ startIcon={displayIcon}
75
+ endIcon={displayEndIcon}
32
76
  sx={[
33
77
  ...(Array.isArray(sx) ? sx : [sx]),
34
78
  isIconOnly
@@ -44,7 +88,7 @@ function RcSesButton(props: Props) {
44
88
  : undefined,
45
89
  ]}
46
90
  >
47
- {children}
91
+ {displayContent}
48
92
  </MuiButton>
49
93
  )
50
94
  }