@registrucentras/rc-ses-react-components 2.0.0-rc.7 → 2.0.0-rc.8

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 (199) hide show
  1. package/dist/components/common/Accordion/hooks/useAccordionController.d.ts +2 -2
  2. package/dist/components/common/Accordion/types/AccordionControllerState.d.ts +2 -2
  3. package/dist/components/common/AdvancedList/components/AdvancedListItem/AdvancedListItem.types.d.ts +2 -2
  4. package/dist/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemLeading.d.ts +2 -2
  5. package/dist/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemTrailing.d.ts +2 -2
  6. package/dist/components/common/Badge/index.d.ts +2 -2
  7. package/dist/components/common/Breadcrumbs/index.d.ts +4 -4
  8. package/dist/components/common/Card/index.d.ts +2 -2
  9. package/dist/components/common/CardShell/CardFooter/index.d.ts +1 -1
  10. package/dist/components/common/CardShell/CardFooter/types.d.ts +4 -9
  11. package/dist/components/common/CardShell/types.d.ts +4 -4
  12. package/dist/components/common/IconWithCircularBackground.d.ts +2 -2
  13. package/dist/components/common/IconWithSquareBackground/index.d.ts +2 -2
  14. package/dist/components/common/ImageCard/index.d.ts +2 -2
  15. package/dist/components/common/SelectableCardList/components/SelectableCardListItem.d.ts +2 -2
  16. package/dist/components/common/SelectableCardList/index.d.ts +2 -2
  17. package/dist/components/common/ServiceLinks/types.d.ts +6 -6
  18. package/dist/components/common/SideNav/SideNav.types.d.ts +7 -5
  19. package/dist/components/common/SideNav/SideNavLayout.d.ts +1 -1
  20. package/dist/components/common/SideNav/components/SideNavPill.d.ts +2 -2
  21. package/dist/components/common/SideNav/components/SideNavPillList.d.ts +2 -2
  22. package/dist/components/common/SideNav/components/SideNavRow.d.ts +4 -3
  23. package/dist/components/common/SideNav/hooks/useKeepActiveItemInView.d.ts +19 -0
  24. package/dist/components/common/SideNav/hooks/useSideNavScrollSpy.d.ts +2 -2
  25. package/dist/components/common/SideNav/index.d.ts +2 -2
  26. package/dist/components/common/Tabs/TabPanel.d.ts +2 -2
  27. package/dist/components/common/Tabs/TabsWrapper.d.ts +2 -2
  28. package/dist/components/common/TitleBlock/types.d.ts +4 -4
  29. package/dist/components/form/components/FormControlWrapper/components/FieldSuffix.d.ts +2 -2
  30. package/dist/components/form/components/FormControlWrapper/index.d.ts +2 -2
  31. package/dist/components/form/inputs/RadioButtonGroup.d.ts +3 -3
  32. package/dist/components/form/inputs/SearchableField.d.ts +2 -2
  33. package/dist/components/form/inputs/Select/Select.types.d.ts +2 -2
  34. package/dist/components/layout/Footer/index.d.ts +2 -2
  35. package/dist/components/layout/ServiceFormActions.d.ts +2 -2
  36. package/dist/components/layout/ServiceFormContainer/AccordionFormContainer/components/AccordionCollapseControls.d.ts +2 -2
  37. package/dist/components/layout/ServiceFormContainer/AccordionFormContainer/index.d.ts +2 -2
  38. package/dist/components/layout/ServiceHeader.d.ts +2 -2
  39. package/dist/components/layout/ServicePage.d.ts +2 -2
  40. package/dist/components/utils/normalizeSx.d.ts +1 -1
  41. package/dist/library/types.d.ts +2 -2
  42. package/dist/registrucentras-rc-ses-react-components.cjs +1 -1
  43. package/dist/registrucentras-rc-ses-react-components.js +1631 -1589
  44. package/dist/types/assets/IconProps.d.ts +2 -2
  45. package/dist/types/cards/CardServiceProps.d.ts +2 -2
  46. package/dist/types/common/QuickLinkType.d.ts +2 -2
  47. package/dist/types/inputs/InputIconProps.d.ts +2 -2
  48. package/dist/types/lists/ListNewsItemType.d.ts +2 -2
  49. package/dist/types/lists/ListServicesItemType.d.ts +3 -3
  50. package/package.json +2 -1
  51. package/src/components/common/Accordion/hooks/useAccordionController.tsx +1 -1
  52. package/src/components/common/Accordion/index.tsx +1 -4
  53. package/src/components/common/Accordion/types/AccordionControllerState.ts +1 -1
  54. package/src/components/common/AdvancedList/components/AdvancedListItem/AdvancedListItem.types.ts +1 -1
  55. package/src/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemLeading.tsx +1 -1
  56. package/src/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemTrailing.tsx +1 -1
  57. package/src/components/common/AdvancedList/components/AdvancedListItem/index.test.tsx +2 -2
  58. package/src/components/common/Badge/index.tsx +3 -3
  59. package/src/components/common/Breadcrumbs/index.tsx +5 -2
  60. package/src/components/common/Card/index.tsx +1 -1
  61. package/src/components/common/CardShell/CardFooter/index.tsx +6 -13
  62. package/src/components/common/CardShell/CardFooter/types.ts +2 -7
  63. package/src/components/common/CardShell/types.ts +2 -2
  64. package/src/components/common/IconWithCircularBackground.tsx +7 -8
  65. package/src/components/common/IconWithSquareBackground/index.tsx +7 -8
  66. package/src/components/common/ImageCard/index.tsx +1 -1
  67. package/src/components/common/SegmentedControl/components/SegmentButton/index.tsx +18 -19
  68. package/src/components/common/SelectableCardList/components/SelectableCardListItem.tsx +1 -1
  69. package/src/components/common/SelectableCardList/index.tsx +1 -1
  70. package/src/components/common/ServiceLinks/types.ts +3 -3
  71. package/src/components/common/SideNav/SideNav.types.ts +11 -3
  72. package/src/components/common/SideNav/SideNavLayout.tsx +3 -0
  73. package/src/components/common/SideNav/components/SideNavPill.tsx +1 -1
  74. package/src/components/common/SideNav/components/SideNavPillList.tsx +8 -23
  75. package/src/components/common/SideNav/components/SideNavRow.tsx +6 -2
  76. package/src/components/common/SideNav/hooks/useKeepActiveItemInView.test.ts +258 -0
  77. package/src/components/common/SideNav/hooks/useKeepActiveItemInView.ts +80 -0
  78. package/src/components/common/SideNav/hooks/useSideNavScrollSpy.test.ts +9 -2
  79. package/src/components/common/SideNav/hooks/useSideNavScrollSpy.ts +4 -3
  80. package/src/components/common/SideNav/index.test.tsx +51 -0
  81. package/src/components/common/SideNav/index.tsx +47 -12
  82. package/src/components/common/Snackbar/index.test.tsx +40 -0
  83. package/src/components/common/Snackbar/index.tsx +9 -3
  84. package/src/components/common/Tabs/TabPanel.tsx +1 -1
  85. package/src/components/common/Tabs/TabsWrapper.tsx +1 -1
  86. package/src/components/common/TitleBlock/index.test.tsx +9 -7
  87. package/src/components/common/TitleBlock/index.tsx +13 -9
  88. package/src/components/common/TitleBlock/types.ts +2 -2
  89. package/src/components/form/components/FormControlWrapper/components/FieldSuffix.tsx +1 -1
  90. package/src/components/form/components/FormControlWrapper/index.tsx +1 -1
  91. package/src/components/form/inputs/Datepicker/index.test.tsx +1 -1
  92. package/src/components/form/inputs/FileDropzone.tsx +1 -4
  93. package/src/components/form/inputs/NumberStepper.test.tsx +83 -0
  94. package/src/components/form/inputs/NumberStepper.tsx +7 -8
  95. package/src/components/form/inputs/RadioButtonGroup.test.tsx +1 -1
  96. package/src/components/form/inputs/RadioButtonGroup.tsx +2 -2
  97. package/src/components/form/inputs/SearchInput/index.tsx +1 -1
  98. package/src/components/form/inputs/SearchableField.test.tsx +2 -2
  99. package/src/components/form/inputs/SearchableField.tsx +1 -1
  100. package/src/components/form/inputs/Select/Select.types.ts +1 -1
  101. package/src/components/form/inputs/Select/index.test.tsx +3 -3
  102. package/src/components/layout/Footer/index.tsx +1 -1
  103. package/src/components/layout/ServiceFormActions.tsx +1 -1
  104. package/src/components/layout/ServiceFormContainer/AccordionFormContainer/components/AccordionCollapseControls.tsx +1 -1
  105. package/src/components/layout/ServiceFormContainer/AccordionFormContainer/index.tsx +1 -1
  106. package/src/components/layout/ServiceHeader.tsx +1 -1
  107. package/src/components/layout/ServicePage.tsx +1 -1
  108. package/src/components/utils/normalizeSx.ts +2 -4
  109. package/src/examples/ListWithPagination/index.tsx +0 -2
  110. package/src/examples/MultipleStepForm/components/AdditionalServicesForm.tsx +1 -1
  111. package/src/examples/MultipleStepForm/components/ServiceIssuanceForm.tsx +1 -1
  112. package/src/examples/MultipleStepForm/components/TermsAndConditionsForm.tsx +1 -1
  113. package/src/examples/MultipleStepForm/types/MultiStepFormModel.ts +1 -1
  114. package/src/examples/SingleStepForm/components/ObjectIdentifierSearchModal.tsx +2 -2
  115. package/src/examples/SingleStepForm/types/SingleStepFormModel.ts +1 -1
  116. package/src/library/types.ts +2 -1
  117. package/src/stories/atoms/Button.stories.tsx +9 -14
  118. package/src/stories/atoms/Checkbox.stories.tsx +1 -1
  119. package/src/stories/atoms/Icons.stories.tsx +1 -1
  120. package/src/stories/atoms/NumberStepper.stories.tsx +1 -1
  121. package/src/stories/atoms/PhoneInput.stories.tsx +1 -1
  122. package/src/stories/atoms/Select.stories.tsx +7 -9
  123. package/src/stories/atoms/Switch.stories.tsx +1 -1
  124. package/src/stories/molecules/Alert.stories.tsx +2 -2
  125. package/src/stories/molecules/CardShell.stories.tsx +4 -4
  126. package/src/stories/molecules/CheckboxFormControl.stories.tsx +13 -21
  127. package/src/stories/molecules/RadioButtonGroup.stories.tsx +1 -1
  128. package/src/stories/molecules/Snackbar.stories.tsx +2 -2
  129. package/src/stories/molecules/TitleBlock.stories.tsx +40 -1
  130. package/src/stories/organisms/AdvancedList.stories.tsx +4 -4
  131. package/src/stories/organisms/FileDropzone.stories.tsx +1 -1
  132. package/src/stories/organisms/FileUpload.stories.tsx +1 -1
  133. package/src/stories/organisms/SideNav.stories.tsx +36 -3
  134. package/src/stubs/Component.tsx +4 -4
  135. package/src/types/assets/IconProps.tsx +1 -1
  136. package/src/types/cards/CardServiceProps.tsx +1 -1
  137. package/src/types/common/QuickLinkType.tsx +1 -1
  138. package/src/types/inputs/InputIconProps.tsx +1 -1
  139. package/src/types/lists/ListNewsItemType.tsx +1 -1
  140. package/src/types/lists/ListServicesItemType.tsx +2 -2
  141. package/src/vite-env.d.ts +2 -2
  142. package/dist/stories/atoms/Badge.stories.d.ts +0 -9
  143. package/dist/stories/atoms/Button.stories.d.ts +0 -107
  144. package/dist/stories/atoms/Checkbox.stories.d.ts +0 -21
  145. package/dist/stories/atoms/IconWithCircularBackground.stories.d.ts +0 -6
  146. package/dist/stories/atoms/IconWithSquareBackground.stories.d.ts +0 -7
  147. package/dist/stories/atoms/Icons.stories.d.ts +0 -7
  148. package/dist/stories/atoms/Loader.stories.d.ts +0 -36
  149. package/dist/stories/atoms/LoadingSpinner.stories.d.ts +0 -62
  150. package/dist/stories/atoms/Logo.stories.d.ts +0 -12
  151. package/dist/stories/atoms/NumberStepper.stories.d.ts +0 -6
  152. package/dist/stories/atoms/PhoneInput.stories.d.ts +0 -10
  153. package/dist/stories/atoms/SearchInput.stories.d.ts +0 -11
  154. package/dist/stories/atoms/Select.stories.d.ts +0 -7
  155. package/dist/stories/atoms/SimpleCheckbox.stories.d.ts +0 -19
  156. package/dist/stories/atoms/Switch.stories.d.ts +0 -17
  157. package/dist/stories/atoms/Tab.stories.d.ts +0 -8
  158. package/dist/stories/atoms/TextField.stories.d.ts +0 -6
  159. package/dist/stories/atoms/Tooltip.stories.d.ts +0 -48
  160. package/dist/stories/foundations/ThemedMuiComponents.stories.d.ts +0 -25
  161. package/dist/stories/molecules/Alert.stories.d.ts +0 -14
  162. package/dist/stories/molecules/Breadcrumbs.stories.d.ts +0 -6
  163. package/dist/stories/molecules/ButtonWithPopover.stories.d.ts +0 -7
  164. package/dist/stories/molecules/Card.stories.d.ts +0 -8
  165. package/dist/stories/molecules/CardShell.stories.d.ts +0 -18
  166. package/dist/stories/molecules/CheckboxFormControl.stories.d.ts +0 -9
  167. package/dist/stories/molecules/DatePicker.stories.d.ts +0 -152
  168. package/dist/stories/molecules/FormControlWrapper.stories.d.ts +0 -7
  169. package/dist/stories/molecules/ImageCard.stories.d.ts +0 -8
  170. package/dist/stories/molecules/ListWithIcons.stories.d.ts +0 -34
  171. package/dist/stories/molecules/PhoneInputFormControl.stories.d.ts +0 -6
  172. package/dist/stories/molecules/Popover.stories.d.ts +0 -12
  173. package/dist/stories/molecules/RadioButtonGroup.stories.d.ts +0 -6
  174. package/dist/stories/molecules/SearchableField.stories.d.ts +0 -6
  175. package/dist/stories/molecules/SegmentedControl.stories.d.ts +0 -202
  176. package/dist/stories/molecules/Snackbar.stories.d.ts +0 -143
  177. package/dist/stories/molecules/TabPanel.stories.d.ts +0 -7
  178. package/dist/stories/molecules/Tabs.stories.d.ts +0 -7
  179. package/dist/stories/molecules/TabsWrapper.stories.d.ts +0 -6
  180. package/dist/stories/molecules/TitleBlock.stories.d.ts +0 -22
  181. package/dist/stories/organisms/Accordion.stories.d.ts +0 -18
  182. package/dist/stories/organisms/AdvancedList.stories.d.ts +0 -33
  183. package/dist/stories/organisms/AdvancedListItem.stories.d.ts +0 -33
  184. package/dist/stories/organisms/CardFormContainer.stories.d.ts +0 -7
  185. package/dist/stories/organisms/DataPagination.stories.d.ts +0 -47
  186. package/dist/stories/organisms/Dialog.stories.d.ts +0 -15
  187. package/dist/stories/organisms/FileDropzone.stories.d.ts +0 -6
  188. package/dist/stories/organisms/FileUpload.stories.d.ts +0 -18
  189. package/dist/stories/organisms/Footer.stories.d.ts +0 -6
  190. package/dist/stories/organisms/FullPageLoader.stories.d.ts +0 -37
  191. package/dist/stories/organisms/Modal.stories.d.ts +0 -10
  192. package/dist/stories/organisms/SelectableCardList.stories.d.ts +0 -37
  193. package/dist/stories/organisms/ServiceFormActions.stories.d.ts +0 -6
  194. package/dist/stories/organisms/ServiceFormContainer.stories.d.ts +0 -15
  195. package/dist/stories/organisms/ServiceHeader.stories.d.ts +0 -7
  196. package/dist/stories/organisms/ServiceLinks.stories.d.ts +0 -28
  197. package/dist/stories/organisms/ServiceWizardStepper.stories.d.ts +0 -7
  198. package/dist/stories/organisms/SideNav.stories.d.ts +0 -7
  199. package/dist/stories/templates/ServicePage.stories.d.ts +0 -6
@@ -4,7 +4,7 @@ import RcSesBadge from '@/components/common/Badge'
4
4
  import cards from '@/theme/cards'
5
5
  import palette from '@/theme/palette'
6
6
 
7
- import { RcSesTitleBlockProps } from './types'
7
+ import { RcSesTitleBlockProps, TitleBlockHeadingLevel } from './types'
8
8
 
9
9
  function RcSesTitleBlock({
10
10
  title,
@@ -20,7 +20,10 @@ function RcSesTitleBlock({
20
20
  className,
21
21
  testIds,
22
22
  }: RcSesTitleBlockProps) {
23
- const HeadingTag = `h${headingLevel}` as 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
23
+ // Annotated rather than asserted: a template literal expression widens to
24
+ // `string` without a contextual type, and JSX cannot resolve an intrinsic
25
+ // element from that.
26
+ const HeadingTag: `h${TitleBlockHeadingLevel}` = `h${headingLevel}`
24
27
  const hasCount = count !== undefined && count !== null
25
28
  const hasDescription = description !== undefined && description !== null
26
29
  const isVertical = orientation === 'vertical'
@@ -103,11 +106,15 @@ function RcSesTitleBlock({
103
106
  const actionsSlot = actions ? (
104
107
  <Stack
105
108
  data-testid={testIds?.actions}
106
- direction={{ xs: 'column', sm: 'row' }}
109
+ direction='row'
107
110
  spacing={cards.header.actionsGap}
111
+ // Flex gap instead of sibling margin, so wrapped rows get the vertical
112
+ // gap and the first action of each row has no stray left margin.
113
+ useFlexGap
108
114
  sx={{
109
- alignItems: { xs: 'flex-start', sm: 'center' },
115
+ alignItems: 'center',
110
116
  flexShrink: 0,
117
+ flexWrap: 'wrap',
111
118
  }}
112
119
  >
113
120
  {actions}
@@ -125,10 +132,7 @@ function RcSesTitleBlock({
125
132
  // leaving a sibling-selector margin above the title.
126
133
  useFlexGap
127
134
  sx={{
128
- alignItems:
129
- isVertical || hasDescription
130
- ? 'flex-start'
131
- : { xs: 'flex-start', sm: 'center' },
135
+ alignItems: isVertical ? 'flex-start' : { xs: 'flex-start', sm: 'center' },
132
136
  width: '100%',
133
137
  }}
134
138
  >
@@ -145,7 +149,7 @@ function RcSesTitleBlock({
145
149
  direction='row'
146
150
  spacing={cards.header.rowGap}
147
151
  sx={{
148
- alignItems: hasDescription ? 'flex-start' : 'center',
152
+ alignItems: 'center',
149
153
  flex: 1,
150
154
  minWidth: 0,
151
155
  width: '100%',
@@ -6,7 +6,7 @@ export type TitleBlockTitleVariant = 'h4' | 'h5' | 'h6' | 'body1'
6
6
 
7
7
  export type TitleBlockOrientation = 'horizontal' | 'vertical'
8
8
 
9
- export type RcSesTitleBlockTestIds = {
9
+ export interface RcSesTitleBlockTestIds {
10
10
  root?: string
11
11
  icon?: string
12
12
  heading?: string
@@ -15,7 +15,7 @@ export type RcSesTitleBlockTestIds = {
15
15
  actions?: string
16
16
  }
17
17
 
18
- export type RcSesTitleBlockBaseProps = {
18
+ export interface RcSesTitleBlockBaseProps {
19
19
  title: ReactNode
20
20
  headingLevel?: TitleBlockHeadingLevel
21
21
  /**
@@ -1,6 +1,6 @@
1
1
  import { Box, SxProps, Theme } from '@mui/material'
2
2
 
3
- type Props = {
3
+ interface Props {
4
4
  children: React.ReactNode
5
5
  sx?: SxProps<Theme>
6
6
  }
@@ -8,7 +8,7 @@ import theme from '@/theme/light'
8
8
  import FieldSuffix from './components/FieldSuffix'
9
9
  import { formControlDesktopLabelWidth } from './const/FormControlLayoutVariables'
10
10
 
11
- type Props = {
11
+ interface Props {
12
12
  children: React.ReactNode
13
13
  className?: string
14
14
  description?: React.ReactNode
@@ -16,7 +16,7 @@ import RcSesDatepicker from '.'
16
16
  const REFERENCE = new Date(2026, 0, 15)
17
17
  const MAX = new Date(2026, 0, 20)
18
18
 
19
- type HarnessProps = {
19
+ interface HarnessProps {
20
20
  /** Seeds the field, so a day renders as selected. */
21
21
  value?: string | null
22
22
  /** Bounds the calendar, so later days render as disabled. */
@@ -70,10 +70,7 @@ function RcSesFileDropzone(props: Props) {
70
70
 
71
71
  const hasValidFileSelection = value && Array.isArray(value) && value.length > 0
72
72
 
73
- const onRemoveFile = (
74
- e: React.MouseEvent<HTMLButtonElement, MouseEvent>,
75
- index: number,
76
- ) => {
73
+ const onRemoveFile = (e: React.MouseEvent<HTMLButtonElement>, index: number) => {
77
74
  e.preventDefault()
78
75
  e.stopPropagation()
79
76
 
@@ -0,0 +1,83 @@
1
+ import { ThemeProvider } from '@mui/material/styles'
2
+ import { fireEvent, render, screen } from '@testing-library/react'
3
+ import { useForm } from 'react-hook-form'
4
+
5
+ import theme from '@/theme/light'
6
+
7
+ import RcSesNumberStepper from './NumberStepper'
8
+
9
+ interface TestWrapperProps {
10
+ defaultValue?: number
11
+ disabled?: boolean
12
+ max?: number
13
+ min?: number
14
+ }
15
+
16
+ const TestWrapper = ({ defaultValue = 5, disabled, max, min }: TestWrapperProps) => {
17
+ const { control } = useForm({ defaultValues: { quantity: defaultValue } })
18
+
19
+ return (
20
+ <ThemeProvider theme={theme}>
21
+ <RcSesNumberStepper
22
+ id='quantity'
23
+ name='quantity'
24
+ control={control}
25
+ label='Kiekis'
26
+ displayStepperControls
27
+ disabled={disabled}
28
+ rules={{ min, max }}
29
+ />
30
+ </ThemeProvider>
31
+ )
32
+ }
33
+
34
+ const subtractButton = () => screen.getByRole('button', { name: 'Atimti' })
35
+ const addButton = () => screen.getByRole('button', { name: 'Pridėti' })
36
+
37
+ describe('RcSesNumberStepper', () => {
38
+ test('enables both controls when the value sits between min and max', () => {
39
+ render(<TestWrapper defaultValue={5} min={0} max={10} />)
40
+
41
+ expect(subtractButton()).toBeEnabled()
42
+ expect(addButton()).toBeEnabled()
43
+ })
44
+
45
+ test('disables subtract on the first render when the value is already at min', () => {
46
+ render(<TestWrapper defaultValue={0} min={0} max={10} />)
47
+
48
+ expect(subtractButton()).toBeDisabled()
49
+ expect(addButton()).toBeEnabled()
50
+ })
51
+
52
+ test('disables add on the first render when the value is already at max', () => {
53
+ render(<TestWrapper defaultValue={10} min={0} max={10} />)
54
+
55
+ expect(subtractButton()).toBeEnabled()
56
+ expect(addButton()).toBeDisabled()
57
+ })
58
+
59
+ test('disables both controls when the field is disabled', () => {
60
+ render(<TestWrapper defaultValue={5} disabled min={0} max={10} />)
61
+
62
+ expect(subtractButton()).toBeDisabled()
63
+ expect(addButton()).toBeDisabled()
64
+ })
65
+
66
+ test('leaves both controls enabled when no min or max is set', () => {
67
+ render(<TestWrapper defaultValue={0} />)
68
+
69
+ expect(subtractButton()).toBeEnabled()
70
+ expect(addButton()).toBeEnabled()
71
+ })
72
+
73
+ test('re-evaluates the controls as the value reaches a bound', () => {
74
+ render(<TestWrapper defaultValue={9} min={0} max={10} />)
75
+
76
+ expect(addButton()).toBeEnabled()
77
+
78
+ fireEvent.click(addButton())
79
+
80
+ expect(addButton()).toBeDisabled()
81
+ expect(subtractButton()).toBeEnabled()
82
+ })
83
+ })
@@ -51,7 +51,7 @@ const NumberInput = styled(OutlinedInput)({
51
51
  },
52
52
  })
53
53
 
54
- type ArrowButtonProps = {
54
+ interface ArrowButtonProps {
55
55
  ariaLabel: string
56
56
  direction: 'plus' | 'minus'
57
57
  disabled: boolean
@@ -110,8 +110,6 @@ type Props = Pick<TControllerProps, ImmediateControllerProps> &
110
110
  function RcSesNumberStepper(props: Props) {
111
111
  const { t } = useTranslation('input', { keyPrefix: 'components.RcSesNumberStepper' })
112
112
 
113
- const [buttonState, setButtonState] = React.useState<[boolean, boolean]>([true, true])
114
-
115
113
  const {
116
114
  control,
117
115
  displayStepperControls,
@@ -138,20 +136,21 @@ function RcSesNumberStepper(props: Props) {
138
136
  ...slotProps?.controller,
139
137
  })
140
138
 
141
- React.useEffect(() => {
139
+ // [subtractDisabled, addDisabled] - derived from the current value and the
140
+ // controller rules, so the buttons render with the right state on first paint.
141
+ const buttonState = useMemo<[boolean, boolean]>(() => {
142
142
  if (disabled) {
143
- setButtonState([true, true])
144
- return
143
+ return [true, true]
145
144
  }
146
145
 
147
- setButtonState([
146
+ return [
148
147
  Number.isInteger(rules?.min)
149
148
  ? parseInt(rules?.min as string, 10) >= parseInt((value ?? 0) as string, 10)
150
149
  : false,
151
150
  Number.isInteger(rules?.max)
152
151
  ? parseInt(rules?.max as string, 10) <= parseInt((value ?? 0) as string, 10)
153
152
  : false,
154
- ])
153
+ ]
155
154
  }, [disabled, rules?.max, rules?.min, value])
156
155
 
157
156
  const handleInputOnChange = (
@@ -12,7 +12,7 @@ const options = [
12
12
  { label: 'Juridinis asmuo', value: 'legal' },
13
13
  ]
14
14
 
15
- type TestWrapperProps = {
15
+ interface TestWrapperProps {
16
16
  shouldUnregister?: boolean
17
17
  }
18
18
 
@@ -15,7 +15,7 @@ import RcSesFormControlWrapper, {
15
15
  RcSesFormControlWrapperProps,
16
16
  } from '../components/FormControlWrapper'
17
17
 
18
- export type RadioOption = {
18
+ export interface RadioOption {
19
19
  label: string
20
20
  value: string
21
21
  }
@@ -35,7 +35,7 @@ type Props = Pick<TControllerProps, ImmediateControllerProps> &
35
35
  id?: string
36
36
  className?: string
37
37
  hideNativeRadio?: boolean
38
- options: Array<RadioOption>
38
+ options: RadioOption[]
39
39
  variant?: 'flat' | 'outlined' | 'filled'
40
40
  slotProps?: {
41
41
  controller?: Partial<Omit<TControllerProps, ImmediateControllerProps>>
@@ -62,7 +62,7 @@ const RcSesSearchInput = React.forwardRef<HTMLInputElement, Props>((props, ref)
62
62
  if (typeof ref === 'function') {
63
63
  ref(el)
64
64
  } else if (ref) {
65
- ;(ref as React.MutableRefObject<HTMLInputElement | null>).current = el
65
+ ref.current = el
66
66
  }
67
67
  },
68
68
  [ref],
@@ -25,7 +25,7 @@ vi.mock('react-i18next', () => ({
25
25
  * the runtime breaks. These tests pin the behaviour so the migration is verifiable.
26
26
  */
27
27
 
28
- type ModalProps = {
28
+ interface ModalProps {
29
29
  open: boolean
30
30
  onSubmit: (value: string) => void
31
31
  onClose: () => void
@@ -58,7 +58,7 @@ const TestWrapper = ({ defaultValue = '' }: { defaultValue?: string }) => {
58
58
  )
59
59
  }
60
60
 
61
- const getField = () => screen.getByRole('textbox') as HTMLInputElement
61
+ const getField = () => screen.getByRole<HTMLInputElement>('textbox')
62
62
 
63
63
  describe('RcSesSearchableField', () => {
64
64
  it('should render the field with the value from the form', () => {
@@ -15,7 +15,7 @@ import RcSesFormControlWrapper, {
15
15
  RcSesFormControlWrapperProps,
16
16
  } from '../components/FormControlWrapper'
17
17
 
18
- type ModalComponentProps = {
18
+ interface ModalComponentProps {
19
19
  open: boolean
20
20
  onSubmit: (value: string) => void
21
21
  onClose: () => void
@@ -1,4 +1,4 @@
1
- export type Option = {
1
+ export interface Option {
2
2
  label: string
3
3
  value: string
4
4
  description?: string
@@ -7,7 +7,7 @@ import theme from '@/theme/light'
7
7
 
8
8
  import RcSesSelect from '.'
9
9
 
10
- type TestWrapperProps = {
10
+ interface TestWrapperProps {
11
11
  defaultValue?: string | null
12
12
  }
13
13
 
@@ -22,13 +22,13 @@ const options = [
22
22
  },
23
23
  ]
24
24
 
25
- type UnregisterTestWrapperProps = {
25
+ interface UnregisterTestWrapperProps {
26
26
  shouldUnregister?: boolean
27
27
  }
28
28
 
29
29
  const UnregisterTestWrapper = ({ shouldUnregister }: UnregisterTestWrapperProps) => {
30
30
  const { control, getValues } = useForm({
31
- defaultValues: { selection: 'short-option' as string | null },
31
+ defaultValues: { selection: 'short-option' },
32
32
  })
33
33
  const [mounted, setMounted] = useState(true)
34
34
  const [formValues, setFormValues] = useState('')
@@ -2,7 +2,7 @@ import { Box, Container, Typography } from '@mui/material'
2
2
 
3
3
  import palette from '@/theme/palette'
4
4
 
5
- type Props = {
5
+ interface Props {
6
6
  text: string
7
7
  }
8
8
 
@@ -6,7 +6,7 @@ import CaretLeftIcon from '@/assets/icons/CaretLeftIcon'
6
6
  import Button from '@/components/common/Button'
7
7
  import palette from '@/theme/palette'
8
8
 
9
- type Props = {
9
+ interface Props {
10
10
  onDiscard: () => void
11
11
  onSaveDraft: () => void
12
12
  onSubmit: () => void
@@ -5,7 +5,7 @@ import ExpandChevronsIcon from '@/assets/icons/ExpandChevronsIcon'
5
5
  import useAccordionController from '@/components/common/Accordion/hooks/useAccordionController'
6
6
  import Button from '@/components/common/Button'
7
7
 
8
- type Props = {
8
+ interface Props {
9
9
  controller: ReturnType<typeof useAccordionController>
10
10
  }
11
11
  function AccordionCollapseControls({ controller }: Props) {
@@ -9,7 +9,7 @@ import ServiceWizardStepper from '../../ServiceWizardStepper'
9
9
  import AccordionCollapseControls from './components/AccordionCollapseControls'
10
10
  import mapAccordionStateToSteps from './utils'
11
11
 
12
- type Props = {
12
+ interface Props {
13
13
  accordionController: ReturnType<typeof useAccordionController>
14
14
  children: React.ReactNode
15
15
  showAccordionCollapseControls?: boolean
@@ -5,7 +5,7 @@ import RcSesBreadcrumbs from '@/components/common/Breadcrumbs'
5
5
  import theme from '@/theme/light'
6
6
  import { common } from '@/theme/palette'
7
7
 
8
- type Props = {
8
+ interface Props {
9
9
  breadcrumbsProps: React.ComponentProps<typeof RcSesBreadcrumbs>
10
10
  children?: React.ReactNode
11
11
  title: string
@@ -1,6 +1,6 @@
1
1
  import { Box } from '@mui/material'
2
2
 
3
- type Props = {
3
+ interface Props {
4
4
  children: React.ReactNode
5
5
  }
6
6
  function ServicePage({ children }: Props) {
@@ -1,11 +1,9 @@
1
1
  import { SxProps, Theme } from '@mui/material'
2
2
 
3
3
  type SxEntry =
4
- Extract<SxProps<Theme>, ReadonlyArray<unknown>> extends ReadonlyArray<infer T>
5
- ? T
6
- : never
4
+ Extract<SxProps<Theme>, readonly unknown[]> extends readonly (infer T)[] ? T : never
7
5
 
8
- function isSxArray(sx: SxProps<Theme>): sx is ReadonlyArray<SxEntry> {
6
+ function isSxArray(sx: SxProps<Theme>): sx is readonly SxEntry[] {
9
7
  return Array.isArray(sx)
10
8
  }
11
9
 
@@ -58,8 +58,6 @@ function ListWithPagination() {
58
58
  const [selectedItemId, setSelectedItemId] = useState<string | null>(null)
59
59
 
60
60
  useEffect(() => {
61
- setIsLoading(true)
62
-
63
61
  const timer = setTimeout(() => {
64
62
  setData(mapToSelectableItems(mockApiData))
65
63
  setIsLoading(false)
@@ -2,7 +2,7 @@ import { useForm } from 'react-hook-form'
2
2
 
3
3
  import RcSesTextField from '@/components/form/inputs/TextField'
4
4
 
5
- type FormModel = {
5
+ interface FormModel {
6
6
  additionalServices: string
7
7
  }
8
8
 
@@ -4,7 +4,7 @@ import RcSesAlert from '@/components/common/Alert'
4
4
  import RcSesRadioButtonGroup from '@/components/form/inputs/RadioButtonGroup'
5
5
  import RcSesSelect from '@/components/form/inputs/Select'
6
6
 
7
- type FormModel = {
7
+ interface FormModel {
8
8
  issuanceMethod: string
9
9
  rcBranch: string
10
10
  }
@@ -2,7 +2,7 @@ import { useForm } from 'react-hook-form'
2
2
 
3
3
  import RcSesCheckbox from '@/components/form/inputs/Checkbox'
4
4
 
5
- type FormModel = {
5
+ interface FormModel {
6
6
  agreement: boolean
7
7
  }
8
8
 
@@ -1,4 +1,4 @@
1
- type MultiStepFormModel = {
1
+ interface MultiStepFormModel {
2
2
  purpose: string
3
3
  legalBasis: string
4
4
  agreement: boolean
@@ -19,7 +19,7 @@ import { useForm } from 'react-hook-form'
19
19
 
20
20
  import RcSesTextField from '@/components/form/inputs/TextField'
21
21
 
22
- type FormModel = {
22
+ interface FormModel {
23
23
  city: string
24
24
  street: string
25
25
  addressNo: string
@@ -27,7 +27,7 @@ type FormModel = {
27
27
  aptNo: string
28
28
  }
29
29
 
30
- type Props = {
30
+ interface Props {
31
31
  open: boolean
32
32
  onSubmit: (value: string) => void
33
33
  onClose: () => void
@@ -1,4 +1,4 @@
1
- type SingleStepFormModel = {
1
+ interface SingleStepFormModel {
2
2
  text: string
3
3
  multilineText: string
4
4
  selection: string
@@ -22,7 +22,7 @@ import {
22
22
  RcSesServiceLinksProps,
23
23
  RcSesServiceLinksTestIds,
24
24
  } from '@/components/common/ServiceLinks/types'
25
- import { RcSesSideNavItem } from '@/components/common/SideNav'
25
+ import { RcSesSideNavItem, RcSesSideNavOverflow } from '@/components/common/SideNav'
26
26
  import { RcSesSideNavLayoutProps } from '@/components/common/SideNav/SideNavLayout'
27
27
  import {
28
28
  RcSesTitleBlockProps,
@@ -81,6 +81,7 @@ export type {
81
81
  RcSesTooltipProps,
82
82
  RcSesSideNavItem,
83
83
  RcSesSideNavLayoutProps,
84
+ RcSesSideNavOverflow,
84
85
  }
85
86
  export type { RcSesDialogProps, DialogSize }
86
87
  export type { RcSesModalProps, ModalVariant }
@@ -6,12 +6,7 @@ import Button from '@/components/common/Button'
6
6
  import { grey } from '@/theme/palette'
7
7
  import { ButtonProps } from '@/types/buttons/ButtonProps'
8
8
 
9
- const variantOptions: Array<ButtonProps['variant']> = [
10
- 'contained',
11
- 'outlined',
12
- 'link',
13
- 'text',
14
- ]
9
+ const variantOptions: ButtonProps['variant'][] = ['contained', 'outlined', 'link', 'text']
15
10
  const colorOptions = [
16
11
  'primary',
17
12
  'secondary',
@@ -249,7 +244,7 @@ export const ErrorOutlined: Story = {
249
244
  export const LightOutlined: Story = {
250
245
  args: {
251
246
  variant: 'outlined',
252
- color: 'light' as any,
247
+ color: 'light',
253
248
  children: 'Light Button',
254
249
  },
255
250
  decorators: [
@@ -273,7 +268,7 @@ export const LightOutlined: Story = {
273
268
  export const LightOutlinedWithIcon: Story = {
274
269
  args: {
275
270
  variant: 'outlined',
276
- color: 'light' as any,
271
+ color: 'light',
277
272
  startIcon: <PlusBoldIcon />,
278
273
  children: 'Light Button with Icon',
279
274
  },
@@ -298,7 +293,7 @@ export const LightOutlinedWithIcon: Story = {
298
293
  export const LightOutlinedDisabled: Story = {
299
294
  args: {
300
295
  variant: 'outlined',
301
- color: 'light' as any,
296
+ color: 'light',
302
297
  children: 'Light Button Disabled',
303
298
  disabled: true,
304
299
  },
@@ -324,7 +319,7 @@ export const GhostOutlinedIconOnly: Story = {
324
319
  args: {
325
320
  'aria-label': 'Close',
326
321
  children: <PlusBoldIcon />,
327
- color: 'ghost' as any,
322
+ color: 'ghost',
328
323
  iconOnly: true,
329
324
  variant: 'outlined',
330
325
  },
@@ -350,7 +345,7 @@ export const GhostOutlinedIconOnlyDisabled: Story = {
350
345
  args: {
351
346
  'aria-label': 'Close',
352
347
  children: <PlusBoldIcon />,
353
- color: 'ghost' as any,
348
+ color: 'ghost',
354
349
  disabled: true,
355
350
  iconOnly: true,
356
351
  variant: 'outlined',
@@ -491,7 +486,7 @@ export const ErrorOutlinedLoading: Story = {
491
486
  export const LightOutlinedLoading: Story = {
492
487
  args: {
493
488
  variant: 'outlined',
494
- color: 'light' as any,
489
+ color: 'light',
495
490
  children: 'Light Button',
496
491
  loading: true,
497
492
  },
@@ -516,7 +511,7 @@ export const LightOutlinedLoading: Story = {
516
511
  export const LightOutlinedWithIconLoading: Story = {
517
512
  args: {
518
513
  variant: 'outlined',
519
- color: 'light' as any,
514
+ color: 'light',
520
515
  startIcon: <PlusBoldIcon />,
521
516
  children: 'Light Button with Icon',
522
517
  loading: true,
@@ -543,7 +538,7 @@ export const GhostOutlinedIconOnlyLoading: Story = {
543
538
  args: {
544
539
  'aria-label': 'Close',
545
540
  children: <PlusBoldIcon />,
546
- color: 'ghost' as any,
541
+ color: 'ghost',
547
542
  iconOnly: true,
548
543
  variant: 'outlined',
549
544
  loading: true,
@@ -11,7 +11,7 @@ const variants = ['outlined', 'flat']
11
11
 
12
12
  const lorem = 'Lorem Ipsum has been the standard.'
13
13
 
14
- type FormModel = {
14
+ interface FormModel {
15
15
  agreement: string
16
16
  }
17
17
 
@@ -51,7 +51,7 @@ import palette from '@/theme/palette'
51
51
 
52
52
  type StoryArgs = IconProps
53
53
 
54
- type IconStoryItem = {
54
+ interface IconStoryItem {
55
55
  name: string
56
56
  render: (args: StoryArgs) => ReactElement
57
57
  }
@@ -7,7 +7,7 @@ import FieldView from '@/components/storybook/FieldView'
7
7
  import Fields from '@/components/storybook/Fields'
8
8
  import PreviewTitle from '@/components/storybook/PreviewTitle'
9
9
 
10
- type FormModel = {
10
+ interface FormModel {
11
11
  countable: number
12
12
  countable2: number
13
13
  countable3: number
@@ -7,7 +7,7 @@ import FieldView from '@/components/storybook/FieldView'
7
7
  import Fields from '@/components/storybook/Fields'
8
8
  import PreviewTitle from '@/components/storybook/PreviewTitle'
9
9
 
10
- type FormModel = {
10
+ interface FormModel {
11
11
  phone: string
12
12
  phoneDisabled: string
13
13
  phoneError: string