@via-profit/ui-kit 0.5.0 → 0.7.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 (311) 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 +49 -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 +83 -15
  155. package/Swiper/Swiper.js +285 -143
  156. package/Swiper/SwiperContainer.d.ts +2 -2
  157. package/Swiper/SwiperSlide.js +20 -7
  158. package/Swiper/SwiperSlidesRenderer.d.ts +4 -0
  159. package/Swiper/SwiperSlidesRenderer.js +19 -8
  160. package/Swiper/SwiperTrack.d.ts +22 -2
  161. package/Swiper/SwiperTrack.js +45 -12
  162. package/Swiper/SwiperWrapper.d.ts +5 -2
  163. package/Swiper/SwiperWrapper.js +22 -11
  164. package/Switch/SwitchAsterisk.js +17 -7
  165. package/Switch/SwitchContainer.d.ts +2 -2
  166. package/Switch/SwitchDot.d.ts +1 -1
  167. package/Switch/SwitchDot.js +2 -4
  168. package/Switch/SwitchErrorText.js +17 -7
  169. package/Switch/SwitchTrack.d.ts +1 -1
  170. package/Switch/index.d.ts +9 -9
  171. package/Switch/index.js +1 -2
  172. package/Switch/useSwitchColor.d.ts +1 -1
  173. package/Table/Table.d.ts +1 -1
  174. package/Table/Table.js +1 -1
  175. package/Table/TableCaption.js +5 -1
  176. package/Table/TableCell.js +6 -2
  177. package/Table/TableFooter.js +2 -1
  178. package/Table/TableHeaderCell.js +6 -2
  179. package/Tabs/Tab.js +4 -1
  180. package/Tabs/TabPanel.d.ts +1 -1
  181. package/Tabs/Tabs.d.ts +7 -7
  182. package/Tabs/Tabs.js +1 -2
  183. package/Tabs/useTabsColor.d.ts +1 -1
  184. package/TextArea/TextAreaIconWrapper.d.ts +3 -3
  185. package/TextArea/TextAreaIconWrapper.js +17 -7
  186. package/TextArea/TextAreaInput.js +23 -8
  187. package/TextArea/index.js +18 -9
  188. package/TextField/TextFieldContainer.js +17 -7
  189. package/TextField/TextFieldErrorText.js +17 -7
  190. package/TextField/TextFieldIconWrapper.d.ts +3 -3
  191. package/TextField/TextFieldIconWrapper.js +17 -7
  192. package/TextField/TextFieldInput.js +23 -8
  193. package/TextField/TextFieldInputWrapper.d.ts +5 -5
  194. package/TextField/TextFieldInputWrapper.js +22 -9
  195. package/TextField/TextFieldLabel.js +17 -7
  196. package/TextField/TextFieldLabelAsterisk.js +17 -7
  197. package/TextField/index.d.ts +1 -1
  198. package/TextField/index.js +18 -9
  199. package/ThemeProvider/createTheme.js +7 -3
  200. package/ThemeProvider/index.d.ts +45 -12
  201. package/ThemeProvider/index.js +1 -4
  202. package/ThemeProvider/tokens.d.ts +54 -3
  203. package/ThemeProvider/tokens.js +61 -3
  204. package/Toast/ToastCard.js +5 -2
  205. package/Toast/ToastContainer.js +1 -2
  206. package/Tooltip/TooltipContainer.js +2 -0
  207. package/Tooltip/index.js +3 -4
  208. package/Typography/Base.d.ts +2 -3
  209. package/Typography/Blockquote.d.ts +2 -3
  210. package/Typography/List.d.ts +6 -7
  211. package/Typography/Paragraph.d.ts +1 -1
  212. package/Typography/Paragraph.js +17 -7
  213. package/Typography/SectionDescription.d.ts +2 -3
  214. package/Typography/U.d.ts +2 -3
  215. package/esm/Accordion/AccordionActions.js +2 -1
  216. package/esm/Accordion/AccordionContainer.js +2 -14
  217. package/esm/Accordion/AccordionContent.js +5 -1
  218. package/esm/Accordion/AccordionHeader.js +7 -3
  219. package/esm/Accordion/index.js +1 -2
  220. package/esm/Autocomplete/AutocompleteItem.js +2 -1
  221. package/esm/Avatar/index.js +1 -2
  222. package/esm/Badge/BadgeStyled.js +2 -2
  223. package/esm/Badge/index.js +1 -2
  224. package/esm/Button/ButtonContainer.js +23 -6
  225. package/esm/Button/buttonVariants.js +3 -2
  226. package/esm/Button/index.js +1 -20
  227. package/esm/ButtonGroup/index.js +4 -3
  228. package/esm/Calendar/CalendarComponent.js +1 -2
  229. package/esm/Calendar/CalendarPaper.js +1 -1
  230. package/esm/Checkbox/CheckboxBox.js +2 -2
  231. package/esm/Checkbox/index.js +1 -2
  232. package/esm/ClickOutside/index.js +5 -2
  233. package/esm/Grid/index.js +7 -2
  234. package/esm/Highlighted/index.js +1 -2
  235. package/esm/Menu/MenuContainer.js +2 -3
  236. package/esm/Menu/MenuItem.js +5 -1
  237. package/esm/Menu/MenuList.js +1 -1
  238. package/esm/Modal/BaseModal/ModalInner.js +2 -0
  239. package/esm/Modal/BaseModal/ModalWrapper.js +30 -37
  240. package/esm/Modal/BaseModal/index.js +1 -2
  241. package/esm/Modal/ConfirmBox/ConfirmBoxContent.js +5 -1
  242. package/esm/Modal/ConfirmBox/ConfirmBoxFooter.js +5 -1
  243. package/esm/Modal/ConfirmBox/ConfirmBoxHeader.js +5 -1
  244. package/esm/Modal/ConfirmBox/index.js +1 -2
  245. package/esm/Modal/Dialog/DialogInner.js +5 -1
  246. package/esm/Modal/Dialog/index.js +1 -2
  247. package/esm/Modal/Drawer/DrawerFooter.js +5 -1
  248. package/esm/Modal/Drawer/DrawerHeader.js +5 -1
  249. package/esm/Modal/Drawer/index.js +1 -2
  250. package/esm/Modal/MessageBox/MessageBoxContent.js +5 -1
  251. package/esm/Modal/MessageBox/MessageBoxFooter.js +5 -1
  252. package/esm/Modal/MessageBox/MessageBoxHeader.js +5 -1
  253. package/esm/Modal/MessageBox/index.js +1 -2
  254. package/esm/Pagination/PaginationContainer.js +29 -0
  255. package/esm/Pagination/PaginationGap.js +17 -0
  256. package/esm/Pagination/PaginationIcons.js +15 -0
  257. package/esm/Pagination/PaginationItem.js +54 -0
  258. package/esm/Pagination/getPaginationItems.js +40 -0
  259. package/esm/Pagination/index.js +77 -0
  260. package/esm/Pagination/usePagination.js +61 -0
  261. package/esm/Popper/Popper.js +1 -2
  262. package/esm/Radio/RadioBox.js +2 -2
  263. package/esm/Radio/index.js +1 -2
  264. package/esm/RadioGroup/index.js +1 -2
  265. package/esm/Selectbox/SelectboxButton.js +8 -3
  266. package/esm/Selectbox/SelectboxButtonWrapper.js +2 -3
  267. package/esm/Selectbox/index.js +1 -2
  268. package/esm/Slider/index.js +1 -2
  269. package/esm/Stack/index.js +7 -2
  270. package/esm/Surface/SurfaceContainer.js +1 -1
  271. package/esm/Surface/SurfaceContent.js +18 -11
  272. package/esm/Surface/SurfaceFooter.js +5 -1
  273. package/esm/Surface/SurfaceHeader.js +6 -2
  274. package/esm/Surface/SurfaceSubheader.js +6 -2
  275. package/esm/Surface/index.js +1 -2
  276. package/esm/Swiper/Swiper.js +268 -136
  277. package/esm/Swiper/SwiperSlide.js +3 -0
  278. package/esm/Swiper/SwiperSlidesRenderer.js +2 -1
  279. package/esm/Swiper/SwiperTrack.js +28 -5
  280. package/esm/Swiper/SwiperWrapper.js +5 -4
  281. package/esm/Switch/SwitchDot.js +2 -4
  282. package/esm/Switch/index.js +1 -2
  283. package/esm/Table/Table.js +1 -1
  284. package/esm/Table/TableCaption.js +5 -1
  285. package/esm/Table/TableCell.js +6 -2
  286. package/esm/Table/TableFooter.js +2 -1
  287. package/esm/Table/TableHeaderCell.js +6 -2
  288. package/esm/Tabs/Tab.js +5 -2
  289. package/esm/Tabs/Tabs.js +1 -2
  290. package/esm/TextArea/TextAreaInput.js +6 -1
  291. package/esm/TextArea/index.js +1 -2
  292. package/esm/TextField/TextFieldInput.js +6 -1
  293. package/esm/TextField/TextFieldInputWrapper.js +5 -2
  294. package/esm/TextField/index.js +1 -2
  295. package/esm/ThemeProvider/createTheme.js +7 -3
  296. package/esm/ThemeProvider/index.js +0 -2
  297. package/esm/ThemeProvider/tokens.js +55 -2
  298. package/esm/Toast/ToastCard.js +6 -3
  299. package/esm/Toast/ToastContainer.js +1 -2
  300. package/esm/Tooltip/TooltipContainer.js +2 -0
  301. package/esm/Tooltip/index.js +3 -4
  302. package/esm/utils/getElementRef.js +13 -0
  303. package/package.json +46 -11
  304. package/utils/getElementRef.d.ts +8 -0
  305. package/utils/getElementRef.js +18 -0
  306. package/ThemeProvider/components.d.ts +0 -79
  307. package/ThemeProvider/components.js +0 -3
  308. package/ThemeProvider/useThemeProps.d.ts +0 -7
  309. package/ThemeProvider/useThemeProps.js +0 -34
  310. package/esm/ThemeProvider/components.js +0 -2
  311. package/esm/ThemeProvider/useThemeProps.js +0 -29
@@ -12,11 +12,21 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import React from 'react';
13
13
  import styled from '@emotion/styled';
14
14
  import { css } from '@emotion/react';
15
- import { themeFocusRing } from '../ThemeProvider/tokens';
15
+ import { themeFocusRing, controlHeight, CONTROL_BORDER, CONTROL_LINE_HEIGHT, } from '../ThemeProvider/tokens';
16
16
  import { buttonVariantStyles } from './buttonVariants';
17
+ /**
18
+ * The outlined buttons and all the buttons of the ButtonGroup have a border.
19
+ * The other ones get its width in the padding, so all the buttons have the same height
20
+ */
21
+ const buttonPadding = ({ theme, $variant, $group }) => {
22
+ const { y, x } = theme.padding.control;
23
+ const hasBorder = $variant === 'outlined' || Boolean($group) || !$variant;
24
+ return hasBorder ? `${y} ${x}` : `calc(${y} + ${CONTROL_BORDER}) calc(${x} + ${CONTROL_BORDER})`;
25
+ };
17
26
  const StyledButton = styled.button `
18
27
  border-radius: ${({ theme }) => theme.shape.radiusFactor * 2}em;
19
- padding: 0.8em 1em;
28
+ padding: ${buttonPadding};
29
+ line-height: ${CONTROL_LINE_HEIGHT};
20
30
  cursor: ${({ disabled }) => (disabled ? 'default' : 'pointer')};
21
31
  font-size: 1em;
22
32
  /* Buttons do not inherit the font by default */
@@ -25,7 +35,13 @@ const StyledButton = styled.button `
25
35
  outline-style: solid;
26
36
  outline-color: transparent;
27
37
  outline-width: 0.14em;
28
- transition: all 180ms ease-out 0s;
38
+ /*
39
+ * The colors only: the variants have different border and padding, a transition of the sizes
40
+ * makes the button grow for a moment when the variant changes (the border width changes by whole pixels)
41
+ */
42
+ transition-property: color, background-color, border-color, box-shadow, outline-color;
43
+ transition-duration: 180ms;
44
+ transition-timing-function: ease-out;
29
45
  background: none;
30
46
  display: inline-flex;
31
47
  align-items: center;
@@ -40,10 +56,11 @@ const StyledButton = styled.button `
40
56
  }};
41
57
  ${({ iconOnly, theme }) => iconOnly &&
42
58
  css `
43
- padding: 1em;
59
+ padding: 0;
44
60
  justify-content: center;
45
- width: 2.6em;
46
- height: 2.6em;
61
+ box-sizing: border-box;
62
+ width: ${controlHeight(theme)};
63
+ height: ${controlHeight(theme)};
47
64
  border-radius: ${theme.shape.radiusFactor * 3}em;
48
65
  `}
49
66
  ${({ $variant, $group, color, disabled, theme }) => $variant && buttonVariantStyles({ variant: $variant, color, disabled, group: $group, theme })}
@@ -1,5 +1,6 @@
1
1
  import { css } from '@emotion/react';
2
2
  import Color from '../Color';
3
+ import { CONTROL_BORDER } from '../ThemeProvider/tokens';
3
4
  const parseColor = (color, fallback) => {
4
5
  try {
5
6
  return Color.fromString(color);
@@ -82,7 +83,7 @@ const outlinedStyles = ({ $color, disabled, theme }) => css `
82
83
  : $color.toString()};
83
84
  background-color: transparent;
84
85
  border-style: solid;
85
- border-width: 0.14em;
86
+ border-width: ${CONTROL_BORDER};
86
87
 
87
88
  ${!disabled &&
88
89
  css `
@@ -126,7 +127,7 @@ const plainStyles = ({ $color, disabled, theme }) => css `
126
127
  const groupStyles = ({ $group, $variant, $color }) => $group &&
127
128
  css `
128
129
  border-style: solid;
129
- border-width: 0.14em;
130
+ border-width: ${CONTROL_BORDER};
130
131
  ${$variant !== 'outlined' &&
131
132
  css `
132
133
  border-color: transparent;
@@ -1,24 +1,5 @@
1
1
  import React from 'react';
2
2
  import ButtonStyled from './ButtonStyled';
3
- import ButtonGroupContext from '../ButtonGroup/ButtonGroupContext';
4
- import useThemeProps from '../ThemeProvider/useThemeProps';
5
- /**
6
- * The props the ButtonGroup gives to its buttons. Inside the group the theme does not set them:
7
- * the own props of the button win, then the group, then the theme
8
- */
9
- const GROUP_PROPS = ['variant', 'color', 'disabled'];
10
3
  // One component for all the variants, so changing the variant does not remount the button
11
- const Button = (props, ref) => {
12
- const group = React.useContext(ButtonGroupContext);
13
- const themedProps = useThemeProps('Button', props);
14
- if (!group) {
15
- return React.createElement(ButtonStyled, Object.assign({}, themedProps, { ref: ref }));
16
- }
17
- const ownProps = props;
18
- const buttonProps = Object.assign({}, themedProps);
19
- GROUP_PROPS.forEach(key => {
20
- buttonProps[key] = ownProps[key];
21
- });
22
- return React.createElement(ButtonStyled, Object.assign({}, buttonProps, { ref: ref }));
23
- };
4
+ const Button = (props, ref) => (React.createElement(ButtonStyled, Object.assign({}, props, { ref: ref })));
24
5
  export default React.forwardRef(Button);
@@ -13,8 +13,9 @@ import React from 'react';
13
13
  import styled from '@emotion/styled';
14
14
  import { css } from '@emotion/react';
15
15
  import ButtonGroupContext from './ButtonGroupContext';
16
+ import { CONTROL_BORDER } from '../ThemeProvider/tokens';
16
17
  /**
17
- * The buttons are glued: the inner corners are square and the borders overlap.
18
+ * The buttons are glued: the inner corners are square and the borders overlap by the width of the border.
18
19
  * `:not(...)` raises the specificity above the own styles of the button.
19
20
  * `-of-type`, not `-child`: with SSR emotion inserts <style> elements between the children
20
21
  */
@@ -39,7 +40,7 @@ const StyledGroup = styled.div `
39
40
  ${({ $orientation }) => $orientation === 'vertical'
40
41
  ? css `
41
42
  & > *:not(:first-of-type) {
42
- margin-top: -0.14em;
43
+ margin-top: calc(-1 * ${CONTROL_BORDER});
43
44
  border-top-left-radius: 0;
44
45
  border-top-right-radius: 0;
45
46
  }
@@ -50,7 +51,7 @@ const StyledGroup = styled.div `
50
51
  `
51
52
  : css `
52
53
  & > *:not(:first-of-type) {
53
- margin-left: -0.14em;
54
+ margin-left: calc(-1 * ${CONTROL_BORDER});
54
55
  border-top-left-radius: 0;
55
56
  border-bottom-left-radius: 0;
56
57
  }
@@ -24,7 +24,6 @@ import WeekDaysBar from './CalendarWeekDaysBar';
24
24
  import { useCalendar } from './use-calendar';
25
25
  import styled from '@emotion/styled';
26
26
  import { keyframes } from '@emotion/react';
27
- import useThemeProps from '../ThemeProvider/useThemeProps';
28
27
  export * from './use-calendar';
29
28
  export * from './CalendarWeekDaysBar';
30
29
  const viewAppear = keyframes `
@@ -117,7 +116,7 @@ const computeCalendarDate = (params) => {
117
116
  };
118
117
  const CalendarComponent = React.forwardRef((props, ref) => {
119
118
  var _a;
120
- const { minDate: inputMinDate, maxDate: inputMaxDate, weekStartDay = 'monday', locale = 'ru-RU', displayLeadingZero = false, onChange, badges = [], markToday = true, weekDayLabelFormat = 'short', accentColor = 'primary', defaultValue, value: inputValue, initialView: inputInitialView, view: inputView, views: inputViews, resetButtonLabel, todayButtonLabel, heading, subheading, footer, overrides, range = false, prevButtonLabel = 'Previous', nextButtonLabel = 'Next', } = useThemeProps('Calendar', props);
119
+ const { minDate: inputMinDate, maxDate: inputMaxDate, weekStartDay = 'monday', locale = 'ru-RU', displayLeadingZero = false, onChange, badges = [], markToday = true, weekDayLabelFormat = 'short', accentColor = 'primary', defaultValue, value: inputValue, initialView: inputInitialView, view: inputView, views: inputViews, resetButtonLabel, todayButtonLabel, heading, subheading, footer, overrides, range = false, prevButtonLabel = 'Previous', nextButtonLabel = 'Next', } = props;
121
120
  /**
122
121
  * Validations
123
122
  */
@@ -20,7 +20,7 @@ const StyledCalendarPaper = styled.div `
20
20
  justify-content: stretch;
21
21
  background-color: ${({ theme }) => theme.color.surface.toString()};
22
22
  border-radius: ${({ theme }) => theme.shape.radiusFactor}em;
23
- box-shadow: ${({ theme }) => elevation(theme, 'popup', `0 4px 24px ${theme.color.surface.darken(50).alpha(0.6).toString()}`)};
23
+ box-shadow: ${({ theme }) => elevation(theme, 'popup')};
24
24
  `;
25
25
  const CalendarPaper = (props, ref) => {
26
26
  const { children } = props, restProps = __rest(props, ["children"]);
@@ -13,7 +13,7 @@ import React from 'react';
13
13
  import styled from '@emotion/styled';
14
14
  import { css } from '@emotion/react';
15
15
  import useCheckboxColor from './useCheckboxColor';
16
- import { themeFocusRing } from '../ThemeProvider/tokens';
16
+ import { themeFocusRing, BORDER_WIDTH } from '../ThemeProvider/tokens';
17
17
  const Root = styled.span `
18
18
  position: relative;
19
19
  display: inline-flex;
@@ -44,7 +44,7 @@ const Square = styled.span `
44
44
  display: flex;
45
45
  width: 100%;
46
46
  height: 100%;
47
- border-width: 0.1em;
47
+ border-width: ${BORDER_WIDTH};
48
48
  border-style: solid;
49
49
  /* Scaled down: the square is small, the full radius would turn it into a circle */
50
50
  border-radius: ${({ theme }) => theme.shape.radiusFactor * 0.6}em;
@@ -17,9 +17,8 @@ import Icon from './CheckboxIcon';
17
17
  import TextWrapper from './CheckboxTextWrapper';
18
18
  import Asterisk from './CheckboxAsterisk';
19
19
  import ErrorText from './CheckboxErrorText';
20
- import useThemeProps from '../ThemeProvider/useThemeProps';
21
20
  const Checkbox = (props, ref) => {
22
- const _a = useThemeProps('Checkbox', props), { checked, defaultChecked, onChange, indeterminate = false, disabled, color, labelPosition, error, errorText, requiredAsterisk, overrides, children, className, style } = _a, nativeProps = __rest(_a, ["checked", "defaultChecked", "onChange", "indeterminate", "disabled", "color", "labelPosition", "error", "errorText", "requiredAsterisk", "overrides", "children", "className", "style"]);
21
+ const { checked, defaultChecked, onChange, indeterminate = false, disabled, color, labelPosition, error, errorText, requiredAsterisk, overrides, children, className, style } = props, nativeProps = __rest(props, ["checked", "defaultChecked", "onChange", "indeterminate", "disabled", "color", "labelPosition", "error", "errorText", "requiredAsterisk", "overrides", "children", "className", "style"]);
23
22
  const inputRef = React.useRef(null);
24
23
  const [internalChecked, setInternalChecked] = React.useState(Boolean(defaultChecked));
25
24
  const isControlled = typeof checked !== 'undefined';
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import getElementRef from '../utils/getElementRef';
2
3
  export const mouseEventMap = {
3
4
  onClick: 'click',
4
5
  onMouseDown: 'mousedown',
@@ -37,7 +38,7 @@ const ClickOutside = props => {
37
38
  };
38
39
  }, [onOutsideClick, mouseEvent]);
39
40
  // Keep the child's own ref working alongside ours
40
- const childRef = children.ref;
41
+ const childRef = getElementRef(children);
41
42
  const setRef = React.useCallback((el) => {
42
43
  ref.current = el;
43
44
  if (typeof childRef === 'function') {
@@ -47,6 +48,8 @@ const ClickOutside = props => {
47
48
  childRef.current = el;
48
49
  }
49
50
  }, [childRef]);
50
- return React.createElement(React.Fragment, null, React.cloneElement(children, { ref: setRef }));
51
+ return (React.createElement(React.Fragment, null, React.cloneElement(children, {
52
+ ref: setRef,
53
+ })));
51
54
  };
52
55
  export default ClickOutside;
package/esm/Grid/index.js CHANGED
@@ -12,6 +12,10 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import React from 'react';
13
13
  import styled from '@emotion/styled';
14
14
  import { resolveSpacing } from '../utils/spacing';
15
+ /**
16
+ * The lists are the rows of the elements here: no default margins and markers
17
+ */
18
+ const LIST_TAGS = ['ul', 'ol', 'dl'];
15
19
  const StyledGrid = styled.div `
16
20
  display: grid;
17
21
  grid-template-columns: ${({ $template }) => $template};
@@ -19,6 +23,7 @@ const StyledGrid = styled.div `
19
23
  ${({ theme, $rowGap }) => typeof $rowGap !== 'undefined' ? `row-gap: ${resolveSpacing(theme, $rowGap)};` : ''}
20
24
  align-items: ${({ $align }) => $align !== null && $align !== void 0 ? $align : 'stretch'};
21
25
  min-width: 0;
26
+ ${({ $isList }) => ($isList ? 'margin: 0; padding: 0; list-style: none;' : '')}
22
27
  `;
23
28
  const getTemplate = (minColumnWidth, columns) => {
24
29
  if (minColumnWidth) {
@@ -32,7 +37,7 @@ const getTemplate = (minColumnWidth, columns) => {
32
37
  * The grid of cells with the same gap. The children are the cells: no wrappers for the items
33
38
  */
34
39
  const Grid = (props, ref) => {
35
- const { children, minColumnWidth, columns = 1, gap = 'md', rowGap, align } = props, nativeProps = __rest(props, ["children", "minColumnWidth", "columns", "gap", "rowGap", "align"]);
36
- return (React.createElement(StyledGrid, Object.assign({}, nativeProps, { "$template": getTemplate(minColumnWidth, columns), "$gap": gap, "$rowGap": rowGap, "$align": align, ref: ref }), children));
40
+ const { children, minColumnWidth, columns = 1, gap = 'md', rowGap, align, as } = props, nativeProps = __rest(props, ["children", "minColumnWidth", "columns", "gap", "rowGap", "align", "as"]);
41
+ return (React.createElement(StyledGrid, Object.assign({}, nativeProps, { "$template": getTemplate(minColumnWidth, columns), "$gap": gap, "$rowGap": rowGap, "$align": align, "$isList": Boolean(as && LIST_TAGS.includes(as)), as: as, ref: ref }), children));
37
42
  };
38
43
  export default React.forwardRef(Grid);
@@ -14,13 +14,12 @@ import React from 'react';
14
14
  import Container from './HighlightedContainer';
15
15
  import Mark from './HighlightedMark';
16
16
  import Text from './HighlightedText';
17
- import useThemeProps from '../ThemeProvider/useThemeProps';
18
17
  export const escapeRegex = (pattern) => pattern.replace(/[/\-\\^$*+?.()|[\]{}]/g, '\\$&');
19
18
  /**
20
19
  * The component allows you to highlight text matches in a string
21
20
  */
22
21
  const Highlighted = (props, ref) => {
23
- const _a = useThemeProps('Highlighted', props), { text, highlight, overrides, disabledHighlighting = false, caseSensitive = false } = _a, nativeProps = __rest(_a, ["text", "highlight", "overrides", "disabledHighlighting", "caseSensitive"]);
22
+ const { text, highlight, overrides, disabledHighlighting = false, caseSensitive = false } = props, nativeProps = __rest(props, ["text", "highlight", "overrides", "disabledHighlighting", "caseSensitive"]);
24
23
  const patterns = React.useMemo(() => (typeof highlight === 'string' ? [highlight] : highlight)
25
24
  .filter(h => h.trim() !== '')
26
25
  // Longest first: the alternation takes the first matching pattern,
@@ -3,7 +3,6 @@ import useContext, { actionSetmenuState } from './context';
3
3
  import List from './MenuList';
4
4
  import Popper from '../Popper';
5
5
  import ClickOutside from '../ClickOutside';
6
- import useThemeProps from '../ThemeProvider/useThemeProps';
7
6
  const onRequestCloseDefault = () => undefined;
8
7
  const isEqual = (a, b) => {
9
8
  if (a === b) {
@@ -19,7 +18,7 @@ const isEqual = (a, b) => {
19
18
  return keysA.every(key => Object.prototype.hasOwnProperty.call(b, key) && a[key] === b[key]);
20
19
  };
21
20
  const MenuContainer = React.forwardRef((props, ref) => {
22
- const { items, value, anchorElement = null, overrides, children, closeOutsideClick = true, closeOnAnchorClick = false, isOpen = false, anchorPos = 'bottom', alternativePlacements = ['bottom', 'top'], positionStrategy, autoFlip, viewportMargin, offset, multiple = false, autofocus = true, closeOnSelect = !multiple, onRequestClose = onRequestCloseDefault, onAnchorPosChanged, zIndex, onSelectItem, getOptionSelected, maxWidth, } = useThemeProps('Menu', props);
21
+ const { items, value, anchorElement = null, overrides, children, closeOutsideClick = true, closeOnAnchorClick = false, isOpen = false, anchorPos = 'bottom', alternativePlacements = ['bottom', 'top'], positionStrategy, autoFlip, viewportMargin, offset, multiple = false, autofocus = true, closeOnSelect = !multiple, onRequestClose = onRequestCloseDefault, onAnchorPosChanged, zIndex, onSelectItem, getOptionSelected, maxWidth, } = props;
23
22
  const overridesMap = React.useMemo(() => ({
24
23
  List: (overrides === null || overrides === void 0 ? void 0 : overrides.List) || List,
25
24
  Popper: (overrides === null || overrides === void 0 ? void 0 : overrides.Popper) || Popper,
@@ -28,7 +27,7 @@ const MenuContainer = React.forwardRef((props, ref) => {
28
27
  const menuPopperRef = React.useRef(null);
29
28
  // Starts as `false` so that a menu mounted in the open state is focused and scrolled too
30
29
  const isOpenRef = React.useRef(false);
31
- const focusTimeoutRef = React.useRef();
30
+ const focusTimeoutRef = React.useRef(undefined);
32
31
  // Whether the focus is inside the list: then it is returned to the anchor on close
33
32
  const hasFocusRef = React.useRef(false);
34
33
  // The parent often resets the anchor together with isOpen, so the last one is kept
@@ -12,12 +12,16 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import React from 'react';
13
13
  import styled from '@emotion/styled';
14
14
  import { css } from '@emotion/react';
15
+ import { themePadding } from '../ThemeProvider/tokens';
15
16
  const StyledMenuItem = styled.div `
16
17
  cursor: pointer;
17
18
  user-select: none;
18
19
  display: flex;
19
20
  align-items: center;
20
- padding: 0.4em 0.8em;
21
+ padding: ${({ theme }) => {
22
+ const { y, x } = themePadding(theme, 'item');
23
+ return `${y} ${x}`;
24
+ }};
21
25
  transition: all 240ms ease-out;
22
26
  border-radius: ${({ theme }) => theme.shape.radiusFactor}em;
23
27
  background-color: ${({ theme, selected, hovered }) => {
@@ -20,7 +20,7 @@ const StyledMenuList = styled.div `
20
20
  opacity: ${props => (props.$isOpen ? 1 : 0)};
21
21
  background-color: ${({ theme }) => theme.color.surface.toString()};
22
22
  border-radius: ${({ theme }) => theme.shape.radiusFactor * 2}em;
23
- box-shadow: ${({ theme }) => elevation(theme, 'popup', `0 0.5em 1.5em ${theme.color.surface.darken(50).alpha(0.6).toString()}`)};
23
+ box-shadow: ${({ theme }) => elevation(theme, 'popup')};
24
24
 
25
25
  ${({ $maxWidth }) => {
26
26
  if (typeof $maxWidth === 'number') {
@@ -12,6 +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 { css } from '@emotion/react';
15
+ import { elevation } from '../../ThemeProvider/tokens';
15
16
  const StyledModalInner = styled.div `
16
17
  opacity: 0;
17
18
  z-index: ${({ theme }) => theme.zIndex.modal};
@@ -19,6 +20,7 @@ const StyledModalInner = styled.div `
19
20
  pointer-events: all;
20
21
  position: relative;
21
22
  background-color: ${({ theme }) => theme.color.surface.toString()};
23
+ box-shadow: ${({ theme }) => elevation(theme, 'popup')};
22
24
  border-radius: ${({ theme }) => theme.shape.radiusFactor * 2}em;
23
25
  margin-top: 2em;
24
26
  transition:
@@ -6,6 +6,32 @@ import TabManager from '../../utils/TabManager';
6
6
  * Count of the modals which lock the body scroll
7
7
  */
8
8
  let bodyLocksCount = 0;
9
+ const SCROLL_WIDTH_PROPERTY = '--modal-scroll-width';
10
+ /**
11
+ * The first modal hides the scrollbar of the page and puts the margin of the same width instead,
12
+ * so the page does not move. The width is measured before the scrollbar is hidden:
13
+ * the scrollbar of the window, not of the body (`0` for the overlay scrollbars)
14
+ */
15
+ const lockPageScroll = () => {
16
+ var _a;
17
+ if (bodyLocksCount === 0) {
18
+ const scrollWidth = Math.max(window.innerWidth - window.document.documentElement.clientWidth, 0);
19
+ window.document.documentElement.style.setProperty(SCROLL_WIDTH_PROPERTY, `${scrollWidth}px`);
20
+ (_a = window.document.body) === null || _a === void 0 ? void 0 : _a.classList.add('-modal-over');
21
+ }
22
+ bodyLocksCount += 1;
23
+ };
24
+ /**
25
+ * The last modal returns the scrollbar of the page
26
+ */
27
+ const unlockPageScroll = () => {
28
+ var _a;
29
+ bodyLocksCount = Math.max(0, bodyLocksCount - 1);
30
+ if (bodyLocksCount === 0) {
31
+ (_a = window.document.body) === null || _a === void 0 ? void 0 : _a.classList.remove('-modal-over');
32
+ window.document.documentElement.style.removeProperty(SCROLL_WIDTH_PROPERTY);
33
+ }
34
+ };
9
35
  const ModalWrapper = props => {
10
36
  const { children, isOpen: isOpenProp, autofocus = true } = props;
11
37
  const { state, dispatch } = useContext();
@@ -29,46 +55,16 @@ const ModalWrapper = props => {
29
55
  }
30
56
  };
31
57
  }, [isOpen, autofocus]);
32
- const getScrollWidth = React.useCallback(() => {
33
- var _a;
34
- const outer = window.document.createElement('div');
35
- const inner = window.document.createElement('div');
36
- const isVerticalScrollbar = window.document.body.scrollHeight > window.document.body.clientHeight;
37
- if (!isVerticalScrollbar) {
38
- return 0;
39
- }
40
- let widthNoScroll = 0;
41
- let widthWithScroll = 0;
42
- outer.style.visibility = 'hidden';
43
- outer.style.width = '100px';
44
- window.document.body.appendChild(outer);
45
- widthNoScroll = outer.offsetWidth;
46
- // force scrollbars
47
- outer.style.overflow = 'scroll';
48
- // add innerdiv
49
- inner.style.width = '100%';
50
- outer.appendChild(inner);
51
- widthWithScroll = inner.offsetWidth;
52
- // remove div
53
- (_a = outer.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(outer);
54
- return widthNoScroll - widthWithScroll;
55
- }, []);
56
58
  const lockBody = React.useCallback(() => {
57
- var _a;
58
59
  if (!bodyLockedRef.current) {
59
60
  bodyLockedRef.current = true;
60
- bodyLocksCount += 1;
61
- (_a = window.document.body) === null || _a === void 0 ? void 0 : _a.classList.add('-modal-over');
61
+ lockPageScroll();
62
62
  }
63
63
  }, []);
64
64
  const unlockBody = React.useCallback(() => {
65
- var _a;
66
65
  if (bodyLockedRef.current) {
67
66
  bodyLockedRef.current = false;
68
- bodyLocksCount = Math.max(0, bodyLocksCount - 1);
69
- if (bodyLocksCount === 0) {
70
- (_a = window.document.body) === null || _a === void 0 ? void 0 : _a.classList.remove('-modal-over');
71
- }
67
+ unlockPageScroll();
72
68
  }
73
69
  }, []);
74
70
  /**
@@ -160,13 +156,10 @@ const ModalWrapper = props => {
160
156
  return React.useMemo(() => isMounted ? (React.createElement("div", { ref: containerRef, tabIndex: -1, id: id },
161
157
  children,
162
158
  React.createElement(Global, { styles: css `
163
- :root {
164
- --modal-scroll-width: ${getScrollWidth()}px;
165
- }
166
159
  body.-modal-over {
167
160
  overflow: hidden;
168
- margin-right: var(--modal-scroll-width);
161
+ margin-right: var(${SCROLL_WIDTH_PROPERTY}, 0px);
169
162
  }
170
- ` }))) : null, [children, getScrollWidth, isMounted, id]);
163
+ ` }))) : null, [children, isMounted, id]);
171
164
  };
172
165
  export default ModalWrapper;
@@ -7,9 +7,8 @@ import InnerContainer from './ModalInnerContainer';
7
7
  import ModalWrapper from './ModalWrapper';
8
8
  import RenderModal from './RenderModal';
9
9
  import NoSSR from '../../NoSSR';
10
- import useThemeProps from '../../ThemeProvider/useThemeProps';
11
10
  const BaseModal = props => {
12
- const { isOpen, children, overrides, autofocus = true, closeOnOverlayClick = defaultState.closeOnOverlayClick, closeOnEscape = defaultState.closeOnEscape, destroyTimeout = defaultState.destroyTimeout, onRequestClose, } = useThemeProps('Modal', props);
11
+ const { isOpen, children, overrides, autofocus = true, closeOnOverlayClick = defaultState.closeOnOverlayClick, closeOnEscape = defaultState.closeOnEscape, destroyTimeout = defaultState.destroyTimeout, onRequestClose, } = props;
13
12
  const [domLoaded, setDomLoaded] = React.useState(false);
14
13
  const overridesMap = React.useMemo(() => ({
15
14
  Overlay: (overrides === null || overrides === void 0 ? void 0 : overrides.Overlay) || Overlay,
@@ -11,9 +11,13 @@ 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 StyledConfirmBoxContent = styled.div `
15
16
  flex: 1;
16
- padding: 1em 1em;
17
+ padding: ${({ theme }) => {
18
+ const { y, x } = themePadding(theme, 'container');
19
+ return `${y} ${x}`;
20
+ }};
17
21
  `;
18
22
  const ConfirmBoxContent = (props, ref) => {
19
23
  const { children, dialogID } = props, nativeProps = __rest(props, ["children", "dialogID"]);
@@ -12,11 +12,15 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import React from 'react';
13
13
  import styled from '@emotion/styled';
14
14
  import Button from '../../Button';
15
+ import { themePadding } from '../../ThemeProvider/tokens';
15
16
  const StyledConfirmBoxFooter = styled.div `
16
17
  display: flex;
17
18
  justify-content: flex-end;
18
19
  align-items: center;
19
- padding: 1em 1em 1em 1em;
20
+ padding: ${({ theme }) => {
21
+ const { y, x } = themePadding(theme, 'container');
22
+ return `${y} ${x}`;
23
+ }};
20
24
 
21
25
  & > button {
22
26
  border-radius: 0;
@@ -11,8 +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 StyedConfirmBoxHeader = styled.div `
15
- padding: 1em 1em 0 1em;
16
+ padding: ${({ theme }) => {
17
+ const { y, x } = themePadding(theme, 'container');
18
+ return `${y} ${x} 0 ${x}`;
19
+ }};
16
20
  `;
17
21
  const ConfirmBoxTitle = styled.div `
18
22
  font-size: 1.4rem;
@@ -17,9 +17,8 @@ import Footer from './ConfirmBoxFooter';
17
17
  import Header from './ConfirmBoxHeader';
18
18
  import Overlay from '../BaseModal/ModalOverlay';
19
19
  import useDialogID from '../BaseModal/useDialogID';
20
- import useThemeProps from '../../ThemeProvider/useThemeProps';
21
20
  const ConfirmBox = props => {
22
- const _a = useThemeProps('ConfirmBox', props), { header, children, onRequestYes, onRequestClose, overrides, isOpen, dismissButtonLabel, confirmButtonLabel } = _a, otherProps = __rest(_a, ["header", "children", "onRequestYes", "onRequestClose", "overrides", "isOpen", "dismissButtonLabel", "confirmButtonLabel"]);
21
+ const { header, children, onRequestYes, onRequestClose, overrides, isOpen, dismissButtonLabel, confirmButtonLabel } = props, otherProps = __rest(props, ["header", "children", "onRequestYes", "onRequestClose", "overrides", "isOpen", "dismissButtonLabel", "confirmButtonLabel"]);
23
22
  const dialogID = useDialogID('dialog-confirm');
24
23
  const overridesMap = React.useMemo(() => ({
25
24
  Container: (overrides === null || overrides === void 0 ? void 0 : overrides.Container) || Container,
@@ -12,8 +12,12 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import React from 'react';
13
13
  import styled from '@emotion/styled';
14
14
  import BaseModalInner from '../BaseModal/ModalInner';
15
+ import { themePadding } from '../../ThemeProvider/tokens';
15
16
  const StyledDialogInner = styled(BaseModalInner) `
16
- padding: 1em 1em;
17
+ padding: ${({ theme }) => {
18
+ const { y, x } = themePadding(theme, 'container');
19
+ return `${y} ${x}`;
20
+ }};
17
21
  `;
18
22
  const DialogInner = (props, ref) => {
19
23
  const { children, dialogID } = props, restProps = __rest(props, ["children", "dialogID"]);
@@ -13,9 +13,8 @@ import * as React from 'react';
13
13
  import BaseModal from '../BaseModal';
14
14
  import DialogInner from './DialogInner';
15
15
  import useDialogID from '../BaseModal/useDialogID';
16
- import useThemeProps from '../../ThemeProvider/useThemeProps';
17
16
  const Dialog = props => {
18
- const _a = useThemeProps('Dialog', props), { children, overrides } = _a, restProps = __rest(_a, ["children", "overrides"]);
17
+ const { children, overrides } = props, restProps = __rest(props, ["children", "overrides"]);
19
18
  const dialogID = useDialogID('dialog');
20
19
  // Created once: a component created during the render is a new type on every render,
21
20
  // so React would remount the whole dialog content (inputs lose the focus and the state)
@@ -11,8 +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 StyledDrawerFooter = styled.div `
15
- padding: 0.5em 1em;
16
+ padding: ${({ theme }) => {
17
+ const { y, x } = themePadding(theme, 'container');
18
+ return `calc(${y} / 2) ${x}`;
19
+ }};
16
20
  `;
17
21
  const DrawerFooter = (props, ref) => {
18
22
  const { children } = props, nativeProps = __rest(props, ["children"]);
@@ -14,8 +14,12 @@ import styled from '@emotion/styled';
14
14
  import Span from '../../Typography/Span';
15
15
  import DrawerCloseIcon from './DrawerCloseIcon';
16
16
  import Button from '../../Button';
17
+ import { themePadding } from '../../ThemeProvider/tokens';
17
18
  const StyledDrawerHeader = styled.div `
18
- padding: 1em;
19
+ padding: ${({ theme }) => {
20
+ const { y, x } = themePadding(theme, 'container');
21
+ return `${y} ${x}`;
22
+ }};
19
23
  display: flex;
20
24
  align-items: center;
21
25
  justify-content: space-between;
@@ -18,9 +18,8 @@ import Content from './DrawerContent';
18
18
  import Footer from './DrawerFooter';
19
19
  import Overlay from '../BaseModal/ModalOverlay';
20
20
  import useDialogID from '../BaseModal/useDialogID';
21
- import useThemeProps from '../../ThemeProvider/useThemeProps';
22
21
  const Drawer = props => {
23
- const _a = useThemeProps('Drawer', props), { children, onRequestClose, showCloseButton, header, closeButtonLabel, anchor, toolbar, footer, overrides } = _a, otherProps = __rest(_a, ["children", "onRequestClose", "showCloseButton", "header", "closeButtonLabel", "anchor", "toolbar", "footer", "overrides"]);
22
+ const { children, onRequestClose, showCloseButton, header, closeButtonLabel, anchor, toolbar, footer, overrides } = props, otherProps = __rest(props, ["children", "onRequestClose", "showCloseButton", "header", "closeButtonLabel", "anchor", "toolbar", "footer", "overrides"]);
24
23
  const hasFooter = React.useMemo(() => typeof footer !== 'undefined' && footer !== null, [footer]);
25
24
  const hasHeader = React.useMemo(() => typeof header !== 'undefined' ||
26
25
  typeof toolbar !== 'undefined' ||
@@ -11,9 +11,13 @@ 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 Content = styled.div `
15
16
  flex: 1;
16
- padding: 1em 1em;
17
+ padding: ${({ theme }) => {
18
+ const { y, x } = themePadding(theme, 'container');
19
+ return `${y} ${x}`;
20
+ }};
17
21
  `;
18
22
  const MessageBoxContent = (props, ref) => {
19
23
  const { children, dialogID } = props, nativeProps = __rest(props, ["children", "dialogID"]);
@@ -12,11 +12,15 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import React from 'react';
13
13
  import styled from '@emotion/styled';
14
14
  import Button from '../../Button';
15
+ import { themePadding } from '../../ThemeProvider/tokens';
15
16
  const Footer = styled.div `
16
17
  display: flex;
17
18
  justify-content: flex-end;
18
19
  align-items: center;
19
- padding: 1em 1em 1em 1em;
20
+ padding: ${({ theme }) => {
21
+ const { y, x } = themePadding(theme, 'container');
22
+ return `${y} ${x}`;
23
+ }};
20
24
 
21
25
  & > button {
22
26
  border-radius: 0;
@@ -11,8 +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 Header = styled.div `
15
- padding: 1em 1em 0 1em;
16
+ padding: ${({ theme }) => {
17
+ const { y, x } = themePadding(theme, 'container');
18
+ return `${y} ${x} 0 ${x}`;
19
+ }};
16
20
  `;
17
21
  const HeaderTitle = styled.div `
18
22
  font-size: 1.4rem;