@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.
Files changed (289) hide show
  1. package/dist/assets/icons/phosphorIcons.d.ts +24 -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 +11144 -8374
  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 +11 -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,211 @@
1
+ import { Box, BoxProps, Typography } from '@mui/material'
2
+ import { MouseEventHandler, useEffect, useId, useState } from 'react'
3
+
4
+ import {
5
+ InfoIcon,
6
+ MagnifyingGlassIcon,
7
+ WarningCircleIcon,
8
+ WarningFillIcon,
9
+ } from '@/assets/icons/phosphorIcons'
10
+ import RcSesButton from '@/components/common/Button'
11
+ import normalizeSx from '@/components/utils/normalizeSx'
12
+ import { borderTokens } from '@/theme/borderTokens'
13
+ import { colorTokens } from '@/theme/colorTokens'
14
+ import { sizeTokens } from '@/theme/sizeTokens'
15
+ import { spacingTokens } from '@/theme/spacingTokens'
16
+ import '@/theme/tokens.css'
17
+ import { typographyTokens } from '@/theme/typographyTokens'
18
+
19
+ export type EmptyStateType = 'neutral' | 'info' | 'warning' | 'error'
20
+ export type EmptyStateSize = 'regular' | 'compact'
21
+
22
+ export interface EmptyStateProps extends Omit<BoxProps, 'title' | 'children'> {
23
+ title: string
24
+ description: string
25
+ type?: EmptyStateType
26
+ size?: EmptyStateSize
27
+ hint?: string
28
+ headingLevel?: 1 | 2 | 3 | 4 | 5 | 6
29
+ action?: {
30
+ label: string
31
+ onClick: MouseEventHandler<HTMLButtonElement>
32
+ disabled?: boolean
33
+ }
34
+ showAction?: boolean
35
+ validationError?: boolean
36
+ announce?: boolean
37
+ }
38
+
39
+ const tones = {
40
+ neutral: { Icon: MagnifyingGlassIcon, color: colorTokens['text-secondary'] },
41
+ info: { Icon: InfoIcon, color: colorTokens['status-info-text'] },
42
+ warning: { Icon: WarningFillIcon, color: colorTokens['status-warning-text'] },
43
+ error: { Icon: WarningCircleIcon, color: colorTokens['status-error-icon'] },
44
+ }
45
+
46
+ const textStyle = (
47
+ role: 'heading-h3' | 'heading-h5' | 'body-regular' | 'body-small',
48
+ ) => ({
49
+ fontFamily: typographyTokens['font-family'],
50
+ fontSize: typographyTokens[`font-size-${role}`],
51
+ lineHeight: typographyTokens[`line-height-${role}`],
52
+ fontWeight: typographyTokens[`font-weight-${role}`],
53
+ letterSpacing: typographyTokens[`letter-spacing-${role}`],
54
+ })
55
+
56
+ export default function RcSesEmptyState({
57
+ title,
58
+ description,
59
+ type = 'neutral',
60
+ size = 'regular',
61
+ hint,
62
+ headingLevel = 2,
63
+ action,
64
+ showAction = true,
65
+ validationError = false,
66
+ announce = false,
67
+ sx,
68
+ ...rest
69
+ }: EmptyStateProps) {
70
+ const titleId = useId()
71
+ const compact = size === 'compact'
72
+ const iconSize = sizeTokens[compact ? 'icon-size-feature' : 'icon-size-32']
73
+ const { Icon, color } = tones[type]
74
+ const [announcement, setAnnouncement] = useState('')
75
+ const shouldAnnounce = announce && (type === 'warning' || type === 'error')
76
+
77
+ useEffect(() => {
78
+ const timer = setTimeout(
79
+ () => setAnnouncement(shouldAnnounce ? `${title}. ${description}` : ''),
80
+ 0,
81
+ )
82
+ return () => clearTimeout(timer)
83
+ }, [shouldAnnounce, title, description])
84
+
85
+ return (
86
+ <Box
87
+ component='section'
88
+ aria-labelledby={titleId}
89
+ {...rest}
90
+ sx={[
91
+ {
92
+ display: 'flex',
93
+ flexDirection: 'column',
94
+ alignItems: 'center',
95
+ justifyContent: 'center',
96
+ width: '100%',
97
+ minWidth: 0,
98
+ boxSizing: 'border-box',
99
+ backgroundColor: colorTokens['surface-sunken'],
100
+ borderRadius: borderTokens[compact ? 'radius-list-item' : 'radius-subcard'],
101
+ paddingBlock:
102
+ spacingTokens[
103
+ compact
104
+ ? 'spacing-aliases-content-card-padding-compact'
105
+ : 'spacing-aliases-card-padding-x'
106
+ ],
107
+ paddingInline:
108
+ spacingTokens[
109
+ compact
110
+ ? 'spacing-aliases-content-card-padding-compact'
111
+ : 'spacing-aliases-content-card-padding-regular'
112
+ ],
113
+ gap: spacingTokens[
114
+ compact ? 'spacing-aliases-stack-tight' : 'spacing-aliases-stack-default'
115
+ ],
116
+ boxShadow: validationError
117
+ ? `inset 0 0 0 ${borderTokens['stroke-2']} ${colorTokens['status-error-border']}`
118
+ : 'none',
119
+ textAlign: 'center',
120
+ overflowWrap: 'anywhere',
121
+ },
122
+ ...normalizeSx(sx),
123
+ ]}
124
+ >
125
+ <Icon
126
+ weight='regular'
127
+ fillColor={color}
128
+ aria-hidden='true'
129
+ focusable='false'
130
+ style={{ flexShrink: 0, width: iconSize, height: iconSize }}
131
+ />
132
+ <Box
133
+ sx={{
134
+ width: '100%',
135
+ maxWidth: compact ? undefined : '560px',
136
+ display: 'flex',
137
+ flexDirection: 'column',
138
+ gap: spacingTokens[
139
+ compact
140
+ ? 'spacing-aliases-subcard-heading-gap'
141
+ : 'spacing-aliases-stack-tight'
142
+ ],
143
+ }}
144
+ >
145
+ <Typography
146
+ id={titleId}
147
+ component={`h${headingLevel}`}
148
+ sx={{
149
+ ...textStyle(compact ? 'heading-h5' : 'heading-h3'),
150
+ color: colorTokens['text-default'],
151
+ }}
152
+ >
153
+ {title}
154
+ </Typography>
155
+ <Typography
156
+ component='p'
157
+ sx={{
158
+ ...textStyle(compact ? 'body-small' : 'body-regular'),
159
+ color: colorTokens['text-secondary'],
160
+ }}
161
+ >
162
+ {description}
163
+ </Typography>
164
+ {!compact && hint && (
165
+ <Typography
166
+ component='p'
167
+ sx={{ ...textStyle('body-small'), color: colorTokens['text-secondary'] }}
168
+ >
169
+ {hint}
170
+ </Typography>
171
+ )}
172
+ </Box>
173
+ {showAction && action && (
174
+ <RcSesButton
175
+ type='button'
176
+ variant='outlined'
177
+ color='grey'
178
+ size='small'
179
+ onClick={action.onClick}
180
+ disabled={action.disabled}
181
+ sx={{
182
+ width: { xs: '100%', sm: 'auto' },
183
+ maxWidth: '100%',
184
+ whiteSpace: 'normal',
185
+ overflowWrap: 'anywhere',
186
+ }}
187
+ >
188
+ {action.label}
189
+ </RcSesButton>
190
+ )}
191
+ <Box
192
+ role='status'
193
+ aria-live='polite'
194
+ aria-atomic='true'
195
+ sx={{
196
+ position: 'absolute',
197
+ width: '1px',
198
+ height: '1px',
199
+ padding: 0,
200
+ margin: '-1px',
201
+ overflow: 'hidden',
202
+ clipPath: 'inset(50%)',
203
+ whiteSpace: 'nowrap',
204
+ border: 0,
205
+ }}
206
+ >
207
+ {shouldAnnounce ? announcement : ''}
208
+ </Box>
209
+ </Box>
210
+ )
211
+ }
@@ -3,7 +3,10 @@ import { forwardRef, useLayoutEffect, useRef, useState } from 'react'
3
3
  import { useTranslation } from 'react-i18next'
4
4
 
5
5
  import { CloseIcon } from '@/assets/icons/phosphorIcons'
6
- import { common, grey, primary } from '@/theme/palette'
6
+ import { borderTokens } from '@/theme/borderTokens'
7
+ import { colorTokens } from '@/theme/colorTokens'
8
+ import { spacingRoleBasedTokens } from '@/theme/spacingRoleBasedTokens'
9
+ import { typographyTokens } from '@/theme/typographyTokens'
7
10
 
8
11
  export interface RcSesFilterChipProps {
9
12
  label: string
@@ -49,33 +52,35 @@ const RcSesFilterChip = forwardRef<HTMLDivElement, RcSesFilterChipProps>((props,
49
52
  data-testid={testId}
50
53
  sx={{
51
54
  maxWidth: '100%',
52
- borderColor: grey['300'],
53
- backgroundColor: common.white,
54
- color: grey['900'],
55
+ padding: `${spacingRoleBasedTokens['space-6']} ${spacingRoleBasedTokens['space-8']} ${spacingRoleBasedTokens['space-6']} ${spacingRoleBasedTokens['space-12']}`,
56
+ gap: spacingRoleBasedTokens['space-4'],
57
+ borderRadius: borderTokens['radius-pill'],
58
+ borderColor: colorTokens['border-default'],
59
+ backgroundColor: colorTokens['surface-base'],
60
+ color: colorTokens['text-default'],
55
61
  '& .MuiChip-label': {
56
- fontSize: '0.875rem',
57
- fontWeight: 400,
58
- lineHeight: '1.25rem',
62
+ fontSize: typographyTokens['font-size-body-small'],
63
+ fontWeight: typographyTokens['font-weight-body-small'],
64
+ lineHeight: typographyTokens['line-height-body-small'],
59
65
  minWidth: 0,
60
- pl: '0.75rem',
61
- pr: 0,
66
+ padding: 0,
62
67
  },
63
68
  '& .MuiChip-deleteIcon': {
64
- color: grey['900'],
65
- margin: '0 0.5rem 0 0.25rem',
69
+ color: colorTokens['text-default'],
70
+ margin: 0,
66
71
  flexShrink: 0,
72
+ '&:hover': {
73
+ color: colorTokens['text-default'],
74
+ },
67
75
  },
68
76
  '&.MuiChip-clickable:hover': {
69
- borderColor: grey['400'],
70
- backgroundColor: grey['100'],
71
- },
72
- '&:hover .MuiChip-deleteIcon': {
73
- color: grey['900'],
77
+ borderColor: colorTokens['border-strong'],
78
+ backgroundColor: colorTokens['surface-muted'],
74
79
  },
75
80
  '&.Mui-focusVisible': {
76
- outline: `2px solid ${primary['500']}`,
77
- outlineOffset: '-2px',
78
- backgroundColor: common.white,
81
+ outline: `${borderTokens['border-focus']} solid ${colorTokens['border-focus']}`,
82
+ outlineOffset: `calc(-1 * ${borderTokens['border-focus']})`,
83
+ backgroundColor: colorTokens['surface-base'],
79
84
  },
80
85
  }}
81
86
  variant='outlined'
@@ -2,10 +2,24 @@ import { Box } from '@mui/material'
2
2
  import React, { memo, useMemo } from 'react'
3
3
 
4
4
  import IconProps from '@/assets/IconProps'
5
- import resolvePaletteColorPath from '@/assets/resolvePaletteColorPath'
6
- import palette from '@/theme/palette'
5
+ import { colorTokens } from '@/theme/colorTokens'
6
+ import type palette from '@/theme/palette'
7
7
 
8
8
  type Shade = keyof (typeof palette)[keyof typeof palette]
9
+ type PaletteColor = keyof typeof palette
10
+
11
+ // Figma has no circular tile; the palette-name props map onto the DS primitive
12
+ // variables, where each palette's `main` is its 500 shade.
13
+ const PRIMITIVE_FAMILY: Record<PaletteColor, string> = {
14
+ primary: 'cyans',
15
+ secondary: 'greens',
16
+ grey: 'neutrals',
17
+ warning: 'yellows',
18
+ error: 'red',
19
+ }
20
+
21
+ const primitiveColor = (color: PaletteColor, shade: Shade) =>
22
+ `var(--rc-color-${PRIMITIVE_FAMILY[color]}-${shade === 'main' ? '500' : shade})`
9
23
 
10
24
  interface Props {
11
25
  bgShade?: Shade | 'white'
@@ -45,7 +59,10 @@ function IconWithCircularBackground(props: Props) {
45
59
  className='IconWithCircularBackground-root'
46
60
  sx={{
47
61
  alignItems: 'center',
48
- backgroundColor: bgShade === 'white' ? 'white' : palette[color][bgShade],
62
+ backgroundColor:
63
+ bgShade === 'white'
64
+ ? colorTokens['surface-base']
65
+ : primitiveColor(color, bgShade),
49
66
  borderRadius: '50%',
50
67
  display: 'flex',
51
68
  justifyContent: 'center',
@@ -58,9 +75,10 @@ function IconWithCircularBackground(props: Props) {
58
75
  width: sizes[1],
59
76
  },
60
77
  'svg path': {
61
- fill: resolvePaletteColorPath(
62
- iconShade === 'white' ? 'white' : `${color}.${iconShade}`,
63
- ),
78
+ fill:
79
+ iconShade === 'white'
80
+ ? colorTokens['text-inverse']
81
+ : primitiveColor(color, iconShade),
64
82
  },
65
83
  }}
66
84
  >
@@ -37,10 +37,22 @@ describe('RcSesIconWithSquareBackground', () => {
37
37
  )
38
38
 
39
39
  const root = container.querySelector('.IconWithSquareBackground-root') as HTMLElement
40
- expect(root).toHaveStyle({ height: '2.5rem', width: '2.5rem' })
40
+ expect(root).toHaveStyle({
41
+ height: '2.5rem',
42
+ width: '2.5rem',
43
+ })
41
44
  })
42
45
 
43
- test.each(['solid', 'soft', 'muted'] as const)(
46
+ test('applies the 20 size tokens when size=20', () => {
47
+ const { container } = renderTile(
48
+ <RcSesIconWithSquareBackground Icon={InfoFillIcon} size={20} />,
49
+ )
50
+
51
+ const root = container.querySelector('.IconWithSquareBackground-root') as HTMLElement
52
+ expect(root).toHaveStyle({ height: '1.25rem', width: '1.25rem' })
53
+ })
54
+
55
+ test.each(['solid', 'cyan', 'muted', 'green'] as const)(
44
56
  'renders without crashing for the %s variant',
45
57
  (variant) => {
46
58
  const { container } = renderTile(
@@ -2,12 +2,12 @@ import { Box } from '@mui/material'
2
2
  import React, { memo, useMemo } from 'react'
3
3
 
4
4
  import IconProps from '@/assets/IconProps'
5
- import { ThemeColors } from '@/assets/ThemeColors'
6
- import resolvePaletteColorPath from '@/assets/resolvePaletteColorPath'
7
- import palette from '@/theme/palette'
5
+ import { borderTokens } from '@/theme/borderTokens'
6
+ import { colorTokens } from '@/theme/colorTokens'
7
+ import { sizeTokens } from '@/theme/sizeTokens'
8
8
 
9
- type SquareTileSize = 40 | 44
10
- type SquareTileVariant = 'solid' | 'soft' | 'muted'
9
+ type SquareTileSize = 16 | 20 | 24 | 32 | 40 | 44 | 48 | 56 | 64
10
+ type SquareTileVariant = 'solid' | 'cyan' | 'muted' | 'green'
11
11
 
12
12
  interface Props {
13
13
  Icon: React.JSXElementConstructor<IconProps>
@@ -15,9 +15,23 @@ interface Props {
15
15
  variant?: SquareTileVariant
16
16
  }
17
17
 
18
+ // Figma Icon-tile backgrounds bind color primitives directly; no semantic
19
+ const SOLID_TILE_BG = 'var(--rc-color-cyans-500)'
20
+ const GREEN_TILE_BG = 'var(--rc-color-greens-50)'
21
+ const CYAN_TILE_BG = 'var(--rc-color-cyans-50)'
22
+
23
+ // Tile size / icon size / radius. Figma leaves the tile sizes and the 40px
24
+ // tile's 22px icon unbound.
18
25
  const SIZE_TOKENS: Record<SquareTileSize, [string, string, string]> = {
19
- 40: ['2.5rem', '1.375rem', '0.5rem'], // 40 / 22 / 8
20
- 44: ['2.75rem', '1.5rem', '0.625rem'], // 44 / 24 / 10
26
+ 16: ['1rem', sizeTokens['icon-size-12'], borderTokens['radius-2']],
27
+ 20: ['1.25rem', sizeTokens['icon-size-14'], borderTokens['radius-4']],
28
+ 24: ['1.5rem', sizeTokens['icon-size-16'], borderTokens['radius-4']],
29
+ 32: ['2rem', sizeTokens['icon-size-20'], borderTokens['radius-6']],
30
+ 40: ['2.5rem', sizeTokens['icon-size-22'], borderTokens['radius-8']],
31
+ 44: ['2.75rem', sizeTokens['icon-size-24'], borderTokens['radius-10']],
32
+ 48: ['3rem', sizeTokens['icon-size-28'], borderTokens['radius-12']],
33
+ 56: ['3.5rem', sizeTokens['icon-size-32'], borderTokens['radius-14']],
34
+ 64: ['4rem', sizeTokens['icon-size-36'], borderTokens['radius-16']],
21
35
  }
22
36
 
23
37
  function IconWithSquareBackground(props: Props) {
@@ -28,26 +42,31 @@ function IconWithSquareBackground(props: Props) {
28
42
 
29
43
  const [boxSize, iconSize, radius] = SIZE_TOKENS[size]
30
44
 
31
- const { backgroundColor, iconColorPath } = useMemo<{
45
+ const { backgroundColor, iconColor } = useMemo<{
32
46
  backgroundColor: string
33
- iconColorPath: ThemeColors | 'white'
47
+ iconColor: string
34
48
  }>(() => {
35
49
  switch (variant) {
36
- case 'soft':
50
+ case 'cyan':
51
+ return {
52
+ backgroundColor: CYAN_TILE_BG,
53
+ iconColor: colorTokens['text-default'],
54
+ }
55
+ case 'green':
37
56
  return {
38
- backgroundColor: palette.primary[50],
39
- iconColorPath: 'grey.900',
57
+ backgroundColor: GREEN_TILE_BG,
58
+ iconColor: colorTokens['text-default'],
40
59
  }
41
60
  case 'muted':
42
61
  return {
43
- backgroundColor: palette.grey[100],
44
- iconColorPath: 'grey.900',
62
+ backgroundColor: colorTokens['surface-sunken'],
63
+ iconColor: colorTokens['text-default'],
45
64
  }
46
65
  case 'solid':
47
66
  default:
48
67
  return {
49
- backgroundColor: palette.primary[500],
50
- iconColorPath: 'white',
68
+ backgroundColor: SOLID_TILE_BG,
69
+ iconColor: colorTokens['text-inverse'],
51
70
  }
52
71
  }
53
72
  }, [variant])
@@ -70,7 +89,7 @@ function IconWithSquareBackground(props: Props) {
70
89
  width: iconSize,
71
90
  },
72
91
  'svg path': {
73
- fill: resolvePaletteColorPath(iconColorPath),
92
+ fill: iconColor,
74
93
  },
75
94
  }}
76
95
  >
@@ -4,6 +4,8 @@ import { render, screen } from '@testing-library/react'
4
4
  import { type ReactElement } from 'react'
5
5
  import { describe, expect, test } from 'vitest'
6
6
 
7
+ import { colorTokens } from '@/theme/colorTokens'
8
+
7
9
  import RcSesImageCard from '.'
8
10
  import theme from '../../../theme/light'
9
11
 
@@ -50,6 +52,20 @@ describe('RcSesImageCard', () => {
50
52
  expect(screen.queryByRole('button')).not.toBeInTheDocument()
51
53
  })
52
54
 
55
+ test('lets consumer slot styles override the default title style', () => {
56
+ renderCard(
57
+ <RcSesImageCard
58
+ image={<img src='test.png' alt='icon' />}
59
+ title='Styled title'
60
+ slotProps={{ title: { sx: { color: colorTokens['text-link'] } } }}
61
+ />,
62
+ )
63
+
64
+ expect(screen.getByText('Styled title')).toHaveStyle({
65
+ color: colorTokens['text-link'],
66
+ })
67
+ })
68
+
53
69
  test('forwards testIds to internal sections', () => {
54
70
  renderCard(
55
71
  <RcSesImageCard
@@ -1,6 +1,11 @@
1
1
  import { ReactNode } from 'react'
2
2
 
3
3
  import RcSesCard, { RcSesCardProps, RcSesCardTestIds } from '@/components/common/Card'
4
+ import normalizeSx from '@/components/utils/normalizeSx'
5
+ import { colorTokens } from '@/theme/colorTokens'
6
+ import { spacingRoleBasedTokens } from '@/theme/spacingRoleBasedTokens'
7
+ import { spacingTokens } from '@/theme/spacingTokens'
8
+ import { typographyTokens } from '@/theme/typographyTokens'
4
9
 
5
10
  export type RcSesImageCardTestIds = Pick<
6
11
  RcSesCardTestIds,
@@ -16,6 +21,11 @@ export interface RcSesImageCardProps {
16
21
  slotProps?: RcSesCardProps['slotProps']
17
22
  }
18
23
 
24
+ /**
25
+ * Figma Image-heading-text: image, 8px, heading and description, then the
26
+ * `Stack/loose` gap to the button. The card's own gap is cleared so the slots
27
+ * can carry those two different gaps; consumer slot styles still win.
28
+ */
19
29
  function RcSesImageCard({
20
30
  image,
21
31
  title,
@@ -30,7 +40,50 @@ function RcSesImageCard({
30
40
  contentBackground={false}
31
41
  description={description}
32
42
  image={image}
33
- slotProps={slotProps}
43
+ slotProps={{
44
+ ...slotProps,
45
+ image: {
46
+ ...slotProps?.image,
47
+ sx: [
48
+ { mb: spacingRoleBasedTokens['space-8'] },
49
+ ...normalizeSx(slotProps?.image?.sx),
50
+ ],
51
+ },
52
+ title: {
53
+ ...slotProps?.title,
54
+ sx: [
55
+ {
56
+ color: colorTokens['text-default'],
57
+ fontSize: typographyTokens['font-size-heading-card-title'],
58
+ lineHeight: typographyTokens['line-height-heading-card-title'],
59
+ fontWeight: typographyTokens['font-weight-heading-card-title'],
60
+ letterSpacing: typographyTokens['letter-spacing-heading-card-title'],
61
+ },
62
+ ...normalizeSx(slotProps?.title?.sx),
63
+ ],
64
+ },
65
+ description: {
66
+ ...slotProps?.description,
67
+ sx: [
68
+ {
69
+ color: colorTokens['text-default'],
70
+ fontSize: typographyTokens['font-size-body-small'],
71
+ lineHeight: typographyTokens['line-height-body-small'],
72
+ fontWeight: typographyTokens['font-weight-body-small'],
73
+ },
74
+ ...normalizeSx(slotProps?.description?.sx),
75
+ ],
76
+ },
77
+ content: {
78
+ ...slotProps?.content,
79
+ sx: [
80
+ { mt: spacingTokens['spacing-aliases-stack-loose'] },
81
+ ...normalizeSx(slotProps?.content?.sx),
82
+ ],
83
+ },
84
+ }}
85
+ // Responsive, so it also replaces RcSesCard's md breakpoint gap.
86
+ sx={{ gap: { xs: 0, md: 0 } }}
34
87
  testIds={testIds}
35
88
  title={title}
36
89
  variant='elevation'
@@ -0,0 +1,57 @@
1
+ import { fireEvent, render, screen } from '@testing-library/react'
2
+ import { createRef } from 'react'
3
+ import { describe, expect, test, vi } from 'vitest'
4
+
5
+ import { InfoIcon } from '@/assets/icons/phosphorIcons'
6
+
7
+ import RcSesLinkTile from '.'
8
+
9
+ describe('LinkTile', () => {
10
+ test('renders exactly one anchor named by its label and hides the icon', () => {
11
+ const { container } = render(
12
+ <RcSesLinkTile href='/help' label='Pagalba' Icon={InfoIcon} />,
13
+ )
14
+ const link = screen.getByRole('link', { name: 'Pagalba' })
15
+ expect(link).toHaveAttribute('href', '/help')
16
+ expect(container.querySelectorAll('a')).toHaveLength(1)
17
+ expect(container.querySelector('svg')?.closest('[aria-hidden="true"]')).not.toBeNull()
18
+ expect(screen.queryByRole('button')).not.toBeInTheDocument()
19
+ })
20
+
21
+ test('marks current pages through either supported API', () => {
22
+ const { rerender } = render(
23
+ <RcSesLinkTile href='/help' label='Pagalba' Icon={InfoIcon} current />,
24
+ )
25
+ expect(screen.getByRole('link')).toHaveAttribute('aria-current', 'page')
26
+ rerender(<RcSesLinkTile href='/help' label='Pagalba' Icon={InfoIcon} />)
27
+ expect(screen.getByRole('link')).not.toHaveAttribute('aria-current')
28
+ rerender(
29
+ <RcSesLinkTile href='/help' label='Pagalba' Icon={InfoIcon} aria-current='page' />,
30
+ )
31
+ expect(screen.getByRole('link')).toHaveAttribute('aria-current', 'page')
32
+ })
33
+
34
+ test('forwards anchor ref and caller events without replacing navigation', () => {
35
+ const onClick = vi.fn((event) => event.preventDefault())
36
+ const onTouchCancel = vi.fn()
37
+ const ref = createRef<HTMLAnchorElement>()
38
+ render(
39
+ <RcSesLinkTile
40
+ ref={ref}
41
+ href='/help'
42
+ label='Pagalba'
43
+ Icon={InfoIcon}
44
+ onClick={onClick}
45
+ onTouchCancel={onTouchCancel}
46
+ target='_blank'
47
+ />,
48
+ )
49
+ fireEvent.click(screen.getByRole('link'))
50
+ fireEvent.touchCancel(screen.getByRole('link'))
51
+ expect(onClick).toHaveBeenCalledOnce()
52
+ expect(onTouchCancel).toHaveBeenCalledOnce()
53
+ expect(ref.current).toBe(screen.getByRole('link'))
54
+ expect(ref.current).toHaveAttribute('target', '_blank')
55
+ expect(ref.current).toHaveAttribute('rel', 'noopener noreferrer')
56
+ })
57
+ })