@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
@@ -1,11 +1,11 @@
1
1
  import { ColorType } from '../common/ColorType';
2
- type IconProps = {
2
+ interface IconProps {
3
3
  className?: string;
4
4
  width?: number;
5
5
  height?: number;
6
6
  disabled?: boolean;
7
7
  color?: ColorType | string;
8
- };
8
+ }
9
9
  export declare const IconDefaultProps: {
10
10
  className: undefined;
11
11
  disabled: boolean;
@@ -1,7 +1,7 @@
1
1
  import { default as React } from 'react';
2
2
  import { ColorType } from '../common/ColorType';
3
- export type CardServiceProps = {
3
+ export interface CardServiceProps {
4
4
  title: string;
5
5
  Icon: React.FunctionComponent;
6
6
  iconColor?: ColorType;
7
- };
7
+ }
@@ -1,5 +1,5 @@
1
- export type QuickLinkType = {
1
+ export interface QuickLinkType {
2
2
  name: string;
3
3
  title: string;
4
4
  Icon?: React.FC;
5
- };
5
+ }
@@ -1,4 +1,4 @@
1
- type InputIconProps = {
1
+ interface InputIconProps {
2
2
  disabled?: boolean;
3
- };
3
+ }
4
4
  export default InputIconProps;
@@ -1,5 +1,5 @@
1
- export type ListNewsItemType = {
1
+ export interface ListNewsItemType {
2
2
  title: string;
3
3
  date: Date | string;
4
4
  imgUrl: string;
5
- };
5
+ }
@@ -1,7 +1,7 @@
1
1
  import { default as React } from 'react';
2
- export type ListServicesItemType = {
2
+ export interface ListServicesItemType {
3
3
  title: string;
4
4
  Icon?: React.FC | undefined;
5
5
  limit?: number | undefined;
6
- items: Array<string>;
7
- };
6
+ items: string[];
7
+ }
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": "2.0.0-rc.7",
4
+ "version": "2.0.0-rc.8",
5
5
  "description": "RC SES React komponentų biblioteka",
6
6
  "type": "module",
7
7
  "private": false,
@@ -30,6 +30,7 @@
30
30
  "preview": "vite preview",
31
31
  "lint": "eslint .",
32
32
  "lint:fix": "eslint --fix .",
33
+ "typecheck": "tsc -p ./tsconfig.json --noEmit",
33
34
  "storybook": "storybook dev -p 6006",
34
35
  "storybook-test": "test-storybook",
35
36
  "storybook-build": "storybook build",
@@ -2,7 +2,7 @@ import React from 'react'
2
2
 
3
3
  import { AccordionControllerState } from '../types/AccordionControllerState'
4
4
 
5
- type Props = {
5
+ interface Props {
6
6
  initialState: AccordionControllerState
7
7
  }
8
8
 
@@ -19,10 +19,7 @@ function RcSesAccordion(props: Props) {
19
19
  ? state[id]
20
20
  : { canToggle: true, disabled: false, expanded: false, title: '' }
21
21
 
22
- const handleOnChange = (
23
- event: React.SyntheticEvent<Element, Event>,
24
- isExpanded: boolean,
25
- ) => {
22
+ const handleOnChange = (event: React.SyntheticEvent, isExpanded: boolean) => {
26
23
  if (canToggle === false) return
27
24
 
28
25
  toggleAccordion(id, isExpanded)
@@ -1,4 +1,4 @@
1
- export type AccordionState = {
1
+ export interface AccordionState {
2
2
  canToggle?: boolean | undefined
3
3
  disabled?: boolean | undefined
4
4
  expanded: boolean | undefined
@@ -6,7 +6,7 @@ export type AdvancedListItemState = 'rest' | 'selected' | 'disabled' | 'error'
6
6
 
7
7
  export type AdvancedListItemStatusColor = 'grey' | 'warning' | 'success' | 'error'
8
8
 
9
- export type AdvancedListItemAction = {
9
+ export interface AdvancedListItemAction {
10
10
  label: string
11
11
  icon?: ComponentType<{ fillColor?: string; size?: number }>
12
12
  onClick: () => void
@@ -10,7 +10,7 @@ import palette from '@/theme/palette'
10
10
 
11
11
  import { AdvancedListItemLeading as AdvancedListItemLeadingData } from '../AdvancedListItem.types'
12
12
 
13
- type Props = {
13
+ interface Props {
14
14
  leading: AdvancedListItemLeadingData
15
15
  disabled?: boolean
16
16
  inputRef?: RefObject<HTMLInputElement>
@@ -16,7 +16,7 @@ import {
16
16
  AdvancedListItemTrailing as AdvancedListItemTrailingData,
17
17
  } from '../AdvancedListItem.types'
18
18
 
19
- type Props = {
19
+ interface Props {
20
20
  trailing: AdvancedListItemTrailingData
21
21
  disabled?: boolean
22
22
  }
@@ -496,7 +496,7 @@ describe('AdvancedListItem', () => {
496
496
 
497
497
  renderItem(<Wrapper />)
498
498
 
499
- const input = screen.getByLabelText('Company name') as HTMLInputElement
499
+ const input = screen.getByLabelText('Company name')
500
500
  fireEvent.change(input, { target: { value: 'UAB Įmonė' } })
501
501
  expect(input).toHaveValue('UAB Įmonė')
502
502
 
@@ -571,7 +571,7 @@ describe('AdvancedListItem', () => {
571
571
  />,
572
572
  )
573
573
 
574
- const field = screen.getByLabelText('Field') as HTMLInputElement
574
+ const field = screen.getByLabelText('Field')
575
575
  const contentContainer = field.closest('[id]') as HTMLElement
576
576
 
577
577
  // jsdom doesn't implement the `.inert` IDL property (it's always undefined there even
@@ -5,7 +5,7 @@ import CircleFilledIcon from '@/assets/icons/CircleFilledIcon'
5
5
  import CloseIcon from '@/assets/icons/CloseIcon'
6
6
  import { common, error, grey, primary, secondary, warning } from '@/theme/palette'
7
7
 
8
- export type RcSesBadgeProps = {
8
+ export interface RcSesBadgeProps {
9
9
  label: string
10
10
  variant: 'neutral' | 'success' | 'warning' | 'error' | 'info' | 'brand'
11
11
  size: 'small' | 'regular'
@@ -14,7 +14,7 @@ export type RcSesBadgeProps = {
14
14
  onClose?: () => void
15
15
  }
16
16
 
17
- type VariantStyle = {
17
+ interface VariantStyle {
18
18
  border: string
19
19
  background: string
20
20
  iconColor: string
@@ -60,7 +60,7 @@ const variantStyles: Record<RcSesBadgeProps['variant'], VariantStyle> = {
60
60
  },
61
61
  }
62
62
 
63
- type SizeStyle = {
63
+ interface SizeStyle {
64
64
  height: string
65
65
  padding: string
66
66
  fontSize: string
@@ -1,8 +1,11 @@
1
1
  import { Link, Breadcrumbs as MuiBreadcrumbs, SxProps, Theme } from '@mui/material'
2
2
 
3
- export type BreadcrumbItem = { label: string; path: string }
3
+ export interface BreadcrumbItem {
4
+ label: string
5
+ path: string
6
+ }
4
7
 
5
- type Props = {
8
+ interface Props {
6
9
  path: BreadcrumbItem[]
7
10
  sx?: SxProps<Theme>
8
11
  }
@@ -13,7 +13,7 @@ import { ReactNode } from 'react'
13
13
  import normalizeSx from '@/components/utils/normalizeSx'
14
14
  import palette from '@/theme/palette'
15
15
 
16
- export type RcSesCardTestIds = {
16
+ export interface RcSesCardTestIds {
17
17
  root?: string
18
18
  image?: string
19
19
  header?: string
@@ -10,19 +10,9 @@ const justifyContent: Record<CardFooterAlign, string> = {
10
10
  start: 'flex-start',
11
11
  }
12
12
 
13
- // On xs the Stack is column, so cross-axis alignment (alignItems) is what
14
- // positions children horizontally. Mirror `align` onto it so `end` still
15
- // renders on the right on mobile when children are not full-width.
16
- const mobileAlignItems: Record<CardFooterAlign, string> = {
17
- between: 'flex-start',
18
- end: 'flex-end',
19
- start: 'flex-start',
20
- }
21
-
22
13
  function RcSesCardFooter({
23
14
  children,
24
15
  align = 'between',
25
- stretchOnMobile = true,
26
16
  className,
27
17
  testIds,
28
18
  }: RcSesCardFooterProps) {
@@ -30,13 +20,16 @@ function RcSesCardFooter({
30
20
  <Stack
31
21
  className={className}
32
22
  data-testid={testIds?.root}
33
- direction={{ xs: 'column', sm: 'row' }}
23
+ direction='row'
34
24
  spacing={cards.footer.gap}
25
+ // Flex gap instead of sibling margin, so wrapped lines pick up the
26
+ // vertical gap and the first child of each row has no stray left margin.
27
+ useFlexGap
35
28
  sx={{
36
- alignItems: { xs: mobileAlignItems[align], sm: 'center' },
29
+ alignItems: 'center',
37
30
  justifyContent: justifyContent[align],
38
31
  width: '100%',
39
- ...(stretchOnMobile ? { '& > *': { width: { xs: '100%', sm: 'auto' } } } : {}),
32
+ flexWrap: 'wrap',
40
33
  }}
41
34
  >
42
35
  {children}
@@ -2,11 +2,11 @@ import { ReactNode } from 'react'
2
2
 
3
3
  export type CardFooterAlign = 'start' | 'between' | 'end'
4
4
 
5
- export type RcSesCardFooterTestIds = {
5
+ export interface RcSesCardFooterTestIds {
6
6
  root?: string
7
7
  }
8
8
 
9
- export type RcSesCardFooterProps = {
9
+ export interface RcSesCardFooterProps {
10
10
  children?: ReactNode
11
11
  /**
12
12
  * Horizontal distribution of the row. `between` pushes the first and last
@@ -14,11 +14,6 @@ export type RcSesCardFooterProps = {
14
14
  * primary action; `start` is a lone link such as "Žiūrėti visas".
15
15
  */
16
16
  align?: CardFooterAlign
17
- /**
18
- * Whether direct children stretch to the full width once the row stacks.
19
- * Right for buttons, wrong for a text link, which is why it is a prop.
20
- */
21
- stretchOnMobile?: boolean
22
17
  className?: string
23
18
  testIds?: RcSesCardFooterTestIds
24
19
  }
@@ -4,14 +4,14 @@ export type CardShellVariant = 'card' | 'subcard'
4
4
 
5
5
  export type CardShellTheme = 'default' | 'brand' | 'sunken'
6
6
 
7
- export type RcSesCardShellTestIds = {
7
+ export interface RcSesCardShellTestIds {
8
8
  root?: string
9
9
  header?: string
10
10
  content?: string
11
11
  footer?: string
12
12
  }
13
13
 
14
- export type RcSesCardShellProps = {
14
+ export interface RcSesCardShellProps {
15
15
  variant?: CardShellVariant
16
16
  theme?: CardShellTheme
17
17
  fullHeight?: boolean
@@ -1,4 +1,4 @@
1
- import { Box, styled } from '@mui/material'
1
+ import { Box } from '@mui/material'
2
2
  import React, { memo, useMemo } from 'react'
3
3
 
4
4
  import IconProps from '@/assets/IconProps'
@@ -7,7 +7,7 @@ import palette from '@/theme/palette'
7
7
 
8
8
  type Shade = keyof (typeof palette)[keyof typeof palette]
9
9
 
10
- type Props = {
10
+ interface Props {
11
11
  bgShade?: Shade | 'white'
12
12
  color?: keyof typeof palette
13
13
  Icon: React.JSXElementConstructor<IconProps>
@@ -40,11 +40,6 @@ function IconWithCircularBackground(props: Props) {
40
40
  }
41
41
  }, [size])
42
42
 
43
- const StyledIcon = styled(Icon)({
44
- height: sizes[1],
45
- width: sizes[1],
46
- })
47
-
48
43
  return (
49
44
  <Box
50
45
  className='IconWithCircularBackground-root'
@@ -58,6 +53,10 @@ function IconWithCircularBackground(props: Props) {
58
53
  width: sizes[0],
59
54
  aspectRatio: '1 / 1',
60
55
 
56
+ svg: {
57
+ height: sizes[1],
58
+ width: sizes[1],
59
+ },
61
60
  'svg path': {
62
61
  fill: resolvePaletteColorPath(
63
62
  iconShade === 'white' ? 'white' : `${color}.${iconShade}`,
@@ -65,7 +64,7 @@ function IconWithCircularBackground(props: Props) {
65
64
  },
66
65
  }}
67
66
  >
68
- <StyledIcon />
67
+ <Icon />
69
68
  </Box>
70
69
  )
71
70
  }
@@ -1,4 +1,4 @@
1
- import { Box, styled } from '@mui/material'
1
+ import { Box } from '@mui/material'
2
2
  import React, { memo, useMemo } from 'react'
3
3
 
4
4
  import IconProps from '@/assets/IconProps'
@@ -9,7 +9,7 @@ import palette from '@/theme/palette'
9
9
  type SquareTileSize = 40 | 44
10
10
  type SquareTileVariant = 'solid' | 'soft' | 'muted'
11
11
 
12
- type Props = {
12
+ interface Props {
13
13
  Icon: React.JSXElementConstructor<IconProps>
14
14
  size?: SquareTileSize
15
15
  variant?: SquareTileVariant
@@ -52,11 +52,6 @@ function IconWithSquareBackground(props: Props) {
52
52
  }
53
53
  }, [variant])
54
54
 
55
- const StyledIcon = styled(Icon)({
56
- height: iconSize,
57
- width: iconSize,
58
- })
59
-
60
55
  return (
61
56
  <Box
62
57
  className='IconWithSquareBackground-root'
@@ -70,12 +65,16 @@ function IconWithSquareBackground(props: Props) {
70
65
  width: boxSize,
71
66
  aspectRatio: '1 / 1',
72
67
 
68
+ svg: {
69
+ height: iconSize,
70
+ width: iconSize,
71
+ },
73
72
  'svg path': {
74
73
  fill: resolvePaletteColorPath(iconColorPath),
75
74
  },
76
75
  }}
77
76
  >
78
- <StyledIcon />
77
+ <Icon />
79
78
  </Box>
80
79
  )
81
80
  }
@@ -7,7 +7,7 @@ export type RcSesImageCardTestIds = Pick<
7
7
  'root' | 'image' | 'header' | 'title' | 'description' | 'content'
8
8
  >
9
9
 
10
- export type RcSesImageCardProps = {
10
+ export interface RcSesImageCardProps {
11
11
  image: ReactNode
12
12
  title: ReactNode
13
13
  description?: ReactNode
@@ -55,27 +55,26 @@ const RcSesSegmentButton = React.forwardRef<HTMLButtonElement, RcSesSegmentButto
55
55
  }, [isDisabled, isSelected])
56
56
 
57
57
  const buttonStyles = useMemo(
58
- () =>
59
- ({
60
- flex: '0 1 auto',
61
- minWidth: '0',
62
- height: 'auto',
63
- wordBreak: 'break-word',
64
- fontFamily: '"Public Sans", sans-serif !important',
65
- border: `2px solid ${isFocused && !isDisabled ? primary['500'] : 'transparent'}`,
58
+ () => ({
59
+ flex: '0 1 auto',
60
+ minWidth: '0',
61
+ height: 'auto',
62
+ wordBreak: 'break-word',
63
+ fontFamily: '"Public Sans", sans-serif !important',
64
+ border: `2px solid ${isFocused && !isDisabled ? primary['500'] : 'transparent'}`,
66
65
 
67
- backgroundColor: isSelected
68
- ? `${primary['50']} !important`
69
- : 'transparent !important',
66
+ backgroundColor: isSelected
67
+ ? `${primary['50']} !important`
68
+ : 'transparent !important',
70
69
 
71
- color: textColor,
72
- cursor: isDisabled ? 'not-allowed' : 'pointer',
73
- fontWeight: 500,
74
- borderRadius: '8px',
75
- transition: 'all 150ms ease-in-out',
76
- whiteSpace: 'normal',
77
- ...sizeStyles,
78
- }) as React.CSSProperties,
70
+ color: textColor,
71
+ cursor: isDisabled ? 'not-allowed' : 'pointer',
72
+ fontWeight: 500,
73
+ borderRadius: '8px',
74
+ transition: 'all 150ms ease-in-out',
75
+ whiteSpace: 'normal',
76
+ ...sizeStyles,
77
+ }),
79
78
  [sizeStyles, isDisabled, isSelected, isFocused, textColor],
80
79
  )
81
80
 
@@ -7,7 +7,7 @@ import palette from '@/theme/palette'
7
7
 
8
8
  import { ListWithIconsItemData } from '../../ListWithIcons/ListWithIcons.types'
9
9
 
10
- type Props = {
10
+ interface Props {
11
11
  title: string
12
12
  subtitle?: string
13
13
  listItems: ListWithIconsItemData[]
@@ -5,7 +5,7 @@ import DataPagination from '../DataPagination'
5
5
  import { ListWithIconsItemData } from '../ListWithIcons/ListWithIcons.types'
6
6
  import SelectableCardListItem from './components/SelectableCardListItem'
7
7
 
8
- export type SelectableCardListItemData = {
8
+ export interface SelectableCardListItemData {
9
9
  id: string
10
10
  title: string
11
11
  subtitle?: string
@@ -1,13 +1,13 @@
1
1
  import { ElementType, ReactNode } from 'react'
2
2
 
3
- export type RcSesServiceLinksTestIds = {
3
+ export interface RcSesServiceLinksTestIds {
4
4
  root?: string
5
5
  item?: string
6
6
  itemLabel?: string
7
7
  itemIcon?: string
8
8
  }
9
9
 
10
- export type RcSesServiceLinkItem = {
10
+ export interface RcSesServiceLinkItem {
11
11
  label: ReactNode
12
12
  href?: string
13
13
  target?: string
@@ -20,7 +20,7 @@ export type RcSesServiceLinkItem = {
20
20
  key?: string
21
21
  }
22
22
 
23
- export type RcSesServiceLinksProps = {
23
+ export interface RcSesServiceLinksProps {
24
24
  items: RcSesServiceLinkItem[]
25
25
  dividers?: boolean
26
26
  isLoading?: boolean
@@ -1,24 +1,32 @@
1
1
  import { SxProps, Theme } from '@mui/material'
2
2
  import { ReactNode } from 'react'
3
3
 
4
- export type RcSesSideNavItem = {
4
+ export interface RcSesSideNavItem {
5
5
  id: string
6
6
  label: string
7
7
  count?: number
8
8
  }
9
9
 
10
- export type RcSesSideNavProps = {
10
+ // 'fit' - the nav hugs its items, however tall the list gets.
11
+ // 'scroll' - the desktop list is capped to the viewport and scrolls inside itself,
12
+ // keeping the active item reachable when there are more topics than fit.
13
+ export type RcSesSideNavOverflow = 'fit' | 'scroll'
14
+
15
+ export interface RcSesSideNavProps {
11
16
  // In document order - scroll-spy compares section positions in list order.
12
17
  items: RcSesSideNavItem[]
13
18
  activeItemId?: string
14
19
  onItemClick?: (id: string) => void
15
20
  title?: string
21
+ overflow?: RcSesSideNavOverflow
22
+ // Height of the sticky page header the nav sits below. Decides both where the
23
+ // nav sticks and, with overflow='scroll', how tall it may grow.
24
+ offset?: number
16
25
  sx?: SxProps<Theme>
17
26
  }
18
27
 
19
28
  export type RcSesSideNavLayoutProps = Omit<RcSesSideNavProps, 'sx'> & {
20
29
  children: ReactNode
21
30
  sidebarWidth?: string
22
- offset?: number
23
31
  sx?: SxProps<Theme>
24
32
  }
@@ -13,6 +13,7 @@ function RcSesSideNavLayout({
13
13
  activeItemId: controlledActiveItemId,
14
14
  onItemClick,
15
15
  title,
16
+ overflow,
16
17
  offset,
17
18
  sidebarWidth = '17rem',
18
19
  sx,
@@ -48,6 +49,8 @@ function RcSesSideNavLayout({
48
49
  activeItemId={activeItemId}
49
50
  onItemClick={handleItemClick}
50
51
  title={title}
52
+ overflow={overflow}
53
+ offset={offset}
51
54
  sx={{
52
55
  position: 'sticky',
53
56
  top: `${offset ?? 0}px`,
@@ -2,7 +2,7 @@ import { Box, Typography } from '@mui/material'
2
2
 
3
3
  import palette, { common } from '@/theme/palette'
4
4
 
5
- type Props = {
5
+ interface Props {
6
6
  label: string
7
7
  count?: number
8
8
  ariaLabel?: string
@@ -4,19 +4,20 @@ import { useCallback, useEffect, useRef, useState } from 'react'
4
4
  import palette, { common } from '@/theme/palette'
5
5
 
6
6
  import { RcSesSideNavItem } from '../SideNav.types'
7
+ import useKeepActiveItemInView from '../hooks/useKeepActiveItemInView'
7
8
  import SideNavPill from './SideNavPill'
8
9
 
9
10
  const FADE_WIDTH = '2rem'
10
11
  const SCROLL_EPSILON = 1
11
12
 
12
- type Props = {
13
+ interface Props {
13
14
  items: RcSesSideNavItem[]
14
15
  activeItemId?: string
15
16
  onItemClick?: (id: string) => void
16
17
  getItemAriaLabel: (item: RcSesSideNavItem) => string | undefined
17
18
  }
18
19
 
19
- type ScrollState = {
20
+ interface ScrollState {
20
21
  hasOverflow: boolean
21
22
  showRightFade: boolean
22
23
  thumbWidth: number
@@ -89,27 +90,11 @@ function SideNavPillList({ items, activeItemId, onItemClick, getItemAriaLabel }:
89
90
  }
90
91
  }, [items, updateScrollState])
91
92
 
92
- useEffect(() => {
93
- if (!activeItemId) return
94
- const container = scrollRef.current
95
- const target = container?.querySelector<HTMLElement>(
96
- `[data-item-id="${activeItemId}"]`,
97
- )
98
- if (!container || !target) return
99
-
100
- // Viewport rects on both, so they agree: offsetLeft would be relative to the
101
- // positioned wrapper, not the scroll container.
102
- const containerRect = container.getBoundingClientRect()
103
- const targetRect = target.getBoundingClientRect()
104
- const overflowLeft = containerRect.left - targetRect.left
105
- const overflowRight = targetRect.right - containerRect.right
106
-
107
- if (overflowLeft > 0) {
108
- container.scrollLeft -= overflowLeft
109
- } else if (overflowRight > 0) {
110
- container.scrollLeft += overflowRight
111
- }
112
- }, [activeItemId])
93
+ useKeepActiveItemInView({
94
+ containerRef: scrollRef,
95
+ activeItemId,
96
+ axis: 'horizontal',
97
+ })
113
98
 
114
99
  return (
115
100
  <Box>
@@ -4,7 +4,8 @@ import palette from '@/theme/palette'
4
4
 
5
5
  const BORDER_WIDTH = '0.125rem'
6
6
 
7
- type Props = {
7
+ interface Props {
8
+ itemId: string
8
9
  label: string
9
10
  count?: number
10
11
  ariaLabel?: string
@@ -12,12 +13,13 @@ type Props = {
12
13
  onClick?: () => void
13
14
  }
14
15
 
15
- function SideNavRow({ label, count, ariaLabel, active, onClick }: Props) {
16
+ function SideNavRow({ itemId, label, count, ariaLabel, active, onClick }: Props) {
16
17
  return (
17
18
  <Box
18
19
  component={onClick ? 'button' : 'div'}
19
20
  type={onClick ? 'button' : undefined}
20
21
  onClick={onClick}
22
+ data-item-id={itemId}
21
23
  aria-current={active ? 'page' : undefined}
22
24
  aria-label={ariaLabel}
23
25
  sx={{
@@ -32,6 +34,8 @@ function SideNavRow({ label, count, ariaLabel, active, onClick }: Props) {
32
34
  backgroundColor: active ? palette.primary[50] : 'transparent',
33
35
  padding: '0.75rem 1rem',
34
36
  textAlign: 'left',
37
+ // A scrolling list (overflow='scroll') must not shrink its rows to fit.
38
+ flexShrink: 0,
35
39
  cursor: onClick ? 'pointer' : 'default',
36
40
  '&:hover': onClick && !active ? { backgroundColor: palette.grey[50] } : undefined,
37
41
  '&:focus-visible': {