@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,253 @@
|
|
|
1
|
+
import { Box, Typography } from '@mui/material'
|
|
2
|
+
import {
|
|
3
|
+
CheckCircleIcon,
|
|
4
|
+
InfoIcon,
|
|
5
|
+
WarningIcon,
|
|
6
|
+
XCircleIcon,
|
|
7
|
+
} from '@phosphor-icons/react'
|
|
8
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
Chain,
|
|
12
|
+
Code,
|
|
13
|
+
DocPage,
|
|
14
|
+
Section,
|
|
15
|
+
hairline,
|
|
16
|
+
literalOf,
|
|
17
|
+
numericSuffix,
|
|
18
|
+
parseHex,
|
|
19
|
+
} from '@/components/storybook/TokenDocs'
|
|
20
|
+
import { borderTokens } from '@/theme/borderTokens'
|
|
21
|
+
import { colorTokens } from '@/theme/colorTokens'
|
|
22
|
+
import { typographyTokens } from '@/theme/typographyTokens'
|
|
23
|
+
|
|
24
|
+
const meta = {
|
|
25
|
+
title: 'Foundations/Colors',
|
|
26
|
+
tags: ['no-snapshot'],
|
|
27
|
+
parameters: { layout: 'padded' },
|
|
28
|
+
} satisfies Meta
|
|
29
|
+
export default meta
|
|
30
|
+
type Story = StoryObj<typeof meta>
|
|
31
|
+
|
|
32
|
+
const families = ['cyans', 'greens', 'neutrals', 'yellows', 'red'] as const
|
|
33
|
+
const steps = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950]
|
|
34
|
+
|
|
35
|
+
function Ramp({ family }: { family: (typeof families)[number] }) {
|
|
36
|
+
return (
|
|
37
|
+
<Box
|
|
38
|
+
sx={{
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
display: 'grid',
|
|
41
|
+
gap: 2,
|
|
42
|
+
gridTemplateColumns: '88px 1fr',
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
45
|
+
<Typography
|
|
46
|
+
variant='body2'
|
|
47
|
+
sx={{
|
|
48
|
+
fontWeight: typographyTokens['font-weight-semibold'],
|
|
49
|
+
textTransform: 'capitalize',
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
{family}
|
|
53
|
+
</Typography>
|
|
54
|
+
<Box
|
|
55
|
+
sx={{
|
|
56
|
+
borderRadius: borderTokens['radius-12'],
|
|
57
|
+
display: 'grid',
|
|
58
|
+
gridTemplateColumns: `repeat(${steps.length}, 1fr)`,
|
|
59
|
+
overflow: 'hidden',
|
|
60
|
+
}}
|
|
61
|
+
>
|
|
62
|
+
{steps.map((step) => {
|
|
63
|
+
const name = `color-${family}-${step}`
|
|
64
|
+
const color = parseHex(literalOf(name))
|
|
65
|
+
return (
|
|
66
|
+
<Box
|
|
67
|
+
key={step}
|
|
68
|
+
title={`--rc-${name}`}
|
|
69
|
+
sx={{
|
|
70
|
+
backgroundColor: `var(--rc-${name})`,
|
|
71
|
+
color: color?.dark
|
|
72
|
+
? colorTokens['text-inverse']
|
|
73
|
+
: colorTokens['text-default'],
|
|
74
|
+
display: 'flex',
|
|
75
|
+
flexDirection: 'column',
|
|
76
|
+
justifyContent: 'space-between',
|
|
77
|
+
minHeight: 72,
|
|
78
|
+
p: 1,
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
<Box
|
|
82
|
+
sx={{
|
|
83
|
+
fontSize: '0.75rem',
|
|
84
|
+
fontWeight: typographyTokens['font-weight-semibold'],
|
|
85
|
+
}}
|
|
86
|
+
>
|
|
87
|
+
{step}
|
|
88
|
+
</Box>
|
|
89
|
+
<Box sx={{ fontFamily: 'monospace', fontSize: '0.625rem' }}>
|
|
90
|
+
{color?.hex.slice(1)}
|
|
91
|
+
</Box>
|
|
92
|
+
</Box>
|
|
93
|
+
)
|
|
94
|
+
})}
|
|
95
|
+
</Box>
|
|
96
|
+
</Box>
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const groups = [
|
|
101
|
+
{ prefix: 'text', title: 'Text' },
|
|
102
|
+
{ prefix: 'surface', title: 'Surface' },
|
|
103
|
+
{ prefix: 'border', title: 'Border' },
|
|
104
|
+
{ prefix: 'action', title: 'Action' },
|
|
105
|
+
{ prefix: 'control', title: 'Control' },
|
|
106
|
+
{ prefix: 'status', title: 'Status' },
|
|
107
|
+
{ prefix: 'flow', title: 'Flow' },
|
|
108
|
+
] as const
|
|
109
|
+
|
|
110
|
+
type ColorToken = keyof typeof colorTokens
|
|
111
|
+
|
|
112
|
+
function Swatch({ token }: { token: ColorToken }) {
|
|
113
|
+
const isText =
|
|
114
|
+
token.startsWith('text-') || token.endsWith('-text') || token.endsWith('-icon')
|
|
115
|
+
return (
|
|
116
|
+
<Box
|
|
117
|
+
sx={{
|
|
118
|
+
alignItems: 'center',
|
|
119
|
+
backgroundColor: isText
|
|
120
|
+
? colorTokens[token.includes('inverse') ? 'surface-inverse' : 'surface-base']
|
|
121
|
+
: colorTokens[token],
|
|
122
|
+
border: hairline,
|
|
123
|
+
borderRadius: borderTokens['radius-8'],
|
|
124
|
+
color: colorTokens[token],
|
|
125
|
+
display: 'flex',
|
|
126
|
+
flexShrink: 0,
|
|
127
|
+
fontSize: '1rem',
|
|
128
|
+
fontWeight: 700,
|
|
129
|
+
height: 40,
|
|
130
|
+
justifyContent: 'center',
|
|
131
|
+
width: 40,
|
|
132
|
+
}}
|
|
133
|
+
>
|
|
134
|
+
{isText ? 'Aa' : null}
|
|
135
|
+
</Box>
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function SemanticRow({ token }: { token: ColorToken }) {
|
|
140
|
+
const name = `color-${token}`
|
|
141
|
+
const color = parseHex(literalOf(name))
|
|
142
|
+
return (
|
|
143
|
+
<Box sx={{ alignItems: 'center', display: 'flex', gap: 1.5, minWidth: 0, py: 1 }}>
|
|
144
|
+
<Swatch token={token} />
|
|
145
|
+
<Box sx={{ minWidth: 0 }}>
|
|
146
|
+
<Code>{token}</Code>
|
|
147
|
+
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1 }}>
|
|
148
|
+
<Chain name={name} />
|
|
149
|
+
<Code muted>
|
|
150
|
+
{color
|
|
151
|
+
? `${color.hex}${color.alpha < 1 ? ` · ${Math.round(color.alpha * 100)}%` : ''}`
|
|
152
|
+
: ''}
|
|
153
|
+
</Code>
|
|
154
|
+
</Box>
|
|
155
|
+
</Box>
|
|
156
|
+
</Box>
|
|
157
|
+
)
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const statuses = [
|
|
161
|
+
{ key: 'info', Icon: InfoIcon, text: 'Paraiška priimta ir laukia peržiūros.' },
|
|
162
|
+
{ key: 'success', Icon: CheckCircleIcon, text: 'Duomenys sėkmingai išsaugoti.' },
|
|
163
|
+
{
|
|
164
|
+
key: 'warning',
|
|
165
|
+
Icon: WarningIcon,
|
|
166
|
+
text: 'Dokumento galiojimas baigiasi po 3 dienų.',
|
|
167
|
+
},
|
|
168
|
+
{ key: 'error', Icon: XCircleIcon, text: 'Nepavyko pateikti formos.' },
|
|
169
|
+
] as const
|
|
170
|
+
|
|
171
|
+
function StatusPreview() {
|
|
172
|
+
return (
|
|
173
|
+
<Box
|
|
174
|
+
sx={{
|
|
175
|
+
display: 'grid',
|
|
176
|
+
gap: 1.5,
|
|
177
|
+
gridTemplateColumns: 'repeat(auto-fill, minmax(220px, 1fr))',
|
|
178
|
+
mb: 2,
|
|
179
|
+
}}
|
|
180
|
+
>
|
|
181
|
+
{statuses.map(({ key, Icon, text }) => (
|
|
182
|
+
<Box
|
|
183
|
+
key={key}
|
|
184
|
+
sx={{
|
|
185
|
+
alignItems: 'flex-start',
|
|
186
|
+
backgroundColor: colorTokens[`status-${key}-bg`],
|
|
187
|
+
border: `${borderTokens['border-default']} solid ${colorTokens[`status-${key}-border`]}`,
|
|
188
|
+
borderRadius: borderTokens['radius-8'],
|
|
189
|
+
color: colorTokens[`status-${key}-text`],
|
|
190
|
+
display: 'flex',
|
|
191
|
+
fontSize: '0.875rem',
|
|
192
|
+
gap: 1,
|
|
193
|
+
p: 1.5,
|
|
194
|
+
}}
|
|
195
|
+
>
|
|
196
|
+
<Icon
|
|
197
|
+
size={20}
|
|
198
|
+
weight='fill'
|
|
199
|
+
color={colorTokens[`status-${key}-icon`]}
|
|
200
|
+
style={{ flexShrink: 0 }}
|
|
201
|
+
/>
|
|
202
|
+
{text}
|
|
203
|
+
</Box>
|
|
204
|
+
))}
|
|
205
|
+
</Box>
|
|
206
|
+
)
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function Colors() {
|
|
210
|
+
return (
|
|
211
|
+
<DocPage
|
|
212
|
+
title='Colors'
|
|
213
|
+
lead='Primitives are the raw palette. Components use semantic tokens, which point at one primitive each, so a palette change flows through by role.'
|
|
214
|
+
>
|
|
215
|
+
<Section
|
|
216
|
+
title='Palette'
|
|
217
|
+
lead='Primitive ramps, 50 to 950. Hover a step for its CSS variable.'
|
|
218
|
+
>
|
|
219
|
+
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 1.5 }}>
|
|
220
|
+
{families.map((family) => (
|
|
221
|
+
<Ramp key={family} family={family} />
|
|
222
|
+
))}
|
|
223
|
+
</Box>
|
|
224
|
+
</Section>
|
|
225
|
+
|
|
226
|
+
{groups.map(({ prefix, title }) => {
|
|
227
|
+
const tokens = (Object.keys(colorTokens) as ColorToken[]).filter((token) =>
|
|
228
|
+
token.startsWith(`${prefix}-`),
|
|
229
|
+
)
|
|
230
|
+
return (
|
|
231
|
+
<Section key={prefix} title={title} lead={`${tokens.length} semantic tokens`}>
|
|
232
|
+
{prefix === 'status' && <StatusPreview />}
|
|
233
|
+
<Box
|
|
234
|
+
sx={{
|
|
235
|
+
columnGap: 4,
|
|
236
|
+
display: 'grid',
|
|
237
|
+
gridTemplateColumns: 'repeat(auto-fill, minmax(300px, 1fr))',
|
|
238
|
+
}}
|
|
239
|
+
>
|
|
240
|
+
{tokens
|
|
241
|
+
.sort((a, b) => a.localeCompare(b) || numericSuffix(a) - numericSuffix(b))
|
|
242
|
+
.map((token) => (
|
|
243
|
+
<SemanticRow key={token} token={token} />
|
|
244
|
+
))}
|
|
245
|
+
</Box>
|
|
246
|
+
</Section>
|
|
247
|
+
)
|
|
248
|
+
})}
|
|
249
|
+
</DocPage>
|
|
250
|
+
)
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export const Overview: Story = { render: () => <Colors /> }
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { Box, Typography } from '@mui/material'
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
3
|
+
|
|
4
|
+
import { Code, DocPage, Section, literalOf } from '@/components/storybook/TokenDocs'
|
|
5
|
+
import { borderTokens } from '@/theme/borderTokens'
|
|
6
|
+
import { colorTokens } from '@/theme/colorTokens'
|
|
7
|
+
import { effectTokens } from '@/theme/effectTokens'
|
|
8
|
+
import { typographyTokens } from '@/theme/typographyTokens'
|
|
9
|
+
|
|
10
|
+
const meta = {
|
|
11
|
+
title: 'Foundations/Effects',
|
|
12
|
+
tags: ['no-snapshot'],
|
|
13
|
+
parameters: { layout: 'padded' },
|
|
14
|
+
} satisfies Meta
|
|
15
|
+
export default meta
|
|
16
|
+
type Story = StoryObj<typeof meta>
|
|
17
|
+
|
|
18
|
+
const elevations = [
|
|
19
|
+
{ token: 'elevation-sm', use: 'Cards resting on the page' },
|
|
20
|
+
{ token: 'elevation-md', use: 'Menus, dropdowns, popovers' },
|
|
21
|
+
{ token: 'elevation-lg', use: 'Dialogs and overlays' },
|
|
22
|
+
] as const
|
|
23
|
+
|
|
24
|
+
const rings = [
|
|
25
|
+
{ token: 'focus-ring-default', label: 'Default focus' },
|
|
26
|
+
{ token: 'focus-ring-error', label: 'Error focus' },
|
|
27
|
+
] as const
|
|
28
|
+
|
|
29
|
+
// Splits a multi-layer shadow at top-level commas only.
|
|
30
|
+
const layers = (value: string) => value.split(/,(?![^(]*\))/).map((layer) => layer.trim())
|
|
31
|
+
|
|
32
|
+
function Effects() {
|
|
33
|
+
return (
|
|
34
|
+
<DocPage
|
|
35
|
+
title='Effects'
|
|
36
|
+
lead='Elevation separates layers; focus rings mark keyboard focus. Both are composite tokens, so components take them whole.'
|
|
37
|
+
>
|
|
38
|
+
<Section title='Elevation'>
|
|
39
|
+
<Box
|
|
40
|
+
sx={{
|
|
41
|
+
backgroundColor: colorTokens['surface-sunken'],
|
|
42
|
+
borderRadius: borderTokens['radius-16'],
|
|
43
|
+
display: 'grid',
|
|
44
|
+
gap: 4,
|
|
45
|
+
gridTemplateColumns: 'repeat(auto-fill, minmax(220px, 1fr))',
|
|
46
|
+
p: 4,
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
{elevations.map(({ token, use }) => (
|
|
50
|
+
<Box
|
|
51
|
+
key={token}
|
|
52
|
+
sx={{
|
|
53
|
+
backgroundColor: colorTokens['surface-base'],
|
|
54
|
+
borderRadius: borderTokens['radius-card'],
|
|
55
|
+
boxShadow: effectTokens[token],
|
|
56
|
+
display: 'flex',
|
|
57
|
+
flexDirection: 'column',
|
|
58
|
+
gap: 1,
|
|
59
|
+
minHeight: 140,
|
|
60
|
+
p: 2.5,
|
|
61
|
+
}}
|
|
62
|
+
>
|
|
63
|
+
<Typography sx={{ fontWeight: typographyTokens['font-weight-semibold'] }}>
|
|
64
|
+
{token.replace('elevation-', '').toUpperCase()}
|
|
65
|
+
</Typography>
|
|
66
|
+
<Typography
|
|
67
|
+
variant='body2'
|
|
68
|
+
sx={{ color: colorTokens['text-secondary'], flexGrow: 1 }}
|
|
69
|
+
>
|
|
70
|
+
{use}
|
|
71
|
+
</Typography>
|
|
72
|
+
<Code>{token}</Code>
|
|
73
|
+
{layers(literalOf(token)).map((layer) => (
|
|
74
|
+
<Code key={layer} muted>
|
|
75
|
+
{layer}
|
|
76
|
+
</Code>
|
|
77
|
+
))}
|
|
78
|
+
</Box>
|
|
79
|
+
))}
|
|
80
|
+
</Box>
|
|
81
|
+
</Section>
|
|
82
|
+
|
|
83
|
+
<Section
|
|
84
|
+
title='Focus rings'
|
|
85
|
+
lead='A 2px ring in the focus color, outside the element border.'
|
|
86
|
+
>
|
|
87
|
+
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 4 }}>
|
|
88
|
+
{rings.map(({ token, label }) => (
|
|
89
|
+
<Box key={token} sx={{ display: 'flex', flexDirection: 'column', gap: 1.5 }}>
|
|
90
|
+
<Box
|
|
91
|
+
sx={{
|
|
92
|
+
alignItems: 'center',
|
|
93
|
+
backgroundColor: colorTokens['surface-base'],
|
|
94
|
+
border: `${borderTokens['border-default']} solid ${colorTokens['border-default']}`,
|
|
95
|
+
borderRadius: borderTokens['radius-input'],
|
|
96
|
+
boxShadow: effectTokens[token],
|
|
97
|
+
color: colorTokens['text-secondary'],
|
|
98
|
+
display: 'flex',
|
|
99
|
+
height: 44,
|
|
100
|
+
px: 2,
|
|
101
|
+
width: 240,
|
|
102
|
+
}}
|
|
103
|
+
>
|
|
104
|
+
{label}
|
|
105
|
+
</Box>
|
|
106
|
+
<Code>{token}</Code>
|
|
107
|
+
<Code muted>{literalOf(token).replace(/var\(--rc-([\w-]+)\)/g, '$1')}</Code>
|
|
108
|
+
</Box>
|
|
109
|
+
))}
|
|
110
|
+
</Box>
|
|
111
|
+
</Section>
|
|
112
|
+
</DocPage>
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export const Overview: Story = { render: () => <Effects /> }
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { Box, Typography } from '@mui/material'
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
Code,
|
|
6
|
+
DocPage,
|
|
7
|
+
ResponsiveValues,
|
|
8
|
+
Row,
|
|
9
|
+
Section,
|
|
10
|
+
Table,
|
|
11
|
+
breakpoints,
|
|
12
|
+
cssName,
|
|
13
|
+
hairline,
|
|
14
|
+
mono,
|
|
15
|
+
useBreakpoint,
|
|
16
|
+
} from '@/components/storybook/TokenDocs'
|
|
17
|
+
import { borderTokens } from '@/theme/borderTokens'
|
|
18
|
+
import { colorTokens } from '@/theme/colorTokens'
|
|
19
|
+
import { layoutTokens } from '@/theme/layoutTokens'
|
|
20
|
+
import { typographyTokens } from '@/theme/typographyTokens'
|
|
21
|
+
|
|
22
|
+
const meta = {
|
|
23
|
+
title: 'Foundations/Layout',
|
|
24
|
+
tags: ['no-snapshot'],
|
|
25
|
+
parameters: { layout: 'padded' },
|
|
26
|
+
} satisfies Meta
|
|
27
|
+
export default meta
|
|
28
|
+
type Story = StoryObj<typeof meta>
|
|
29
|
+
|
|
30
|
+
type LayoutToken = keyof typeof layoutTokens
|
|
31
|
+
|
|
32
|
+
const rows: { token: LayoutToken; note: string }[] = [
|
|
33
|
+
{ token: 'outer-padding', note: 'Page edge to content' },
|
|
34
|
+
{ token: 'gutter', note: 'Between grid columns' },
|
|
35
|
+
{ token: 'container-narrow-width', note: 'Forms, single column' },
|
|
36
|
+
{ token: 'container-medium-width', note: 'Content pages' },
|
|
37
|
+
{ token: 'container-wide-width', note: 'Dashboards, tables' },
|
|
38
|
+
{ token: 'outer-container-max-width', note: 'Page frame' },
|
|
39
|
+
{ token: 'grid-width-lg', note: 'Grid at lg' },
|
|
40
|
+
{ token: 'column-width', note: 'Nominal column' },
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
function Layout() {
|
|
44
|
+
const current = useBreakpoint()
|
|
45
|
+
return (
|
|
46
|
+
<DocPage
|
|
47
|
+
title='Layout'
|
|
48
|
+
lead='Breakpoints follow MUI: sm 600, md 900, lg 1200. Containers and spacing widen at sm and md; outer padding grows again at lg.'
|
|
49
|
+
>
|
|
50
|
+
<Section title='Breakpoints'>
|
|
51
|
+
<Box sx={{ display: 'grid', gap: 1.5, gridTemplateColumns: 'repeat(4, 1fr)' }}>
|
|
52
|
+
{breakpoints.map((bp) => (
|
|
53
|
+
<Box
|
|
54
|
+
key={bp.key}
|
|
55
|
+
sx={{
|
|
56
|
+
border:
|
|
57
|
+
bp.key === current
|
|
58
|
+
? `2px solid ${colorTokens['border-focus']}`
|
|
59
|
+
: hairline,
|
|
60
|
+
borderRadius: borderTokens['radius-12'],
|
|
61
|
+
p: 2,
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
<Typography
|
|
65
|
+
sx={{
|
|
66
|
+
fontSize: '1.25rem',
|
|
67
|
+
fontWeight: typographyTokens['font-weight-semibold'],
|
|
68
|
+
}}
|
|
69
|
+
>
|
|
70
|
+
{bp.key}
|
|
71
|
+
</Typography>
|
|
72
|
+
<Code muted>{bp.min ? `≥ ${bp.min}px` : '< 600px'}</Code>
|
|
73
|
+
{bp.key === current && (
|
|
74
|
+
<Typography
|
|
75
|
+
variant='caption'
|
|
76
|
+
sx={{ color: colorTokens['text-link'], display: 'block', mt: 0.5 }}
|
|
77
|
+
>
|
|
78
|
+
Viewing now
|
|
79
|
+
</Typography>
|
|
80
|
+
)}
|
|
81
|
+
</Box>
|
|
82
|
+
))}
|
|
83
|
+
</Box>
|
|
84
|
+
</Section>
|
|
85
|
+
|
|
86
|
+
<Section
|
|
87
|
+
title='Tokens per breakpoint'
|
|
88
|
+
lead='Bold values change at that breakpoint; plain ones carry over.'
|
|
89
|
+
>
|
|
90
|
+
<Table columns='minmax(0, 1fr) 300px' head={['Token', 'xs · sm · md · lg']}>
|
|
91
|
+
{rows.map(({ token, note }) => (
|
|
92
|
+
<Row key={token}>
|
|
93
|
+
<Box>
|
|
94
|
+
<Code>{token}</Code>
|
|
95
|
+
<Typography variant='body2' sx={{ color: colorTokens['text-secondary'] }}>
|
|
96
|
+
{note}
|
|
97
|
+
</Typography>
|
|
98
|
+
</Box>
|
|
99
|
+
<ResponsiveValues name={cssName(layoutTokens[token])} />
|
|
100
|
+
</Row>
|
|
101
|
+
))}
|
|
102
|
+
</Table>
|
|
103
|
+
</Section>
|
|
104
|
+
|
|
105
|
+
<Section
|
|
106
|
+
title='Grid at this width'
|
|
107
|
+
lead='12 columns with the token gutter, inside the outer padding. Resize the viewport to see it change.'
|
|
108
|
+
>
|
|
109
|
+
<Box
|
|
110
|
+
sx={{
|
|
111
|
+
backgroundColor: colorTokens['status-warning-bg'],
|
|
112
|
+
borderRadius: borderTokens['radius-12'],
|
|
113
|
+
px: layoutTokens['outer-padding'],
|
|
114
|
+
py: 2,
|
|
115
|
+
}}
|
|
116
|
+
>
|
|
117
|
+
<Box
|
|
118
|
+
sx={{
|
|
119
|
+
display: 'grid',
|
|
120
|
+
gap: layoutTokens.gutter,
|
|
121
|
+
gridTemplateColumns: 'repeat(12, minmax(0, 1fr))',
|
|
122
|
+
}}
|
|
123
|
+
>
|
|
124
|
+
{Array.from({ length: 12 }, (_, index) => (
|
|
125
|
+
<Box
|
|
126
|
+
key={index}
|
|
127
|
+
sx={{
|
|
128
|
+
alignItems: 'center',
|
|
129
|
+
backgroundColor: colorTokens['surface-brand-subtle'],
|
|
130
|
+
border: `1px solid ${colorTokens['border-brand-subtle']}`,
|
|
131
|
+
borderRadius: borderTokens['radius-4'],
|
|
132
|
+
color: colorTokens['text-link'],
|
|
133
|
+
display: 'flex',
|
|
134
|
+
fontFamily: mono,
|
|
135
|
+
fontSize: '0.75rem',
|
|
136
|
+
height: 64,
|
|
137
|
+
justifyContent: 'center',
|
|
138
|
+
}}
|
|
139
|
+
>
|
|
140
|
+
{index + 1}
|
|
141
|
+
</Box>
|
|
142
|
+
))}
|
|
143
|
+
</Box>
|
|
144
|
+
</Box>
|
|
145
|
+
</Section>
|
|
146
|
+
|
|
147
|
+
<Section
|
|
148
|
+
title='Containers'
|
|
149
|
+
lead='Max widths at this breakpoint, centered in the page frame.'
|
|
150
|
+
>
|
|
151
|
+
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 1 }}>
|
|
152
|
+
{(['wide', 'medium', 'narrow'] as const).map((variant) => (
|
|
153
|
+
<Box
|
|
154
|
+
key={variant}
|
|
155
|
+
sx={{
|
|
156
|
+
alignItems: 'center',
|
|
157
|
+
backgroundColor: colorTokens['surface-brand-subtle'],
|
|
158
|
+
border: `1px dashed ${colorTokens['border-focus']}`,
|
|
159
|
+
borderRadius: borderTokens['radius-8'],
|
|
160
|
+
display: 'flex',
|
|
161
|
+
height: 40,
|
|
162
|
+
justifyContent: 'center',
|
|
163
|
+
marginInline: 'auto',
|
|
164
|
+
maxWidth: layoutTokens[`container-${variant}-width`],
|
|
165
|
+
width: '100%',
|
|
166
|
+
}}
|
|
167
|
+
>
|
|
168
|
+
<Code>{`container-${variant}-width`}</Code>
|
|
169
|
+
</Box>
|
|
170
|
+
))}
|
|
171
|
+
</Box>
|
|
172
|
+
</Section>
|
|
173
|
+
</DocPage>
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export const Overview: Story = { render: () => <Layout /> }
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { Box, Typography } from '@mui/material'
|
|
2
|
+
import { CheckIcon } from '@phosphor-icons/react'
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Chain,
|
|
7
|
+
Code,
|
|
8
|
+
DocPage,
|
|
9
|
+
Row,
|
|
10
|
+
Section,
|
|
11
|
+
Stage,
|
|
12
|
+
Table,
|
|
13
|
+
hairline,
|
|
14
|
+
literalOf,
|
|
15
|
+
numericSuffix,
|
|
16
|
+
toPx,
|
|
17
|
+
} from '@/components/storybook/TokenDocs'
|
|
18
|
+
import { borderTokens } from '@/theme/borderTokens'
|
|
19
|
+
import { colorTokens } from '@/theme/colorTokens'
|
|
20
|
+
import { sizeTokens } from '@/theme/sizeTokens'
|
|
21
|
+
import { typographyTokens } from '@/theme/typographyTokens'
|
|
22
|
+
|
|
23
|
+
const meta = {
|
|
24
|
+
title: 'Foundations/Sizes',
|
|
25
|
+
tags: ['no-snapshot'],
|
|
26
|
+
parameters: { layout: 'padded' },
|
|
27
|
+
} satisfies Meta
|
|
28
|
+
export default meta
|
|
29
|
+
type Story = StoryObj<typeof meta>
|
|
30
|
+
|
|
31
|
+
type SizeToken = keyof typeof sizeTokens
|
|
32
|
+
|
|
33
|
+
const all = Object.keys(sizeTokens) as SizeToken[]
|
|
34
|
+
const scale = all
|
|
35
|
+
.filter((name) => /^icon-size-\d+$/.test(name))
|
|
36
|
+
.sort((a, b) => numericSuffix(a) - numericSuffix(b))
|
|
37
|
+
const roles = all.filter((name) => !scale.includes(name)).sort()
|
|
38
|
+
|
|
39
|
+
// The dashed square is the token box; the glyph fills it as icons do in components.
|
|
40
|
+
function Specimen({ token }: { token: SizeToken }) {
|
|
41
|
+
return (
|
|
42
|
+
<Box
|
|
43
|
+
sx={{
|
|
44
|
+
color: colorTokens['text-default'],
|
|
45
|
+
display: 'flex',
|
|
46
|
+
height: sizeTokens[token],
|
|
47
|
+
outline: `1px dashed ${colorTokens['border-focus']}`,
|
|
48
|
+
width: sizeTokens[token],
|
|
49
|
+
}}
|
|
50
|
+
>
|
|
51
|
+
<CheckIcon aria-hidden weight='bold' style={{ width: '100%', height: '100%' }} />
|
|
52
|
+
</Box>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function Sizes() {
|
|
57
|
+
return (
|
|
58
|
+
<DocPage
|
|
59
|
+
title='Sizes'
|
|
60
|
+
lead='Icon sizes. Components bind to the role tokens; each role points at one step of the scale.'
|
|
61
|
+
>
|
|
62
|
+
<Section title='Icon scale'>
|
|
63
|
+
<Box
|
|
64
|
+
sx={{
|
|
65
|
+
display: 'grid',
|
|
66
|
+
gap: 2,
|
|
67
|
+
gridTemplateColumns: 'repeat(auto-fill, minmax(120px, 1fr))',
|
|
68
|
+
}}
|
|
69
|
+
>
|
|
70
|
+
{scale.map((name) => (
|
|
71
|
+
<Box
|
|
72
|
+
key={name}
|
|
73
|
+
sx={{
|
|
74
|
+
alignItems: 'center',
|
|
75
|
+
border: hairline,
|
|
76
|
+
borderRadius: borderTokens['radius-12'],
|
|
77
|
+
display: 'flex',
|
|
78
|
+
flexDirection: 'column',
|
|
79
|
+
gap: 1.5,
|
|
80
|
+
p: 2,
|
|
81
|
+
}}
|
|
82
|
+
>
|
|
83
|
+
<Stage>
|
|
84
|
+
<Specimen token={name} />
|
|
85
|
+
</Stage>
|
|
86
|
+
<Box sx={{ textAlign: 'center' }}>
|
|
87
|
+
<Typography
|
|
88
|
+
sx={{
|
|
89
|
+
fontSize: '1.5rem',
|
|
90
|
+
fontWeight: typographyTokens['font-weight-semibold'],
|
|
91
|
+
lineHeight: 1.2,
|
|
92
|
+
}}
|
|
93
|
+
>
|
|
94
|
+
{numericSuffix(name)}
|
|
95
|
+
</Typography>
|
|
96
|
+
<Code>{name}</Code>
|
|
97
|
+
</Box>
|
|
98
|
+
</Box>
|
|
99
|
+
))}
|
|
100
|
+
</Box>
|
|
101
|
+
</Section>
|
|
102
|
+
|
|
103
|
+
<Section title='Icon roles'>
|
|
104
|
+
<Table columns='64px minmax(0, 1fr) 72px' head={['', 'Token', 'Value']}>
|
|
105
|
+
{roles.map((name) => (
|
|
106
|
+
<Row key={name}>
|
|
107
|
+
<Stage height={48}>
|
|
108
|
+
<Specimen token={name} />
|
|
109
|
+
</Stage>
|
|
110
|
+
<Box>
|
|
111
|
+
<Code>{name}</Code>
|
|
112
|
+
<Chain name={name} />
|
|
113
|
+
</Box>
|
|
114
|
+
<Code muted>{toPx(literalOf(name))}</Code>
|
|
115
|
+
</Row>
|
|
116
|
+
))}
|
|
117
|
+
</Table>
|
|
118
|
+
</Section>
|
|
119
|
+
</DocPage>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export const Overview: Story = { render: () => <Sizes /> }
|