@registrucentras/rc-ses-react-components 2.7.3 → 3.0.0-rc.0
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/phosphorIcons.d.ts +4 -0
- package/dist/components/common/Accordion/hooks/useAccordionController.d.ts +2 -1
- package/dist/components/common/Accordion/index.d.ts +18 -4
- package/dist/components/common/Accordion/types/AccordionControllerState.d.ts +1 -0
- package/dist/components/common/Card/index.d.ts +3 -0
- package/dist/components/common/CheckboxMark/index.d.ts +8 -0
- package/dist/components/common/DataPagination/components/ExpandButton.d.ts +7 -0
- package/dist/components/common/DataPagination/components/PaginationButton.d.ts +2 -1
- package/dist/components/common/DataPagination/index.d.ts +13 -3
- package/dist/components/common/DataPagination/paginationModel.d.ts +4 -0
- package/dist/components/common/Divider/index.d.ts +6 -0
- package/dist/components/common/EmptyState/index.d.ts +21 -0
- package/dist/components/common/IconWithSquareBackground/index.d.ts +2 -2
- package/dist/components/common/ImageCard/index.d.ts +5 -0
- package/dist/components/common/LinkTile/index.d.ts +11 -0
- package/dist/components/common/RadioMark/index.d.ts +8 -0
- package/dist/components/common/StepCard/StepCardFooter/index.d.ts +1 -1
- package/dist/components/common/TitleBlock/types.d.ts +4 -2
- package/dist/components/form/components/FormControlWrapper/index.d.ts +2 -1
- package/dist/components/form/inputs/Datepicker/RangeDatepicker.d.ts +23 -0
- package/dist/components/form/inputs/Datepicker/SingleDatepicker.d.ts +24 -0
- package/dist/components/form/inputs/Datepicker/components/CalendarViewsHeader.d.ts +18 -0
- package/dist/components/form/inputs/Datepicker/index.d.ts +10 -14
- package/dist/components/form/inputs/Datepicker/rangeModel.d.ts +4 -0
- package/dist/components/form/inputs/FileDropzone.d.ts +2 -2
- package/dist/components/form/inputs/RadioButtonGroup.d.ts +1 -0
- package/dist/components/form/inputs/Select/Select.styles.d.ts +84 -0
- package/dist/components/form/inputs/Select/components/OptionCheckbox.d.ts +2 -1
- package/dist/components/form/inputs/TextField.d.ts +27 -12
- package/dist/components/form/inputs/TextField.styles.d.ts +101 -0
- package/dist/components/layout/ServiceWizardStepper/stepperTokens.d.ts +5 -0
- package/dist/components/loaders/Loader/index.d.ts +12 -9
- package/dist/components/overlays/BottomSheet/index.d.ts +3 -2
- package/dist/components/overlays/Dialog/index.d.ts +1 -1
- package/dist/components/storybook/FileUploadTokenPreview.d.ts +4 -0
- package/dist/components/storybook/TabsTokenPreview.d.ts +3 -0
- package/dist/components/storybook/TokenDocs.d.ts +74 -0
- package/dist/library/index.d.ts +30 -1
- package/dist/registrucentras-rc-ses-react-components.cjs +2 -2
- package/dist/registrucentras-rc-ses-react-components.js +11143 -8378
- package/dist/theme/backdropTokens.d.ts +6 -0
- package/dist/theme/borderTokens.d.ts +33 -0
- package/dist/theme/cards.d.ts +42 -73
- package/dist/theme/colorTokens.d.ts +146 -0
- package/dist/theme/effectTokens.d.ts +9 -0
- package/dist/theme/layoutTokens.d.ts +12 -0
- package/dist/theme/light/MuiAccordion.d.ts +2 -2
- package/dist/theme/light/MuiAccordionSummary.d.ts +19 -0
- package/dist/theme/light/MuiButton.d.ts +7 -0
- package/dist/theme/light/MuiInputBase.d.ts +2 -0
- package/dist/theme/light/MuiPickerPopper.d.ts +3 -0
- package/dist/theme/light/MuiTypography.d.ts +0 -14
- package/dist/theme/palette.d.ts +8 -0
- package/dist/theme/sizeTokens.d.ts +20 -0
- package/dist/theme/spacingRoleBasedTokens.d.ts +38 -0
- package/dist/theme/spacingTokens.d.ts +97 -0
- package/dist/theme/tokenTheme.d.ts +13 -0
- package/dist/theme/typographyTokens.d.ts +104 -0
- package/package.json +2 -2
- package/src/assets/icons/phosphorIcons.ts +1 -0
- package/src/components/common/Accordion/hooks/useAccordionController.tsx +39 -7
- package/src/components/common/Accordion/index.test.tsx +132 -0
- package/src/components/common/Accordion/index.tsx +302 -25
- package/src/components/common/Accordion/types/AccordionControllerState.ts +1 -0
- package/src/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemLeading.tsx +3 -3
- package/src/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemTrailing.tsx +8 -3
- package/src/components/common/AdvancedList/components/AdvancedListItem/index.tsx +3 -2
- package/src/components/common/AdvancedList/components/AdvancedListItemShell/index.test.tsx +3 -3
- package/src/components/common/AdvancedList/components/AdvancedListItemShell/index.tsx +23 -19
- package/src/components/common/AdvancedList/index.test.tsx +4 -2
- package/src/components/common/Alert/index.tsx +10 -6
- package/src/components/common/Badge/index.tsx +50 -37
- package/src/components/common/Button/index.tsx +12 -10
- package/src/components/common/Card/index.tsx +6 -1
- package/src/components/common/CardShell/index.test.tsx +16 -6
- package/src/components/common/CheckboxMark/index.tsx +86 -0
- package/src/components/common/DataPagination/components/DataPaginationSkeleton.tsx +9 -7
- package/src/components/common/DataPagination/components/ExpandButton.tsx +48 -0
- package/src/components/common/DataPagination/components/PaginationButton.tsx +48 -21
- package/src/components/common/DataPagination/index.test.tsx +229 -12
- package/src/components/common/DataPagination/index.tsx +135 -60
- package/src/components/common/DataPagination/paginationModel.ts +35 -0
- package/src/components/common/Divider/index.test.tsx +33 -0
- package/src/components/common/Divider/index.tsx +52 -0
- package/src/components/common/EmptyState/index.test.tsx +56 -0
- package/src/components/common/EmptyState/index.tsx +211 -0
- package/src/components/common/FilterChip/index.tsx +24 -19
- package/src/components/common/IconWithCircularBackground.tsx +24 -6
- package/src/components/common/IconWithSquareBackground/index.test.tsx +14 -2
- package/src/components/common/IconWithSquareBackground/index.tsx +36 -17
- package/src/components/common/ImageCard/index.test.tsx +16 -0
- package/src/components/common/ImageCard/index.tsx +54 -1
- package/src/components/common/LinkTile/index.test.tsx +57 -0
- package/src/components/common/LinkTile/index.tsx +136 -0
- package/src/components/common/ListWithIcons/components/ListWithIconsItem.tsx +39 -23
- package/src/components/common/ListWithIcons/index.test.tsx +20 -9
- package/src/components/common/ListWithIcons/index.tsx +6 -6
- package/src/components/common/Popover/index.tsx +11 -1
- package/src/components/common/RadioMark/index.tsx +76 -0
- package/src/components/common/SegmentedControl/components/SegmentButton/index.tsx +49 -25
- package/src/components/common/SegmentedControl/index.tsx +10 -6
- package/src/components/common/SelectableCardList/components/SelectableCardListItem.tsx +7 -5
- package/src/components/common/SelectableCardList/index.test.tsx +8 -6
- package/src/components/common/SelectionMarks.test.tsx +92 -0
- package/src/components/common/ServiceLinks/ServiceLinkItem/index.tsx +20 -11
- package/src/components/common/ServiceLinks/index.tsx +3 -3
- package/src/components/common/SideNav/SideNavLayout.tsx +6 -1
- package/src/components/common/SideNav/components/SideNavPill.tsx +24 -12
- package/src/components/common/SideNav/components/SideNavPillList.tsx +18 -12
- package/src/components/common/SideNav/components/SideNavRow.tsx +22 -15
- package/src/components/common/SideNav/index.tsx +10 -9
- package/src/components/common/Snackbar/config.ts +27 -8
- package/src/components/common/Snackbar/index.tsx +39 -16
- package/src/components/common/StepCard/StepCardFooter/index.tsx +28 -6
- package/src/components/common/StepCard/index.tsx +18 -6
- package/src/components/common/Switch/index.tsx +10 -4
- package/src/components/common/Tabs/TabPanel.tsx +6 -3
- package/src/components/common/Tabs/TabsWrapper.tsx +15 -7
- package/src/components/common/TitleBlock/index.test.tsx +14 -17
- package/src/components/common/TitleBlock/index.tsx +120 -15
- package/src/components/common/TitleBlock/types.ts +4 -2
- package/src/components/common/Tooltip/index.tsx +32 -3
- package/src/components/form/components/FormControlWrapper/index.tsx +43 -14
- package/src/components/form/inputs/CheckboxFormControl.tsx +25 -13
- package/src/components/form/inputs/Datepicker/RangeDatepicker.tsx +356 -0
- package/src/components/form/inputs/Datepicker/SingleDatepicker.tsx +207 -0
- package/src/components/form/inputs/Datepicker/components/CalendarViewsHeader.tsx +335 -0
- package/src/components/form/inputs/Datepicker/components/RcSesDatepickerCalendarHeader.tsx +22 -10
- package/src/components/form/inputs/Datepicker/index.test.tsx +23 -18
- package/src/components/form/inputs/Datepicker/index.tsx +20 -150
- package/src/components/form/inputs/Datepicker/rangeModel.test.ts +35 -0
- package/src/components/form/inputs/Datepicker/rangeModel.ts +25 -0
- package/src/components/form/inputs/FileDropzone.tsx +73 -46
- package/src/components/form/inputs/FileUpload.tsx +25 -16
- package/src/components/form/inputs/NumberStepper.tsx +36 -14
- package/src/components/form/inputs/PhoneInputFormControl/components/AutocompleteInput.tsx +10 -5
- package/src/components/form/inputs/PhoneInputFormControl/components/ListboxComponent.tsx +7 -1
- package/src/components/form/inputs/PhoneInputFormControl/components/PopperComponent.tsx +5 -2
- package/src/components/form/inputs/PhoneInputFormControl/components/RowComponent.tsx +9 -5
- package/src/components/form/inputs/PhoneInputFormControl/index.tsx +48 -24
- package/src/components/form/inputs/RadioButtonGroup.tsx +14 -6
- package/src/components/form/inputs/Select/Select.styles.ts +76 -0
- package/src/components/form/inputs/Select/components/OptionCheckbox.tsx +6 -33
- package/src/components/form/inputs/Select/index.tsx +124 -86
- package/src/components/form/inputs/SimpleCheckbox.tsx +10 -3
- package/src/components/form/inputs/TextField.presets.test.tsx +284 -0
- package/src/components/form/inputs/TextField.styles.ts +96 -0
- package/src/components/form/inputs/TextField.test.tsx +153 -0
- package/src/components/form/inputs/TextField.tsx +315 -42
- package/src/components/layout/Footer/index.test.tsx +1 -1
- package/src/components/layout/Footer/index.tsx +17 -7
- package/src/components/layout/ServiceFormActions.tsx +5 -1
- package/src/components/layout/ServiceFormContainer/AccordionFormContainer/index.tsx +3 -3
- package/src/components/layout/ServiceHeader.tsx +19 -19
- package/src/components/layout/ServiceWizardStepper/ServiceWizardStepper.css +10 -10
- package/src/components/layout/ServiceWizardStepper/StepConnector.tsx +8 -5
- package/src/components/layout/ServiceWizardStepper/components/CustomStepIcon.tsx +22 -7
- package/src/components/layout/ServiceWizardStepper/components/HorizontalStepperButton.tsx +15 -11
- package/src/components/layout/ServiceWizardStepper/components/StyledStepLabel.tsx +28 -11
- package/src/components/layout/ServiceWizardStepper/stepperTokens.ts +8 -0
- package/src/components/loaders/FullPageLoader/index.test.tsx +18 -7
- package/src/components/loaders/FullPageLoader/index.tsx +14 -9
- package/src/components/loaders/Loader/index.tsx +48 -17
- package/src/components/overlays/BottomSheet/index.test.tsx +36 -3
- package/src/components/overlays/BottomSheet/index.tsx +54 -21
- package/src/components/overlays/Dialog/index.tsx +5 -23
- package/src/components/overlays/Drawer/index.tsx +29 -14
- package/src/components/overlays/Modal/index.tsx +46 -8
- package/src/components/storybook/FileUploadTokenPreview.tsx +68 -0
- package/src/components/storybook/TabsTokenPreview.tsx +58 -0
- package/src/components/storybook/TokenDocs.tsx +347 -0
- package/src/examples/MultipleStepForm/components/TermsAndConditionsForm.tsx +5 -1
- package/src/i18n/namespaces/input/en.json +48 -4
- package/src/i18n/namespaces/input/lt.json +48 -4
- package/src/library/index.ts +50 -0
- package/src/stories/atoms/Badge.stories.tsx +2 -1
- package/src/stories/atoms/Button.stories.tsx +124 -6
- package/src/stories/atoms/CheckboxMark.stories.tsx +79 -0
- package/src/stories/atoms/Divider.stories.tsx +129 -0
- package/src/stories/atoms/FilterChip.stories.tsx +9 -1
- package/src/stories/atoms/IconWithSquareBackground.stories.tsx +7 -7
- package/src/stories/atoms/Icons.stories.tsx +1 -1
- package/src/stories/atoms/NumberStepper.stories.tsx +44 -0
- package/src/stories/atoms/PhoneInput.stories.tsx +42 -0
- package/src/stories/atoms/RadioMark.stories.tsx +132 -0
- package/src/stories/atoms/Select.stories.tsx +139 -2
- package/src/stories/atoms/SimpleCheckbox.stories.tsx +74 -0
- package/src/stories/atoms/Switch.stories.tsx +46 -1
- package/src/stories/atoms/TextField.stories.tsx +508 -0
- package/src/stories/atoms/Tooltip.stories.tsx +5 -0
- package/src/stories/fixtures/foundations/Borders.stories.tsx +84 -0
- package/src/stories/fixtures/foundations/Effects.stories.tsx +204 -0
- package/src/stories/fixtures/foundations/Layout.stories.tsx +76 -0
- package/src/stories/fixtures/foundations/Sizes.stories.tsx +42 -0
- package/src/stories/fixtures/foundations/Spacing.stories.tsx +48 -0
- package/src/stories/fixtures/foundations/Typography.stories.tsx +49 -0
- package/src/stories/foundations/Borders.stories.tsx +179 -0
- package/src/stories/foundations/Colors.stories.tsx +253 -0
- package/src/stories/foundations/Effects.stories.tsx +116 -0
- package/src/stories/foundations/Layout.stories.tsx +177 -0
- package/src/stories/foundations/Sizes.stories.tsx +123 -0
- package/src/stories/foundations/Spacing.stories.tsx +159 -0
- package/src/stories/foundations/ThemeAdapter.stories.tsx +389 -0
- package/src/stories/foundations/Typography.stories.tsx +148 -0
- package/src/stories/molecules/Alert.stories.tsx +18 -0
- package/src/stories/molecules/Breadcrumbs.stories.tsx +51 -0
- package/src/stories/molecules/Card.stories.tsx +1 -1
- package/src/stories/molecules/CardShell.stories.tsx +1 -0
- package/src/stories/molecules/DatePicker.stories.tsx +133 -3
- package/src/stories/molecules/EmptyState.stories.tsx +106 -0
- package/src/stories/molecules/FormControlWrapper.stories.tsx +59 -0
- package/src/stories/molecules/LinkTile.stories.tsx +151 -0
- package/src/stories/molecules/ListWithIcons.stories.tsx +27 -2
- package/src/stories/molecules/RadioButtonGroup.stories.tsx +23 -0
- package/src/stories/molecules/SegmentedControl.stories.tsx +62 -1
- package/src/stories/molecules/Tabs.stories.tsx +4 -0
- package/src/stories/molecules/TitleBlock.stories.tsx +16 -16
- package/src/stories/organisms/Accordion.stories.tsx +132 -0
- package/src/stories/organisms/AdvancedListItemShell.stories.tsx +63 -23
- package/src/stories/organisms/BottomSheet.stories.tsx +48 -1
- package/src/stories/organisms/DataPagination.stories.tsx +127 -3
- package/src/stories/organisms/Dialog.stories.tsx +13 -0
- package/src/stories/organisms/FileDropzone.stories.tsx +6 -0
- package/src/stories/organisms/FileUpload.stories.tsx +4 -0
- package/src/stories/organisms/Footer.stories.tsx +20 -0
- package/src/stories/organisms/Modal.stories.tsx +53 -0
- package/src/stories/organisms/ServiceHeader.stories.tsx +25 -3
- package/src/stories/organisms/ServiceLinks.stories.tsx +1 -1
- package/src/stories/organisms/ServiceWizardStepper.stories.tsx +37 -1
- package/src/stories/organisms/SideNav.stories.tsx +8 -1
- package/src/theme/backdropTokens.test.ts +11 -0
- package/src/theme/backdropTokens.ts +11 -0
- package/src/theme/borderTokens.test.ts +59 -0
- package/src/theme/borderTokens.ts +36 -0
- package/src/theme/cards.ts +28 -28
- package/src/theme/colorTokens.test.ts +66 -0
- package/src/theme/colorTokens.ts +87 -0
- package/src/theme/effectTokens.test.ts +29 -0
- package/src/theme/effectTokens.ts +11 -0
- package/src/theme/layoutTokens.test.ts +42 -0
- package/src/theme/layoutTokens.ts +14 -0
- package/src/theme/light/MuiAccordion.tsx +30 -26
- package/src/theme/light/MuiAccordionDetails.ts +10 -5
- package/src/theme/light/MuiAccordionSummary.tsx +31 -17
- package/src/theme/light/MuiAlert.tsx +42 -65
- package/src/theme/light/MuiAutocomplete.ts +14 -7
- package/src/theme/light/MuiBreadcrumbs.tsx +17 -9
- package/src/theme/light/MuiButton.tsx +213 -204
- package/src/theme/light/MuiCard.tsx +5 -4
- package/src/theme/light/MuiCheckbox.ts +45 -14
- package/src/theme/light/MuiChip.tsx +3 -1
- package/src/theme/light/MuiDialog.ts +45 -6
- package/src/theme/light/MuiFormControl.ts +19 -9
- package/src/theme/light/MuiFormControlLabel.ts +16 -25
- package/src/theme/light/MuiFormGroup.ts +29 -26
- package/src/theme/light/MuiFormHelperText.ts +15 -4
- package/src/theme/light/MuiFormLabel.ts +20 -20
- package/src/theme/light/MuiInputBase.ts +49 -84
- package/src/theme/light/MuiOutlinedInput.ts +50 -6
- package/src/theme/light/MuiPagination.ts +21 -21
- package/src/theme/light/MuiPickerPopper.ts +17 -0
- package/src/theme/light/MuiPickersLayout.ts +63 -34
- package/src/theme/light/MuiPickersOutlinedInput.ts +38 -38
- package/src/theme/light/MuiPopover.ts +3 -1
- package/src/theme/light/MuiRadio.tsx +35 -52
- package/src/theme/light/MuiStepper.ts +21 -17
- package/src/theme/light/MuiSwitch.tsx +27 -23
- package/src/theme/light/MuiTab.tsx +27 -18
- package/src/theme/light/MuiTableCell.ts +4 -2
- package/src/theme/light/MuiTabs.tsx +11 -9
- package/src/theme/light/MuiTooltip.ts +2 -1
- package/src/theme/light/MuiTypography.tsx +0 -17
- package/src/theme/light/index.tsx +2 -0
- package/src/theme/light/themePalette.tsx +1 -0
- package/src/theme/palette.tsx +9 -0
- package/src/theme/sizeTokens.test.ts +37 -0
- package/src/theme/sizeTokens.ts +21 -0
- package/src/theme/spacingRoleBasedTokens.ts +41 -0
- package/src/theme/spacingTokens.test.ts +58 -0
- package/src/theme/spacingTokens.ts +114 -0
- package/src/theme/tokenTheme.test.tsx +402 -0
- package/src/theme/tokenTheme.ts +429 -0
- package/src/theme/tokens.css +476 -0
- package/src/theme/tokens.test.ts +174 -0
- package/src/theme/typographyTokens.test.ts +120 -0
- package/src/theme/typographyTokens.ts +119 -0
- package/dist/theme/spacing.d.ts +0 -4
- package/src/stories/foundations/Colors.mdx +0 -127
- package/src/theme/spacing.ts +0 -5
|
@@ -60,7 +60,7 @@ describe('SelectableCardList', () => {
|
|
|
60
60
|
test('navigating to next page shows the next set of items', () => {
|
|
61
61
|
renderList(<SelectableCardList items={makeItems(8)} onSelect={vi.fn()} />)
|
|
62
62
|
|
|
63
|
-
fireEvent.click(screen.getByRole('button', { name: 'Kitas' }))
|
|
63
|
+
fireEvent.click(screen.getByRole('button', { name: 'Kitas puslapis' }))
|
|
64
64
|
|
|
65
65
|
expect(screen.getByText('Item 6')).toBeInTheDocument()
|
|
66
66
|
expect(screen.getByText('Item 7')).toBeInTheDocument()
|
|
@@ -76,9 +76,11 @@ describe('SelectableCardList', () => {
|
|
|
76
76
|
expect(screen.getByText('Item 1')).toBeInTheDocument()
|
|
77
77
|
expect(screen.getByText('Item 3')).toBeInTheDocument()
|
|
78
78
|
expect(screen.queryByText('Item 4')).not.toBeInTheDocument()
|
|
79
|
-
expect(screen.getByRole('button', { name: '
|
|
80
|
-
expect(screen.getByRole('button', { name: '
|
|
81
|
-
expect(
|
|
79
|
+
expect(screen.getByRole('button', { name: 'Eiti į 1 puslapį' })).toBeInTheDocument()
|
|
80
|
+
expect(screen.getByRole('button', { name: 'Eiti į 3 puslapį' })).toBeInTheDocument()
|
|
81
|
+
expect(
|
|
82
|
+
screen.queryByRole('button', { name: 'Eiti į 4 puslapį' }),
|
|
83
|
+
).not.toBeInTheDocument()
|
|
82
84
|
})
|
|
83
85
|
|
|
84
86
|
test('resets to page 1 when switching from desktop to mobile page size', () => {
|
|
@@ -86,7 +88,7 @@ describe('SelectableCardList', () => {
|
|
|
86
88
|
<SelectableCardList items={makeItems(8)} onSelect={vi.fn()} />,
|
|
87
89
|
)
|
|
88
90
|
|
|
89
|
-
fireEvent.click(screen.getByRole('button', { name: 'Kitas' }))
|
|
91
|
+
fireEvent.click(screen.getByRole('button', { name: 'Kitas puslapis' }))
|
|
90
92
|
expect(screen.getByText('Item 6')).toBeInTheDocument()
|
|
91
93
|
|
|
92
94
|
mockedUseMediaQuery.mockReturnValue(true)
|
|
@@ -107,7 +109,7 @@ describe('SelectableCardList', () => {
|
|
|
107
109
|
<SelectableCardList items={makeItems(8)} onSelect={vi.fn()} />,
|
|
108
110
|
)
|
|
109
111
|
|
|
110
|
-
fireEvent.click(screen.getByRole('button', { name: '
|
|
112
|
+
fireEvent.click(screen.getByRole('button', { name: 'Eiti į 3 puslapį' }))
|
|
111
113
|
expect(screen.getByText('Item 7')).toBeInTheDocument()
|
|
112
114
|
|
|
113
115
|
mockedUseMediaQuery.mockReturnValue(false)
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Checkbox,
|
|
3
|
+
FormControlLabel,
|
|
4
|
+
Radio,
|
|
5
|
+
RadioGroup,
|
|
6
|
+
ThemeProvider,
|
|
7
|
+
} from '@mui/material'
|
|
8
|
+
import { fireEvent, render, screen } from '@testing-library/react'
|
|
9
|
+
import { describe, expect, it } from 'vitest'
|
|
10
|
+
|
|
11
|
+
import SimpleCheckbox from '@/components/form/inputs/SimpleCheckbox'
|
|
12
|
+
import theme from '@/theme/light'
|
|
13
|
+
|
|
14
|
+
import CheckboxMark from './CheckboxMark'
|
|
15
|
+
import RadioMark from './RadioMark'
|
|
16
|
+
|
|
17
|
+
describe('selection marks', () => {
|
|
18
|
+
it('renders decorative marks without inputs, labels or focusable elements', () => {
|
|
19
|
+
const { container } = render(
|
|
20
|
+
<>
|
|
21
|
+
<CheckboxMark />
|
|
22
|
+
<RadioMark />
|
|
23
|
+
</>,
|
|
24
|
+
)
|
|
25
|
+
expect(container.querySelectorAll('[aria-hidden="true"]')).toHaveLength(2)
|
|
26
|
+
expect(container.querySelector('input, button, [tabindex]')).toBeNull()
|
|
27
|
+
expect(screen.queryByRole('checkbox')).not.toBeInTheDocument()
|
|
28
|
+
expect(screen.queryByRole('radio')).not.toBeInTheDocument()
|
|
29
|
+
expect(container.textContent).toBe('')
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
it('distinguishes checked and mixed glyphs from an empty box', () => {
|
|
33
|
+
const { container, rerender } = render(<CheckboxMark />)
|
|
34
|
+
expect(container.querySelector('svg')).toBeNull()
|
|
35
|
+
rerender(<CheckboxMark type='checked' />)
|
|
36
|
+
const checkPath = container.querySelector('path')?.getAttribute('d')
|
|
37
|
+
expect(checkPath).toBeTruthy()
|
|
38
|
+
rerender(<CheckboxMark type='indeterminate' />)
|
|
39
|
+
expect(container.querySelector('path')?.getAttribute('d')).not.toBe(checkPath)
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
it('adds a visible radio dot only for the selected state', () => {
|
|
43
|
+
const { container, rerender } = render(<RadioMark />)
|
|
44
|
+
expect(container.querySelector('[data-rc-radio-dot]')).toBeNull()
|
|
45
|
+
rerender(<RadioMark type='selected' disabled />)
|
|
46
|
+
expect(container.querySelector('[data-rc-radio-dot]')).not.toBeNull()
|
|
47
|
+
expect(container.querySelector('[data-rc-checkbox-mark]')).toBeNull()
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it('native checkbox selection and mixed state use the shared marks', () => {
|
|
51
|
+
const { container, rerender } = render(
|
|
52
|
+
<ThemeProvider theme={theme}>
|
|
53
|
+
<Checkbox slotProps={{ input: { 'aria-label': 'Select item' } }} />
|
|
54
|
+
</ThemeProvider>,
|
|
55
|
+
)
|
|
56
|
+
const input = screen.getByRole('checkbox', { name: 'Select item' })
|
|
57
|
+
fireEvent.click(input)
|
|
58
|
+
expect(input).toBeChecked()
|
|
59
|
+
expect(container.querySelector('[data-rc-checkbox-mark="checked"]')).not.toBeNull()
|
|
60
|
+
rerender(
|
|
61
|
+
<ThemeProvider theme={theme}>
|
|
62
|
+
<Checkbox indeterminate />
|
|
63
|
+
</ThemeProvider>,
|
|
64
|
+
)
|
|
65
|
+
expect(
|
|
66
|
+
container.querySelector('[data-rc-checkbox-mark="indeterminate"]'),
|
|
67
|
+
).not.toBeNull()
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
it('native radio selection switches independent radio marks', () => {
|
|
71
|
+
const { container } = render(
|
|
72
|
+
<ThemeProvider theme={theme}>
|
|
73
|
+
<RadioGroup defaultValue='a'>
|
|
74
|
+
<FormControlLabel control={<Radio />} value='a' label='A' />
|
|
75
|
+
<FormControlLabel control={<Radio />} value='b' label='B' />
|
|
76
|
+
</RadioGroup>
|
|
77
|
+
</ThemeProvider>,
|
|
78
|
+
)
|
|
79
|
+
fireEvent.click(screen.getByRole('radio', { name: 'B' }))
|
|
80
|
+
expect(screen.getByRole('radio', { name: 'B' })).toBeChecked()
|
|
81
|
+
expect(screen.getByRole('radio', { name: 'A' })).not.toBeChecked()
|
|
82
|
+
expect(container.querySelectorAll('[data-rc-radio-mark="selected"]')).toHaveLength(1)
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
it('preserves loading placeholders and caller-supplied checkbox icons', () => {
|
|
86
|
+
const { container, rerender } = render(<SimpleCheckbox loading indeterminate />)
|
|
87
|
+
expect(container.querySelector('.MuiSkeleton-root')).not.toBeNull()
|
|
88
|
+
expect(container.querySelector('[data-rc-checkbox-mark]')).toBeNull()
|
|
89
|
+
rerender(<SimpleCheckbox icon={<span data-testid='custom-icon' />} />)
|
|
90
|
+
expect(screen.getByTestId('custom-icon')).toBeInTheDocument()
|
|
91
|
+
})
|
|
92
|
+
})
|
|
@@ -2,18 +2,22 @@ import { Box, Skeleton, Stack, Typography } from '@mui/material'
|
|
|
2
2
|
import { ElementType } from 'react'
|
|
3
3
|
|
|
4
4
|
import { ArrowRightIcon } from '@/assets/icons/phosphorIcons'
|
|
5
|
+
import { borderTokens } from '@/theme/borderTokens'
|
|
5
6
|
import { subcard } from '@/theme/cards'
|
|
6
|
-
import
|
|
7
|
+
import { colorTokens } from '@/theme/colorTokens'
|
|
8
|
+
import { spacingRoleBasedTokens } from '@/theme/spacingRoleBasedTokens'
|
|
9
|
+
import { spacingTokens } from '@/theme/spacingTokens'
|
|
10
|
+
import { typographyTokens } from '@/theme/typographyTokens'
|
|
7
11
|
|
|
8
12
|
import { RcSesServiceLinkItem, RcSesServiceLinksTestIds } from '../types'
|
|
9
13
|
|
|
10
14
|
const linkRow = {
|
|
11
15
|
borderRadius: subcard.borderRadius,
|
|
12
|
-
gap: '
|
|
16
|
+
gap: spacingTokens['spacing-aliases-service-list-item-gap'],
|
|
13
17
|
iconSize: 20,
|
|
14
|
-
labelFontWeight:
|
|
15
|
-
lineHeight: '
|
|
16
|
-
paddingBlock: '
|
|
18
|
+
labelFontWeight: typographyTokens['font-weight-body-regular'],
|
|
19
|
+
lineHeight: typographyTokens['line-height-body-regular'],
|
|
20
|
+
paddingBlock: spacingTokens['spacing-aliases-service-list-item-padding-y'],
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
type Props = RcSesServiceLinkItem & {
|
|
@@ -51,7 +55,11 @@ function ServiceLinkItem({
|
|
|
51
55
|
}}
|
|
52
56
|
>
|
|
53
57
|
<Skeleton
|
|
54
|
-
sx={{
|
|
58
|
+
sx={{
|
|
59
|
+
borderRadius: 1,
|
|
60
|
+
height: spacingRoleBasedTokens['space-16'],
|
|
61
|
+
width: '60%',
|
|
62
|
+
}}
|
|
55
63
|
variant='rounded'
|
|
56
64
|
/>
|
|
57
65
|
<Skeleton
|
|
@@ -117,13 +125,13 @@ function ServiceLinkItem({
|
|
|
117
125
|
width: '100%',
|
|
118
126
|
|
|
119
127
|
'&:focus-visible': {
|
|
120
|
-
outline:
|
|
121
|
-
outlineOffset: '
|
|
128
|
+
outline: `${borderTokens['border-focus']} solid ${colorTokens['border-focus']}`,
|
|
129
|
+
outlineOffset: borderTokens['border-focus'],
|
|
122
130
|
},
|
|
123
131
|
|
|
124
132
|
...(isInteractive && {
|
|
125
133
|
'&:hover .RcSesServiceLink-label, &:hover .RcSesServiceLink-icon': {
|
|
126
|
-
color:
|
|
134
|
+
color: colorTokens['text-link-hover'],
|
|
127
135
|
},
|
|
128
136
|
'&:hover .RcSesServiceLink-icon': {
|
|
129
137
|
transform: 'translateX(2px)',
|
|
@@ -146,7 +154,8 @@ function ServiceLinkItem({
|
|
|
146
154
|
data-testid={testIds?.itemLabel}
|
|
147
155
|
variant='body1'
|
|
148
156
|
sx={{
|
|
149
|
-
color:
|
|
157
|
+
color: colorTokens['text-link'],
|
|
158
|
+
fontSize: typographyTokens['font-size-body-regular'],
|
|
150
159
|
fontWeight: linkRow.labelFontWeight,
|
|
151
160
|
lineHeight: linkRow.lineHeight,
|
|
152
161
|
minWidth: 0,
|
|
@@ -162,7 +171,7 @@ function ServiceLinkItem({
|
|
|
162
171
|
className='RcSesServiceLink-icon'
|
|
163
172
|
data-testid={testIds?.itemIcon}
|
|
164
173
|
sx={{
|
|
165
|
-
color:
|
|
174
|
+
color: colorTokens['text-link'],
|
|
166
175
|
display: 'flex',
|
|
167
176
|
flexShrink: 0,
|
|
168
177
|
transition: 'color 150ms ease, transform 150ms ease',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Box, Divider } from '@mui/material'
|
|
2
2
|
import { Fragment } from 'react'
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import { colorTokens } from '@/theme/colorTokens'
|
|
5
5
|
|
|
6
6
|
import ServiceLinkItem from './ServiceLinkItem'
|
|
7
7
|
import { RcSesServiceLinksProps } from './types'
|
|
@@ -35,7 +35,7 @@ function RcSesServiceLinks({
|
|
|
35
35
|
// eslint-disable-next-line react/no-array-index-key
|
|
36
36
|
<Fragment key={`skeleton-${index}`}>
|
|
37
37
|
{dividers && index > 0 ? (
|
|
38
|
-
<Divider sx={{ borderColor:
|
|
38
|
+
<Divider sx={{ borderColor: colorTokens['border-subtle'] }} />
|
|
39
39
|
) : null}
|
|
40
40
|
<ServiceLinkItem label='' isLoading testIds={testIds} />
|
|
41
41
|
</Fragment>
|
|
@@ -49,7 +49,7 @@ function RcSesServiceLinks({
|
|
|
49
49
|
return (
|
|
50
50
|
<Fragment key={key}>
|
|
51
51
|
{dividers && index > 0 ? (
|
|
52
|
-
<Divider sx={{ borderColor:
|
|
52
|
+
<Divider sx={{ borderColor: colorTokens['border-subtle'] }} />
|
|
53
53
|
) : null}
|
|
54
54
|
<ServiceLinkItem
|
|
55
55
|
{...itemProps}
|
|
@@ -2,6 +2,7 @@ import { Box } from '@mui/material'
|
|
|
2
2
|
import { CSSProperties, useRef, useState } from 'react'
|
|
3
3
|
|
|
4
4
|
import normalizeSx from '@/components/utils/normalizeSx'
|
|
5
|
+
import { spacingRoleBasedTokens } from '@/theme/spacingRoleBasedTokens'
|
|
5
6
|
|
|
6
7
|
import RcSesSideNav from '.'
|
|
7
8
|
import { RcSesSideNavLayoutProps } from './SideNav.types'
|
|
@@ -46,7 +47,11 @@ function RcSesSideNavLayout({
|
|
|
46
47
|
return (
|
|
47
48
|
<Box
|
|
48
49
|
sx={[
|
|
49
|
-
{
|
|
50
|
+
{
|
|
51
|
+
display: 'flex',
|
|
52
|
+
flexDirection: { xs: 'column', md: 'row' },
|
|
53
|
+
gap: spacingRoleBasedTokens['space-32'],
|
|
54
|
+
},
|
|
50
55
|
...normalizeSx(sx),
|
|
51
56
|
]}
|
|
52
57
|
>
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Box, Typography } from '@mui/material'
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { borderTokens } from '@/theme/borderTokens'
|
|
4
|
+
import { colorTokens } from '@/theme/colorTokens'
|
|
5
|
+
import { spacingRoleBasedTokens } from '@/theme/spacingRoleBasedTokens'
|
|
6
|
+
import { typographyTokens } from '@/theme/typographyTokens'
|
|
4
7
|
|
|
5
8
|
interface Props {
|
|
6
9
|
label: string
|
|
@@ -21,28 +24,32 @@ function SideNavPill({ label, count, ariaLabel, active, onClick }: Props) {
|
|
|
21
24
|
sx={{
|
|
22
25
|
display: 'flex',
|
|
23
26
|
alignItems: 'center',
|
|
24
|
-
gap: '
|
|
27
|
+
gap: spacingRoleBasedTokens['space-8'],
|
|
25
28
|
flexShrink: 0,
|
|
26
29
|
whiteSpace: 'nowrap',
|
|
27
30
|
margin: 0,
|
|
28
|
-
borderRadius: '
|
|
29
|
-
border:
|
|
30
|
-
backgroundColor: active
|
|
31
|
-
|
|
31
|
+
borderRadius: borderTokens['radius-pill'],
|
|
32
|
+
border: `${borderTokens['border-default']} solid ${active ? colorTokens['border-focus'] : colorTokens['border-subtle']}`,
|
|
33
|
+
backgroundColor: active
|
|
34
|
+
? colorTokens['surface-brand-subtle']
|
|
35
|
+
: colorTokens['surface-base'],
|
|
36
|
+
paddingX: spacingRoleBasedTokens['space-16'],
|
|
37
|
+
paddingY: spacingRoleBasedTokens['space-8'],
|
|
32
38
|
cursor: onClick ? 'pointer' : 'default',
|
|
33
39
|
WebkitTapHighlightColor: 'transparent',
|
|
34
40
|
'&:focus-visible': {
|
|
35
|
-
outline:
|
|
36
|
-
outlineOffset: '
|
|
41
|
+
outline: `${borderTokens['border-focus']} solid ${colorTokens['border-focus']}`,
|
|
42
|
+
outlineOffset: borderTokens['border-focus'],
|
|
37
43
|
},
|
|
38
44
|
}}
|
|
39
45
|
>
|
|
40
46
|
<Typography
|
|
41
47
|
component='span'
|
|
42
48
|
sx={{
|
|
43
|
-
fontSize: '
|
|
44
|
-
lineHeight: '
|
|
45
|
-
|
|
49
|
+
fontSize: typographyTokens['font-size-body-small'],
|
|
50
|
+
lineHeight: typographyTokens['line-height-body-small'],
|
|
51
|
+
fontWeight: typographyTokens['font-weight-body-small'],
|
|
52
|
+
color: active ? colorTokens['text-default'] : colorTokens['text-secondary'],
|
|
46
53
|
}}
|
|
47
54
|
>
|
|
48
55
|
{label}
|
|
@@ -50,7 +57,12 @@ function SideNavPill({ label, count, ariaLabel, active, onClick }: Props) {
|
|
|
50
57
|
{count !== undefined && (
|
|
51
58
|
<Typography
|
|
52
59
|
component='span'
|
|
53
|
-
sx={{
|
|
60
|
+
sx={{
|
|
61
|
+
fontSize: typographyTokens['font-size-body-caption'],
|
|
62
|
+
lineHeight: typographyTokens['line-height-body-caption'],
|
|
63
|
+
fontWeight: typographyTokens['font-weight-body-caption'],
|
|
64
|
+
color: colorTokens['text-muted'],
|
|
65
|
+
}}
|
|
54
66
|
>
|
|
55
67
|
{count}
|
|
56
68
|
</Typography>
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { Box } from '@mui/material'
|
|
2
2
|
import { useCallback, useEffect, useRef, useState } from 'react'
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import { borderTokens } from '@/theme/borderTokens'
|
|
5
|
+
import { colorTokens } from '@/theme/colorTokens'
|
|
6
|
+
import { spacingRoleBasedTokens } from '@/theme/spacingRoleBasedTokens'
|
|
5
7
|
|
|
6
8
|
import { RcSesSideNavItem } from '../SideNav.types'
|
|
7
9
|
import useKeepActiveItemInView from '../hooks/useKeepActiveItemInView'
|
|
8
10
|
import SideNavPill from './SideNavPill'
|
|
9
11
|
|
|
10
|
-
const FADE_WIDTH = '
|
|
12
|
+
const FADE_WIDTH = spacingRoleBasedTokens['space-32']
|
|
13
|
+
// The mobile scroll indicator is not in Figma; no semantic role matches these.
|
|
14
|
+
const SCROLL_TRACK_BG = 'var(--rc-color-neutrals-200)'
|
|
15
|
+
const SCROLL_THUMB_BG = 'var(--rc-color-neutrals-400)'
|
|
11
16
|
const SCROLL_EPSILON = 1
|
|
12
17
|
|
|
13
18
|
interface Props {
|
|
@@ -104,12 +109,13 @@ function SideNavPillList({ items, activeItemId, onItemClick, getItemAriaLabel }:
|
|
|
104
109
|
onScroll={updateScrollState}
|
|
105
110
|
sx={{
|
|
106
111
|
display: 'flex',
|
|
107
|
-
gap: '
|
|
112
|
+
gap: spacingRoleBasedTokens['space-8'],
|
|
108
113
|
overflowX: 'auto',
|
|
109
114
|
overflowY: 'hidden',
|
|
110
115
|
scrollbarWidth: 'none',
|
|
111
116
|
'&::-webkit-scrollbar': { display: 'none' },
|
|
112
|
-
|
|
117
|
+
paddingX: spacingRoleBasedTokens['space-12'],
|
|
118
|
+
paddingY: spacingRoleBasedTokens['space-8'],
|
|
113
119
|
}}
|
|
114
120
|
>
|
|
115
121
|
{items.map((item) => (
|
|
@@ -135,7 +141,7 @@ function SideNavPillList({ items, activeItemId, onItemClick, getItemAriaLabel }:
|
|
|
135
141
|
right: `-${scrollState.edgeBleed}px`,
|
|
136
142
|
width: `calc(${FADE_WIDTH} + ${scrollState.edgeBleed}px)`,
|
|
137
143
|
// Stop at FADE_WIDTH, not 100%, so the bleed stays solid.
|
|
138
|
-
background: `linear-gradient(to right,
|
|
144
|
+
background: `linear-gradient(to right, transparent, ${colorTokens['surface-base']} ${FADE_WIDTH})`,
|
|
139
145
|
pointerEvents: 'none',
|
|
140
146
|
}}
|
|
141
147
|
/>
|
|
@@ -147,11 +153,11 @@ function SideNavPillList({ items, activeItemId, onItemClick, getItemAriaLabel }:
|
|
|
147
153
|
aria-hidden
|
|
148
154
|
sx={{
|
|
149
155
|
position: 'relative',
|
|
150
|
-
height: '
|
|
151
|
-
marginX: '
|
|
152
|
-
marginTop: '
|
|
153
|
-
borderRadius: '
|
|
154
|
-
backgroundColor:
|
|
156
|
+
height: spacingRoleBasedTokens['space-4'],
|
|
157
|
+
marginX: spacingRoleBasedTokens['space-12'],
|
|
158
|
+
marginTop: spacingRoleBasedTokens['space-4'],
|
|
159
|
+
borderRadius: borderTokens['radius-pill'],
|
|
160
|
+
backgroundColor: SCROLL_TRACK_BG,
|
|
155
161
|
overflow: 'hidden',
|
|
156
162
|
}}
|
|
157
163
|
>
|
|
@@ -162,8 +168,8 @@ function SideNavPillList({ items, activeItemId, onItemClick, getItemAriaLabel }:
|
|
|
162
168
|
bottom: 0,
|
|
163
169
|
left: `${scrollState.thumbOffset}%`,
|
|
164
170
|
width: `${scrollState.thumbWidth}%`,
|
|
165
|
-
borderRadius: '
|
|
166
|
-
backgroundColor:
|
|
171
|
+
borderRadius: borderTokens['radius-pill'],
|
|
172
|
+
backgroundColor: SCROLL_THUMB_BG,
|
|
167
173
|
}}
|
|
168
174
|
/>
|
|
169
175
|
</Box>
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { Box, Typography } from '@mui/material'
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { borderTokens } from '@/theme/borderTokens'
|
|
4
|
+
import { colorTokens } from '@/theme/colorTokens'
|
|
5
|
+
import { spacingTokens } from '@/theme/spacingTokens'
|
|
6
|
+
import { typographyTokens } from '@/theme/typographyTokens'
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
// Figma's .Side-nav-row has no hover state; no semantic role matches the tint.
|
|
9
|
+
const ROW_HOVER_BG = 'var(--rc-color-neutrals-50)'
|
|
6
10
|
|
|
7
11
|
interface Props {
|
|
8
12
|
itemId: string
|
|
@@ -25,22 +29,23 @@ function SideNavRow({ itemId, label, count, ariaLabel, active, onClick }: Props)
|
|
|
25
29
|
sx={{
|
|
26
30
|
display: 'flex',
|
|
27
31
|
alignItems: 'center',
|
|
28
|
-
gap: '
|
|
32
|
+
gap: spacingTokens['spacing-aliases-side-nav-gap'],
|
|
29
33
|
width: '100%',
|
|
30
34
|
boxSizing: 'border-box',
|
|
31
35
|
margin: 0,
|
|
32
36
|
border: 'none',
|
|
33
|
-
borderLeft: `${
|
|
34
|
-
backgroundColor: active ?
|
|
35
|
-
|
|
37
|
+
borderLeft: `${borderTokens['border-focus']} solid ${active ? colorTokens['border-focus'] : 'transparent'}`,
|
|
38
|
+
backgroundColor: active ? colorTokens['surface-brand-subtle'] : 'transparent',
|
|
39
|
+
paddingX: spacingTokens['spacing-aliases-side-nav-row-padding-x'],
|
|
40
|
+
paddingY: spacingTokens['spacing-aliases-side-nav-row-padding-y'],
|
|
36
41
|
textAlign: 'left',
|
|
37
42
|
// A scrolling list (overflow='scroll') must not shrink its rows to fit.
|
|
38
43
|
flexShrink: 0,
|
|
39
44
|
cursor: onClick ? 'pointer' : 'default',
|
|
40
|
-
'&:hover': onClick && !active ? { backgroundColor:
|
|
45
|
+
'&:hover': onClick && !active ? { backgroundColor: ROW_HOVER_BG } : undefined,
|
|
41
46
|
'&:focus-visible': {
|
|
42
|
-
outline: `${
|
|
43
|
-
outlineOffset: '-
|
|
47
|
+
outline: `${borderTokens['border-focus']} solid ${colorTokens['border-focus']}`,
|
|
48
|
+
outlineOffset: `calc(-1 * ${borderTokens['border-focus']})`,
|
|
44
49
|
},
|
|
45
50
|
}}
|
|
46
51
|
>
|
|
@@ -49,9 +54,10 @@ function SideNavRow({ itemId, label, count, ariaLabel, active, onClick }: Props)
|
|
|
49
54
|
sx={{
|
|
50
55
|
flex: '1 1 0%',
|
|
51
56
|
minWidth: 0,
|
|
52
|
-
fontSize: '
|
|
53
|
-
lineHeight: '
|
|
54
|
-
|
|
57
|
+
fontSize: typographyTokens['font-size-body-regular'],
|
|
58
|
+
lineHeight: typographyTokens['line-height-body-regular'],
|
|
59
|
+
fontWeight: typographyTokens['font-weight-body-regular'],
|
|
60
|
+
color: active ? colorTokens['text-default'] : colorTokens['text-link'],
|
|
55
61
|
}}
|
|
56
62
|
>
|
|
57
63
|
{label}
|
|
@@ -61,9 +67,10 @@ function SideNavRow({ itemId, label, count, ariaLabel, active, onClick }: Props)
|
|
|
61
67
|
component='span'
|
|
62
68
|
sx={{
|
|
63
69
|
flexShrink: 0,
|
|
64
|
-
fontSize: '
|
|
65
|
-
lineHeight: '
|
|
66
|
-
|
|
70
|
+
fontSize: typographyTokens['font-size-body-caption'],
|
|
71
|
+
lineHeight: typographyTokens['line-height-body-caption'],
|
|
72
|
+
fontWeight: typographyTokens['font-weight-body-caption'],
|
|
73
|
+
color: colorTokens['text-muted'],
|
|
67
74
|
}}
|
|
68
75
|
>
|
|
69
76
|
{count}
|
|
@@ -3,7 +3,9 @@ import { useEffect, useRef } from 'react'
|
|
|
3
3
|
import { useTranslation } from 'react-i18next'
|
|
4
4
|
|
|
5
5
|
import normalizeSx from '@/components/utils/normalizeSx'
|
|
6
|
-
import
|
|
6
|
+
import { colorTokens } from '@/theme/colorTokens'
|
|
7
|
+
import { spacingRoleBasedTokens } from '@/theme/spacingRoleBasedTokens'
|
|
8
|
+
import { typographyTokens } from '@/theme/typographyTokens'
|
|
7
9
|
|
|
8
10
|
import { RcSesSideNavItem, RcSesSideNavProps } from './SideNav.types'
|
|
9
11
|
import SideNavPillList from './components/SideNavPillList'
|
|
@@ -11,8 +13,6 @@ import SideNavRow from './components/SideNavRow'
|
|
|
11
13
|
import useElementHeight from './hooks/useElementHeight'
|
|
12
14
|
import useKeepActiveItemInView from './hooks/useKeepActiveItemInView'
|
|
13
15
|
|
|
14
|
-
const ROW_GAP = '0.25rem'
|
|
15
|
-
|
|
16
16
|
function RcSesSideNav({
|
|
17
17
|
items,
|
|
18
18
|
activeItemId,
|
|
@@ -57,7 +57,7 @@ function RcSesSideNav({
|
|
|
57
57
|
{
|
|
58
58
|
width: '100%',
|
|
59
59
|
// Only the mobile bar overlays scrolling content.
|
|
60
|
-
backgroundColor: { xs:
|
|
60
|
+
backgroundColor: { xs: colorTokens['surface-base'], md: 'transparent' },
|
|
61
61
|
// Above content setting zIndex: 1 - the nav precedes it in DOM order.
|
|
62
62
|
zIndex: 2,
|
|
63
63
|
},
|
|
@@ -68,7 +68,7 @@ function RcSesSideNav({
|
|
|
68
68
|
sx={{
|
|
69
69
|
display: { xs: 'none', md: 'flex' },
|
|
70
70
|
flexDirection: 'column',
|
|
71
|
-
gap:
|
|
71
|
+
gap: spacingRoleBasedTokens['space-4'],
|
|
72
72
|
// Capped to what is left of the viewport below the sticky header, so
|
|
73
73
|
// the list can never run past the bottom of the screen. The title stays
|
|
74
74
|
// put and only the rows scroll, hence minHeight: 0 on this flex column.
|
|
@@ -78,9 +78,10 @@ function RcSesSideNav({
|
|
|
78
78
|
<Typography
|
|
79
79
|
sx={{
|
|
80
80
|
width: '100%',
|
|
81
|
-
fontSize: '
|
|
82
|
-
lineHeight: '
|
|
83
|
-
|
|
81
|
+
fontSize: typographyTokens['font-size-body-small'],
|
|
82
|
+
lineHeight: typographyTokens['line-height-body-small'],
|
|
83
|
+
fontWeight: typographyTokens['font-weight-body-small'],
|
|
84
|
+
color: colorTokens['text-secondary'],
|
|
84
85
|
}}
|
|
85
86
|
>
|
|
86
87
|
{navTitle}
|
|
@@ -90,7 +91,7 @@ function RcSesSideNav({
|
|
|
90
91
|
sx={{
|
|
91
92
|
display: 'flex',
|
|
92
93
|
flexDirection: 'column',
|
|
93
|
-
gap:
|
|
94
|
+
gap: spacingRoleBasedTokens['space-4'],
|
|
94
95
|
...(isScrollable && { overflowY: 'auto', minHeight: 0 }),
|
|
95
96
|
}}
|
|
96
97
|
>
|
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
WarningFillIcon,
|
|
8
8
|
XCircleFillIcon,
|
|
9
9
|
} from '@/library/icons'
|
|
10
|
-
import {
|
|
10
|
+
import { spacingRoleBasedTokens } from '@/theme/spacingRoleBasedTokens'
|
|
11
|
+
import { spacingTokens } from '@/theme/spacingTokens'
|
|
11
12
|
|
|
12
13
|
import { type SnackbarSize, type SnackbarState } from './types'
|
|
13
14
|
|
|
@@ -15,6 +16,24 @@ export const SNACKBAR_DURATION = 10000 // 10s
|
|
|
15
16
|
|
|
16
17
|
export const SNACKBAR_ICON_SIZE = { width: 18, height: 20 }
|
|
17
18
|
|
|
19
|
+
// Figma binds the state icons to the 400 primitives, which read on the dark
|
|
20
|
+
// surface; the status-*-icon roles are meant for light backgrounds.
|
|
21
|
+
const STATE_ICON_COLORS = {
|
|
22
|
+
success: 'var(--rc-color-greens-400)',
|
|
23
|
+
error: 'var(--rc-color-red-400)',
|
|
24
|
+
warning: 'var(--rc-color-yellows-400)',
|
|
25
|
+
info: 'var(--rc-color-cyans-400)',
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Figma uses the same padding for both sizes: the Snackbar aliases on the
|
|
29
|
+
// top, bottom and left, 12px on the right next to the close button.
|
|
30
|
+
const SNACKBAR_PADDING = [
|
|
31
|
+
spacingTokens['spacing-aliases-snackbar-padding-y'],
|
|
32
|
+
spacingRoleBasedTokens['space-12'],
|
|
33
|
+
spacingTokens['spacing-aliases-snackbar-padding-y'],
|
|
34
|
+
spacingTokens['spacing-aliases-snackbar-padding-x'],
|
|
35
|
+
].join(' ')
|
|
36
|
+
|
|
18
37
|
export const SNACKBAR_CHAR_LIMITS: Record<SnackbarSize, number> = {
|
|
19
38
|
standard: 120,
|
|
20
39
|
compact: 60,
|
|
@@ -31,31 +50,31 @@ export const stateConfig: Record<
|
|
|
31
50
|
> = {
|
|
32
51
|
success: {
|
|
33
52
|
icon: CheckCircleFillIcon,
|
|
34
|
-
color:
|
|
53
|
+
color: STATE_ICON_COLORS.success,
|
|
35
54
|
severity: 'success',
|
|
36
55
|
ariaLive: 'polite',
|
|
37
56
|
},
|
|
38
57
|
error: {
|
|
39
58
|
icon: XCircleFillIcon,
|
|
40
|
-
color: error
|
|
59
|
+
color: STATE_ICON_COLORS.error,
|
|
41
60
|
severity: 'error',
|
|
42
61
|
ariaLive: 'assertive',
|
|
43
62
|
},
|
|
44
63
|
warning: {
|
|
45
64
|
icon: WarningFillIcon,
|
|
46
|
-
color: warning
|
|
65
|
+
color: STATE_ICON_COLORS.warning,
|
|
47
66
|
severity: 'warning',
|
|
48
67
|
ariaLive: 'polite',
|
|
49
68
|
},
|
|
50
69
|
info: {
|
|
51
70
|
icon: InfoFillIcon,
|
|
52
|
-
color:
|
|
71
|
+
color: STATE_ICON_COLORS.info,
|
|
53
72
|
severity: 'info',
|
|
54
73
|
ariaLive: 'polite',
|
|
55
74
|
},
|
|
56
75
|
'action-needed': {
|
|
57
76
|
icon: ScrollIcon,
|
|
58
|
-
color:
|
|
77
|
+
color: STATE_ICON_COLORS.info,
|
|
59
78
|
severity: 'info',
|
|
60
79
|
ariaLive: 'assertive',
|
|
61
80
|
},
|
|
@@ -72,11 +91,11 @@ export const sizeConfig: Record<
|
|
|
72
91
|
standard: {
|
|
73
92
|
maxHeight: 120,
|
|
74
93
|
width: 400,
|
|
75
|
-
padding:
|
|
94
|
+
padding: SNACKBAR_PADDING,
|
|
76
95
|
},
|
|
77
96
|
compact: {
|
|
78
97
|
maxHeight: 96,
|
|
79
98
|
width: 320,
|
|
80
|
-
padding:
|
|
99
|
+
padding: SNACKBAR_PADDING,
|
|
81
100
|
},
|
|
82
101
|
}
|