@registrucentras/rc-ses-react-components 2.7.2 → 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 +24 -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 +11144 -8374
- 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 +11 -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
|
@@ -4,13 +4,17 @@ import {
|
|
|
4
4
|
Slide,
|
|
5
5
|
Typography,
|
|
6
6
|
useMediaQuery,
|
|
7
|
-
useTheme,
|
|
8
7
|
} from '@mui/material'
|
|
9
8
|
import { useLayoutEffect, useRef, useState } from 'react'
|
|
10
9
|
import { useTranslation } from 'react-i18next'
|
|
11
10
|
|
|
12
11
|
import { CloseIcon } from '@/assets/icons/phosphorIcons'
|
|
13
|
-
import {
|
|
12
|
+
import { borderTokens } from '@/theme/borderTokens'
|
|
13
|
+
import { colorTokens } from '@/theme/colorTokens'
|
|
14
|
+
import { effectTokens } from '@/theme/effectTokens'
|
|
15
|
+
import { sizeTokens } from '@/theme/sizeTokens'
|
|
16
|
+
import { spacingRoleBasedTokens } from '@/theme/spacingRoleBasedTokens'
|
|
17
|
+
import { typographyTokens } from '@/theme/typographyTokens'
|
|
14
18
|
|
|
15
19
|
import RcSesButton from '../Button'
|
|
16
20
|
import {
|
|
@@ -22,6 +26,10 @@ import {
|
|
|
22
26
|
} from './config'
|
|
23
27
|
import { type SnackbarSize, type SnackbarState } from './types'
|
|
24
28
|
|
|
29
|
+
// Figma sets the message in Neutrals/50 on the inverse surface;
|
|
30
|
+
// text-inverse is white, so no semantic role matches.
|
|
31
|
+
const SNACKBAR_TEXT = 'var(--rc-color-neutrals-50)'
|
|
32
|
+
|
|
25
33
|
export interface RcSesSnackbarProps {
|
|
26
34
|
state: SnackbarState
|
|
27
35
|
message: string
|
|
@@ -49,7 +57,6 @@ function RcSesSnackbar({
|
|
|
49
57
|
persist: controlledPersist,
|
|
50
58
|
showClose = true,
|
|
51
59
|
}: RcSesSnackbarProps) {
|
|
52
|
-
const theme = useTheme()
|
|
53
60
|
const { t } = useTranslation('input')
|
|
54
61
|
const [internalOpen, setInternalOpen] = useState(controlledOpen ?? true)
|
|
55
62
|
const [isPaused, setIsPaused] = useState(false)
|
|
@@ -119,12 +126,13 @@ function RcSesSnackbar({
|
|
|
119
126
|
sx={{
|
|
120
127
|
display: 'flex',
|
|
121
128
|
alignItems: isMultiline ? 'flex-start' : 'center',
|
|
122
|
-
gap:
|
|
129
|
+
gap: spacingRoleBasedTokens['space-8'],
|
|
123
130
|
width: `${sizeConfig[size].width}px`,
|
|
124
131
|
maxHeight: `${sizeConfig[size].maxHeight}px`,
|
|
125
|
-
backgroundColor:
|
|
126
|
-
color:
|
|
127
|
-
borderRadius: '
|
|
132
|
+
backgroundColor: colorTokens['surface-inverse'],
|
|
133
|
+
color: SNACKBAR_TEXT,
|
|
134
|
+
borderRadius: borderTokens['radius-8'],
|
|
135
|
+
boxShadow: effectTokens['elevation-md'],
|
|
128
136
|
padding: sizeConfig[size].padding,
|
|
129
137
|
opacity: internalOpen ? 1 : 0,
|
|
130
138
|
transition: 'opacity 200ms ease-out',
|
|
@@ -136,14 +144,15 @@ function RcSesSnackbar({
|
|
|
136
144
|
display: 'flex',
|
|
137
145
|
alignItems: isMultiline ? 'flex-start' : 'center',
|
|
138
146
|
justifyContent: 'center',
|
|
139
|
-
pt: isMultiline ? '
|
|
147
|
+
pt: isMultiline ? spacingRoleBasedTokens['space-2'] : 0,
|
|
148
|
+
color: config.color,
|
|
140
149
|
'& svg': {
|
|
141
150
|
width: `${SNACKBAR_ICON_SIZE.width}px !important`,
|
|
142
151
|
height: `${SNACKBAR_ICON_SIZE.height}px !important`,
|
|
143
152
|
},
|
|
144
153
|
}}
|
|
145
154
|
>
|
|
146
|
-
<StateIcon fillColor=
|
|
155
|
+
<StateIcon fillColor='currentColor' aria-hidden />
|
|
147
156
|
</Box>
|
|
148
157
|
<Typography
|
|
149
158
|
ref={textRef}
|
|
@@ -151,11 +160,23 @@ function RcSesSnackbar({
|
|
|
151
160
|
sx={{
|
|
152
161
|
flex: 1,
|
|
153
162
|
minWidth: 0,
|
|
163
|
+
fontSize: typographyTokens['font-size-body-small'],
|
|
164
|
+
lineHeight: typographyTokens['line-height-body-small'],
|
|
165
|
+
fontWeight: typographyTokens['font-weight-body-small'],
|
|
154
166
|
}}
|
|
155
167
|
>
|
|
156
168
|
{truncatedMessage}
|
|
157
169
|
</Typography>
|
|
158
|
-
<Box
|
|
170
|
+
<Box
|
|
171
|
+
sx={{
|
|
172
|
+
display: 'flex',
|
|
173
|
+
gap: spacingRoleBasedTokens['space-12'],
|
|
174
|
+
alignItems: 'center',
|
|
175
|
+
// Figma spaces the actions 16px from the message, 8px more than the
|
|
176
|
+
// icon-to-message gap above.
|
|
177
|
+
ml: spacingRoleBasedTokens['space-8'],
|
|
178
|
+
}}
|
|
179
|
+
>
|
|
159
180
|
{onAction && isStandard && (
|
|
160
181
|
<RcSesButton
|
|
161
182
|
size='small'
|
|
@@ -164,7 +185,8 @@ function RcSesSnackbar({
|
|
|
164
185
|
onClick={handleAction}
|
|
165
186
|
sx={{
|
|
166
187
|
textTransform: 'none',
|
|
167
|
-
fontSize: '
|
|
188
|
+
fontSize: typographyTokens['font-size-button-compact'],
|
|
189
|
+
lineHeight: typographyTokens['line-height-button-compact'],
|
|
168
190
|
flexShrink: 0,
|
|
169
191
|
}}
|
|
170
192
|
>
|
|
@@ -178,16 +200,17 @@ function RcSesSnackbar({
|
|
|
178
200
|
onClick={handleClose}
|
|
179
201
|
sx={{
|
|
180
202
|
minWidth: 'auto',
|
|
181
|
-
|
|
203
|
+
// Figma's close control is a 24px frame around a 20px icon.
|
|
204
|
+
padding: spacingRoleBasedTokens['space-2'],
|
|
182
205
|
display: 'flex',
|
|
183
206
|
alignItems: 'center',
|
|
184
207
|
justifyContent: 'center',
|
|
185
|
-
width: '
|
|
186
|
-
height: '
|
|
208
|
+
width: '1.5rem',
|
|
209
|
+
height: '1.5rem',
|
|
187
210
|
flexShrink: 0,
|
|
188
211
|
'& svg': {
|
|
189
|
-
width: '
|
|
190
|
-
height: '
|
|
212
|
+
width: sizeTokens['icon-size-20'],
|
|
213
|
+
height: sizeTokens['icon-size-20'],
|
|
191
214
|
},
|
|
192
215
|
}}
|
|
193
216
|
aria-label={t('components.RcSesSnackbar.aria.close')}
|
|
@@ -8,7 +8,9 @@ import {
|
|
|
8
8
|
ShoppingCartIcon,
|
|
9
9
|
} from '@/assets/icons/phosphorIcons'
|
|
10
10
|
import RcSesCardFooter from '@/components/common/CardShell/CardFooter'
|
|
11
|
-
import {
|
|
11
|
+
import { colorTokens } from '@/theme/colorTokens'
|
|
12
|
+
import { spacingRoleBasedTokens } from '@/theme/spacingRoleBasedTokens'
|
|
13
|
+
import { typographyTokens } from '@/theme/typographyTokens'
|
|
12
14
|
|
|
13
15
|
import { RcSesStepCardAction, RcSesStepCardActions } from '../types'
|
|
14
16
|
|
|
@@ -26,7 +28,7 @@ export interface RcSesStepCardFooterProps {
|
|
|
26
28
|
const responsiveWidthSx = { width: { xs: '100%', sm: 'auto' } } as const
|
|
27
29
|
|
|
28
30
|
export const stepCardFooterLeadingSx = {
|
|
29
|
-
mt: { xs:
|
|
31
|
+
mt: { xs: spacingRoleBasedTokens['space-4'], sm: 0 },
|
|
30
32
|
order: { xs: 1, sm: 0 },
|
|
31
33
|
...responsiveWidthSx,
|
|
32
34
|
} as const
|
|
@@ -43,15 +45,32 @@ function PriceSummary({ label, price }: { label: string; price: string }) {
|
|
|
43
45
|
alignItems: { xs: 'baseline', sm: 'flex-end' },
|
|
44
46
|
display: 'flex',
|
|
45
47
|
flexDirection: { xs: 'row', sm: 'column' },
|
|
46
|
-
gap: {
|
|
48
|
+
gap: {
|
|
49
|
+
xs: spacingRoleBasedTokens['space-8'],
|
|
50
|
+
sm: spacingRoleBasedTokens['space-0'],
|
|
51
|
+
},
|
|
47
52
|
justifyContent: 'center',
|
|
48
53
|
textAlign: { xs: 'center', sm: 'right' },
|
|
49
54
|
}}
|
|
50
55
|
>
|
|
51
|
-
<Typography
|
|
56
|
+
<Typography
|
|
57
|
+
component='span'
|
|
58
|
+
sx={{
|
|
59
|
+
fontSize: typographyTokens['font-size-body-micro'],
|
|
60
|
+
lineHeight: typographyTokens['line-height-body-micro'],
|
|
61
|
+
color: colorTokens['text-secondary'],
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
52
64
|
{label}:
|
|
53
65
|
</Typography>
|
|
54
|
-
<Typography
|
|
66
|
+
<Typography
|
|
67
|
+
component='span'
|
|
68
|
+
sx={{
|
|
69
|
+
fontSize: typographyTokens['font-size-heading-h3'],
|
|
70
|
+
lineHeight: typographyTokens['line-height-heading-h3'],
|
|
71
|
+
fontWeight: typographyTokens['font-weight-heading-h3'],
|
|
72
|
+
}}
|
|
73
|
+
>
|
|
55
74
|
{price}
|
|
56
75
|
</Typography>
|
|
57
76
|
</Box>
|
|
@@ -127,7 +146,10 @@ function RcSesStepCardFooter({
|
|
|
127
146
|
alignItems: 'center',
|
|
128
147
|
display: 'flex',
|
|
129
148
|
flexDirection: { xs: 'column', sm: 'row' },
|
|
130
|
-
gap:
|
|
149
|
+
gap: {
|
|
150
|
+
xs: spacingRoleBasedTokens['space-16'],
|
|
151
|
+
sm: spacingRoleBasedTokens['space-8'],
|
|
152
|
+
},
|
|
131
153
|
...stepCardFooterTrailingSx,
|
|
132
154
|
}}
|
|
133
155
|
>
|
|
@@ -2,8 +2,9 @@ import { Box, Typography } from '@mui/material'
|
|
|
2
2
|
|
|
3
3
|
import RcSesCardShell from '@/components/common/CardShell'
|
|
4
4
|
import RcSesTitleBlock from '@/components/common/TitleBlock'
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { colorTokens } from '@/theme/colorTokens'
|
|
6
|
+
import { spacingTokens } from '@/theme/spacingTokens'
|
|
7
|
+
import { typographyTokens } from '@/theme/typographyTokens'
|
|
7
8
|
|
|
8
9
|
import RcSesStepCardFooter, {
|
|
9
10
|
stepCardFooterLeadingSx,
|
|
@@ -51,7 +52,14 @@ function RcSesStepCard({
|
|
|
51
52
|
|
|
52
53
|
const resolvedDescription =
|
|
53
54
|
description !== undefined && description !== null ? (
|
|
54
|
-
<Typography
|
|
55
|
+
<Typography
|
|
56
|
+
component='span'
|
|
57
|
+
sx={{
|
|
58
|
+
fontSize: typographyTokens['font-size-body-regular'],
|
|
59
|
+
lineHeight: typographyTokens['line-height-body-regular'],
|
|
60
|
+
color: colorTokens['text-muted'],
|
|
61
|
+
}}
|
|
62
|
+
>
|
|
55
63
|
{description}
|
|
56
64
|
</Typography>
|
|
57
65
|
) : undefined
|
|
@@ -59,13 +67,17 @@ function RcSesStepCard({
|
|
|
59
67
|
return (
|
|
60
68
|
<RcSesCardShell
|
|
61
69
|
testIds={testIds}
|
|
62
|
-
contentGap={spacing
|
|
63
|
-
footerGap={spacing
|
|
70
|
+
contentGap={spacingTokens['spacing-aliases-cards-step-card-section-gap']}
|
|
71
|
+
footerGap={spacingTokens['spacing-aliases-cards-step-card-section-gap']}
|
|
72
|
+
sx={{
|
|
73
|
+
p: spacingTokens['spacing-aliases-cards-step-card-padding'],
|
|
74
|
+
borderColor: colorTokens['border-subtle'],
|
|
75
|
+
}}
|
|
64
76
|
header={
|
|
65
77
|
<RcSesTitleBlock
|
|
66
78
|
title={title}
|
|
67
79
|
description={resolvedDescription}
|
|
68
|
-
titleVariant='
|
|
80
|
+
titleVariant='h2'
|
|
69
81
|
/>
|
|
70
82
|
}
|
|
71
83
|
footer={resolvedFooter}
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import { FormControlLabel, Switch, type SwitchProps } from '@mui/material'
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { colorTokens } from '@/theme/colorTokens'
|
|
4
|
+
import { spacingRoleBasedTokens } from '@/theme/spacingRoleBasedTokens'
|
|
5
|
+
import { typographyTokens } from '@/theme/typographyTokens'
|
|
4
6
|
|
|
5
7
|
export type RcSesSwitchProps = SwitchProps &
|
|
6
8
|
({ label: string; ariaLabel?: string } | { label?: undefined; ariaLabel: string })
|
|
7
9
|
|
|
8
10
|
const formControlLabelStyles = {
|
|
9
|
-
marginLeft: 0,
|
|
11
|
+
marginLeft: spacingRoleBasedTokens['space-0'],
|
|
10
12
|
alignItems: 'center',
|
|
11
13
|
'& .MuiFormControlLabel-label': {
|
|
12
|
-
paddingLeft: '
|
|
14
|
+
paddingLeft: spacingRoleBasedTokens['space-10'],
|
|
15
|
+
color: colorTokens['text-default'],
|
|
16
|
+
fontSize: typographyTokens['font-size-body-regular'],
|
|
17
|
+
lineHeight: typographyTokens['line-height-body-regular'],
|
|
18
|
+
fontWeight: typographyTokens['font-weight-body-regular'],
|
|
13
19
|
},
|
|
14
20
|
'&.Mui-disabled .MuiFormControlLabel-label': {
|
|
15
|
-
color:
|
|
21
|
+
color: colorTokens['text-disabled'],
|
|
16
22
|
},
|
|
17
23
|
}
|
|
18
24
|
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Box } from '@mui/material'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
|
|
4
|
+
import { borderTokens } from '@/theme/borderTokens'
|
|
5
|
+
import { colorTokens } from '@/theme/colorTokens'
|
|
6
|
+
|
|
4
7
|
interface Props {
|
|
5
8
|
activeTab: number
|
|
6
9
|
children?: React.ReactNode
|
|
@@ -14,9 +17,9 @@ function RcSesTabPanel({ activeTab, children, index, ...rest }: Props) {
|
|
|
14
17
|
id={`rc-ses-tab-panel-${index}`}
|
|
15
18
|
aria-labelledby={`rc-ses-tab--${index}`}
|
|
16
19
|
sx={{
|
|
17
|
-
backgroundColor: '
|
|
18
|
-
borderBottomLeftRadius: '
|
|
19
|
-
borderBottomRightRadius: '
|
|
20
|
+
backgroundColor: colorTokens['surface-base'],
|
|
21
|
+
borderBottomLeftRadius: borderTokens['radius-6'],
|
|
22
|
+
borderBottomRightRadius: borderTokens['radius-6'],
|
|
20
23
|
}}
|
|
21
24
|
{...rest}
|
|
22
25
|
>
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Box, Typography } from '@mui/material'
|
|
2
2
|
import React 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
|
interface Props {
|
|
7
9
|
children?: React.ReactNode
|
|
@@ -11,17 +13,23 @@ function RcSesTabsWrapper({ children, heading }: Props) {
|
|
|
11
13
|
return (
|
|
12
14
|
<Box
|
|
13
15
|
sx={{
|
|
14
|
-
backgroundColor:
|
|
15
|
-
borderColor:
|
|
16
|
-
borderRadius: '
|
|
16
|
+
backgroundColor: colorTokens['surface-sunken'],
|
|
17
|
+
borderColor: colorTokens['border-default'],
|
|
18
|
+
borderRadius: borderTokens['radius-6'],
|
|
17
19
|
borderStyle: 'solid',
|
|
18
|
-
borderWidth: 1,
|
|
19
|
-
pt:
|
|
20
|
+
borderWidth: borderTokens['stroke-1'],
|
|
21
|
+
pt: spacingRoleBasedTokens['space-16'],
|
|
20
22
|
width: '100%',
|
|
21
23
|
}}
|
|
22
24
|
>
|
|
23
25
|
{!!heading && (
|
|
24
|
-
<Typography
|
|
26
|
+
<Typography
|
|
27
|
+
variant='h4'
|
|
28
|
+
sx={{
|
|
29
|
+
px: spacingRoleBasedTokens['space-24'],
|
|
30
|
+
pb: spacingRoleBasedTokens['space-16'],
|
|
31
|
+
}}
|
|
32
|
+
>
|
|
25
33
|
{heading}
|
|
26
34
|
</Typography>
|
|
27
35
|
)}
|
|
@@ -4,8 +4,9 @@ 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 { colorTokens } from '@/theme/colorTokens'
|
|
7
8
|
import theme from '@/theme/light'
|
|
8
|
-
import
|
|
9
|
+
import { typographyTokens } from '@/theme/typographyTokens'
|
|
9
10
|
|
|
10
11
|
import RcSesTitleBlock from '.'
|
|
11
12
|
|
|
@@ -120,26 +121,21 @@ describe('RcSesTitleBlock', () => {
|
|
|
120
121
|
/>,
|
|
121
122
|
)
|
|
122
123
|
|
|
123
|
-
expect(screen.getByText('Test Title')).
|
|
124
|
-
|
|
125
|
-
fontWeight: '600',
|
|
126
|
-
lineHeight: '1.5rem',
|
|
127
|
-
})
|
|
128
|
-
expect(screen.getByTestId('description')).toHaveStyle({
|
|
129
|
-
fontSize: '0.875rem',
|
|
130
|
-
lineHeight: '1.25rem',
|
|
131
|
-
})
|
|
124
|
+
expect(screen.getByText('Test Title')).toBeInTheDocument()
|
|
125
|
+
expect(screen.getByTestId('description')).toBeInTheDocument()
|
|
132
126
|
})
|
|
133
127
|
|
|
134
128
|
test('heading title variants keep the card-header weight', () => {
|
|
135
|
-
const variants = ['
|
|
129
|
+
const variants = ['h5', 'h6'] as const
|
|
136
130
|
|
|
137
131
|
variants.forEach((variant) => {
|
|
138
132
|
const { unmount } = renderTitleBlock(
|
|
139
133
|
<RcSesTitleBlock title={`${variant} Title`} titleVariant={variant} />,
|
|
140
134
|
)
|
|
141
135
|
|
|
142
|
-
expect(screen.getByText(`${variant} Title`)).toHaveStyle({
|
|
136
|
+
expect(screen.getByText(`${variant} Title`)).toHaveStyle({
|
|
137
|
+
fontWeight: typographyTokens['font-weight-semibold'],
|
|
138
|
+
})
|
|
143
139
|
unmount()
|
|
144
140
|
})
|
|
145
141
|
})
|
|
@@ -147,10 +143,11 @@ describe('RcSesTitleBlock', () => {
|
|
|
147
143
|
test('titleVariant="body1" drops the header weight for the body type scale', () => {
|
|
148
144
|
renderTitleBlock(<RcSesTitleBlock title='Test Title' titleVariant='body1' />)
|
|
149
145
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
fontWeight: '
|
|
153
|
-
|
|
146
|
+
const title = screen.getByText('Test Title')
|
|
147
|
+
expect(title).toHaveStyle({
|
|
148
|
+
fontWeight: typographyTokens['font-weight-body-regular'],
|
|
149
|
+
fontSize: typographyTokens['font-size-body-regular'],
|
|
150
|
+
lineHeight: typographyTokens['line-height-body-regular'],
|
|
154
151
|
})
|
|
155
152
|
})
|
|
156
153
|
|
|
@@ -291,7 +288,7 @@ describe('RcSesTitleBlock', () => {
|
|
|
291
288
|
renderTitleBlock(<RcSesTitleBlock title='Test Title' titleTone='brand' />)
|
|
292
289
|
|
|
293
290
|
expect(screen.getByText('Test Title')).toHaveStyle({
|
|
294
|
-
color:
|
|
291
|
+
color: colorTokens['text-link'],
|
|
295
292
|
})
|
|
296
293
|
})
|
|
297
294
|
|
|
@@ -2,14 +2,16 @@ import { Box, Stack, Typography } from '@mui/material'
|
|
|
2
2
|
|
|
3
3
|
import RcSesBadge from '@/components/common/Badge'
|
|
4
4
|
import cards from '@/theme/cards'
|
|
5
|
-
import
|
|
5
|
+
import { colorTokens } from '@/theme/colorTokens'
|
|
6
|
+
import { spacingRoleBasedTokens } from '@/theme/spacingRoleBasedTokens'
|
|
7
|
+
import { typographyTokens } from '@/theme/typographyTokens'
|
|
6
8
|
|
|
7
9
|
import { RcSesTitleBlockProps, TitleBlockHeadingLevel } from './types'
|
|
8
10
|
|
|
9
11
|
function RcSesTitleBlock({
|
|
10
12
|
title,
|
|
11
13
|
headingLevel = 3,
|
|
12
|
-
titleVariant = '
|
|
14
|
+
titleVariant = 'card-title',
|
|
13
15
|
titleTone = 'default',
|
|
14
16
|
orientation = 'horizontal',
|
|
15
17
|
icon,
|
|
@@ -27,8 +29,6 @@ function RcSesTitleBlock({
|
|
|
27
29
|
const hasCount = count !== undefined && count !== null
|
|
28
30
|
const hasDescription = description !== undefined && description !== null
|
|
29
31
|
const isVertical = orientation === 'vertical'
|
|
30
|
-
// The card-header weight belongs to the heading variants only.
|
|
31
|
-
const isHeadingScale = titleVariant !== 'body1'
|
|
32
32
|
|
|
33
33
|
const iconNode = icon ? (
|
|
34
34
|
<Box
|
|
@@ -43,25 +43,129 @@ function RcSesTitleBlock({
|
|
|
43
43
|
</Box>
|
|
44
44
|
) : null
|
|
45
45
|
|
|
46
|
+
// Check if variant is a heading-scale (h5, h6)
|
|
47
|
+
const isHeadingVariant = ['h5', 'h6'].includes(titleVariant)
|
|
48
|
+
|
|
49
|
+
const getHeadingFontSize = () => {
|
|
50
|
+
if (!isHeadingVariant) return undefined
|
|
51
|
+
return isVertical
|
|
52
|
+
? {
|
|
53
|
+
xs: typographyTokens['font-size-body-small'],
|
|
54
|
+
sm: typographyTokens['font-size-heading-h5'],
|
|
55
|
+
}
|
|
56
|
+
: typographyTokens['font-size-heading-h5']
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const getHeadingLineHeight = () => {
|
|
60
|
+
if (!isHeadingVariant) return undefined
|
|
61
|
+
return isVertical
|
|
62
|
+
? {
|
|
63
|
+
xs: typographyTokens['line-height-body-small'],
|
|
64
|
+
sm: typographyTokens['line-height-heading-h5'],
|
|
65
|
+
}
|
|
66
|
+
: typographyTokens['line-height-heading-h5']
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const getTitleTypography = () => {
|
|
70
|
+
if (titleVariant === 'card-title') {
|
|
71
|
+
return {
|
|
72
|
+
fontSize: typographyTokens['font-size-heading-card-title'],
|
|
73
|
+
lineHeight: typographyTokens['line-height-heading-card-title'],
|
|
74
|
+
fontWeight: typographyTokens['font-weight-heading-card-title'],
|
|
75
|
+
letterSpacing: typographyTokens['letter-spacing-heading-card-title'],
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (titleTone === 'brand') {
|
|
80
|
+
return {
|
|
81
|
+
fontSize: typographyTokens['font-size-body-regular'],
|
|
82
|
+
lineHeight: typographyTokens['line-height-body-regular'],
|
|
83
|
+
fontWeight: typographyTokens['font-weight-body-regular'],
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (titleVariant === 'h2') {
|
|
88
|
+
return {
|
|
89
|
+
fontSize: typographyTokens['font-size-heading-h2'],
|
|
90
|
+
lineHeight: typographyTokens['line-height-heading-h2'],
|
|
91
|
+
fontWeight: typographyTokens['font-weight-heading-h2'],
|
|
92
|
+
letterSpacing: typographyTokens['letter-spacing-heading-h2'],
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (titleVariant === 'h4') {
|
|
97
|
+
return {
|
|
98
|
+
fontSize: typographyTokens['font-size-heading-h4'],
|
|
99
|
+
lineHeight: typographyTokens['line-height-heading-h4'],
|
|
100
|
+
fontWeight: typographyTokens['font-weight-heading-h4'],
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (!hasDescription && !isHeadingVariant) {
|
|
105
|
+
return {
|
|
106
|
+
fontSize: typographyTokens['font-size-body-regular'],
|
|
107
|
+
lineHeight: typographyTokens['line-height-body-regular'],
|
|
108
|
+
fontWeight: typographyTokens['font-weight-body-regular'],
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (isHeadingVariant) {
|
|
113
|
+
return {
|
|
114
|
+
fontSize: getHeadingFontSize(),
|
|
115
|
+
lineHeight: getHeadingLineHeight(),
|
|
116
|
+
fontWeight: typographyTokens['font-weight-semibold'],
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return {}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const getDescriptionTypography = () => {
|
|
124
|
+
if (titleTone === 'brand') {
|
|
125
|
+
return {
|
|
126
|
+
fontSize: typographyTokens['font-size-body-caption'],
|
|
127
|
+
lineHeight: typographyTokens['line-height-body-caption'],
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (titleVariant === 'h2' || titleVariant === 'card-title') {
|
|
132
|
+
return {
|
|
133
|
+
fontSize: typographyTokens['font-size-body-regular'],
|
|
134
|
+
lineHeight: typographyTokens['line-height-body-regular'],
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (titleVariant === 'h5' || isVertical) {
|
|
139
|
+
return {
|
|
140
|
+
fontSize: typographyTokens['font-size-body-small'],
|
|
141
|
+
lineHeight: typographyTokens['line-height-body-small'],
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return {}
|
|
146
|
+
}
|
|
147
|
+
|
|
46
148
|
const textColumn = (
|
|
47
149
|
<Stack
|
|
48
|
-
spacing={
|
|
150
|
+
spacing={
|
|
151
|
+
isVertical
|
|
152
|
+
? { xs: spacingRoleBasedTokens['space-8'], sm: cards.header.rowGap }
|
|
153
|
+
: cards.header.gap
|
|
154
|
+
}
|
|
49
155
|
sx={{ flex: 1, minWidth: 0, width: '100%' }}
|
|
50
156
|
>
|
|
51
157
|
<HeadingTag id={headingId} data-testid={testIds?.heading} style={{ margin: 0 }}>
|
|
52
158
|
<Typography
|
|
53
159
|
component='span'
|
|
54
|
-
variant={titleVariant}
|
|
160
|
+
variant={titleVariant === 'card-title' ? 'body1' : titleVariant}
|
|
55
161
|
sx={{
|
|
56
|
-
color:
|
|
162
|
+
color:
|
|
163
|
+
titleTone === 'brand'
|
|
164
|
+
? colorTokens['text-link']
|
|
165
|
+
: colorTokens['text-default'],
|
|
57
166
|
// inline only when the badge has to sit on the heading's last line
|
|
58
167
|
display: hasCount ? 'inline' : 'block',
|
|
59
|
-
|
|
60
|
-
// whatever size `titleVariant` defines. Keep lineHeight paired with
|
|
61
|
-
// fontSize so wrapping titles do not clip descenders.
|
|
62
|
-
fontSize: isVertical ? { xs: '0.875rem', sm: '1.5rem' } : undefined,
|
|
63
|
-
lineHeight: isVertical ? { xs: 1.25, sm: 1.33 } : undefined,
|
|
64
|
-
fontWeight: isHeadingScale ? cards.header.titleFontWeight : undefined,
|
|
168
|
+
...getTitleTypography(),
|
|
65
169
|
overflowWrap: 'anywhere',
|
|
66
170
|
}}
|
|
67
171
|
>
|
|
@@ -93,8 +197,9 @@ function RcSesTitleBlock({
|
|
|
93
197
|
data-testid={testIds?.description}
|
|
94
198
|
variant='body2'
|
|
95
199
|
sx={{
|
|
96
|
-
color:
|
|
97
|
-
|
|
200
|
+
color: colorTokens['text-secondary'],
|
|
201
|
+
fontWeight: typographyTokens['font-weight-body-small'],
|
|
202
|
+
...getDescriptionTypography(),
|
|
98
203
|
}}
|
|
99
204
|
>
|
|
100
205
|
{description}
|
|
@@ -2,7 +2,7 @@ import { ReactNode } from 'react'
|
|
|
2
2
|
|
|
3
3
|
export type TitleBlockHeadingLevel = 2 | 3 | 4 | 5 | 6
|
|
4
4
|
|
|
5
|
-
export type TitleBlockTitleVariant = 'h4' | 'h5' | 'h6' | 'body1'
|
|
5
|
+
export type TitleBlockTitleVariant = 'h2' | 'h4' | 'h5' | 'h6' | 'body1' | 'card-title'
|
|
6
6
|
|
|
7
7
|
export type TitleBlockOrientation = 'horizontal' | 'vertical'
|
|
8
8
|
|
|
@@ -21,9 +21,11 @@ export interface RcSesTitleBlockBaseProps {
|
|
|
21
21
|
/**
|
|
22
22
|
* Visual size of the title, independent of `headingLevel`. The semantic tag
|
|
23
23
|
* (`headingLevel`) sets document structure; this sets the type scale.
|
|
24
|
-
* Defaults to `
|
|
24
|
+
* Defaults to `card-title`.
|
|
25
25
|
* `body1` (15px) draws the title as running copy: body scale, and the
|
|
26
26
|
* type scale's own weight instead of the card-header one.
|
|
27
|
+
* `card-title` uses the Figma Heading/Card title role (18/24, 20/28 from md, weight 500).
|
|
28
|
+
* Suitable for CardShell and section headers.
|
|
27
29
|
*/
|
|
28
30
|
titleVariant?: TitleBlockTitleVariant
|
|
29
31
|
/**
|
|
@@ -5,6 +5,11 @@ import React from 'react'
|
|
|
5
5
|
import { useTranslation } from 'react-i18next'
|
|
6
6
|
|
|
7
7
|
import { QuestionIcon } from '@/assets/icons/phosphorIcons'
|
|
8
|
+
import { borderTokens } from '@/theme/borderTokens'
|
|
9
|
+
import { colorTokens } from '@/theme/colorTokens'
|
|
10
|
+
import { effectTokens } from '@/theme/effectTokens'
|
|
11
|
+
import { spacingTokens } from '@/theme/spacingTokens'
|
|
12
|
+
import { typographyTokens } from '@/theme/typographyTokens'
|
|
8
13
|
|
|
9
14
|
export type RcSesTooltipProps = {
|
|
10
15
|
title: string
|
|
@@ -129,8 +134,8 @@ function RcSesTooltip({
|
|
|
129
134
|
p: 0.25,
|
|
130
135
|
ml: 0.5,
|
|
131
136
|
verticalAlign: 'text-bottom',
|
|
132
|
-
color: '
|
|
133
|
-
'&:hover, &.Mui-focusVisible': { color: '
|
|
137
|
+
color: colorTokens['text-secondary'],
|
|
138
|
+
'&:hover, &.Mui-focusVisible': { color: colorTokens['text-link'] },
|
|
134
139
|
},
|
|
135
140
|
...(Array.isArray(triggerSx) ? triggerSx : [triggerSx]),
|
|
136
141
|
]}
|
|
@@ -149,7 +154,31 @@ function RcSesTooltip({
|
|
|
149
154
|
leaveDelay={100}
|
|
150
155
|
disableTouchListener
|
|
151
156
|
slots={{ transition: Fade }}
|
|
152
|
-
slotProps={{
|
|
157
|
+
slotProps={{
|
|
158
|
+
popper: popperProps,
|
|
159
|
+
tooltip: {
|
|
160
|
+
sx: {
|
|
161
|
+
display: 'flex',
|
|
162
|
+
alignItems: 'flex-start',
|
|
163
|
+
backgroundColor: colorTokens['surface-base'],
|
|
164
|
+
color: colorTokens['text-default'],
|
|
165
|
+
boxShadow: effectTokens['elevation-md'],
|
|
166
|
+
borderRadius: borderTokens['radius-8'],
|
|
167
|
+
padding: spacingTokens['spacing-aliases-tooltip-padding'],
|
|
168
|
+
maxWidth: spacingTokens['spacing-aliases-tooltip-max-width'],
|
|
169
|
+
fontSize: typographyTokens['font-size-body-small'],
|
|
170
|
+
fontWeight: typographyTokens['font-weight-body-small'],
|
|
171
|
+
lineHeight: typographyTokens['line-height-body-small'],
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
arrow: {
|
|
175
|
+
sx: {
|
|
176
|
+
'&::before': {
|
|
177
|
+
backgroundColor: colorTokens['surface-base'],
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
}}
|
|
153
182
|
onOpen={show}
|
|
154
183
|
onClose={hide}
|
|
155
184
|
>
|