@via-profit/ui-kit 0.5.0 → 0.6.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 (306) hide show
  1. package/Accordion/AccordionActions.d.ts +1 -1
  2. package/Accordion/AccordionActions.js +2 -1
  3. package/Accordion/AccordionContainer.d.ts +1 -1
  4. package/Accordion/AccordionContainer.js +2 -14
  5. package/Accordion/AccordionContent.d.ts +1 -1
  6. package/Accordion/AccordionContent.js +5 -1
  7. package/Accordion/AccordionHeader.d.ts +2 -2
  8. package/Accordion/AccordionHeader.js +6 -2
  9. package/Accordion/index.d.ts +9 -9
  10. package/Accordion/index.js +18 -9
  11. package/Autocomplete/AutocompleteContainer.d.ts +2 -2
  12. package/Autocomplete/AutocompleteContainer.js +17 -7
  13. package/Autocomplete/AutocompleteItem.js +2 -1
  14. package/Autocomplete/context.d.ts +3 -3
  15. package/Autocomplete/index.d.ts +2 -2
  16. package/Avatar/AvatarContainer.d.ts +2 -2
  17. package/Avatar/AvatarPicture.d.ts +2 -2
  18. package/Avatar/index.js +1 -2
  19. package/Badge/BadgeBase.d.ts +1 -1
  20. package/Badge/BadgeContainer.d.ts +1 -1
  21. package/Badge/BadgeDeleteButton.d.ts +2 -2
  22. package/Badge/BadgeStyled.js +1 -1
  23. package/Badge/index.d.ts +1 -1
  24. package/Badge/index.js +1 -2
  25. package/Button/ButtonBase.d.ts +2 -2
  26. package/Button/ButtonContainer.d.ts +4 -4
  27. package/Button/ButtonContainer.js +22 -5
  28. package/Button/ButtonIconWrapper.d.ts +1 -1
  29. package/Button/ButtonStyled.d.ts +1 -1
  30. package/Button/ButtonTextWrapper.d.ts +1 -1
  31. package/Button/buttonVariants.d.ts +1 -1
  32. package/Button/buttonVariants.js +3 -2
  33. package/Button/index.d.ts +1 -1
  34. package/Button/index.js +1 -20
  35. package/ButtonGroup/index.js +4 -3
  36. package/CHANGELOG.md +32 -1
  37. package/Calendar/CalendarComponent.js +18 -9
  38. package/Calendar/CalendarControlButton.d.ts +2 -2
  39. package/Calendar/CalendarPaper.js +1 -1
  40. package/Calendar/CalendarWeekDayLabel.d.ts +2 -2
  41. package/Calendar/CalendarWeekRowButton.d.ts +1 -1
  42. package/Calendar/IconChevronDown.js +17 -7
  43. package/Calendar/index.d.ts +1 -1
  44. package/Calendar/index.js +17 -7
  45. package/Checkbox/CheckboxAsterisk.js +17 -7
  46. package/Checkbox/CheckboxBox.d.ts +2 -2
  47. package/Checkbox/CheckboxBox.js +1 -1
  48. package/Checkbox/CheckboxContainer.d.ts +2 -2
  49. package/Checkbox/CheckboxErrorText.js +17 -7
  50. package/Checkbox/index.d.ts +10 -10
  51. package/Checkbox/index.js +1 -2
  52. package/Checkbox/useCheckboxColor.d.ts +1 -1
  53. package/ClickOutside/index.js +5 -2
  54. package/DatePicker/index.d.ts +1 -1
  55. package/ErrorBoundary/RenderError.js +17 -7
  56. package/ErrorBoundary/index.d.ts +1 -1
  57. package/Grid/index.d.ts +17 -5
  58. package/Grid/index.js +7 -2
  59. package/Highlighted/index.js +1 -2
  60. package/LoadingIndicator/LoadingOverlay.js +17 -7
  61. package/LoadingIndicator/Spinner.js +17 -7
  62. package/LoadingIndicator/SpinnerCircle.d.ts +2 -3
  63. package/Menu/MenuContainer.d.ts +2 -2
  64. package/Menu/MenuContainer.js +19 -10
  65. package/Menu/MenuItem.js +5 -1
  66. package/Menu/MenuList.js +1 -1
  67. package/Menu/context.d.ts +1 -1
  68. package/Menu/index.d.ts +1 -1
  69. package/Modal/BaseModal/ModalInner.js +2 -0
  70. package/Modal/BaseModal/ModalWrapper.js +30 -37
  71. package/Modal/BaseModal/context.d.ts +1 -1
  72. package/Modal/BaseModal/index.js +1 -2
  73. package/Modal/ConfirmBox/ConfirmBoxContent.js +5 -1
  74. package/Modal/ConfirmBox/ConfirmBoxFooter.js +5 -1
  75. package/Modal/ConfirmBox/ConfirmBoxHeader.js +5 -1
  76. package/Modal/ConfirmBox/index.js +1 -2
  77. package/Modal/Dialog/DialogInner.js +5 -1
  78. package/Modal/Dialog/index.js +18 -9
  79. package/Modal/Drawer/DrawerCloseIcon.js +17 -7
  80. package/Modal/Drawer/DrawerFooter.js +5 -1
  81. package/Modal/Drawer/DrawerHeader.d.ts +4 -4
  82. package/Modal/Drawer/DrawerHeader.js +5 -1
  83. package/Modal/Drawer/index.js +18 -9
  84. package/Modal/MessageBox/MessageBoxContent.js +5 -1
  85. package/Modal/MessageBox/MessageBoxFooter.js +5 -1
  86. package/Modal/MessageBox/MessageBoxHeader.js +5 -1
  87. package/Modal/MessageBox/index.js +18 -9
  88. package/Modal/index.js +17 -7
  89. package/Pagination/PaginationContainer.d.ts +9 -0
  90. package/Pagination/PaginationContainer.js +34 -0
  91. package/Pagination/PaginationGap.d.ts +4 -0
  92. package/Pagination/PaginationGap.js +22 -0
  93. package/Pagination/PaginationIcons.d.ts +6 -0
  94. package/Pagination/PaginationIcons.js +21 -0
  95. package/Pagination/PaginationItem.d.ts +44 -0
  96. package/Pagination/PaginationItem.js +59 -0
  97. package/Pagination/getPaginationItems.d.ts +22 -0
  98. package/Pagination/getPaginationItems.js +42 -0
  99. package/Pagination/index.d.ts +104 -0
  100. package/Pagination/index.js +98 -0
  101. package/Pagination/usePagination.d.ts +105 -0
  102. package/Pagination/usePagination.js +66 -0
  103. package/PhoneField/CountryFlagComponent.d.ts +1 -1
  104. package/PhoneField/UnknownFlag.d.ts +0 -1
  105. package/PhoneField/flags/BY.js +17 -7
  106. package/PhoneField/flags/CN.js +17 -7
  107. package/PhoneField/flags/IL.js +17 -7
  108. package/PhoneField/flags/JP.js +17 -7
  109. package/PhoneField/flags/KZ.js +17 -7
  110. package/PhoneField/flags/RU.js +17 -7
  111. package/PhoneField/flags/UA.js +17 -7
  112. package/PhoneField/flags/US.js +17 -7
  113. package/PhoneField/flags/Unknown.js +17 -7
  114. package/PhoneField/templates.d.ts +2 -2
  115. package/Popper/Popper.js +1 -2
  116. package/Radio/RadioBox.d.ts +1 -1
  117. package/Radio/RadioBox.js +1 -1
  118. package/Radio/RadioContainer.d.ts +2 -2
  119. package/Radio/index.d.ts +5 -5
  120. package/Radio/index.js +1 -2
  121. package/Radio/useRadioColor.d.ts +1 -1
  122. package/RadioGroup/RadioGroupAsterisk.js +17 -7
  123. package/RadioGroup/RadioGroupErrorText.js +17 -7
  124. package/RadioGroup/RadioGroupItems.d.ts +1 -1
  125. package/RadioGroup/index.d.ts +11 -11
  126. package/RadioGroup/index.js +1 -2
  127. package/Selectbox/SelectboxButton.d.ts +4 -4
  128. package/Selectbox/SelectboxButton.js +25 -10
  129. package/Selectbox/SelectboxButtonWrapper.d.ts +2 -2
  130. package/Selectbox/SelectboxButtonWrapper.js +19 -10
  131. package/Selectbox/SelectboxMenu.d.ts +2 -2
  132. package/Selectbox/SelectboxMenu.js +17 -7
  133. package/Selectbox/index.d.ts +2 -2
  134. package/Selectbox/index.js +18 -9
  135. package/Slider/SliderRail.d.ts +1 -1
  136. package/Slider/SliderThumb.d.ts +1 -1
  137. package/Slider/SliderTrack.d.ts +1 -1
  138. package/Slider/index.js +1 -2
  139. package/Slider/useSliderColor.d.ts +1 -1
  140. package/Stack/index.d.ts +18 -6
  141. package/Stack/index.js +7 -2
  142. package/Surface/SurfaceContainer.d.ts +3 -3
  143. package/Surface/SurfaceContainer.js +1 -1
  144. package/Surface/SurfaceContent.d.ts +2 -2
  145. package/Surface/SurfaceContent.js +18 -11
  146. package/Surface/SurfaceFooter.d.ts +2 -2
  147. package/Surface/SurfaceFooter.js +5 -1
  148. package/Surface/SurfaceHeader.d.ts +2 -2
  149. package/Surface/SurfaceHeader.js +6 -2
  150. package/Surface/SurfaceSubheader.d.ts +2 -2
  151. package/Surface/SurfaceSubheader.js +6 -2
  152. package/Surface/index.d.ts +10 -10
  153. package/Surface/index.js +18 -9
  154. package/Swiper/Swiper.d.ts +15 -15
  155. package/Swiper/Swiper.js +18 -9
  156. package/Swiper/SwiperContainer.d.ts +2 -2
  157. package/Swiper/SwiperSlide.js +17 -7
  158. package/Swiper/SwiperSlidesRenderer.js +17 -7
  159. package/Swiper/SwiperTrack.d.ts +2 -2
  160. package/Swiper/SwiperTrack.js +17 -7
  161. package/Swiper/SwiperWrapper.d.ts +2 -2
  162. package/Swiper/SwiperWrapper.js +17 -7
  163. package/Switch/SwitchAsterisk.js +17 -7
  164. package/Switch/SwitchContainer.d.ts +2 -2
  165. package/Switch/SwitchDot.d.ts +1 -1
  166. package/Switch/SwitchDot.js +2 -4
  167. package/Switch/SwitchErrorText.js +17 -7
  168. package/Switch/SwitchTrack.d.ts +1 -1
  169. package/Switch/index.d.ts +9 -9
  170. package/Switch/index.js +1 -2
  171. package/Switch/useSwitchColor.d.ts +1 -1
  172. package/Table/Table.d.ts +1 -1
  173. package/Table/Table.js +1 -1
  174. package/Table/TableCaption.js +5 -1
  175. package/Table/TableCell.js +6 -2
  176. package/Table/TableFooter.js +2 -1
  177. package/Table/TableHeaderCell.js +6 -2
  178. package/Tabs/Tab.js +4 -1
  179. package/Tabs/TabPanel.d.ts +1 -1
  180. package/Tabs/Tabs.d.ts +7 -7
  181. package/Tabs/Tabs.js +1 -2
  182. package/Tabs/useTabsColor.d.ts +1 -1
  183. package/TextArea/TextAreaIconWrapper.d.ts +3 -3
  184. package/TextArea/TextAreaIconWrapper.js +17 -7
  185. package/TextArea/TextAreaInput.js +23 -8
  186. package/TextArea/index.js +18 -9
  187. package/TextField/TextFieldContainer.js +17 -7
  188. package/TextField/TextFieldErrorText.js +17 -7
  189. package/TextField/TextFieldIconWrapper.d.ts +3 -3
  190. package/TextField/TextFieldIconWrapper.js +17 -7
  191. package/TextField/TextFieldInput.js +23 -8
  192. package/TextField/TextFieldInputWrapper.d.ts +5 -5
  193. package/TextField/TextFieldInputWrapper.js +22 -9
  194. package/TextField/TextFieldLabel.js +17 -7
  195. package/TextField/TextFieldLabelAsterisk.js +17 -7
  196. package/TextField/index.d.ts +1 -1
  197. package/TextField/index.js +18 -9
  198. package/ThemeProvider/createTheme.js +7 -3
  199. package/ThemeProvider/index.d.ts +45 -12
  200. package/ThemeProvider/index.js +1 -4
  201. package/ThemeProvider/tokens.d.ts +54 -3
  202. package/ThemeProvider/tokens.js +61 -3
  203. package/Toast/ToastCard.js +5 -2
  204. package/Toast/ToastContainer.js +1 -2
  205. package/Tooltip/TooltipContainer.js +2 -0
  206. package/Tooltip/index.js +3 -4
  207. package/Typography/Base.d.ts +2 -3
  208. package/Typography/Blockquote.d.ts +2 -3
  209. package/Typography/List.d.ts +6 -7
  210. package/Typography/Paragraph.d.ts +1 -1
  211. package/Typography/Paragraph.js +17 -7
  212. package/Typography/SectionDescription.d.ts +2 -3
  213. package/Typography/U.d.ts +2 -3
  214. package/esm/Accordion/AccordionActions.js +2 -1
  215. package/esm/Accordion/AccordionContainer.js +2 -14
  216. package/esm/Accordion/AccordionContent.js +5 -1
  217. package/esm/Accordion/AccordionHeader.js +7 -3
  218. package/esm/Accordion/index.js +1 -2
  219. package/esm/Autocomplete/AutocompleteItem.js +2 -1
  220. package/esm/Avatar/index.js +1 -2
  221. package/esm/Badge/BadgeStyled.js +2 -2
  222. package/esm/Badge/index.js +1 -2
  223. package/esm/Button/ButtonContainer.js +23 -6
  224. package/esm/Button/buttonVariants.js +3 -2
  225. package/esm/Button/index.js +1 -20
  226. package/esm/ButtonGroup/index.js +4 -3
  227. package/esm/Calendar/CalendarComponent.js +1 -2
  228. package/esm/Calendar/CalendarPaper.js +1 -1
  229. package/esm/Checkbox/CheckboxBox.js +2 -2
  230. package/esm/Checkbox/index.js +1 -2
  231. package/esm/ClickOutside/index.js +5 -2
  232. package/esm/Grid/index.js +7 -2
  233. package/esm/Highlighted/index.js +1 -2
  234. package/esm/Menu/MenuContainer.js +2 -3
  235. package/esm/Menu/MenuItem.js +5 -1
  236. package/esm/Menu/MenuList.js +1 -1
  237. package/esm/Modal/BaseModal/ModalInner.js +2 -0
  238. package/esm/Modal/BaseModal/ModalWrapper.js +30 -37
  239. package/esm/Modal/BaseModal/index.js +1 -2
  240. package/esm/Modal/ConfirmBox/ConfirmBoxContent.js +5 -1
  241. package/esm/Modal/ConfirmBox/ConfirmBoxFooter.js +5 -1
  242. package/esm/Modal/ConfirmBox/ConfirmBoxHeader.js +5 -1
  243. package/esm/Modal/ConfirmBox/index.js +1 -2
  244. package/esm/Modal/Dialog/DialogInner.js +5 -1
  245. package/esm/Modal/Dialog/index.js +1 -2
  246. package/esm/Modal/Drawer/DrawerFooter.js +5 -1
  247. package/esm/Modal/Drawer/DrawerHeader.js +5 -1
  248. package/esm/Modal/Drawer/index.js +1 -2
  249. package/esm/Modal/MessageBox/MessageBoxContent.js +5 -1
  250. package/esm/Modal/MessageBox/MessageBoxFooter.js +5 -1
  251. package/esm/Modal/MessageBox/MessageBoxHeader.js +5 -1
  252. package/esm/Modal/MessageBox/index.js +1 -2
  253. package/esm/Pagination/PaginationContainer.js +29 -0
  254. package/esm/Pagination/PaginationGap.js +17 -0
  255. package/esm/Pagination/PaginationIcons.js +15 -0
  256. package/esm/Pagination/PaginationItem.js +54 -0
  257. package/esm/Pagination/getPaginationItems.js +40 -0
  258. package/esm/Pagination/index.js +77 -0
  259. package/esm/Pagination/usePagination.js +61 -0
  260. package/esm/Popper/Popper.js +1 -2
  261. package/esm/Radio/RadioBox.js +2 -2
  262. package/esm/Radio/index.js +1 -2
  263. package/esm/RadioGroup/index.js +1 -2
  264. package/esm/Selectbox/SelectboxButton.js +8 -3
  265. package/esm/Selectbox/SelectboxButtonWrapper.js +2 -3
  266. package/esm/Selectbox/index.js +1 -2
  267. package/esm/Slider/index.js +1 -2
  268. package/esm/Stack/index.js +7 -2
  269. package/esm/Surface/SurfaceContainer.js +1 -1
  270. package/esm/Surface/SurfaceContent.js +18 -11
  271. package/esm/Surface/SurfaceFooter.js +5 -1
  272. package/esm/Surface/SurfaceHeader.js +6 -2
  273. package/esm/Surface/SurfaceSubheader.js +6 -2
  274. package/esm/Surface/index.js +1 -2
  275. package/esm/Swiper/Swiper.js +1 -2
  276. package/esm/Switch/SwitchDot.js +2 -4
  277. package/esm/Switch/index.js +1 -2
  278. package/esm/Table/Table.js +1 -1
  279. package/esm/Table/TableCaption.js +5 -1
  280. package/esm/Table/TableCell.js +6 -2
  281. package/esm/Table/TableFooter.js +2 -1
  282. package/esm/Table/TableHeaderCell.js +6 -2
  283. package/esm/Tabs/Tab.js +5 -2
  284. package/esm/Tabs/Tabs.js +1 -2
  285. package/esm/TextArea/TextAreaInput.js +6 -1
  286. package/esm/TextArea/index.js +1 -2
  287. package/esm/TextField/TextFieldInput.js +6 -1
  288. package/esm/TextField/TextFieldInputWrapper.js +5 -2
  289. package/esm/TextField/index.js +1 -2
  290. package/esm/ThemeProvider/createTheme.js +7 -3
  291. package/esm/ThemeProvider/index.js +0 -2
  292. package/esm/ThemeProvider/tokens.js +55 -2
  293. package/esm/Toast/ToastCard.js +6 -3
  294. package/esm/Toast/ToastContainer.js +1 -2
  295. package/esm/Tooltip/TooltipContainer.js +2 -0
  296. package/esm/Tooltip/index.js +3 -4
  297. package/esm/utils/getElementRef.js +13 -0
  298. package/package.json +46 -11
  299. package/utils/getElementRef.d.ts +8 -0
  300. package/utils/getElementRef.js +18 -0
  301. package/ThemeProvider/components.d.ts +0 -79
  302. package/ThemeProvider/components.js +0 -3
  303. package/ThemeProvider/useThemeProps.d.ts +0 -7
  304. package/ThemeProvider/useThemeProps.js +0 -34
  305. package/esm/ThemeProvider/components.js +0 -2
  306. package/esm/ThemeProvider/useThemeProps.js +0 -29
@@ -1,23 +1,20 @@
1
1
  import React from 'react';
2
2
  import { useTheme } from '@emotion/react';
3
3
  import type Color from '../Color';
4
- import type { UIThemeComponents } from './components';
5
4
  export { useTheme };
6
5
  export * from './createTheme';
7
- export * from './components';
8
- export { default as useThemeProps } from './useThemeProps';
9
6
  export * from './tokens';
10
- export type UITheme = Required<Omit<UIThemeOverrides, 'isDark' | 'fontSize' | 'zIndex' | 'shape' | 'color' | 'spacing' | 'components' | 'typography' | 'focusRing' | 'elevation'>> & {
7
+ export type UITheme = Required<Omit<UIThemeOverrides, 'isDark' | 'fontSize' | 'zIndex' | 'shape' | 'color' | 'spacing' | 'padding' | 'typography' | 'focusRing' | 'elevation'>> & {
11
8
  readonly typography: UIThemeOverrideTypography;
12
9
  readonly focusRing: UIThemeOverrideFocusRing;
13
10
  readonly elevation: UIThemeOverrideElevation;
14
- readonly components: UIThemeComponents;
15
11
  readonly isDark: boolean;
16
12
  readonly fontSize: Record<keyof UIThemeOverrideFontSize, number>;
17
13
  readonly zIndex: Required<UIThemeOverrideZIndex>;
18
14
  readonly color: Record<keyof UIThemeOverrideColor, Color>;
19
15
  readonly shape: Required<UIThemeOverrideShape>;
20
16
  readonly spacing: Required<UIThemeOverrideSpacing>;
17
+ readonly padding: Record<ThemePadding, Required<UIThemeOverridePaddingValue>>;
21
18
  };
22
19
  export interface UIThemeOverrideColor {
23
20
  readonly backgroundPrimary?: string;
@@ -61,18 +58,24 @@ export interface UIThemeOverrideFocusRing {
61
58
  readonly color?: string;
62
59
  }
63
60
  /**
64
- * The shadows. Without these values every component has its own shadow
61
+ * The shadows by the level of the elements. Without a value the components of the level
62
+ * get the default shadow of the kit: all of them have the same shadow
65
63
  */
66
64
  export interface UIThemeOverrideElevation {
67
65
  /**
68
- * The elements over the page: the menus, the calendar of the date picker, the toasts
66
+ * The elements over the page: Menu, Calendar, Toast, Tooltip, the modal windows
69
67
  */
70
68
  readonly popup?: string;
71
69
  /**
72
70
  * The cards and the panels on the page: Surface, Accordion, Table
73
71
  */
74
72
  readonly surface?: string;
73
+ /**
74
+ * The raised parts of the controls: the knob of the Switch
75
+ */
76
+ readonly control?: string;
75
77
  }
78
+ export type ThemeElevation = keyof UIThemeOverrideElevation;
76
79
  export interface UIThemeOverrideZIndex {
77
80
  readonly header?: number;
78
81
  readonly modal?: number;
@@ -92,6 +95,40 @@ export interface UIThemeOverrideSpacing {
92
95
  readonly xl?: string;
93
96
  }
94
97
  export type ThemeSpacing = keyof UIThemeOverrideSpacing;
98
+ /**
99
+ * The inner padding of one class of the elements. Any CSS length, `em` is recommended:
100
+ * the padding grows together with the font size
101
+ */
102
+ export interface UIThemeOverridePaddingValue {
103
+ /**
104
+ * The top and the bottom padding
105
+ */
106
+ readonly y?: string;
107
+ /**
108
+ * The left and the right padding
109
+ */
110
+ readonly x?: string;
111
+ }
112
+ /**
113
+ * The inner paddings of the components, by the class of the elements.
114
+ * Smaller paddings make a denser interface without changing the font size
115
+ */
116
+ export interface UIThemeOverridePadding {
117
+ /**
118
+ * The controls: Button, TextField, TextArea, Selectbox, DatePicker, Autocomplete.
119
+ * `y` sets the height of the controls, all of them have the same height
120
+ */
121
+ readonly control?: UIThemeOverridePaddingValue;
122
+ /**
123
+ * The rows of the lists: the menu items, the table cells, the tabs, the accordion headers
124
+ */
125
+ readonly item?: UIThemeOverridePaddingValue;
126
+ /**
127
+ * The content of the panels: Surface, Accordion, the modal windows, Drawer, Toast
128
+ */
129
+ readonly container?: UIThemeOverridePaddingValue;
130
+ }
131
+ export type ThemePadding = keyof UIThemeOverridePadding;
95
132
  export interface UIThemeOverrideFontSize {
96
133
  readonly small?: number;
97
134
  readonly normal?: number;
@@ -103,11 +140,6 @@ export interface UIThemeOverrides {
103
140
  * **Default:** `false`
104
141
  */
105
142
  readonly isDark?: boolean;
106
- /**
107
- * The look of the components: `defaultProps`, the `styles` added to the parts
108
- * and the `overrides` that replace the parts. The props of the component instance win over the theme
109
- */
110
- readonly components?: UIThemeComponents;
111
143
  readonly fontSize?: UIThemeOverrideFontSize;
112
144
  readonly typography?: UIThemeOverrideTypography;
113
145
  readonly focusRing?: UIThemeOverrideFocusRing;
@@ -115,6 +147,7 @@ export interface UIThemeOverrides {
115
147
  readonly zIndex?: UIThemeOverrideZIndex;
116
148
  readonly shape?: UIThemeOverrideShape;
117
149
  readonly spacing?: UIThemeOverrideSpacing;
150
+ readonly padding?: UIThemeOverridePadding;
118
151
  readonly color?: UIThemeOverrideColor;
119
152
  }
120
153
  declare const ThemeProvider: React.FC<ThemeProviderProps>;
@@ -17,14 +17,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.useThemeProps = exports.useTheme = void 0;
20
+ exports.useTheme = void 0;
21
21
  const react_1 = __importDefault(require("react"));
22
22
  const react_2 = require("@emotion/react");
23
23
  Object.defineProperty(exports, "useTheme", { enumerable: true, get: function () { return react_2.useTheme; } });
24
24
  __exportStar(require("./createTheme"), exports);
25
- __exportStar(require("./components"), exports);
26
- var useThemeProps_1 = require("./useThemeProps");
27
- Object.defineProperty(exports, "useThemeProps", { enumerable: true, get: function () { return __importDefault(useThemeProps_1).default; } });
28
25
  __exportStar(require("./tokens"), exports);
29
26
  const ThemeProvider = props => {
30
27
  const { children, theme } = props;
@@ -1,4 +1,5 @@
1
1
  import { Theme } from '@emotion/react';
2
+ import type { ThemePadding, ThemeElevation } from './index';
2
3
  /**
3
4
  * True if the theme sets the focus ring
4
5
  */
@@ -8,8 +9,58 @@ export declare const hasThemeFocusRing: (theme: Theme) => boolean;
8
9
  * Put it at the end of the styles: it replaces the own focus of the component.
9
10
  * Without `focusRing` in the theme it returns nothing and the component keeps its own focus
10
11
  */
11
- export declare const themeFocusRing: (theme: Theme, selector?: string) => import("@emotion/utils").SerializedStyles | undefined;
12
+ export declare const themeFocusRing: (theme: Theme, selector?: string) => import("@emotion/react").SerializedStyles | undefined;
12
13
  /**
13
- * The shadow of the level: the `elevation` of the theme, or the own shadow of the component
14
+ * The default shadows of the levels: the components of one level have the same shadow.
15
+ * In `px`, not in `em`: the tooltip and the toast have a smaller font, but the same shadow as the menu
14
16
  */
15
- export declare const elevation: (theme: Theme, level: 'popup' | 'surface', own: string) => string;
17
+ export declare const defaultElevation: (theme: Theme) => Record<ThemeElevation, string>;
18
+ /**
19
+ * The shadow of the level: the `elevation` of the theme or the default shadow of the level.
20
+ * `own` replaces the default shadow, the shadow of the theme wins over both
21
+ */
22
+ export declare const elevation: (theme: Theme, level: ThemeElevation, own?: string) => string;
23
+ /**
24
+ * The height of the text line in the controls, in the `em` of the control. Set as a length,
25
+ * the line height is inherited as is by the text of any size: the label of the button and the value of the field
26
+ */
27
+ export declare const CONTROL_LINE_HEIGHT = "1.2em";
28
+ /**
29
+ * The width of the borders of the components: `1px` at the font size of `16px`.
30
+ * In `em`: the border grows together with the font, and at the usual sizes the browser draws `1px`
31
+ */
32
+ export declare const BORDER_WIDTH = "0.0625em";
33
+ /**
34
+ * The border of the buttons. The standard and the plain buttons have no border:
35
+ * their padding is larger by this width, so all the variants have the same size
36
+ */
37
+ export declare const CONTROL_BORDER = "0.0625em";
38
+ /**
39
+ * The size of the text in the fields (TextField, TextArea, Selectbox) relative to the control
40
+ */
41
+ export declare const FIELD_TEXT_SCALE = 0.9;
42
+ /**
43
+ * The height of the one-line control: the icon buttons are squares of this size
44
+ */
45
+ export declare const controlHeight: (theme: Theme) => string;
46
+ /**
47
+ * The border of the field: the border of the buttons in the `em` of the field with the font size `fontScale`
48
+ */
49
+ export declare const fieldBorder: (fontScale?: number) => string;
50
+ /**
51
+ * The padding of the field with the `fieldBorder`, so the field has the height of the button.
52
+ * `fontScale` is the font size of the element relative to the control: the `em` of the padding are its own
53
+ */
54
+ export declare const fieldPadding: (theme: Theme, fontScale?: number) => {
55
+ y: string;
56
+ x: string;
57
+ };
58
+ /**
59
+ * The padding of the class for the element with its own font size.
60
+ * `fontScale` is the font size of the element relative to the parent: the padding is in the `em` of the parent,
61
+ * so the header with a larger font has the same padding as the content under it
62
+ */
63
+ export declare const themePadding: (theme: Theme, kind: ThemePadding, fontScale?: number) => {
64
+ y: string;
65
+ x: string;
66
+ };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.elevation = exports.themeFocusRing = exports.hasThemeFocusRing = void 0;
3
+ exports.themePadding = exports.fieldPadding = exports.fieldBorder = exports.controlHeight = exports.FIELD_TEXT_SCALE = exports.CONTROL_BORDER = exports.BORDER_WIDTH = exports.CONTROL_LINE_HEIGHT = exports.elevation = exports.defaultElevation = exports.themeFocusRing = exports.hasThemeFocusRing = void 0;
4
4
  const react_1 = require("@emotion/react");
5
5
  /**
6
6
  * True if the theme sets the focus ring
@@ -26,7 +26,65 @@ const themeFocusRing = (theme, selector = '&:focus-visible') => {
26
26
  };
27
27
  exports.themeFocusRing = themeFocusRing;
28
28
  /**
29
- * The shadow of the level: the `elevation` of the theme, or the own shadow of the component
29
+ * The default shadows of the levels: the components of one level have the same shadow.
30
+ * In `px`, not in `em`: the tooltip and the toast have a smaller font, but the same shadow as the menu
30
31
  */
31
- const elevation = (theme, level, own) => { var _a; return (_a = theme.elevation[level]) !== null && _a !== void 0 ? _a : own; };
32
+ const defaultElevation = (theme) => ({
33
+ popup: `0 8px 24px ${theme.color.surface.darken(50).alpha(0.6).toString()}`,
34
+ surface: `0 8px 32px -13px ${theme.color.surface.darken(100).alpha(0.4).toString()}`,
35
+ control: `0 1px 3px ${theme.color.surface.darken(100).alpha(0.35).toString()}`,
36
+ });
37
+ exports.defaultElevation = defaultElevation;
38
+ /**
39
+ * The shadow of the level: the `elevation` of the theme or the default shadow of the level.
40
+ * `own` replaces the default shadow, the shadow of the theme wins over both
41
+ */
42
+ const elevation = (theme, level, own) => { var _a, _b; return (_b = (_a = theme.elevation[level]) !== null && _a !== void 0 ? _a : own) !== null && _b !== void 0 ? _b : (0, exports.defaultElevation)(theme)[level]; };
32
43
  exports.elevation = elevation;
44
+ /**
45
+ * The height of the text line in the controls, in the `em` of the control. Set as a length,
46
+ * the line height is inherited as is by the text of any size: the label of the button and the value of the field
47
+ */
48
+ exports.CONTROL_LINE_HEIGHT = '1.2em';
49
+ /**
50
+ * The width of the borders of the components: `1px` at the font size of `16px`.
51
+ * In `em`: the border grows together with the font, and at the usual sizes the browser draws `1px`
52
+ */
53
+ exports.BORDER_WIDTH = '0.0625em';
54
+ /**
55
+ * The border of the buttons. The standard and the plain buttons have no border:
56
+ * their padding is larger by this width, so all the variants have the same size
57
+ */
58
+ exports.CONTROL_BORDER = exports.BORDER_WIDTH;
59
+ /**
60
+ * The size of the text in the fields (TextField, TextArea, Selectbox) relative to the control
61
+ */
62
+ exports.FIELD_TEXT_SCALE = 0.9;
63
+ /**
64
+ * The height of the one-line control: the icon buttons are squares of this size
65
+ */
66
+ const controlHeight = (theme) => `calc(${exports.CONTROL_LINE_HEIGHT} + 2 * ${theme.padding.control.y} + 2 * ${exports.CONTROL_BORDER})`;
67
+ exports.controlHeight = controlHeight;
68
+ /**
69
+ * The border of the field: the border of the buttons in the `em` of the field with the font size `fontScale`
70
+ */
71
+ const fieldBorder = (fontScale = 1) => `calc(${exports.CONTROL_BORDER} / ${fontScale})`;
72
+ exports.fieldBorder = fieldBorder;
73
+ /**
74
+ * The padding of the field with the `fieldBorder`, so the field has the height of the button.
75
+ * `fontScale` is the font size of the element relative to the control: the `em` of the padding are its own
76
+ */
77
+ const fieldPadding = (theme, fontScale = 1) => (0, exports.themePadding)(theme, 'control', fontScale);
78
+ exports.fieldPadding = fieldPadding;
79
+ /**
80
+ * The padding of the class for the element with its own font size.
81
+ * `fontScale` is the font size of the element relative to the parent: the padding is in the `em` of the parent,
82
+ * so the header with a larger font has the same padding as the content under it
83
+ */
84
+ const themePadding = (theme, kind, fontScale = 1) => {
85
+ const { y, x } = theme.padding[kind];
86
+ return fontScale === 1
87
+ ? { y, x }
88
+ : { y: `calc(${y} / ${fontScale})`, x: `calc(${x} / ${fontScale})` };
89
+ };
90
+ exports.themePadding = themePadding;
@@ -41,12 +41,15 @@ const StyledCard = styled_1.default.div `
41
41
  width: max-content;
42
42
  max-width: 100%;
43
43
  min-width: 14em;
44
- padding: 0.75em 1em;
44
+ padding: ${({ theme }) => {
45
+ const { y, x } = (0, tokens_1.themePadding)(theme, 'container');
46
+ return `calc(${y} * 0.75) ${x}`;
47
+ }};
45
48
  border-radius: ${({ theme }) => theme.shape.radiusFactor * 1.5}em;
46
49
  border: 1px solid ${({ theme }) => theme.color.textPrimary.alpha(0.08).toString()};
47
50
  background-color: ${({ theme }) => theme.color.surface.toString()};
48
51
  color: ${({ theme }) => theme.color.textPrimary.toString()};
49
- box-shadow: ${({ theme }) => (0, tokens_1.elevation)(theme, 'popup', `0 0.5em 1.5em rgba(0, 0, 0, ${theme.isDark ? 0.5 : 0.14})`)};
52
+ box-shadow: ${({ theme }) => (0, tokens_1.elevation)(theme, 'popup')};
50
53
  font-size: 0.875em;
51
54
  line-height: 1.4;
52
55
  pointer-events: auto;
@@ -13,7 +13,6 @@ const ToastCloseButton_1 = __importDefault(require("./ToastCloseButton"));
13
13
  const ToastAction_1 = __importDefault(require("./ToastAction"));
14
14
  const ToastItem_1 = __importDefault(require("./ToastItem"));
15
15
  const store_1 = require("./store");
16
- const useThemeProps_1 = __importDefault(require("../ThemeProvider/useThemeProps"));
17
16
  const POSITIONS = [
18
17
  'top-left',
19
18
  'top-center',
@@ -90,7 +89,7 @@ const useWindowFocused = () => {
90
89
  return isFocused;
91
90
  };
92
91
  const ToastContainer = props => {
93
- const { containerId, position = 'top-right', autoClose = 5000, limit, closeButton = true, closeButtonLabel = 'Close', closeOnClick = true, pauseOnHover = true, pauseOnFocusLoss = true, newestOnTop = false, hotkey = 'F8', label = 'Notifications', zIndex, overrides, } = (0, useThemeProps_1.default)('Toast', props);
92
+ const { containerId, position = 'top-right', autoClose = 5000, limit, closeButton = true, closeButtonLabel = 'Close', closeOnClick = true, pauseOnHover = true, pauseOnFocusLoss = true, newestOnTop = false, hotkey = 'F8', label = 'Notifications', zIndex, overrides, } = props;
94
93
  const theme = (0, react_2.useTheme)();
95
94
  const allToasts = react_1.default.useSyncExternalStore(store_1.toastStore.subscribe, store_1.toastStore.getSnapshot, store_1.toastStore.getServerSnapshot);
96
95
  const toasts = react_1.default.useMemo(() => allToasts.filter(item => item.containerId === containerId), [allToasts, containerId]);
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  const react_1 = __importDefault(require("react"));
18
18
  const styled_1 = __importDefault(require("@emotion/styled"));
19
19
  const react_2 = require("@emotion/react");
20
+ const tokens_1 = require("../ThemeProvider/tokens");
20
21
  const appear = (0, react_2.keyframes) `
21
22
  from {
22
23
  opacity: 0;
@@ -38,6 +39,7 @@ const StyledContainer = styled_1.default.div `
38
39
  overflow-wrap: break-word;
39
40
  /* Inverted colors: dark on the light theme, light on the dark one */
40
41
  background-color: ${({ theme }) => theme.color.textPrimary.toString()};
42
+ box-shadow: ${({ theme }) => (0, tokens_1.elevation)(theme, 'popup')};
41
43
  color: ${({ theme }) => theme.color.surface.toString()};
42
44
  animation: ${appear} 120ms ease-out;
43
45
 
package/Tooltip/index.js CHANGED
@@ -8,7 +8,7 @@ const react_2 = require("@emotion/react");
8
8
  const Popper_1 = __importDefault(require("../Popper"));
9
9
  const TooltipContainer_1 = __importDefault(require("./TooltipContainer"));
10
10
  const TooltipArrow_1 = __importDefault(require("./TooltipArrow"));
11
- const useThemeProps_1 = __importDefault(require("../ThemeProvider/useThemeProps"));
11
+ const getElementRef_1 = __importDefault(require("../utils/getElementRef"));
12
12
  /**
13
13
  * Pointer types that have the hover. A tap on the touch screen fires `pointerenter` too,
14
14
  * the tooltip would flash on every tap
@@ -45,7 +45,7 @@ const setRef = (ref, value) => {
45
45
  const isEmptyTitle = (title) => title === null || typeof title === 'undefined' || title === false || title === '';
46
46
  const Tooltip = props => {
47
47
  var _a;
48
- const { title, children, placement = 'top', arrow = false, enterDelay = 400, leaveDelay = 100, isOpen, onOpenChange, describeChild = false, offset = 8, zIndex, id, overrides, } = (0, useThemeProps_1.default)('Tooltip', props);
48
+ const { title, children, placement = 'top', arrow = false, enterDelay = 400, leaveDelay = 100, isOpen, onOpenChange, describeChild = false, offset = 8, zIndex, id, overrides, } = props;
49
49
  const theme = (0, react_2.useTheme)();
50
50
  const generatedId = `tooltip-${react_1.default.useId().replace(/:/g, '')}`;
51
51
  const tooltipId = id || generatedId;
@@ -137,8 +137,7 @@ const Tooltip = props => {
137
137
  }
138
138
  const child = children;
139
139
  const childProps = child.props;
140
- // React 18 keeps the ref of the element outside of props
141
- childRefRef.current = child.ref;
140
+ childRefRef.current = (0, getElementRef_1.default)(child);
142
141
  if (isEmpty) {
143
142
  return child;
144
143
  }
@@ -1,10 +1,9 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * @deprecated - Use `Span` instead\
4
3
  * Example: `import Span from '@via-profit/ui-kit/Typography/Span'`
5
4
  */
6
5
  declare const Base: import("@emotion/styled").StyledComponent<{
7
- theme?: import("@emotion/react").Theme | undefined;
8
- as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
6
+ theme?: import("@emotion/react").Theme;
7
+ as?: React.ElementType;
9
8
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
10
9
  export default Base;
@@ -1,6 +1,5 @@
1
- /// <reference types="react" />
2
1
  declare const Blockquote: import("@emotion/styled").StyledComponent<{
3
- theme?: import("@emotion/react").Theme | undefined;
4
- as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
2
+ theme?: import("@emotion/react").Theme;
3
+ as?: React.ElementType;
5
4
  }, import("react").DetailedHTMLProps<import("react").BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>, {}>;
6
5
  export default Blockquote;
@@ -1,14 +1,13 @@
1
- /// <reference types="react" />
2
1
  export declare const Ul: import("@emotion/styled").StyledComponent<{
3
- theme?: import("@emotion/react").Theme | undefined;
4
- as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
2
+ theme?: import("@emotion/react").Theme;
3
+ as?: React.ElementType;
5
4
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, {}>;
6
5
  export declare const Ol: import("@emotion/styled").StyledComponent<{
7
- theme?: import("@emotion/react").Theme | undefined;
8
- as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
6
+ theme?: import("@emotion/react").Theme;
7
+ as?: React.ElementType;
9
8
  }, import("react").DetailedHTMLProps<import("react").OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, {}>;
10
9
  export declare const Li: import("@emotion/styled").StyledComponent<{
11
- theme?: import("@emotion/react").Theme | undefined;
12
- as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
10
+ theme?: import("@emotion/react").Theme;
11
+ as?: React.ElementType;
13
12
  }, import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, {}>;
14
13
  export default Ul;
@@ -9,6 +9,6 @@ declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTM
9
9
  /**
10
10
  * if `true` is passed, the margins will be removed
11
11
  */
12
- readonly noMargin?: boolean | undefined;
12
+ readonly noMargin?: boolean;
13
13
  } & React.RefAttributes<HTMLParagraphElement>>;
14
14
  export default _default;
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __rest = (this && this.__rest) || function (s, e) {
26
36
  var t = {};
27
37
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -1,7 +1,6 @@
1
- /// <reference types="react" />
2
1
  declare const SectionDescription: import("@emotion/styled").StyledComponent<import("react").HTMLAttributes<HTMLParagraphElement> & {
3
- readonly noMargin?: boolean | undefined;
2
+ readonly noMargin?: boolean;
4
3
  } & import("react").RefAttributes<HTMLParagraphElement> & {
5
- theme?: import("@emotion/react").Theme | undefined;
4
+ theme?: import("@emotion/react").Theme;
6
5
  }, {}, {}>;
7
6
  export default SectionDescription;
package/Typography/U.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- /// <reference types="react" />
2
1
  declare const U: import("@emotion/styled").StyledComponent<{
3
- theme?: import("@emotion/react").Theme | undefined;
4
- as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
2
+ theme?: import("@emotion/react").Theme;
3
+ as?: React.ElementType;
5
4
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {}>;
6
5
  export default U;
@@ -11,11 +11,12 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import React from 'react';
13
13
  import styled from '@emotion/styled';
14
+ import { themePadding } from '../ThemeProvider/tokens';
14
15
  const StyledActions = styled.div `
15
16
  display: flex;
16
17
  align-items: center;
17
18
  justify-content: flex-end;
18
- padding: ${({ $noPadding }) => ($noPadding ? '0' : '1rem 0')};
19
+ padding: ${({ $noPadding, theme }) => $noPadding ? '0' : `${themePadding(theme, 'container').y} 0`};
19
20
  border-bottom-left-radius: inherit;
20
21
  border-bottom-right-radius: inherit;
21
22
  `;
@@ -11,6 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import React from 'react';
13
13
  import styled from '@emotion/styled';
14
+ import { elevation } from '../ThemeProvider/tokens';
14
15
  const StyledAccordionContainer = styled.div `
15
16
  display: ${({ $inline }) => ($inline ? 'inline-flex' : 'flex')};
16
17
  box-sizing: border-box;
@@ -21,20 +22,7 @@ const StyledAccordionContainer = styled.div `
21
22
  font-size: 1em;
22
23
  position: relative;
23
24
  margin-top: 1px;
24
- box-shadow:
25
- ${({ theme }) => theme.isDark
26
- ? theme.color.backgroundSecondary.lighten(80).alpha(0.2).toString()
27
- : theme.color.backgroundSecondary.lighten(50).alpha(0.2).toString()}
28
- 0px 2px 1px -1px,
29
- ${({ theme }) => theme.isDark
30
- ? theme.color.backgroundSecondary.lighten(80).alpha(0.14).toString()
31
- : theme.color.backgroundSecondary.lighten(50).alpha(0.14).toString()}
32
- 0px 1px 1px 0px,
33
- ${({ theme }) => theme.isDark
34
- ? theme.color.backgroundSecondary.lighten(80).alpha(0.12).toString()
35
- : theme.color.backgroundSecondary.lighten(50).alpha(0.12).toString()}
36
- 0px 1px 3px 0px;
37
- ${({ theme }) => theme.elevation.surface && `box-shadow: ${theme.elevation.surface};`}
25
+ box-shadow: ${({ theme }) => elevation(theme, 'surface')};
38
26
 
39
27
  /*
40
28
  * Adjacent accordions form a group: the inner corners are square.
@@ -11,6 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import React from 'react';
13
13
  import styled from '@emotion/styled';
14
+ import { themePadding } from '../ThemeProvider/tokens';
14
15
  /**
15
16
  * Animates the height with grid rows 0fr -> 1fr: no fixed max-height, so the tall content is not cut.
16
17
  * `visibility: hidden` of the collapsed content removes it from the tab order and the accessibility tree
@@ -28,7 +29,10 @@ const Clip = styled.div `
28
29
  overflow: hidden;
29
30
  `;
30
31
  const Wrapper = styled.div `
31
- padding: ${({ $noPadding }) => ($noPadding ? '0' : '1rem')};
32
+ padding: ${({ $noPadding, theme }) => {
33
+ const { y, x } = themePadding(theme, 'container');
34
+ return $noPadding ? '0' : `${y} ${x}`;
35
+ }};
32
36
  `;
33
37
  const AccordionContent = (props, ref) => {
34
38
  const { children, noPadding, isOpen } = props, nativeProps = __rest(props, ["children", "noPadding", "isOpen"]);
@@ -12,7 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import React from 'react';
13
13
  import styled from '@emotion/styled';
14
14
  import Chevron from './Chevron';
15
- import { themeFocusRing } from '../ThemeProvider/tokens';
15
+ import { themeFocusRing, themePadding } from '../ThemeProvider/tokens';
16
16
  const StyledHeader = styled.div `
17
17
  font-size: 1.3rem;
18
18
  font-weight: 600;
@@ -27,10 +27,14 @@ const HeaderButton = styled.button `
27
27
  flex-direction: row;
28
28
  flex-wrap: nowrap;
29
29
  align-items: center;
30
- gap: 1rem;
30
+ gap: 1em;
31
31
  width: 100%;
32
32
  margin: 0;
33
- padding: 1rem;
33
+ /* The text of the header is aligned with the content */
34
+ padding: ${({ theme }) => {
35
+ const { y, x } = themePadding(theme, 'container');
36
+ return `${y} ${x}`;
37
+ }};
34
38
  border: 0;
35
39
  border-radius: inherit;
36
40
  background: none;
@@ -14,9 +14,8 @@ import Container from './AccordionContainer';
14
14
  import Header from './AccordionHeader';
15
15
  import Content from './AccordionContent';
16
16
  import Actions from './AccordionActions';
17
- import useThemeProps from '../ThemeProvider/useThemeProps';
18
17
  const Accordion = (props, ref) => {
19
- const _a = useThemeProps('Accordion', props), { children, header, actions, isOpen, onOpen, overrides, noPadding, defaultOpened } = _a, nativeProps = __rest(_a, ["children", "header", "actions", "isOpen", "onOpen", "overrides", "noPadding", "defaultOpened"]);
18
+ const { children, header, actions, isOpen, onOpen, overrides, noPadding, defaultOpened } = props, nativeProps = __rest(props, ["children", "header", "actions", "isOpen", "onOpen", "overrides", "noPadding", "defaultOpened"]);
20
19
  const hasActions = typeof actions !== 'undefined' && actions !== null;
21
20
  const hasHeader = typeof header !== 'undefined' && header !== null;
22
21
  const [internalOpened, setInternalOpened] = React.useState(Boolean(defaultOpened));
@@ -13,6 +13,7 @@ import React from 'react';
13
13
  import styled from '@emotion/styled';
14
14
  import { css } from '@emotion/react';
15
15
  import MenuItem from '../Menu/MenuItem';
16
+ import { BORDER_WIDTH } from '../ThemeProvider/tokens';
16
17
  const StyeldMenuItem = styled(MenuItem, {
17
18
  shouldForwardProp: p => !['variant'].includes(p),
18
19
  }) `
@@ -22,7 +23,7 @@ const StyeldMenuItem = styled(MenuItem, {
22
23
  border-color: ${theme.color.accentPrimary.toString()};
23
24
  color: ${theme.color.textPrimary.toString()};
24
25
  border-style: dashed;
25
- border-width: 0.02em;
26
+ border-width: ${BORDER_WIDTH};
26
27
 
27
28
  :hover {
28
29
  background-color: ${theme.color.accentPrimary.toString()};
@@ -14,7 +14,6 @@ import styled from '@emotion/styled';
14
14
  import { useTheme, css } from '@emotion/react';
15
15
  import Color from '../Color';
16
16
  import AvatarBase from './AvatarBase';
17
- import useThemeProps from '../ThemeProvider/useThemeProps';
18
17
  const StyledAvatarBase = styled(AvatarBase) `
19
18
  position: relative;
20
19
  color: ${({ $color }) => $color.toString()};
@@ -50,7 +49,7 @@ const StyledAvatarBase = styled(AvatarBase) `
50
49
  }}
51
50
  `;
52
51
  const Avatar = (props, ref) => {
53
- const _a = useThemeProps('Avatar', props), { children, color, onClick, onKeyDown, isOnline, size, src, variant = 'circular', alt, overrides } = _a, restProps = __rest(_a, ["children", "color", "onClick", "onKeyDown", "isOnline", "size", "src", "variant", "alt", "overrides"]);
52
+ const { children, color, onClick, onKeyDown, isOnline, size, src, variant = 'circular', alt, overrides } = props, restProps = __rest(props, ["children", "color", "onClick", "onKeyDown", "isOnline", "size", "src", "variant", "alt", "overrides"]);
54
53
  const theme = useTheme();
55
54
  const clickable = React.useMemo(() => typeof onClick === 'function', [onClick]);
56
55
  // A clickable avatar acts as a button, so it is activated by Enter and Space too
@@ -14,7 +14,7 @@ import styled from '@emotion/styled';
14
14
  import { useTheme, css } from '@emotion/react';
15
15
  import Color from '../Color';
16
16
  import BadgeBase from './BadgeBase';
17
- import { themeFocusRing } from '../ThemeProvider/tokens';
17
+ import { themeFocusRing, BORDER_WIDTH } from '../ThemeProvider/tokens';
18
18
  const parseColor = (color, fallback) => {
19
19
  try {
20
20
  return Color.fromString(color);
@@ -71,7 +71,7 @@ const getOutlinedColors = (color, theme) => {
71
71
  */
72
72
  const StyledBadge = styled(BadgeBase) `
73
73
  border-style: solid;
74
- border-width: 0.14em;
74
+ border-width: ${BORDER_WIDTH};
75
75
  border-color: ${({ $background }) => $background.toString()};
76
76
 
77
77
  ${({ $variant, $color, $background, theme }) => $variant === 'outlined'
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import BadgeStyled from './BadgeStyled';
3
- import useThemeProps from '../ThemeProvider/useThemeProps';
4
3
  // One component for both variants, so changing the variant does not remount the badge
5
- const Badge = (props, ref) => (React.createElement(BadgeStyled, Object.assign({}, useThemeProps('Badge', props), { ref: ref })));
4
+ const Badge = (props, ref) => (React.createElement(BadgeStyled, Object.assign({}, props, { ref: ref })));
6
5
  export default React.forwardRef(Badge);