@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
@@ -17,9 +17,8 @@ import Footer from './MessageBoxFooter';
17
17
  import Header from './MessageBoxHeader';
18
18
  import Overlay from '../BaseModal/ModalOverlay';
19
19
  import useDialogID from '../BaseModal/useDialogID';
20
- import useThemeProps from '../../ThemeProvider/useThemeProps';
21
20
  const MessageBox = props => {
22
- const _a = useThemeProps('MessageBox', props), { header, children, onRequestClose, overrides, okButtonLabel, isOpen } = _a, otherProps = __rest(_a, ["header", "children", "onRequestClose", "overrides", "okButtonLabel", "isOpen"]);
21
+ const { header, children, onRequestClose, overrides, okButtonLabel, isOpen } = props, otherProps = __rest(props, ["header", "children", "onRequestClose", "overrides", "okButtonLabel", "isOpen"]);
23
22
  const dialogID = useDialogID('dialog-message');
24
23
  const buttonRef = React.useRef(null);
25
24
  React.useEffect(() => {
@@ -0,0 +1,29 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import React from 'react';
13
+ import styled from '@emotion/styled';
14
+ /**
15
+ * The sizes of the buttons are in `em`, so the small variant only changes the font size.
16
+ * The height of the buttons is the height of the controls: `theme.padding.control`
17
+ */
18
+ const StyledNav = styled.nav `
19
+ display: inline-flex;
20
+ align-items: center;
21
+ flex-wrap: wrap;
22
+ gap: 0.5em;
23
+ font-size: ${({ $size }) => ($size === 'small' ? '0.8em' : '1em')};
24
+ `;
25
+ const PaginationContainer = (props, ref) => {
26
+ const { size = 'medium', children } = props, nativeProps = __rest(props, ["size", "children"]);
27
+ return (React.createElement(StyledNav, Object.assign({ "$size": size }, nativeProps, { ref: ref }), children));
28
+ };
29
+ export default React.forwardRef(PaginationContainer);
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import styled from '@emotion/styled';
3
+ import { controlHeight } from '../ThemeProvider/tokens';
4
+ const StyledGap = styled.span `
5
+ display: inline-flex;
6
+ align-items: center;
7
+ justify-content: center;
8
+ min-width: 1.6em;
9
+ height: ${({ theme }) => controlHeight(theme)};
10
+ color: ${({ theme }) => theme.color.textSecondary.toString()};
11
+ user-select: none;
12
+ `;
13
+ /**
14
+ * The skipped range of the pages
15
+ */
16
+ const PaginationGap = (props, ref) => (React.createElement(StyledGap, Object.assign({ "aria-hidden": true }, props, { ref: ref }), "\u2026"));
17
+ export default React.forwardRef(PaginationGap);
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import styled from '@emotion/styled';
3
+ const Path = styled.path `
4
+ fill: currentColor;
5
+ `;
6
+ const createIcon = (path, displayName) => {
7
+ const Icon = (props, ref) => (React.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", "aria-hidden": true }, props, { ref: ref }),
8
+ React.createElement(Path, { d: path })));
9
+ Icon.displayName = displayName;
10
+ return React.forwardRef(Icon);
11
+ };
12
+ export const IconPrevious = createIcon('M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z', 'IconPrevious');
13
+ export const IconNext = createIcon('M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z', 'IconNext');
14
+ export const IconFirst = createIcon('M18.41,16.59L13.82,12L18.41,7.41L17,6L11,12L17,18L18.41,16.59M12.41,16.59L7.82,12L12.41,7.41L11,6L5,12L11,18L12.41,16.59Z', 'IconFirst');
15
+ export const IconLast = createIcon('M5.59,7.41L10.18,12L5.59,16.59L7,18L13,12L7,6L5.59,7.41M11.59,7.41L16.18,12L11.59,16.59L13,18L19,12L13,6L11.59,7.41Z', 'IconLast');
@@ -0,0 +1,54 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import React from 'react';
13
+ import styled from '@emotion/styled';
14
+ import { css } from '@emotion/react';
15
+ import Button from '../Button';
16
+ import { controlHeight } from '../ThemeProvider/tokens';
17
+ /**
18
+ * `&&` raises the specificity above the own styles of the button.
19
+ * The button is a square of the height of the controls, the numbers of several digits make it wider
20
+ */
21
+ const StyledButton = styled(Button) `
22
+ && {
23
+ box-sizing: border-box;
24
+ min-width: ${({ theme }) => controlHeight(theme)};
25
+ height: ${({ theme }) => controlHeight(theme)};
26
+ padding: 0 0.6em;
27
+ justify-content: center;
28
+ font-variant-numeric: tabular-nums;
29
+ }
30
+
31
+ ${({ $soft, disabled, theme }) => $soft &&
32
+ css `
33
+ && {
34
+ background-color: ${theme.color.textPrimary.alpha(0.06).toString()};
35
+ color: ${disabled
36
+ ? theme.color.textPrimary.alpha(0.3).toString()
37
+ : theme.color.textPrimary.toString()};
38
+ }
39
+
40
+ &&:hover {
41
+ background-color: ${disabled
42
+ ? theme.color.textPrimary.alpha(0.06).toString()
43
+ : theme.color.textPrimary.alpha(0.1).toString()};
44
+ }
45
+ `}
46
+ `;
47
+ /**
48
+ * The button of the page or of the navigation (first, previous, next, last)
49
+ */
50
+ const PaginationItem = (props, ref) => {
51
+ const { selected, soft, kind, page } = props, buttonProps = __rest(props, ["selected", "soft", "kind", "page"]);
52
+ return (React.createElement(StyledButton, Object.assign({ type: "button", "aria-current": selected ? 'page' : undefined, "data-kind": kind, "$soft": Boolean(soft) }, buttonProps, { ref: ref })));
53
+ };
54
+ export default React.forwardRef(PaginationItem);
@@ -0,0 +1,40 @@
1
+ const range = (start, end) => Array.from({ length: Math.max(end - start + 1, 0) }, (_, index) => start + index);
2
+ /**
3
+ * Returns the items of the pagination: the boundary pages, the current page with the siblings
4
+ * and the gaps instead of the skipped ranges. The pages start from 1.
5
+ * The count of the items does not depend on the current page, so the buttons do not jump
6
+ *
7
+ * @example getPaginationItems({ count: 10, page: 5, siblings: 1, boundaries: 1 })
8
+ * // 1 … 4 5 6 … 10
9
+ */
10
+ const getPaginationItems = (params) => {
11
+ const { count, siblings, boundaries } = params;
12
+ const page = Math.min(Math.max(params.page, 1), Math.max(count, 1));
13
+ // boundaries on both sides + current + siblings + two gaps
14
+ if (count <= boundaries * 2 + siblings * 2 + 3) {
15
+ return range(1, count).map(item => ({ type: 'page', page: item }));
16
+ }
17
+ const startPages = range(1, boundaries);
18
+ const endPages = range(count - boundaries + 1, count);
19
+ // the window of the siblings keeps its size near the start and the end
20
+ const siblingsStart = Math.max(Math.min(page - siblings, count - boundaries - siblings * 2 - 1), boundaries + 2);
21
+ const siblingsEnd = Math.min(Math.max(page + siblings, boundaries + siblings * 2 + 2), count - boundaries - 1);
22
+ const items = startPages.map(item => ({ type: 'page', page: item }));
23
+ // a gap of one page is shown as the page itself
24
+ if (siblingsStart > boundaries + 2) {
25
+ items.push({ type: 'gap-start' });
26
+ }
27
+ else if (boundaries + 1 < count - boundaries) {
28
+ items.push({ type: 'page', page: boundaries + 1 });
29
+ }
30
+ range(siblingsStart, siblingsEnd).forEach(item => items.push({ type: 'page', page: item }));
31
+ if (siblingsEnd < count - boundaries - 1) {
32
+ items.push({ type: 'gap-end' });
33
+ }
34
+ else if (count - boundaries > boundaries) {
35
+ items.push({ type: 'page', page: count - boundaries });
36
+ }
37
+ endPages.forEach(item => items.push({ type: 'page', page: item }));
38
+ return items;
39
+ };
40
+ export default getPaginationItems;
@@ -0,0 +1,77 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import React from 'react';
13
+ import PaginationContainer from './PaginationContainer';
14
+ import PaginationItem from './PaginationItem';
15
+ import PaginationGap from './PaginationGap';
16
+ import { IconFirst, IconLast, IconNext, IconPrevious } from './PaginationIcons';
17
+ import usePagination from './usePagination';
18
+ import getPaginationItems from './getPaginationItems';
19
+ export * from './usePagination';
20
+ export * from './PaginationContainer';
21
+ export * from './PaginationItem';
22
+ export * from './PaginationGap';
23
+ export * from './PaginationIcons';
24
+ export * from './getPaginationItems';
25
+ export { usePagination, getPaginationItems };
26
+ const defaultGetItemLabel = (kind, page, selected) => {
27
+ switch (kind) {
28
+ case 'first':
29
+ return 'Go to first page';
30
+ case 'previous':
31
+ return 'Go to previous page';
32
+ case 'next':
33
+ return 'Go to next page';
34
+ case 'last':
35
+ return 'Go to last page';
36
+ default:
37
+ return selected ? `Page ${page}` : `Go to page ${page}`;
38
+ }
39
+ };
40
+ const navigationIcons = {
41
+ first: React.createElement(IconFirst, null),
42
+ previous: React.createElement(IconPrevious, null),
43
+ next: React.createElement(IconNext, null),
44
+ last: React.createElement(IconLast, null),
45
+ };
46
+ const Pagination = (props, ref) => {
47
+ const { count, page, defaultPage, onChange, siblings, boundaries, showPrevNext, showFirstLast, disabled, variant = 'standard', color = 'primary', navigationVariant = 'outlined', navigationColor, size = 'medium', getItemLabel = defaultGetItemLabel, overrides, 'aria-label': ariaLabel = 'Pagination' } = props, nativeProps = __rest(props, ["count", "page", "defaultPage", "onChange", "siblings", "boundaries", "showPrevNext", "showFirstLast", "disabled", "variant", "color", "navigationVariant", "navigationColor", "size", "getItemLabel", "overrides", 'aria-label']);
48
+ const { items } = usePagination({
49
+ count,
50
+ page,
51
+ defaultPage,
52
+ onChange,
53
+ siblings,
54
+ boundaries,
55
+ showPrevNext,
56
+ showFirstLast,
57
+ disabled,
58
+ });
59
+ const overridesMap = React.useMemo(() => ({
60
+ Container: (overrides === null || overrides === void 0 ? void 0 : overrides.Container) || PaginationContainer,
61
+ Item: (overrides === null || overrides === void 0 ? void 0 : overrides.Item) || PaginationItem,
62
+ Gap: (overrides === null || overrides === void 0 ? void 0 : overrides.Gap) || PaginationGap,
63
+ }), [overrides]);
64
+ const navColor = navigationColor !== null && navigationColor !== void 0 ? navigationColor : (navigationVariant === 'standard' ? color : 'default');
65
+ return (React.createElement(overridesMap.Container, Object.assign({ size: size, "aria-label": ariaLabel }, nativeProps, { ref: ref }), items.map(item => {
66
+ if (item.type === 'gap') {
67
+ return React.createElement(overridesMap.Gap, { key: `gap-${item.position}` });
68
+ }
69
+ const label = getItemLabel(item.type, item.page, item.selected);
70
+ if (item.type !== 'page') {
71
+ // The disabled navigation button gets the soft fill, as the not selected page
72
+ return (React.createElement(overridesMap.Item, { key: item.type, kind: item.type, page: item.page, variant: item.disabled ? 'standard' : navigationVariant, color: item.disabled ? 'default' : navColor, soft: item.disabled, disabled: item.disabled, "aria-label": label, onClick: item.onClick }, navigationIcons[item.type]));
73
+ }
74
+ return (React.createElement(overridesMap.Item, { key: item.page, kind: "page", page: item.page, selected: item.selected, variant: item.selected ? 'standard' : variant, color: item.selected ? color : 'default', soft: !item.selected && variant === 'standard', disabled: item.disabled, "aria-label": label, onClick: item.onClick }, item.page));
75
+ })));
76
+ };
77
+ export default React.forwardRef(Pagination);
@@ -0,0 +1,61 @@
1
+ import React from 'react';
2
+ import getPaginationItems from './getPaginationItems';
3
+ /**
4
+ * The logic of the pagination without the markup: the current page, the buttons and the gaps.
5
+ * `<Pagination>` is built on it, use it for the pagination of your own design
6
+ */
7
+ const usePagination = (params) => {
8
+ const { count, page: controlledPage, defaultPage = 1, onChange, siblings = 1, boundaries = 1, showPrevNext = true, showFirstLast = false, disabled = false, } = params;
9
+ const [uncontrolledPage, setUncontrolledPage] = React.useState(defaultPage);
10
+ const isControlled = typeof controlledPage !== 'undefined';
11
+ const pagesCount = Math.max(Math.floor(count) || 0, 1);
12
+ const currentPage = Math.min(Math.max(isControlled ? controlledPage : uncontrolledPage, 1), pagesCount);
13
+ const setPage = React.useCallback((target, event) => {
14
+ if (disabled || target === currentPage || target < 1 || target > pagesCount) {
15
+ return;
16
+ }
17
+ if (!isControlled) {
18
+ setUncontrolledPage(target);
19
+ }
20
+ onChange === null || onChange === void 0 ? void 0 : onChange(target, event);
21
+ }, [disabled, currentPage, pagesCount, isControlled, onChange]);
22
+ const items = React.useMemo(() => {
23
+ const button = (type, target) => {
24
+ const selected = type === 'page' && target === currentPage;
25
+ return {
26
+ type,
27
+ page: target,
28
+ selected,
29
+ disabled: disabled ||
30
+ (type !== 'page' && (target < 1 || target > pagesCount || target === currentPage)),
31
+ onClick: event => setPage(target, event),
32
+ };
33
+ };
34
+ const pages = getPaginationItems({
35
+ count: pagesCount,
36
+ page: currentPage,
37
+ siblings,
38
+ boundaries,
39
+ }).map(item => item.type === 'page'
40
+ ? button('page', item.page)
41
+ : { type: 'gap', position: item.type === 'gap-start' ? 'start' : 'end' });
42
+ return [
43
+ ...(showFirstLast ? [button('first', 1)] : []),
44
+ ...(showPrevNext ? [button('previous', currentPage - 1)] : []),
45
+ ...pages,
46
+ ...(showPrevNext ? [button('next', currentPage + 1)] : []),
47
+ ...(showFirstLast ? [button('last', pagesCount)] : []),
48
+ ];
49
+ }, [
50
+ pagesCount,
51
+ currentPage,
52
+ siblings,
53
+ boundaries,
54
+ showPrevNext,
55
+ showFirstLast,
56
+ disabled,
57
+ setPage,
58
+ ]);
59
+ return { page: currentPage, count: pagesCount, items, setPage };
60
+ };
61
+ export default usePagination;
@@ -13,11 +13,10 @@ import React from 'react';
13
13
  import ReactDOM from 'react-dom';
14
14
  import Container from './PopperContainer';
15
15
  import { usePopper } from './usePopper';
16
- import useThemeProps from '../ThemeProvider/useThemeProps';
17
16
  export * from './usePopper';
18
17
  export const PORTAL_ID = 'ui-kit-portal';
19
18
  const Popper = (props, ref) => {
20
- const _a = useThemeProps('Popper', props), { isOpen, children, anchorElement, zIndex, overrides, anchorPos = 'auto', positionStrategy = 'fixed', viewportMargin = 30, autoFlip = false, alternativePlacements, offset = 0, onAnchorPosChanged } = _a, nativeProps = __rest(_a, ["isOpen", "children", "anchorElement", "zIndex", "overrides", "anchorPos", "positionStrategy", "viewportMargin", "autoFlip", "alternativePlacements", "offset", "onAnchorPosChanged"]);
19
+ const { isOpen, children, anchorElement, zIndex, overrides, anchorPos = 'auto', positionStrategy = 'fixed', viewportMargin = 30, autoFlip = false, alternativePlacements, offset = 0, onAnchorPosChanged } = props, nativeProps = __rest(props, ["isOpen", "children", "anchorElement", "zIndex", "overrides", "anchorPos", "positionStrategy", "viewportMargin", "autoFlip", "alternativePlacements", "offset", "onAnchorPosChanged"]);
21
20
  const [domLoaded, setDomLoaded] = React.useState(false);
22
21
  const { actualPlacement, style, popperRef, isVisible } = usePopper({
23
22
  anchorElement,
@@ -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 useRadioColor from './useRadioColor';
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;
@@ -59,7 +59,7 @@ const Circle = styled.span `
59
59
  width: 100%;
60
60
  height: 100%;
61
61
  border-radius: 50%;
62
- border-width: 0.1em;
62
+ border-width: ${BORDER_WIDTH};
63
63
  border-style: solid;
64
64
  background-color: ${({ theme }) => theme.color.surface.toString()};
65
65
  transition: border-color 150ms ease-out;
@@ -14,11 +14,10 @@ import Container from './RadioContainer';
14
14
  import Box from './RadioBox';
15
15
  import TextWrapper from './RadioTextWrapper';
16
16
  import RadioGroupContext from '../RadioGroup/RadioGroupContext';
17
- import useThemeProps from '../ThemeProvider/useThemeProps';
18
17
  const Radio = (props, ref) => {
19
18
  var _a;
20
19
  const group = React.useContext(RadioGroupContext);
21
- const _b = useThemeProps('Radio', props), { children, value, checked, defaultChecked, onChange, disabled, color, labelPosition, error, name, required, overrides, className, style } = _b, nativeProps = __rest(_b, ["children", "value", "checked", "defaultChecked", "onChange", "disabled", "color", "labelPosition", "error", "name", "required", "overrides", "className", "style"]);
20
+ const { children, value, checked, defaultChecked, onChange, disabled, color, labelPosition, error, name, required, overrides, className, style } = props, nativeProps = __rest(props, ["children", "value", "checked", "defaultChecked", "onChange", "disabled", "color", "labelPosition", "error", "name", "required", "overrides", "className", "style"]);
22
21
  const overridesMap = React.useMemo(() => ({
23
22
  Container: (overrides === null || overrides === void 0 ? void 0 : overrides.Container) || Container,
24
23
  Box: (overrides === null || overrides === void 0 ? void 0 : overrides.Box) || Box,
@@ -16,9 +16,8 @@ import Items from './RadioGroupItems';
16
16
  import Asterisk from './RadioGroupAsterisk';
17
17
  import ErrorText from './RadioGroupErrorText';
18
18
  import RadioGroupContext from './RadioGroupContext';
19
- import useThemeProps from '../ThemeProvider/useThemeProps';
20
19
  const RadioGroup = (props, ref) => {
21
- const _a = useThemeProps('RadioGroup', props), { children, name: inputName, value, defaultValue, onChange, label, orientation = 'vertical', color, disabled, required, requiredAsterisk, error, errorText, overrides } = _a, nativeProps = __rest(_a, ["children", "name", "value", "defaultValue", "onChange", "label", "orientation", "color", "disabled", "required", "requiredAsterisk", "error", "errorText", "overrides"]);
20
+ const { children, name: inputName, value, defaultValue, onChange, label, orientation = 'vertical', color, disabled, required, requiredAsterisk, error, errorText, overrides } = props, nativeProps = __rest(props, ["children", "name", "value", "defaultValue", "onChange", "label", "orientation", "color", "disabled", "required", "requiredAsterisk", "error", "errorText", "overrides"]);
22
21
  const id = React.useId().replace(/:/g, '');
23
22
  const name = inputName !== null && inputName !== void 0 ? inputName : `radio-group-${id}`;
24
23
  const legendID = `radio-group-${id}-legend`;
@@ -14,13 +14,19 @@ import styled from '@emotion/styled';
14
14
  import Button from '../Button';
15
15
  import ButtonTextWrapper from '../Button/ButtonTextWrapper';
16
16
  import { css } from '@emotion/react';
17
+ import { fieldPadding, CONTROL_LINE_HEIGHT, FIELD_TEXT_SCALE, fieldBorder, } from '../ThemeProvider/tokens';
17
18
  const StyledSelectboxButton = styled(Button) `
18
19
  flex: 1;
19
- padding: 1em 1.2em;
20
+ padding: ${({ theme }) => {
21
+ const { y, x } = fieldPadding(theme, FIELD_TEXT_SCALE);
22
+ return `${y} ${x}`;
23
+ }};
20
24
  font-size: 1em;
25
+ /* The line of the control: the selectbox has the height of the button */
26
+ line-height: calc(${CONTROL_LINE_HEIGHT} / ${FIELD_TEXT_SCALE});
21
27
  background: none;
22
28
  width: 100%;
23
- border-width: 1px;
29
+ border-width: ${fieldBorder(FIELD_TEXT_SCALE)};
24
30
  border-style: solid;
25
31
  box-shadow: none;
26
32
  &:hover {
@@ -38,7 +44,6 @@ const StyledSelectboxButton = styled(Button) `
38
44
  }
39
45
  `}
40
46
  transition: none;
41
-
42
47
  `;
43
48
  // The value has the size of the text in the fields, so the selectbox has the height of the TextField
44
49
  const StyledButtonTextWrapper = styled(ButtonTextWrapper) `
@@ -11,9 +11,10 @@ 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 { FIELD_TEXT_SCALE } from '../ThemeProvider/tokens';
14
15
  const Wrapper = styled.div `
15
16
  min-width: 16em;
16
- font-size: 0.9em;
17
+ font-size: ${FIELD_TEXT_SCALE}em;
17
18
  text-align: left;
18
19
  max-width: ${({ $fullWidth }) => ($fullWidth ? '100%' : '16em')};
19
20
  display: flex;
@@ -24,8 +25,6 @@ const Wrapper = styled.div `
24
25
  background-color: ${({ theme }) => theme.color.surface.toString()};
25
26
  color: ${({ theme }) => theme.color.textPrimary.toString()};
26
27
  transition: all 180ms ease-out 0s;
27
-
28
-
29
28
  `;
30
29
  const SelectboxButtonWrapper = (props, ref) => {
31
30
  const { fullWidth, children, error } = props, nativeProps = __rest(props, ["fullWidth", "children", "error"]);
@@ -21,7 +21,6 @@ import ErrorText from '../TextField/TextFieldErrorText';
21
21
  import ButtonWrapper from './SelectboxButtonWrapper';
22
22
  import Container from './SelectboxContainer';
23
23
  import SelectboxMenu from './SelectboxMenu';
24
- import useThemeProps from '../ThemeProvider/useThemeProps';
25
24
  export { SelectboxItem };
26
25
  const DEFAULT_OVERRIDES = {
27
26
  Button,
@@ -33,7 +32,7 @@ const DEFAULT_OVERRIDES = {
33
32
  Container,
34
33
  };
35
34
  const Selectbox = React.forwardRef((props, ref) => {
36
- const _a = useThemeProps('Selectbox', props), { items, value, multiple, isOpen = false, isLoading = false, anchorPos = 'bottom-fill', fullWidth = false, children, onChange, selectedItemToString, renderValue, getOptionSelected, onRequestOpen = () => undefined, onRequestClose = () => undefined, overrides, id, label, requiredAsterisk, error, errorText, notSetLabel = 'Not set', autoFlip = true, positionStrategy } = _a, nativeButtonProps = __rest(_a, ["items", "value", "multiple", "isOpen", "isLoading", "anchorPos", "fullWidth", "children", "onChange", "selectedItemToString", "renderValue", "getOptionSelected", "onRequestOpen", "onRequestClose", "overrides", "id", "label", "requiredAsterisk", "error", "errorText", "notSetLabel", "autoFlip", "positionStrategy"]);
35
+ const { items, value, multiple, isOpen = false, isLoading = false, anchorPos = 'bottom-fill', fullWidth = false, children, onChange, selectedItemToString, renderValue, getOptionSelected, onRequestOpen = () => undefined, onRequestClose = () => undefined, overrides, id, label, requiredAsterisk, error, errorText, notSetLabel = 'Not set', autoFlip = true, positionStrategy } = props, nativeButtonProps = __rest(props, ["items", "value", "multiple", "isOpen", "isLoading", "anchorPos", "fullWidth", "children", "onChange", "selectedItemToString", "renderValue", "getOptionSelected", "onRequestOpen", "onRequestClose", "overrides", "id", "label", "requiredAsterisk", "error", "errorText", "notSetLabel", "autoFlip", "positionStrategy"]);
37
36
  const menuRef = React.useRef(null);
38
37
  const [anchorElement, setAnchorElement] = React.useState(null);
39
38
  const overridesMap = React.useMemo(() => (Object.assign(Object.assign({}, DEFAULT_OVERRIDES), overrides)), [overrides]);
@@ -17,9 +17,8 @@ import Thumb from './SliderThumb';
17
17
  import Mark from './SliderMark';
18
18
  import MarkLabel from './SliderMarkLabel';
19
19
  import { clamp, snapToStep, valueToPercent } from './utils';
20
- import useThemeProps from '../ThemeProvider/useThemeProps';
21
20
  const Slider = (props, ref) => {
22
- const _a = useThemeProps('Slider', props), { value, defaultValue, onChange, onChangeCommitted, min = 0, max = 100, step = 1, marks = false, orientation = 'horizontal', disabled = false, color, name, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, getAriaLabel, getAriaValueText, overrides, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, onLostPointerCapture } = _a, nativeProps = __rest(_a, ["value", "defaultValue", "onChange", "onChangeCommitted", "min", "max", "step", "marks", "orientation", "disabled", "color", "name", 'aria-label', 'aria-labelledby', "getAriaLabel", "getAriaValueText", "overrides", "onPointerDown", "onPointerMove", "onPointerUp", "onPointerCancel", "onLostPointerCapture"]);
21
+ const { value, defaultValue, onChange, onChangeCommitted, min = 0, max = 100, step = 1, marks = false, orientation = 'horizontal', disabled = false, color, name, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, getAriaLabel, getAriaValueText, overrides, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, onLostPointerCapture } = props, nativeProps = __rest(props, ["value", "defaultValue", "onChange", "onChangeCommitted", "min", "max", "step", "marks", "orientation", "disabled", "color", "name", 'aria-label', 'aria-labelledby', "getAriaLabel", "getAriaValueText", "overrides", "onPointerDown", "onPointerMove", "onPointerUp", "onPointerCancel", "onLostPointerCapture"]);
23
22
  const overridesMap = React.useMemo(() => ({
24
23
  Container: (overrides === null || overrides === void 0 ? void 0 : overrides.Container) || Container,
25
24
  Rail: (overrides === null || overrides === void 0 ? void 0 : overrides.Rail) || Rail,
@@ -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 StyledStack = styled.div `
16
20
  display: ${({ $inline }) => ($inline ? 'inline-flex' : 'flex')};
17
21
  flex-direction: ${({ $direction }) => $direction};
@@ -21,13 +25,14 @@ const StyledStack = styled.div `
21
25
  gap: ${({ theme, $gap }) => resolveSpacing(theme, $gap)};
22
26
  /* A flex child shrinks below its content only with min-width: 0 */
23
27
  min-width: 0;
28
+ ${({ $isList }) => ($isList ? 'margin: 0; padding: 0; list-style: none;' : '')}
24
29
  `;
25
30
  /**
26
31
  * The elements in a column or in a row with the same gap between them.
27
32
  * The children stay the plain elements: no wrappers for the items
28
33
  */
29
34
  const Stack = (props, ref) => {
30
- const { children, direction = 'column', gap = 'md', align, justify, wrap = false, inline = false } = props, nativeProps = __rest(props, ["children", "direction", "gap", "align", "justify", "wrap", "inline"]);
31
- return (React.createElement(StyledStack, Object.assign({}, nativeProps, { "$direction": direction, "$gap": gap, "$align": align, "$justify": justify, "$wrap": wrap, "$inline": inline, ref: ref }), children));
35
+ const { children, direction = 'column', gap = 'md', align, justify, wrap = false, inline = false, as } = props, nativeProps = __rest(props, ["children", "direction", "gap", "align", "justify", "wrap", "inline", "as"]);
36
+ return (React.createElement(StyledStack, Object.assign({}, nativeProps, { "$direction": direction, "$gap": gap, "$align": align, "$justify": justify, "$wrap": wrap, "$inline": inline, "$isList": Boolean(as && LIST_TAGS.includes(as)), as: as, ref: ref }), children));
32
37
  };
33
38
  export default React.forwardRef(Stack);
@@ -19,7 +19,7 @@ const StyledSurfaceContainer = styled.div `
19
19
  flex-direction: column;
20
20
  background: ${({ theme }) => theme.color.surface.toString()};
21
21
  color: ${({ theme }) => theme.color.textPrimary.toString()};
22
- box-shadow: ${({ theme }) => elevation(theme, 'surface', `0 0.5em 2em -0.8em ${theme.color.surface.darken(100).alpha(0.4).toString()}`)};
22
+ box-shadow: ${({ theme }) => elevation(theme, 'surface')};
23
23
  border-radius: ${({ theme }) => theme.shape.radiusFactor}em;
24
24
  font-size: 1em;
25
25
 
@@ -12,20 +12,27 @@ 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 StyledContent = styled.div `
16
17
  flex: 1;
17
- ${({ $noPadding }) => (typeof $noPadding === 'undefined' || $noPadding === false) &&
18
- css `
19
- padding: 1.4rem 1rem 1rem 1rem;
20
- `}
18
+ ${({ $noPadding, theme }) => {
19
+ const { y, x } = themePadding(theme, 'container');
20
+ return (!$noPadding &&
21
+ css `
22
+ padding: calc(${y} * 1.4) ${x} ${y} ${x};
23
+ `);
24
+ }}
21
25
 
22
- ${({ $rounded, $noPadding }) => $rounded &&
23
- css `
24
- display: flex;
25
- align-items: center;
26
- justify-content: center;
27
- padding: ${$noPadding ? '0' : '1rem'};
28
- `}
26
+ ${({ $rounded, $noPadding, theme }) => {
27
+ const { y, x } = themePadding(theme, 'container');
28
+ return ($rounded &&
29
+ css `
30
+ display: flex;
31
+ align-items: center;
32
+ justify-content: center;
33
+ padding: ${$noPadding ? '0' : `${y} ${x}`};
34
+ `);
35
+ }}
29
36
  `;
30
37
  const SurfaceContent = (props, ref) => {
31
38
  const { children, noPadding, rounded } = props, nativeProps = __rest(props, ["children", "noPadding", "rounded"]);
@@ -11,11 +11,15 @@ 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 StyledFooter = styled.div `
15
16
  display: flex;
16
17
  align-items: center;
17
18
  justify-content: flex-end;
18
- padding: ${({ $noPadding }) => ($noPadding ? '0' : '1rem')};
19
+ padding: ${({ $noPadding, theme }) => {
20
+ const { y, x } = themePadding(theme, 'container');
21
+ return $noPadding ? '0' : `${y} ${x}`;
22
+ }};
19
23
  border-bottom-left-radius: inherit;
20
24
  border-bottom-right-radius: inherit;
21
25
  `;
@@ -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 StyledHeader = styled.div `
15
- padding: ${({ $noPadding }) => ($noPadding ? '0' : '1rem 1rem 0 1rem')};
16
- font-size: 1.3rem;
16
+ padding: ${({ $noPadding, theme }) => {
17
+ const { y, x } = themePadding(theme, 'container', 1.3);
18
+ return $noPadding ? '0' : `${y} ${x} 0 ${x}`;
19
+ }};
20
+ font-size: 1.3em;
17
21
  font-weight: 600;
18
22
  border-top-left-radius: inherit;
19
23
  border-top-right-radius: inherit;
@@ -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 StyledHeader = styled.div `
15
- padding: ${({ $noPadding }) => ($noPadding ? '0' : '0.5em 1rem 0 1rem')};
16
- font-size: 0.9rem;
16
+ padding: ${({ $noPadding, theme }) => {
17
+ const { y, x } = themePadding(theme, 'container', 0.9);
18
+ return $noPadding ? '0' : `calc(${y} / 2) ${x} 0 ${x}`;
19
+ }};
20
+ font-size: 0.9em;
17
21
  font-weight: 200;
18
22
  color: ${({ theme }) => theme.color.textSecondary.toString()};
19
23
  `;
@@ -15,9 +15,8 @@ import Header from './SurfaceHeader';
15
15
  import Subheader from './SurfaceSubheader';
16
16
  import Content from './SurfaceContent';
17
17
  import Footer from './SurfaceFooter';
18
- import useThemeProps from '../ThemeProvider/useThemeProps';
19
18
  const Surface = (props, ref) => {
20
- const _a = useThemeProps('Surface', props), { children, header, subheader, footer, inline, noPadding, rounded, overrides } = _a, nativeProps = __rest(_a, ["children", "header", "subheader", "footer", "inline", "noPadding", "rounded", "overrides"]);
19
+ const { children, header, subheader, footer, inline, noPadding, rounded, overrides } = props, nativeProps = __rest(props, ["children", "header", "subheader", "footer", "inline", "noPadding", "rounded", "overrides"]);
21
20
  const hasFooter = typeof footer !== 'undefined' && footer !== null;
22
21
  const hasHeader = typeof header !== 'undefined' && header !== null;
23
22
  const hasSubheader = typeof subheader !== 'undefined' && subheader !== null;