@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.
- 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 +7 -5
- 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/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 +1631 -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 +11 -3
- package/src/components/common/SideNav/SideNavLayout.tsx +3 -0
- 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/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 +47 -12
- 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 +36 -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.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",
|
|
@@ -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,32 @@
|
|
|
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
|
|
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`,
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
-
|
|
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': {
|