@registrucentras/rc-ses-react-components 2.0.0-rc.6 → 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 +1767 -1672
- package/dist/theme/cards.d.ts +4 -0
- 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 +5 -3
- package/src/components/common/CardShell/CardFooter/types.ts +2 -7
- package/src/components/common/CardShell/index.tsx +31 -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 +34 -11
- 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/Welcome.mdx +25 -2
- package/src/stories/{components/display → atoms}/Badge.stories.tsx +1 -1
- package/src/stories/{components/actions → atoms}/Button.stories.tsx +10 -15
- package/src/stories/{components/inputs → atoms}/Checkbox.stories.tsx +2 -2
- package/src/stories/{components/icons → atoms}/IconWithCircularBackground.stories.tsx +1 -1
- package/src/stories/{components/icons → atoms}/IconWithSquareBackground.stories.tsx +1 -1
- package/src/stories/{components/icons → atoms}/Icons.stories.tsx +2 -2
- package/src/stories/{components/loaders → atoms}/Loader.stories.tsx +1 -1
- package/src/stories/{components/loaders → atoms}/LoadingSpinner.stories.tsx +1 -1
- package/src/stories/{assets → atoms}/Logo.stories.tsx +1 -1
- package/src/stories/{components/inputs → atoms}/NumberStepper.stories.tsx +2 -2
- package/src/stories/{components/inputs → atoms}/PhoneInput.stories.tsx +2 -2
- package/src/stories/{components/inputs → atoms}/SearchInput.stories.tsx +1 -1
- package/src/stories/{components/inputs → atoms}/Select.stories.tsx +8 -10
- package/src/stories/{components/form → atoms}/SimpleCheckbox.stories.tsx +1 -1
- package/src/stories/{components/inputs → atoms}/Switch.stories.tsx +2 -2
- package/src/stories/{components/tabs → atoms}/Tab.stories.tsx +1 -1
- package/src/stories/{components/inputs → atoms}/TextField.stories.tsx +1 -1
- package/src/stories/{components/display → atoms}/Tooltip.stories.tsx +2 -2
- package/src/stories/{theme → foundations}/ThemedMuiComponents.stories.tsx +1 -1
- package/src/stories/{components/feedback → molecules}/Alert.stories.tsx +3 -3
- package/src/stories/{components/navigation → molecules}/Breadcrumbs.stories.tsx +1 -1
- package/src/stories/{components/actions → molecules}/ButtonWithPopover.stories.tsx +1 -1
- package/src/stories/{components/display → molecules}/Card.stories.tsx +1 -1
- package/src/stories/{components/display → molecules}/CardShell.stories.tsx +20 -1
- package/src/stories/{components/form → molecules}/CheckboxFormControl.stories.tsx +14 -22
- package/src/stories/{components/inputs → molecules}/DatePicker.stories.tsx +1 -1
- package/src/stories/{components/form → molecules}/FormControlWrapper.stories.tsx +1 -1
- package/src/stories/{components/display → molecules}/ImageCard.stories.tsx +1 -1
- package/src/stories/{components/display → molecules}/ListWithIcons.stories.tsx +1 -1
- package/src/stories/{components/inputs → molecules}/PhoneInputFormControl.stories.tsx +1 -1
- package/src/stories/{components/overlays → molecules}/Popover.stories.tsx +1 -1
- package/src/stories/{components/inputs → molecules}/RadioButtonGroup.stories.tsx +2 -2
- package/src/stories/{components/inputs → molecules}/SearchableField.stories.tsx +1 -1
- package/src/stories/{components/display → molecules}/SegmentedControl.stories.tsx +2 -2
- package/src/stories/{components/feedback → molecules}/Snackbar.stories.tsx +3 -3
- package/src/stories/{components/tabs → molecules}/TabPanel.stories.tsx +1 -1
- package/src/stories/{components/tabs → molecules}/Tabs.stories.tsx +1 -1
- package/src/stories/{components/tabs → molecules}/TabsWrapper.stories.tsx +1 -1
- package/src/stories/{components/display → molecules}/TitleBlock.stories.tsx +65 -3
- package/src/stories/{components/navigation → organisms}/Accordion.stories.tsx +1 -1
- package/src/stories/{components/display → organisms}/AdvancedList.stories.tsx +5 -5
- package/src/stories/{components/display → organisms}/AdvancedListItem.stories.tsx +1 -1
- package/src/stories/{components/form → organisms}/CardFormContainer.stories.tsx +1 -1
- package/src/stories/{components/navigation → organisms}/DataPagination.stories.tsx +1 -1
- package/src/stories/{components/overlays → organisms}/Dialog.stories.tsx +1 -1
- package/src/stories/{components/inputs → organisms}/FileDropzone.stories.tsx +2 -2
- package/src/stories/{components/inputs → organisms}/FileUpload.stories.tsx +2 -2
- package/src/stories/{components/layout → organisms}/Footer.stories.tsx +1 -1
- package/src/stories/{components/loaders → organisms}/FullPageLoader.stories.tsx +1 -1
- package/src/stories/{components/overlays → organisms}/Modal.stories.tsx +1 -1
- package/src/stories/{components/display → organisms}/SelectableCardList.stories.tsx +1 -1
- package/src/stories/{components/form → organisms}/ServiceFormActions.stories.tsx +1 -1
- package/src/stories/{components/form → organisms}/ServiceFormContainer.stories.tsx +1 -1
- package/src/stories/{components/layout → organisms}/ServiceHeader.stories.tsx +1 -1
- package/src/stories/{components/display → organisms}/ServiceLinks.stories.tsx +1 -1
- package/src/stories/{components/navigation → organisms}/ServiceWizardStepper.stories.tsx +3 -3
- package/src/stories/{components/navigation → organisms}/SideNav.stories.tsx +37 -4
- package/src/stories/{components/layout → templates}/ServicePage.stories.tsx +1 -1
- package/src/stubs/Component.tsx +4 -4
- package/src/theme/cards.ts +2 -0
- 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/assets/Logo.stories.d.ts +0 -12
- package/dist/stories/components/actions/Button.stories.d.ts +0 -107
- package/dist/stories/components/actions/ButtonWithPopover.stories.d.ts +0 -7
- package/dist/stories/components/display/AdvancedList.stories.d.ts +0 -33
- package/dist/stories/components/display/AdvancedListItem.stories.d.ts +0 -33
- package/dist/stories/components/display/Badge.stories.d.ts +0 -9
- package/dist/stories/components/display/Card.stories.d.ts +0 -8
- package/dist/stories/components/display/CardShell.stories.d.ts +0 -17
- package/dist/stories/components/display/ImageCard.stories.d.ts +0 -8
- package/dist/stories/components/display/ListWithIcons.stories.d.ts +0 -34
- package/dist/stories/components/display/SegmentedControl.stories.d.ts +0 -202
- package/dist/stories/components/display/SelectableCardList.stories.d.ts +0 -37
- package/dist/stories/components/display/ServiceLinks.stories.d.ts +0 -28
- package/dist/stories/components/display/TitleBlock.stories.d.ts +0 -21
- package/dist/stories/components/display/Tooltip.stories.d.ts +0 -48
- package/dist/stories/components/feedback/Alert.stories.d.ts +0 -14
- package/dist/stories/components/feedback/Snackbar.stories.d.ts +0 -143
- package/dist/stories/components/form/CardFormContainer.stories.d.ts +0 -7
- package/dist/stories/components/form/CheckboxFormControl.stories.d.ts +0 -9
- package/dist/stories/components/form/FormControlWrapper.stories.d.ts +0 -7
- package/dist/stories/components/form/ServiceFormActions.stories.d.ts +0 -6
- package/dist/stories/components/form/ServiceFormContainer.stories.d.ts +0 -15
- package/dist/stories/components/form/SimpleCheckbox.stories.d.ts +0 -19
- package/dist/stories/components/icons/IconWithCircularBackground.stories.d.ts +0 -6
- package/dist/stories/components/icons/IconWithSquareBackground.stories.d.ts +0 -7
- package/dist/stories/components/icons/Icons.stories.d.ts +0 -7
- package/dist/stories/components/inputs/Checkbox.stories.d.ts +0 -21
- package/dist/stories/components/inputs/DatePicker.stories.d.ts +0 -152
- package/dist/stories/components/inputs/FileDropzone.stories.d.ts +0 -6
- package/dist/stories/components/inputs/FileUpload.stories.d.ts +0 -18
- package/dist/stories/components/inputs/NumberStepper.stories.d.ts +0 -6
- package/dist/stories/components/inputs/PhoneInput.stories.d.ts +0 -10
- package/dist/stories/components/inputs/PhoneInputFormControl.stories.d.ts +0 -6
- package/dist/stories/components/inputs/RadioButtonGroup.stories.d.ts +0 -6
- package/dist/stories/components/inputs/SearchInput.stories.d.ts +0 -11
- package/dist/stories/components/inputs/SearchableField.stories.d.ts +0 -6
- package/dist/stories/components/inputs/Select.stories.d.ts +0 -7
- package/dist/stories/components/inputs/Switch.stories.d.ts +0 -17
- package/dist/stories/components/inputs/TextField.stories.d.ts +0 -6
- package/dist/stories/components/layout/Footer.stories.d.ts +0 -6
- package/dist/stories/components/layout/ServiceHeader.stories.d.ts +0 -7
- package/dist/stories/components/layout/ServicePage.stories.d.ts +0 -6
- package/dist/stories/components/loaders/FullPageLoader.stories.d.ts +0 -37
- package/dist/stories/components/loaders/Loader.stories.d.ts +0 -36
- package/dist/stories/components/loaders/LoadingSpinner.stories.d.ts +0 -62
- package/dist/stories/components/navigation/Accordion.stories.d.ts +0 -18
- package/dist/stories/components/navigation/Breadcrumbs.stories.d.ts +0 -6
- package/dist/stories/components/navigation/DataPagination.stories.d.ts +0 -47
- package/dist/stories/components/navigation/ServiceWizardStepper.stories.d.ts +0 -7
- package/dist/stories/components/navigation/SideNav.stories.d.ts +0 -7
- package/dist/stories/components/overlays/Dialog.stories.d.ts +0 -15
- package/dist/stories/components/overlays/Modal.stories.d.ts +0 -10
- package/dist/stories/components/overlays/Popover.stories.d.ts +0 -12
- package/dist/stories/components/tabs/Tab.stories.d.ts +0 -8
- package/dist/stories/components/tabs/TabPanel.stories.d.ts +0 -7
- package/dist/stories/components/tabs/Tabs.stories.d.ts +0 -7
- package/dist/stories/components/tabs/TabsWrapper.stories.d.ts +0 -6
- package/dist/stories/theme/ThemedMuiComponents.stories.d.ts +0 -25
- package/src/stories/components/display/Card.test.tsx +0 -19
- /package/src/stories/{components/actions → atoms}/Button.test.ts +0 -0
- /package/src/stories/{Colors.mdx → foundations/Colors.mdx} +0 -0
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
useMediaQuery,
|
|
7
7
|
useTheme,
|
|
8
8
|
} from '@mui/material'
|
|
9
|
-
import {
|
|
9
|
+
import { useLayoutEffect, useRef, useState } from 'react'
|
|
10
10
|
import { useTranslation } from 'react-i18next'
|
|
11
11
|
|
|
12
12
|
import CloseIcon from '@/assets/icons/CloseIcon'
|
|
@@ -53,13 +53,19 @@ function RcSesSnackbar({
|
|
|
53
53
|
const { t } = useTranslation('input')
|
|
54
54
|
const [internalOpen, setInternalOpen] = useState(controlledOpen ?? true)
|
|
55
55
|
const [isPaused, setIsPaused] = useState(false)
|
|
56
|
+
const [prevControlledOpen, setPrevControlledOpen] = useState(controlledOpen)
|
|
56
57
|
const persist = controlledPersist ?? state === 'action-needed'
|
|
57
58
|
|
|
58
|
-
|
|
59
|
+
// The `open` prop drives the internal state, but closing from the inside
|
|
60
|
+
// (Escape, autohide, close button) has to keep working while the parent holds
|
|
61
|
+
// `open` at true. Adjusting the state during render instead of in an effect
|
|
62
|
+
// preserves both without the extra render pass an effect would cause.
|
|
63
|
+
if (controlledOpen !== prevControlledOpen) {
|
|
64
|
+
setPrevControlledOpen(controlledOpen)
|
|
59
65
|
if (controlledOpen !== undefined) {
|
|
60
66
|
setInternalOpen(controlledOpen)
|
|
61
67
|
}
|
|
62
|
-
}
|
|
68
|
+
}
|
|
63
69
|
|
|
64
70
|
const config = stateConfig[state]
|
|
65
71
|
const StateIcon = config.icon
|
|
@@ -241,10 +241,9 @@ describe('RcSesTitleBlock', () => {
|
|
|
241
241
|
)
|
|
242
242
|
})
|
|
243
243
|
|
|
244
|
-
test('actions slot
|
|
245
|
-
//
|
|
246
|
-
//
|
|
247
|
-
// override lives behind a media query and does not affect the base style.
|
|
244
|
+
test('actions slot renders as a wrapping row', () => {
|
|
245
|
+
// jsdom does not evaluate media queries or measure widths, so this only
|
|
246
|
+
// asserts the base flex styles — not the actual mobile wrap behaviour.
|
|
248
247
|
renderTitleBlock(
|
|
249
248
|
<RcSesTitleBlock
|
|
250
249
|
actions={
|
|
@@ -258,10 +257,13 @@ describe('RcSesTitleBlock', () => {
|
|
|
258
257
|
/>,
|
|
259
258
|
)
|
|
260
259
|
|
|
261
|
-
expect(screen.getByTestId('actions')).toHaveStyle({
|
|
260
|
+
expect(screen.getByTestId('actions')).toHaveStyle({
|
|
261
|
+
flexDirection: 'row',
|
|
262
|
+
flexWrap: 'wrap',
|
|
263
|
+
})
|
|
262
264
|
})
|
|
263
265
|
|
|
264
|
-
test('actions slot
|
|
266
|
+
test('actions slot renders as a row with a single action', () => {
|
|
265
267
|
renderTitleBlock(
|
|
266
268
|
<RcSesTitleBlock
|
|
267
269
|
actions={<button type='button'>Užsakyti</button>}
|
|
@@ -270,7 +272,7 @@ describe('RcSesTitleBlock', () => {
|
|
|
270
272
|
/>,
|
|
271
273
|
)
|
|
272
274
|
|
|
273
|
-
expect(screen.getByTestId('actions')).toHaveStyle({ flexDirection: '
|
|
275
|
+
expect(screen.getByTestId('actions')).toHaveStyle({ flexDirection: 'row' })
|
|
274
276
|
})
|
|
275
277
|
|
|
276
278
|
test('omits the icon and actions slots when not provided', () => {
|
|
@@ -4,7 +4,7 @@ import RcSesBadge from '@/components/common/Badge'
|
|
|
4
4
|
import cards from '@/theme/cards'
|
|
5
5
|
import palette from '@/theme/palette'
|
|
6
6
|
|
|
7
|
-
import { RcSesTitleBlockProps } from './types'
|
|
7
|
+
import { RcSesTitleBlockProps, TitleBlockHeadingLevel } from './types'
|
|
8
8
|
|
|
9
9
|
function RcSesTitleBlock({
|
|
10
10
|
title,
|
|
@@ -20,7 +20,10 @@ function RcSesTitleBlock({
|
|
|
20
20
|
className,
|
|
21
21
|
testIds,
|
|
22
22
|
}: RcSesTitleBlockProps) {
|
|
23
|
-
|
|
23
|
+
// Annotated rather than asserted: a template literal expression widens to
|
|
24
|
+
// `string` without a contextual type, and JSX cannot resolve an intrinsic
|
|
25
|
+
// element from that.
|
|
26
|
+
const HeadingTag: `h${TitleBlockHeadingLevel}` = `h${headingLevel}`
|
|
24
27
|
const hasCount = count !== undefined && count !== null
|
|
25
28
|
const hasDescription = description !== undefined && description !== null
|
|
26
29
|
const isVertical = orientation === 'vertical'
|
|
@@ -28,13 +31,23 @@ function RcSesTitleBlock({
|
|
|
28
31
|
const isHeadingScale = titleVariant !== 'body1'
|
|
29
32
|
|
|
30
33
|
const iconNode = icon ? (
|
|
31
|
-
<Box
|
|
34
|
+
<Box
|
|
35
|
+
aria-hidden
|
|
36
|
+
data-testid={testIds?.icon}
|
|
37
|
+
sx={{
|
|
38
|
+
display: 'flex',
|
|
39
|
+
flexShrink: 0,
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
32
42
|
{icon}
|
|
33
43
|
</Box>
|
|
34
44
|
) : null
|
|
35
45
|
|
|
36
46
|
const textColumn = (
|
|
37
|
-
<Stack
|
|
47
|
+
<Stack
|
|
48
|
+
spacing={isVertical ? { xs: '0.5rem', sm: cards.header.rowGap } : cards.header.gap}
|
|
49
|
+
sx={{ flex: 1, minWidth: 0, width: '100%' }}
|
|
50
|
+
>
|
|
38
51
|
<HeadingTag id={headingId} data-testid={testIds?.heading} style={{ margin: 0 }}>
|
|
39
52
|
<Typography
|
|
40
53
|
component='span'
|
|
@@ -43,6 +56,11 @@ function RcSesTitleBlock({
|
|
|
43
56
|
color: titleTone === 'brand' ? palette.primary[700] : palette.grey[900],
|
|
44
57
|
// inline only when the badge has to sit on the heading's last line
|
|
45
58
|
display: hasCount ? 'inline' : 'block',
|
|
59
|
+
// Vertical orientation compresses the title on xs; desktop keeps
|
|
60
|
+
// whatever size `titleVariant` defines. Keep lineHeight paired with
|
|
61
|
+
// fontSize so wrapping titles do not clip descenders.
|
|
62
|
+
fontSize: isVertical ? { xs: '0.875rem', sm: '1.5rem' } : undefined,
|
|
63
|
+
lineHeight: isVertical ? { xs: 1.25, sm: 1.33 } : undefined,
|
|
46
64
|
fontWeight: isHeadingScale ? cards.header.titleFontWeight : undefined,
|
|
47
65
|
overflowWrap: 'anywhere',
|
|
48
66
|
}}
|
|
@@ -88,11 +106,15 @@ function RcSesTitleBlock({
|
|
|
88
106
|
const actionsSlot = actions ? (
|
|
89
107
|
<Stack
|
|
90
108
|
data-testid={testIds?.actions}
|
|
91
|
-
direction=
|
|
109
|
+
direction='row'
|
|
92
110
|
spacing={cards.header.actionsGap}
|
|
111
|
+
// Flex gap instead of sibling margin, so wrapped rows get the vertical
|
|
112
|
+
// gap and the first action of each row has no stray left margin.
|
|
113
|
+
useFlexGap
|
|
93
114
|
sx={{
|
|
94
|
-
alignItems:
|
|
115
|
+
alignItems: 'center',
|
|
95
116
|
flexShrink: 0,
|
|
117
|
+
flexWrap: 'wrap',
|
|
96
118
|
}}
|
|
97
119
|
>
|
|
98
120
|
{actions}
|
|
@@ -105,11 +127,12 @@ function RcSesTitleBlock({
|
|
|
105
127
|
data-testid={testIds?.root}
|
|
106
128
|
direction={isVertical ? 'column' : { xs: 'column', sm: 'row' }}
|
|
107
129
|
spacing={cards.header.rowGap}
|
|
130
|
+
// Flex gap skips items removed via `display: none`, so the icon's mobile
|
|
131
|
+
// hide in the vertical orientation actually collapses its slot instead of
|
|
132
|
+
// leaving a sibling-selector margin above the title.
|
|
133
|
+
useFlexGap
|
|
108
134
|
sx={{
|
|
109
|
-
alignItems:
|
|
110
|
-
isVertical || hasDescription
|
|
111
|
-
? 'flex-start'
|
|
112
|
-
: { xs: 'flex-start', sm: 'center' },
|
|
135
|
+
alignItems: isVertical ? 'flex-start' : { xs: 'flex-start', sm: 'center' },
|
|
113
136
|
width: '100%',
|
|
114
137
|
}}
|
|
115
138
|
>
|
|
@@ -126,7 +149,7 @@ function RcSesTitleBlock({
|
|
|
126
149
|
direction='row'
|
|
127
150
|
spacing={cards.header.rowGap}
|
|
128
151
|
sx={{
|
|
129
|
-
alignItems:
|
|
152
|
+
alignItems: 'center',
|
|
130
153
|
flex: 1,
|
|
131
154
|
minWidth: 0,
|
|
132
155
|
width: '100%',
|
|
@@ -6,7 +6,7 @@ export type TitleBlockTitleVariant = 'h4' | 'h5' | 'h6' | 'body1'
|
|
|
6
6
|
|
|
7
7
|
export type TitleBlockOrientation = 'horizontal' | 'vertical'
|
|
8
8
|
|
|
9
|
-
export
|
|
9
|
+
export interface RcSesTitleBlockTestIds {
|
|
10
10
|
root?: string
|
|
11
11
|
icon?: string
|
|
12
12
|
heading?: string
|
|
@@ -15,7 +15,7 @@ export type RcSesTitleBlockTestIds = {
|
|
|
15
15
|
actions?: string
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
export
|
|
18
|
+
export interface RcSesTitleBlockBaseProps {
|
|
19
19
|
title: ReactNode
|
|
20
20
|
headingLevel?: TitleBlockHeadingLevel
|
|
21
21
|
/**
|
|
@@ -8,7 +8,7 @@ import theme from '@/theme/light'
|
|
|
8
8
|
import FieldSuffix from './components/FieldSuffix'
|
|
9
9
|
import { formControlDesktopLabelWidth } from './const/FormControlLayoutVariables'
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
interface Props {
|
|
12
12
|
children: React.ReactNode
|
|
13
13
|
className?: string
|
|
14
14
|
description?: React.ReactNode
|
|
@@ -16,7 +16,7 @@ import RcSesDatepicker from '.'
|
|
|
16
16
|
const REFERENCE = new Date(2026, 0, 15)
|
|
17
17
|
const MAX = new Date(2026, 0, 20)
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
interface HarnessProps {
|
|
20
20
|
/** Seeds the field, so a day renders as selected. */
|
|
21
21
|
value?: string | null
|
|
22
22
|
/** Bounds the calendar, so later days render as disabled. */
|
|
@@ -70,10 +70,7 @@ function RcSesFileDropzone(props: Props) {
|
|
|
70
70
|
|
|
71
71
|
const hasValidFileSelection = value && Array.isArray(value) && value.length > 0
|
|
72
72
|
|
|
73
|
-
const onRemoveFile = (
|
|
74
|
-
e: React.MouseEvent<HTMLButtonElement, MouseEvent>,
|
|
75
|
-
index: number,
|
|
76
|
-
) => {
|
|
73
|
+
const onRemoveFile = (e: React.MouseEvent<HTMLButtonElement>, index: number) => {
|
|
77
74
|
e.preventDefault()
|
|
78
75
|
e.stopPropagation()
|
|
79
76
|
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { ThemeProvider } from '@mui/material/styles'
|
|
2
|
+
import { fireEvent, render, screen } from '@testing-library/react'
|
|
3
|
+
import { useForm } from 'react-hook-form'
|
|
4
|
+
|
|
5
|
+
import theme from '@/theme/light'
|
|
6
|
+
|
|
7
|
+
import RcSesNumberStepper from './NumberStepper'
|
|
8
|
+
|
|
9
|
+
interface TestWrapperProps {
|
|
10
|
+
defaultValue?: number
|
|
11
|
+
disabled?: boolean
|
|
12
|
+
max?: number
|
|
13
|
+
min?: number
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const TestWrapper = ({ defaultValue = 5, disabled, max, min }: TestWrapperProps) => {
|
|
17
|
+
const { control } = useForm({ defaultValues: { quantity: defaultValue } })
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<ThemeProvider theme={theme}>
|
|
21
|
+
<RcSesNumberStepper
|
|
22
|
+
id='quantity'
|
|
23
|
+
name='quantity'
|
|
24
|
+
control={control}
|
|
25
|
+
label='Kiekis'
|
|
26
|
+
displayStepperControls
|
|
27
|
+
disabled={disabled}
|
|
28
|
+
rules={{ min, max }}
|
|
29
|
+
/>
|
|
30
|
+
</ThemeProvider>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const subtractButton = () => screen.getByRole('button', { name: 'Atimti' })
|
|
35
|
+
const addButton = () => screen.getByRole('button', { name: 'Pridėti' })
|
|
36
|
+
|
|
37
|
+
describe('RcSesNumberStepper', () => {
|
|
38
|
+
test('enables both controls when the value sits between min and max', () => {
|
|
39
|
+
render(<TestWrapper defaultValue={5} min={0} max={10} />)
|
|
40
|
+
|
|
41
|
+
expect(subtractButton()).toBeEnabled()
|
|
42
|
+
expect(addButton()).toBeEnabled()
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
test('disables subtract on the first render when the value is already at min', () => {
|
|
46
|
+
render(<TestWrapper defaultValue={0} min={0} max={10} />)
|
|
47
|
+
|
|
48
|
+
expect(subtractButton()).toBeDisabled()
|
|
49
|
+
expect(addButton()).toBeEnabled()
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
test('disables add on the first render when the value is already at max', () => {
|
|
53
|
+
render(<TestWrapper defaultValue={10} min={0} max={10} />)
|
|
54
|
+
|
|
55
|
+
expect(subtractButton()).toBeEnabled()
|
|
56
|
+
expect(addButton()).toBeDisabled()
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
test('disables both controls when the field is disabled', () => {
|
|
60
|
+
render(<TestWrapper defaultValue={5} disabled min={0} max={10} />)
|
|
61
|
+
|
|
62
|
+
expect(subtractButton()).toBeDisabled()
|
|
63
|
+
expect(addButton()).toBeDisabled()
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
test('leaves both controls enabled when no min or max is set', () => {
|
|
67
|
+
render(<TestWrapper defaultValue={0} />)
|
|
68
|
+
|
|
69
|
+
expect(subtractButton()).toBeEnabled()
|
|
70
|
+
expect(addButton()).toBeEnabled()
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
test('re-evaluates the controls as the value reaches a bound', () => {
|
|
74
|
+
render(<TestWrapper defaultValue={9} min={0} max={10} />)
|
|
75
|
+
|
|
76
|
+
expect(addButton()).toBeEnabled()
|
|
77
|
+
|
|
78
|
+
fireEvent.click(addButton())
|
|
79
|
+
|
|
80
|
+
expect(addButton()).toBeDisabled()
|
|
81
|
+
expect(subtractButton()).toBeEnabled()
|
|
82
|
+
})
|
|
83
|
+
})
|
|
@@ -51,7 +51,7 @@ const NumberInput = styled(OutlinedInput)({
|
|
|
51
51
|
},
|
|
52
52
|
})
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
interface ArrowButtonProps {
|
|
55
55
|
ariaLabel: string
|
|
56
56
|
direction: 'plus' | 'minus'
|
|
57
57
|
disabled: boolean
|
|
@@ -110,8 +110,6 @@ type Props = Pick<TControllerProps, ImmediateControllerProps> &
|
|
|
110
110
|
function RcSesNumberStepper(props: Props) {
|
|
111
111
|
const { t } = useTranslation('input', { keyPrefix: 'components.RcSesNumberStepper' })
|
|
112
112
|
|
|
113
|
-
const [buttonState, setButtonState] = React.useState<[boolean, boolean]>([true, true])
|
|
114
|
-
|
|
115
113
|
const {
|
|
116
114
|
control,
|
|
117
115
|
displayStepperControls,
|
|
@@ -138,20 +136,21 @@ function RcSesNumberStepper(props: Props) {
|
|
|
138
136
|
...slotProps?.controller,
|
|
139
137
|
})
|
|
140
138
|
|
|
141
|
-
|
|
139
|
+
// [subtractDisabled, addDisabled] - derived from the current value and the
|
|
140
|
+
// controller rules, so the buttons render with the right state on first paint.
|
|
141
|
+
const buttonState = useMemo<[boolean, boolean]>(() => {
|
|
142
142
|
if (disabled) {
|
|
143
|
-
|
|
144
|
-
return
|
|
143
|
+
return [true, true]
|
|
145
144
|
}
|
|
146
145
|
|
|
147
|
-
|
|
146
|
+
return [
|
|
148
147
|
Number.isInteger(rules?.min)
|
|
149
148
|
? parseInt(rules?.min as string, 10) >= parseInt((value ?? 0) as string, 10)
|
|
150
149
|
: false,
|
|
151
150
|
Number.isInteger(rules?.max)
|
|
152
151
|
? parseInt(rules?.max as string, 10) <= parseInt((value ?? 0) as string, 10)
|
|
153
152
|
: false,
|
|
154
|
-
]
|
|
153
|
+
]
|
|
155
154
|
}, [disabled, rules?.max, rules?.min, value])
|
|
156
155
|
|
|
157
156
|
const handleInputOnChange = (
|
|
@@ -15,7 +15,7 @@ import RcSesFormControlWrapper, {
|
|
|
15
15
|
RcSesFormControlWrapperProps,
|
|
16
16
|
} from '../components/FormControlWrapper'
|
|
17
17
|
|
|
18
|
-
export
|
|
18
|
+
export interface RadioOption {
|
|
19
19
|
label: string
|
|
20
20
|
value: string
|
|
21
21
|
}
|
|
@@ -35,7 +35,7 @@ type Props = Pick<TControllerProps, ImmediateControllerProps> &
|
|
|
35
35
|
id?: string
|
|
36
36
|
className?: string
|
|
37
37
|
hideNativeRadio?: boolean
|
|
38
|
-
options:
|
|
38
|
+
options: RadioOption[]
|
|
39
39
|
variant?: 'flat' | 'outlined' | 'filled'
|
|
40
40
|
slotProps?: {
|
|
41
41
|
controller?: Partial<Omit<TControllerProps, ImmediateControllerProps>>
|
|
@@ -62,7 +62,7 @@ const RcSesSearchInput = React.forwardRef<HTMLInputElement, Props>((props, ref)
|
|
|
62
62
|
if (typeof ref === 'function') {
|
|
63
63
|
ref(el)
|
|
64
64
|
} else if (ref) {
|
|
65
|
-
|
|
65
|
+
ref.current = el
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
68
|
[ref],
|
|
@@ -25,7 +25,7 @@ vi.mock('react-i18next', () => ({
|
|
|
25
25
|
* the runtime breaks. These tests pin the behaviour so the migration is verifiable.
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
interface ModalProps {
|
|
29
29
|
open: boolean
|
|
30
30
|
onSubmit: (value: string) => void
|
|
31
31
|
onClose: () => void
|
|
@@ -58,7 +58,7 @@ const TestWrapper = ({ defaultValue = '' }: { defaultValue?: string }) => {
|
|
|
58
58
|
)
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
const getField = () => screen.getByRole('textbox')
|
|
61
|
+
const getField = () => screen.getByRole<HTMLInputElement>('textbox')
|
|
62
62
|
|
|
63
63
|
describe('RcSesSearchableField', () => {
|
|
64
64
|
it('should render the field with the value from the form', () => {
|
|
@@ -7,7 +7,7 @@ import theme from '@/theme/light'
|
|
|
7
7
|
|
|
8
8
|
import RcSesSelect from '.'
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
interface TestWrapperProps {
|
|
11
11
|
defaultValue?: string | null
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -22,13 +22,13 @@ const options = [
|
|
|
22
22
|
},
|
|
23
23
|
]
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
interface UnregisterTestWrapperProps {
|
|
26
26
|
shouldUnregister?: boolean
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
const UnregisterTestWrapper = ({ shouldUnregister }: UnregisterTestWrapperProps) => {
|
|
30
30
|
const { control, getValues } = useForm({
|
|
31
|
-
defaultValues: { selection: 'short-option'
|
|
31
|
+
defaultValues: { selection: 'short-option' },
|
|
32
32
|
})
|
|
33
33
|
const [mounted, setMounted] = useState(true)
|
|
34
34
|
const [formValues, setFormValues] = useState('')
|
|
@@ -5,7 +5,7 @@ import ExpandChevronsIcon from '@/assets/icons/ExpandChevronsIcon'
|
|
|
5
5
|
import useAccordionController from '@/components/common/Accordion/hooks/useAccordionController'
|
|
6
6
|
import Button from '@/components/common/Button'
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
interface Props {
|
|
9
9
|
controller: ReturnType<typeof useAccordionController>
|
|
10
10
|
}
|
|
11
11
|
function AccordionCollapseControls({ controller }: Props) {
|
|
@@ -9,7 +9,7 @@ import ServiceWizardStepper from '../../ServiceWizardStepper'
|
|
|
9
9
|
import AccordionCollapseControls from './components/AccordionCollapseControls'
|
|
10
10
|
import mapAccordionStateToSteps from './utils'
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
interface Props {
|
|
13
13
|
accordionController: ReturnType<typeof useAccordionController>
|
|
14
14
|
children: React.ReactNode
|
|
15
15
|
showAccordionCollapseControls?: boolean
|
|
@@ -5,7 +5,7 @@ import RcSesBreadcrumbs from '@/components/common/Breadcrumbs'
|
|
|
5
5
|
import theme from '@/theme/light'
|
|
6
6
|
import { common } from '@/theme/palette'
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
interface Props {
|
|
9
9
|
breadcrumbsProps: React.ComponentProps<typeof RcSesBreadcrumbs>
|
|
10
10
|
children?: React.ReactNode
|
|
11
11
|
title: string
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { SxProps, Theme } from '@mui/material'
|
|
2
2
|
|
|
3
3
|
type SxEntry =
|
|
4
|
-
Extract<SxProps<Theme>,
|
|
5
|
-
? T
|
|
6
|
-
: never
|
|
4
|
+
Extract<SxProps<Theme>, readonly unknown[]> extends readonly (infer T)[] ? T : never
|
|
7
5
|
|
|
8
|
-
function isSxArray(sx: SxProps<Theme>): sx is
|
|
6
|
+
function isSxArray(sx: SxProps<Theme>): sx is readonly SxEntry[] {
|
|
9
7
|
return Array.isArray(sx)
|
|
10
8
|
}
|
|
11
9
|
|
|
@@ -58,8 +58,6 @@ function ListWithPagination() {
|
|
|
58
58
|
const [selectedItemId, setSelectedItemId] = useState<string | null>(null)
|
|
59
59
|
|
|
60
60
|
useEffect(() => {
|
|
61
|
-
setIsLoading(true)
|
|
62
|
-
|
|
63
61
|
const timer = setTimeout(() => {
|
|
64
62
|
setData(mapToSelectableItems(mockApiData))
|
|
65
63
|
setIsLoading(false)
|
|
@@ -4,7 +4,7 @@ import RcSesAlert from '@/components/common/Alert'
|
|
|
4
4
|
import RcSesRadioButtonGroup from '@/components/form/inputs/RadioButtonGroup'
|
|
5
5
|
import RcSesSelect from '@/components/form/inputs/Select'
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
interface FormModel {
|
|
8
8
|
issuanceMethod: string
|
|
9
9
|
rcBranch: string
|
|
10
10
|
}
|
|
@@ -19,7 +19,7 @@ import { useForm } from 'react-hook-form'
|
|
|
19
19
|
|
|
20
20
|
import RcSesTextField from '@/components/form/inputs/TextField'
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
interface FormModel {
|
|
23
23
|
city: string
|
|
24
24
|
street: string
|
|
25
25
|
addressNo: string
|
|
@@ -27,7 +27,7 @@ type FormModel = {
|
|
|
27
27
|
aptNo: string
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
interface Props {
|
|
31
31
|
open: boolean
|
|
32
32
|
onSubmit: (value: string) => void
|
|
33
33
|
onClose: () => void
|
package/src/library/types.ts
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
RcSesServiceLinksProps,
|
|
23
23
|
RcSesServiceLinksTestIds,
|
|
24
24
|
} from '@/components/common/ServiceLinks/types'
|
|
25
|
-
import { RcSesSideNavItem } from '@/components/common/SideNav'
|
|
25
|
+
import { RcSesSideNavItem, RcSesSideNavOverflow } from '@/components/common/SideNav'
|
|
26
26
|
import { RcSesSideNavLayoutProps } from '@/components/common/SideNav/SideNavLayout'
|
|
27
27
|
import {
|
|
28
28
|
RcSesTitleBlockProps,
|
|
@@ -81,6 +81,7 @@ export type {
|
|
|
81
81
|
RcSesTooltipProps,
|
|
82
82
|
RcSesSideNavItem,
|
|
83
83
|
RcSesSideNavLayoutProps,
|
|
84
|
+
RcSesSideNavOverflow,
|
|
84
85
|
}
|
|
85
86
|
export type { RcSesDialogProps, DialogSize }
|
|
86
87
|
export type { RcSesModalProps, ModalVariant }
|