@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
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs'
|
|
2
|
+
import { expect, test } from 'vitest'
|
|
3
|
+
|
|
4
|
+
import { typographyTokens } from './typographyTokens'
|
|
5
|
+
|
|
6
|
+
// Typography.zip Figma export: xs, sm, md, lg; values in px at a 16px root.
|
|
7
|
+
const expected = {
|
|
8
|
+
'heading-h1': [
|
|
9
|
+
[28, 32],
|
|
10
|
+
[30, 36],
|
|
11
|
+
[36, 40],
|
|
12
|
+
[36, 40],
|
|
13
|
+
],
|
|
14
|
+
'heading-h2': [
|
|
15
|
+
[20, 26],
|
|
16
|
+
[22, 28],
|
|
17
|
+
[24, 32],
|
|
18
|
+
[24, 32],
|
|
19
|
+
],
|
|
20
|
+
'heading-h3': [
|
|
21
|
+
[16, 22],
|
|
22
|
+
[18, 24],
|
|
23
|
+
[18, 24],
|
|
24
|
+
[18, 24],
|
|
25
|
+
],
|
|
26
|
+
'heading-card-title': [
|
|
27
|
+
[18, 24],
|
|
28
|
+
[18, 24],
|
|
29
|
+
[20, 28],
|
|
30
|
+
[20, 28],
|
|
31
|
+
],
|
|
32
|
+
'heading-h4': [
|
|
33
|
+
[16, 22],
|
|
34
|
+
[16, 22],
|
|
35
|
+
[16, 22],
|
|
36
|
+
[16, 22],
|
|
37
|
+
],
|
|
38
|
+
'heading-h5': [
|
|
39
|
+
[14, 20],
|
|
40
|
+
[14, 20],
|
|
41
|
+
[14, 20],
|
|
42
|
+
[14, 20],
|
|
43
|
+
],
|
|
44
|
+
'body-large': [
|
|
45
|
+
[16, 24],
|
|
46
|
+
[16, 24],
|
|
47
|
+
[16, 24],
|
|
48
|
+
[16, 24],
|
|
49
|
+
],
|
|
50
|
+
'body-lead': [
|
|
51
|
+
[16, 24],
|
|
52
|
+
[16, 24],
|
|
53
|
+
[16, 24],
|
|
54
|
+
[16, 24],
|
|
55
|
+
],
|
|
56
|
+
'body-regular': [
|
|
57
|
+
[15, 22],
|
|
58
|
+
[15, 22],
|
|
59
|
+
[15, 22],
|
|
60
|
+
[15, 22],
|
|
61
|
+
],
|
|
62
|
+
'body-small': [
|
|
63
|
+
[14, 20],
|
|
64
|
+
[14, 20],
|
|
65
|
+
[14, 20],
|
|
66
|
+
[14, 20],
|
|
67
|
+
],
|
|
68
|
+
'body-caption': [
|
|
69
|
+
[13, 18],
|
|
70
|
+
[13, 18],
|
|
71
|
+
[13, 18],
|
|
72
|
+
[13, 18],
|
|
73
|
+
],
|
|
74
|
+
'body-micro': [
|
|
75
|
+
[12, 20],
|
|
76
|
+
[12, 20],
|
|
77
|
+
[12, 20],
|
|
78
|
+
[12, 20],
|
|
79
|
+
],
|
|
80
|
+
'button-regular': [
|
|
81
|
+
[15, 20],
|
|
82
|
+
[15, 20],
|
|
83
|
+
[15, 20],
|
|
84
|
+
[15, 20],
|
|
85
|
+
],
|
|
86
|
+
'button-compact': [
|
|
87
|
+
[14, 20],
|
|
88
|
+
[14, 20],
|
|
89
|
+
[14, 20],
|
|
90
|
+
[14, 20],
|
|
91
|
+
],
|
|
92
|
+
} as const
|
|
93
|
+
|
|
94
|
+
test('all 28 typography dimensions match the Figma export in four discrete modes', () => {
|
|
95
|
+
const css = readFileSync('src/theme/tokens.css', 'utf8')
|
|
96
|
+
const blocks = css.split('@media')
|
|
97
|
+
expect(blocks).toHaveLength(4)
|
|
98
|
+
expect(blocks[1]).toContain('min-width: 600px')
|
|
99
|
+
expect(blocks[2]).toContain('min-width: 900px')
|
|
100
|
+
expect(blocks[3]).toContain('min-width: 1200px')
|
|
101
|
+
expect(Object.keys(typographyTokens)).toHaveLength(61)
|
|
102
|
+
const values = new Map<string, number>()
|
|
103
|
+
blocks.forEach((block, index) => {
|
|
104
|
+
Array.from(block.matchAll(/--rc-typography-([\w-]+): ([\d.]+)rem;/g)).forEach(
|
|
105
|
+
([, key, amount]) => values.set(key, Number(amount) * 16),
|
|
106
|
+
)
|
|
107
|
+
expect(values.size).toBe(28)
|
|
108
|
+
Object.entries(expected).forEach(([role, modes]) => {
|
|
109
|
+
expect(
|
|
110
|
+
values.get(`font-size-${role}`),
|
|
111
|
+
`${['xs', 'sm', 'md', 'lg'][index]}: font-size-${role}`,
|
|
112
|
+
).toBe(modes[index][0])
|
|
113
|
+
expect(
|
|
114
|
+
values.get(`line-height-${role}`),
|
|
115
|
+
`${['xs', 'sm', 'md', 'lg'][index]}: line-height-${role}`,
|
|
116
|
+
).toBe(modes[index][1])
|
|
117
|
+
})
|
|
118
|
+
})
|
|
119
|
+
expect(css).not.toContain('clamp(')
|
|
120
|
+
})
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { CSSProperties } from '@mui/material/styles'
|
|
2
|
+
|
|
3
|
+
// CSS variable references. Values and responsive modes live in tokens.css.
|
|
4
|
+
const typographyTokens = {
|
|
5
|
+
// Font family
|
|
6
|
+
'font-family': 'var(--rc-typography-font-family-base)',
|
|
7
|
+
// Font weights (primitives)
|
|
8
|
+
'font-weight-light': 'var(--rc-typography-font-weight-light)',
|
|
9
|
+
'font-weight-regular': 'var(--rc-typography-font-weight-regular)',
|
|
10
|
+
'font-weight-medium': 'var(--rc-typography-font-weight-medium)',
|
|
11
|
+
'font-weight-semibold': 'var(--rc-typography-font-weight-semibold)',
|
|
12
|
+
// Font sizes
|
|
13
|
+
'font-size-body-caption': 'var(--rc-typography-font-size-body-caption)',
|
|
14
|
+
'font-size-body-large': 'var(--rc-typography-font-size-body-large)',
|
|
15
|
+
'font-size-body-lead': 'var(--rc-typography-font-size-body-lead)',
|
|
16
|
+
'font-size-body-micro': 'var(--rc-typography-font-size-body-micro)',
|
|
17
|
+
'font-size-body-regular': 'var(--rc-typography-font-size-body-regular)',
|
|
18
|
+
'font-size-body-small': 'var(--rc-typography-font-size-body-small)',
|
|
19
|
+
'font-size-button-compact': 'var(--rc-typography-font-size-button-compact)',
|
|
20
|
+
'font-size-button-regular': 'var(--rc-typography-font-size-button-regular)',
|
|
21
|
+
'font-size-heading-card-title': 'var(--rc-typography-font-size-heading-card-title)',
|
|
22
|
+
'font-size-heading-h1': 'var(--rc-typography-font-size-heading-h1)',
|
|
23
|
+
'font-size-heading-h2': 'var(--rc-typography-font-size-heading-h2)',
|
|
24
|
+
'font-size-heading-h3': 'var(--rc-typography-font-size-heading-h3)',
|
|
25
|
+
'font-size-heading-h4': 'var(--rc-typography-font-size-heading-h4)',
|
|
26
|
+
'font-size-heading-h5': 'var(--rc-typography-font-size-heading-h5)',
|
|
27
|
+
// Line heights
|
|
28
|
+
'line-height-body-caption': 'var(--rc-typography-line-height-body-caption)',
|
|
29
|
+
'line-height-body-large': 'var(--rc-typography-line-height-body-large)',
|
|
30
|
+
'line-height-body-lead': 'var(--rc-typography-line-height-body-lead)',
|
|
31
|
+
'line-height-body-micro': 'var(--rc-typography-line-height-body-micro)',
|
|
32
|
+
'line-height-body-regular': 'var(--rc-typography-line-height-body-regular)',
|
|
33
|
+
'line-height-body-small': 'var(--rc-typography-line-height-body-small)',
|
|
34
|
+
'line-height-button-compact': 'var(--rc-typography-line-height-button-compact)',
|
|
35
|
+
'line-height-button-regular': 'var(--rc-typography-line-height-button-regular)',
|
|
36
|
+
'line-height-heading-card-title': 'var(--rc-typography-line-height-heading-card-title)',
|
|
37
|
+
'line-height-heading-h1': 'var(--rc-typography-line-height-heading-h1)',
|
|
38
|
+
'line-height-heading-h2': 'var(--rc-typography-line-height-heading-h2)',
|
|
39
|
+
'line-height-heading-h3': 'var(--rc-typography-line-height-heading-h3)',
|
|
40
|
+
'line-height-heading-h4': 'var(--rc-typography-line-height-heading-h4)',
|
|
41
|
+
'line-height-heading-h5': 'var(--rc-typography-line-height-heading-h5)',
|
|
42
|
+
// Font weights
|
|
43
|
+
'font-weight-heading-h1': 'var(--rc-typography-font-weight-heading-h1)',
|
|
44
|
+
'font-weight-heading-h2': 'var(--rc-typography-font-weight-heading-h2)',
|
|
45
|
+
'font-weight-heading-h3': 'var(--rc-typography-font-weight-heading-h3)',
|
|
46
|
+
'font-weight-heading-h4': 'var(--rc-typography-font-weight-heading-h4)',
|
|
47
|
+
'font-weight-heading-h5': 'var(--rc-typography-font-weight-heading-h5)',
|
|
48
|
+
'font-weight-heading-card-title': 'var(--rc-typography-font-weight-heading-card-title)',
|
|
49
|
+
'font-weight-body-large': 'var(--rc-typography-font-weight-body-large)',
|
|
50
|
+
'font-weight-body-lead': 'var(--rc-typography-font-weight-body-lead)',
|
|
51
|
+
'font-weight-body-regular': 'var(--rc-typography-font-weight-body-regular)',
|
|
52
|
+
'font-weight-body-small': 'var(--rc-typography-font-weight-body-small)',
|
|
53
|
+
'font-weight-body-caption': 'var(--rc-typography-font-weight-body-caption)',
|
|
54
|
+
'font-weight-body-micro': 'var(--rc-typography-font-weight-body-micro)',
|
|
55
|
+
'font-weight-button-regular': 'var(--rc-typography-font-weight-button-regular)',
|
|
56
|
+
'font-weight-button-compact': 'var(--rc-typography-font-weight-button-compact)',
|
|
57
|
+
// Letter spacing
|
|
58
|
+
'letter-spacing-heading-h1': 'var(--rc-typography-letter-spacing-heading-h1)',
|
|
59
|
+
'letter-spacing-heading-h2': 'var(--rc-typography-letter-spacing-heading-h2)',
|
|
60
|
+
'letter-spacing-heading-h3': 'var(--rc-typography-letter-spacing-heading-h3)',
|
|
61
|
+
'letter-spacing-heading-h4': 'var(--rc-typography-letter-spacing-heading-h4)',
|
|
62
|
+
'letter-spacing-heading-h5': 'var(--rc-typography-letter-spacing-heading-h5)',
|
|
63
|
+
'letter-spacing-heading-card-title':
|
|
64
|
+
'var(--rc-typography-letter-spacing-heading-card-title)',
|
|
65
|
+
'letter-spacing-body-large': 'var(--rc-typography-letter-spacing-body-large)',
|
|
66
|
+
'letter-spacing-body-lead': 'var(--rc-typography-letter-spacing-body-lead)',
|
|
67
|
+
'letter-spacing-body-regular': 'var(--rc-typography-letter-spacing-body-regular)',
|
|
68
|
+
'letter-spacing-body-small': 'var(--rc-typography-letter-spacing-body-small)',
|
|
69
|
+
'letter-spacing-body-caption': 'var(--rc-typography-letter-spacing-body-caption)',
|
|
70
|
+
'letter-spacing-body-micro': 'var(--rc-typography-letter-spacing-body-micro)',
|
|
71
|
+
'letter-spacing-button-regular': 'var(--rc-typography-letter-spacing-button-regular)',
|
|
72
|
+
'letter-spacing-button-compact': 'var(--rc-typography-letter-spacing-button-compact)',
|
|
73
|
+
} as const
|
|
74
|
+
|
|
75
|
+
export { typographyTokens }
|
|
76
|
+
export default typographyTokens
|
|
77
|
+
|
|
78
|
+
/** Existing MUI variants retain their font attributes; unmatched roles are additive. */
|
|
79
|
+
export const typographyRoleVariants = {
|
|
80
|
+
'heading-h1': 'h1',
|
|
81
|
+
'heading-h2': 'h2',
|
|
82
|
+
'heading-h3': 'h3',
|
|
83
|
+
'heading-card-title': 'headingCardTitle',
|
|
84
|
+
'heading-h4': 'h4',
|
|
85
|
+
'heading-h5': 'h5',
|
|
86
|
+
'body-large': 'bodyLarge',
|
|
87
|
+
'body-lead': 'subtitle1',
|
|
88
|
+
'body-regular': 'body1',
|
|
89
|
+
'body-small': 'body2',
|
|
90
|
+
'body-caption': 'caption',
|
|
91
|
+
'body-micro': 'subtitle2',
|
|
92
|
+
'button-regular': 'button',
|
|
93
|
+
'button-compact': 'buttonCompact',
|
|
94
|
+
} as const
|
|
95
|
+
|
|
96
|
+
export type RcSesTypographyRole = keyof typeof typographyRoleVariants
|
|
97
|
+
export type RcSesNamedTypographyVariant =
|
|
98
|
+
'headingCardTitle' | 'bodyLarge' | 'buttonCompact'
|
|
99
|
+
|
|
100
|
+
declare module '@mui/material/styles' {
|
|
101
|
+
interface TypographyVariants {
|
|
102
|
+
headingCardTitle?: CSSProperties
|
|
103
|
+
bodyLarge?: CSSProperties
|
|
104
|
+
buttonCompact?: CSSProperties
|
|
105
|
+
}
|
|
106
|
+
interface TypographyVariantsOptions {
|
|
107
|
+
headingCardTitle?: CSSProperties
|
|
108
|
+
bodyLarge?: CSSProperties
|
|
109
|
+
buttonCompact?: CSSProperties
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
declare module '@mui/material/Typography' {
|
|
114
|
+
interface TypographyPropsVariantOverrides {
|
|
115
|
+
headingCardTitle: true
|
|
116
|
+
bodyLarge: true
|
|
117
|
+
buttonCompact: true
|
|
118
|
+
}
|
|
119
|
+
}
|
package/dist/theme/spacing.d.ts
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { Meta } from '@storybook/addon-docs/blocks'
|
|
2
|
-
import { primary, secondary, grey, warning, error } from '@/theme/palette'
|
|
3
|
-
|
|
4
|
-
<Meta title="Foundations/Colors" />
|
|
5
|
-
|
|
6
|
-
# 🎨 Color Palette
|
|
7
|
-
|
|
8
|
-
All color tokens used throughout RC SES React Components are defined centrally in `src/theme/palette.tsx` and can be imported from the library.
|
|
9
|
-
|
|
10
|
-
## Primary Color
|
|
11
|
-
Used for main actions, links, and interactive elements.
|
|
12
|
-
|
|
13
|
-
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(6, 1fr)', gap: '12px', marginBottom: '32px' }}>
|
|
14
|
-
{Object.entries(primary).map(([key, value]) => (
|
|
15
|
-
<div key={key} style={{ textAlign: 'center' }}>
|
|
16
|
-
<div style={{
|
|
17
|
-
width: '100%',
|
|
18
|
-
height: '80px',
|
|
19
|
-
backgroundColor: value,
|
|
20
|
-
borderRadius: '8px',
|
|
21
|
-
marginBottom: '8px',
|
|
22
|
-
border: '1px solid #ddd'
|
|
23
|
-
}} />
|
|
24
|
-
<div style={{ fontSize: '12px', fontWeight: '600' }}>{key}</div>
|
|
25
|
-
<div style={{ fontSize: '11px', color: '#666', fontFamily: 'monospace' }}>{value}</div>
|
|
26
|
-
</div>
|
|
27
|
-
))}
|
|
28
|
-
</div>
|
|
29
|
-
|
|
30
|
-
## Secondary Color
|
|
31
|
-
Used for secondary actions and highlights.
|
|
32
|
-
|
|
33
|
-
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(6, 1fr)', gap: '12px', marginBottom: '32px' }}>
|
|
34
|
-
{Object.entries(secondary).map(([key, value]) => (
|
|
35
|
-
<div key={key} style={{ textAlign: 'center' }}>
|
|
36
|
-
<div style={{
|
|
37
|
-
width: '100%',
|
|
38
|
-
height: '80px',
|
|
39
|
-
backgroundColor: value,
|
|
40
|
-
borderRadius: '8px',
|
|
41
|
-
marginBottom: '8px',
|
|
42
|
-
border: '1px solid #ddd'
|
|
43
|
-
}} />
|
|
44
|
-
<div style={{ fontSize: '12px', fontWeight: '600' }}>{key}</div>
|
|
45
|
-
<div style={{ fontSize: '11px', color: '#666', fontFamily: 'monospace' }}>{value}</div>
|
|
46
|
-
</div>
|
|
47
|
-
))}
|
|
48
|
-
</div>
|
|
49
|
-
|
|
50
|
-
## Neutral Colors (Grey)
|
|
51
|
-
Used for text, borders, backgrounds, and disabled states.
|
|
52
|
-
|
|
53
|
-
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(6, 1fr)', gap: '12px', marginBottom: '32px' }}>
|
|
54
|
-
{Object.entries(grey).map(([key, value]) => (
|
|
55
|
-
<div key={key} style={{ textAlign: 'center' }}>
|
|
56
|
-
<div style={{
|
|
57
|
-
width: '100%',
|
|
58
|
-
height: '80px',
|
|
59
|
-
backgroundColor: value,
|
|
60
|
-
borderRadius: '8px',
|
|
61
|
-
marginBottom: '8px',
|
|
62
|
-
border: '1px solid #ddd'
|
|
63
|
-
}} />
|
|
64
|
-
<div style={{ fontSize: '12px', fontWeight: '600' }}>{key}</div>
|
|
65
|
-
<div style={{ fontSize: '11px', color: '#666', fontFamily: 'monospace' }}>{value}</div>
|
|
66
|
-
</div>
|
|
67
|
-
))}
|
|
68
|
-
</div>
|
|
69
|
-
|
|
70
|
-
## Warning Color
|
|
71
|
-
Used for warning messages and alerts.
|
|
72
|
-
|
|
73
|
-
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(6, 1fr)', gap: '12px', marginBottom: '32px' }}>
|
|
74
|
-
{Object.entries(warning).map(([key, value]) => (
|
|
75
|
-
<div key={key} style={{ textAlign: 'center' }}>
|
|
76
|
-
<div style={{
|
|
77
|
-
width: '100%',
|
|
78
|
-
height: '80px',
|
|
79
|
-
backgroundColor: value,
|
|
80
|
-
borderRadius: '8px',
|
|
81
|
-
marginBottom: '8px',
|
|
82
|
-
border: '1px solid #ddd'
|
|
83
|
-
}} />
|
|
84
|
-
<div style={{ fontSize: '12px', fontWeight: '600' }}>{key}</div>
|
|
85
|
-
<div style={{ fontSize: '11px', color: '#666', fontFamily: 'monospace' }}>{value}</div>
|
|
86
|
-
</div>
|
|
87
|
-
))}
|
|
88
|
-
</div>
|
|
89
|
-
|
|
90
|
-
## Error Color
|
|
91
|
-
Used for error messages and destructive actions.
|
|
92
|
-
|
|
93
|
-
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(6, 1fr)', gap: '12px', marginBottom: '32px' }}>
|
|
94
|
-
{Object.entries(error).map(([key, value]) => (
|
|
95
|
-
<div key={key} style={{ textAlign: 'center' }}>
|
|
96
|
-
<div style={{
|
|
97
|
-
width: '100%',
|
|
98
|
-
height: '80px',
|
|
99
|
-
backgroundColor: value,
|
|
100
|
-
borderRadius: '8px',
|
|
101
|
-
marginBottom: '8px',
|
|
102
|
-
border: '1px solid #ddd'
|
|
103
|
-
}} />
|
|
104
|
-
<div style={{ fontSize: '12px', fontWeight: '600' }}>{key}</div>
|
|
105
|
-
<div style={{ fontSize: '11px', color: '#666', fontFamily: 'monospace' }}>{value}</div>
|
|
106
|
-
</div>
|
|
107
|
-
))}
|
|
108
|
-
</div>
|
|
109
|
-
|
|
110
|
-
## Usage
|
|
111
|
-
|
|
112
|
-
Import and use color tokens in your components:
|
|
113
|
-
|
|
114
|
-
```typescript
|
|
115
|
-
// Import the entire palette
|
|
116
|
-
import palette from '@/theme/palette'
|
|
117
|
-
|
|
118
|
-
// Use in components
|
|
119
|
-
<Box sx={{ backgroundColor: palette.primary['50'] }} />
|
|
120
|
-
|
|
121
|
-
// Or destructure specific colors
|
|
122
|
-
import { primary, error, grey } from '@/theme/palette'
|
|
123
|
-
|
|
124
|
-
const color = primary['600']
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
|