@registrucentras/rc-ses-react-components 1.6.5 → 1.7.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 (71) hide show
  1. package/dist/assets/icons/ArrowsClockwiseIcon.d.ts +3 -0
  2. package/dist/assets/icons/SearchHelpIcon.d.ts +3 -0
  3. package/dist/assets/icons/SearchXIcon.d.ts +3 -0
  4. package/dist/components/common/Breadcrumbs/index.d.ts +3 -1
  5. package/dist/components/common/Snackbar/SnackbarProvider.d.ts +22 -0
  6. package/dist/components/common/Snackbar/config.d.ts +21 -0
  7. package/dist/components/common/Snackbar/index.d.ts +16 -0
  8. package/dist/components/common/Snackbar/types.d.ts +2 -0
  9. package/dist/components/form/inputs/CheckboxFormControl.d.ts +2 -0
  10. package/dist/components/form/inputs/FormControlLabel.d.ts +10 -0
  11. package/dist/components/form/inputs/SearchInput/index.d.ts +27 -0
  12. package/dist/components/form/inputs/SimpleCheckbox.d.ts +6 -0
  13. package/dist/components/layout/ServiceHeader.d.ts +2 -1
  14. package/dist/components/utils/loading.d.ts +3 -0
  15. package/dist/library/icons.d.ts +5 -1
  16. package/dist/library/index.d.ts +11 -2
  17. package/dist/library/types.d.ts +3 -1
  18. package/dist/registrucentras-rc-ses-react-components.cjs +10 -27
  19. package/dist/registrucentras-rc-ses-react-components.js +3484 -2897
  20. package/dist/stories/components/actions/Button.stories.d.ts +5 -0
  21. package/dist/stories/components/{SelectableCardList.stories.d.ts → display/SelectableCardList.stories.d.ts} +1 -1
  22. package/dist/stories/components/feedback/Snackbar.stories.d.ts +143 -0
  23. package/dist/stories/components/form/CheckboxFormControl.stories.d.ts +3 -0
  24. package/dist/stories/components/form/SimpleCheckbox.stories.d.ts +19 -0
  25. package/dist/stories/components/inputs/SearchInput.stories.d.ts +11 -0
  26. package/dist/stories/components/layout/ServiceHeader.stories.d.ts +1 -0
  27. package/dist/theme/light/MuiOutlinedInput.d.ts +3 -0
  28. package/dist/theme/light/index.d.ts +6 -0
  29. package/dist/theme/palette.d.ts +9 -1
  30. package/package.json +1 -1
  31. package/src/assets/icons/ArrowsClockwiseIcon.tsx +16 -0
  32. package/src/assets/icons/CheckIcon.tsx +1 -1
  33. package/src/assets/icons/SearchHelpIcon.tsx +44 -0
  34. package/src/assets/icons/SearchXIcon.tsx +41 -0
  35. package/src/components/common/Breadcrumbs/index.tsx +4 -3
  36. package/src/components/common/ListWithIcons/components/ListWithIconsItem.tsx +5 -3
  37. package/src/components/common/ListWithIcons/index.tsx +1 -1
  38. package/src/components/common/SelectableCardList/components/SelectableCardListItem.tsx +3 -1
  39. package/src/components/common/Snackbar/SnackbarProvider.tsx +78 -0
  40. package/src/components/common/Snackbar/config.ts +77 -0
  41. package/src/components/common/Snackbar/index.test.tsx +119 -0
  42. package/src/components/common/Snackbar/index.tsx +181 -0
  43. package/src/components/common/Snackbar/types.ts +2 -0
  44. package/src/components/form/inputs/Checkbox.tsx +2 -2
  45. package/src/components/form/inputs/CheckboxFormControl.test.tsx +68 -0
  46. package/src/components/form/inputs/CheckboxFormControl.tsx +48 -29
  47. package/src/components/form/inputs/FormControlLabel.tsx +36 -0
  48. package/src/components/form/inputs/SearchInput/index.test.tsx +203 -0
  49. package/src/components/form/inputs/SearchInput/index.tsx +282 -0
  50. package/src/components/form/inputs/SimpleCheckbox.tsx +23 -0
  51. package/src/components/layout/ServiceHeader.tsx +22 -8
  52. package/src/components/utils/loading.tsx +9 -0
  53. package/src/i18n/namespaces/input/en.json +11 -0
  54. package/src/i18n/namespaces/input/lt.json +11 -0
  55. package/src/library/icons.ts +8 -0
  56. package/src/library/index.ts +15 -1
  57. package/src/library/types.ts +9 -1
  58. package/src/stories/Colors.mdx +127 -0
  59. package/src/stories/components/actions/Button.stories.tsx +130 -0
  60. package/src/stories/components/{SelectableCardList.stories.tsx → display/SelectableCardList.stories.tsx} +36 -19
  61. package/src/stories/components/feedback/Snackbar.stories.tsx +504 -0
  62. package/src/stories/components/form/CheckboxFormControl.stories.tsx +312 -2
  63. package/src/stories/components/form/SimpleCheckbox.stories.tsx +52 -0
  64. package/src/stories/components/icons/Icons.stories.tsx +35 -0
  65. package/src/stories/components/inputs/SearchInput.stories.tsx +134 -0
  66. package/src/stories/components/layout/ServiceHeader.stories.tsx +43 -8
  67. package/src/theme/light/MuiButton.tsx +34 -1
  68. package/src/theme/light/MuiOutlinedInput.ts +15 -0
  69. package/src/theme/light/index.tsx +8 -0
  70. package/src/theme/light/themePalette.tsx +2 -0
  71. package/src/theme/palette.tsx +11 -1
@@ -0,0 +1,203 @@
1
+ import { ThemeProvider } from '@mui/material/styles'
2
+ import { fireEvent, render, screen } from '@testing-library/react'
3
+ import { useForm } from 'react-hook-form'
4
+ import { vi } from 'vitest'
5
+
6
+ import theme from '@/theme/light'
7
+
8
+ import RcSesSearchInput from './index'
9
+
10
+ vi.mock('react-i18next', () => ({
11
+ useTranslation: () => ({
12
+ t: (key: string) => key,
13
+ }),
14
+ initReactI18next: {
15
+ type: '3rdParty',
16
+ init: () => {},
17
+ },
18
+ }))
19
+
20
+ // Fake md breakpoint so the search button is always rendered
21
+ vi.mock('@mui/material', async (importOriginal) => {
22
+ const actual = await importOriginal<typeof import('@mui/material')>()
23
+ return {
24
+ ...actual,
25
+ useMediaQuery: () => true,
26
+ }
27
+ })
28
+
29
+ type WrapperProps = Partial<React.ComponentProps<typeof RcSesSearchInput>> & {
30
+ onSearch?: (value: string) => void
31
+ defaultValue?: string
32
+ }
33
+
34
+ const TestWrapper = ({
35
+ defaultValue = '',
36
+ onSearch = vi.fn(),
37
+ ...props
38
+ }: WrapperProps) => {
39
+ const { control } = useForm({ defaultValues: { search: defaultValue } })
40
+ return (
41
+ <ThemeProvider theme={theme}>
42
+ <RcSesSearchInput
43
+ id='search'
44
+ name='search'
45
+ control={control}
46
+ label='Search'
47
+ errors={undefined}
48
+ onSearch={onSearch}
49
+ {...props}
50
+ />
51
+ </ThemeProvider>
52
+ )
53
+ }
54
+
55
+ describe('RcSesSearchInput', () => {
56
+ test('renders the text input', () => {
57
+ render(<TestWrapper />)
58
+ expect(screen.getByRole('textbox')).toBeInTheDocument()
59
+ })
60
+
61
+ test('renders label', () => {
62
+ render(<TestWrapper label='My label' />)
63
+ expect(screen.getByText('My label')).toBeInTheDocument()
64
+ })
65
+
66
+ test('does not show clear button when value is empty', () => {
67
+ render(<TestWrapper />)
68
+ expect(
69
+ screen.queryByRole('button', { name: /clearValueAriaLabel/i }),
70
+ ).not.toBeInTheDocument()
71
+ })
72
+
73
+ test('search button is disabled when input is empty', () => {
74
+ render(<TestWrapper />)
75
+ const btn = screen.getByRole('button', { name: /search/i })
76
+ expect(btn).toBeDisabled()
77
+ })
78
+
79
+ test('search button is not rendered when showSearchButton=false', () => {
80
+ render(<TestWrapper showSearchButton={false} />)
81
+ expect(screen.queryByRole('button', { name: /search/i })).not.toBeInTheDocument()
82
+ })
83
+
84
+ describe('handleSearchClick', () => {
85
+ test('calls onSearch with current value when button is clicked', () => {
86
+ const onSearch = vi.fn()
87
+ render(<TestWrapper onSearch={onSearch} defaultValue='hello' />)
88
+
89
+ fireEvent.click(screen.getByRole('button', { name: /search/i }))
90
+
91
+ expect(onSearch).toHaveBeenCalledWith('hello')
92
+ })
93
+
94
+ test('does not call onSearch when slotProps.searchButton.onClick calls preventDefault', () => {
95
+ const onSearch = vi.fn()
96
+
97
+ render(
98
+ <TestWrapper
99
+ onSearch={onSearch}
100
+ defaultValue='test'
101
+ slotProps={{
102
+ searchButton: {
103
+ onClick: (e) => e.preventDefault(),
104
+ },
105
+ }}
106
+ />,
107
+ )
108
+
109
+ fireEvent.click(screen.getByRole('button', { name: /search/i }))
110
+
111
+ expect(onSearch).not.toHaveBeenCalled()
112
+ })
113
+ })
114
+
115
+ describe('handleFieldKeyDown', () => {
116
+ test('calls onSearch on Enter when search button is hidden', () => {
117
+ const onSearch = vi.fn()
118
+ render(<TestWrapper onSearch={onSearch} showSearchButton={false} />)
119
+
120
+ const input = screen.getByRole('textbox')
121
+ fireEvent.change(input, { target: { value: 'query' } })
122
+ fireEvent.keyDown(input, { key: 'Enter', code: 'Enter', charCode: 13 })
123
+
124
+ expect(onSearch).toHaveBeenCalledWith('query')
125
+ })
126
+
127
+ test('does not call onSearch on Enter when value is empty', () => {
128
+ const onSearch = vi.fn()
129
+ render(<TestWrapper onSearch={onSearch} showSearchButton={false} />)
130
+
131
+ const input = screen.getByRole('textbox')
132
+ fireEvent.click(input)
133
+ fireEvent.keyDown(input, { key: 'Enter', code: 'Enter', charCode: 13 })
134
+
135
+ expect(onSearch).not.toHaveBeenCalled()
136
+ })
137
+
138
+ test('does not call onSearch on Enter when search button is enabled (shouldSearchOnEnter=false)', () => {
139
+ const onSearch = vi.fn()
140
+ render(<TestWrapper onSearch={onSearch} defaultValue='hello' />)
141
+
142
+ const input = screen.getByRole('textbox')
143
+ fireEvent.click(input)
144
+ fireEvent.keyDown(input, { key: 'Enter', code: 'Enter', charCode: 13 })
145
+
146
+ expect(onSearch).not.toHaveBeenCalled()
147
+ })
148
+
149
+ test('does not call onSearch when slotProps.field.onKeyDown calls preventDefault', () => {
150
+ const onSearch = vi.fn()
151
+
152
+ render(
153
+ <TestWrapper
154
+ onSearch={onSearch}
155
+ showSearchButton={false}
156
+ slotProps={{
157
+ field: {
158
+ onKeyDown: (e) => {
159
+ if (e.key === 'Enter') e.preventDefault()
160
+ },
161
+ },
162
+ }}
163
+ />,
164
+ )
165
+
166
+ const input = screen.getByRole('textbox')
167
+ fireEvent.change(input, { target: { value: 'hi' } })
168
+ fireEvent.keyDown(input, { key: 'Enter', code: 'Enter', charCode: 13 })
169
+
170
+ expect(onSearch).not.toHaveBeenCalled()
171
+ })
172
+ })
173
+
174
+ describe('handleFieldChange', () => {
175
+ test('updates field value as user types', () => {
176
+ render(<TestWrapper />)
177
+
178
+ const input = screen.getByRole('textbox')
179
+ fireEvent.change(input, { target: { value: 'hello' } })
180
+
181
+ expect(input).toHaveValue('hello')
182
+ })
183
+
184
+ test('strips non-numeric characters when onlyNumbers=true', () => {
185
+ render(<TestWrapper onlyNumbers />)
186
+
187
+ const input = screen.getByRole('textbox')
188
+ fireEvent.change(input, { target: { value: 'ab12cd3' } })
189
+
190
+ expect(input).toHaveValue('123')
191
+ })
192
+
193
+ test('calls slotProps.field.onChange before updating value', () => {
194
+ const fieldOnChange = vi.fn()
195
+
196
+ render(<TestWrapper slotProps={{ field: { onChange: fieldOnChange } }} />)
197
+
198
+ fireEvent.change(screen.getByRole('textbox'), { target: { value: 'x' } })
199
+
200
+ expect(fieldOnChange).toHaveBeenCalled()
201
+ })
202
+ })
203
+ })
@@ -0,0 +1,282 @@
1
+ import { Box, IconButton, useMediaQuery, useTheme } from '@mui/material'
2
+ import InputAdornment from '@mui/material/InputAdornment'
3
+ import type { OutlinedTextFieldProps } from '@mui/material/TextField'
4
+ import TextField from '@mui/material/TextField'
5
+ import React, { useCallback, useMemo, useRef } from 'react'
6
+ import type { UseControllerProps } from 'react-hook-form'
7
+ import { useController } from 'react-hook-form'
8
+ import { useTranslation } from 'react-i18next'
9
+ import { v4 as uuidv4 } from 'uuid'
10
+
11
+ import MagnifyingGlassIcon from '@/assets/icons/MagnifyingGlassIcon'
12
+ import XCircleFillIcon from '@/assets/icons/XCircleFillIcon'
13
+ import RcSesButton from '@/components/common/Button'
14
+ import RcSesFormControlWrapper, {
15
+ RcSesFormControlWrapperProps,
16
+ } from '@/components/form/components/FormControlWrapper'
17
+ import type { ButtonProps } from '@/types/buttons/ButtonProps'
18
+
19
+ type TControllerProps = UseControllerProps<any, any>
20
+ type ImmediateControllerProps = 'control' | 'rules' | 'disabled' | 'name'
21
+
22
+ type TFieldProps = Omit<OutlinedTextFieldProps, 'variant' | 'value' | 'defaultValue'>
23
+
24
+ type TWrapperProps = RcSesFormControlWrapperProps
25
+ type ImmediateWrapperProps = 'id' | 'label' | 'errors' | 'labelSubtitle'
26
+ type TSearchButtonProps = Partial<ButtonProps>
27
+
28
+ type Props = Pick<TControllerProps, ImmediateControllerProps> &
29
+ Pick<TWrapperProps, ImmediateWrapperProps> & {
30
+ onSearch: (value: string) => void
31
+ required?: boolean
32
+ onlyNumbers?: boolean
33
+ placeholder?: TFieldProps['placeholder']
34
+ sideLabel?: boolean
35
+ showSearchButton?: boolean
36
+ searchButtonLabel?: string
37
+ slotProps?: {
38
+ controller?: Partial<Omit<TControllerProps, ImmediateControllerProps>>
39
+ field?: Partial<TFieldProps>
40
+ searchButton?: TSearchButtonProps
41
+ wrapper?: Partial<Omit<TWrapperProps, ImmediateWrapperProps>>
42
+ }
43
+ }
44
+
45
+ const RcSesSearchInput = React.forwardRef<HTMLInputElement, Props>((props, ref) => {
46
+ const [hasSearchAttempted, setHasSearchAttempted] = React.useState(false)
47
+ const internalInputRef = useRef<HTMLInputElement>(null)
48
+
49
+ const setInputRef = useCallback(
50
+ (el: HTMLInputElement | null) => {
51
+ ;(internalInputRef as React.MutableRefObject<HTMLInputElement | null>).current = el
52
+ if (typeof ref === 'function') {
53
+ ref(el)
54
+ } else if (ref) {
55
+ ;(ref as React.MutableRefObject<HTMLInputElement | null>).current = el
56
+ }
57
+ },
58
+ [ref],
59
+ )
60
+
61
+ const { t } = useTranslation('input', { keyPrefix: 'components.RcSesSearchInput' })
62
+
63
+ const {
64
+ control,
65
+ labelSubtitle,
66
+ errors,
67
+ label,
68
+ onSearch,
69
+ required,
70
+ onlyNumbers = false,
71
+ placeholder,
72
+ rules,
73
+ sideLabel = false,
74
+ showSearchButton = true,
75
+ searchButtonLabel,
76
+ slotProps,
77
+ disabled,
78
+ name,
79
+ id: providedId,
80
+ } = props
81
+ const {
82
+ InputProps: slotFieldInputProps,
83
+ inputProps: slotFieldNativeInputProps,
84
+ ...restFieldProps
85
+ } = slotProps?.field ?? {}
86
+ const id = useMemo(() => providedId ?? uuidv4(), [providedId])
87
+
88
+ const hasRequiredRule = rules?.required !== undefined
89
+ const isRequired = hasRequiredRule ? !!rules?.required : required === true
90
+ const controllerRules =
91
+ hasRequiredRule || !isRequired ? rules : { ...(rules ?? {}), required: true }
92
+
93
+ const {
94
+ field: { onBlur, onChange, value },
95
+ } = useController({
96
+ control,
97
+ name,
98
+ rules: controllerRules,
99
+ disabled,
100
+ shouldUnregister: true,
101
+ ...slotProps?.controller,
102
+ })
103
+
104
+ const currentTheme = useTheme()
105
+ const upMd = useMediaQuery(currentTheme.breakpoints.up('md'))
106
+
107
+ const mergedSearchButtonProps = slotProps?.searchButton ?? {}
108
+
109
+ const shouldRenderSearchButton = showSearchButton !== false && upMd
110
+
111
+ const mergedWrapperProps = {
112
+ ...slotProps?.wrapper,
113
+ labelSubtitle,
114
+ hideLabel: slotProps?.wrapper?.hideLabel ?? !label,
115
+ labelOnTop: slotProps?.wrapper?.labelOnTop ?? !sideLabel,
116
+ }
117
+
118
+ const shouldSearchOnEnter =
119
+ !shouldRenderSearchButton || !!mergedSearchButtonProps.disabled
120
+
121
+ const hasSearchValue = `${value ?? ''}`.trim().length > 0
122
+ const visibleErrors = hasSearchAttempted ? errors : undefined
123
+
124
+ const handleSearchClick: NonNullable<ButtonProps['onClick']> = (event) => {
125
+ setHasSearchAttempted(true)
126
+ mergedSearchButtonProps.onClick?.(event)
127
+
128
+ if (!event.defaultPrevented && hasSearchValue) {
129
+ onSearch(value ?? '')
130
+ }
131
+ }
132
+
133
+ const handleFieldKeyDown: NonNullable<TFieldProps['onKeyDown']> = (event) => {
134
+ slotProps?.field?.onKeyDown?.(event)
135
+
136
+ if (!event.defaultPrevented && shouldSearchOnEnter && event.key === 'Enter') {
137
+ setHasSearchAttempted(true)
138
+ event.preventDefault()
139
+
140
+ if (hasSearchValue) {
141
+ onSearch(value ?? '')
142
+ } else {
143
+ onBlur()
144
+ }
145
+ }
146
+ }
147
+
148
+ const handleFieldChange: NonNullable<TFieldProps['onChange']> = (event) => {
149
+ slotProps?.field?.onChange?.(event)
150
+
151
+ if (event.defaultPrevented) {
152
+ return
153
+ }
154
+
155
+ const nextValue = event.target.value ?? ''
156
+ const parsedValue = onlyNumbers ? nextValue.replace(/\D+/g, '') : nextValue
157
+
158
+ onChange(parsedValue)
159
+ }
160
+
161
+ const mergedNativeInputProps: NonNullable<
162
+ NonNullable<TFieldProps['InputProps']>['inputProps']
163
+ > = {
164
+ ...(slotFieldInputProps?.inputProps ?? {}),
165
+ ...(slotFieldNativeInputProps ?? {}),
166
+ ...(onlyNumbers
167
+ ? {
168
+ inputMode: 'numeric',
169
+ pattern: '[0-9]*',
170
+ }
171
+ : {}),
172
+ }
173
+
174
+ const mergedTextFieldInputProps: TFieldProps['InputProps'] = {
175
+ ...slotFieldInputProps,
176
+ inputProps: mergedNativeInputProps,
177
+ startAdornment: (
178
+ <InputAdornment position='start' onClick={() => internalInputRef.current?.focus()}>
179
+ <Box
180
+ sx={{
181
+ alignItems: 'center',
182
+ cursor: 'text',
183
+ display: 'flex',
184
+ height: '2.5rem',
185
+ justifyContent: 'center',
186
+ p: 1,
187
+ width: '2.5rem',
188
+ }}
189
+ >
190
+ <MagnifyingGlassIcon />
191
+ </Box>
192
+ </InputAdornment>
193
+ ),
194
+ endAdornment: !!value && (
195
+ <InputAdornment position='end'>
196
+ <IconButton
197
+ aria-label={t('clearValueAriaLabel')}
198
+ disabled={disabled}
199
+ onClick={() => onChange('')}
200
+ >
201
+ <XCircleFillIcon />
202
+ </IconButton>
203
+ </InputAdornment>
204
+ ),
205
+ }
206
+
207
+ return (
208
+ <RcSesFormControlWrapper
209
+ id={id}
210
+ errors={visibleErrors}
211
+ label={label}
212
+ required={isRequired}
213
+ {...mergedWrapperProps}
214
+ >
215
+ <Box
216
+ sx={{
217
+ alignItems: 'stretch',
218
+ display: 'flex',
219
+ gap: 2,
220
+ width: '100%',
221
+ }}
222
+ >
223
+ <TextField
224
+ id={id}
225
+ inputRef={setInputRef}
226
+ InputProps={mergedTextFieldInputProps}
227
+ error={!!visibleErrors}
228
+ fullWidth
229
+ {...restFieldProps}
230
+ disabled={disabled}
231
+ label={undefined}
232
+ name={name}
233
+ onBlur={onBlur}
234
+ onChange={handleFieldChange}
235
+ onKeyDown={handleFieldKeyDown}
236
+ placeholder={restFieldProps.placeholder ?? placeholder}
237
+ sx={[
238
+ {
239
+ flex: '1 1 auto',
240
+ '& input:-webkit-autofill, & input:-webkit-autofill:hover, & input:-webkit-autofill:focus':
241
+ {
242
+ WebkitBoxShadow: `0 0 0 1000px ${currentTheme.palette.background.paper} inset`,
243
+ },
244
+ '& .MuiOutlinedInput-root:has(input:-webkit-autofill)': {
245
+ backgroundColor: currentTheme.palette.background.paper,
246
+ },
247
+ },
248
+ ...(Array.isArray(restFieldProps.sx)
249
+ ? restFieldProps.sx
250
+ : [restFieldProps.sx]),
251
+ ]}
252
+ value={value ?? ''}
253
+ />
254
+
255
+ {shouldRenderSearchButton && (
256
+ <RcSesButton
257
+ disabled={disabled || mergedSearchButtonProps.disabled || !hasSearchValue}
258
+ onClick={handleSearchClick}
259
+ sx={[
260
+ {
261
+ flexShrink: 0,
262
+ minWidth: '6.75rem',
263
+ px: 3,
264
+ whiteSpace: 'nowrap',
265
+ },
266
+ ...(Array.isArray(mergedSearchButtonProps.sx)
267
+ ? mergedSearchButtonProps.sx
268
+ : [mergedSearchButtonProps.sx]),
269
+ ]}
270
+ {...mergedSearchButtonProps}
271
+ >
272
+ {searchButtonLabel ??
273
+ mergedSearchButtonProps.children ??
274
+ t('searchButtonLabel')}
275
+ </RcSesButton>
276
+ )}
277
+ </Box>
278
+ </RcSesFormControlWrapper>
279
+ )
280
+ })
281
+
282
+ export default RcSesSearchInput
@@ -0,0 +1,23 @@
1
+ import { Checkbox as MuiCheckbox, CheckboxProps as MuiCheckboxProps } from '@mui/material'
2
+ import React from 'react'
3
+
4
+ import CheckBoldIcon from '@/assets/icons/CheckBoldIcon'
5
+ import CheckUncheckedBoldIcon from '@/assets/icons/CheckUncheckedBoldIcon'
6
+ import getLoadingIcon from '@/components/utils/loading'
7
+
8
+ export type SimpleCheckboxProps = MuiCheckboxProps & {
9
+ loading?: boolean
10
+ }
11
+
12
+ function RcSesSimpleCheckbox({ loading, ...props }: SimpleCheckboxProps) {
13
+ return (
14
+ <MuiCheckbox
15
+ checkedIcon={getLoadingIcon(<CheckBoldIcon />, loading)}
16
+ icon={getLoadingIcon(<CheckUncheckedBoldIcon />, loading)}
17
+ {...props}
18
+ disableRipple
19
+ />
20
+ )
21
+ }
22
+
23
+ export default RcSesSimpleCheckbox
@@ -3,16 +3,24 @@ import React from 'react'
3
3
 
4
4
  import RcSesBreadcrumbs from '@/components/common/Breadcrumbs'
5
5
  import theme from '@/theme/light'
6
- import Colors from '@/theme/palette'
6
+ import Colors, { common } from '@/theme/palette'
7
7
 
8
8
  type Props = {
9
9
  breadcrumbsProps: React.ComponentProps<typeof RcSesBreadcrumbs>
10
10
  children?: React.ReactNode
11
11
  title: string
12
+ backgroundColor?: 'primary' | 'white'
12
13
  }
13
- function ServiceHeader({ breadcrumbsProps, children, title }: Props) {
14
+ function ServiceHeader({
15
+ breadcrumbsProps,
16
+ children,
17
+ title,
18
+ backgroundColor = 'primary',
19
+ }: Props) {
20
+ const bgColor = backgroundColor === 'white' ? common.white : Colors.primary['50']
21
+
14
22
  return (
15
- <Box sx={{ backgroundColor: Colors.primary['50'] }}>
23
+ <Box sx={{ backgroundColor: bgColor }}>
16
24
  <Container
17
25
  sx={{
18
26
  pb: { xs: '2rem', md: '2.25rem' },
@@ -23,14 +31,19 @@ function ServiceHeader({ breadcrumbsProps, children, title }: Props) {
23
31
  flexDirection: 'column',
24
32
  }}
25
33
  >
26
- <Box sx={{ mb: { xs: '.875rem', md: '.375rem' } }}>
27
- <RcSesBreadcrumbs {...breadcrumbsProps} />
28
- </Box>
34
+ <RcSesBreadcrumbs
35
+ {...breadcrumbsProps}
36
+ sx={{
37
+ pb: { xs: '.25rem', md: '.5rem' },
38
+ fontSize: '0.75rem',
39
+ lineHeight: '1.25rem',
40
+ }}
41
+ />
29
42
 
30
43
  <Typography
31
44
  variant='h1'
32
45
  sx={{
33
- lineHeight: { xs: '2rem', md: '2.125rem' },
46
+ lineHeight: { xs: '2rem', md: '2.5rem' },
34
47
  }}
35
48
  >
36
49
  {title}
@@ -45,7 +58,8 @@ function ServiceHeader({ breadcrumbsProps, children, title }: Props) {
45
58
  rowGap: '10px',
46
59
 
47
60
  '.MuiTypography-body1': {
48
- lineHeight: '1.3125rem',
61
+ fontSize: '1rem',
62
+ lineHeight: '1.5rem',
49
63
 
50
64
  [theme.breakpoints.down('md')]: {
51
65
  fontSize: '.8125rem',
@@ -0,0 +1,9 @@
1
+ import { Skeleton } from '@mui/material'
2
+ import React from 'react'
3
+
4
+ const LOADING_SKELETON = <Skeleton variant='rounded' width={20} height={20} />
5
+
6
+ const getLoadingIcon = (fallback: React.ReactNode, loading?: boolean) =>
7
+ loading ? LOADING_SKELETON : fallback
8
+
9
+ export default getLoadingIcon
@@ -48,6 +48,17 @@
48
48
  "RcSesSearchableField": {
49
49
  "clearValueAriaLabel": "Clear search value",
50
50
  "searchAriaLabel": "Open search"
51
+ },
52
+
53
+ "RcSesSearchInput": {
54
+ "clearValueAriaLabel": "Clear search value",
55
+ "searchButtonLabel": "Search"
56
+ },
57
+
58
+ "RcSesSnackbar": {
59
+ "aria": {
60
+ "close": "Close notification"
61
+ }
51
62
  }
52
63
  }
53
64
  }
@@ -48,6 +48,17 @@
48
48
  "RcSesSearchableField": {
49
49
  "clearValueAriaLabel": "Išvalyti paieškos reikšmę",
50
50
  "searchAriaLabel": "Ieškoti"
51
+ },
52
+
53
+ "RcSesSearchInput": {
54
+ "clearValueAriaLabel": "Išvalyti paieškos reikšmę",
55
+ "searchButtonLabel": "Ieškoti"
56
+ },
57
+
58
+ "RcSesSnackbar": {
59
+ "aria": {
60
+ "close": "Uždaryti pranešimą"
61
+ }
51
62
  }
52
63
  }
53
64
  }
@@ -1,6 +1,7 @@
1
1
  import RcSesLogo from '@/assets/Logo'
2
2
  import ArrowLeftIcon from '@/assets/icons/ArrowLeftIcon'
3
3
  import ArrowRightIcon from '@/assets/icons/ArrowRightIcon'
4
+ import ArrowsClockwiseIcon from '@/assets/icons/ArrowsClockwiseIcon'
4
5
  import BarcodeIcon from '@/assets/icons/BarcodeIcon'
5
6
  import CalendarBlankIcon from '@/assets/icons/CalendarBlankIcon'
6
7
  import CaretDoubleLeftBoldIcon from '@/assets/icons/CaretDoubleLeftBoldIcon'
@@ -13,6 +14,7 @@ import CaretLeftIcon from '@/assets/icons/CaretLeftIcon'
13
14
  import CaretRightBoldIcon from '@/assets/icons/CaretRightBoldIcon'
14
15
  import CheckBoldIcon from '@/assets/icons/CheckBoldIcon'
15
16
  import CheckCircleFillIcon from '@/assets/icons/CheckCircleFillIcon'
17
+ import CheckIcon from '@/assets/icons/CheckIcon'
16
18
  import CheckUncheckedBoldIcon from '@/assets/icons/CheckUncheckedBoldIcon'
17
19
  import CircleFilledIcon from '@/assets/icons/CircleFilledIcon'
18
20
  import CloseIcon from '@/assets/icons/CloseIcon'
@@ -29,6 +31,8 @@ import QuestionFillIcon from '@/assets/icons/QuestionFillIcon'
29
31
  import QuestionIcon from '@/assets/icons/QuestionIcon'
30
32
  import ScalesIcon from '@/assets/icons/ScalesIcon'
31
33
  import ScrollIcon from '@/assets/icons/ScrollIcon'
34
+ import SearchHelpIcon from '@/assets/icons/SearchHelpIcon'
35
+ import SearchXIcon from '@/assets/icons/SearchXIcon'
32
36
  import SpinnerGapBoldIcon from '@/assets/icons/SpinnerGapBoldIcon'
33
37
  import UploadSimpleIcon from '@/assets/icons/UploadSimpleIcon'
34
38
  import WarningCircleIcon from '@/assets/icons/WarningCircleIcon'
@@ -40,6 +44,7 @@ export {
40
44
  RcSesLogo,
41
45
  ArrowLeftIcon,
42
46
  ArrowRightIcon,
47
+ ArrowsClockwiseIcon,
43
48
  BarcodeIcon,
44
49
  CalendarBlankIcon,
45
50
  CaretDoubleLeftBoldIcon,
@@ -52,6 +57,7 @@ export {
52
57
  CaretRightBoldIcon,
53
58
  CheckBoldIcon,
54
59
  CheckCircleFillIcon,
60
+ CheckIcon,
55
61
  CheckUncheckedBoldIcon,
56
62
  CircleFilledIcon,
57
63
  CloseIcon,
@@ -68,6 +74,8 @@ export {
68
74
  QuestionIcon,
69
75
  ScalesIcon,
70
76
  ScrollIcon,
77
+ SearchHelpIcon,
78
+ SearchXIcon,
71
79
  SpinnerGapBoldIcon,
72
80
  UploadSimpleIcon,
73
81
  WarningDiamondFillIcon,