@registrucentras/rc-ses-react-components 2.0.0-rc.7 → 2.0.0-rc.9
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.
- package/dist/components/common/Accordion/hooks/useAccordionController.d.ts +2 -2
- package/dist/components/common/Accordion/types/AccordionControllerState.d.ts +2 -2
- package/dist/components/common/AdvancedList/components/AdvancedListItem/AdvancedListItem.types.d.ts +2 -2
- package/dist/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemLeading.d.ts +2 -2
- package/dist/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemTrailing.d.ts +2 -2
- package/dist/components/common/Badge/index.d.ts +2 -2
- package/dist/components/common/Breadcrumbs/index.d.ts +4 -4
- package/dist/components/common/Card/index.d.ts +2 -2
- package/dist/components/common/CardShell/CardFooter/index.d.ts +1 -1
- package/dist/components/common/CardShell/CardFooter/types.d.ts +4 -9
- package/dist/components/common/CardShell/types.d.ts +4 -4
- package/dist/components/common/IconWithCircularBackground.d.ts +2 -2
- package/dist/components/common/IconWithSquareBackground/index.d.ts +2 -2
- package/dist/components/common/ImageCard/index.d.ts +2 -2
- package/dist/components/common/SelectableCardList/components/SelectableCardListItem.d.ts +2 -2
- package/dist/components/common/SelectableCardList/index.d.ts +2 -2
- package/dist/components/common/ServiceLinks/types.d.ts +6 -6
- package/dist/components/common/SideNav/SideNav.types.d.ts +9 -6
- package/dist/components/common/SideNav/SideNavLayout.d.ts +1 -1
- package/dist/components/common/SideNav/components/SideNavPill.d.ts +2 -2
- package/dist/components/common/SideNav/components/SideNavPillList.d.ts +2 -2
- package/dist/components/common/SideNav/components/SideNavRow.d.ts +4 -3
- package/dist/components/common/SideNav/hooks/useElementHeight.d.ts +11 -0
- package/dist/components/common/SideNav/hooks/useKeepActiveItemInView.d.ts +19 -0
- package/dist/components/common/SideNav/hooks/useSideNavScrollSpy.d.ts +2 -2
- package/dist/components/common/SideNav/index.d.ts +2 -2
- package/dist/components/common/Tabs/TabPanel.d.ts +2 -2
- package/dist/components/common/Tabs/TabsWrapper.d.ts +2 -2
- package/dist/components/common/TitleBlock/types.d.ts +4 -4
- package/dist/components/form/components/FormControlWrapper/components/FieldSuffix.d.ts +2 -2
- package/dist/components/form/components/FormControlWrapper/index.d.ts +2 -2
- package/dist/components/form/inputs/RadioButtonGroup.d.ts +3 -3
- package/dist/components/form/inputs/SearchableField.d.ts +2 -2
- package/dist/components/form/inputs/Select/Select.types.d.ts +2 -2
- package/dist/components/layout/Footer/index.d.ts +2 -2
- package/dist/components/layout/ServiceFormActions.d.ts +2 -2
- package/dist/components/layout/ServiceFormContainer/AccordionFormContainer/components/AccordionCollapseControls.d.ts +2 -2
- package/dist/components/layout/ServiceFormContainer/AccordionFormContainer/index.d.ts +2 -2
- package/dist/components/layout/ServiceHeader.d.ts +2 -2
- package/dist/components/layout/ServicePage.d.ts +2 -2
- package/dist/components/utils/normalizeSx.d.ts +1 -1
- package/dist/library/types.d.ts +2 -2
- package/dist/registrucentras-rc-ses-react-components.cjs +1 -1
- package/dist/registrucentras-rc-ses-react-components.js +1660 -1589
- package/dist/types/assets/IconProps.d.ts +2 -2
- package/dist/types/cards/CardServiceProps.d.ts +2 -2
- package/dist/types/common/QuickLinkType.d.ts +2 -2
- package/dist/types/inputs/InputIconProps.d.ts +2 -2
- package/dist/types/lists/ListNewsItemType.d.ts +2 -2
- package/dist/types/lists/ListServicesItemType.d.ts +3 -3
- package/package.json +2 -1
- package/src/components/common/Accordion/hooks/useAccordionController.tsx +1 -1
- package/src/components/common/Accordion/index.tsx +1 -4
- package/src/components/common/Accordion/types/AccordionControllerState.ts +1 -1
- package/src/components/common/AdvancedList/components/AdvancedListItem/AdvancedListItem.types.ts +1 -1
- package/src/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemLeading.tsx +1 -1
- package/src/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemTrailing.tsx +1 -1
- package/src/components/common/AdvancedList/components/AdvancedListItem/index.test.tsx +2 -2
- package/src/components/common/Badge/index.tsx +3 -3
- package/src/components/common/Breadcrumbs/index.tsx +5 -2
- package/src/components/common/Card/index.tsx +1 -1
- package/src/components/common/CardShell/CardFooter/index.tsx +6 -13
- package/src/components/common/CardShell/CardFooter/types.ts +2 -7
- package/src/components/common/CardShell/types.ts +2 -2
- package/src/components/common/IconWithCircularBackground.tsx +7 -8
- package/src/components/common/IconWithSquareBackground/index.tsx +7 -8
- package/src/components/common/ImageCard/index.tsx +1 -1
- package/src/components/common/SegmentedControl/components/SegmentButton/index.tsx +18 -19
- package/src/components/common/SelectableCardList/components/SelectableCardListItem.tsx +1 -1
- package/src/components/common/SelectableCardList/index.tsx +1 -1
- package/src/components/common/ServiceLinks/types.ts +3 -3
- package/src/components/common/SideNav/SideNav.types.ts +22 -4
- package/src/components/common/SideNav/SideNavLayout.test.tsx +52 -0
- package/src/components/common/SideNav/SideNavLayout.tsx +23 -3
- package/src/components/common/SideNav/components/SideNavPill.tsx +1 -1
- package/src/components/common/SideNav/components/SideNavPillList.tsx +8 -23
- package/src/components/common/SideNav/components/SideNavRow.tsx +6 -2
- package/src/components/common/SideNav/hooks/useElementHeight.test.ts +135 -0
- package/src/components/common/SideNav/hooks/useElementHeight.ts +46 -0
- package/src/components/common/SideNav/hooks/useKeepActiveItemInView.test.ts +258 -0
- package/src/components/common/SideNav/hooks/useKeepActiveItemInView.ts +80 -0
- package/src/components/common/SideNav/hooks/useSideNavScrollSpy.test.ts +9 -2
- package/src/components/common/SideNav/hooks/useSideNavScrollSpy.ts +4 -3
- package/src/components/common/SideNav/index.test.tsx +51 -0
- package/src/components/common/SideNav/index.tsx +58 -13
- package/src/components/common/Snackbar/index.test.tsx +40 -0
- package/src/components/common/Snackbar/index.tsx +9 -3
- package/src/components/common/Tabs/TabPanel.tsx +1 -1
- package/src/components/common/Tabs/TabsWrapper.tsx +1 -1
- package/src/components/common/TitleBlock/index.test.tsx +9 -7
- package/src/components/common/TitleBlock/index.tsx +13 -9
- package/src/components/common/TitleBlock/types.ts +2 -2
- package/src/components/form/components/FormControlWrapper/components/FieldSuffix.tsx +1 -1
- package/src/components/form/components/FormControlWrapper/index.tsx +1 -1
- package/src/components/form/inputs/Datepicker/index.test.tsx +1 -1
- package/src/components/form/inputs/FileDropzone.tsx +1 -4
- package/src/components/form/inputs/NumberStepper.test.tsx +83 -0
- package/src/components/form/inputs/NumberStepper.tsx +7 -8
- package/src/components/form/inputs/RadioButtonGroup.test.tsx +1 -1
- package/src/components/form/inputs/RadioButtonGroup.tsx +2 -2
- package/src/components/form/inputs/SearchInput/index.tsx +1 -1
- package/src/components/form/inputs/SearchableField.test.tsx +2 -2
- package/src/components/form/inputs/SearchableField.tsx +1 -1
- package/src/components/form/inputs/Select/Select.types.ts +1 -1
- package/src/components/form/inputs/Select/index.test.tsx +3 -3
- package/src/components/layout/Footer/index.tsx +1 -1
- package/src/components/layout/ServiceFormActions.tsx +1 -1
- package/src/components/layout/ServiceFormContainer/AccordionFormContainer/components/AccordionCollapseControls.tsx +1 -1
- package/src/components/layout/ServiceFormContainer/AccordionFormContainer/index.tsx +1 -1
- package/src/components/layout/ServiceHeader.tsx +1 -1
- package/src/components/layout/ServicePage.tsx +1 -1
- package/src/components/utils/normalizeSx.ts +2 -4
- package/src/examples/ListWithPagination/index.tsx +0 -2
- package/src/examples/MultipleStepForm/components/AdditionalServicesForm.tsx +1 -1
- package/src/examples/MultipleStepForm/components/ServiceIssuanceForm.tsx +1 -1
- package/src/examples/MultipleStepForm/components/TermsAndConditionsForm.tsx +1 -1
- package/src/examples/MultipleStepForm/types/MultiStepFormModel.ts +1 -1
- package/src/examples/SingleStepForm/components/ObjectIdentifierSearchModal.tsx +2 -2
- package/src/examples/SingleStepForm/types/SingleStepFormModel.ts +1 -1
- package/src/library/types.ts +2 -1
- package/src/stories/atoms/Button.stories.tsx +9 -14
- package/src/stories/atoms/Checkbox.stories.tsx +1 -1
- package/src/stories/atoms/Icons.stories.tsx +1 -1
- package/src/stories/atoms/NumberStepper.stories.tsx +1 -1
- package/src/stories/atoms/PhoneInput.stories.tsx +1 -1
- package/src/stories/atoms/Select.stories.tsx +7 -9
- package/src/stories/atoms/Switch.stories.tsx +1 -1
- package/src/stories/molecules/Alert.stories.tsx +2 -2
- package/src/stories/molecules/CardShell.stories.tsx +4 -4
- package/src/stories/molecules/CheckboxFormControl.stories.tsx +13 -21
- package/src/stories/molecules/RadioButtonGroup.stories.tsx +1 -1
- package/src/stories/molecules/Snackbar.stories.tsx +2 -2
- package/src/stories/molecules/TitleBlock.stories.tsx +40 -1
- package/src/stories/organisms/AdvancedList.stories.tsx +4 -4
- package/src/stories/organisms/FileDropzone.stories.tsx +1 -1
- package/src/stories/organisms/FileUpload.stories.tsx +1 -1
- package/src/stories/organisms/SideNav.stories.tsx +41 -3
- package/src/stubs/Component.tsx +4 -4
- package/src/types/assets/IconProps.tsx +1 -1
- package/src/types/cards/CardServiceProps.tsx +1 -1
- package/src/types/common/QuickLinkType.tsx +1 -1
- package/src/types/inputs/InputIconProps.tsx +1 -1
- package/src/types/lists/ListNewsItemType.tsx +1 -1
- package/src/types/lists/ListServicesItemType.tsx +2 -2
- package/src/vite-env.d.ts +2 -2
- package/dist/stories/atoms/Badge.stories.d.ts +0 -9
- package/dist/stories/atoms/Button.stories.d.ts +0 -107
- package/dist/stories/atoms/Checkbox.stories.d.ts +0 -21
- package/dist/stories/atoms/IconWithCircularBackground.stories.d.ts +0 -6
- package/dist/stories/atoms/IconWithSquareBackground.stories.d.ts +0 -7
- package/dist/stories/atoms/Icons.stories.d.ts +0 -7
- package/dist/stories/atoms/Loader.stories.d.ts +0 -36
- package/dist/stories/atoms/LoadingSpinner.stories.d.ts +0 -62
- package/dist/stories/atoms/Logo.stories.d.ts +0 -12
- package/dist/stories/atoms/NumberStepper.stories.d.ts +0 -6
- package/dist/stories/atoms/PhoneInput.stories.d.ts +0 -10
- package/dist/stories/atoms/SearchInput.stories.d.ts +0 -11
- package/dist/stories/atoms/Select.stories.d.ts +0 -7
- package/dist/stories/atoms/SimpleCheckbox.stories.d.ts +0 -19
- package/dist/stories/atoms/Switch.stories.d.ts +0 -17
- package/dist/stories/atoms/Tab.stories.d.ts +0 -8
- package/dist/stories/atoms/TextField.stories.d.ts +0 -6
- package/dist/stories/atoms/Tooltip.stories.d.ts +0 -48
- package/dist/stories/foundations/ThemedMuiComponents.stories.d.ts +0 -25
- package/dist/stories/molecules/Alert.stories.d.ts +0 -14
- package/dist/stories/molecules/Breadcrumbs.stories.d.ts +0 -6
- package/dist/stories/molecules/ButtonWithPopover.stories.d.ts +0 -7
- package/dist/stories/molecules/Card.stories.d.ts +0 -8
- package/dist/stories/molecules/CardShell.stories.d.ts +0 -18
- package/dist/stories/molecules/CheckboxFormControl.stories.d.ts +0 -9
- package/dist/stories/molecules/DatePicker.stories.d.ts +0 -152
- package/dist/stories/molecules/FormControlWrapper.stories.d.ts +0 -7
- package/dist/stories/molecules/ImageCard.stories.d.ts +0 -8
- package/dist/stories/molecules/ListWithIcons.stories.d.ts +0 -34
- package/dist/stories/molecules/PhoneInputFormControl.stories.d.ts +0 -6
- package/dist/stories/molecules/Popover.stories.d.ts +0 -12
- package/dist/stories/molecules/RadioButtonGroup.stories.d.ts +0 -6
- package/dist/stories/molecules/SearchableField.stories.d.ts +0 -6
- package/dist/stories/molecules/SegmentedControl.stories.d.ts +0 -202
- package/dist/stories/molecules/Snackbar.stories.d.ts +0 -143
- package/dist/stories/molecules/TabPanel.stories.d.ts +0 -7
- package/dist/stories/molecules/Tabs.stories.d.ts +0 -7
- package/dist/stories/molecules/TabsWrapper.stories.d.ts +0 -6
- package/dist/stories/molecules/TitleBlock.stories.d.ts +0 -22
- package/dist/stories/organisms/Accordion.stories.d.ts +0 -18
- package/dist/stories/organisms/AdvancedList.stories.d.ts +0 -33
- package/dist/stories/organisms/AdvancedListItem.stories.d.ts +0 -33
- package/dist/stories/organisms/CardFormContainer.stories.d.ts +0 -7
- package/dist/stories/organisms/DataPagination.stories.d.ts +0 -47
- package/dist/stories/organisms/Dialog.stories.d.ts +0 -15
- package/dist/stories/organisms/FileDropzone.stories.d.ts +0 -6
- package/dist/stories/organisms/FileUpload.stories.d.ts +0 -18
- package/dist/stories/organisms/Footer.stories.d.ts +0 -6
- package/dist/stories/organisms/FullPageLoader.stories.d.ts +0 -37
- package/dist/stories/organisms/Modal.stories.d.ts +0 -10
- package/dist/stories/organisms/SelectableCardList.stories.d.ts +0 -37
- package/dist/stories/organisms/ServiceFormActions.stories.d.ts +0 -6
- package/dist/stories/organisms/ServiceFormContainer.stories.d.ts +0 -15
- package/dist/stories/organisms/ServiceHeader.stories.d.ts +0 -7
- package/dist/stories/organisms/ServiceLinks.stories.d.ts +0 -28
- package/dist/stories/organisms/ServiceWizardStepper.stories.d.ts +0 -7
- package/dist/stories/organisms/SideNav.stories.d.ts +0 -7
- package/dist/stories/templates/ServicePage.stories.d.ts +0 -6
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ColorType } from '../common/ColorType';
|
|
2
|
-
|
|
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;
|
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.
|
|
4
|
+
"version": "2.0.0-rc.9",
|
|
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",
|
|
@@ -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)
|
package/src/components/common/AdvancedList/components/AdvancedListItem/AdvancedListItem.types.ts
CHANGED
|
@@ -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
|
|
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
|
-
|
|
13
|
+
interface Props {
|
|
14
14
|
leading: AdvancedListItemLeadingData
|
|
15
15
|
disabled?: boolean
|
|
16
16
|
inputRef?: RefObject<HTMLInputElement>
|
|
@@ -496,7 +496,7 @@ describe('AdvancedListItem', () => {
|
|
|
496
496
|
|
|
497
497
|
renderItem(<Wrapper />)
|
|
498
498
|
|
|
499
|
-
const input = screen.getByLabelText('Company name')
|
|
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')
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
3
|
+
export interface BreadcrumbItem {
|
|
4
|
+
label: string
|
|
5
|
+
path: string
|
|
6
|
+
}
|
|
4
7
|
|
|
5
|
-
|
|
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
|
|
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=
|
|
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:
|
|
29
|
+
alignItems: 'center',
|
|
37
30
|
justifyContent: justifyContent[align],
|
|
38
31
|
width: '100%',
|
|
39
|
-
|
|
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
|
|
5
|
+
export interface RcSesCardFooterTestIds {
|
|
6
6
|
root?: string
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export
|
|
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
|
|
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
|
|
14
|
+
export interface RcSesCardShellProps {
|
|
15
15
|
variant?: CardShellVariant
|
|
16
16
|
theme?: CardShellTheme
|
|
17
17
|
fullHeight?: boolean
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Box
|
|
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
|
-
|
|
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
|
-
<
|
|
67
|
+
<Icon />
|
|
69
68
|
</Box>
|
|
70
69
|
)
|
|
71
70
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Box
|
|
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
|
-
|
|
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
|
-
<
|
|
77
|
+
<Icon />
|
|
79
78
|
</Box>
|
|
80
79
|
)
|
|
81
80
|
}
|
|
@@ -55,27 +55,26 @@ const RcSesSegmentButton = React.forwardRef<HTMLButtonElement, RcSesSegmentButto
|
|
|
55
55
|
}, [isDisabled, isSelected])
|
|
56
56
|
|
|
57
57
|
const buttonStyles = useMemo(
|
|
58
|
-
() =>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
backgroundColor: isSelected
|
|
67
|
+
? `${primary['50']} !important`
|
|
68
|
+
: 'transparent !important',
|
|
70
69
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
23
|
+
export interface RcSesServiceLinksProps {
|
|
24
24
|
items: RcSesServiceLinkItem[]
|
|
25
25
|
dividers?: boolean
|
|
26
26
|
isLoading?: boolean
|
|
@@ -1,24 +1,42 @@
|
|
|
1
1
|
import { SxProps, Theme } from '@mui/material'
|
|
2
2
|
import { ReactNode } from 'react'
|
|
3
3
|
|
|
4
|
-
export
|
|
4
|
+
export interface RcSesSideNavItem {
|
|
5
5
|
id: string
|
|
6
6
|
label: string
|
|
7
7
|
count?: number
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
|
|
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
|
|
25
|
+
// Reports the height of the mobile bar, which is sticky and overlays the
|
|
26
|
+
// scrolling content - 0 on the desktop layout, where the nav overlays nothing.
|
|
27
|
+
// Anything that scrolls the page to a section has to clear it on top of
|
|
28
|
+
// `offset`; RcSesSideNavLayout does that for its own children.
|
|
29
|
+
onOverlayHeightChange?: (height: number) => void
|
|
16
30
|
sx?: SxProps<Theme>
|
|
17
31
|
}
|
|
18
32
|
|
|
19
|
-
|
|
33
|
+
// The layout measures the mobile bar for its own children, so the callback is
|
|
34
|
+
// not part of its surface.
|
|
35
|
+
export type RcSesSideNavLayoutProps = Omit<
|
|
36
|
+
RcSesSideNavProps,
|
|
37
|
+
'sx' | 'onOverlayHeightChange'
|
|
38
|
+
> & {
|
|
20
39
|
children: ReactNode
|
|
21
40
|
sidebarWidth?: string
|
|
22
|
-
offset?: number
|
|
23
41
|
sx?: SxProps<Theme>
|
|
24
42
|
}
|
|
@@ -15,6 +15,10 @@ function ResizeObserverMock() {
|
|
|
15
15
|
|
|
16
16
|
Element.prototype.scrollIntoView = vi.fn()
|
|
17
17
|
|
|
18
|
+
const HEADER_OFFSET = 56
|
|
19
|
+
const MOBILE_BAR_HEIGHT = 62
|
|
20
|
+
const SECTION_TOP = 500
|
|
21
|
+
|
|
18
22
|
const items: RcSesSideNavItem[] = [
|
|
19
23
|
{ id: 'family', label: 'Aš ir mano šeima', count: 4 },
|
|
20
24
|
{ id: 'documents', label: 'Dokumentai apie gyventoją', count: 2 },
|
|
@@ -31,6 +35,7 @@ describe('RcSesSideNavLayout', () => {
|
|
|
31
35
|
|
|
32
36
|
afterEach(() => {
|
|
33
37
|
vi.unstubAllGlobals()
|
|
38
|
+
vi.restoreAllMocks()
|
|
34
39
|
})
|
|
35
40
|
|
|
36
41
|
it('renders the nav alongside its content children', () => {
|
|
@@ -84,6 +89,53 @@ describe('RcSesSideNavLayout', () => {
|
|
|
84
89
|
)
|
|
85
90
|
})
|
|
86
91
|
|
|
92
|
+
// The mobile bar is sticky on top of the content: land a section at the page
|
|
93
|
+
// header's height alone and the bar covers its heading, so the first thing the
|
|
94
|
+
// reader sees is the section's first row.
|
|
95
|
+
it('clears the mobile bar as well as the page header when scrolling to an item', () => {
|
|
96
|
+
const scrollToMock = vi.fn()
|
|
97
|
+
vi.stubGlobal('scrollTo', scrollToMock)
|
|
98
|
+
vi.stubGlobal(
|
|
99
|
+
'matchMedia',
|
|
100
|
+
vi.fn(() => ({ matches: false })),
|
|
101
|
+
)
|
|
102
|
+
vi.spyOn(HTMLElement.prototype, 'getBoundingClientRect').mockImplementation(
|
|
103
|
+
() => ({ top: SECTION_TOP, height: MOBILE_BAR_HEIGHT }) as DOMRect,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
renderLayout(
|
|
107
|
+
<RcSesSideNavLayout items={items} title='Temos' offset={HEADER_OFFSET}>
|
|
108
|
+
<div id='family' />
|
|
109
|
+
<div id='documents' />
|
|
110
|
+
</RcSesSideNavLayout>,
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
act(() => {
|
|
114
|
+
screen.getAllByRole('button', { name: 'Dokumentai apie gyventoją, 2' })[0].click()
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
expect(scrollToMock).toHaveBeenCalledWith(
|
|
118
|
+
expect.objectContaining({ top: SECTION_TOP - HEADER_OFFSET - MOBILE_BAR_HEIGHT }),
|
|
119
|
+
)
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
it('publishes that same offset for the sections to scroll-margin by', () => {
|
|
123
|
+
vi.spyOn(HTMLElement.prototype, 'getBoundingClientRect').mockImplementation(
|
|
124
|
+
() => ({ top: SECTION_TOP, height: MOBILE_BAR_HEIGHT }) as DOMRect,
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
const { container } = renderLayout(
|
|
128
|
+
<RcSesSideNavLayout items={items} title='Temos' offset={HEADER_OFFSET}>
|
|
129
|
+
<div id='family' />
|
|
130
|
+
</RcSesSideNavLayout>,
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
const content = container.querySelector<HTMLElement>('[style*="scroll-offset"]')
|
|
134
|
+
expect(content?.style.getPropertyValue('--rc-ses-sidenav-scroll-offset')).toBe(
|
|
135
|
+
`${HEADER_OFFSET + MOBILE_BAR_HEIGHT}px`,
|
|
136
|
+
)
|
|
137
|
+
})
|
|
138
|
+
|
|
87
139
|
it('does not throw when clicked with no matching section in the content', () => {
|
|
88
140
|
renderLayout(
|
|
89
141
|
<RcSesSideNavLayout items={items} title='Temos'>
|