@via-profit/ui-kit 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Accordion/AccordionActions.d.ts +1 -1
- package/Accordion/AccordionActions.js +2 -1
- package/Accordion/AccordionContainer.d.ts +1 -1
- package/Accordion/AccordionContainer.js +2 -14
- package/Accordion/AccordionContent.d.ts +1 -1
- package/Accordion/AccordionContent.js +5 -1
- package/Accordion/AccordionHeader.d.ts +2 -2
- package/Accordion/AccordionHeader.js +6 -2
- package/Accordion/index.d.ts +9 -9
- package/Accordion/index.js +18 -9
- package/Autocomplete/AutocompleteContainer.d.ts +2 -2
- package/Autocomplete/AutocompleteContainer.js +17 -7
- package/Autocomplete/AutocompleteItem.js +2 -1
- package/Autocomplete/context.d.ts +3 -3
- package/Autocomplete/index.d.ts +2 -2
- package/Avatar/AvatarContainer.d.ts +2 -2
- package/Avatar/AvatarPicture.d.ts +2 -2
- package/Avatar/index.js +1 -2
- package/Badge/BadgeBase.d.ts +1 -1
- package/Badge/BadgeContainer.d.ts +1 -1
- package/Badge/BadgeDeleteButton.d.ts +2 -2
- package/Badge/BadgeStyled.js +1 -1
- package/Badge/index.d.ts +1 -1
- package/Badge/index.js +1 -2
- package/Button/ButtonBase.d.ts +2 -2
- package/Button/ButtonContainer.d.ts +4 -4
- package/Button/ButtonContainer.js +22 -5
- package/Button/ButtonIconWrapper.d.ts +1 -1
- package/Button/ButtonStyled.d.ts +1 -1
- package/Button/ButtonTextWrapper.d.ts +1 -1
- package/Button/buttonVariants.d.ts +1 -1
- package/Button/buttonVariants.js +3 -2
- package/Button/index.d.ts +1 -1
- package/Button/index.js +1 -20
- package/ButtonGroup/index.js +4 -3
- package/CHANGELOG.md +32 -1
- package/Calendar/CalendarComponent.js +18 -9
- package/Calendar/CalendarControlButton.d.ts +2 -2
- package/Calendar/CalendarPaper.js +1 -1
- package/Calendar/CalendarWeekDayLabel.d.ts +2 -2
- package/Calendar/CalendarWeekRowButton.d.ts +1 -1
- package/Calendar/IconChevronDown.js +17 -7
- package/Calendar/index.d.ts +1 -1
- package/Calendar/index.js +17 -7
- package/Checkbox/CheckboxAsterisk.js +17 -7
- package/Checkbox/CheckboxBox.d.ts +2 -2
- package/Checkbox/CheckboxBox.js +1 -1
- package/Checkbox/CheckboxContainer.d.ts +2 -2
- package/Checkbox/CheckboxErrorText.js +17 -7
- package/Checkbox/index.d.ts +10 -10
- package/Checkbox/index.js +1 -2
- package/Checkbox/useCheckboxColor.d.ts +1 -1
- package/ClickOutside/index.js +5 -2
- package/DatePicker/index.d.ts +1 -1
- package/ErrorBoundary/RenderError.js +17 -7
- package/ErrorBoundary/index.d.ts +1 -1
- package/Grid/index.d.ts +17 -5
- package/Grid/index.js +7 -2
- package/Highlighted/index.js +1 -2
- package/LoadingIndicator/LoadingOverlay.js +17 -7
- package/LoadingIndicator/Spinner.js +17 -7
- package/LoadingIndicator/SpinnerCircle.d.ts +2 -3
- package/Menu/MenuContainer.d.ts +2 -2
- package/Menu/MenuContainer.js +19 -10
- package/Menu/MenuItem.js +5 -1
- package/Menu/MenuList.js +1 -1
- package/Menu/context.d.ts +1 -1
- package/Menu/index.d.ts +1 -1
- package/Modal/BaseModal/ModalInner.js +2 -0
- package/Modal/BaseModal/ModalWrapper.js +30 -37
- package/Modal/BaseModal/context.d.ts +1 -1
- package/Modal/BaseModal/index.js +1 -2
- package/Modal/ConfirmBox/ConfirmBoxContent.js +5 -1
- package/Modal/ConfirmBox/ConfirmBoxFooter.js +5 -1
- package/Modal/ConfirmBox/ConfirmBoxHeader.js +5 -1
- package/Modal/ConfirmBox/index.js +1 -2
- package/Modal/Dialog/DialogInner.js +5 -1
- package/Modal/Dialog/index.js +18 -9
- package/Modal/Drawer/DrawerCloseIcon.js +17 -7
- package/Modal/Drawer/DrawerFooter.js +5 -1
- package/Modal/Drawer/DrawerHeader.d.ts +4 -4
- package/Modal/Drawer/DrawerHeader.js +5 -1
- package/Modal/Drawer/index.js +18 -9
- package/Modal/MessageBox/MessageBoxContent.js +5 -1
- package/Modal/MessageBox/MessageBoxFooter.js +5 -1
- package/Modal/MessageBox/MessageBoxHeader.js +5 -1
- package/Modal/MessageBox/index.js +18 -9
- package/Modal/index.js +17 -7
- package/Pagination/PaginationContainer.d.ts +9 -0
- package/Pagination/PaginationContainer.js +34 -0
- package/Pagination/PaginationGap.d.ts +4 -0
- package/Pagination/PaginationGap.js +22 -0
- package/Pagination/PaginationIcons.d.ts +6 -0
- package/Pagination/PaginationIcons.js +21 -0
- package/Pagination/PaginationItem.d.ts +44 -0
- package/Pagination/PaginationItem.js +59 -0
- package/Pagination/getPaginationItems.d.ts +22 -0
- package/Pagination/getPaginationItems.js +42 -0
- package/Pagination/index.d.ts +104 -0
- package/Pagination/index.js +98 -0
- package/Pagination/usePagination.d.ts +105 -0
- package/Pagination/usePagination.js +66 -0
- package/PhoneField/CountryFlagComponent.d.ts +1 -1
- package/PhoneField/UnknownFlag.d.ts +0 -1
- package/PhoneField/flags/BY.js +17 -7
- package/PhoneField/flags/CN.js +17 -7
- package/PhoneField/flags/IL.js +17 -7
- package/PhoneField/flags/JP.js +17 -7
- package/PhoneField/flags/KZ.js +17 -7
- package/PhoneField/flags/RU.js +17 -7
- package/PhoneField/flags/UA.js +17 -7
- package/PhoneField/flags/US.js +17 -7
- package/PhoneField/flags/Unknown.js +17 -7
- package/PhoneField/templates.d.ts +2 -2
- package/Popper/Popper.js +1 -2
- package/Radio/RadioBox.d.ts +1 -1
- package/Radio/RadioBox.js +1 -1
- package/Radio/RadioContainer.d.ts +2 -2
- package/Radio/index.d.ts +5 -5
- package/Radio/index.js +1 -2
- package/Radio/useRadioColor.d.ts +1 -1
- package/RadioGroup/RadioGroupAsterisk.js +17 -7
- package/RadioGroup/RadioGroupErrorText.js +17 -7
- package/RadioGroup/RadioGroupItems.d.ts +1 -1
- package/RadioGroup/index.d.ts +11 -11
- package/RadioGroup/index.js +1 -2
- package/Selectbox/SelectboxButton.d.ts +4 -4
- package/Selectbox/SelectboxButton.js +25 -10
- package/Selectbox/SelectboxButtonWrapper.d.ts +2 -2
- package/Selectbox/SelectboxButtonWrapper.js +19 -10
- package/Selectbox/SelectboxMenu.d.ts +2 -2
- package/Selectbox/SelectboxMenu.js +17 -7
- package/Selectbox/index.d.ts +2 -2
- package/Selectbox/index.js +18 -9
- package/Slider/SliderRail.d.ts +1 -1
- package/Slider/SliderThumb.d.ts +1 -1
- package/Slider/SliderTrack.d.ts +1 -1
- package/Slider/index.js +1 -2
- package/Slider/useSliderColor.d.ts +1 -1
- package/Stack/index.d.ts +18 -6
- package/Stack/index.js +7 -2
- package/Surface/SurfaceContainer.d.ts +3 -3
- package/Surface/SurfaceContainer.js +1 -1
- package/Surface/SurfaceContent.d.ts +2 -2
- package/Surface/SurfaceContent.js +18 -11
- package/Surface/SurfaceFooter.d.ts +2 -2
- package/Surface/SurfaceFooter.js +5 -1
- package/Surface/SurfaceHeader.d.ts +2 -2
- package/Surface/SurfaceHeader.js +6 -2
- package/Surface/SurfaceSubheader.d.ts +2 -2
- package/Surface/SurfaceSubheader.js +6 -2
- package/Surface/index.d.ts +10 -10
- package/Surface/index.js +18 -9
- package/Swiper/Swiper.d.ts +15 -15
- package/Swiper/Swiper.js +18 -9
- package/Swiper/SwiperContainer.d.ts +2 -2
- package/Swiper/SwiperSlide.js +17 -7
- package/Swiper/SwiperSlidesRenderer.js +17 -7
- package/Swiper/SwiperTrack.d.ts +2 -2
- package/Swiper/SwiperTrack.js +17 -7
- package/Swiper/SwiperWrapper.d.ts +2 -2
- package/Swiper/SwiperWrapper.js +17 -7
- package/Switch/SwitchAsterisk.js +17 -7
- package/Switch/SwitchContainer.d.ts +2 -2
- package/Switch/SwitchDot.d.ts +1 -1
- package/Switch/SwitchDot.js +2 -4
- package/Switch/SwitchErrorText.js +17 -7
- package/Switch/SwitchTrack.d.ts +1 -1
- package/Switch/index.d.ts +9 -9
- package/Switch/index.js +1 -2
- package/Switch/useSwitchColor.d.ts +1 -1
- package/Table/Table.d.ts +1 -1
- package/Table/Table.js +1 -1
- package/Table/TableCaption.js +5 -1
- package/Table/TableCell.js +6 -2
- package/Table/TableFooter.js +2 -1
- package/Table/TableHeaderCell.js +6 -2
- package/Tabs/Tab.js +4 -1
- package/Tabs/TabPanel.d.ts +1 -1
- package/Tabs/Tabs.d.ts +7 -7
- package/Tabs/Tabs.js +1 -2
- package/Tabs/useTabsColor.d.ts +1 -1
- package/TextArea/TextAreaIconWrapper.d.ts +3 -3
- package/TextArea/TextAreaIconWrapper.js +17 -7
- package/TextArea/TextAreaInput.js +23 -8
- package/TextArea/index.js +18 -9
- package/TextField/TextFieldContainer.js +17 -7
- package/TextField/TextFieldErrorText.js +17 -7
- package/TextField/TextFieldIconWrapper.d.ts +3 -3
- package/TextField/TextFieldIconWrapper.js +17 -7
- package/TextField/TextFieldInput.js +23 -8
- package/TextField/TextFieldInputWrapper.d.ts +5 -5
- package/TextField/TextFieldInputWrapper.js +22 -9
- package/TextField/TextFieldLabel.js +17 -7
- package/TextField/TextFieldLabelAsterisk.js +17 -7
- package/TextField/index.d.ts +1 -1
- package/TextField/index.js +18 -9
- package/ThemeProvider/createTheme.js +7 -3
- package/ThemeProvider/index.d.ts +45 -12
- package/ThemeProvider/index.js +1 -4
- package/ThemeProvider/tokens.d.ts +54 -3
- package/ThemeProvider/tokens.js +61 -3
- package/Toast/ToastCard.js +5 -2
- package/Toast/ToastContainer.js +1 -2
- package/Tooltip/TooltipContainer.js +2 -0
- package/Tooltip/index.js +3 -4
- package/Typography/Base.d.ts +2 -3
- package/Typography/Blockquote.d.ts +2 -3
- package/Typography/List.d.ts +6 -7
- package/Typography/Paragraph.d.ts +1 -1
- package/Typography/Paragraph.js +17 -7
- package/Typography/SectionDescription.d.ts +2 -3
- package/Typography/U.d.ts +2 -3
- package/esm/Accordion/AccordionActions.js +2 -1
- package/esm/Accordion/AccordionContainer.js +2 -14
- package/esm/Accordion/AccordionContent.js +5 -1
- package/esm/Accordion/AccordionHeader.js +7 -3
- package/esm/Accordion/index.js +1 -2
- package/esm/Autocomplete/AutocompleteItem.js +2 -1
- package/esm/Avatar/index.js +1 -2
- package/esm/Badge/BadgeStyled.js +2 -2
- package/esm/Badge/index.js +1 -2
- package/esm/Button/ButtonContainer.js +23 -6
- package/esm/Button/buttonVariants.js +3 -2
- package/esm/Button/index.js +1 -20
- package/esm/ButtonGroup/index.js +4 -3
- package/esm/Calendar/CalendarComponent.js +1 -2
- package/esm/Calendar/CalendarPaper.js +1 -1
- package/esm/Checkbox/CheckboxBox.js +2 -2
- package/esm/Checkbox/index.js +1 -2
- package/esm/ClickOutside/index.js +5 -2
- package/esm/Grid/index.js +7 -2
- package/esm/Highlighted/index.js +1 -2
- package/esm/Menu/MenuContainer.js +2 -3
- package/esm/Menu/MenuItem.js +5 -1
- package/esm/Menu/MenuList.js +1 -1
- package/esm/Modal/BaseModal/ModalInner.js +2 -0
- package/esm/Modal/BaseModal/ModalWrapper.js +30 -37
- package/esm/Modal/BaseModal/index.js +1 -2
- package/esm/Modal/ConfirmBox/ConfirmBoxContent.js +5 -1
- package/esm/Modal/ConfirmBox/ConfirmBoxFooter.js +5 -1
- package/esm/Modal/ConfirmBox/ConfirmBoxHeader.js +5 -1
- package/esm/Modal/ConfirmBox/index.js +1 -2
- package/esm/Modal/Dialog/DialogInner.js +5 -1
- package/esm/Modal/Dialog/index.js +1 -2
- package/esm/Modal/Drawer/DrawerFooter.js +5 -1
- package/esm/Modal/Drawer/DrawerHeader.js +5 -1
- package/esm/Modal/Drawer/index.js +1 -2
- package/esm/Modal/MessageBox/MessageBoxContent.js +5 -1
- package/esm/Modal/MessageBox/MessageBoxFooter.js +5 -1
- package/esm/Modal/MessageBox/MessageBoxHeader.js +5 -1
- package/esm/Modal/MessageBox/index.js +1 -2
- package/esm/Pagination/PaginationContainer.js +29 -0
- package/esm/Pagination/PaginationGap.js +17 -0
- package/esm/Pagination/PaginationIcons.js +15 -0
- package/esm/Pagination/PaginationItem.js +54 -0
- package/esm/Pagination/getPaginationItems.js +40 -0
- package/esm/Pagination/index.js +77 -0
- package/esm/Pagination/usePagination.js +61 -0
- package/esm/Popper/Popper.js +1 -2
- package/esm/Radio/RadioBox.js +2 -2
- package/esm/Radio/index.js +1 -2
- package/esm/RadioGroup/index.js +1 -2
- package/esm/Selectbox/SelectboxButton.js +8 -3
- package/esm/Selectbox/SelectboxButtonWrapper.js +2 -3
- package/esm/Selectbox/index.js +1 -2
- package/esm/Slider/index.js +1 -2
- package/esm/Stack/index.js +7 -2
- package/esm/Surface/SurfaceContainer.js +1 -1
- package/esm/Surface/SurfaceContent.js +18 -11
- package/esm/Surface/SurfaceFooter.js +5 -1
- package/esm/Surface/SurfaceHeader.js +6 -2
- package/esm/Surface/SurfaceSubheader.js +6 -2
- package/esm/Surface/index.js +1 -2
- package/esm/Swiper/Swiper.js +1 -2
- package/esm/Switch/SwitchDot.js +2 -4
- package/esm/Switch/index.js +1 -2
- package/esm/Table/Table.js +1 -1
- package/esm/Table/TableCaption.js +5 -1
- package/esm/Table/TableCell.js +6 -2
- package/esm/Table/TableFooter.js +2 -1
- package/esm/Table/TableHeaderCell.js +6 -2
- package/esm/Tabs/Tab.js +5 -2
- package/esm/Tabs/Tabs.js +1 -2
- package/esm/TextArea/TextAreaInput.js +6 -1
- package/esm/TextArea/index.js +1 -2
- package/esm/TextField/TextFieldInput.js +6 -1
- package/esm/TextField/TextFieldInputWrapper.js +5 -2
- package/esm/TextField/index.js +1 -2
- package/esm/ThemeProvider/createTheme.js +7 -3
- package/esm/ThemeProvider/index.js +0 -2
- package/esm/ThemeProvider/tokens.js +55 -2
- package/esm/Toast/ToastCard.js +6 -3
- package/esm/Toast/ToastContainer.js +1 -2
- package/esm/Tooltip/TooltipContainer.js +2 -0
- package/esm/Tooltip/index.js +3 -4
- package/esm/utils/getElementRef.js +13 -0
- package/package.json +46 -11
- package/utils/getElementRef.d.ts +8 -0
- package/utils/getElementRef.js +18 -0
- package/ThemeProvider/components.d.ts +0 -79
- package/ThemeProvider/components.js +0 -3
- package/ThemeProvider/useThemeProps.d.ts +0 -7
- package/ThemeProvider/useThemeProps.js +0 -34
- package/esm/ThemeProvider/components.js +0 -2
- 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
|
|
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;
|
package/esm/Popper/Popper.js
CHANGED
|
@@ -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
|
|
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,
|
package/esm/Radio/RadioBox.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 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:
|
|
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;
|
package/esm/Radio/index.js
CHANGED
|
@@ -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
|
|
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,
|
package/esm/RadioGroup/index.js
CHANGED
|
@@ -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
|
|
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:
|
|
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:
|
|
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:
|
|
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"]);
|
package/esm/Selectbox/index.js
CHANGED
|
@@ -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
|
|
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]);
|
package/esm/Slider/index.js
CHANGED
|
@@ -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
|
|
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,
|
package/esm/Stack/index.js
CHANGED
|
@@ -12,6 +12,10 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
14
|
import { resolveSpacing } from '../utils/spacing';
|
|
15
|
+
/**
|
|
16
|
+
* The lists are the rows of the elements here: no default margins and markers
|
|
17
|
+
*/
|
|
18
|
+
const LIST_TAGS = ['ul', 'ol', 'dl'];
|
|
15
19
|
const 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'
|
|
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 }) =>
|
|
18
|
-
|
|
19
|
-
|
|
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 }) =>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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 }) =>
|
|
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 }) =>
|
|
16
|
-
|
|
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 }) =>
|
|
16
|
-
|
|
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
|
`;
|
package/esm/Surface/index.js
CHANGED
|
@@ -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
|
|
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;
|
package/esm/Swiper/Swiper.js
CHANGED
|
@@ -14,11 +14,10 @@ import Container from './SwiperContainer';
|
|
|
14
14
|
import Wrapper from './SwiperWrapper';
|
|
15
15
|
import Track from './SwiperTrack';
|
|
16
16
|
import SwiperSlidesRenderer from './SwiperSlidesRenderer';
|
|
17
|
-
import useThemeProps from '../ThemeProvider/useThemeProps';
|
|
18
17
|
export * from './SwiperSlide';
|
|
19
18
|
const defaultSlideLabel = (index, total) => `${index + 1} / ${total}`;
|
|
20
19
|
export const Swiper = React.forwardRef((props, ref) => {
|
|
21
|
-
const
|
|
20
|
+
const { children, dragThreshold = 240, snap = true, draggable = true, overrides, initialIndex = 0, infinite = false, onSlideChange, autoplay = false, autoplayInterval = 3000, pauseOnHover = true, threshold = 20, resistance = true, slidesPerView = 1, keyboardControl = true, slideLabel = defaultSlideLabel } = props, restProps = __rest(props, ["children", "dragThreshold", "snap", "draggable", "overrides", "initialIndex", "infinite", "onSlideChange", "autoplay", "autoplayInterval", "pauseOnHover", "threshold", "resistance", "slidesPerView", "keyboardControl", "slideLabel"]);
|
|
22
21
|
// #region Slides
|
|
23
22
|
const slides = React.useMemo(() => {
|
|
24
23
|
// toArray skips null/false and keeps the user keys (prefixed), so the slides are not remounted
|