@registrucentras/rc-ses-react-components 1.12.0 → 2.0.0-rc.1
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/assets/icons/ArrowLeftIcon.d.ts +1 -1
- package/dist/assets/icons/ArrowRightIcon.d.ts +1 -1
- package/dist/assets/icons/ArrowsClockwiseIcon.d.ts +1 -1
- package/dist/assets/icons/BarcodeIcon.d.ts +1 -1
- package/dist/assets/icons/CalendarBlankIcon.d.ts +1 -1
- package/dist/assets/icons/CaretDoubleLeftBoldIcon.d.ts +1 -1
- package/dist/assets/icons/CaretDoubleRightBoldIcon.d.ts +1 -1
- package/dist/assets/icons/CaretDownBoldIcon.d.ts +1 -1
- package/dist/assets/icons/CaretDownFill.d.ts +1 -1
- package/dist/assets/icons/CaretDownIcon.d.ts +1 -1
- package/dist/assets/icons/CaretLeftBoldIcon.d.ts +1 -1
- package/dist/assets/icons/CaretLeftIcon.d.ts +1 -1
- package/dist/assets/icons/CaretRightBoldIcon.d.ts +1 -1
- package/dist/assets/icons/CaretUpBoldIcon.d.ts +3 -0
- package/dist/assets/icons/CaretUpIcon.d.ts +3 -0
- package/dist/assets/icons/CheckBoldIcon.d.ts +1 -1
- package/dist/assets/icons/CheckCircleFillIcon.d.ts +1 -1
- package/dist/assets/icons/CheckIcon.d.ts +1 -1
- package/dist/assets/icons/CheckUncheckedBoldIcon.d.ts +1 -1
- package/dist/assets/icons/CircleFilledIcon.d.ts +1 -1
- package/dist/assets/icons/CloseIcon.d.ts +1 -1
- package/dist/assets/icons/CollapseChevronsIcon.d.ts +1 -1
- package/dist/assets/icons/CopyIcon.d.ts +1 -1
- package/dist/assets/icons/DotCircleFilledIcon.d.ts +1 -1
- package/dist/assets/icons/ExpandChevronsIcon.d.ts +1 -1
- package/dist/assets/icons/InfoFillIcon.d.ts +1 -1
- package/dist/assets/icons/ListIcon.d.ts +3 -0
- package/dist/assets/icons/MagnifyingGlassIcon.d.ts +1 -1
- package/dist/assets/icons/MapPinAreaIcon.d.ts +1 -1
- package/dist/assets/icons/MinusBoldIcon.d.ts +1 -1
- package/dist/assets/icons/MinusIcon.d.ts +3 -0
- package/dist/assets/icons/NotePencilIcon.d.ts +3 -0
- package/dist/assets/icons/PencilSimpleLineIcon.d.ts +1 -1
- package/dist/assets/icons/PlusBoldIcon.d.ts +1 -1
- package/dist/assets/icons/PlusIcon.d.ts +3 -0
- package/dist/assets/icons/QuestionFillIcon.d.ts +1 -1
- package/dist/assets/icons/QuestionIcon.d.ts +1 -1
- package/dist/assets/icons/ScalesIcon.d.ts +1 -1
- package/dist/assets/icons/ScrollIcon.d.ts +1 -1
- package/dist/assets/icons/SearchHelpIcon.d.ts +1 -1
- package/dist/assets/icons/SearchXIcon.d.ts +1 -1
- package/dist/assets/icons/SpinnerGapBoldIcon.d.ts +1 -1
- package/dist/assets/icons/TrashIcon.d.ts +3 -0
- package/dist/assets/icons/UploadSimpleIcon.d.ts +1 -1
- package/dist/assets/icons/UserIcon.d.ts +3 -0
- package/dist/assets/icons/WarningCircleIcon.d.ts +1 -1
- package/dist/assets/icons/WarningDiamondFillIcon.d.ts +1 -1
- package/dist/assets/icons/WarningFillIcon.d.ts +1 -1
- package/dist/assets/icons/XCircleFillIcon.d.ts +1 -1
- package/dist/components/common/Accordion/index.d.ts +1 -1
- package/dist/components/common/AdvancedList/components/AdvancedListItem/AdvancedListItem.types.d.ts +106 -0
- package/dist/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemLeading.d.ts +12 -0
- package/dist/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemTrailing.d.ts +7 -0
- package/dist/components/common/AdvancedList/components/AdvancedListItem/hooks/usePrefersReducedMotion.d.ts +2 -0
- package/dist/components/common/AdvancedList/components/AdvancedListItem/index.d.ts +4 -0
- package/dist/components/common/AdvancedList/index.d.ts +11 -0
- package/dist/components/common/Alert/index.d.ts +1 -1
- package/dist/components/common/Badge/index.d.ts +1 -1
- package/dist/components/common/Breadcrumbs/index.d.ts +1 -1
- package/dist/components/common/Button/ButtonWithPopover.d.ts +1 -1
- package/dist/components/common/Button/index.d.ts +13 -5
- package/dist/components/common/Card/index.d.ts +1 -1
- package/dist/components/common/DataPagination/components/DataPaginationSkeleton.d.ts +1 -1
- package/dist/components/common/DataPagination/components/PaginationButton.d.ts +1 -1
- package/dist/components/common/DataPagination/index.d.ts +1 -1
- package/dist/components/common/IconWithCircularBackground.d.ts +1 -1
- package/dist/components/common/ImageCard/index.d.ts +1 -1
- package/dist/components/common/ListWithIcons/components/ListWithIconsItem.d.ts +1 -1
- package/dist/components/common/ListWithIcons/index.d.ts +1 -1
- package/dist/components/common/Popover/index.d.ts +1 -1
- package/dist/components/common/SelectableCardList/components/SelectableCardListItem.d.ts +4 -1
- package/dist/components/common/SelectableCardList/index.d.ts +4 -1
- package/dist/components/common/Snackbar/SnackbarProvider.d.ts +1 -1
- package/dist/components/common/Snackbar/index.d.ts +1 -1
- package/dist/components/common/Switch/index.d.ts +1 -1
- package/dist/components/common/Tabs/TabPanel.d.ts +1 -1
- package/dist/components/common/Tabs/TabsWrapper.d.ts +1 -1
- package/dist/components/common/Tooltip/index.d.ts +1 -1
- package/dist/components/form/components/FormControlWrapper/components/FieldSuffix.d.ts +1 -1
- package/dist/components/form/components/FormControlWrapper/index.d.ts +1 -1
- package/dist/components/form/inputs/Checkbox.d.ts +1 -1
- package/dist/components/form/inputs/CheckboxFormControl.d.ts +1 -1
- package/dist/components/form/inputs/Datepicker/components/RcSesDatepickerActionBar.d.ts +1 -1
- package/dist/components/form/inputs/Datepicker/components/RcSesDatepickerCalendarHeader.d.ts +2 -1
- package/dist/components/form/inputs/Datepicker/index.d.ts +1 -1
- package/dist/components/form/inputs/FileDropzone.d.ts +1 -1
- package/dist/components/form/inputs/FileUpload.d.ts +1 -1
- package/dist/components/form/inputs/FormControlLabel.d.ts +2 -2
- package/dist/components/form/inputs/NumberStepper.d.ts +2 -1
- package/dist/components/form/inputs/PhoneInput.d.ts +2 -1
- package/dist/components/form/inputs/PhoneInputFormControl/components/AutocompleteInput.d.ts +1 -1
- package/dist/components/form/inputs/PhoneInputFormControl/components/ListboxComponent.d.ts +13 -0
- package/dist/components/form/inputs/PhoneInputFormControl/components/PopperComponent.d.ts +1 -1
- package/dist/components/form/inputs/PhoneInputFormControl/components/RowComponent.d.ts +5 -2
- package/dist/components/form/inputs/PhoneInputFormControl/index.d.ts +2 -1
- package/dist/components/form/inputs/Select/index.d.ts +2 -1
- package/dist/components/form/inputs/SimpleCheckbox.d.ts +2 -1
- package/dist/components/layout/Footer/index.d.ts +1 -1
- package/dist/components/layout/ServiceFormActions.d.ts +1 -1
- package/dist/components/layout/ServiceFormContainer/AccordionFormContainer/components/AccordionCollapseControls.d.ts +1 -1
- package/dist/components/layout/ServiceFormContainer/AccordionFormContainer/index.d.ts +1 -1
- package/dist/components/layout/ServiceFormContainer/CardFormContainer/index.d.ts +1 -1
- package/dist/components/layout/ServiceHeader.d.ts +1 -1
- package/dist/components/layout/ServicePage.d.ts +1 -1
- package/dist/components/layout/ServiceWizardStepper/components/CustomStepIcon.d.ts +1 -1
- package/dist/components/layout/ServiceWizardStepper/components/DesktopStepper.d.ts +1 -1
- package/dist/components/layout/ServiceWizardStepper/components/HorizontalStepperButton.d.ts +1 -1
- package/dist/components/layout/ServiceWizardStepper/components/MobileStepper.d.ts +1 -1
- package/dist/components/layout/ServiceWizardStepper/index.d.ts +1 -1
- package/dist/components/loaders/FullPageLoader/index.d.ts +1 -1
- package/dist/components/loaders/Loader/index.d.ts +1 -1
- package/dist/components/loaders/LoadingSpinner/index.d.ts +1 -1
- package/dist/components/overlays/Dialog/index.d.ts +1 -1
- package/dist/components/overlays/Modal/index.d.ts +1 -1
- package/dist/components/utils/loading.d.ts +1 -1
- package/dist/i18n/@mui/x-date-pickers/ltLT.d.ts +1 -71
- package/dist/library/icons.d.ts +9 -1
- package/dist/library/index.d.ts +3 -0
- package/dist/registrucentras-rc-ses-react-components.cjs +1 -30
- package/dist/registrucentras-rc-ses-react-components.js +6698 -7777
- package/dist/stories/assets/Logo.stories.d.ts +1 -1
- package/dist/stories/components/actions/Button.stories.d.ts +6 -5
- package/dist/stories/components/actions/ButtonWithPopover.stories.d.ts +1 -1
- package/dist/stories/components/display/AdvancedList.stories.d.ts +32 -0
- package/dist/stories/components/display/AdvancedListItem.stories.d.ts +33 -0
- package/dist/stories/components/display/Badge.stories.d.ts +1 -1
- package/dist/stories/components/display/Card.stories.d.ts +1 -1
- package/dist/stories/components/display/ImageCard.stories.d.ts +1 -1
- package/dist/stories/components/display/ListWithIcons.stories.d.ts +2 -2
- package/dist/stories/components/display/SegmentedControl.stories.d.ts +9 -9
- package/dist/stories/components/display/SelectableCardList.stories.d.ts +2 -2
- package/dist/stories/components/display/Tooltip.stories.d.ts +2 -2
- package/dist/stories/components/feedback/Alert.stories.d.ts +1 -1
- package/dist/stories/components/feedback/Snackbar.stories.d.ts +7 -7
- package/dist/stories/components/form/CardFormContainer.stories.d.ts +1 -1
- package/dist/stories/components/form/CheckboxFormControl.stories.d.ts +1 -1
- package/dist/stories/components/form/FormControlWrapper.stories.d.ts +1 -1
- package/dist/stories/components/form/ServiceFormActions.stories.d.ts +1 -1
- package/dist/stories/components/form/ServiceFormContainer.stories.d.ts +2 -2
- package/dist/stories/components/form/SimpleCheckbox.stories.d.ts +1 -1
- package/dist/stories/components/icons/IconWithCircularBackground.stories.d.ts +1 -1
- package/dist/stories/components/icons/Icons.stories.d.ts +1 -1
- package/dist/stories/components/inputs/Checkbox.stories.d.ts +2 -2
- package/dist/stories/components/inputs/DatePicker.stories.d.ts +25 -2
- package/dist/stories/components/inputs/FileDropzone.stories.d.ts +1 -1
- package/dist/stories/components/inputs/FileUpload.stories.d.ts +2 -2
- package/dist/stories/components/inputs/NumberStepper.stories.d.ts +1 -1
- package/dist/stories/components/inputs/PhoneInput.stories.d.ts +2 -2
- package/dist/stories/components/inputs/PhoneInputFormControl.stories.d.ts +1 -1
- package/dist/stories/components/inputs/RadioButtonGroup.stories.d.ts +1 -1
- package/dist/stories/components/inputs/SearchInput.stories.d.ts +1 -1
- package/dist/stories/components/inputs/SearchableField.stories.d.ts +1 -1
- package/dist/stories/components/inputs/Select.stories.d.ts +1 -1
- package/dist/stories/components/inputs/Switch.stories.d.ts +1 -1
- package/dist/stories/components/inputs/TextField.stories.d.ts +1 -1
- package/dist/stories/components/layout/Footer.stories.d.ts +1 -1
- package/dist/stories/components/layout/ServiceHeader.stories.d.ts +1 -1
- package/dist/stories/components/layout/ServicePage.stories.d.ts +1 -1
- package/dist/stories/components/loaders/FullPageLoader.stories.d.ts +1 -1
- package/dist/stories/components/loaders/Loader.stories.d.ts +1 -1
- package/dist/stories/components/loaders/LoadingSpinner.stories.d.ts +4 -4
- package/dist/stories/components/navigation/Accordion.stories.d.ts +2 -2
- package/dist/stories/components/navigation/Breadcrumbs.stories.d.ts +1 -1
- package/dist/stories/components/navigation/DataPagination.stories.d.ts +2 -2
- package/dist/stories/components/navigation/ServiceWizardStepper.stories.d.ts +1 -1
- package/dist/stories/components/overlays/Dialog.stories.d.ts +7 -1
- package/dist/stories/components/overlays/Modal.stories.d.ts +1 -1
- package/dist/stories/components/overlays/Popover.stories.d.ts +12 -0
- package/dist/stories/components/tabs/Tab.stories.d.ts +1 -1
- package/dist/stories/components/tabs/TabPanel.stories.d.ts +1 -1
- package/dist/stories/components/tabs/Tabs.stories.d.ts +1 -1
- package/dist/stories/components/tabs/TabsWrapper.stories.d.ts +1 -1
- package/dist/stories/theme/ThemedMuiComponents.stories.d.ts +25 -0
- package/dist/theme/motion.d.ts +16 -0
- package/package.json +64 -62
- package/src/assets/icons/CaretUpBoldIcon.tsx +17 -0
- package/src/assets/icons/CaretUpIcon.tsx +9 -0
- package/src/assets/icons/ListIcon.tsx +17 -0
- package/src/assets/icons/MinusIcon.tsx +9 -0
- package/src/assets/icons/NotePencilIcon.tsx +9 -0
- package/src/assets/icons/PlusIcon.tsx +9 -0
- package/src/assets/icons/TrashIcon.tsx +23 -0
- package/src/assets/icons/UserIcon.tsx +17 -0
- package/src/components/common/Accordion/index.tsx +0 -1
- package/src/components/common/AdvancedList/components/AdvancedListItem/AdvancedListItem.types.ts +100 -0
- package/src/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemLeading.tsx +224 -0
- package/src/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemTrailing.tsx +263 -0
- package/src/components/common/AdvancedList/components/AdvancedListItem/hooks/usePrefersReducedMotion.test.ts +80 -0
- package/src/components/common/AdvancedList/components/AdvancedListItem/hooks/usePrefersReducedMotion.ts +28 -0
- package/src/components/common/AdvancedList/components/AdvancedListItem/index.test.tsx +631 -0
- package/src/components/common/AdvancedList/components/AdvancedListItem/index.tsx +332 -0
- package/src/components/common/AdvancedList/index.test.tsx +97 -0
- package/src/components/common/AdvancedList/index.tsx +52 -0
- package/src/components/common/Alert/index.test.tsx +1 -1
- package/src/components/common/Badge/index.test.tsx +1 -1
- package/src/components/common/Button/index.test.tsx +5 -2
- package/src/components/common/Button/index.tsx +25 -5
- package/src/components/common/Card/index.test.tsx +1 -1
- package/src/components/common/DataPagination/index.test.tsx +1 -1
- package/src/components/common/DataPagination/index.tsx +14 -2
- package/src/components/common/ImageCard/index.test.tsx +1 -1
- package/src/components/common/ListWithIcons/index.test.tsx +1 -1
- package/src/components/common/SegmentedControl/components/SegmentButton/index.test.tsx +1 -1
- package/src/components/common/SegmentedControl/components/SegmentButton/index.tsx +2 -0
- package/src/components/common/SegmentedControl/index.test.tsx +1 -1
- package/src/components/common/SelectableCardList/components/SelectableCardListItem.test.tsx +50 -0
- package/src/components/common/SelectableCardList/components/SelectableCardListItem.tsx +48 -2
- package/src/components/common/SelectableCardList/index.test.tsx +1 -1
- package/src/components/common/SelectableCardList/index.tsx +6 -0
- package/src/components/common/Snackbar/SnackbarProvider.tsx +1 -1
- package/src/components/common/Snackbar/index.test.tsx +1 -1
- package/src/components/common/Snackbar/index.tsx +3 -1
- package/src/components/common/Switch/index.test.tsx +1 -1
- package/src/components/common/Switch/index.tsx +21 -6
- package/src/components/common/Tooltip/index.test.tsx +2 -4
- package/src/components/common/Tooltip/index.tsx +5 -4
- package/src/components/form/components/FormControlWrapper/const/FormControlLayoutVariables.ts +1 -1
- package/src/components/form/inputs/CheckboxFormControl.tsx +7 -3
- package/src/components/form/inputs/Datepicker/components/RcSesDatepickerActionBar.tsx +8 -5
- package/src/components/form/inputs/Datepicker/components/RcSesDatepickerCalendarHeader.tsx +12 -12
- package/src/components/form/inputs/Datepicker/index.tsx +37 -32
- package/src/components/form/inputs/FileDropzone.tsx +6 -1
- package/src/components/form/inputs/NumberStepper.tsx +10 -5
- package/src/components/form/inputs/PhoneInputFormControl/components/AutocompleteInput.tsx +15 -11
- package/src/components/form/inputs/PhoneInputFormControl/components/ListboxComponent.tsx +31 -27
- package/src/components/form/inputs/PhoneInputFormControl/components/RowComponent.tsx +8 -4
- package/src/components/form/inputs/PhoneInputFormControl/index.test.tsx +57 -2
- package/src/components/form/inputs/PhoneInputFormControl/index.tsx +66 -53
- package/src/components/form/inputs/RadioButtonGroup.tsx +0 -1
- package/src/components/form/inputs/SearchInput/index.test.tsx +1 -1
- package/src/components/form/inputs/SearchInput/index.tsx +23 -13
- package/src/components/form/inputs/SearchableField.test.tsx +126 -0
- package/src/components/form/inputs/SearchableField.tsx +29 -24
- package/src/components/form/inputs/Select/index.test.tsx +1 -1
- package/src/components/form/inputs/Select/index.tsx +95 -65
- package/src/components/form/inputs/TextField.tsx +1 -7
- package/src/components/layout/Footer/index.test.tsx +1 -1
- package/src/components/layout/ServiceFormActions.tsx +3 -3
- package/src/components/layout/ServiceFormContainer/AccordionFormContainer/components/AccordionCollapseControls.tsx +2 -2
- package/src/components/layout/ServiceFormContainer/AccordionFormContainer/index.tsx +2 -2
- package/src/components/layout/ServiceFormContainer/CardFormContainer/index.test.tsx +1 -1
- package/src/components/layout/ServiceWizardStepper/components/DesktopStepper.tsx +2 -1
- package/src/components/layout/ServiceWizardStepper/components/MobileStepper.test.tsx +8 -6
- package/src/components/layout/ServiceWizardStepper/components/MobileStepper.tsx +2 -1
- package/src/components/loaders/FullPageLoader/index.test.tsx +1 -1
- package/src/components/loaders/FullPageLoader/index.tsx +4 -3
- package/src/components/loaders/Loader/index.test.tsx +1 -1
- package/src/components/loaders/Loader/index.tsx +14 -4
- package/src/components/loaders/LoadingSpinner/index.test.tsx +1 -1
- package/src/components/overlays/Dialog/index.test.tsx +1 -1
- package/src/components/overlays/Dialog/index.tsx +7 -5
- package/src/components/overlays/Modal/index.test.tsx +1 -1
- package/src/components/overlays/Modal/index.tsx +4 -2
- package/src/env.tsx +1 -1
- package/src/examples/MultipleStepForm/components/ServiceDetailsForm.tsx +0 -5
- package/src/examples/MultipleStepForm/components/ServiceIssuanceForm.tsx +0 -2
- package/src/examples/MultipleStepForm/components/TermsAndConditionsForm.tsx +2 -2
- package/src/examples/SingleStepForm/components/ObjectIdentifierSearchModal.tsx +12 -8
- package/src/examples/SingleStepForm/index.tsx +0 -2
- package/src/i18n/@mui/x-date-pickers/ltLT.ts +15 -1
- package/src/i18n/namespaces/common/en.json +11 -0
- package/src/i18n/namespaces/common/lt.json +11 -0
- package/src/library/icons.ts +16 -0
- package/src/library/index.ts +3 -0
- package/src/main.tsx +1 -1
- package/src/setupTests.ts +7 -1
- package/src/stories/Colors.mdx +1 -1
- package/src/stories/Welcome.mdx +1 -1
- package/src/stories/assets/Logo.stories.tsx +1 -1
- package/src/stories/components/actions/Button.stories.tsx +2 -2
- package/src/stories/components/actions/ButtonWithPopover.stories.tsx +1 -1
- package/src/stories/components/display/AdvancedList.stories.tsx +529 -0
- package/src/stories/components/display/AdvancedListItem.stories.tsx +653 -0
- package/src/stories/components/display/Badge.stories.tsx +24 -5
- package/src/stories/components/display/Card.stories.tsx +1 -1
- package/src/stories/components/display/ImageCard.stories.tsx +1 -1
- package/src/stories/components/display/ListWithIcons.stories.tsx +1 -1
- package/src/stories/components/display/SegmentedControl.stories.tsx +1 -1
- package/src/stories/components/display/SelectableCardList.stories.tsx +4 -1
- package/src/stories/components/display/Tooltip.stories.tsx +1 -1
- package/src/stories/components/feedback/Alert.stories.tsx +1 -1
- package/src/stories/components/feedback/Snackbar.stories.tsx +1 -1
- package/src/stories/components/form/CardFormContainer.stories.tsx +1 -1
- package/src/stories/components/form/CheckboxFormControl.stories.tsx +1 -1
- package/src/stories/components/form/FormControlWrapper.stories.tsx +1 -1
- package/src/stories/components/form/ServiceFormActions.stories.tsx +1 -1
- package/src/stories/components/form/ServiceFormContainer.stories.tsx +1 -3
- package/src/stories/components/form/SimpleCheckbox.stories.tsx +1 -1
- package/src/stories/components/icons/IconWithCircularBackground.stories.tsx +1 -1
- package/src/stories/components/icons/Icons.stories.tsx +1 -2
- package/src/stories/components/inputs/Checkbox.stories.tsx +1 -2
- package/src/stories/components/inputs/DatePicker.stories.tsx +38 -4
- package/src/stories/components/inputs/FileDropzone.stories.tsx +1 -1
- package/src/stories/components/inputs/FileUpload.stories.tsx +1 -2
- package/src/stories/components/inputs/NumberStepper.stories.tsx +1 -1
- package/src/stories/components/inputs/PhoneInput.stories.tsx +1 -2
- package/src/stories/components/inputs/PhoneInputFormControl.stories.tsx +3 -2
- package/src/stories/components/inputs/RadioButtonGroup.stories.tsx +1 -1
- package/src/stories/components/inputs/SearchInput.stories.tsx +2 -2
- package/src/stories/components/inputs/SearchableField.stories.tsx +1 -1
- package/src/stories/components/inputs/Select.stories.tsx +1 -2
- package/src/stories/components/inputs/Switch.stories.tsx +1 -1
- package/src/stories/components/inputs/TextField.stories.tsx +1 -1
- package/src/stories/components/layout/Footer.stories.tsx +1 -1
- package/src/stories/components/layout/ServiceHeader.stories.tsx +1 -1
- package/src/stories/components/layout/ServicePage.stories.tsx +1 -1
- package/src/stories/components/loaders/FullPageLoader.stories.tsx +1 -1
- package/src/stories/components/loaders/Loader.stories.tsx +1 -1
- package/src/stories/components/loaders/LoadingSpinner.stories.tsx +1 -1
- package/src/stories/components/navigation/Accordion.stories.tsx +1 -2
- package/src/stories/components/navigation/Breadcrumbs.stories.tsx +1 -1
- package/src/stories/components/navigation/DataPagination.stories.tsx +8 -2
- package/src/stories/components/navigation/ServiceWizardStepper.stories.tsx +1 -1
- package/src/stories/components/overlays/Dialog.stories.tsx +35 -1
- package/src/stories/components/overlays/Modal.stories.tsx +1 -1
- package/src/stories/components/overlays/Popover.stories.tsx +65 -0
- package/src/stories/components/tabs/Tab.stories.tsx +12 -1
- package/src/stories/components/tabs/TabPanel.stories.tsx +1 -1
- package/src/stories/components/tabs/Tabs.stories.tsx +1 -1
- package/src/stories/components/tabs/TabsWrapper.stories.tsx +1 -1
- package/src/stories/theme/ThemedMuiComponents.stories.tsx +177 -0
- package/src/theme/light/MuiAlert.tsx +82 -75
- package/src/theme/light/MuiLinearProgress.ts +6 -2
- package/src/theme/light/MuiPickersLayout.ts +4 -4
- package/src/theme/light/MuiTabs.tsx +2 -1
- package/src/theme/motion.tsx +10 -0
- package/src/types/common/ColorType.tsx +1 -7
- package/dist/components/form/inputs/PhoneInputFormControl/components/OuterElementType.d.ts +0 -5
- package/dist/components/form/inputs/PhoneInputFormControl/hooks/useResetCache.d.ts +0 -4
- package/src/components/form/inputs/PhoneInputFormControl/components/OuterElementType.tsx +0 -13
- package/src/components/form/inputs/PhoneInputFormControl/hooks/useResetCache.ts +0 -14
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
import { Box, Collapse, Stack, Typography } from '@mui/material'
|
|
2
|
+
import { useCallback, useEffect, useId, useMemo, useRef } from 'react'
|
|
3
|
+
|
|
4
|
+
import RcSesBadge from '@/components/common/Badge'
|
|
5
|
+
import ListWithIcons from '@/components/common/ListWithIcons'
|
|
6
|
+
import motion from '@/theme/motion'
|
|
7
|
+
import palette from '@/theme/palette'
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
AdvancedListItemLeading as AdvancedListItemLeadingData,
|
|
11
|
+
AdvancedListItemProps,
|
|
12
|
+
AdvancedListItemState,
|
|
13
|
+
} from './AdvancedListItem.types'
|
|
14
|
+
import AdvancedListItemLeading from './components/AdvancedListItemLeading'
|
|
15
|
+
import AdvancedListItemTrailing from './components/AdvancedListItemTrailing'
|
|
16
|
+
import usePrefersReducedMotion from './hooks/usePrefersReducedMotion'
|
|
17
|
+
|
|
18
|
+
const BORDER_RADIUS = '0.5rem'
|
|
19
|
+
const BORDER_WIDTH = '0.0625rem'
|
|
20
|
+
const FOCUS_RING_WIDTH = '0.0625rem'
|
|
21
|
+
|
|
22
|
+
const STATE_BORDER_COLOR: Record<AdvancedListItemState, string> = {
|
|
23
|
+
rest: palette.grey[300],
|
|
24
|
+
selected: palette.primary.main,
|
|
25
|
+
disabled: palette.grey[200],
|
|
26
|
+
error: palette.error.main,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const LEADING_MEDIA_SX = {
|
|
30
|
+
width: '2rem',
|
|
31
|
+
height: '2rem',
|
|
32
|
+
flexShrink: 0,
|
|
33
|
+
display: 'flex',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
justifyContent: 'center',
|
|
36
|
+
} as const
|
|
37
|
+
|
|
38
|
+
const INTERACTIVE_LEADING_TYPES = new Set(['reorder', 'checkbox', 'radio'])
|
|
39
|
+
const INTERACTIVE_TRAILING_TYPES = new Set([
|
|
40
|
+
'actions',
|
|
41
|
+
'toggle',
|
|
42
|
+
'checkbox',
|
|
43
|
+
'radio',
|
|
44
|
+
'stepper',
|
|
45
|
+
])
|
|
46
|
+
|
|
47
|
+
const AdvancedListItem = ({
|
|
48
|
+
title,
|
|
49
|
+
label,
|
|
50
|
+
subtitle,
|
|
51
|
+
metaItems,
|
|
52
|
+
leadingMedia,
|
|
53
|
+
expandedContent,
|
|
54
|
+
expanded = false,
|
|
55
|
+
onExpandedChange,
|
|
56
|
+
leading = { type: 'none' },
|
|
57
|
+
trailing = { type: 'none' },
|
|
58
|
+
state = 'rest',
|
|
59
|
+
onClick,
|
|
60
|
+
}: AdvancedListItemProps) => {
|
|
61
|
+
const isDisabled = state === 'disabled'
|
|
62
|
+
const isSelectable = leading.type === 'checkbox' || leading.type === 'radio'
|
|
63
|
+
const isClickable = (!!onClick || isSelectable) && !isDisabled
|
|
64
|
+
|
|
65
|
+
const hasInteractiveChild =
|
|
66
|
+
INTERACTIVE_LEADING_TYPES.has(leading.type) ||
|
|
67
|
+
INTERACTIVE_TRAILING_TYPES.has(trailing.type) ||
|
|
68
|
+
(trailing.type === 'price' && !!trailing.onDelete)
|
|
69
|
+
|
|
70
|
+
const isRootFocusable = isClickable && !hasInteractiveChild
|
|
71
|
+
const isExpandable = !!expandedContent
|
|
72
|
+
const canAttachExpandToLeading =
|
|
73
|
+
isExpandable && (leading.type === 'radio' || leading.type === 'checkbox')
|
|
74
|
+
const needsRootFocusFallback =
|
|
75
|
+
isExpandable && !canAttachExpandToLeading && !isRootFocusable
|
|
76
|
+
|
|
77
|
+
let rootTabIndex: number | undefined
|
|
78
|
+
if (isRootFocusable) {
|
|
79
|
+
rootTabIndex = 0
|
|
80
|
+
} else if (needsRootFocusFallback) {
|
|
81
|
+
rootTabIndex = -1
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const contentId = useId()
|
|
85
|
+
const titleId = useId()
|
|
86
|
+
const selectorRef = useRef<HTMLInputElement>(null)
|
|
87
|
+
const rootRef = useRef<HTMLDivElement>(null)
|
|
88
|
+
const contentRef = useRef<HTMLDivElement>(null)
|
|
89
|
+
const prefersReducedMotion = usePrefersReducedMotion()
|
|
90
|
+
|
|
91
|
+
const borderColor = STATE_BORDER_COLOR[state]
|
|
92
|
+
const backgroundColor = state === 'selected' ? palette.primary[50] : undefined
|
|
93
|
+
const focusRingShadow = `0 0 0 ${FOCUS_RING_WIDTH} ${palette.primary.main}`
|
|
94
|
+
const transitionTiming = `${motion.duration.standard}ms ${motion.easing.standard}`
|
|
95
|
+
|
|
96
|
+
const leadingWithExpandNotify: AdvancedListItemLeadingData = useMemo(() => {
|
|
97
|
+
if (
|
|
98
|
+
!canAttachExpandToLeading ||
|
|
99
|
+
(leading.type !== 'radio' && leading.type !== 'checkbox')
|
|
100
|
+
) {
|
|
101
|
+
return leading
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
...leading,
|
|
105
|
+
onChange: (checked: boolean) => {
|
|
106
|
+
leading.onChange(checked)
|
|
107
|
+
onExpandedChange?.(checked)
|
|
108
|
+
},
|
|
109
|
+
}
|
|
110
|
+
}, [canAttachExpandToLeading, leading, onExpandedChange])
|
|
111
|
+
|
|
112
|
+
// Runs for every collapse, not just ones driven by the leading control's own onChange —
|
|
113
|
+
// an external trigger (e.g. a parent-level "collapse" action) sets `expanded` directly,
|
|
114
|
+
// bypassing that onChange entirely. Without this, focus is left stranded inside content
|
|
115
|
+
// that's about to become inert.
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
if (!expanded && contentRef.current?.contains(document.activeElement)) {
|
|
118
|
+
if (selectorRef.current) {
|
|
119
|
+
selectorRef.current.focus()
|
|
120
|
+
} else {
|
|
121
|
+
rootRef.current?.focus()
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}, [expanded])
|
|
125
|
+
|
|
126
|
+
const isInsideExpandedContent = useCallback(
|
|
127
|
+
(target: EventTarget | null) => !!contentRef.current?.contains(target as Node),
|
|
128
|
+
[],
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
const activate = useCallback(
|
|
132
|
+
(event: React.SyntheticEvent) => {
|
|
133
|
+
if (isInsideExpandedContent(event.target)) {
|
|
134
|
+
return
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const clickedInputDirectly =
|
|
138
|
+
isSelectable && selectorRef.current?.contains(event.target as Node)
|
|
139
|
+
|
|
140
|
+
if (isSelectable && !clickedInputDirectly) {
|
|
141
|
+
if (
|
|
142
|
+
leadingWithExpandNotify.type === 'checkbox' ||
|
|
143
|
+
leadingWithExpandNotify.type === 'radio'
|
|
144
|
+
) {
|
|
145
|
+
const nextChecked =
|
|
146
|
+
leadingWithExpandNotify.type === 'radio'
|
|
147
|
+
? true
|
|
148
|
+
: !leadingWithExpandNotify.checked
|
|
149
|
+
leadingWithExpandNotify.onChange(nextChecked)
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
onClick?.()
|
|
153
|
+
},
|
|
154
|
+
[isInsideExpandedContent, isSelectable, leadingWithExpandNotify, onClick],
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
const handleRootClick = useCallback(
|
|
158
|
+
(event: React.MouseEvent) => activate(event),
|
|
159
|
+
[activate],
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
const handleRootKeyDown = useCallback(
|
|
163
|
+
(event: React.KeyboardEvent) => {
|
|
164
|
+
if (isInsideExpandedContent(event.target)) {
|
|
165
|
+
return
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
169
|
+
event.preventDefault()
|
|
170
|
+
activate(event)
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
[activate, isInsideExpandedContent],
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
return (
|
|
177
|
+
<Box
|
|
178
|
+
ref={rootRef}
|
|
179
|
+
role={isRootFocusable ? 'button' : undefined}
|
|
180
|
+
tabIndex={rootTabIndex}
|
|
181
|
+
onClick={isClickable ? handleRootClick : undefined}
|
|
182
|
+
onKeyDown={isRootFocusable ? handleRootKeyDown : undefined}
|
|
183
|
+
aria-disabled={isDisabled || undefined}
|
|
184
|
+
sx={{
|
|
185
|
+
display: 'flex',
|
|
186
|
+
flexDirection: 'column',
|
|
187
|
+
gap: '0.75rem',
|
|
188
|
+
width: '100%',
|
|
189
|
+
boxSizing: 'border-box',
|
|
190
|
+
border: `${BORDER_WIDTH} solid`,
|
|
191
|
+
borderColor,
|
|
192
|
+
backgroundColor,
|
|
193
|
+
borderRadius: BORDER_RADIUS,
|
|
194
|
+
padding: '0.5rem 0.75rem',
|
|
195
|
+
opacity: isDisabled ? 0.6 : 1,
|
|
196
|
+
pointerEvents: isDisabled ? 'none' : 'auto',
|
|
197
|
+
cursor: isClickable ? 'pointer' : 'default',
|
|
198
|
+
boxShadow: state === 'selected' ? focusRingShadow : 'none',
|
|
199
|
+
transition: prefersReducedMotion
|
|
200
|
+
? 'none'
|
|
201
|
+
: `border-color ${transitionTiming}, box-shadow ${transitionTiming}`,
|
|
202
|
+
'&:hover': isClickable
|
|
203
|
+
? { borderColor: state === 'rest' ? palette.grey[400] : borderColor }
|
|
204
|
+
: undefined,
|
|
205
|
+
'&:focus-visible, &:focus-within': !isDisabled
|
|
206
|
+
? { borderColor: palette.primary.main, boxShadow: focusRingShadow }
|
|
207
|
+
: undefined,
|
|
208
|
+
}}
|
|
209
|
+
>
|
|
210
|
+
<Stack
|
|
211
|
+
direction='row'
|
|
212
|
+
sx={{
|
|
213
|
+
alignItems: 'flex-start',
|
|
214
|
+
flexWrap: { xs: 'wrap', md: 'nowrap' },
|
|
215
|
+
gap: '0.75rem',
|
|
216
|
+
}}
|
|
217
|
+
>
|
|
218
|
+
{leading.type !== 'none' && (
|
|
219
|
+
<Box sx={{ alignSelf: 'center', order: { xs: -1, md: 0 } }}>
|
|
220
|
+
<AdvancedListItemLeading
|
|
221
|
+
leading={leadingWithExpandNotify}
|
|
222
|
+
disabled={isDisabled}
|
|
223
|
+
inputRef={canAttachExpandToLeading ? selectorRef : undefined}
|
|
224
|
+
expandableId={canAttachExpandToLeading ? contentId : undefined}
|
|
225
|
+
expanded={canAttachExpandToLeading ? expanded : undefined}
|
|
226
|
+
titleId={titleId}
|
|
227
|
+
/>
|
|
228
|
+
</Box>
|
|
229
|
+
)}
|
|
230
|
+
|
|
231
|
+
<Box
|
|
232
|
+
sx={{
|
|
233
|
+
display: 'flex',
|
|
234
|
+
flexDirection: 'row',
|
|
235
|
+
alignItems: 'flex-start',
|
|
236
|
+
gap: '0.75rem',
|
|
237
|
+
minWidth: 0,
|
|
238
|
+
flex: {
|
|
239
|
+
xs: trailing.type !== 'none' ? '1 1 100%' : '1 1 0%',
|
|
240
|
+
md: '1 1 0%',
|
|
241
|
+
},
|
|
242
|
+
alignSelf: subtitle ? undefined : 'center',
|
|
243
|
+
}}
|
|
244
|
+
>
|
|
245
|
+
{!!leadingMedia && <Box sx={LEADING_MEDIA_SX}>{leadingMedia}</Box>}
|
|
246
|
+
|
|
247
|
+
<Box
|
|
248
|
+
sx={{
|
|
249
|
+
flex: 1,
|
|
250
|
+
minWidth: 0,
|
|
251
|
+
display: 'flex',
|
|
252
|
+
flexDirection: 'column',
|
|
253
|
+
gap: '0.25rem',
|
|
254
|
+
}}
|
|
255
|
+
>
|
|
256
|
+
<Stack
|
|
257
|
+
direction='row'
|
|
258
|
+
sx={{
|
|
259
|
+
alignItems: 'center',
|
|
260
|
+
flexWrap: 'wrap',
|
|
261
|
+
gap: '0.5rem',
|
|
262
|
+
alignSelf: 'stretch',
|
|
263
|
+
}}
|
|
264
|
+
>
|
|
265
|
+
<Typography
|
|
266
|
+
id={titleId}
|
|
267
|
+
variant='h3'
|
|
268
|
+
sx={{ fontSize: '1rem', fontWeight: 600, lineHeight: '1.375rem' }}
|
|
269
|
+
color={palette.grey[900]}
|
|
270
|
+
>
|
|
271
|
+
{title}
|
|
272
|
+
</Typography>
|
|
273
|
+
{!!label && <RcSesBadge label={label} variant='neutral' size='small' />}
|
|
274
|
+
</Stack>
|
|
275
|
+
|
|
276
|
+
{!!subtitle && (
|
|
277
|
+
<Typography
|
|
278
|
+
variant='body2'
|
|
279
|
+
sx={{ fontSize: '0.875rem', fontWeight: 400, lineHeight: '1.25rem' }}
|
|
280
|
+
color={palette.grey[600]}
|
|
281
|
+
>
|
|
282
|
+
{subtitle}
|
|
283
|
+
</Typography>
|
|
284
|
+
)}
|
|
285
|
+
|
|
286
|
+
{!!metaItems?.length && (
|
|
287
|
+
<ListWithIcons items={metaItems} layout='horizontal' />
|
|
288
|
+
)}
|
|
289
|
+
</Box>
|
|
290
|
+
</Box>
|
|
291
|
+
|
|
292
|
+
{trailing.type !== 'none' && (
|
|
293
|
+
<Box
|
|
294
|
+
sx={{
|
|
295
|
+
alignSelf: 'center',
|
|
296
|
+
order: leading.type !== 'none' ? { xs: -1, md: 0 } : 0,
|
|
297
|
+
marginLeft: leading.type !== 'none' ? { xs: 'auto', md: 0 } : 0,
|
|
298
|
+
}}
|
|
299
|
+
>
|
|
300
|
+
<AdvancedListItemTrailing trailing={trailing} disabled={isDisabled} />
|
|
301
|
+
</Box>
|
|
302
|
+
)}
|
|
303
|
+
</Stack>
|
|
304
|
+
{isExpandable && (
|
|
305
|
+
<Collapse
|
|
306
|
+
in={expanded}
|
|
307
|
+
timeout={prefersReducedMotion ? 0 : motion.duration.standard}
|
|
308
|
+
easing={motion.easing.standard}
|
|
309
|
+
>
|
|
310
|
+
<Box
|
|
311
|
+
ref={contentRef}
|
|
312
|
+
id={contentId}
|
|
313
|
+
sx={{
|
|
314
|
+
marginLeft: leading.type !== 'none' ? { xs: 0, md: '2rem' } : 0,
|
|
315
|
+
backgroundColor: palette.grey[50],
|
|
316
|
+
borderRadius: BORDER_RADIUS,
|
|
317
|
+
padding: '0.75rem 1rem',
|
|
318
|
+
}}
|
|
319
|
+
{...({
|
|
320
|
+
inert: expanded ? undefined : '',
|
|
321
|
+
} as React.HTMLAttributes<HTMLDivElement>)}
|
|
322
|
+
>
|
|
323
|
+
{expandedContent}
|
|
324
|
+
</Box>
|
|
325
|
+
</Collapse>
|
|
326
|
+
)}
|
|
327
|
+
</Box>
|
|
328
|
+
)
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
export default AdvancedListItem
|
|
332
|
+
export type { AdvancedListItemProps }
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { useMediaQuery } from '@mui/material'
|
|
2
|
+
import { ThemeProvider } from '@mui/material/styles'
|
|
3
|
+
import { fireEvent, render, screen } from '@testing-library/react'
|
|
4
|
+
import { type ReactElement } from 'react'
|
|
5
|
+
import { beforeEach, describe, expect, test, vi } from 'vitest'
|
|
6
|
+
|
|
7
|
+
import theme from '@/theme/light'
|
|
8
|
+
|
|
9
|
+
import AdvancedList, { type AdvancedListItemData } from '.'
|
|
10
|
+
|
|
11
|
+
vi.mock('@mui/material', async () => {
|
|
12
|
+
const actual = await vi.importActual<typeof import('@mui/material')>('@mui/material')
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
...actual,
|
|
16
|
+
useMediaQuery: vi.fn(() => false),
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const mockedUseMediaQuery = vi.mocked(useMediaQuery)
|
|
21
|
+
|
|
22
|
+
beforeEach(() => {
|
|
23
|
+
mockedUseMediaQuery.mockReturnValue(false)
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
const renderList = (ui: ReactElement) =>
|
|
27
|
+
render(<ThemeProvider theme={theme}>{ui}</ThemeProvider>)
|
|
28
|
+
|
|
29
|
+
const makeItems = (count: number): AdvancedListItemData[] =>
|
|
30
|
+
Array.from({ length: count }, (_, i) => ({
|
|
31
|
+
id: `item-${i + 1}`,
|
|
32
|
+
title: `Item ${i + 1}`,
|
|
33
|
+
subtitle: `Subtitle ${i + 1}`,
|
|
34
|
+
}))
|
|
35
|
+
|
|
36
|
+
describe('AdvancedList', () => {
|
|
37
|
+
test('renders all items on the first page when count <= page size', () => {
|
|
38
|
+
renderList(<AdvancedList items={makeItems(3)} />)
|
|
39
|
+
|
|
40
|
+
expect(screen.getByText('Item 1')).toBeInTheDocument()
|
|
41
|
+
expect(screen.getByText('Item 2')).toBeInTheDocument()
|
|
42
|
+
expect(screen.getByText('Item 3')).toBeInTheDocument()
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
test('shows only 5 items per page', () => {
|
|
46
|
+
renderList(<AdvancedList items={makeItems(8)} />)
|
|
47
|
+
|
|
48
|
+
expect(screen.getByText('Item 1')).toBeInTheDocument()
|
|
49
|
+
expect(screen.getByText('Item 5')).toBeInTheDocument()
|
|
50
|
+
expect(screen.queryByText('Item 6')).not.toBeInTheDocument()
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
test('navigating to next page shows the next set of items', () => {
|
|
54
|
+
renderList(<AdvancedList items={makeItems(8)} />)
|
|
55
|
+
|
|
56
|
+
fireEvent.click(screen.getByRole('button', { name: 'Kitas' }))
|
|
57
|
+
|
|
58
|
+
expect(screen.getByText('Item 6')).toBeInTheDocument()
|
|
59
|
+
expect(screen.getByText('Item 7')).toBeInTheDocument()
|
|
60
|
+
expect(screen.getByText('Item 8')).toBeInTheDocument()
|
|
61
|
+
expect(screen.queryByText('Item 1')).not.toBeInTheDocument()
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
test("passes each item's own leading/trailing/expanded config through to AdvancedListItem", () => {
|
|
65
|
+
const onChange = vi.fn()
|
|
66
|
+
|
|
67
|
+
renderList(
|
|
68
|
+
<AdvancedList
|
|
69
|
+
items={[
|
|
70
|
+
{
|
|
71
|
+
id: 'radio-item',
|
|
72
|
+
title: 'Savininkas juridinis asmuo',
|
|
73
|
+
leading: { type: 'radio', checked: true, onChange },
|
|
74
|
+
expanded: true,
|
|
75
|
+
expandedContent: <input aria-label='Įmonės kodas' />,
|
|
76
|
+
},
|
|
77
|
+
]}
|
|
78
|
+
/>,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
expect(screen.getByRole('radio')).toBeChecked()
|
|
82
|
+
expect(screen.getByLabelText('Įmonės kodas')).toBeInTheDocument()
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
test('renders error node and hides the list when error is provided', () => {
|
|
86
|
+
renderList(<AdvancedList items={makeItems(3)} error={<p>Something went wrong</p>} />)
|
|
87
|
+
|
|
88
|
+
expect(screen.getByText('Something went wrong')).toBeInTheDocument()
|
|
89
|
+
expect(screen.queryByText('Item 1')).not.toBeInTheDocument()
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
test('does not render pagination controls when everything fits on one page', () => {
|
|
93
|
+
renderList(<AdvancedList items={makeItems(2)} />)
|
|
94
|
+
|
|
95
|
+
expect(screen.queryByRole('button', { name: 'Kitas' })).not.toBeInTheDocument()
|
|
96
|
+
})
|
|
97
|
+
})
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Box, Container } from '@mui/material'
|
|
2
|
+
import { ReactNode, useState } from 'react'
|
|
3
|
+
|
|
4
|
+
import DataPagination from '@/components/common/DataPagination'
|
|
5
|
+
|
|
6
|
+
import AdvancedListItem, {
|
|
7
|
+
type AdvancedListItemProps,
|
|
8
|
+
} from './components/AdvancedListItem'
|
|
9
|
+
|
|
10
|
+
export type AdvancedListItemData = AdvancedListItemProps & { id: string }
|
|
11
|
+
|
|
12
|
+
export interface AdvancedListProps {
|
|
13
|
+
items: AdvancedListItemData[]
|
|
14
|
+
error?: ReactNode
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const PAGE_SIZE = 5
|
|
18
|
+
|
|
19
|
+
const AdvancedList = ({ items, error }: AdvancedListProps) => {
|
|
20
|
+
const [page, setPage] = useState(1)
|
|
21
|
+
|
|
22
|
+
if (error != null) {
|
|
23
|
+
return (
|
|
24
|
+
<Container disableGutters sx={{ display: 'flex', justifyContent: 'center' }}>
|
|
25
|
+
{error}
|
|
26
|
+
</Container>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const totalPages = Math.ceil(items.length / PAGE_SIZE)
|
|
31
|
+
const currentPage = totalPages > 0 ? Math.min(page, totalPages) : 1
|
|
32
|
+
const startIndex = (currentPage - 1) * PAGE_SIZE
|
|
33
|
+
const pagedItems = items.slice(startIndex, startIndex + PAGE_SIZE)
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Container
|
|
37
|
+
disableGutters
|
|
38
|
+
sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: '1rem' }}
|
|
39
|
+
>
|
|
40
|
+
<Box
|
|
41
|
+
sx={{ display: 'flex', flexDirection: 'column', gap: '0.625rem', width: '100%' }}
|
|
42
|
+
>
|
|
43
|
+
{pagedItems.map(({ id, ...itemProps }) => (
|
|
44
|
+
<AdvancedListItem key={id} {...itemProps} />
|
|
45
|
+
))}
|
|
46
|
+
</Box>
|
|
47
|
+
<DataPagination count={totalPages} page={currentPage} onChange={setPage} />
|
|
48
|
+
</Container>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export default AdvancedList
|
|
@@ -6,7 +6,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
|
6
6
|
import i18n from '@/i18n/i18n'
|
|
7
7
|
import theme from '@/theme/light'
|
|
8
8
|
|
|
9
|
-
import RcSesBadge from '
|
|
9
|
+
import RcSesBadge from '.'
|
|
10
10
|
|
|
11
11
|
const getCloseAriaLabel = (label: string) =>
|
|
12
12
|
i18n.t('components.RcSesBadge.aria.close', { label, ns: 'input' })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fireEvent, render, screen } from '@testing-library/react'
|
|
2
2
|
import { describe, expect, it, vi } from 'vitest'
|
|
3
3
|
|
|
4
|
-
import Button from '
|
|
4
|
+
import Button from '.'
|
|
5
5
|
|
|
6
6
|
describe('Button Component', () => {
|
|
7
7
|
describe('Loading State', () => {
|
|
@@ -128,7 +128,10 @@ describe('Button Component', () => {
|
|
|
128
128
|
render(<Button variant='text'>Save</Button>)
|
|
129
129
|
|
|
130
130
|
const button = screen.getByRole('button')
|
|
131
|
-
|
|
131
|
+
// MUI 9 removed the combined variant+colour classes: MuiButton-textPrimary
|
|
132
|
+
// is now expressed as MuiButton-text plus MuiButton-colorPrimary.
|
|
133
|
+
expect(button).toHaveClass('MuiButton-text')
|
|
134
|
+
expect(button).toHaveClass('MuiButton-colorPrimary')
|
|
132
135
|
})
|
|
133
136
|
})
|
|
134
137
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Button as MuiButton, ButtonProps as MuiButtonProps } from '@mui/material'
|
|
2
|
+
import type { ButtonTypeMap } from '@mui/material/Button'
|
|
3
|
+
import type { ExtendButtonBase } from '@mui/material/ButtonBase'
|
|
2
4
|
import { useTranslation } from 'react-i18next'
|
|
3
5
|
|
|
4
6
|
import RcSesLoadingSpinner, { getSpinnerColor } from '@/components/loaders/LoadingSpinner'
|
|
@@ -16,12 +18,18 @@ const ICON_ONLY_SIZE_MAP = {
|
|
|
16
18
|
large: '3rem',
|
|
17
19
|
} as const
|
|
18
20
|
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
// MUI 6 added a native `loading` prop (`boolean | null`, alongside
|
|
22
|
+
// `loadingIndicator` and `loadingPosition`), so it no longer needs declaring
|
|
23
|
+
// here - re-declaring it as `boolean` conflicted with MUI's nullable type at
|
|
24
|
+
// every call site that spreads ButtonProps.
|
|
25
|
+
//
|
|
26
|
+
// Behaviour is unchanged: `loading` is still destructured out below and drives
|
|
27
|
+
// the custom RcSesLoadingSpinner, so it never reaches MuiButton and the native
|
|
28
|
+
// indicator stays inactive. Switching over to MUI's implementation is a
|
|
29
|
+
// breaking change, tracked as SAV-5916.
|
|
30
|
+
type Props = ButtonProps
|
|
23
31
|
|
|
24
|
-
function
|
|
32
|
+
function RcSesButtonComponent(props: Props) {
|
|
25
33
|
const { t } = useTranslation('common')
|
|
26
34
|
const {
|
|
27
35
|
children,
|
|
@@ -91,4 +99,16 @@ function RcSesButton(props: Props) {
|
|
|
91
99
|
)
|
|
92
100
|
}
|
|
93
101
|
|
|
102
|
+
/**
|
|
103
|
+
* Declared the way MUI declares its own `Button`, rather than as a plain
|
|
104
|
+
* function component. `component={Link}` has to bring the target component's
|
|
105
|
+
* props with it - without this, `<RcSesButton component={Link} to='/x' />` fails
|
|
106
|
+
* with "Property 'to' does not exist", which is how ~38 call sites in `ses-ui`
|
|
107
|
+
* were compiling against 1.x (it declared a bare `to?: string`, which allowed
|
|
108
|
+
* `to` even when no `component` was given).
|
|
109
|
+
*/
|
|
110
|
+
const RcSesButton = RcSesButtonComponent as ExtendButtonBase<
|
|
111
|
+
ButtonTypeMap<{ iconOnly?: boolean }>
|
|
112
|
+
>
|
|
113
|
+
|
|
94
114
|
export default RcSesButton
|
|
@@ -4,8 +4,8 @@ import { render, screen } from '@testing-library/react'
|
|
|
4
4
|
import { type ReactElement } from 'react'
|
|
5
5
|
import { describe, expect, test } from 'vitest'
|
|
6
6
|
|
|
7
|
+
import RcSesCard from '.'
|
|
7
8
|
import theme from '../../../theme/light'
|
|
8
|
-
import RcSesCard from './index'
|
|
9
9
|
|
|
10
10
|
const renderCard = (ui: ReactElement) =>
|
|
11
11
|
render(<ThemeProvider theme={theme}>{ui}</ThemeProvider>)
|
|
@@ -6,7 +6,7 @@ import { beforeEach, describe, expect, test, vi } from 'vitest'
|
|
|
6
6
|
|
|
7
7
|
import theme from '@/theme/light'
|
|
8
8
|
|
|
9
|
-
import DataPagination from '
|
|
9
|
+
import DataPagination from '.'
|
|
10
10
|
|
|
11
11
|
vi.mock('@mui/material', async () => {
|
|
12
12
|
const actual = await vi.importActual<typeof import('@mui/material')>('@mui/material')
|
|
@@ -45,7 +45,13 @@ const DataPagination = ({
|
|
|
45
45
|
|
|
46
46
|
if (isLoading) {
|
|
47
47
|
return (
|
|
48
|
-
<Box
|
|
48
|
+
<Box
|
|
49
|
+
sx={{
|
|
50
|
+
display: 'flex',
|
|
51
|
+
alignItems: 'center',
|
|
52
|
+
gap: 1,
|
|
53
|
+
}}
|
|
54
|
+
>
|
|
49
55
|
<DataPaginationSkeleton isMobile={isMobile} />
|
|
50
56
|
</Box>
|
|
51
57
|
)
|
|
@@ -58,7 +64,13 @@ const DataPagination = ({
|
|
|
58
64
|
}
|
|
59
65
|
|
|
60
66
|
return (
|
|
61
|
-
<Box
|
|
67
|
+
<Box
|
|
68
|
+
sx={{
|
|
69
|
+
display: 'flex',
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
gap: 1,
|
|
72
|
+
}}
|
|
73
|
+
>
|
|
62
74
|
<>
|
|
63
75
|
<PaginationButton
|
|
64
76
|
onClick={() => handlePageChange(currentPage - 1)}
|
|
@@ -4,8 +4,8 @@ import { render, screen } from '@testing-library/react'
|
|
|
4
4
|
import { type ReactElement } from 'react'
|
|
5
5
|
import { describe, expect, test } from 'vitest'
|
|
6
6
|
|
|
7
|
+
import RcSesImageCard from '.'
|
|
7
8
|
import theme from '../../../theme/light'
|
|
8
|
-
import RcSesImageCard from './index'
|
|
9
9
|
|
|
10
10
|
const renderCard = (ui: ReactElement) =>
|
|
11
11
|
render(<ThemeProvider theme={theme}>{ui}</ThemeProvider>)
|
|
@@ -5,7 +5,7 @@ import { describe, expect, test } from 'vitest'
|
|
|
5
5
|
|
|
6
6
|
import theme from '@/theme/light'
|
|
7
7
|
|
|
8
|
-
import ListWithIcons from '
|
|
8
|
+
import ListWithIcons from '.'
|
|
9
9
|
|
|
10
10
|
const renderListWithIcons = (ui: ReactElement) =>
|
|
11
11
|
render(<ThemeProvider theme={theme}>{ui}</ThemeProvider>)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fireEvent, render, screen } from '@testing-library/react'
|
|
2
2
|
import { describe, expect, test, vi } from 'vitest'
|
|
3
3
|
|
|
4
|
-
import RcSesSegmentButton, { type RcSesSegmentOption } from '
|
|
4
|
+
import RcSesSegmentButton, { type RcSesSegmentOption } from '.'
|
|
5
5
|
|
|
6
6
|
describe('RcSesSegmentButton', () => {
|
|
7
7
|
const defaultOption: RcSesSegmentOption = {
|
|
@@ -63,9 +63,11 @@ const RcSesSegmentButton = React.forwardRef<HTMLButtonElement, RcSesSegmentButto
|
|
|
63
63
|
wordBreak: 'break-word',
|
|
64
64
|
fontFamily: '"Public Sans", sans-serif !important',
|
|
65
65
|
border: `2px solid ${isFocused && !isDisabled ? primary['500'] : 'transparent'}`,
|
|
66
|
+
|
|
66
67
|
backgroundColor: isSelected
|
|
67
68
|
? `${primary['50']} !important`
|
|
68
69
|
: 'transparent !important',
|
|
70
|
+
|
|
69
71
|
color: textColor,
|
|
70
72
|
cursor: isDisabled ? 'not-allowed' : 'pointer',
|
|
71
73
|
fontWeight: 500,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fireEvent, render, screen } from '@testing-library/react'
|
|
2
2
|
import { describe, expect, test, vi } from 'vitest'
|
|
3
3
|
|
|
4
|
-
import RcSesSegmentedControl, { type RcSesSegmentOption } from '
|
|
4
|
+
import RcSesSegmentedControl, { type RcSesSegmentOption } from '.'
|
|
5
5
|
|
|
6
6
|
describe('RcSesSegmentedControl', () => {
|
|
7
7
|
const options: RcSesSegmentOption[] = [
|