@registrucentras/rc-ses-react-components 2.7.3 → 3.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (289) hide show
  1. package/dist/assets/icons/phosphorIcons.d.ts +4 -0
  2. package/dist/components/common/Accordion/hooks/useAccordionController.d.ts +2 -1
  3. package/dist/components/common/Accordion/index.d.ts +18 -4
  4. package/dist/components/common/Accordion/types/AccordionControllerState.d.ts +1 -0
  5. package/dist/components/common/Card/index.d.ts +3 -0
  6. package/dist/components/common/CheckboxMark/index.d.ts +8 -0
  7. package/dist/components/common/DataPagination/components/ExpandButton.d.ts +7 -0
  8. package/dist/components/common/DataPagination/components/PaginationButton.d.ts +2 -1
  9. package/dist/components/common/DataPagination/index.d.ts +13 -3
  10. package/dist/components/common/DataPagination/paginationModel.d.ts +4 -0
  11. package/dist/components/common/Divider/index.d.ts +6 -0
  12. package/dist/components/common/EmptyState/index.d.ts +21 -0
  13. package/dist/components/common/IconWithSquareBackground/index.d.ts +2 -2
  14. package/dist/components/common/ImageCard/index.d.ts +5 -0
  15. package/dist/components/common/LinkTile/index.d.ts +11 -0
  16. package/dist/components/common/RadioMark/index.d.ts +8 -0
  17. package/dist/components/common/StepCard/StepCardFooter/index.d.ts +1 -1
  18. package/dist/components/common/TitleBlock/types.d.ts +4 -2
  19. package/dist/components/form/components/FormControlWrapper/index.d.ts +2 -1
  20. package/dist/components/form/inputs/Datepicker/RangeDatepicker.d.ts +23 -0
  21. package/dist/components/form/inputs/Datepicker/SingleDatepicker.d.ts +24 -0
  22. package/dist/components/form/inputs/Datepicker/components/CalendarViewsHeader.d.ts +18 -0
  23. package/dist/components/form/inputs/Datepicker/index.d.ts +10 -14
  24. package/dist/components/form/inputs/Datepicker/rangeModel.d.ts +4 -0
  25. package/dist/components/form/inputs/FileDropzone.d.ts +2 -2
  26. package/dist/components/form/inputs/RadioButtonGroup.d.ts +1 -0
  27. package/dist/components/form/inputs/Select/Select.styles.d.ts +84 -0
  28. package/dist/components/form/inputs/Select/components/OptionCheckbox.d.ts +2 -1
  29. package/dist/components/form/inputs/TextField.d.ts +27 -12
  30. package/dist/components/form/inputs/TextField.styles.d.ts +101 -0
  31. package/dist/components/layout/ServiceWizardStepper/stepperTokens.d.ts +5 -0
  32. package/dist/components/loaders/Loader/index.d.ts +12 -9
  33. package/dist/components/overlays/BottomSheet/index.d.ts +3 -2
  34. package/dist/components/overlays/Dialog/index.d.ts +1 -1
  35. package/dist/components/storybook/FileUploadTokenPreview.d.ts +4 -0
  36. package/dist/components/storybook/TabsTokenPreview.d.ts +3 -0
  37. package/dist/components/storybook/TokenDocs.d.ts +74 -0
  38. package/dist/library/index.d.ts +30 -1
  39. package/dist/registrucentras-rc-ses-react-components.cjs +2 -2
  40. package/dist/registrucentras-rc-ses-react-components.js +11143 -8378
  41. package/dist/theme/backdropTokens.d.ts +6 -0
  42. package/dist/theme/borderTokens.d.ts +33 -0
  43. package/dist/theme/cards.d.ts +42 -73
  44. package/dist/theme/colorTokens.d.ts +146 -0
  45. package/dist/theme/effectTokens.d.ts +9 -0
  46. package/dist/theme/layoutTokens.d.ts +12 -0
  47. package/dist/theme/light/MuiAccordion.d.ts +2 -2
  48. package/dist/theme/light/MuiAccordionSummary.d.ts +19 -0
  49. package/dist/theme/light/MuiButton.d.ts +7 -0
  50. package/dist/theme/light/MuiInputBase.d.ts +2 -0
  51. package/dist/theme/light/MuiPickerPopper.d.ts +3 -0
  52. package/dist/theme/light/MuiTypography.d.ts +0 -14
  53. package/dist/theme/palette.d.ts +8 -0
  54. package/dist/theme/sizeTokens.d.ts +20 -0
  55. package/dist/theme/spacingRoleBasedTokens.d.ts +38 -0
  56. package/dist/theme/spacingTokens.d.ts +97 -0
  57. package/dist/theme/tokenTheme.d.ts +13 -0
  58. package/dist/theme/typographyTokens.d.ts +104 -0
  59. package/package.json +2 -2
  60. package/src/assets/icons/phosphorIcons.ts +1 -0
  61. package/src/components/common/Accordion/hooks/useAccordionController.tsx +39 -7
  62. package/src/components/common/Accordion/index.test.tsx +132 -0
  63. package/src/components/common/Accordion/index.tsx +302 -25
  64. package/src/components/common/Accordion/types/AccordionControllerState.ts +1 -0
  65. package/src/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemLeading.tsx +3 -3
  66. package/src/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemTrailing.tsx +8 -3
  67. package/src/components/common/AdvancedList/components/AdvancedListItem/index.tsx +3 -2
  68. package/src/components/common/AdvancedList/components/AdvancedListItemShell/index.test.tsx +3 -3
  69. package/src/components/common/AdvancedList/components/AdvancedListItemShell/index.tsx +23 -19
  70. package/src/components/common/AdvancedList/index.test.tsx +4 -2
  71. package/src/components/common/Alert/index.tsx +10 -6
  72. package/src/components/common/Badge/index.tsx +50 -37
  73. package/src/components/common/Button/index.tsx +12 -10
  74. package/src/components/common/Card/index.tsx +6 -1
  75. package/src/components/common/CardShell/index.test.tsx +16 -6
  76. package/src/components/common/CheckboxMark/index.tsx +86 -0
  77. package/src/components/common/DataPagination/components/DataPaginationSkeleton.tsx +9 -7
  78. package/src/components/common/DataPagination/components/ExpandButton.tsx +48 -0
  79. package/src/components/common/DataPagination/components/PaginationButton.tsx +48 -21
  80. package/src/components/common/DataPagination/index.test.tsx +229 -12
  81. package/src/components/common/DataPagination/index.tsx +135 -60
  82. package/src/components/common/DataPagination/paginationModel.ts +35 -0
  83. package/src/components/common/Divider/index.test.tsx +33 -0
  84. package/src/components/common/Divider/index.tsx +52 -0
  85. package/src/components/common/EmptyState/index.test.tsx +56 -0
  86. package/src/components/common/EmptyState/index.tsx +211 -0
  87. package/src/components/common/FilterChip/index.tsx +24 -19
  88. package/src/components/common/IconWithCircularBackground.tsx +24 -6
  89. package/src/components/common/IconWithSquareBackground/index.test.tsx +14 -2
  90. package/src/components/common/IconWithSquareBackground/index.tsx +36 -17
  91. package/src/components/common/ImageCard/index.test.tsx +16 -0
  92. package/src/components/common/ImageCard/index.tsx +54 -1
  93. package/src/components/common/LinkTile/index.test.tsx +57 -0
  94. package/src/components/common/LinkTile/index.tsx +136 -0
  95. package/src/components/common/ListWithIcons/components/ListWithIconsItem.tsx +39 -23
  96. package/src/components/common/ListWithIcons/index.test.tsx +20 -9
  97. package/src/components/common/ListWithIcons/index.tsx +6 -6
  98. package/src/components/common/Popover/index.tsx +11 -1
  99. package/src/components/common/RadioMark/index.tsx +76 -0
  100. package/src/components/common/SegmentedControl/components/SegmentButton/index.tsx +49 -25
  101. package/src/components/common/SegmentedControl/index.tsx +10 -6
  102. package/src/components/common/SelectableCardList/components/SelectableCardListItem.tsx +7 -5
  103. package/src/components/common/SelectableCardList/index.test.tsx +8 -6
  104. package/src/components/common/SelectionMarks.test.tsx +92 -0
  105. package/src/components/common/ServiceLinks/ServiceLinkItem/index.tsx +20 -11
  106. package/src/components/common/ServiceLinks/index.tsx +3 -3
  107. package/src/components/common/SideNav/SideNavLayout.tsx +6 -1
  108. package/src/components/common/SideNav/components/SideNavPill.tsx +24 -12
  109. package/src/components/common/SideNav/components/SideNavPillList.tsx +18 -12
  110. package/src/components/common/SideNav/components/SideNavRow.tsx +22 -15
  111. package/src/components/common/SideNav/index.tsx +10 -9
  112. package/src/components/common/Snackbar/config.ts +27 -8
  113. package/src/components/common/Snackbar/index.tsx +39 -16
  114. package/src/components/common/StepCard/StepCardFooter/index.tsx +28 -6
  115. package/src/components/common/StepCard/index.tsx +18 -6
  116. package/src/components/common/Switch/index.tsx +10 -4
  117. package/src/components/common/Tabs/TabPanel.tsx +6 -3
  118. package/src/components/common/Tabs/TabsWrapper.tsx +15 -7
  119. package/src/components/common/TitleBlock/index.test.tsx +14 -17
  120. package/src/components/common/TitleBlock/index.tsx +120 -15
  121. package/src/components/common/TitleBlock/types.ts +4 -2
  122. package/src/components/common/Tooltip/index.tsx +32 -3
  123. package/src/components/form/components/FormControlWrapper/index.tsx +43 -14
  124. package/src/components/form/inputs/CheckboxFormControl.tsx +25 -13
  125. package/src/components/form/inputs/Datepicker/RangeDatepicker.tsx +356 -0
  126. package/src/components/form/inputs/Datepicker/SingleDatepicker.tsx +207 -0
  127. package/src/components/form/inputs/Datepicker/components/CalendarViewsHeader.tsx +335 -0
  128. package/src/components/form/inputs/Datepicker/components/RcSesDatepickerCalendarHeader.tsx +22 -10
  129. package/src/components/form/inputs/Datepicker/index.test.tsx +23 -18
  130. package/src/components/form/inputs/Datepicker/index.tsx +20 -150
  131. package/src/components/form/inputs/Datepicker/rangeModel.test.ts +35 -0
  132. package/src/components/form/inputs/Datepicker/rangeModel.ts +25 -0
  133. package/src/components/form/inputs/FileDropzone.tsx +73 -46
  134. package/src/components/form/inputs/FileUpload.tsx +25 -16
  135. package/src/components/form/inputs/NumberStepper.tsx +36 -14
  136. package/src/components/form/inputs/PhoneInputFormControl/components/AutocompleteInput.tsx +10 -5
  137. package/src/components/form/inputs/PhoneInputFormControl/components/ListboxComponent.tsx +7 -1
  138. package/src/components/form/inputs/PhoneInputFormControl/components/PopperComponent.tsx +5 -2
  139. package/src/components/form/inputs/PhoneInputFormControl/components/RowComponent.tsx +9 -5
  140. package/src/components/form/inputs/PhoneInputFormControl/index.tsx +48 -24
  141. package/src/components/form/inputs/RadioButtonGroup.tsx +14 -6
  142. package/src/components/form/inputs/Select/Select.styles.ts +76 -0
  143. package/src/components/form/inputs/Select/components/OptionCheckbox.tsx +6 -33
  144. package/src/components/form/inputs/Select/index.tsx +124 -86
  145. package/src/components/form/inputs/SimpleCheckbox.tsx +10 -3
  146. package/src/components/form/inputs/TextField.presets.test.tsx +284 -0
  147. package/src/components/form/inputs/TextField.styles.ts +96 -0
  148. package/src/components/form/inputs/TextField.test.tsx +153 -0
  149. package/src/components/form/inputs/TextField.tsx +315 -42
  150. package/src/components/layout/Footer/index.test.tsx +1 -1
  151. package/src/components/layout/Footer/index.tsx +17 -7
  152. package/src/components/layout/ServiceFormActions.tsx +5 -1
  153. package/src/components/layout/ServiceFormContainer/AccordionFormContainer/index.tsx +3 -3
  154. package/src/components/layout/ServiceHeader.tsx +19 -19
  155. package/src/components/layout/ServiceWizardStepper/ServiceWizardStepper.css +10 -10
  156. package/src/components/layout/ServiceWizardStepper/StepConnector.tsx +8 -5
  157. package/src/components/layout/ServiceWizardStepper/components/CustomStepIcon.tsx +22 -7
  158. package/src/components/layout/ServiceWizardStepper/components/HorizontalStepperButton.tsx +15 -11
  159. package/src/components/layout/ServiceWizardStepper/components/StyledStepLabel.tsx +28 -11
  160. package/src/components/layout/ServiceWizardStepper/stepperTokens.ts +8 -0
  161. package/src/components/loaders/FullPageLoader/index.test.tsx +18 -7
  162. package/src/components/loaders/FullPageLoader/index.tsx +14 -9
  163. package/src/components/loaders/Loader/index.tsx +48 -17
  164. package/src/components/overlays/BottomSheet/index.test.tsx +36 -3
  165. package/src/components/overlays/BottomSheet/index.tsx +54 -21
  166. package/src/components/overlays/Dialog/index.tsx +5 -23
  167. package/src/components/overlays/Drawer/index.tsx +29 -14
  168. package/src/components/overlays/Modal/index.tsx +46 -8
  169. package/src/components/storybook/FileUploadTokenPreview.tsx +68 -0
  170. package/src/components/storybook/TabsTokenPreview.tsx +58 -0
  171. package/src/components/storybook/TokenDocs.tsx +347 -0
  172. package/src/examples/MultipleStepForm/components/TermsAndConditionsForm.tsx +5 -1
  173. package/src/i18n/namespaces/input/en.json +48 -4
  174. package/src/i18n/namespaces/input/lt.json +48 -4
  175. package/src/library/index.ts +50 -0
  176. package/src/stories/atoms/Badge.stories.tsx +2 -1
  177. package/src/stories/atoms/Button.stories.tsx +124 -6
  178. package/src/stories/atoms/CheckboxMark.stories.tsx +79 -0
  179. package/src/stories/atoms/Divider.stories.tsx +129 -0
  180. package/src/stories/atoms/FilterChip.stories.tsx +9 -1
  181. package/src/stories/atoms/IconWithSquareBackground.stories.tsx +7 -7
  182. package/src/stories/atoms/Icons.stories.tsx +1 -1
  183. package/src/stories/atoms/NumberStepper.stories.tsx +44 -0
  184. package/src/stories/atoms/PhoneInput.stories.tsx +42 -0
  185. package/src/stories/atoms/RadioMark.stories.tsx +132 -0
  186. package/src/stories/atoms/Select.stories.tsx +139 -2
  187. package/src/stories/atoms/SimpleCheckbox.stories.tsx +74 -0
  188. package/src/stories/atoms/Switch.stories.tsx +46 -1
  189. package/src/stories/atoms/TextField.stories.tsx +508 -0
  190. package/src/stories/atoms/Tooltip.stories.tsx +5 -0
  191. package/src/stories/fixtures/foundations/Borders.stories.tsx +84 -0
  192. package/src/stories/fixtures/foundations/Effects.stories.tsx +204 -0
  193. package/src/stories/fixtures/foundations/Layout.stories.tsx +76 -0
  194. package/src/stories/fixtures/foundations/Sizes.stories.tsx +42 -0
  195. package/src/stories/fixtures/foundations/Spacing.stories.tsx +48 -0
  196. package/src/stories/fixtures/foundations/Typography.stories.tsx +49 -0
  197. package/src/stories/foundations/Borders.stories.tsx +179 -0
  198. package/src/stories/foundations/Colors.stories.tsx +253 -0
  199. package/src/stories/foundations/Effects.stories.tsx +116 -0
  200. package/src/stories/foundations/Layout.stories.tsx +177 -0
  201. package/src/stories/foundations/Sizes.stories.tsx +123 -0
  202. package/src/stories/foundations/Spacing.stories.tsx +159 -0
  203. package/src/stories/foundations/ThemeAdapter.stories.tsx +389 -0
  204. package/src/stories/foundations/Typography.stories.tsx +148 -0
  205. package/src/stories/molecules/Alert.stories.tsx +18 -0
  206. package/src/stories/molecules/Breadcrumbs.stories.tsx +51 -0
  207. package/src/stories/molecules/Card.stories.tsx +1 -1
  208. package/src/stories/molecules/CardShell.stories.tsx +1 -0
  209. package/src/stories/molecules/DatePicker.stories.tsx +133 -3
  210. package/src/stories/molecules/EmptyState.stories.tsx +106 -0
  211. package/src/stories/molecules/FormControlWrapper.stories.tsx +59 -0
  212. package/src/stories/molecules/LinkTile.stories.tsx +151 -0
  213. package/src/stories/molecules/ListWithIcons.stories.tsx +27 -2
  214. package/src/stories/molecules/RadioButtonGroup.stories.tsx +23 -0
  215. package/src/stories/molecules/SegmentedControl.stories.tsx +62 -1
  216. package/src/stories/molecules/Tabs.stories.tsx +4 -0
  217. package/src/stories/molecules/TitleBlock.stories.tsx +16 -16
  218. package/src/stories/organisms/Accordion.stories.tsx +132 -0
  219. package/src/stories/organisms/AdvancedListItemShell.stories.tsx +63 -23
  220. package/src/stories/organisms/BottomSheet.stories.tsx +48 -1
  221. package/src/stories/organisms/DataPagination.stories.tsx +127 -3
  222. package/src/stories/organisms/Dialog.stories.tsx +13 -0
  223. package/src/stories/organisms/FileDropzone.stories.tsx +6 -0
  224. package/src/stories/organisms/FileUpload.stories.tsx +4 -0
  225. package/src/stories/organisms/Footer.stories.tsx +20 -0
  226. package/src/stories/organisms/Modal.stories.tsx +53 -0
  227. package/src/stories/organisms/ServiceHeader.stories.tsx +25 -3
  228. package/src/stories/organisms/ServiceLinks.stories.tsx +1 -1
  229. package/src/stories/organisms/ServiceWizardStepper.stories.tsx +37 -1
  230. package/src/stories/organisms/SideNav.stories.tsx +8 -1
  231. package/src/theme/backdropTokens.test.ts +11 -0
  232. package/src/theme/backdropTokens.ts +11 -0
  233. package/src/theme/borderTokens.test.ts +59 -0
  234. package/src/theme/borderTokens.ts +36 -0
  235. package/src/theme/cards.ts +28 -28
  236. package/src/theme/colorTokens.test.ts +66 -0
  237. package/src/theme/colorTokens.ts +87 -0
  238. package/src/theme/effectTokens.test.ts +29 -0
  239. package/src/theme/effectTokens.ts +11 -0
  240. package/src/theme/layoutTokens.test.ts +42 -0
  241. package/src/theme/layoutTokens.ts +14 -0
  242. package/src/theme/light/MuiAccordion.tsx +30 -26
  243. package/src/theme/light/MuiAccordionDetails.ts +10 -5
  244. package/src/theme/light/MuiAccordionSummary.tsx +31 -17
  245. package/src/theme/light/MuiAlert.tsx +42 -65
  246. package/src/theme/light/MuiAutocomplete.ts +14 -7
  247. package/src/theme/light/MuiBreadcrumbs.tsx +17 -9
  248. package/src/theme/light/MuiButton.tsx +213 -204
  249. package/src/theme/light/MuiCard.tsx +5 -4
  250. package/src/theme/light/MuiCheckbox.ts +45 -14
  251. package/src/theme/light/MuiChip.tsx +3 -1
  252. package/src/theme/light/MuiDialog.ts +45 -6
  253. package/src/theme/light/MuiFormControl.ts +19 -9
  254. package/src/theme/light/MuiFormControlLabel.ts +16 -25
  255. package/src/theme/light/MuiFormGroup.ts +29 -26
  256. package/src/theme/light/MuiFormHelperText.ts +15 -4
  257. package/src/theme/light/MuiFormLabel.ts +20 -20
  258. package/src/theme/light/MuiInputBase.ts +49 -84
  259. package/src/theme/light/MuiOutlinedInput.ts +50 -6
  260. package/src/theme/light/MuiPagination.ts +21 -21
  261. package/src/theme/light/MuiPickerPopper.ts +17 -0
  262. package/src/theme/light/MuiPickersLayout.ts +63 -34
  263. package/src/theme/light/MuiPickersOutlinedInput.ts +38 -38
  264. package/src/theme/light/MuiPopover.ts +3 -1
  265. package/src/theme/light/MuiRadio.tsx +35 -52
  266. package/src/theme/light/MuiStepper.ts +21 -17
  267. package/src/theme/light/MuiSwitch.tsx +27 -23
  268. package/src/theme/light/MuiTab.tsx +27 -18
  269. package/src/theme/light/MuiTableCell.ts +4 -2
  270. package/src/theme/light/MuiTabs.tsx +11 -9
  271. package/src/theme/light/MuiTooltip.ts +2 -1
  272. package/src/theme/light/MuiTypography.tsx +0 -17
  273. package/src/theme/light/index.tsx +2 -0
  274. package/src/theme/light/themePalette.tsx +1 -0
  275. package/src/theme/palette.tsx +9 -0
  276. package/src/theme/sizeTokens.test.ts +37 -0
  277. package/src/theme/sizeTokens.ts +21 -0
  278. package/src/theme/spacingRoleBasedTokens.ts +41 -0
  279. package/src/theme/spacingTokens.test.ts +58 -0
  280. package/src/theme/spacingTokens.ts +114 -0
  281. package/src/theme/tokenTheme.test.tsx +402 -0
  282. package/src/theme/tokenTheme.ts +429 -0
  283. package/src/theme/tokens.css +476 -0
  284. package/src/theme/tokens.test.ts +174 -0
  285. package/src/theme/typographyTokens.test.ts +120 -0
  286. package/src/theme/typographyTokens.ts +119 -0
  287. package/dist/theme/spacing.d.ts +0 -4
  288. package/src/stories/foundations/Colors.mdx +0 -127
  289. package/src/theme/spacing.ts +0 -5
@@ -0,0 +1,159 @@
1
+ import { Box } from '@mui/material'
2
+ import type { Meta, StoryObj } from '@storybook/react-vite'
3
+
4
+ import {
5
+ Chain,
6
+ Code,
7
+ DocPage,
8
+ Pill,
9
+ ResponsiveValues,
10
+ Row,
11
+ Section,
12
+ Stage,
13
+ Table,
14
+ isResponsive,
15
+ literalOf,
16
+ numericSuffix,
17
+ toPx,
18
+ } from '@/components/storybook/TokenDocs'
19
+ import { borderTokens } from '@/theme/borderTokens'
20
+ import { colorTokens } from '@/theme/colorTokens'
21
+ import { spacingRoleBasedTokens } from '@/theme/spacingRoleBasedTokens'
22
+
23
+ const meta = {
24
+ title: 'Foundations/Spacing',
25
+ tags: ['no-snapshot'],
26
+ parameters: { layout: 'padded' },
27
+ } satisfies Meta
28
+ export default meta
29
+ type Story = StoryObj<typeof meta>
30
+
31
+ type SpaceToken = keyof typeof spacingRoleBasedTokens
32
+
33
+ const all = Object.keys(spacingRoleBasedTokens) as SpaceToken[]
34
+ const scale = all
35
+ .filter((name) => name.startsWith('space-'))
36
+ .sort((a, b) => numericSuffix(a) - numericSuffix(b))
37
+ const sizeOrder = ['xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl']
38
+ const bySize = (a: string, b: string) =>
39
+ sizeOrder.indexOf(a.split('-').at(-1)!) - sizeOrder.indexOf(b.split('-').at(-1)!)
40
+
41
+ const block = {
42
+ backgroundColor: colorTokens['surface-brand-subtle'],
43
+ border: `${borderTokens['border-default']} solid ${colorTokens['border-brand-subtle']}`,
44
+ borderRadius: borderTokens['radius-4'],
45
+ }
46
+ const fill = colorTokens['status-warning-bg']
47
+
48
+ function GapSpecimen({ token }: { token: SpaceToken }) {
49
+ return (
50
+ <Stage height={56} width={120}>
51
+ <Box
52
+ sx={{
53
+ backgroundColor: fill,
54
+ display: 'flex',
55
+ gap: spacingRoleBasedTokens[token],
56
+ }}
57
+ >
58
+ <Box sx={{ ...block, height: 28, width: 20 }} />
59
+ <Box sx={{ ...block, height: 28, width: 20 }} />
60
+ </Box>
61
+ </Stage>
62
+ )
63
+ }
64
+
65
+ function PaddingSpecimen({ token }: { token: SpaceToken }) {
66
+ return (
67
+ <Stage height={56} width={120}>
68
+ <Box
69
+ sx={{
70
+ backgroundColor: fill,
71
+ borderRadius: borderTokens['radius-4'],
72
+ p: spacingRoleBasedTokens[token],
73
+ }}
74
+ >
75
+ <Box sx={{ ...block, height: 14, width: 28 }} />
76
+ </Box>
77
+ </Stage>
78
+ )
79
+ }
80
+
81
+ const roleGroups = [
82
+ {
83
+ title: 'Gap',
84
+ lead: 'Space between siblings. The yellow area is the gap.',
85
+ tokens: all.filter((name) => name.startsWith('gap-')).sort(bySize),
86
+ Specimen: GapSpecimen,
87
+ },
88
+ {
89
+ title: 'Padding',
90
+ lead: 'Inset inside containers. The yellow area is the padding.',
91
+ tokens: all.filter((name) => name.startsWith('padding-')).sort(bySize),
92
+ Specimen: PaddingSpecimen,
93
+ },
94
+ {
95
+ title: 'Component',
96
+ lead: 'Component-specific paddings.',
97
+ tokens: all.filter((name) => name.startsWith('button-') || name.startsWith('input-')),
98
+ Specimen: PaddingSpecimen,
99
+ },
100
+ ]
101
+
102
+ function Spacing() {
103
+ const max = numericSuffix(scale.at(-1)!)
104
+ return (
105
+ <DocPage
106
+ title='Spacing'
107
+ lead='A rem scale of primitives, and roles for gaps and paddings. Larger roles grow at the md breakpoint; the underline marks the breakpoint you are viewing.'
108
+ >
109
+ <Section
110
+ title='Scale'
111
+ lead='Primitive steps. Use roles in components where one fits.'
112
+ >
113
+ <Table columns='96px 72px minmax(0, 1fr)' head={['Token', 'Value', '']}>
114
+ {scale.map((name) => (
115
+ <Row key={name}>
116
+ <Code>{name}</Code>
117
+ <Code muted>{toPx(literalOf(name))}</Code>
118
+ <Box
119
+ sx={{
120
+ backgroundColor: colorTokens['border-focus'],
121
+ borderRadius: borderTokens['radius-2'],
122
+ height: 10,
123
+ maxWidth: '100%',
124
+ minWidth: 2,
125
+ width: `${(numericSuffix(name) / max) * 100}%`,
126
+ }}
127
+ />
128
+ </Row>
129
+ ))}
130
+ </Table>
131
+ </Section>
132
+
133
+ {roleGroups.map(({ title, lead, tokens, Specimen }) => (
134
+ <Section key={title} title={title} lead={lead}>
135
+ <Table
136
+ columns='120px minmax(0, 1fr) 260px'
137
+ head={['', 'Token', 'Value per breakpoint']}
138
+ >
139
+ {tokens.map((name) => (
140
+ <Row key={name}>
141
+ <Specimen token={name} />
142
+ <Box sx={{ minWidth: 0 }}>
143
+ <Box sx={{ alignItems: 'center', display: 'flex', gap: 1 }}>
144
+ <Code>{name}</Code>
145
+ {isResponsive(name) && <Pill>responsive</Pill>}
146
+ </Box>
147
+ <Chain name={name} />
148
+ </Box>
149
+ <ResponsiveValues name={name} />
150
+ </Row>
151
+ ))}
152
+ </Table>
153
+ </Section>
154
+ ))}
155
+ </DocPage>
156
+ )
157
+ }
158
+
159
+ export const Overview: Story = { render: () => <Spacing /> }
@@ -0,0 +1,389 @@
1
+ import {
2
+ Alert,
3
+ Box,
4
+ Card,
5
+ CardContent,
6
+ Checkbox,
7
+ Divider,
8
+ FormControlLabel,
9
+ Stack,
10
+ Switch,
11
+ TextField,
12
+ ThemeProvider,
13
+ Typography,
14
+ } from '@mui/material'
15
+ import type { Meta, StoryObj } from '@storybook/react-vite'
16
+
17
+ import Button from '@/components/common/Button'
18
+ import legacyTheme from '@/theme/light'
19
+ import { createRcSesTokenTheme } from '@/theme/tokenTheme'
20
+
21
+ const tokenTheme = createRcSesTokenTheme()
22
+
23
+ const meta = {
24
+ title: 'Foundations/Theme Adapter',
25
+ tags: ['no-snapshot'],
26
+ parameters: { layout: 'padded' },
27
+ } satisfies Meta
28
+
29
+ export default meta
30
+ type Story = StoryObj<typeof meta>
31
+
32
+ export const Tokens: Story = {
33
+ render: () => (
34
+ <ThemeProvider theme={tokenTheme}>
35
+ <Stack spacing={2}>
36
+ <Typography variant='h1' data-testid='token-theme-heading'>
37
+ Foundacijų tokenų tema
38
+ </Typography>
39
+
40
+ <Typography variant='body1'>
41
+ Tipografija prisitaiko prie ekrano pločio. Spalvos, tarpai ir radiusai gaunami
42
+ iš dizaino tokenų.
43
+ </Typography>
44
+
45
+ <Box
46
+ data-testid='token-theme-probe'
47
+ sx={{
48
+ p: 2,
49
+ borderRadius: 2,
50
+ bgcolor: 'primary.main',
51
+ color: 'primary.contrastText',
52
+ }}
53
+ >
54
+ Spalvų, tarpų ir radiuso pavyzdys
55
+ </Box>
56
+
57
+ <Typography variant='h6' data-testid='legacy-h6'>
58
+ Legacy H6
59
+ </Typography>
60
+
61
+ <Box>
62
+ <Button>Bibliotekos mygtukas</Button>
63
+ </Box>
64
+ </Stack>
65
+ </ThemeProvider>
66
+ ),
67
+ }
68
+
69
+ const customTheme = createRcSesTokenTheme({
70
+ typography: {
71
+ h1: { fontSize: '2.5rem' },
72
+ h2: { fontSize: '3rem', lineHeight: '4rem', fontWeight: 700 },
73
+ body1: { fontWeight: 700 },
74
+ },
75
+ components: {
76
+ MuiTypography: {
77
+ styleOverrides: {
78
+ h2: { fontWeight: 400 },
79
+ h5: { fontSize: '3.5rem', lineHeight: '4.5rem' },
80
+ },
81
+ },
82
+ MuiCard: {
83
+ styleOverrides: {
84
+ root: { borderColor: '#c5cad1' },
85
+ },
86
+ },
87
+ },
88
+ })
89
+
90
+ export const ConsumerOverrides: Story = {
91
+ render: () => (
92
+ <ThemeProvider theme={customTheme}>
93
+ <Stack spacing={2}>
94
+ <Typography variant='h1' data-testid='custom-h1'>
95
+ Vartotojo h1 dydis
96
+ </Typography>
97
+
98
+ <Typography variant='h2' data-testid='custom-h2'>
99
+ Vartotojo h2 dydis
100
+ </Typography>
101
+
102
+ <Typography variant='body1' data-testid='custom-weight'>
103
+ Vartotojo šrifto svoris
104
+ </Typography>
105
+
106
+ <Typography variant='h5' data-testid='component-typography'>
107
+ Component override
108
+ </Typography>
109
+
110
+ <Card data-testid='literal-card'>
111
+ <CardContent data-testid='base-rem-padding'>
112
+ Vartotojo border spalva ir bibliotekos padding
113
+ </CardContent>
114
+ </Card>
115
+
116
+ <TextField label='Bibliotekos input padding' data-testid='base-rem-input' />
117
+ </Stack>
118
+ </ThemeProvider>
119
+ ),
120
+ }
121
+
122
+ export const TypographyScale: Story = {
123
+ render: () => (
124
+ <ThemeProvider theme={tokenTheme}>
125
+ <Stack spacing={3}>
126
+ <Typography variant='body2'>
127
+ Keisk ekrano plotį ir stebėk šriftų dydžius bei eilučių aukščius.
128
+ </Typography>
129
+
130
+ <Typography variant='h1'>H1 — puslapio antraštė</Typography>
131
+ <Typography variant='h2'>H2 — skyriaus antraštė</Typography>
132
+ <Typography variant='h3'>H3 — poskyrio antraštė</Typography>
133
+ <Typography variant='h4'>H4 — antraštė</Typography>
134
+ <Typography variant='h5'>H5 — antraštė</Typography>
135
+ <Typography variant='h6'>H6 — esamas bibliotekos stilius</Typography>
136
+
137
+ <Divider />
138
+
139
+ <Typography variant='body1'>
140
+ Body1 — pagrindinis tekstas. Ilgesnis sakinys leidžia įvertinti teksto
141
+ skaitomumą, eilučių aukštį ir persilaužimą mažame ekrane.
142
+ </Typography>
143
+
144
+ <Typography variant='body2'>Body2 — mažesnis pagrindinis tekstas.</Typography>
145
+
146
+ <Typography variant='subtitle1'>Subtitle1 — papildomas tekstas.</Typography>
147
+
148
+ <Typography variant='subtitle2'>
149
+ Subtitle2 — papildomas smulkus tekstas.
150
+ </Typography>
151
+
152
+ <Typography variant='caption'>Caption — paaiškinimas arba pastaba.</Typography>
153
+
154
+ <Typography variant='button'>Button — mygtuko tekstas</Typography>
155
+
156
+ <Typography variant='overline'>Overline — papildoma žyma</Typography>
157
+ </Stack>
158
+ </ThemeProvider>
159
+ ),
160
+ }
161
+
162
+ export const SpacingAndRadius: Story = {
163
+ render: () => (
164
+ <ThemeProvider theme={tokenTheme}>
165
+ <Stack spacing={3}>
166
+ <Typography variant='h2'>Tarpai ir kampų apvalinimas</Typography>
167
+
168
+ <Typography variant='body2'>
169
+ Skaičiai yra MUI daugikliai. Padding naudoja spacing, o borderRadius — temos
170
+ bazinį radiusą. Stulpelių išdėstymas keičiamas per sx breakpointus.
171
+ </Typography>
172
+
173
+ <Box
174
+ sx={{
175
+ display: 'grid',
176
+ gridTemplateColumns: {
177
+ xs: '1fr',
178
+ sm: 'repeat(2, 1fr)',
179
+ lg: 'repeat(4, 1fr)',
180
+ },
181
+ gap: 2,
182
+ }}
183
+ >
184
+ {[0.5, 1, 2, 3].map((factor) => (
185
+ <Box
186
+ key={factor}
187
+ sx={{
188
+ p: factor,
189
+ borderRadius: factor,
190
+ bgcolor: 'grey.100',
191
+ border: '1px solid',
192
+ borderColor: 'grey.300',
193
+ }}
194
+ >
195
+ <Typography variant='body2'>Padding: {factor}</Typography>
196
+ <Typography variant='body2'>Radius: {factor}</Typography>
197
+ </Box>
198
+ ))}
199
+ </Box>
200
+
201
+ <Divider />
202
+
203
+ <Typography variant='h3'>Tarpas tarp elementų</Typography>
204
+
205
+ {[0.5, 1, 2, 4].map((factor) => (
206
+ <Box key={factor}>
207
+ <Typography variant='caption'>Gap: {factor}</Typography>
208
+
209
+ <Stack direction='row' spacing={factor} sx={{ mt: 1 }}>
210
+ {[1, 2, 3].map((item) => (
211
+ <Box
212
+ key={item}
213
+ sx={{
214
+ p: 2,
215
+ borderRadius: 1,
216
+ bgcolor: 'primary.main',
217
+ color: 'primary.contrastText',
218
+ }}
219
+ >
220
+ {item}
221
+ </Box>
222
+ ))}
223
+ </Stack>
224
+ </Box>
225
+ ))}
226
+ </Stack>
227
+ </ThemeProvider>
228
+ ),
229
+ }
230
+
231
+ export const Palette: Story = {
232
+ render: () => (
233
+ <ThemeProvider theme={tokenTheme}>
234
+ <Stack spacing={3}>
235
+ <Typography variant='h2'>Temos spalvos</Typography>
236
+
237
+ <Box
238
+ sx={{
239
+ display: 'grid',
240
+ gridTemplateColumns: {
241
+ xs: '1fr',
242
+ sm: 'repeat(2, 1fr)',
243
+ lg: 'repeat(3, 1fr)',
244
+ },
245
+ gap: 2,
246
+ }}
247
+ >
248
+ {['primary', 'secondary', 'success', 'info', 'warning', 'error'].map(
249
+ (color) => (
250
+ <Box
251
+ key={color}
252
+ sx={{
253
+ p: 3,
254
+ borderRadius: 2,
255
+ bgcolor: `${color}.main`,
256
+ color: `${color}.contrastText`,
257
+ }}
258
+ >
259
+ <Typography variant='body1'>{color}.main</Typography>
260
+ </Box>
261
+ ),
262
+ )}
263
+ </Box>
264
+
265
+ <Divider />
266
+
267
+ <Typography sx={{ color: 'text.primary' }}>Pagrindinis tekstas</Typography>
268
+
269
+ <Typography sx={{ color: 'text.secondary' }}>Papildomas tekstas</Typography>
270
+
271
+ <Typography sx={{ color: 'text.disabled' }}>Neaktyvus tekstas</Typography>
272
+
273
+ <Box
274
+ sx={{
275
+ p: 3,
276
+ borderRadius: 2,
277
+ bgcolor: 'background.paper',
278
+ border: '1px solid',
279
+ borderColor: 'divider',
280
+ }}
281
+ >
282
+ <Typography>Background.paper paviršius ir divider kraštinė</Typography>
283
+ </Box>
284
+ </Stack>
285
+ </ThemeProvider>
286
+ ),
287
+ }
288
+
289
+ export const ComponentsPreview: Story = {
290
+ render: () => (
291
+ <ThemeProvider theme={tokenTheme}>
292
+ <Stack spacing={3} sx={{ maxWidth: '40rem' }}>
293
+ <Typography variant='h2'>Komponentų peržiūra</Typography>
294
+
295
+ <Typography variant='body2'>
296
+ Patikrink hover, focus, pasirinktas ir disabled būsenas. Mygtukas yra RC
297
+ komponentas, kiti šiame pavyzdyje — MUI komponentai.
298
+ </Typography>
299
+
300
+ <Stack direction='row' spacing={2} useFlexGap sx={{ flexWrap: 'wrap' }}>
301
+ <Button variant='contained'>Pagrindinis</Button>
302
+ <Button variant='outlined'>Outlined</Button>
303
+ <Button variant='text'>Text</Button>
304
+ <Button disabled>Neaktyvus</Button>
305
+ </Stack>
306
+
307
+ <TextField label='Įprastas laukas' />
308
+
309
+ <TextField
310
+ label='Laukas su klaida'
311
+ error
312
+ helperText='Patikrinkite įvestą reikšmę.'
313
+ defaultValue='Neteisinga reikšmė'
314
+ />
315
+
316
+ <TextField label='Neaktyvus laukas' disabled />
317
+
318
+ <Stack direction={{ xs: 'column', sm: 'row' }} spacing={2}>
319
+ <FormControlLabel control={<Checkbox defaultChecked />} label='Pasirinkta' />
320
+
321
+ <FormControlLabel control={<Checkbox />} label='Nepasirinkta' />
322
+
323
+ <FormControlLabel control={<Switch defaultChecked />} label='Įjungta' />
324
+ </Stack>
325
+
326
+ <Alert severity='info'>Informacinis pranešimas</Alert>
327
+ <Alert severity='success'>Veiksmas atliktas sėkmingai</Alert>
328
+ <Alert severity='warning'>Įspėjimas</Alert>
329
+ <Alert severity='error'>Įvyko klaida</Alert>
330
+
331
+ <Card>
332
+ <CardContent>
333
+ <Stack spacing={2}>
334
+ <Typography variant='h3'>Kortelės antraštė</Typography>
335
+
336
+ <Typography variant='body1'>
337
+ Kortelės, teksto ir mygtuko derinys.
338
+ </Typography>
339
+
340
+ <Box>
341
+ <Button>Tęsti</Button>
342
+ </Box>
343
+ </Stack>
344
+ </CardContent>
345
+ </Card>
346
+ </Stack>
347
+ </ThemeProvider>
348
+ ),
349
+ }
350
+
351
+ export const H1Fallback: Story = {
352
+ render: () => (
353
+ <Stack spacing={2}>
354
+ <ThemeProvider theme={legacyTheme}>
355
+ <Typography variant='h1' data-testid='fallback-legacy-h1'>
356
+ Legacy H1
357
+ </Typography>
358
+ </ThemeProvider>
359
+ <ThemeProvider theme={tokenTheme}>
360
+ <Box data-testid='missing-token-example'>
361
+ <Typography variant='h1' data-testid='fallback-token-h1'>
362
+ Token H1 without DS variables
363
+ </Typography>
364
+ </Box>
365
+ </ThemeProvider>
366
+ </Stack>
367
+ ),
368
+ play: ({ canvasElement }) => {
369
+ const example = canvasElement.querySelector<HTMLElement>(
370
+ '[data-testid="missing-token-example"]',
371
+ )!
372
+ Array.from(getComputedStyle(document.documentElement))
373
+ .filter((name) => name.startsWith('--rc-') && !name.startsWith('--rc-mui-'))
374
+ .forEach((name) => example.style.setProperty(name, 'initial'))
375
+ },
376
+ }
377
+
378
+ const headingWeightTheme = createRcSesTokenTheme({
379
+ typography: { h2: { fontWeight: 700 } },
380
+ })
381
+ export const HeadingWeight: Story = {
382
+ render: () => (
383
+ <ThemeProvider theme={headingWeightTheme}>
384
+ <Typography variant='h2' data-testid='weight-h2'>
385
+ H2 fontWeight 700
386
+ </Typography>
387
+ </ThemeProvider>
388
+ ),
389
+ }
@@ -0,0 +1,148 @@
1
+ import { Box, ThemeProvider, Typography, useTheme } from '@mui/material'
2
+ import type { Meta, StoryObj } from '@storybook/react-vite'
3
+ import { Fragment } from 'react'
4
+
5
+ import {
6
+ Code,
7
+ DocPage,
8
+ Pill,
9
+ ResponsiveValues,
10
+ Row,
11
+ Section,
12
+ Table,
13
+ isResponsive,
14
+ } from '@/components/storybook/TokenDocs'
15
+ import { colorTokens } from '@/theme/colorTokens'
16
+ import { createRcSesTokenTheme } from '@/theme/tokenTheme'
17
+ import { typographyRoleVariants } from '@/theme/typographyTokens'
18
+
19
+ const tokenTheme = createRcSesTokenTheme()
20
+
21
+ const meta = {
22
+ title: 'Foundations/Typography',
23
+ tags: ['no-snapshot'],
24
+ parameters: { layout: 'padded' },
25
+ } satisfies Meta
26
+ export default meta
27
+ type Story = StoryObj<typeof meta>
28
+
29
+ const sample: Partial<Record<string, string>> = {
30
+ heading: 'Nekilnojamojo turto registras',
31
+ button: 'Pateikti prašymą',
32
+ }
33
+ const bodySample = 'Įmonės duomenys atnaujinami kasdien. ąčęėįšųūž 0123456789'
34
+
35
+ const groups = [
36
+ { prefix: 'heading', title: 'Headings' },
37
+ { prefix: 'body', title: 'Body' },
38
+ { prefix: 'button', title: 'Buttons' },
39
+ ] as const
40
+
41
+ function Roles() {
42
+ const theme = useTheme()
43
+ const family = String(theme.typography.fontFamily).split(',')[0].replace(/['"]/g, '')
44
+
45
+ return (
46
+ <DocPage
47
+ title='Typography'
48
+ lead={`14 roles, each with size, line height, font weight, and letter spacing. Sizes and line heights are tokens; headings step up at the sm and md breakpoints. Family: ${family}.`}
49
+ >
50
+ {groups.map(({ prefix, title }) => (
51
+ <Section key={prefix} title={title}>
52
+ <Table
53
+ columns='minmax(0, 1fr) 300px'
54
+ head={['Role and sample', 'Size, line height, weight, and letter spacing']}
55
+ >
56
+ {Object.entries(typographyRoleVariants)
57
+ .filter(([role]) => role.startsWith(prefix))
58
+ .map(([role, variant]) => {
59
+ const style = theme.typography[variant] as {
60
+ fontWeight?: number | string
61
+ }
62
+ return (
63
+ <Row key={role}>
64
+ <Box sx={{ minWidth: 0, py: 1 }}>
65
+ <Box
66
+ sx={{
67
+ alignItems: 'center',
68
+ display: 'flex',
69
+ flexWrap: 'wrap',
70
+ gap: 1,
71
+ mb: 1,
72
+ }}
73
+ >
74
+ <Code>{role}</Code>
75
+ <Code muted>variant=&quot;{variant}&quot;</Code>
76
+ <Code muted>weight {style.fontWeight ?? 'inherit'}</Code>
77
+ {isResponsive(`typography-font-size-${role}`) && (
78
+ <Pill>responsive</Pill>
79
+ )}
80
+ </Box>
81
+ <Typography
82
+ variant={variant}
83
+ sx={{
84
+ color: colorTokens['text-default'],
85
+ overflow: 'hidden',
86
+ textOverflow: 'ellipsis',
87
+ whiteSpace: 'nowrap',
88
+ }}
89
+ >
90
+ {sample[prefix] ?? bodySample}
91
+ </Typography>
92
+ </Box>
93
+ <Box
94
+ sx={{
95
+ alignItems: 'end',
96
+ columnGap: 1.5,
97
+ display: 'grid',
98
+ gridTemplateColumns: '40px 1fr',
99
+ rowGap: 1,
100
+ }}
101
+ >
102
+ {(
103
+ [
104
+ 'font-size',
105
+ 'line-height',
106
+ 'font-weight',
107
+ 'letter-spacing',
108
+ ] as const
109
+ ).map((property) => {
110
+ const labels = {
111
+ 'font-size': 'Size',
112
+ 'line-height': 'Line',
113
+ 'font-weight': 'Weight',
114
+ 'letter-spacing': 'Letter',
115
+ }
116
+ return (
117
+ <Fragment key={property}>
118
+ <Box
119
+ sx={{
120
+ color: colorTokens['text-secondary'],
121
+ fontSize: '0.75rem',
122
+ pb: 0.5,
123
+ }}
124
+ >
125
+ {labels[property]}
126
+ </Box>
127
+ <ResponsiveValues name={`typography-${property}-${role}`} />
128
+ </Fragment>
129
+ )
130
+ })}
131
+ </Box>
132
+ </Row>
133
+ )
134
+ })}
135
+ </Table>
136
+ </Section>
137
+ ))}
138
+ </DocPage>
139
+ )
140
+ }
141
+
142
+ export const Overview: Story = {
143
+ render: () => (
144
+ <ThemeProvider theme={tokenTheme}>
145
+ <Roles />
146
+ </ThemeProvider>
147
+ ),
148
+ }