@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
@@ -15,6 +15,9 @@ const StyledSlide = styled.div `
15
15
  flex-grow: 0;
16
16
  flex-shrink: 0;
17
17
  flex-basis: calc(100% / ${({ $slidesPerView }) => $slidesPerView});
18
+ /* The size of the slide is set by slidesPerView, not by its content: the track positions rely on it */
19
+ min-width: 0;
20
+ min-height: 0;
18
21
  height: 100%;
19
22
  display: flex;
20
23
  align-items: center;
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  // React 19 supports the boolean `inert`, React 18 passes only the string value to the DOM
3
3
  const INERT_VALUE = parseInt(React.version, 10) >= 19 ? true : '';
4
4
  const SwiperSlidesRenderer = props => {
5
- const { slides, slidesPerView, realIndex, realSlidesCount, getSlideRealIndex, slideLabel, firstVisibleIndex = realIndex, visibleCount = slidesPerView, } = props;
5
+ const { slides, slidesPerView, realIndex, realSlidesCount, getSlideRealIndex, slideLabel, firstVisibleIndex = realIndex, visibleCount = Math.ceil(slidesPerView), activeDomIndex = null, } = props;
6
6
  const visibilityMap = React.useMemo(() => {
7
7
  const map = new Map();
8
8
  if (realSlidesCount <= visibleCount) {
@@ -45,6 +45,7 @@ const SwiperSlidesRenderer = props => {
45
45
  'aria-hidden': isClone || !isVisible ? true : undefined,
46
46
  inert: isVisible && !isClone ? undefined : INERT_VALUE,
47
47
  'data-index': i,
48
+ 'data-active': activeDomIndex === null ? undefined : activeDomIndex === i,
48
49
  'data-real-index': slideRealIndex,
49
50
  });
50
51
  })));
@@ -11,21 +11,44 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import * as React from 'react';
13
13
  import styled from '@emotion/styled';
14
+ import { css } from '@emotion/react';
14
15
  const StyledTrack = styled.div `
15
16
  display: flex;
17
+ flex-direction: ${({ $vertical }) => ($vertical ? 'column' : 'row')};
16
18
  height: 100%;
17
- transition: ${({ $dragging, $disableAnimation, $momentum }) => {
19
+ transition: ${({ $dragging, $disableAnimation, $momentum, $speed }) => {
18
20
  if ($dragging || $disableAnimation) {
19
21
  return 'none';
20
22
  }
21
- return $momentum ? 'transform 0.6s cubic-bezier(0.25, 1, 0.5, 1)' : 'transform 0.3s ease';
23
+ return $momentum
24
+ ? 'transform 0.6s cubic-bezier(0.25, 1, 0.5, 1)'
25
+ : `transform ${$speed}ms ease`;
22
26
  }};
23
27
  will-change: transform;
24
- transform: ${({ $index, $offset, $slidesPerView }) => `translateX(calc(${-(($index * 100) / $slidesPerView)}% + ${$offset}px))`};
28
+ transform: ${({ $index, $offset, $slidesPerView, $vertical }) => `${$vertical ? 'translateY' : 'translateX'}(calc(${-(($index * 100) / $slidesPerView)}% + ${$offset}px))`};
29
+
30
+ ${({ $fade, $speed }) => $fade &&
31
+ css `
32
+ /* The slides lie on top of each other, the current one is opaque */
33
+ display: grid;
34
+ transform: none;
35
+ will-change: auto;
36
+
37
+ & > * {
38
+ grid-area: 1 / 1;
39
+ opacity: 0;
40
+ transition: opacity ${$speed}ms ease;
41
+ }
42
+
43
+ & > [data-active='true'] {
44
+ opacity: 1;
45
+ z-index: 1;
46
+ }
47
+ `}
25
48
  `;
26
49
  export const SwiperTrack = React.forwardRef((props, ref) => {
27
- const { children, index, offset, dragging, disableAnimation, momentum, slidesPerView } = props, restProps = __rest(props, ["children", "index", "offset", "dragging", "disableAnimation", "momentum", "slidesPerView"]);
28
- return (React.createElement(StyledTrack, Object.assign({ "$dragging": dragging, "$index": index, "$offset": offset, "$disableAnimation": disableAnimation, "$momentum": momentum, "$slidesPerView": slidesPerView }, restProps, { ref: ref }), children));
50
+ const { children, index, offset, dragging, disableAnimation, momentum, slidesPerView, vertical = false, effect = 'slide', speed = 300 } = props, restProps = __rest(props, ["children", "index", "offset", "dragging", "disableAnimation", "momentum", "slidesPerView", "vertical", "effect", "speed"]);
51
+ return (React.createElement(StyledTrack, Object.assign({ "$dragging": dragging, "$index": index, "$offset": offset, "$disableAnimation": disableAnimation, "$momentum": momentum, "$slidesPerView": slidesPerView, "$vertical": vertical, "$fade": effect === 'fade', "$speed": speed }, restProps, { ref: ref }), children));
29
52
  });
30
53
  SwiperTrack.displayName = 'SwiperTrack';
31
54
  export default SwiperTrack;
@@ -19,9 +19,10 @@ export const StyledWrapper = styled.div `
19
19
  overflow: hidden;
20
20
  user-select: none;
21
21
 
22
- ${({ $draggable }) => $draggable &&
22
+ /* The page still scrolls across the swiper on the touch screens */
23
+ ${({ $draggable, $vertical }) => $draggable &&
23
24
  css `
24
- touch-action: pan-y;
25
+ touch-action: ${$vertical ? 'pan-x' : 'pan-y'};
25
26
  `};
26
27
 
27
28
  /* Inside: the container clips the outer outline */
@@ -34,8 +35,8 @@ export const StyledWrapper = styled.div `
34
35
  const SwiperWrapper = React.forwardRef((props, ref) => {
35
36
  // slidesPerView is for the overrides only, it is not a DOM attribute
36
37
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
37
- const { children, draggable, slidesPerView } = props, restProps = __rest(props, ["children", "draggable", "slidesPerView"]);
38
- return (React.createElement(StyledWrapper, Object.assign({}, restProps, { ref: ref, "$draggable": draggable }), children));
38
+ const { children, draggable, slidesPerView, vertical = false } = props, restProps = __rest(props, ["children", "draggable", "slidesPerView", "vertical"]);
39
+ return (React.createElement(StyledWrapper, Object.assign({}, restProps, { ref: ref, "$draggable": draggable, "$vertical": vertical }), children));
39
40
  });
40
41
  SwiperWrapper.displayName = 'SwiperWrapper';
41
42
  export default SwiperWrapper;
@@ -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 useSwitchColor from './useSwitchColor';
15
+ import { elevation } from '../ThemeProvider/tokens';
15
16
  const ToggleContainer = styled.span `
16
17
  display: inline-flex;
17
18
  align-items: center;
@@ -36,10 +37,7 @@ const Dot = styled.span `
36
37
  width: 1.4rem;
37
38
  height: 1.4rem;
38
39
  border-radius: 50%;
39
- box-shadow:
40
- rgba(0, 0, 0, 0.2) 0px 2px 1px -1px,
41
- rgba(0, 0, 0, 0.14) 0px 1px 1px 0px,
42
- rgba(0, 0, 0, 0.12) 0px 1px 3px 0px;
40
+ box-shadow: ${({ theme }) => elevation(theme, 'control')};
43
41
  background-color: ${({ $color, $checked, theme }) => {
44
42
  switch (true) {
45
43
  case $checked:
@@ -18,9 +18,8 @@ import Track from './SwitchTrack';
18
18
  import Wrapper from './SwitchWrapper';
19
19
  import ErrorText from './SwitchErrorText';
20
20
  import Asterisk from './SwitchAsterisk';
21
- import useThemeProps from '../ThemeProvider/useThemeProps';
22
21
  const Switch = (props, ref) => {
23
- const _a = useThemeProps('Switch', props), { checked, onChange, defaultChecked, overrides, disabled, labelPosition, children, color, name, error, errorText, requiredAsterisk } = _a, nativeProps = __rest(_a, ["checked", "onChange", "defaultChecked", "overrides", "disabled", "labelPosition", "children", "color", "name", "error", "errorText", "requiredAsterisk"]);
22
+ const { checked, onChange, defaultChecked, overrides, disabled, labelPosition, children, color, name, error, errorText, requiredAsterisk } = props, nativeProps = __rest(props, ["checked", "onChange", "defaultChecked", "overrides", "disabled", "labelPosition", "children", "color", "name", "error", "errorText", "requiredAsterisk"]);
24
23
  const [internalChecked, setInternalChecked] = React.useState(typeof defaultChecked !== 'undefined' ? defaultChecked : false);
25
24
  const overridesMap = React.useMemo(() => ({
26
25
  TextWrapper: (overrides === null || overrides === void 0 ? void 0 : overrides.TextWrapper) || TextWrapper,
@@ -26,7 +26,7 @@ const StyledTable = styled.table `
26
26
  overflow: hidden;
27
27
  background: ${({ theme }) => theme.color.surface.toString()};
28
28
  color: ${({ theme }) => theme.color.textPrimary.toString()};
29
- box-shadow: ${({ theme }) => elevation(theme, 'surface', `0 0.5em 2em -0.8em ${theme.color.surface.darken(100).alpha(0.4).toString()}`)};
29
+ box-shadow: ${({ theme }) => elevation(theme, 'surface')};
30
30
  border-radius: ${({ theme }) => theme.shape.radiusFactor}em;
31
31
  font-size: 1em;
32
32
  ${({ $fullWidth }) => $fullWidth &&
@@ -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 StyledTableCaption = styled.caption `
15
16
  text-align: start;
16
- padding: 0.8em;
17
+ padding: ${({ theme }) => {
18
+ const { y, x } = themePadding(theme, 'item', 1.2);
19
+ return `${y} ${x}`;
20
+ }};
17
21
  font-size: 1.2em;
18
22
  font-weight: 700;
19
23
  `;
@@ -11,10 +11,14 @@ 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, BORDER_WIDTH } from '../ThemeProvider/tokens';
14
15
  const StyledTableCell = styled.td `
15
16
  vertical-align: inherit;
16
- padding: 0.8em;
17
- border-bottom: 0.1em solid ${({ theme }) => theme.color.surface.darken(20).toString()};
17
+ padding: ${({ theme }) => {
18
+ const { y, x } = themePadding(theme, 'item');
19
+ return `${y} ${x}`;
20
+ }};
21
+ border-bottom: ${BORDER_WIDTH} solid ${({ theme }) => theme.color.surface.darken(20).toString()};
18
22
  `;
19
23
  const TableCell = (props, ref) => {
20
24
  const { children } = props, nativeProps = __rest(props, ["children"]);
@@ -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 { BORDER_WIDTH } from '../ThemeProvider/tokens';
14
15
  const StyledTableFooter = styled.tfoot `
15
16
  vertical-align: middle;
16
17
 
@@ -22,7 +23,7 @@ const StyledTableFooter = styled.tfoot `
22
23
 
23
24
  & > tr:first-of-type > th,
24
25
  & > tr:first-of-type > td {
25
- border-top: 0.1em solid ${({ theme }) => theme.color.surface.darken(30).toString()};
26
+ border-top: ${BORDER_WIDTH} solid ${({ theme }) => theme.color.surface.darken(30).toString()};
26
27
  }
27
28
  `;
28
29
  const TableFooter = (props, ref) => {
@@ -11,16 +11,20 @@ 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, BORDER_WIDTH } from '../ThemeProvider/tokens';
14
15
  /**
15
16
  * The column header inside `<TableHeader>` or the row header (`scope="row"`) inside `<TableBody>`.
16
17
  * The role (columnheader/rowheader) is implied by the position, so no explicit role
17
18
  */
18
19
  const StyledTableHeaderCell = styled.th `
19
20
  vertical-align: inherit;
20
- padding: 0.8em;
21
+ padding: ${({ theme }) => {
22
+ const { y, x } = themePadding(theme, 'item');
23
+ return `${y} ${x}`;
24
+ }};
21
25
  text-align: start;
22
26
  font-weight: 600;
23
- border-bottom: 0.1em solid ${({ theme }) => theme.color.surface.darken(20).toString()};
27
+ border-bottom: ${BORDER_WIDTH} solid ${({ theme }) => theme.color.surface.darken(20).toString()};
24
28
  `;
25
29
  const TableHeaderCell = (props, ref) => {
26
30
  const { children } = props, nativeProps = __rest(props, ["children"]);
package/esm/Tabs/Tab.js CHANGED
@@ -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 { useTabsContext } from './context';
16
- import { themeFocusRing } from '../ThemeProvider/tokens';
16
+ import { themeFocusRing, themePadding } from '../ThemeProvider/tokens';
17
17
  const StyledTab = styled.button `
18
18
  position: relative;
19
19
  display: inline-flex;
@@ -23,7 +23,10 @@ const StyledTab = styled.button `
23
23
  flex-shrink: 0;
24
24
  box-sizing: border-box;
25
25
  margin: 0;
26
- padding: 0.75em 1.1em;
26
+ padding: ${({ theme }) => {
27
+ const { y, x } = themePadding(theme, 'item');
28
+ return `${y} ${x}`;
29
+ }};
27
30
  border: 0;
28
31
  background: none;
29
32
  font: inherit;
package/esm/Tabs/Tabs.js CHANGED
@@ -13,7 +13,6 @@ import React from 'react';
13
13
  import styled from '@emotion/styled';
14
14
  import { TabsContext } from './context';
15
15
  import useTabsColor from './useTabsColor';
16
- import useThemeProps from '../ThemeProvider/useThemeProps';
17
16
  const StyledTabs = styled.div `
18
17
  display: ${({ $orientation }) => ($orientation === 'vertical' ? 'flex' : 'block')};
19
18
  align-items: flex-start;
@@ -23,7 +22,7 @@ const StyledTabs = styled.div `
23
22
  */
24
23
  const escapeId = (value) => value.replace(/[^\w-]/g, char => `_${char.charCodeAt(0).toString(16)}`);
25
24
  const Tabs = (props, ref) => {
26
- const _a = useThemeProps('Tabs', props), { value, defaultValue, onChange, orientation = 'horizontal', activation = 'auto', fullWidth = false, color, children } = _a, nativeProps = __rest(_a, ["value", "defaultValue", "onChange", "orientation", "activation", "fullWidth", "color", "children"]);
25
+ const { value, defaultValue, onChange, orientation = 'horizontal', activation = 'auto', fullWidth = false, color, children } = props, nativeProps = __rest(props, ["value", "defaultValue", "onChange", "orientation", "activation", "fullWidth", "color", "children"]);
27
26
  const isControlled = typeof value !== 'undefined';
28
27
  const [internalValue, setInternalValue] = React.useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : null);
29
28
  const currentValue = isControlled ? value : internalValue;
@@ -12,10 +12,15 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import * as React from 'react';
13
13
  import styled from '@emotion/styled';
14
14
  import { css } from '@emotion/react';
15
+ import { fieldPadding, FIELD_TEXT_SCALE } from '../ThemeProvider/tokens';
15
16
  const TextareaNative = styled.textarea `
16
17
  resize: none;
17
- padding: 1em 1.2em;
18
+ padding: ${({ theme }) => {
19
+ const { y, x } = fieldPadding(theme, FIELD_TEXT_SCALE);
20
+ return `${y} ${x}`;
21
+ }};
18
22
  font-size: 1em;
23
+ line-height: inherit;
19
24
  /* Form controls do not inherit the font by default (textarea is monospace) */
20
25
  font-family: inherit;
21
26
  background: none;
@@ -17,9 +17,8 @@ import InputWrapper from '../TextField/TextFieldInputWrapper';
17
17
  import Input from '../TextArea/TextAreaInput';
18
18
  import ErrorText from '../TextField/TextFieldErrorText';
19
19
  import IconWrapper from './TextAreaIconWrapper';
20
- import useThemeProps from '../ThemeProvider/useThemeProps';
21
20
  const TextArea = (props, ref) => {
22
- const _a = useThemeProps('TextArea', props), { error, fullWidth, inputRef, label, id, errorText, className, style, endIcon, startIcon, requiredAsterisk, overrides, onChange, onFocus, onBlur } = _a, nativeInputProps = __rest(_a, ["error", "fullWidth", "inputRef", "label", "id", "errorText", "className", "style", "endIcon", "startIcon", "requiredAsterisk", "overrides", "onChange", "onFocus", "onBlur"]);
21
+ const { error, fullWidth, inputRef, label, id, errorText, className, style, endIcon, startIcon, requiredAsterisk, overrides, onChange, onFocus, onBlur } = props, nativeInputProps = __rest(props, ["error", "fullWidth", "inputRef", "label", "id", "errorText", "className", "style", "endIcon", "startIcon", "requiredAsterisk", "overrides", "onChange", "onFocus", "onBlur"]);
23
22
  const [focused, setFocused] = React.useState(false);
24
23
  // useId is stable between server and client renders
25
24
  const generatedID = React.useId();
@@ -12,9 +12,14 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import * as React from 'react';
13
13
  import styled from '@emotion/styled';
14
14
  import { css } from '@emotion/react';
15
+ import { fieldPadding, FIELD_TEXT_SCALE } from '../ThemeProvider/tokens';
15
16
  const Input = styled.input `
16
- padding: 1em 1.2em;
17
+ padding: ${({ theme }) => {
18
+ const { y, x } = fieldPadding(theme, FIELD_TEXT_SCALE);
19
+ return `${y} ${x}`;
20
+ }};
17
21
  font-size: 1em;
22
+ line-height: inherit;
18
23
  /* Form controls do not inherit the font by default (textarea is monospace) */
19
24
  font-family: inherit;
20
25
  background: none;
@@ -12,17 +12,20 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import * as React from 'react';
13
13
  import styled from '@emotion/styled';
14
14
  import { css } from '@emotion/react';
15
+ import { CONTROL_LINE_HEIGHT, FIELD_TEXT_SCALE, fieldBorder } from '../ThemeProvider/tokens';
15
16
  const Wrapper = styled.div `
16
17
  display: flex;
17
18
  align-items: stretch;
18
19
  border-radius: ${({ theme }) => theme.shape.radiusFactor * 2}em;
19
- border: 1px solid;
20
+ border: ${fieldBorder(FIELD_TEXT_SCALE)} solid;
20
21
  outline: 1px solid transparent;
21
22
  border-color: ${({ theme }) => theme.isDark
22
23
  ? theme.color.textPrimary.darken(100).toString()
23
24
  : theme.color.textPrimary.lighten(150).toString()};
24
25
  width: ${({ $fullWidth }) => ($fullWidth ? '100%' : 'auto')};
25
- font-size: 0.9em;
26
+ font-size: ${FIELD_TEXT_SCALE}em;
27
+ /* The line of the control: the field has the height of the button */
28
+ line-height: calc(${CONTROL_LINE_HEIGHT} / ${FIELD_TEXT_SCALE});
26
29
  background-color: ${({ theme }) => theme.color.surface.toString()};
27
30
  color: ${({ theme }) => theme.color.textPrimary.toString()};
28
31
  transition: all 180ms ease-out 0s;
@@ -17,7 +17,6 @@ import InputWrapper from './TextFieldInputWrapper';
17
17
  import Input from './TextFieldInput';
18
18
  import ErrorText from './TextFieldErrorText';
19
19
  import IconWrapper from './TextFieldIconWrapper';
20
- import useThemeProps from '../ThemeProvider/useThemeProps';
21
20
  export * from './TextFieldContainer';
22
21
  export * from './TextFieldLabel';
23
22
  export * from './TextFieldLabelAsterisk';
@@ -35,7 +34,7 @@ const defailtOverrides = {
35
34
  InputWrapper,
36
35
  };
37
36
  const TextField = React.forwardRef((props, ref) => {
38
- const _a = useThemeProps('TextField', props), { error, fullWidth, inputRef, label, id, errorText, className, style, endIcon, startIcon, requiredAsterisk, overrides, onChange, onFocus, onBlur } = _a, nativeInputProps = __rest(_a, ["error", "fullWidth", "inputRef", "label", "id", "errorText", "className", "style", "endIcon", "startIcon", "requiredAsterisk", "overrides", "onChange", "onFocus", "onBlur"]);
37
+ const { error, fullWidth, inputRef, label, id, errorText, className, style, endIcon, startIcon, requiredAsterisk, overrides, onChange, onFocus, onBlur } = props, nativeInputProps = __rest(props, ["error", "fullWidth", "inputRef", "label", "id", "errorText", "className", "style", "endIcon", "startIcon", "requiredAsterisk", "overrides", "onChange", "onFocus", "onBlur"]);
39
38
  const [focused, setFocused] = React.useState(false);
40
39
  // useId is stable between server and client renders
41
40
  const generatedID = React.useId();
@@ -11,10 +11,14 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import Color from '../Color';
13
13
  export const createTheme = overrides => {
14
- const _a = overrides || {}, { isDark, fontSize, zIndex, color, shape, spacing, components, typography, focusRing, elevation } = _a, rest = __rest(_a, ["isDark", "fontSize", "zIndex", "color", "shape", "spacing", "components", "typography", "focusRing", "elevation"]);
15
- const theme = Object.assign(Object.assign({}, rest), { isDark: typeof isDark === 'boolean' ? isDark : false, components: components || {},
14
+ const _a = overrides || {}, { isDark, fontSize, zIndex, color, shape, spacing, padding, typography, focusRing, elevation } = _a, rest = __rest(_a, ["isDark", "fontSize", "zIndex", "color", "shape", "spacing", "padding", "typography", "focusRing", "elevation"]);
15
+ const theme = Object.assign(Object.assign({}, rest), { isDark: typeof isDark === 'boolean' ? isDark : false,
16
16
  // Empty by default: the components keep their own fonts, focus and shadows
17
- typography: Object.assign({}, typography), focusRing: Object.assign({}, focusRing), elevation: Object.assign({}, elevation), fontSize: Object.assign({ small: 14, normal: 16, medium: 18, large: 20 }, fontSize), zIndex: Object.assign({ header: 8, modal: 10 }, zIndex), color: {}, shape: Object.assign({ radiusFactor: 0.3 }, shape), spacing: Object.assign({ xs: '0.25em', sm: '0.5em', md: '1em', lg: '1.5em', xl: '2em' }, spacing) });
17
+ typography: Object.assign({}, typography), focusRing: Object.assign({}, focusRing), elevation: Object.assign({}, elevation), fontSize: Object.assign({ small: 14, normal: 16, medium: 18, large: 20 }, fontSize), zIndex: Object.assign({ header: 8, modal: 10 }, zIndex), color: {}, shape: Object.assign({ radiusFactor: 0.3 }, shape), spacing: Object.assign({ xs: '0.25em', sm: '0.5em', md: '1em', lg: '1.5em', xl: '2em' }, spacing), padding: {
18
+ control: Object.assign({ y: '0.75em', x: '1em' }, padding === null || padding === void 0 ? void 0 : padding.control),
19
+ item: Object.assign({ y: '0.6em', x: '0.8em' }, padding === null || padding === void 0 ? void 0 : padding.item),
20
+ container: Object.assign({ y: '1em', x: '1em' }, padding === null || padding === void 0 ? void 0 : padding.container),
21
+ } });
18
22
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
19
23
  /* @ts-ignore */
20
24
  const defaultColors = {
@@ -2,8 +2,6 @@ import React from 'react';
2
2
  import { ThemeProvider as EmotionProvider, useTheme } from '@emotion/react';
3
3
  export { useTheme };
4
4
  export * from './createTheme';
5
- export * from './components';
6
- export { default as useThemeProps } from './useThemeProps';
7
5
  export * from './tokens';
8
6
  const ThemeProvider = props => {
9
7
  const { children, theme } = props;
@@ -21,6 +21,59 @@ export const themeFocusRing = (theme, selector = '&:focus-visible') => {
21
21
  `;
22
22
  };
23
23
  /**
24
- * The shadow of the level: the `elevation` of the theme, or the own shadow of the component
24
+ * The default shadows of the levels: the components of one level have the same shadow.
25
+ * In `px`, not in `em`: the tooltip and the toast have a smaller font, but the same shadow as the menu
25
26
  */
26
- export const elevation = (theme, level, own) => { var _a; return (_a = theme.elevation[level]) !== null && _a !== void 0 ? _a : own; };
27
+ export const defaultElevation = (theme) => ({
28
+ popup: `0 8px 24px ${theme.color.surface.darken(50).alpha(0.6).toString()}`,
29
+ surface: `0 8px 32px -13px ${theme.color.surface.darken(100).alpha(0.4).toString()}`,
30
+ control: `0 1px 3px ${theme.color.surface.darken(100).alpha(0.35).toString()}`,
31
+ });
32
+ /**
33
+ * The shadow of the level: the `elevation` of the theme or the default shadow of the level.
34
+ * `own` replaces the default shadow, the shadow of the theme wins over both
35
+ */
36
+ export 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 : defaultElevation(theme)[level]; };
37
+ /**
38
+ * The height of the text line in the controls, in the `em` of the control. Set as a length,
39
+ * the line height is inherited as is by the text of any size: the label of the button and the value of the field
40
+ */
41
+ export const CONTROL_LINE_HEIGHT = '1.2em';
42
+ /**
43
+ * The width of the borders of the components: `1px` at the font size of `16px`.
44
+ * In `em`: the border grows together with the font, and at the usual sizes the browser draws `1px`
45
+ */
46
+ export const BORDER_WIDTH = '0.0625em';
47
+ /**
48
+ * The border of the buttons. The standard and the plain buttons have no border:
49
+ * their padding is larger by this width, so all the variants have the same size
50
+ */
51
+ export const CONTROL_BORDER = BORDER_WIDTH;
52
+ /**
53
+ * The size of the text in the fields (TextField, TextArea, Selectbox) relative to the control
54
+ */
55
+ export const FIELD_TEXT_SCALE = 0.9;
56
+ /**
57
+ * The height of the one-line control: the icon buttons are squares of this size
58
+ */
59
+ export const controlHeight = (theme) => `calc(${CONTROL_LINE_HEIGHT} + 2 * ${theme.padding.control.y} + 2 * ${CONTROL_BORDER})`;
60
+ /**
61
+ * The border of the field: the border of the buttons in the `em` of the field with the font size `fontScale`
62
+ */
63
+ export const fieldBorder = (fontScale = 1) => `calc(${CONTROL_BORDER} / ${fontScale})`;
64
+ /**
65
+ * The padding of the field with the `fieldBorder`, so the field has the height of the button.
66
+ * `fontScale` is the font size of the element relative to the control: the `em` of the padding are its own
67
+ */
68
+ export const fieldPadding = (theme, fontScale = 1) => themePadding(theme, 'control', fontScale);
69
+ /**
70
+ * The padding of the class for the element with its own font size.
71
+ * `fontScale` is the font size of the element relative to the parent: the padding is in the `em` of the parent,
72
+ * so the header with a larger font has the same padding as the content under it
73
+ */
74
+ export const themePadding = (theme, kind, fontScale = 1) => {
75
+ const { y, x } = theme.padding[kind];
76
+ return fontScale === 1
77
+ ? { y, x }
78
+ : { y: `calc(${y} / ${fontScale})`, x: `calc(${x} / ${fontScale})` };
79
+ };
@@ -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 { css, keyframes } from '@emotion/react';
15
- import { themeFocusRing, elevation } from '../ThemeProvider/tokens';
15
+ import { themeFocusRing, elevation, themePadding } from '../ThemeProvider/tokens';
16
16
  export const TOAST_ANIMATION_MS = 200;
17
17
  /**
18
18
  * The toasts slide from the edge of the screen they are attached to
@@ -35,12 +35,15 @@ const StyledCard = styled.div `
35
35
  width: max-content;
36
36
  max-width: 100%;
37
37
  min-width: 14em;
38
- padding: 0.75em 1em;
38
+ padding: ${({ theme }) => {
39
+ const { y, x } = themePadding(theme, 'container');
40
+ return `calc(${y} * 0.75) ${x}`;
41
+ }};
39
42
  border-radius: ${({ theme }) => theme.shape.radiusFactor * 1.5}em;
40
43
  border: 1px solid ${({ theme }) => theme.color.textPrimary.alpha(0.08).toString()};
41
44
  background-color: ${({ theme }) => theme.color.surface.toString()};
42
45
  color: ${({ theme }) => theme.color.textPrimary.toString()};
43
- box-shadow: ${({ theme }) => elevation(theme, 'popup', `0 0.5em 1.5em rgba(0, 0, 0, ${theme.isDark ? 0.5 : 0.14})`)};
46
+ box-shadow: ${({ theme }) => elevation(theme, 'popup')};
44
47
  font-size: 0.875em;
45
48
  line-height: 1.4;
46
49
  pointer-events: auto;
@@ -8,7 +8,6 @@ import CloseButton from './ToastCloseButton';
8
8
  import Action from './ToastAction';
9
9
  import ToastItem from './ToastItem';
10
10
  import { toastStore } from './store';
11
- import useThemeProps from '../ThemeProvider/useThemeProps';
12
11
  const POSITIONS = [
13
12
  'top-left',
14
13
  'top-center',
@@ -85,7 +84,7 @@ const useWindowFocused = () => {
85
84
  return isFocused;
86
85
  };
87
86
  const ToastContainer = props => {
88
- 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, } = useThemeProps('Toast', props);
87
+ 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;
89
88
  const theme = useTheme();
90
89
  const allToasts = React.useSyncExternalStore(toastStore.subscribe, toastStore.getSnapshot, toastStore.getServerSnapshot);
91
90
  const toasts = React.useMemo(() => allToasts.filter(item => item.containerId === containerId), [allToasts, containerId]);
@@ -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 { keyframes } from '@emotion/react';
15
+ import { elevation } from '../ThemeProvider/tokens';
15
16
  const appear = keyframes `
16
17
  from {
17
18
  opacity: 0;
@@ -33,6 +34,7 @@ const StyledContainer = styled.div `
33
34
  overflow-wrap: break-word;
34
35
  /* Inverted colors: dark on the light theme, light on the dark one */
35
36
  background-color: ${({ theme }) => theme.color.textPrimary.toString()};
37
+ box-shadow: ${({ theme }) => elevation(theme, 'popup')};
36
38
  color: ${({ theme }) => theme.color.surface.toString()};
37
39
  animation: ${appear} 120ms ease-out;
38
40
 
@@ -3,7 +3,7 @@ import { useTheme } from '@emotion/react';
3
3
  import Popper from '../Popper';
4
4
  import Container from './TooltipContainer';
5
5
  import Arrow from './TooltipArrow';
6
- import useThemeProps from '../ThemeProvider/useThemeProps';
6
+ import getElementRef from '../utils/getElementRef';
7
7
  /**
8
8
  * Pointer types that have the hover. A tap on the touch screen fires `pointerenter` too,
9
9
  * the tooltip would flash on every tap
@@ -40,7 +40,7 @@ const setRef = (ref, value) => {
40
40
  const isEmptyTitle = (title) => title === null || typeof title === 'undefined' || title === false || title === '';
41
41
  const Tooltip = props => {
42
42
  var _a;
43
- const { title, children, placement = 'top', arrow = false, enterDelay = 400, leaveDelay = 100, isOpen, onOpenChange, describeChild = false, offset = 8, zIndex, id, overrides, } = useThemeProps('Tooltip', props);
43
+ const { title, children, placement = 'top', arrow = false, enterDelay = 400, leaveDelay = 100, isOpen, onOpenChange, describeChild = false, offset = 8, zIndex, id, overrides, } = props;
44
44
  const theme = useTheme();
45
45
  const generatedId = `tooltip-${React.useId().replace(/:/g, '')}`;
46
46
  const tooltipId = id || generatedId;
@@ -132,8 +132,7 @@ const Tooltip = props => {
132
132
  }
133
133
  const child = children;
134
134
  const childProps = child.props;
135
- // React 18 keeps the ref of the element outside of props
136
- childRefRef.current = child.ref;
135
+ childRefRef.current = getElementRef(child);
137
136
  if (isEmpty) {
138
137
  return child;
139
138
  }
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ /**
3
+ * Returns the ref of the element.
4
+ * React 19 keeps the ref in props and warns when `element.ref` is read,
5
+ * React 18 keeps it outside of props
6
+ */
7
+ const getElementRef = (element) => {
8
+ if (parseInt(React.version, 10) >= 19) {
9
+ return element.props.ref;
10
+ }
11
+ return element.ref;
12
+ };
13
+ export default getElementRef;