@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.
- 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 +49 -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 +83 -15
- package/Swiper/Swiper.js +285 -143
- package/Swiper/SwiperContainer.d.ts +2 -2
- package/Swiper/SwiperSlide.js +20 -7
- package/Swiper/SwiperSlidesRenderer.d.ts +4 -0
- package/Swiper/SwiperSlidesRenderer.js +19 -8
- package/Swiper/SwiperTrack.d.ts +22 -2
- package/Swiper/SwiperTrack.js +45 -12
- package/Swiper/SwiperWrapper.d.ts +5 -2
- package/Swiper/SwiperWrapper.js +22 -11
- 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 +268 -136
- package/esm/Swiper/SwiperSlide.js +3 -0
- package/esm/Swiper/SwiperSlidesRenderer.js +2 -1
- package/esm/Swiper/SwiperTrack.js +28 -5
- package/esm/Swiper/SwiperWrapper.js +5 -4
- 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
|
@@ -12,11 +12,21 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
14
|
import { css } from '@emotion/react';
|
|
15
|
-
import { themeFocusRing } from '../ThemeProvider/tokens';
|
|
15
|
+
import { themeFocusRing, controlHeight, CONTROL_BORDER, CONTROL_LINE_HEIGHT, } from '../ThemeProvider/tokens';
|
|
16
16
|
import { buttonVariantStyles } from './buttonVariants';
|
|
17
|
+
/**
|
|
18
|
+
* The outlined buttons and all the buttons of the ButtonGroup have a border.
|
|
19
|
+
* The other ones get its width in the padding, so all the buttons have the same height
|
|
20
|
+
*/
|
|
21
|
+
const buttonPadding = ({ theme, $variant, $group }) => {
|
|
22
|
+
const { y, x } = theme.padding.control;
|
|
23
|
+
const hasBorder = $variant === 'outlined' || Boolean($group) || !$variant;
|
|
24
|
+
return hasBorder ? `${y} ${x}` : `calc(${y} + ${CONTROL_BORDER}) calc(${x} + ${CONTROL_BORDER})`;
|
|
25
|
+
};
|
|
17
26
|
const StyledButton = styled.button `
|
|
18
27
|
border-radius: ${({ theme }) => theme.shape.radiusFactor * 2}em;
|
|
19
|
-
padding:
|
|
28
|
+
padding: ${buttonPadding};
|
|
29
|
+
line-height: ${CONTROL_LINE_HEIGHT};
|
|
20
30
|
cursor: ${({ disabled }) => (disabled ? 'default' : 'pointer')};
|
|
21
31
|
font-size: 1em;
|
|
22
32
|
/* Buttons do not inherit the font by default */
|
|
@@ -25,7 +35,13 @@ const StyledButton = styled.button `
|
|
|
25
35
|
outline-style: solid;
|
|
26
36
|
outline-color: transparent;
|
|
27
37
|
outline-width: 0.14em;
|
|
28
|
-
|
|
38
|
+
/*
|
|
39
|
+
* The colors only: the variants have different border and padding, a transition of the sizes
|
|
40
|
+
* makes the button grow for a moment when the variant changes (the border width changes by whole pixels)
|
|
41
|
+
*/
|
|
42
|
+
transition-property: color, background-color, border-color, box-shadow, outline-color;
|
|
43
|
+
transition-duration: 180ms;
|
|
44
|
+
transition-timing-function: ease-out;
|
|
29
45
|
background: none;
|
|
30
46
|
display: inline-flex;
|
|
31
47
|
align-items: center;
|
|
@@ -40,10 +56,11 @@ const StyledButton = styled.button `
|
|
|
40
56
|
}};
|
|
41
57
|
${({ iconOnly, theme }) => iconOnly &&
|
|
42
58
|
css `
|
|
43
|
-
padding:
|
|
59
|
+
padding: 0;
|
|
44
60
|
justify-content: center;
|
|
45
|
-
|
|
46
|
-
|
|
61
|
+
box-sizing: border-box;
|
|
62
|
+
width: ${controlHeight(theme)};
|
|
63
|
+
height: ${controlHeight(theme)};
|
|
47
64
|
border-radius: ${theme.shape.radiusFactor * 3}em;
|
|
48
65
|
`}
|
|
49
66
|
${({ $variant, $group, color, disabled, theme }) => $variant && buttonVariantStyles({ variant: $variant, color, disabled, group: $group, theme })}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
2
|
import Color from '../Color';
|
|
3
|
+
import { CONTROL_BORDER } from '../ThemeProvider/tokens';
|
|
3
4
|
const parseColor = (color, fallback) => {
|
|
4
5
|
try {
|
|
5
6
|
return Color.fromString(color);
|
|
@@ -82,7 +83,7 @@ const outlinedStyles = ({ $color, disabled, theme }) => css `
|
|
|
82
83
|
: $color.toString()};
|
|
83
84
|
background-color: transparent;
|
|
84
85
|
border-style: solid;
|
|
85
|
-
border-width:
|
|
86
|
+
border-width: ${CONTROL_BORDER};
|
|
86
87
|
|
|
87
88
|
${!disabled &&
|
|
88
89
|
css `
|
|
@@ -126,7 +127,7 @@ const plainStyles = ({ $color, disabled, theme }) => css `
|
|
|
126
127
|
const groupStyles = ({ $group, $variant, $color }) => $group &&
|
|
127
128
|
css `
|
|
128
129
|
border-style: solid;
|
|
129
|
-
border-width:
|
|
130
|
+
border-width: ${CONTROL_BORDER};
|
|
130
131
|
${$variant !== 'outlined' &&
|
|
131
132
|
css `
|
|
132
133
|
border-color: transparent;
|
package/esm/Button/index.js
CHANGED
|
@@ -1,24 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ButtonStyled from './ButtonStyled';
|
|
3
|
-
import ButtonGroupContext from '../ButtonGroup/ButtonGroupContext';
|
|
4
|
-
import useThemeProps from '../ThemeProvider/useThemeProps';
|
|
5
|
-
/**
|
|
6
|
-
* The props the ButtonGroup gives to its buttons. Inside the group the theme does not set them:
|
|
7
|
-
* the own props of the button win, then the group, then the theme
|
|
8
|
-
*/
|
|
9
|
-
const GROUP_PROPS = ['variant', 'color', 'disabled'];
|
|
10
3
|
// One component for all the variants, so changing the variant does not remount the button
|
|
11
|
-
const Button = (props, ref) => {
|
|
12
|
-
const group = React.useContext(ButtonGroupContext);
|
|
13
|
-
const themedProps = useThemeProps('Button', props);
|
|
14
|
-
if (!group) {
|
|
15
|
-
return React.createElement(ButtonStyled, Object.assign({}, themedProps, { ref: ref }));
|
|
16
|
-
}
|
|
17
|
-
const ownProps = props;
|
|
18
|
-
const buttonProps = Object.assign({}, themedProps);
|
|
19
|
-
GROUP_PROPS.forEach(key => {
|
|
20
|
-
buttonProps[key] = ownProps[key];
|
|
21
|
-
});
|
|
22
|
-
return React.createElement(ButtonStyled, Object.assign({}, buttonProps, { ref: ref }));
|
|
23
|
-
};
|
|
4
|
+
const Button = (props, ref) => (React.createElement(ButtonStyled, Object.assign({}, props, { ref: ref })));
|
|
24
5
|
export default React.forwardRef(Button);
|
package/esm/ButtonGroup/index.js
CHANGED
|
@@ -13,8 +13,9 @@ import React from 'react';
|
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
14
|
import { css } from '@emotion/react';
|
|
15
15
|
import ButtonGroupContext from './ButtonGroupContext';
|
|
16
|
+
import { CONTROL_BORDER } from '../ThemeProvider/tokens';
|
|
16
17
|
/**
|
|
17
|
-
* The buttons are glued: the inner corners are square and the borders overlap.
|
|
18
|
+
* The buttons are glued: the inner corners are square and the borders overlap by the width of the border.
|
|
18
19
|
* `:not(...)` raises the specificity above the own styles of the button.
|
|
19
20
|
* `-of-type`, not `-child`: with SSR emotion inserts <style> elements between the children
|
|
20
21
|
*/
|
|
@@ -39,7 +40,7 @@ const StyledGroup = styled.div `
|
|
|
39
40
|
${({ $orientation }) => $orientation === 'vertical'
|
|
40
41
|
? css `
|
|
41
42
|
& > *:not(:first-of-type) {
|
|
42
|
-
margin-top: -
|
|
43
|
+
margin-top: calc(-1 * ${CONTROL_BORDER});
|
|
43
44
|
border-top-left-radius: 0;
|
|
44
45
|
border-top-right-radius: 0;
|
|
45
46
|
}
|
|
@@ -50,7 +51,7 @@ const StyledGroup = styled.div `
|
|
|
50
51
|
`
|
|
51
52
|
: css `
|
|
52
53
|
& > *:not(:first-of-type) {
|
|
53
|
-
margin-left: -
|
|
54
|
+
margin-left: calc(-1 * ${CONTROL_BORDER});
|
|
54
55
|
border-top-left-radius: 0;
|
|
55
56
|
border-bottom-left-radius: 0;
|
|
56
57
|
}
|
|
@@ -24,7 +24,6 @@ import WeekDaysBar from './CalendarWeekDaysBar';
|
|
|
24
24
|
import { useCalendar } from './use-calendar';
|
|
25
25
|
import styled from '@emotion/styled';
|
|
26
26
|
import { keyframes } from '@emotion/react';
|
|
27
|
-
import useThemeProps from '../ThemeProvider/useThemeProps';
|
|
28
27
|
export * from './use-calendar';
|
|
29
28
|
export * from './CalendarWeekDaysBar';
|
|
30
29
|
const viewAppear = keyframes `
|
|
@@ -117,7 +116,7 @@ const computeCalendarDate = (params) => {
|
|
|
117
116
|
};
|
|
118
117
|
const CalendarComponent = React.forwardRef((props, ref) => {
|
|
119
118
|
var _a;
|
|
120
|
-
const { minDate: inputMinDate, maxDate: inputMaxDate, weekStartDay = 'monday', locale = 'ru-RU', displayLeadingZero = false, onChange, badges = [], markToday = true, weekDayLabelFormat = 'short', accentColor = 'primary', defaultValue, value: inputValue, initialView: inputInitialView, view: inputView, views: inputViews, resetButtonLabel, todayButtonLabel, heading, subheading, footer, overrides, range = false, prevButtonLabel = 'Previous', nextButtonLabel = 'Next', } =
|
|
119
|
+
const { minDate: inputMinDate, maxDate: inputMaxDate, weekStartDay = 'monday', locale = 'ru-RU', displayLeadingZero = false, onChange, badges = [], markToday = true, weekDayLabelFormat = 'short', accentColor = 'primary', defaultValue, value: inputValue, initialView: inputInitialView, view: inputView, views: inputViews, resetButtonLabel, todayButtonLabel, heading, subheading, footer, overrides, range = false, prevButtonLabel = 'Previous', nextButtonLabel = 'Next', } = props;
|
|
121
120
|
/**
|
|
122
121
|
* Validations
|
|
123
122
|
*/
|
|
@@ -20,7 +20,7 @@ const StyledCalendarPaper = styled.div `
|
|
|
20
20
|
justify-content: stretch;
|
|
21
21
|
background-color: ${({ theme }) => theme.color.surface.toString()};
|
|
22
22
|
border-radius: ${({ theme }) => theme.shape.radiusFactor}em;
|
|
23
|
-
box-shadow: ${({ theme }) => elevation(theme, 'popup'
|
|
23
|
+
box-shadow: ${({ theme }) => elevation(theme, 'popup')};
|
|
24
24
|
`;
|
|
25
25
|
const CalendarPaper = (props, ref) => {
|
|
26
26
|
const { children } = props, restProps = __rest(props, ["children"]);
|
|
@@ -13,7 +13,7 @@ import React from 'react';
|
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
14
|
import { css } from '@emotion/react';
|
|
15
15
|
import useCheckboxColor from './useCheckboxColor';
|
|
16
|
-
import { themeFocusRing } from '../ThemeProvider/tokens';
|
|
16
|
+
import { themeFocusRing, BORDER_WIDTH } from '../ThemeProvider/tokens';
|
|
17
17
|
const Root = styled.span `
|
|
18
18
|
position: relative;
|
|
19
19
|
display: inline-flex;
|
|
@@ -44,7 +44,7 @@ const Square = styled.span `
|
|
|
44
44
|
display: flex;
|
|
45
45
|
width: 100%;
|
|
46
46
|
height: 100%;
|
|
47
|
-
border-width:
|
|
47
|
+
border-width: ${BORDER_WIDTH};
|
|
48
48
|
border-style: solid;
|
|
49
49
|
/* Scaled down: the square is small, the full radius would turn it into a circle */
|
|
50
50
|
border-radius: ${({ theme }) => theme.shape.radiusFactor * 0.6}em;
|
package/esm/Checkbox/index.js
CHANGED
|
@@ -17,9 +17,8 @@ import Icon from './CheckboxIcon';
|
|
|
17
17
|
import TextWrapper from './CheckboxTextWrapper';
|
|
18
18
|
import Asterisk from './CheckboxAsterisk';
|
|
19
19
|
import ErrorText from './CheckboxErrorText';
|
|
20
|
-
import useThemeProps from '../ThemeProvider/useThemeProps';
|
|
21
20
|
const Checkbox = (props, ref) => {
|
|
22
|
-
const
|
|
21
|
+
const { checked, defaultChecked, onChange, indeterminate = false, disabled, color, labelPosition, error, errorText, requiredAsterisk, overrides, children, className, style } = props, nativeProps = __rest(props, ["checked", "defaultChecked", "onChange", "indeterminate", "disabled", "color", "labelPosition", "error", "errorText", "requiredAsterisk", "overrides", "children", "className", "style"]);
|
|
23
22
|
const inputRef = React.useRef(null);
|
|
24
23
|
const [internalChecked, setInternalChecked] = React.useState(Boolean(defaultChecked));
|
|
25
24
|
const isControlled = typeof checked !== 'undefined';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import getElementRef from '../utils/getElementRef';
|
|
2
3
|
export const mouseEventMap = {
|
|
3
4
|
onClick: 'click',
|
|
4
5
|
onMouseDown: 'mousedown',
|
|
@@ -37,7 +38,7 @@ const ClickOutside = props => {
|
|
|
37
38
|
};
|
|
38
39
|
}, [onOutsideClick, mouseEvent]);
|
|
39
40
|
// Keep the child's own ref working alongside ours
|
|
40
|
-
const childRef = children
|
|
41
|
+
const childRef = getElementRef(children);
|
|
41
42
|
const setRef = React.useCallback((el) => {
|
|
42
43
|
ref.current = el;
|
|
43
44
|
if (typeof childRef === 'function') {
|
|
@@ -47,6 +48,8 @@ const ClickOutside = props => {
|
|
|
47
48
|
childRef.current = el;
|
|
48
49
|
}
|
|
49
50
|
}, [childRef]);
|
|
50
|
-
return React.createElement(React.Fragment, null, React.cloneElement(children, {
|
|
51
|
+
return (React.createElement(React.Fragment, null, React.cloneElement(children, {
|
|
52
|
+
ref: setRef,
|
|
53
|
+
})));
|
|
51
54
|
};
|
|
52
55
|
export default ClickOutside;
|
package/esm/Grid/index.js
CHANGED
|
@@ -12,6 +12,10 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
14
|
import { resolveSpacing } from '../utils/spacing';
|
|
15
|
+
/**
|
|
16
|
+
* The lists are the rows of the elements here: no default margins and markers
|
|
17
|
+
*/
|
|
18
|
+
const LIST_TAGS = ['ul', 'ol', 'dl'];
|
|
15
19
|
const StyledGrid = styled.div `
|
|
16
20
|
display: grid;
|
|
17
21
|
grid-template-columns: ${({ $template }) => $template};
|
|
@@ -19,6 +23,7 @@ const StyledGrid = styled.div `
|
|
|
19
23
|
${({ theme, $rowGap }) => typeof $rowGap !== 'undefined' ? `row-gap: ${resolveSpacing(theme, $rowGap)};` : ''}
|
|
20
24
|
align-items: ${({ $align }) => $align !== null && $align !== void 0 ? $align : 'stretch'};
|
|
21
25
|
min-width: 0;
|
|
26
|
+
${({ $isList }) => ($isList ? 'margin: 0; padding: 0; list-style: none;' : '')}
|
|
22
27
|
`;
|
|
23
28
|
const getTemplate = (minColumnWidth, columns) => {
|
|
24
29
|
if (minColumnWidth) {
|
|
@@ -32,7 +37,7 @@ const getTemplate = (minColumnWidth, columns) => {
|
|
|
32
37
|
* The grid of cells with the same gap. The children are the cells: no wrappers for the items
|
|
33
38
|
*/
|
|
34
39
|
const Grid = (props, ref) => {
|
|
35
|
-
const { children, minColumnWidth, columns = 1, gap = 'md', rowGap, align } = props, nativeProps = __rest(props, ["children", "minColumnWidth", "columns", "gap", "rowGap", "align"]);
|
|
36
|
-
return (React.createElement(StyledGrid, Object.assign({}, nativeProps, { "$template": getTemplate(minColumnWidth, columns), "$gap": gap, "$rowGap": rowGap, "$align": align, ref: ref }), children));
|
|
40
|
+
const { children, minColumnWidth, columns = 1, gap = 'md', rowGap, align, as } = props, nativeProps = __rest(props, ["children", "minColumnWidth", "columns", "gap", "rowGap", "align", "as"]);
|
|
41
|
+
return (React.createElement(StyledGrid, Object.assign({}, nativeProps, { "$template": getTemplate(minColumnWidth, columns), "$gap": gap, "$rowGap": rowGap, "$align": align, "$isList": Boolean(as && LIST_TAGS.includes(as)), as: as, ref: ref }), children));
|
|
37
42
|
};
|
|
38
43
|
export default React.forwardRef(Grid);
|
package/esm/Highlighted/index.js
CHANGED
|
@@ -14,13 +14,12 @@ import React from 'react';
|
|
|
14
14
|
import Container from './HighlightedContainer';
|
|
15
15
|
import Mark from './HighlightedMark';
|
|
16
16
|
import Text from './HighlightedText';
|
|
17
|
-
import useThemeProps from '../ThemeProvider/useThemeProps';
|
|
18
17
|
export const escapeRegex = (pattern) => pattern.replace(/[/\-\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
19
18
|
/**
|
|
20
19
|
* The component allows you to highlight text matches in a string
|
|
21
20
|
*/
|
|
22
21
|
const Highlighted = (props, ref) => {
|
|
23
|
-
const
|
|
22
|
+
const { text, highlight, overrides, disabledHighlighting = false, caseSensitive = false } = props, nativeProps = __rest(props, ["text", "highlight", "overrides", "disabledHighlighting", "caseSensitive"]);
|
|
24
23
|
const patterns = React.useMemo(() => (typeof highlight === 'string' ? [highlight] : highlight)
|
|
25
24
|
.filter(h => h.trim() !== '')
|
|
26
25
|
// Longest first: the alternation takes the first matching pattern,
|
|
@@ -3,7 +3,6 @@ import useContext, { actionSetmenuState } from './context';
|
|
|
3
3
|
import List from './MenuList';
|
|
4
4
|
import Popper from '../Popper';
|
|
5
5
|
import ClickOutside from '../ClickOutside';
|
|
6
|
-
import useThemeProps from '../ThemeProvider/useThemeProps';
|
|
7
6
|
const onRequestCloseDefault = () => undefined;
|
|
8
7
|
const isEqual = (a, b) => {
|
|
9
8
|
if (a === b) {
|
|
@@ -19,7 +18,7 @@ const isEqual = (a, b) => {
|
|
|
19
18
|
return keysA.every(key => Object.prototype.hasOwnProperty.call(b, key) && a[key] === b[key]);
|
|
20
19
|
};
|
|
21
20
|
const MenuContainer = React.forwardRef((props, ref) => {
|
|
22
|
-
const { items, value, anchorElement = null, overrides, children, closeOutsideClick = true, closeOnAnchorClick = false, isOpen = false, anchorPos = 'bottom', alternativePlacements = ['bottom', 'top'], positionStrategy, autoFlip, viewportMargin, offset, multiple = false, autofocus = true, closeOnSelect = !multiple, onRequestClose = onRequestCloseDefault, onAnchorPosChanged, zIndex, onSelectItem, getOptionSelected, maxWidth, } =
|
|
21
|
+
const { items, value, anchorElement = null, overrides, children, closeOutsideClick = true, closeOnAnchorClick = false, isOpen = false, anchorPos = 'bottom', alternativePlacements = ['bottom', 'top'], positionStrategy, autoFlip, viewportMargin, offset, multiple = false, autofocus = true, closeOnSelect = !multiple, onRequestClose = onRequestCloseDefault, onAnchorPosChanged, zIndex, onSelectItem, getOptionSelected, maxWidth, } = props;
|
|
23
22
|
const overridesMap = React.useMemo(() => ({
|
|
24
23
|
List: (overrides === null || overrides === void 0 ? void 0 : overrides.List) || List,
|
|
25
24
|
Popper: (overrides === null || overrides === void 0 ? void 0 : overrides.Popper) || Popper,
|
|
@@ -28,7 +27,7 @@ const MenuContainer = React.forwardRef((props, ref) => {
|
|
|
28
27
|
const menuPopperRef = React.useRef(null);
|
|
29
28
|
// Starts as `false` so that a menu mounted in the open state is focused and scrolled too
|
|
30
29
|
const isOpenRef = React.useRef(false);
|
|
31
|
-
const focusTimeoutRef = React.useRef();
|
|
30
|
+
const focusTimeoutRef = React.useRef(undefined);
|
|
32
31
|
// Whether the focus is inside the list: then it is returned to the anchor on close
|
|
33
32
|
const hasFocusRef = React.useRef(false);
|
|
34
33
|
// The parent often resets the anchor together with isOpen, so the last one is kept
|
package/esm/Menu/MenuItem.js
CHANGED
|
@@ -12,12 +12,16 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
14
|
import { css } from '@emotion/react';
|
|
15
|
+
import { themePadding } from '../ThemeProvider/tokens';
|
|
15
16
|
const StyledMenuItem = styled.div `
|
|
16
17
|
cursor: pointer;
|
|
17
18
|
user-select: none;
|
|
18
19
|
display: flex;
|
|
19
20
|
align-items: center;
|
|
20
|
-
padding:
|
|
21
|
+
padding: ${({ theme }) => {
|
|
22
|
+
const { y, x } = themePadding(theme, 'item');
|
|
23
|
+
return `${y} ${x}`;
|
|
24
|
+
}};
|
|
21
25
|
transition: all 240ms ease-out;
|
|
22
26
|
border-radius: ${({ theme }) => theme.shape.radiusFactor}em;
|
|
23
27
|
background-color: ${({ theme, selected, hovered }) => {
|
package/esm/Menu/MenuList.js
CHANGED
|
@@ -20,7 +20,7 @@ const StyledMenuList = styled.div `
|
|
|
20
20
|
opacity: ${props => (props.$isOpen ? 1 : 0)};
|
|
21
21
|
background-color: ${({ theme }) => theme.color.surface.toString()};
|
|
22
22
|
border-radius: ${({ theme }) => theme.shape.radiusFactor * 2}em;
|
|
23
|
-
box-shadow: ${({ theme }) => elevation(theme, 'popup'
|
|
23
|
+
box-shadow: ${({ theme }) => elevation(theme, 'popup')};
|
|
24
24
|
|
|
25
25
|
${({ $maxWidth }) => {
|
|
26
26
|
if (typeof $maxWidth === 'number') {
|
|
@@ -12,6 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
14
|
import { css } from '@emotion/react';
|
|
15
|
+
import { elevation } from '../../ThemeProvider/tokens';
|
|
15
16
|
const StyledModalInner = styled.div `
|
|
16
17
|
opacity: 0;
|
|
17
18
|
z-index: ${({ theme }) => theme.zIndex.modal};
|
|
@@ -19,6 +20,7 @@ const StyledModalInner = styled.div `
|
|
|
19
20
|
pointer-events: all;
|
|
20
21
|
position: relative;
|
|
21
22
|
background-color: ${({ theme }) => theme.color.surface.toString()};
|
|
23
|
+
box-shadow: ${({ theme }) => elevation(theme, 'popup')};
|
|
22
24
|
border-radius: ${({ theme }) => theme.shape.radiusFactor * 2}em;
|
|
23
25
|
margin-top: 2em;
|
|
24
26
|
transition:
|
|
@@ -6,6 +6,32 @@ import TabManager from '../../utils/TabManager';
|
|
|
6
6
|
* Count of the modals which lock the body scroll
|
|
7
7
|
*/
|
|
8
8
|
let bodyLocksCount = 0;
|
|
9
|
+
const SCROLL_WIDTH_PROPERTY = '--modal-scroll-width';
|
|
10
|
+
/**
|
|
11
|
+
* The first modal hides the scrollbar of the page and puts the margin of the same width instead,
|
|
12
|
+
* so the page does not move. The width is measured before the scrollbar is hidden:
|
|
13
|
+
* the scrollbar of the window, not of the body (`0` for the overlay scrollbars)
|
|
14
|
+
*/
|
|
15
|
+
const lockPageScroll = () => {
|
|
16
|
+
var _a;
|
|
17
|
+
if (bodyLocksCount === 0) {
|
|
18
|
+
const scrollWidth = Math.max(window.innerWidth - window.document.documentElement.clientWidth, 0);
|
|
19
|
+
window.document.documentElement.style.setProperty(SCROLL_WIDTH_PROPERTY, `${scrollWidth}px`);
|
|
20
|
+
(_a = window.document.body) === null || _a === void 0 ? void 0 : _a.classList.add('-modal-over');
|
|
21
|
+
}
|
|
22
|
+
bodyLocksCount += 1;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* The last modal returns the scrollbar of the page
|
|
26
|
+
*/
|
|
27
|
+
const unlockPageScroll = () => {
|
|
28
|
+
var _a;
|
|
29
|
+
bodyLocksCount = Math.max(0, bodyLocksCount - 1);
|
|
30
|
+
if (bodyLocksCount === 0) {
|
|
31
|
+
(_a = window.document.body) === null || _a === void 0 ? void 0 : _a.classList.remove('-modal-over');
|
|
32
|
+
window.document.documentElement.style.removeProperty(SCROLL_WIDTH_PROPERTY);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
9
35
|
const ModalWrapper = props => {
|
|
10
36
|
const { children, isOpen: isOpenProp, autofocus = true } = props;
|
|
11
37
|
const { state, dispatch } = useContext();
|
|
@@ -29,46 +55,16 @@ const ModalWrapper = props => {
|
|
|
29
55
|
}
|
|
30
56
|
};
|
|
31
57
|
}, [isOpen, autofocus]);
|
|
32
|
-
const getScrollWidth = React.useCallback(() => {
|
|
33
|
-
var _a;
|
|
34
|
-
const outer = window.document.createElement('div');
|
|
35
|
-
const inner = window.document.createElement('div');
|
|
36
|
-
const isVerticalScrollbar = window.document.body.scrollHeight > window.document.body.clientHeight;
|
|
37
|
-
if (!isVerticalScrollbar) {
|
|
38
|
-
return 0;
|
|
39
|
-
}
|
|
40
|
-
let widthNoScroll = 0;
|
|
41
|
-
let widthWithScroll = 0;
|
|
42
|
-
outer.style.visibility = 'hidden';
|
|
43
|
-
outer.style.width = '100px';
|
|
44
|
-
window.document.body.appendChild(outer);
|
|
45
|
-
widthNoScroll = outer.offsetWidth;
|
|
46
|
-
// force scrollbars
|
|
47
|
-
outer.style.overflow = 'scroll';
|
|
48
|
-
// add innerdiv
|
|
49
|
-
inner.style.width = '100%';
|
|
50
|
-
outer.appendChild(inner);
|
|
51
|
-
widthWithScroll = inner.offsetWidth;
|
|
52
|
-
// remove div
|
|
53
|
-
(_a = outer.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(outer);
|
|
54
|
-
return widthNoScroll - widthWithScroll;
|
|
55
|
-
}, []);
|
|
56
58
|
const lockBody = React.useCallback(() => {
|
|
57
|
-
var _a;
|
|
58
59
|
if (!bodyLockedRef.current) {
|
|
59
60
|
bodyLockedRef.current = true;
|
|
60
|
-
|
|
61
|
-
(_a = window.document.body) === null || _a === void 0 ? void 0 : _a.classList.add('-modal-over');
|
|
61
|
+
lockPageScroll();
|
|
62
62
|
}
|
|
63
63
|
}, []);
|
|
64
64
|
const unlockBody = React.useCallback(() => {
|
|
65
|
-
var _a;
|
|
66
65
|
if (bodyLockedRef.current) {
|
|
67
66
|
bodyLockedRef.current = false;
|
|
68
|
-
|
|
69
|
-
if (bodyLocksCount === 0) {
|
|
70
|
-
(_a = window.document.body) === null || _a === void 0 ? void 0 : _a.classList.remove('-modal-over');
|
|
71
|
-
}
|
|
67
|
+
unlockPageScroll();
|
|
72
68
|
}
|
|
73
69
|
}, []);
|
|
74
70
|
/**
|
|
@@ -160,13 +156,10 @@ const ModalWrapper = props => {
|
|
|
160
156
|
return React.useMemo(() => isMounted ? (React.createElement("div", { ref: containerRef, tabIndex: -1, id: id },
|
|
161
157
|
children,
|
|
162
158
|
React.createElement(Global, { styles: css `
|
|
163
|
-
:root {
|
|
164
|
-
--modal-scroll-width: ${getScrollWidth()}px;
|
|
165
|
-
}
|
|
166
159
|
body.-modal-over {
|
|
167
160
|
overflow: hidden;
|
|
168
|
-
margin-right: var(
|
|
161
|
+
margin-right: var(${SCROLL_WIDTH_PROPERTY}, 0px);
|
|
169
162
|
}
|
|
170
|
-
` }))) : null, [children,
|
|
163
|
+
` }))) : null, [children, isMounted, id]);
|
|
171
164
|
};
|
|
172
165
|
export default ModalWrapper;
|
|
@@ -7,9 +7,8 @@ import InnerContainer from './ModalInnerContainer';
|
|
|
7
7
|
import ModalWrapper from './ModalWrapper';
|
|
8
8
|
import RenderModal from './RenderModal';
|
|
9
9
|
import NoSSR from '../../NoSSR';
|
|
10
|
-
import useThemeProps from '../../ThemeProvider/useThemeProps';
|
|
11
10
|
const BaseModal = props => {
|
|
12
|
-
const { isOpen, children, overrides, autofocus = true, closeOnOverlayClick = defaultState.closeOnOverlayClick, closeOnEscape = defaultState.closeOnEscape, destroyTimeout = defaultState.destroyTimeout, onRequestClose, } =
|
|
11
|
+
const { isOpen, children, overrides, autofocus = true, closeOnOverlayClick = defaultState.closeOnOverlayClick, closeOnEscape = defaultState.closeOnEscape, destroyTimeout = defaultState.destroyTimeout, onRequestClose, } = props;
|
|
13
12
|
const [domLoaded, setDomLoaded] = React.useState(false);
|
|
14
13
|
const overridesMap = React.useMemo(() => ({
|
|
15
14
|
Overlay: (overrides === null || overrides === void 0 ? void 0 : overrides.Overlay) || Overlay,
|
|
@@ -11,9 +11,13 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
|
+
import { themePadding } from '../../ThemeProvider/tokens';
|
|
14
15
|
const StyledConfirmBoxContent = styled.div `
|
|
15
16
|
flex: 1;
|
|
16
|
-
padding:
|
|
17
|
+
padding: ${({ theme }) => {
|
|
18
|
+
const { y, x } = themePadding(theme, 'container');
|
|
19
|
+
return `${y} ${x}`;
|
|
20
|
+
}};
|
|
17
21
|
`;
|
|
18
22
|
const ConfirmBoxContent = (props, ref) => {
|
|
19
23
|
const { children, dialogID } = props, nativeProps = __rest(props, ["children", "dialogID"]);
|
|
@@ -12,11 +12,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
14
|
import Button from '../../Button';
|
|
15
|
+
import { themePadding } from '../../ThemeProvider/tokens';
|
|
15
16
|
const StyledConfirmBoxFooter = styled.div `
|
|
16
17
|
display: flex;
|
|
17
18
|
justify-content: flex-end;
|
|
18
19
|
align-items: center;
|
|
19
|
-
padding:
|
|
20
|
+
padding: ${({ theme }) => {
|
|
21
|
+
const { y, x } = themePadding(theme, 'container');
|
|
22
|
+
return `${y} ${x}`;
|
|
23
|
+
}};
|
|
20
24
|
|
|
21
25
|
& > button {
|
|
22
26
|
border-radius: 0;
|
|
@@ -11,8 +11,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
|
+
import { themePadding } from '../../ThemeProvider/tokens';
|
|
14
15
|
const StyedConfirmBoxHeader = styled.div `
|
|
15
|
-
padding:
|
|
16
|
+
padding: ${({ theme }) => {
|
|
17
|
+
const { y, x } = themePadding(theme, 'container');
|
|
18
|
+
return `${y} ${x} 0 ${x}`;
|
|
19
|
+
}};
|
|
16
20
|
`;
|
|
17
21
|
const ConfirmBoxTitle = styled.div `
|
|
18
22
|
font-size: 1.4rem;
|
|
@@ -17,9 +17,8 @@ import Footer from './ConfirmBoxFooter';
|
|
|
17
17
|
import Header from './ConfirmBoxHeader';
|
|
18
18
|
import Overlay from '../BaseModal/ModalOverlay';
|
|
19
19
|
import useDialogID from '../BaseModal/useDialogID';
|
|
20
|
-
import useThemeProps from '../../ThemeProvider/useThemeProps';
|
|
21
20
|
const ConfirmBox = props => {
|
|
22
|
-
const
|
|
21
|
+
const { header, children, onRequestYes, onRequestClose, overrides, isOpen, dismissButtonLabel, confirmButtonLabel } = props, otherProps = __rest(props, ["header", "children", "onRequestYes", "onRequestClose", "overrides", "isOpen", "dismissButtonLabel", "confirmButtonLabel"]);
|
|
23
22
|
const dialogID = useDialogID('dialog-confirm');
|
|
24
23
|
const overridesMap = React.useMemo(() => ({
|
|
25
24
|
Container: (overrides === null || overrides === void 0 ? void 0 : overrides.Container) || Container,
|
|
@@ -12,8 +12,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
14
|
import BaseModalInner from '../BaseModal/ModalInner';
|
|
15
|
+
import { themePadding } from '../../ThemeProvider/tokens';
|
|
15
16
|
const StyledDialogInner = styled(BaseModalInner) `
|
|
16
|
-
padding:
|
|
17
|
+
padding: ${({ theme }) => {
|
|
18
|
+
const { y, x } = themePadding(theme, 'container');
|
|
19
|
+
return `${y} ${x}`;
|
|
20
|
+
}};
|
|
17
21
|
`;
|
|
18
22
|
const DialogInner = (props, ref) => {
|
|
19
23
|
const { children, dialogID } = props, restProps = __rest(props, ["children", "dialogID"]);
|
|
@@ -13,9 +13,8 @@ import * as React from 'react';
|
|
|
13
13
|
import BaseModal from '../BaseModal';
|
|
14
14
|
import DialogInner from './DialogInner';
|
|
15
15
|
import useDialogID from '../BaseModal/useDialogID';
|
|
16
|
-
import useThemeProps from '../../ThemeProvider/useThemeProps';
|
|
17
16
|
const Dialog = props => {
|
|
18
|
-
const
|
|
17
|
+
const { children, overrides } = props, restProps = __rest(props, ["children", "overrides"]);
|
|
19
18
|
const dialogID = useDialogID('dialog');
|
|
20
19
|
// Created once: a component created during the render is a new type on every render,
|
|
21
20
|
// so React would remount the whole dialog content (inputs lose the focus and the state)
|
|
@@ -11,8 +11,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
|
+
import { themePadding } from '../../ThemeProvider/tokens';
|
|
14
15
|
const StyledDrawerFooter = styled.div `
|
|
15
|
-
padding:
|
|
16
|
+
padding: ${({ theme }) => {
|
|
17
|
+
const { y, x } = themePadding(theme, 'container');
|
|
18
|
+
return `calc(${y} / 2) ${x}`;
|
|
19
|
+
}};
|
|
16
20
|
`;
|
|
17
21
|
const DrawerFooter = (props, ref) => {
|
|
18
22
|
const { children } = props, nativeProps = __rest(props, ["children"]);
|
|
@@ -14,8 +14,12 @@ import styled from '@emotion/styled';
|
|
|
14
14
|
import Span from '../../Typography/Span';
|
|
15
15
|
import DrawerCloseIcon from './DrawerCloseIcon';
|
|
16
16
|
import Button from '../../Button';
|
|
17
|
+
import { themePadding } from '../../ThemeProvider/tokens';
|
|
17
18
|
const StyledDrawerHeader = styled.div `
|
|
18
|
-
padding:
|
|
19
|
+
padding: ${({ theme }) => {
|
|
20
|
+
const { y, x } = themePadding(theme, 'container');
|
|
21
|
+
return `${y} ${x}`;
|
|
22
|
+
}};
|
|
19
23
|
display: flex;
|
|
20
24
|
align-items: center;
|
|
21
25
|
justify-content: space-between;
|
|
@@ -18,9 +18,8 @@ import Content from './DrawerContent';
|
|
|
18
18
|
import Footer from './DrawerFooter';
|
|
19
19
|
import Overlay from '../BaseModal/ModalOverlay';
|
|
20
20
|
import useDialogID from '../BaseModal/useDialogID';
|
|
21
|
-
import useThemeProps from '../../ThemeProvider/useThemeProps';
|
|
22
21
|
const Drawer = props => {
|
|
23
|
-
const
|
|
22
|
+
const { children, onRequestClose, showCloseButton, header, closeButtonLabel, anchor, toolbar, footer, overrides } = props, otherProps = __rest(props, ["children", "onRequestClose", "showCloseButton", "header", "closeButtonLabel", "anchor", "toolbar", "footer", "overrides"]);
|
|
24
23
|
const hasFooter = React.useMemo(() => typeof footer !== 'undefined' && footer !== null, [footer]);
|
|
25
24
|
const hasHeader = React.useMemo(() => typeof header !== 'undefined' ||
|
|
26
25
|
typeof toolbar !== 'undefined' ||
|
|
@@ -11,9 +11,13 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
|
+
import { themePadding } from '../../ThemeProvider/tokens';
|
|
14
15
|
const Content = styled.div `
|
|
15
16
|
flex: 1;
|
|
16
|
-
padding:
|
|
17
|
+
padding: ${({ theme }) => {
|
|
18
|
+
const { y, x } = themePadding(theme, 'container');
|
|
19
|
+
return `${y} ${x}`;
|
|
20
|
+
}};
|
|
17
21
|
`;
|
|
18
22
|
const MessageBoxContent = (props, ref) => {
|
|
19
23
|
const { children, dialogID } = props, nativeProps = __rest(props, ["children", "dialogID"]);
|
|
@@ -12,11 +12,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
14
|
import Button from '../../Button';
|
|
15
|
+
import { themePadding } from '../../ThemeProvider/tokens';
|
|
15
16
|
const Footer = styled.div `
|
|
16
17
|
display: flex;
|
|
17
18
|
justify-content: flex-end;
|
|
18
19
|
align-items: center;
|
|
19
|
-
padding:
|
|
20
|
+
padding: ${({ theme }) => {
|
|
21
|
+
const { y, x } = themePadding(theme, 'container');
|
|
22
|
+
return `${y} ${x}`;
|
|
23
|
+
}};
|
|
20
24
|
|
|
21
25
|
& > button {
|
|
22
26
|
border-radius: 0;
|
|
@@ -11,8 +11,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
|
+
import { themePadding } from '../../ThemeProvider/tokens';
|
|
14
15
|
const Header = styled.div `
|
|
15
|
-
padding:
|
|
16
|
+
padding: ${({ theme }) => {
|
|
17
|
+
const { y, x } = themePadding(theme, 'container');
|
|
18
|
+
return `${y} ${x} 0 ${x}`;
|
|
19
|
+
}};
|
|
16
20
|
`;
|
|
17
21
|
const HeaderTitle = styled.div `
|
|
18
22
|
font-size: 1.4rem;
|