@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
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
useMediaQuery,
|
|
7
7
|
} from '@mui/material'
|
|
8
8
|
import { Meta, StoryObj } from '@storybook/react-vite'
|
|
9
|
-
import { useState } from 'react'
|
|
9
|
+
import { CSSProperties, useState } from 'react'
|
|
10
10
|
|
|
11
11
|
import RcSesButton from '@/components/common/Button'
|
|
12
12
|
import RcSesBottomSheet, {
|
|
@@ -96,6 +96,53 @@ export const Default: Story = {
|
|
|
96
96
|
render: (args) => <BottomSheetDemo {...args} />,
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
export const TokenBindings: Story = {
|
|
100
|
+
render: () => (
|
|
101
|
+
<RcSesBottomSheet
|
|
102
|
+
open
|
|
103
|
+
onClose={() => undefined}
|
|
104
|
+
title='Token bindings'
|
|
105
|
+
primaryActionLabel='Apply'
|
|
106
|
+
secondaryActionLabel='Cancel'
|
|
107
|
+
>
|
|
108
|
+
<Typography>Bottom sheet content</Typography>
|
|
109
|
+
</RcSesBottomSheet>
|
|
110
|
+
),
|
|
111
|
+
parameters: {
|
|
112
|
+
docs: {
|
|
113
|
+
description: {
|
|
114
|
+
story:
|
|
115
|
+
'Sheet spacing, handle geometry, surface and heading-h3 typography follow the Figma shell using DS tokens. The upward shadow has no matching effect token. Action layout, dismissal and accessibility behavior are unchanged.',
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export const TokenOverrides: Story = {
|
|
122
|
+
render: () => (
|
|
123
|
+
<div
|
|
124
|
+
style={
|
|
125
|
+
{
|
|
126
|
+
'--rc-color-border-default': '#0079ad',
|
|
127
|
+
'--rc-radius-modal': '1.5rem',
|
|
128
|
+
'--rc-space-16': '2rem',
|
|
129
|
+
} as CSSProperties
|
|
130
|
+
}
|
|
131
|
+
>
|
|
132
|
+
<RcSesBottomSheet
|
|
133
|
+
open
|
|
134
|
+
onClose={() => undefined}
|
|
135
|
+
title='Token overrides'
|
|
136
|
+
disablePortal
|
|
137
|
+
>
|
|
138
|
+
<Typography>
|
|
139
|
+
Scoped CSS tokens also reach the sheet with disablePortal.
|
|
140
|
+
</Typography>
|
|
141
|
+
</RcSesBottomSheet>
|
|
142
|
+
</div>
|
|
143
|
+
),
|
|
144
|
+
}
|
|
145
|
+
|
|
99
146
|
export const WithActions: Story = {
|
|
100
147
|
render: (args) => <BottomSheetDemo {...args} />,
|
|
101
148
|
args: {
|
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
import { Box, Typography } from '@mui/material'
|
|
1
|
+
import { Box, Button, Stack, Typography, useMediaQuery, useTheme } from '@mui/material'
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
3
3
|
import { useState } from 'react'
|
|
4
4
|
|
|
5
|
-
import DataPagination
|
|
5
|
+
import DataPagination, {
|
|
6
|
+
type DataPaginationProps,
|
|
7
|
+
} from '@/components/common/DataPagination'
|
|
8
|
+
import ExpandButton from '@/components/common/DataPagination/components/ExpandButton'
|
|
6
9
|
|
|
7
10
|
const meta = {
|
|
8
11
|
title: 'Organisms/DataPagination',
|
|
9
12
|
component: DataPagination,
|
|
10
13
|
tags: ['autodocs'],
|
|
14
|
+
parameters: {
|
|
15
|
+
docs: {
|
|
16
|
+
description: {
|
|
17
|
+
component:
|
|
18
|
+
'Use totalItems for responsive record pagination (desktop 10 / mobile 5). Override desktopPageSize and mobilePageSize independently. onPageSizeChange(size, page) reports the resized page; update both the data query/slice and controlled page together. count retains its legacy meaning: number of pages. Mobile starts below the theme md breakpoint. Use ExpandButton instead of Pagination, never alongside it for the same list.',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
11
22
|
args: {
|
|
12
23
|
count: 12,
|
|
13
24
|
defaultPage: 1,
|
|
@@ -49,7 +60,11 @@ const meta = {
|
|
|
49
60
|
export default meta
|
|
50
61
|
type Story = StoryObj<typeof meta>
|
|
51
62
|
|
|
52
|
-
function ControlledDataPaginationDemo({
|
|
63
|
+
function ControlledDataPaginationDemo({
|
|
64
|
+
page: initialPage,
|
|
65
|
+
onChange,
|
|
66
|
+
...args
|
|
67
|
+
}: DataPaginationProps) {
|
|
53
68
|
const [page, setPage] = useState(initialPage ?? 1)
|
|
54
69
|
|
|
55
70
|
return (
|
|
@@ -81,3 +96,112 @@ export const Controlled: Story = {
|
|
|
81
96
|
page: 1,
|
|
82
97
|
},
|
|
83
98
|
}
|
|
99
|
+
|
|
100
|
+
function RecordsDemo({
|
|
101
|
+
totalItems = 123,
|
|
102
|
+
desktopPageSize = 10,
|
|
103
|
+
mobilePageSize = 5,
|
|
104
|
+
defaultPage = 1,
|
|
105
|
+
}: {
|
|
106
|
+
totalItems?: number
|
|
107
|
+
desktopPageSize?: number
|
|
108
|
+
mobilePageSize?: number
|
|
109
|
+
defaultPage?: number
|
|
110
|
+
}) {
|
|
111
|
+
const theme = useTheme()
|
|
112
|
+
const mobile = useMediaQuery(theme.breakpoints.down('md'))
|
|
113
|
+
const [page, setPage] = useState(defaultPage)
|
|
114
|
+
const [size, setSize] = useState(mobile ? mobilePageSize : desktopPageSize)
|
|
115
|
+
const records = Array.from({ length: totalItems }, (_, i) => i + 1)
|
|
116
|
+
return (
|
|
117
|
+
<Stack spacing={2}>
|
|
118
|
+
<Typography component='output' aria-label='Puslapiavimo būsena'>
|
|
119
|
+
Puslapis {page}; dydis {size}
|
|
120
|
+
</Typography>
|
|
121
|
+
<Box component='ul' aria-label='Įrašai' sx={{ pl: 3, m: 0 }}>
|
|
122
|
+
{records.slice((page - 1) * size, page * size).map((number) => (
|
|
123
|
+
<li key={number}>Įrašas {number}</li>
|
|
124
|
+
))}
|
|
125
|
+
</Box>
|
|
126
|
+
<DataPagination
|
|
127
|
+
totalItems={totalItems}
|
|
128
|
+
desktopPageSize={desktopPageSize}
|
|
129
|
+
mobilePageSize={mobilePageSize}
|
|
130
|
+
page={page}
|
|
131
|
+
onChange={setPage}
|
|
132
|
+
onPageSizeChange={(newSize, newPage) => {
|
|
133
|
+
setSize(newSize)
|
|
134
|
+
setPage(newPage)
|
|
135
|
+
}}
|
|
136
|
+
/>
|
|
137
|
+
</Stack>
|
|
138
|
+
)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export const ResponsiveRecords: Story = {
|
|
142
|
+
render: () => <RecordsDemo />,
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export const CustomPageSizes: Story = {
|
|
146
|
+
render: () => <RecordsDemo desktopPageSize={4} mobilePageSize={2} />,
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export const Mobile: Story = {
|
|
150
|
+
tags: ['viewport-320'],
|
|
151
|
+
render: () => <DataPagination totalItems={100} />,
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export const Boundaries: Story = {
|
|
155
|
+
render: () => (
|
|
156
|
+
<Stack spacing={3}>
|
|
157
|
+
<DataPagination count={20} defaultPage={1} ariaLabel='Pirmas puslapis' />
|
|
158
|
+
<DataPagination count={20} defaultPage={10} ariaLabel='Vidurinis puslapis' />
|
|
159
|
+
<DataPagination count={20} defaultPage={20} ariaLabel='Paskutinis puslapis' />
|
|
160
|
+
</Stack>
|
|
161
|
+
),
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function LoadingDemo() {
|
|
165
|
+
const [page, setPage] = useState(1)
|
|
166
|
+
const [loading, setLoading] = useState(false)
|
|
167
|
+
return (
|
|
168
|
+
<Stack spacing={2}>
|
|
169
|
+
<Button onClick={() => setLoading(!loading)}>
|
|
170
|
+
{loading ? 'Baigti užklausą' : 'Pradėti užklausą'}
|
|
171
|
+
</Button>
|
|
172
|
+
<DataPagination
|
|
173
|
+
count={12}
|
|
174
|
+
page={page}
|
|
175
|
+
onChange={(next) => {
|
|
176
|
+
setPage(next)
|
|
177
|
+
setLoading(true)
|
|
178
|
+
}}
|
|
179
|
+
isLoading={loading}
|
|
180
|
+
/>
|
|
181
|
+
</Stack>
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export const NetworkLoading: Story = { render: () => <LoadingDemo /> }
|
|
186
|
+
|
|
187
|
+
export const Loading: Story = { args: { isLoading: true } }
|
|
188
|
+
|
|
189
|
+
function ExpandDemo() {
|
|
190
|
+
const [expanded, setExpanded] = useState(false)
|
|
191
|
+
return (
|
|
192
|
+
<Stack spacing={2} sx={{ alignItems: 'flex-start' }}>
|
|
193
|
+
<Box component='ul' id='expand-records'>
|
|
194
|
+
{Array.from({ length: expanded ? 12 : 3 }, (_, i) => (
|
|
195
|
+
<li key={i + 1}>Įrašas {i + 1}</li>
|
|
196
|
+
))}
|
|
197
|
+
</Box>
|
|
198
|
+
<ExpandButton
|
|
199
|
+
expanded={expanded}
|
|
200
|
+
aria-controls='expand-records'
|
|
201
|
+
onClick={() => setExpanded(!expanded)}
|
|
202
|
+
/>
|
|
203
|
+
</Stack>
|
|
204
|
+
)
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export const ExpandAlternative: Story = { render: () => <ExpandDemo /> }
|
|
@@ -135,6 +135,19 @@ export const Open: Story = {
|
|
|
135
135
|
},
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
+
export const TokenOverrides: Story = {
|
|
139
|
+
...Open,
|
|
140
|
+
args: {
|
|
141
|
+
...Open.args,
|
|
142
|
+
sx: {
|
|
143
|
+
'--rc-color-surface-base': '#fff8ed',
|
|
144
|
+
'--rc-color-border-default': '#986b22',
|
|
145
|
+
'--rc-radius-modal': '24px',
|
|
146
|
+
'& .MuiDialog-paper': { boxShadow: 'none' },
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
}
|
|
150
|
+
|
|
138
151
|
export const SmallDialog: Story = {
|
|
139
152
|
render: (args) => (
|
|
140
153
|
<DialogStory {...args}>
|
|
@@ -5,6 +5,7 @@ import RcSesFileDropzone from '@/components/form/inputs/FileDropzone'
|
|
|
5
5
|
import FieldPreviewRow from '@/components/storybook/FieldPreviewRow'
|
|
6
6
|
import FieldView from '@/components/storybook/FieldView'
|
|
7
7
|
import Fields from '@/components/storybook/Fields'
|
|
8
|
+
import FileUploadTokenPreview from '@/components/storybook/FileUploadTokenPreview'
|
|
8
9
|
import PreviewTitle from '@/components/storybook/PreviewTitle'
|
|
9
10
|
|
|
10
11
|
interface FormModel {
|
|
@@ -98,3 +99,8 @@ export const Main: Story = {
|
|
|
98
99
|
},
|
|
99
100
|
},
|
|
100
101
|
}
|
|
102
|
+
|
|
103
|
+
export const TokenBindings = { render: () => <FileUploadTokenPreview dropzone /> }
|
|
104
|
+
export const TokenOverrides = {
|
|
105
|
+
render: () => <FileUploadTokenPreview dropzone overrides />,
|
|
106
|
+
}
|
|
@@ -5,6 +5,7 @@ import RcSesFileUpload from '@/components/form/inputs/FileUpload'
|
|
|
5
5
|
import FieldPreviewRow from '@/components/storybook/FieldPreviewRow'
|
|
6
6
|
import FieldView from '@/components/storybook/FieldView'
|
|
7
7
|
import Fields from '@/components/storybook/Fields'
|
|
8
|
+
import FileUploadTokenPreview from '@/components/storybook/FileUploadTokenPreview'
|
|
8
9
|
import PreviewTitle from '@/components/storybook/PreviewTitle'
|
|
9
10
|
|
|
10
11
|
interface FormModel {
|
|
@@ -141,3 +142,6 @@ export const Main = {
|
|
|
141
142
|
},
|
|
142
143
|
},
|
|
143
144
|
}
|
|
145
|
+
|
|
146
|
+
export const TokenBindings = { render: () => <FileUploadTokenPreview /> }
|
|
147
|
+
export const TokenOverrides = { render: () => <FileUploadTokenPreview overrides /> }
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
+
import type { CSSProperties } from 'react'
|
|
2
3
|
|
|
3
4
|
import RcSesFooter from '@/components/layout/Footer'
|
|
4
5
|
|
|
@@ -17,3 +18,22 @@ export const Main: Story = {
|
|
|
17
18
|
text: '© Valstybės įmonė Registrų centras. Duomenys apie įmonę kaupiami ir saugomi Juridinių asmenų registre.\nStudentų g. 39, LT-08106 Vilnius | tel. +370 5 268 8262 | el. p. info@registrucentras.lt | įmonės kodas 124110246 | PVM mokėtojo kodas LT241102419',
|
|
18
19
|
},
|
|
19
20
|
}
|
|
21
|
+
|
|
22
|
+
export const TokenBindings: Story = { ...Main }
|
|
23
|
+
|
|
24
|
+
export const TokenOverrides: Story = {
|
|
25
|
+
...Main,
|
|
26
|
+
render: (args) => (
|
|
27
|
+
<div
|
|
28
|
+
style={
|
|
29
|
+
{
|
|
30
|
+
'--rc-color-neutrals-950': '#082d44',
|
|
31
|
+
'--rc-color-neutrals-200': '#ffffff',
|
|
32
|
+
'--rc-space-24': '32px',
|
|
33
|
+
} as CSSProperties
|
|
34
|
+
}
|
|
35
|
+
>
|
|
36
|
+
<RcSesFooter {...args} />
|
|
37
|
+
</div>
|
|
38
|
+
),
|
|
39
|
+
}
|
|
@@ -96,3 +96,56 @@ export const WithoutIcon: Story = {
|
|
|
96
96
|
primaryActionLabel: 'Pašalinti',
|
|
97
97
|
},
|
|
98
98
|
}
|
|
99
|
+
|
|
100
|
+
/** Open previews ensure the modal itself is included in visual regression tests. */
|
|
101
|
+
export const TokenBindings: Story = {
|
|
102
|
+
render: (args) => <RcSesModal {...args} />,
|
|
103
|
+
// The modal portals out of an otherwise empty root, which the snapshot spec can check before it mounts.
|
|
104
|
+
tags: ['snapshot-fullpage'],
|
|
105
|
+
args: {
|
|
106
|
+
open: true,
|
|
107
|
+
title: 'Ar tikrai norite tęsti?',
|
|
108
|
+
message: 'Aprašymo tekstas. Pakeisk šį turinį per slot override.',
|
|
109
|
+
variant: 'confirm',
|
|
110
|
+
showIcon: true,
|
|
111
|
+
secondaryActionLabel: 'Atšaukti',
|
|
112
|
+
primaryActionLabel: 'Tęsti',
|
|
113
|
+
},
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export const DestructiveTokenBindings: Story = {
|
|
117
|
+
...TokenBindings,
|
|
118
|
+
tags: ['snapshot-fullpage'],
|
|
119
|
+
args: { ...TokenBindings.args, variant: 'destructive' },
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export const SuccessTokenBindings: Story = {
|
|
123
|
+
...TokenBindings,
|
|
124
|
+
tags: ['snapshot-fullpage'],
|
|
125
|
+
args: { ...TokenBindings.args, variant: 'success', primaryActionLabel: 'Uždaryti' },
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export const InfoTokenBindings: Story = {
|
|
129
|
+
...TokenBindings,
|
|
130
|
+
tags: ['snapshot-fullpage'],
|
|
131
|
+
args: { ...TokenBindings.args, variant: 'info', primaryActionLabel: 'Suprantu' },
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export const MobileTokenBindings: Story = {
|
|
135
|
+
...TokenBindings,
|
|
136
|
+
tags: ['snapshot-fullpage', 'viewport-390'],
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export const TokenOverrides: Story = {
|
|
140
|
+
...TokenBindings,
|
|
141
|
+
tags: ['snapshot-fullpage'],
|
|
142
|
+
args: {
|
|
143
|
+
...TokenBindings.args,
|
|
144
|
+
sx: {
|
|
145
|
+
'--rc-color-surface-base': '#fff8ed',
|
|
146
|
+
'--rc-color-border-default': '#986b22',
|
|
147
|
+
'--rc-radius-modal': '24px',
|
|
148
|
+
'--rc-color-status-info-icon': '#986b22',
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
}
|
|
@@ -3,7 +3,6 @@ import { Meta, StoryObj } from '@storybook/react-vite'
|
|
|
3
3
|
import React from 'react'
|
|
4
4
|
|
|
5
5
|
import RcSesServiceHeader from '@/components/layout/ServiceHeader'
|
|
6
|
-
import { common, grey } from '@/theme/palette'
|
|
7
6
|
|
|
8
7
|
const meta: Meta<typeof RcSesServiceHeader> = {
|
|
9
8
|
title: 'Organisms/ServiceHeader',
|
|
@@ -32,7 +31,7 @@ export const Default: Story = {
|
|
|
32
31
|
title: 'Service Title',
|
|
33
32
|
children: 'This is a description of the service.',
|
|
34
33
|
breadcrumbsProps: breadcrumbs,
|
|
35
|
-
backgroundColor:
|
|
34
|
+
backgroundColor: '#ffffff',
|
|
36
35
|
},
|
|
37
36
|
render: (args) => (
|
|
38
37
|
<RcSesServiceHeader
|
|
@@ -50,7 +49,7 @@ export const CustomBackground: Story = {
|
|
|
50
49
|
title: 'Service Title',
|
|
51
50
|
children: 'This is a description of the service with custom background.',
|
|
52
51
|
breadcrumbsProps: breadcrumbs,
|
|
53
|
-
backgroundColor:
|
|
52
|
+
backgroundColor: '#f0f2f5',
|
|
54
53
|
},
|
|
55
54
|
render: (args) => (
|
|
56
55
|
<RcSesServiceHeader
|
|
@@ -62,3 +61,26 @@ export const CustomBackground: Story = {
|
|
|
62
61
|
</RcSesServiceHeader>
|
|
63
62
|
),
|
|
64
63
|
}
|
|
64
|
+
|
|
65
|
+
export const TokenBindings: Story = {
|
|
66
|
+
...Default,
|
|
67
|
+
args: { ...Default.args, backgroundColor: undefined },
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export const TokenOverrides: Story = {
|
|
71
|
+
...TokenBindings,
|
|
72
|
+
render: (args) => (
|
|
73
|
+
<div
|
|
74
|
+
style={
|
|
75
|
+
{
|
|
76
|
+
'--rc-color-surface-base': '#f0f2f5',
|
|
77
|
+
'--rc-space-10': '16px',
|
|
78
|
+
} as React.CSSProperties
|
|
79
|
+
}
|
|
80
|
+
>
|
|
81
|
+
<RcSesServiceHeader {...args}>
|
|
82
|
+
<Typography variant='body1'>{args.children}</Typography>
|
|
83
|
+
</RcSesServiceHeader>
|
|
84
|
+
</div>
|
|
85
|
+
),
|
|
86
|
+
}
|
|
@@ -133,7 +133,7 @@ export const InsideCardShell: Story = {
|
|
|
133
133
|
<RcSesTitleBlock
|
|
134
134
|
icon={<RcSesIconWithSquareBackground Icon={BriefcaseIcon} variant='solid' />}
|
|
135
135
|
title='Įmonėms ir organizacijoms'
|
|
136
|
-
titleVariant='
|
|
136
|
+
titleVariant='card-title'
|
|
137
137
|
/>
|
|
138
138
|
}
|
|
139
139
|
footer={
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
-
import { useState } from 'react'
|
|
2
|
+
import { type CSSProperties, useState } from 'react'
|
|
3
3
|
|
|
4
4
|
import ServiceWizardStepper from '@/components/layout/ServiceWizardStepper'
|
|
5
5
|
import { StepItem } from '@/components/layout/ServiceWizardStepper/StepperTypes'
|
|
@@ -58,3 +58,39 @@ export const Horizontal: Story = {
|
|
|
58
58
|
export const Vertical: Story = {
|
|
59
59
|
render: (args) => <ServiceWizardStepperDemo {...args} orientation='vertical' />,
|
|
60
60
|
}
|
|
61
|
+
|
|
62
|
+
export const TokenBindings: Story = {
|
|
63
|
+
args: { steps, activeStep: 1, orientation: 'horizontal' },
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const VerticalTokenBindings: Story = {
|
|
67
|
+
...TokenBindings,
|
|
68
|
+
args: { ...TokenBindings.args, orientation: 'vertical' },
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const Loading: Story = {
|
|
72
|
+
...TokenBindings,
|
|
73
|
+
args: { ...TokenBindings.args, isLoading: true },
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const MobileTokenBindings: Story = {
|
|
77
|
+
...TokenBindings,
|
|
78
|
+
tags: ['viewport-375'],
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export const TokenOverrides: Story = {
|
|
82
|
+
...TokenBindings,
|
|
83
|
+
render: (args) => (
|
|
84
|
+
<div
|
|
85
|
+
style={
|
|
86
|
+
{
|
|
87
|
+
'--rc-color-cyans-400': '#008561',
|
|
88
|
+
'--rc-color-neutrals-800': '#005276',
|
|
89
|
+
'--rc-typography-font-size-heading-h4': '18px',
|
|
90
|
+
} as CSSProperties
|
|
91
|
+
}
|
|
92
|
+
>
|
|
93
|
+
<ServiceWizardStepper {...args} />
|
|
94
|
+
</div>
|
|
95
|
+
),
|
|
96
|
+
}
|
|
@@ -5,6 +5,7 @@ import { useState } from 'react'
|
|
|
5
5
|
import { RcSesSideNavItem } from '@/components/common/SideNav/SideNav.types'
|
|
6
6
|
import RcSesSideNavLayout from '@/components/common/SideNav/SideNavLayout'
|
|
7
7
|
import FieldView from '@/components/storybook/FieldView'
|
|
8
|
+
import { typographyTokens } from '@/theme/typographyTokens'
|
|
8
9
|
|
|
9
10
|
const ITEMS: RcSesSideNavItem[] = [
|
|
10
11
|
{ id: 'family', label: 'Aš ir mano šeima', count: 4 },
|
|
@@ -47,7 +48,13 @@ function Sections({ items = ITEMS }: { items?: RcSesSideNavItem[] }) {
|
|
|
47
48
|
scrollMarginTop: 'var(--rc-ses-sidenav-scroll-offset, 0px)',
|
|
48
49
|
}}
|
|
49
50
|
>
|
|
50
|
-
<Typography
|
|
51
|
+
<Typography
|
|
52
|
+
variant='h3'
|
|
53
|
+
sx={{
|
|
54
|
+
fontSize: '1.25rem',
|
|
55
|
+
fontWeight: typographyTokens['font-weight-semibold'],
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
51
58
|
{item.label}
|
|
52
59
|
</Typography>
|
|
53
60
|
<Typography sx={{ color: '#6b747f' }}>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { expect, test } from 'vitest'
|
|
2
|
+
|
|
3
|
+
import { backdropTokens } from './backdropTokens'
|
|
4
|
+
|
|
5
|
+
test('backdrops mix the inverse and base surfaces at the designer-defined opacity', () => {
|
|
6
|
+
expect(backdropTokens).toEqual({
|
|
7
|
+
'backdrop-dark':
|
|
8
|
+
'color-mix(in srgb, var(--rc-color-surface-inverse) 55%, transparent)',
|
|
9
|
+
'backdrop-light': 'color-mix(in srgb, var(--rc-color-surface-base) 70%, transparent)',
|
|
10
|
+
})
|
|
11
|
+
})
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { colorTokens } from './colorTokens'
|
|
2
|
+
|
|
3
|
+
// Figma has no backdrop variables; the designer defined them as semantic surfaces
|
|
4
|
+
// mixed with transparency (figma-deviations Q14).
|
|
5
|
+
const backdropTokens = {
|
|
6
|
+
'backdrop-dark': `color-mix(in srgb, ${colorTokens['surface-inverse']} 55%, transparent)`,
|
|
7
|
+
'backdrop-light': `color-mix(in srgb, ${colorTokens['surface-base']} 70%, transparent)`,
|
|
8
|
+
} as const
|
|
9
|
+
|
|
10
|
+
export { backdropTokens }
|
|
11
|
+
export default backdropTokens
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs'
|
|
2
|
+
import { expect, test } from 'vitest'
|
|
3
|
+
|
|
4
|
+
import { borderTokens } from './borderTokens'
|
|
5
|
+
|
|
6
|
+
// Borders.zip, Mode 1: 11 radius primitives, 8 aliases, 2 legacy radii, 7 strokes.
|
|
7
|
+
test('all 28 Borders tokens match the export, with acyclic primitive aliases', () => {
|
|
8
|
+
const blocks = readFileSync('src/theme/tokens.css', 'utf8').split('@media')
|
|
9
|
+
const declarations = new Map(
|
|
10
|
+
Array.from(
|
|
11
|
+
blocks[0].matchAll(/--rc-((?:radius-|stroke-|border-|borders-)[\w-]+): ([^;]+);/g),
|
|
12
|
+
([, key, value]) => [key, value],
|
|
13
|
+
),
|
|
14
|
+
)
|
|
15
|
+
const expected = new Map<string, string>()
|
|
16
|
+
;[0, 2, 4, 6, 8, 10, 12, 14, 16, 20, 24, 9999].forEach((value) => {
|
|
17
|
+
expected.set(
|
|
18
|
+
`radius-${value === 9999 ? 'full' : value}`,
|
|
19
|
+
value === 9999 ? '9999px' : `${value / 16}rem`,
|
|
20
|
+
)
|
|
21
|
+
})
|
|
22
|
+
Object.entries({
|
|
23
|
+
button: '8',
|
|
24
|
+
card: '16',
|
|
25
|
+
chip: '4',
|
|
26
|
+
input: '8',
|
|
27
|
+
'list-item': '8',
|
|
28
|
+
modal: '16',
|
|
29
|
+
pill: 'full',
|
|
30
|
+
subcard: '12',
|
|
31
|
+
}).forEach(([role, primitive]) => {
|
|
32
|
+
expected.set(`radius-${role}`, `var(--rc-radius-${primitive})`)
|
|
33
|
+
})
|
|
34
|
+
expected.set('borders-button-border-radius', 'var(--rc-radius-8)')
|
|
35
|
+
expected.set('borders-container-border-radius', 'var(--rc-radius-16)')
|
|
36
|
+
;[0, 1, 2, 4].forEach((value) => expected.set(`stroke-${value}`, `${value}px`))
|
|
37
|
+
Object.entries({ accent: 4, default: 1, focus: 2 }).forEach(([role, value]) =>
|
|
38
|
+
expected.set(`border-${role}`, `var(--rc-stroke-${value})`),
|
|
39
|
+
)
|
|
40
|
+
expect(declarations).toEqual(expected)
|
|
41
|
+
expect(Object.keys(borderTokens).sort()).toEqual(
|
|
42
|
+
[...expected.keys()].map((key) => key.replace(/^borders-/, '')).sort(),
|
|
43
|
+
)
|
|
44
|
+
expected.forEach((value, key) => {
|
|
45
|
+
expect(borderTokens[key.replace(/^borders-/, '') as keyof typeof borderTokens]).toBe(
|
|
46
|
+
`var(--rc-${key})`,
|
|
47
|
+
)
|
|
48
|
+
if (value.startsWith('var(')) {
|
|
49
|
+
const target = value.slice('var(--rc-'.length, -1)
|
|
50
|
+
expect(declarations.has(target)).toBe(true)
|
|
51
|
+
expect(declarations.get(target)).toMatch(/^[\d.]+(rem|px)$/)
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
blocks
|
|
55
|
+
.slice(1)
|
|
56
|
+
.forEach((block) =>
|
|
57
|
+
expect(block).not.toMatch(/--rc-(?:radius-|stroke-|border-|borders-)/),
|
|
58
|
+
)
|
|
59
|
+
})
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// CSS variable references; values live in tokens.css.
|
|
2
|
+
|
|
3
|
+
const borderTokens = {
|
|
4
|
+
'button-border-radius': 'var(--rc-borders-button-border-radius)',
|
|
5
|
+
'container-border-radius': 'var(--rc-borders-container-border-radius)',
|
|
6
|
+
'radius-button': 'var(--rc-radius-button)',
|
|
7
|
+
'radius-card': 'var(--rc-radius-card)',
|
|
8
|
+
'radius-chip': 'var(--rc-radius-chip)',
|
|
9
|
+
'radius-input': 'var(--rc-radius-input)',
|
|
10
|
+
'radius-list-item': 'var(--rc-radius-list-item)',
|
|
11
|
+
'radius-modal': 'var(--rc-radius-modal)',
|
|
12
|
+
'radius-pill': 'var(--rc-radius-pill)',
|
|
13
|
+
'radius-subcard': 'var(--rc-radius-subcard)',
|
|
14
|
+
'radius-0': 'var(--rc-radius-0)',
|
|
15
|
+
'radius-10': 'var(--rc-radius-10)',
|
|
16
|
+
'radius-12': 'var(--rc-radius-12)',
|
|
17
|
+
'radius-14': 'var(--rc-radius-14)',
|
|
18
|
+
'radius-16': 'var(--rc-radius-16)',
|
|
19
|
+
'radius-2': 'var(--rc-radius-2)',
|
|
20
|
+
'radius-20': 'var(--rc-radius-20)',
|
|
21
|
+
'radius-24': 'var(--rc-radius-24)',
|
|
22
|
+
'radius-4': 'var(--rc-radius-4)',
|
|
23
|
+
'radius-6': 'var(--rc-radius-6)',
|
|
24
|
+
'radius-8': 'var(--rc-radius-8)',
|
|
25
|
+
'radius-full': 'var(--rc-radius-full)',
|
|
26
|
+
'border-accent': 'var(--rc-border-accent)',
|
|
27
|
+
'border-default': 'var(--rc-border-default)',
|
|
28
|
+
'border-focus': 'var(--rc-border-focus)',
|
|
29
|
+
'stroke-0': 'var(--rc-stroke-0)',
|
|
30
|
+
'stroke-1': 'var(--rc-stroke-1)',
|
|
31
|
+
'stroke-2': 'var(--rc-stroke-2)',
|
|
32
|
+
'stroke-4': 'var(--rc-stroke-4)',
|
|
33
|
+
} as const
|
|
34
|
+
|
|
35
|
+
export { borderTokens }
|
|
36
|
+
export default borderTokens
|