@registrucentras/rc-ses-react-components 2.0.0 → 2.2.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 (78) hide show
  1. package/README.md +4 -0
  2. package/dist/assets/icons/ShoppingCartIcon.d.ts +3 -0
  3. package/dist/components/common/CardShell/index.d.ts +1 -1
  4. package/dist/components/common/CardShell/types.d.ts +10 -0
  5. package/dist/components/common/ListWithIcons/ListWithIcons.types.d.ts +4 -1
  6. package/dist/components/common/StepCard/StepCardFooter/index.d.ts +34 -0
  7. package/dist/components/common/StepCard/index.d.ts +3 -0
  8. package/dist/components/common/StepCard/types.d.ts +39 -0
  9. package/dist/components/common/TitleBlock/types.d.ts +1 -1
  10. package/dist/components/form/inputs/Select/Select.utils.d.ts +9 -0
  11. package/dist/components/form/inputs/Select/components/OptionCheckbox.d.ts +5 -0
  12. package/dist/components/form/inputs/Select/index.d.ts +18 -8
  13. package/dist/components/layout/ServiceFormContainer/CardFormContainer/index.d.ts +3 -0
  14. package/dist/components/loaders/LoadingSpinner/index.d.ts +1 -4
  15. package/dist/components/overlays/BottomSheet/index.d.ts +17 -0
  16. package/dist/components/overlays/BottomSheet/useSwipeToDismiss.d.ts +17 -0
  17. package/dist/library/icons.d.ts +2 -1
  18. package/dist/library/index.d.ts +3 -1
  19. package/dist/library/types.d.ts +6 -3
  20. package/dist/registrucentras-rc-ses-react-components.cjs +1 -1
  21. package/dist/registrucentras-rc-ses-react-components.js +3903 -3289
  22. package/dist/theme/cards.d.ts +12 -12
  23. package/dist/theme/light/MuiTypography.d.ts +14 -0
  24. package/dist/theme/palette.d.ts +124 -124
  25. package/dist/theme/spacing.d.ts +4 -0
  26. package/package.json +2 -1
  27. package/src/assets/icons/ShoppingCartIcon.tsx +16 -0
  28. package/src/components/common/Button/index.test.tsx +20 -11
  29. package/src/components/common/Button/index.tsx +8 -44
  30. package/src/components/common/CardShell/index.tsx +6 -2
  31. package/src/components/common/CardShell/types.ts +10 -0
  32. package/src/components/common/ListWithIcons/ListWithIcons.types.ts +22 -1
  33. package/src/components/common/ListWithIcons/components/ListWithIconsItem.tsx +13 -4
  34. package/src/components/common/ListWithIcons/index.test.tsx +42 -0
  35. package/src/components/common/StepCard/StepCardFooter/index.test.tsx +162 -0
  36. package/src/components/common/StepCard/StepCardFooter/index.tsx +120 -0
  37. package/src/components/common/StepCard/index.test.tsx +120 -0
  38. package/src/components/common/StepCard/index.tsx +74 -0
  39. package/src/components/common/StepCard/types.ts +45 -0
  40. package/src/components/common/TitleBlock/types.ts +1 -1
  41. package/src/components/form/inputs/SearchableField.test.tsx +1 -1
  42. package/src/components/form/inputs/Select/Select.utils.ts +24 -0
  43. package/src/components/form/inputs/Select/components/OptionCheckbox.tsx +46 -0
  44. package/src/components/form/inputs/Select/index.test.tsx +127 -0
  45. package/src/components/form/inputs/Select/index.tsx +426 -181
  46. package/src/components/layout/ServiceFormContainer/CardFormContainer/index.tsx +3 -0
  47. package/src/components/loaders/LoadingSpinner/index.tsx +3 -26
  48. package/src/components/overlays/BottomSheet/index.test.tsx +256 -0
  49. package/src/components/overlays/BottomSheet/index.tsx +242 -0
  50. package/src/components/overlays/BottomSheet/useSwipeToDismiss.test.ts +295 -0
  51. package/src/components/overlays/BottomSheet/useSwipeToDismiss.ts +138 -0
  52. package/src/examples/ListWithPagination/index.tsx +2 -1
  53. package/src/i18n/namespaces/common/en.json +7 -0
  54. package/src/i18n/namespaces/common/lt.json +7 -0
  55. package/src/i18n/namespaces/input/en.json +11 -0
  56. package/src/i18n/namespaces/input/lt.json +11 -0
  57. package/src/library/icons.ts +2 -0
  58. package/src/library/index.ts +4 -0
  59. package/src/library/types.ts +19 -2
  60. package/src/stories/atoms/Button.stories.tsx +202 -497
  61. package/src/stories/atoms/Select.stories.tsx +33 -5
  62. package/src/stories/foundations/ThemedMuiComponents.stories.tsx +2 -2
  63. package/src/stories/molecules/CardShell.stories.tsx +36 -2
  64. package/src/stories/molecules/DatePicker.stories.tsx +1 -2
  65. package/src/stories/molecules/ListWithIcons.stories.tsx +26 -0
  66. package/src/stories/molecules/Popover.stories.tsx +1 -1
  67. package/src/stories/molecules/StepCard.stories.tsx +181 -0
  68. package/src/stories/molecules/TitleBlock.stories.tsx +2 -2
  69. package/src/stories/organisms/AdvancedListItem.stories.tsx +80 -0
  70. package/src/stories/organisms/BottomSheet.stories.tsx +291 -0
  71. package/src/stories/organisms/CardFormContainer.stories.tsx +1 -1
  72. package/src/stories/organisms/Dialog.stories.tsx +1 -2
  73. package/src/theme/light/MuiAutocomplete.ts +43 -19
  74. package/src/theme/light/MuiButton.tsx +54 -0
  75. package/src/theme/light/MuiCard.tsx +9 -7
  76. package/src/theme/light/MuiTypography.tsx +17 -0
  77. package/src/theme/palette.tsx +7 -7
  78. package/src/theme/spacing.ts +5 -0
@@ -15,6 +15,9 @@ export interface RcSesCardFormContainerProps extends RcSesCardProps {
15
15
  isLoading?: boolean
16
16
  }
17
17
 
18
+ /**
19
+ * @deprecated Use `RcSesStepCard` instead. Will be removed in a future major release.
20
+ */
18
21
  const RcSesCardFormContainer = ({
19
22
  steps,
20
23
  onStepClick,
@@ -1,16 +1,4 @@
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]
1
+ import { CircularProgress } from '@mui/material'
14
2
 
15
3
  const SPINNER_SIZE_MAP = {
16
4
  small: '16px',
@@ -18,19 +6,8 @@ const SPINNER_SIZE_MAP = {
18
6
  large: '24px',
19
7
  } as const
20
8
 
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
- }
9
+ export type RcSesSpinnerColor =
10
+ 'primary' | 'secondary' | 'error' | 'warning' | 'info' | 'success' | 'inherit'
34
11
 
35
12
  export interface RcSesLoadingSpinnerProps {
36
13
  color?: RcSesSpinnerColor
@@ -0,0 +1,256 @@
1
+ import { fireEvent, render, screen } from '@testing-library/react'
2
+ import { beforeAll, describe, expect, it, vi } from 'vitest'
3
+
4
+ import RcSesBottomSheet from '.'
5
+
6
+ describe('RcSesBottomSheet', () => {
7
+ beforeAll(() => {
8
+ // jsdom does not implement pointer capture; the handle calls it unconditionally.
9
+ Element.prototype.setPointerCapture = vi.fn()
10
+ Element.prototype.releasePointerCapture = vi.fn()
11
+ })
12
+
13
+ it('renders as a dialog with the title as its accessible name', () => {
14
+ render(
15
+ <RcSesBottomSheet open onClose={vi.fn()} title='Pasirinkite padalinį'>
16
+ Content
17
+ </RcSesBottomSheet>,
18
+ )
19
+
20
+ const dialog = screen.getByRole('dialog')
21
+ expect(dialog).toHaveAccessibleName('Pasirinkite padalinį')
22
+ expect(screen.getByText('Content')).toBeInTheDocument()
23
+ })
24
+
25
+ it('renders without a header when neither title nor showBack is given', () => {
26
+ render(
27
+ <RcSesBottomSheet open onClose={vi.fn()}>
28
+ Content
29
+ </RcSesBottomSheet>,
30
+ )
31
+
32
+ expect(screen.getByText('Content')).toBeInTheDocument()
33
+ expect(screen.queryAllByRole('button')).toHaveLength(0)
34
+ })
35
+
36
+ it('renders the primary and secondary action buttons with their labels', () => {
37
+ const onPrimaryAction = vi.fn()
38
+ const onSecondaryAction = vi.fn()
39
+ render(
40
+ <RcSesBottomSheet
41
+ open
42
+ onClose={vi.fn()}
43
+ title='Filtrai'
44
+ primaryActionLabel='Taikyti'
45
+ onPrimaryAction={onPrimaryAction}
46
+ secondaryActionLabel='Atšaukti'
47
+ onSecondaryAction={onSecondaryAction}
48
+ >
49
+ Content
50
+ </RcSesBottomSheet>,
51
+ )
52
+
53
+ fireEvent.click(screen.getByRole('button', { name: 'Taikyti' }))
54
+ fireEvent.click(screen.getByRole('button', { name: 'Atšaukti' }))
55
+
56
+ expect(onPrimaryAction).toHaveBeenCalledTimes(1)
57
+ expect(onSecondaryAction).toHaveBeenCalledTimes(1)
58
+ })
59
+
60
+ it('renders no footer when no action label is given', () => {
61
+ render(
62
+ <RcSesBottomSheet open onClose={vi.fn()} title='Filtrai'>
63
+ Content
64
+ </RcSesBottomSheet>,
65
+ )
66
+
67
+ expect(screen.queryAllByRole('button')).toHaveLength(0)
68
+ })
69
+
70
+ it('does not render a back button by default', () => {
71
+ render(
72
+ <RcSesBottomSheet open onClose={vi.fn()} title='Filtrai'>
73
+ Content
74
+ </RcSesBottomSheet>,
75
+ )
76
+
77
+ expect(screen.queryAllByRole('button')).toHaveLength(0)
78
+ })
79
+
80
+ it('calls onBack, not onClose, when the back button is pressed', () => {
81
+ const onBack = vi.fn()
82
+ const onClose = vi.fn()
83
+ render(
84
+ <RcSesBottomSheet open onClose={onClose} onBack={onBack} showBack title='2 iš 2'>
85
+ Content
86
+ </RcSesBottomSheet>,
87
+ )
88
+
89
+ fireEvent.click(screen.getByRole('button'))
90
+
91
+ expect(onBack).toHaveBeenCalledTimes(1)
92
+ expect(onClose).not.toHaveBeenCalled()
93
+ })
94
+
95
+ it('closes on Escape even when backdrop close is disabled', () => {
96
+ const onClose = vi.fn()
97
+ render(
98
+ <RcSesBottomSheet open onClose={onClose} title='Filtrai' disableBackdropClose>
99
+ Content
100
+ </RcSesBottomSheet>,
101
+ )
102
+
103
+ fireEvent.keyDown(screen.getByRole('dialog'), { key: 'Escape' })
104
+
105
+ expect(onClose).toHaveBeenCalledWith(expect.anything(), 'escapeKeyDown')
106
+ })
107
+
108
+ it('closes on backdrop click by default', () => {
109
+ const onClose = vi.fn()
110
+ render(
111
+ <RcSesBottomSheet open onClose={onClose} title='Filtrai'>
112
+ Content
113
+ </RcSesBottomSheet>,
114
+ )
115
+
116
+ fireEvent.click(document.querySelector('.MuiBackdrop-root') as HTMLElement)
117
+
118
+ expect(onClose).toHaveBeenCalledWith(expect.anything(), 'backdropClick')
119
+ })
120
+
121
+ it('ignores backdrop clicks when disableBackdropClose is set', () => {
122
+ const onClose = vi.fn()
123
+ render(
124
+ <RcSesBottomSheet open onClose={onClose} title='Filtrai' disableBackdropClose>
125
+ Content
126
+ </RcSesBottomSheet>,
127
+ )
128
+
129
+ fireEvent.click(document.querySelector('.MuiBackdrop-root') as HTMLElement)
130
+
131
+ expect(onClose).not.toHaveBeenCalled()
132
+ })
133
+
134
+ it('always anchors the paper to the bottom of the viewport - there is no desktop presentation', () => {
135
+ render(
136
+ <RcSesBottomSheet open onClose={vi.fn()} title='Pasirinkite padalinį'>
137
+ Content
138
+ </RcSesBottomSheet>,
139
+ )
140
+
141
+ expect(document.querySelector('.MuiDialog-container')).toHaveStyle({
142
+ alignItems: 'flex-end',
143
+ })
144
+ })
145
+
146
+ it('caps the sheet width for size="md" instead of the sm full-bleed default', () => {
147
+ render(
148
+ <RcSesBottomSheet open onClose={vi.fn()} title='Filtrai' size='md'>
149
+ Content
150
+ </RcSesBottomSheet>,
151
+ )
152
+
153
+ expect(document.querySelector('.MuiDialog-paper')).toHaveStyle({ maxWidth: '480px' })
154
+ })
155
+
156
+ it('dismisses via a swipe on the handle past the distance threshold', () => {
157
+ const onClose = vi.fn()
158
+ render(
159
+ <RcSesBottomSheet open onClose={onClose} title='Filtrai'>
160
+ Content
161
+ </RcSesBottomSheet>,
162
+ )
163
+
164
+ const handle = screen.getByTestId('rc-ses-bottom-sheet-handle')
165
+ fireEvent.pointerDown(handle, { clientY: 0, pointerId: 1, isPrimary: true })
166
+ fireEvent.pointerUp(handle, { clientY: 150, pointerId: 1 })
167
+
168
+ expect(onClose).toHaveBeenCalledWith(expect.anything(), 'swipeDown')
169
+ })
170
+
171
+ it('does not dismiss when the handle drag stays under the threshold', () => {
172
+ const onClose = vi.fn()
173
+ render(
174
+ <RcSesBottomSheet open onClose={onClose} title='Filtrai'>
175
+ Content
176
+ </RcSesBottomSheet>,
177
+ )
178
+
179
+ const handle = screen.getByTestId('rc-ses-bottom-sheet-handle')
180
+ fireEvent.pointerDown(handle, { clientY: 0, pointerId: 1, isPrimary: true })
181
+ fireEvent.pointerUp(handle, { clientY: 10, pointerId: 1 })
182
+
183
+ expect(onClose).not.toHaveBeenCalled()
184
+ })
185
+
186
+ it('lets a caller-supplied aria-describedby win over the generated one', () => {
187
+ render(
188
+ <RcSesBottomSheet
189
+ open
190
+ onClose={vi.fn()}
191
+ title='Filtrai'
192
+ aria-describedby='external-description'
193
+ >
194
+ Content
195
+ </RcSesBottomSheet>,
196
+ )
197
+
198
+ expect(screen.getByRole('dialog')).toHaveAttribute(
199
+ 'aria-describedby',
200
+ 'external-description',
201
+ )
202
+ })
203
+
204
+ it('does not dismiss on a pointercancel, even past the distance threshold', () => {
205
+ const onClose = vi.fn()
206
+ render(
207
+ <RcSesBottomSheet open onClose={onClose} title='Filtrai'>
208
+ Content
209
+ </RcSesBottomSheet>,
210
+ )
211
+
212
+ const handle = screen.getByTestId('rc-ses-bottom-sheet-handle')
213
+ fireEvent.pointerDown(handle, { clientY: 0, pointerId: 1, isPrimary: true })
214
+ fireEvent.pointerCancel(handle, { clientY: 150, pointerId: 1 })
215
+
216
+ expect(onClose).not.toHaveBeenCalled()
217
+ })
218
+
219
+ it('ignores a right-click on the handle', () => {
220
+ const onClose = vi.fn()
221
+ render(
222
+ <RcSesBottomSheet open onClose={onClose} title='Filtrai'>
223
+ Content
224
+ </RcSesBottomSheet>,
225
+ )
226
+
227
+ const handle = screen.getByTestId('rc-ses-bottom-sheet-handle')
228
+ fireEvent.pointerDown(handle, {
229
+ clientY: 0,
230
+ pointerId: 1,
231
+ pointerType: 'mouse',
232
+ button: 2,
233
+ isPrimary: true,
234
+ })
235
+ fireEvent.pointerUp(handle, { clientY: 150, pointerId: 1, pointerType: 'mouse' })
236
+
237
+ expect(onClose).not.toHaveBeenCalled()
238
+ })
239
+
240
+ it('passes the real pointer event through to onClose on swipe-dismiss', () => {
241
+ const onClose = vi.fn()
242
+ render(
243
+ <RcSesBottomSheet open onClose={onClose} title='Filtrai'>
244
+ Content
245
+ </RcSesBottomSheet>,
246
+ )
247
+
248
+ const handle = screen.getByTestId('rc-ses-bottom-sheet-handle')
249
+ fireEvent.pointerDown(handle, { clientY: 0, pointerId: 1, isPrimary: true })
250
+ fireEvent.pointerUp(handle, { clientY: 150, pointerId: 1 })
251
+
252
+ const [event, reason] = onClose.mock.calls[0]
253
+ expect(reason).toBe('swipeDown')
254
+ expect(event).toMatchObject({ type: 'pointerup' })
255
+ })
256
+ })
@@ -0,0 +1,242 @@
1
+ import {
2
+ Box,
3
+ Fade,
4
+ Dialog as MuiDialog,
5
+ DialogProps as MuiDialogProps,
6
+ Slide,
7
+ Typography,
8
+ } from '@mui/material'
9
+ import { TransitionProps } from '@mui/material/transitions'
10
+ import {
11
+ ReactElement,
12
+ ReactNode,
13
+ PointerEvent as ReactPointerEvent,
14
+ forwardRef,
15
+ useCallback,
16
+ useId,
17
+ } from 'react'
18
+ import { useTranslation } from 'react-i18next'
19
+
20
+ import ArrowLeftIcon from '@/assets/icons/ArrowLeftIcon'
21
+ import usePrefersReducedMotion from '@/components/common/AdvancedList/components/AdvancedListItem/hooks/usePrefersReducedMotion'
22
+ import RcSesButton from '@/components/common/Button'
23
+ import { grey } from '@/theme/palette'
24
+
25
+ import useSwipeToDismiss from './useSwipeToDismiss'
26
+
27
+ const SHEET = {
28
+ handleWidth: '2.25rem',
29
+ handleHeight: '0.25rem',
30
+ handleHitAreaPadding: '0.75rem 0',
31
+ headerPadding: '0 1.5rem 1rem',
32
+ contentPadding: '0 1.5rem 1.5rem',
33
+ actionsPadding: '0.75rem 1.5rem 1.5rem',
34
+ cornerRadius: '1rem',
35
+ maxHeight: '85vh',
36
+ titleFontSize: '1rem',
37
+ titleLineHeight: '1.375rem',
38
+ }
39
+
40
+ const SHEET_MAX_WIDTH = {
41
+ sm: '100%',
42
+ md: '480px',
43
+ }
44
+
45
+ const MOTION_DURATION = { enter: 280, exit: 200 }
46
+
47
+ const SlideUpTransition = forwardRef<
48
+ HTMLDivElement,
49
+ TransitionProps & { children: ReactElement<unknown> }
50
+ >((props, ref) => <Slide direction='up' ref={ref} {...props} />)
51
+
52
+ export interface RcSesBottomSheetProps extends Omit<
53
+ MuiDialogProps,
54
+ 'children' | 'title' | 'PaperProps' | 'maxWidth' | 'onClose' | 'slots' | 'slotProps'
55
+ > {
56
+ title?: string
57
+ children?: ReactNode
58
+ showBack?: boolean
59
+ onBack?: () => void
60
+ primaryActionLabel?: string
61
+ onPrimaryAction?: () => void
62
+ secondaryActionLabel?: string
63
+ onSecondaryAction?: () => void
64
+ disableBackdropClose?: boolean
65
+ size?: 'sm' | 'md'
66
+ onClose?: (
67
+ event: unknown,
68
+ reason: 'backdropClick' | 'escapeKeyDown' | 'swipeDown',
69
+ ) => void
70
+ }
71
+
72
+ function RcSesBottomSheet({
73
+ title,
74
+ children,
75
+ showBack = false,
76
+ onBack,
77
+ primaryActionLabel,
78
+ onPrimaryAction,
79
+ secondaryActionLabel,
80
+ onSecondaryAction,
81
+ onClose,
82
+ disableBackdropClose = false,
83
+ size = 'sm',
84
+ open,
85
+ 'aria-labelledby': ariaLabelledByProp,
86
+ 'aria-describedby': ariaDescribedByProp,
87
+ scroll = 'paper',
88
+ transitionDuration = MOTION_DURATION,
89
+ ...props
90
+ }: RcSesBottomSheetProps) {
91
+ const prefersReducedMotion = usePrefersReducedMotion()
92
+ const { t } = useTranslation('input', { keyPrefix: 'components.RcSesBottomSheet' })
93
+ const titleId = useId()
94
+ const contentId = useId()
95
+
96
+ const hasFooter = !!primaryActionLabel || !!secondaryActionLabel
97
+
98
+ if (process.env.NODE_ENV !== 'production' && showBack && !onBack) {
99
+ // eslint-disable-next-line no-console
100
+ console.warn(
101
+ 'RcSesBottomSheet: `showBack` is set without an `onBack` handler - the back button will do nothing.',
102
+ )
103
+ }
104
+
105
+ const handleClose = (event: unknown, reason: 'backdropClick' | 'escapeKeyDown') => {
106
+ if (disableBackdropClose && reason === 'backdropClick') return
107
+ onClose?.(event, reason)
108
+ }
109
+
110
+ const handleSwipeDismiss = useCallback(
111
+ (event: ReactPointerEvent<HTMLElement>) => onClose?.(event, 'swipeDown'),
112
+ [onClose],
113
+ )
114
+
115
+ const { paperRef, isDragging, handleProps } = useSwipeToDismiss({
116
+ open,
117
+ disableTransform: prefersReducedMotion,
118
+ onDismiss: handleSwipeDismiss,
119
+ })
120
+
121
+ return (
122
+ <MuiDialog
123
+ open={open}
124
+ onClose={handleClose}
125
+ {...props}
126
+ maxWidth={false}
127
+ aria-labelledby={ariaLabelledByProp ?? (title ? titleId : undefined)}
128
+ aria-describedby={ariaDescribedByProp ?? (children != null ? contentId : undefined)}
129
+ scroll={scroll}
130
+ slots={{ transition: prefersReducedMotion ? Fade : SlideUpTransition }}
131
+ slotProps={{
132
+ container: { sx: { alignItems: 'flex-end' } },
133
+ paper: {
134
+ ref: paperRef,
135
+ sx: {
136
+ margin: 0,
137
+ width: '100%',
138
+ maxWidth: SHEET_MAX_WIDTH[size],
139
+ maxHeight: SHEET.maxHeight,
140
+ borderRadius: `${SHEET.cornerRadius} ${SHEET.cornerRadius} 0 0`,
141
+ },
142
+ },
143
+ }}
144
+ transitionDuration={transitionDuration}
145
+ >
146
+ <Box
147
+ aria-hidden
148
+ data-testid='rc-ses-bottom-sheet-handle'
149
+ {...handleProps}
150
+ sx={{
151
+ display: 'flex',
152
+ justifyContent: 'center',
153
+ padding: SHEET.handleHitAreaPadding,
154
+ flexShrink: 0,
155
+ touchAction: 'none',
156
+ cursor: isDragging ? 'grabbing' : 'grab',
157
+ }}
158
+ >
159
+ <Box
160
+ sx={{
161
+ width: SHEET.handleWidth,
162
+ height: SHEET.handleHeight,
163
+ borderRadius: 999,
164
+ backgroundColor: grey['300'],
165
+ }}
166
+ />
167
+ </Box>
168
+
169
+ {(title || showBack) && (
170
+ <Box
171
+ sx={{
172
+ display: 'flex',
173
+ alignItems: 'center',
174
+ gap: 1.5,
175
+ padding: SHEET.headerPadding,
176
+ flexShrink: 0,
177
+ }}
178
+ >
179
+ {showBack && (
180
+ <RcSesButton
181
+ iconOnly
182
+ variant='outlined'
183
+ color='grey'
184
+ onClick={onBack}
185
+ aria-label={t('aria.back')}
186
+ >
187
+ <ArrowLeftIcon />
188
+ </RcSesButton>
189
+ )}
190
+ {title && (
191
+ <Typography
192
+ id={titleId}
193
+ variant='h3'
194
+ component='h2'
195
+ sx={{
196
+ flex: 1,
197
+ fontSize: SHEET.titleFontSize,
198
+ lineHeight: SHEET.titleLineHeight,
199
+ }}
200
+ >
201
+ {title}
202
+ </Typography>
203
+ )}
204
+ </Box>
205
+ )}
206
+
207
+ {children != null && (
208
+ <Box
209
+ id={contentId}
210
+ sx={{ padding: SHEET.contentPadding, overflowY: 'auto', flex: 1 }}
211
+ >
212
+ {children}
213
+ </Box>
214
+ )}
215
+
216
+ {hasFooter && (
217
+ <Box
218
+ sx={{
219
+ display: 'flex',
220
+ justifyContent: 'flex-end',
221
+ gap: 1.5,
222
+ padding: SHEET.actionsPadding,
223
+ flexShrink: 0,
224
+ }}
225
+ >
226
+ {secondaryActionLabel && (
227
+ <RcSesButton variant='outlined' color='grey' onClick={onSecondaryAction}>
228
+ {secondaryActionLabel}
229
+ </RcSesButton>
230
+ )}
231
+ {primaryActionLabel && (
232
+ <RcSesButton variant='contained' onClick={onPrimaryAction}>
233
+ {primaryActionLabel}
234
+ </RcSesButton>
235
+ )}
236
+ </Box>
237
+ )}
238
+ </MuiDialog>
239
+ )
240
+ }
241
+
242
+ export default RcSesBottomSheet