@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
package/esm/Switch/SwitchDot.js
CHANGED
|
@@ -12,6 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
14
|
import useSwitchColor from './useSwitchColor';
|
|
15
|
+
import { elevation } from '../ThemeProvider/tokens';
|
|
15
16
|
const ToggleContainer = styled.span `
|
|
16
17
|
display: inline-flex;
|
|
17
18
|
align-items: center;
|
|
@@ -36,10 +37,7 @@ const Dot = styled.span `
|
|
|
36
37
|
width: 1.4rem;
|
|
37
38
|
height: 1.4rem;
|
|
38
39
|
border-radius: 50%;
|
|
39
|
-
box-shadow:
|
|
40
|
-
rgba(0, 0, 0, 0.2) 0px 2px 1px -1px,
|
|
41
|
-
rgba(0, 0, 0, 0.14) 0px 1px 1px 0px,
|
|
42
|
-
rgba(0, 0, 0, 0.12) 0px 1px 3px 0px;
|
|
40
|
+
box-shadow: ${({ theme }) => elevation(theme, 'control')};
|
|
43
41
|
background-color: ${({ $color, $checked, theme }) => {
|
|
44
42
|
switch (true) {
|
|
45
43
|
case $checked:
|
package/esm/Switch/index.js
CHANGED
|
@@ -18,9 +18,8 @@ import Track from './SwitchTrack';
|
|
|
18
18
|
import Wrapper from './SwitchWrapper';
|
|
19
19
|
import ErrorText from './SwitchErrorText';
|
|
20
20
|
import Asterisk from './SwitchAsterisk';
|
|
21
|
-
import useThemeProps from '../ThemeProvider/useThemeProps';
|
|
22
21
|
const Switch = (props, ref) => {
|
|
23
|
-
const
|
|
22
|
+
const { checked, onChange, defaultChecked, overrides, disabled, labelPosition, children, color, name, error, errorText, requiredAsterisk } = props, nativeProps = __rest(props, ["checked", "onChange", "defaultChecked", "overrides", "disabled", "labelPosition", "children", "color", "name", "error", "errorText", "requiredAsterisk"]);
|
|
24
23
|
const [internalChecked, setInternalChecked] = React.useState(typeof defaultChecked !== 'undefined' ? defaultChecked : false);
|
|
25
24
|
const overridesMap = React.useMemo(() => ({
|
|
26
25
|
TextWrapper: (overrides === null || overrides === void 0 ? void 0 : overrides.TextWrapper) || TextWrapper,
|
package/esm/Table/Table.js
CHANGED
|
@@ -26,7 +26,7 @@ const StyledTable = styled.table `
|
|
|
26
26
|
overflow: hidden;
|
|
27
27
|
background: ${({ theme }) => theme.color.surface.toString()};
|
|
28
28
|
color: ${({ theme }) => theme.color.textPrimary.toString()};
|
|
29
|
-
box-shadow: ${({ theme }) => elevation(theme, 'surface'
|
|
29
|
+
box-shadow: ${({ theme }) => elevation(theme, 'surface')};
|
|
30
30
|
border-radius: ${({ theme }) => theme.shape.radiusFactor}em;
|
|
31
31
|
font-size: 1em;
|
|
32
32
|
${({ $fullWidth }) => $fullWidth &&
|
|
@@ -11,9 +11,13 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
|
+
import { themePadding } from '../ThemeProvider/tokens';
|
|
14
15
|
const StyledTableCaption = styled.caption `
|
|
15
16
|
text-align: start;
|
|
16
|
-
padding:
|
|
17
|
+
padding: ${({ theme }) => {
|
|
18
|
+
const { y, x } = themePadding(theme, 'item', 1.2);
|
|
19
|
+
return `${y} ${x}`;
|
|
20
|
+
}};
|
|
17
21
|
font-size: 1.2em;
|
|
18
22
|
font-weight: 700;
|
|
19
23
|
`;
|
package/esm/Table/TableCell.js
CHANGED
|
@@ -11,10 +11,14 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
|
+
import { themePadding, BORDER_WIDTH } from '../ThemeProvider/tokens';
|
|
14
15
|
const StyledTableCell = styled.td `
|
|
15
16
|
vertical-align: inherit;
|
|
16
|
-
padding:
|
|
17
|
-
|
|
17
|
+
padding: ${({ theme }) => {
|
|
18
|
+
const { y, x } = themePadding(theme, 'item');
|
|
19
|
+
return `${y} ${x}`;
|
|
20
|
+
}};
|
|
21
|
+
border-bottom: ${BORDER_WIDTH} solid ${({ theme }) => theme.color.surface.darken(20).toString()};
|
|
18
22
|
`;
|
|
19
23
|
const TableCell = (props, ref) => {
|
|
20
24
|
const { children } = props, nativeProps = __rest(props, ["children"]);
|
package/esm/Table/TableFooter.js
CHANGED
|
@@ -11,6 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
|
+
import { BORDER_WIDTH } from '../ThemeProvider/tokens';
|
|
14
15
|
const StyledTableFooter = styled.tfoot `
|
|
15
16
|
vertical-align: middle;
|
|
16
17
|
|
|
@@ -22,7 +23,7 @@ const StyledTableFooter = styled.tfoot `
|
|
|
22
23
|
|
|
23
24
|
& > tr:first-of-type > th,
|
|
24
25
|
& > tr:first-of-type > td {
|
|
25
|
-
border-top:
|
|
26
|
+
border-top: ${BORDER_WIDTH} solid ${({ theme }) => theme.color.surface.darken(30).toString()};
|
|
26
27
|
}
|
|
27
28
|
`;
|
|
28
29
|
const TableFooter = (props, ref) => {
|
|
@@ -11,16 +11,20 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
|
+
import { themePadding, BORDER_WIDTH } from '../ThemeProvider/tokens';
|
|
14
15
|
/**
|
|
15
16
|
* The column header inside `<TableHeader>` or the row header (`scope="row"`) inside `<TableBody>`.
|
|
16
17
|
* The role (columnheader/rowheader) is implied by the position, so no explicit role
|
|
17
18
|
*/
|
|
18
19
|
const StyledTableHeaderCell = styled.th `
|
|
19
20
|
vertical-align: inherit;
|
|
20
|
-
padding:
|
|
21
|
+
padding: ${({ theme }) => {
|
|
22
|
+
const { y, x } = themePadding(theme, 'item');
|
|
23
|
+
return `${y} ${x}`;
|
|
24
|
+
}};
|
|
21
25
|
text-align: start;
|
|
22
26
|
font-weight: 600;
|
|
23
|
-
border-bottom:
|
|
27
|
+
border-bottom: ${BORDER_WIDTH} solid ${({ theme }) => theme.color.surface.darken(20).toString()};
|
|
24
28
|
`;
|
|
25
29
|
const TableHeaderCell = (props, ref) => {
|
|
26
30
|
const { children } = props, nativeProps = __rest(props, ["children"]);
|
package/esm/Tabs/Tab.js
CHANGED
|
@@ -13,7 +13,7 @@ import React from 'react';
|
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
14
|
import { css } from '@emotion/react';
|
|
15
15
|
import { useTabsContext } from './context';
|
|
16
|
-
import { themeFocusRing } from '../ThemeProvider/tokens';
|
|
16
|
+
import { themeFocusRing, themePadding } from '../ThemeProvider/tokens';
|
|
17
17
|
const StyledTab = styled.button `
|
|
18
18
|
position: relative;
|
|
19
19
|
display: inline-flex;
|
|
@@ -23,7 +23,10 @@ const StyledTab = styled.button `
|
|
|
23
23
|
flex-shrink: 0;
|
|
24
24
|
box-sizing: border-box;
|
|
25
25
|
margin: 0;
|
|
26
|
-
padding:
|
|
26
|
+
padding: ${({ theme }) => {
|
|
27
|
+
const { y, x } = themePadding(theme, 'item');
|
|
28
|
+
return `${y} ${x}`;
|
|
29
|
+
}};
|
|
27
30
|
border: 0;
|
|
28
31
|
background: none;
|
|
29
32
|
font: inherit;
|
package/esm/Tabs/Tabs.js
CHANGED
|
@@ -13,7 +13,6 @@ import React from 'react';
|
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
14
|
import { TabsContext } from './context';
|
|
15
15
|
import useTabsColor from './useTabsColor';
|
|
16
|
-
import useThemeProps from '../ThemeProvider/useThemeProps';
|
|
17
16
|
const StyledTabs = styled.div `
|
|
18
17
|
display: ${({ $orientation }) => ($orientation === 'vertical' ? 'flex' : 'block')};
|
|
19
18
|
align-items: flex-start;
|
|
@@ -23,7 +22,7 @@ const StyledTabs = styled.div `
|
|
|
23
22
|
*/
|
|
24
23
|
const escapeId = (value) => value.replace(/[^\w-]/g, char => `_${char.charCodeAt(0).toString(16)}`);
|
|
25
24
|
const Tabs = (props, ref) => {
|
|
26
|
-
const
|
|
25
|
+
const { value, defaultValue, onChange, orientation = 'horizontal', activation = 'auto', fullWidth = false, color, children } = props, nativeProps = __rest(props, ["value", "defaultValue", "onChange", "orientation", "activation", "fullWidth", "color", "children"]);
|
|
27
26
|
const isControlled = typeof value !== 'undefined';
|
|
28
27
|
const [internalValue, setInternalValue] = React.useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : null);
|
|
29
28
|
const currentValue = isControlled ? value : internalValue;
|
|
@@ -12,10 +12,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import * as React from 'react';
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
14
|
import { css } from '@emotion/react';
|
|
15
|
+
import { fieldPadding, FIELD_TEXT_SCALE } from '../ThemeProvider/tokens';
|
|
15
16
|
const TextareaNative = styled.textarea `
|
|
16
17
|
resize: none;
|
|
17
|
-
padding:
|
|
18
|
+
padding: ${({ theme }) => {
|
|
19
|
+
const { y, x } = fieldPadding(theme, FIELD_TEXT_SCALE);
|
|
20
|
+
return `${y} ${x}`;
|
|
21
|
+
}};
|
|
18
22
|
font-size: 1em;
|
|
23
|
+
line-height: inherit;
|
|
19
24
|
/* Form controls do not inherit the font by default (textarea is monospace) */
|
|
20
25
|
font-family: inherit;
|
|
21
26
|
background: none;
|
package/esm/TextArea/index.js
CHANGED
|
@@ -17,9 +17,8 @@ import InputWrapper from '../TextField/TextFieldInputWrapper';
|
|
|
17
17
|
import Input from '../TextArea/TextAreaInput';
|
|
18
18
|
import ErrorText from '../TextField/TextFieldErrorText';
|
|
19
19
|
import IconWrapper from './TextAreaIconWrapper';
|
|
20
|
-
import useThemeProps from '../ThemeProvider/useThemeProps';
|
|
21
20
|
const TextArea = (props, ref) => {
|
|
22
|
-
const
|
|
21
|
+
const { error, fullWidth, inputRef, label, id, errorText, className, style, endIcon, startIcon, requiredAsterisk, overrides, onChange, onFocus, onBlur } = props, nativeInputProps = __rest(props, ["error", "fullWidth", "inputRef", "label", "id", "errorText", "className", "style", "endIcon", "startIcon", "requiredAsterisk", "overrides", "onChange", "onFocus", "onBlur"]);
|
|
23
22
|
const [focused, setFocused] = React.useState(false);
|
|
24
23
|
// useId is stable between server and client renders
|
|
25
24
|
const generatedID = React.useId();
|
|
@@ -12,9 +12,14 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import * as React from 'react';
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
14
|
import { css } from '@emotion/react';
|
|
15
|
+
import { fieldPadding, FIELD_TEXT_SCALE } from '../ThemeProvider/tokens';
|
|
15
16
|
const Input = styled.input `
|
|
16
|
-
padding:
|
|
17
|
+
padding: ${({ theme }) => {
|
|
18
|
+
const { y, x } = fieldPadding(theme, FIELD_TEXT_SCALE);
|
|
19
|
+
return `${y} ${x}`;
|
|
20
|
+
}};
|
|
17
21
|
font-size: 1em;
|
|
22
|
+
line-height: inherit;
|
|
18
23
|
/* Form controls do not inherit the font by default (textarea is monospace) */
|
|
19
24
|
font-family: inherit;
|
|
20
25
|
background: none;
|
|
@@ -12,17 +12,20 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import * as React from 'react';
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
14
|
import { css } from '@emotion/react';
|
|
15
|
+
import { CONTROL_LINE_HEIGHT, FIELD_TEXT_SCALE, fieldBorder } from '../ThemeProvider/tokens';
|
|
15
16
|
const Wrapper = styled.div `
|
|
16
17
|
display: flex;
|
|
17
18
|
align-items: stretch;
|
|
18
19
|
border-radius: ${({ theme }) => theme.shape.radiusFactor * 2}em;
|
|
19
|
-
border:
|
|
20
|
+
border: ${fieldBorder(FIELD_TEXT_SCALE)} solid;
|
|
20
21
|
outline: 1px solid transparent;
|
|
21
22
|
border-color: ${({ theme }) => theme.isDark
|
|
22
23
|
? theme.color.textPrimary.darken(100).toString()
|
|
23
24
|
: theme.color.textPrimary.lighten(150).toString()};
|
|
24
25
|
width: ${({ $fullWidth }) => ($fullWidth ? '100%' : 'auto')};
|
|
25
|
-
font-size:
|
|
26
|
+
font-size: ${FIELD_TEXT_SCALE}em;
|
|
27
|
+
/* The line of the control: the field has the height of the button */
|
|
28
|
+
line-height: calc(${CONTROL_LINE_HEIGHT} / ${FIELD_TEXT_SCALE});
|
|
26
29
|
background-color: ${({ theme }) => theme.color.surface.toString()};
|
|
27
30
|
color: ${({ theme }) => theme.color.textPrimary.toString()};
|
|
28
31
|
transition: all 180ms ease-out 0s;
|
package/esm/TextField/index.js
CHANGED
|
@@ -17,7 +17,6 @@ import InputWrapper from './TextFieldInputWrapper';
|
|
|
17
17
|
import Input from './TextFieldInput';
|
|
18
18
|
import ErrorText from './TextFieldErrorText';
|
|
19
19
|
import IconWrapper from './TextFieldIconWrapper';
|
|
20
|
-
import useThemeProps from '../ThemeProvider/useThemeProps';
|
|
21
20
|
export * from './TextFieldContainer';
|
|
22
21
|
export * from './TextFieldLabel';
|
|
23
22
|
export * from './TextFieldLabelAsterisk';
|
|
@@ -35,7 +34,7 @@ const defailtOverrides = {
|
|
|
35
34
|
InputWrapper,
|
|
36
35
|
};
|
|
37
36
|
const TextField = React.forwardRef((props, ref) => {
|
|
38
|
-
const
|
|
37
|
+
const { error, fullWidth, inputRef, label, id, errorText, className, style, endIcon, startIcon, requiredAsterisk, overrides, onChange, onFocus, onBlur } = props, nativeInputProps = __rest(props, ["error", "fullWidth", "inputRef", "label", "id", "errorText", "className", "style", "endIcon", "startIcon", "requiredAsterisk", "overrides", "onChange", "onFocus", "onBlur"]);
|
|
39
38
|
const [focused, setFocused] = React.useState(false);
|
|
40
39
|
// useId is stable between server and client renders
|
|
41
40
|
const generatedID = React.useId();
|
|
@@ -11,10 +11,14 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import Color from '../Color';
|
|
13
13
|
export const createTheme = overrides => {
|
|
14
|
-
const _a = overrides || {}, { isDark, fontSize, zIndex, color, shape, spacing,
|
|
15
|
-
const theme = Object.assign(Object.assign({}, rest), { isDark: typeof isDark === 'boolean' ? isDark : false,
|
|
14
|
+
const _a = overrides || {}, { isDark, fontSize, zIndex, color, shape, spacing, padding, typography, focusRing, elevation } = _a, rest = __rest(_a, ["isDark", "fontSize", "zIndex", "color", "shape", "spacing", "padding", "typography", "focusRing", "elevation"]);
|
|
15
|
+
const theme = Object.assign(Object.assign({}, rest), { isDark: typeof isDark === 'boolean' ? isDark : false,
|
|
16
16
|
// Empty by default: the components keep their own fonts, focus and shadows
|
|
17
|
-
typography: Object.assign({}, typography), focusRing: Object.assign({}, focusRing), elevation: Object.assign({}, elevation), fontSize: Object.assign({ small: 14, normal: 16, medium: 18, large: 20 }, fontSize), zIndex: Object.assign({ header: 8, modal: 10 }, zIndex), color: {}, shape: Object.assign({ radiusFactor: 0.3 }, shape), spacing: Object.assign({ xs: '0.25em', sm: '0.5em', md: '1em', lg: '1.5em', xl: '2em' }, spacing)
|
|
17
|
+
typography: Object.assign({}, typography), focusRing: Object.assign({}, focusRing), elevation: Object.assign({}, elevation), fontSize: Object.assign({ small: 14, normal: 16, medium: 18, large: 20 }, fontSize), zIndex: Object.assign({ header: 8, modal: 10 }, zIndex), color: {}, shape: Object.assign({ radiusFactor: 0.3 }, shape), spacing: Object.assign({ xs: '0.25em', sm: '0.5em', md: '1em', lg: '1.5em', xl: '2em' }, spacing), padding: {
|
|
18
|
+
control: Object.assign({ y: '0.75em', x: '1em' }, padding === null || padding === void 0 ? void 0 : padding.control),
|
|
19
|
+
item: Object.assign({ y: '0.6em', x: '0.8em' }, padding === null || padding === void 0 ? void 0 : padding.item),
|
|
20
|
+
container: Object.assign({ y: '1em', x: '1em' }, padding === null || padding === void 0 ? void 0 : padding.container),
|
|
21
|
+
} });
|
|
18
22
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
19
23
|
/* @ts-ignore */
|
|
20
24
|
const defaultColors = {
|
|
@@ -2,8 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { ThemeProvider as EmotionProvider, useTheme } from '@emotion/react';
|
|
3
3
|
export { useTheme };
|
|
4
4
|
export * from './createTheme';
|
|
5
|
-
export * from './components';
|
|
6
|
-
export { default as useThemeProps } from './useThemeProps';
|
|
7
5
|
export * from './tokens';
|
|
8
6
|
const ThemeProvider = props => {
|
|
9
7
|
const { children, theme } = props;
|
|
@@ -21,6 +21,59 @@ export const themeFocusRing = (theme, selector = '&:focus-visible') => {
|
|
|
21
21
|
`;
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
|
-
* The
|
|
24
|
+
* The default shadows of the levels: the components of one level have the same shadow.
|
|
25
|
+
* In `px`, not in `em`: the tooltip and the toast have a smaller font, but the same shadow as the menu
|
|
25
26
|
*/
|
|
26
|
-
export const
|
|
27
|
+
export const defaultElevation = (theme) => ({
|
|
28
|
+
popup: `0 8px 24px ${theme.color.surface.darken(50).alpha(0.6).toString()}`,
|
|
29
|
+
surface: `0 8px 32px -13px ${theme.color.surface.darken(100).alpha(0.4).toString()}`,
|
|
30
|
+
control: `0 1px 3px ${theme.color.surface.darken(100).alpha(0.35).toString()}`,
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* The shadow of the level: the `elevation` of the theme or the default shadow of the level.
|
|
34
|
+
* `own` replaces the default shadow, the shadow of the theme wins over both
|
|
35
|
+
*/
|
|
36
|
+
export const elevation = (theme, level, own) => { var _a, _b; return (_b = (_a = theme.elevation[level]) !== null && _a !== void 0 ? _a : own) !== null && _b !== void 0 ? _b : defaultElevation(theme)[level]; };
|
|
37
|
+
/**
|
|
38
|
+
* The height of the text line in the controls, in the `em` of the control. Set as a length,
|
|
39
|
+
* the line height is inherited as is by the text of any size: the label of the button and the value of the field
|
|
40
|
+
*/
|
|
41
|
+
export const CONTROL_LINE_HEIGHT = '1.2em';
|
|
42
|
+
/**
|
|
43
|
+
* The width of the borders of the components: `1px` at the font size of `16px`.
|
|
44
|
+
* In `em`: the border grows together with the font, and at the usual sizes the browser draws `1px`
|
|
45
|
+
*/
|
|
46
|
+
export const BORDER_WIDTH = '0.0625em';
|
|
47
|
+
/**
|
|
48
|
+
* The border of the buttons. The standard and the plain buttons have no border:
|
|
49
|
+
* their padding is larger by this width, so all the variants have the same size
|
|
50
|
+
*/
|
|
51
|
+
export const CONTROL_BORDER = BORDER_WIDTH;
|
|
52
|
+
/**
|
|
53
|
+
* The size of the text in the fields (TextField, TextArea, Selectbox) relative to the control
|
|
54
|
+
*/
|
|
55
|
+
export const FIELD_TEXT_SCALE = 0.9;
|
|
56
|
+
/**
|
|
57
|
+
* The height of the one-line control: the icon buttons are squares of this size
|
|
58
|
+
*/
|
|
59
|
+
export const controlHeight = (theme) => `calc(${CONTROL_LINE_HEIGHT} + 2 * ${theme.padding.control.y} + 2 * ${CONTROL_BORDER})`;
|
|
60
|
+
/**
|
|
61
|
+
* The border of the field: the border of the buttons in the `em` of the field with the font size `fontScale`
|
|
62
|
+
*/
|
|
63
|
+
export const fieldBorder = (fontScale = 1) => `calc(${CONTROL_BORDER} / ${fontScale})`;
|
|
64
|
+
/**
|
|
65
|
+
* The padding of the field with the `fieldBorder`, so the field has the height of the button.
|
|
66
|
+
* `fontScale` is the font size of the element relative to the control: the `em` of the padding are its own
|
|
67
|
+
*/
|
|
68
|
+
export const fieldPadding = (theme, fontScale = 1) => themePadding(theme, 'control', fontScale);
|
|
69
|
+
/**
|
|
70
|
+
* The padding of the class for the element with its own font size.
|
|
71
|
+
* `fontScale` is the font size of the element relative to the parent: the padding is in the `em` of the parent,
|
|
72
|
+
* so the header with a larger font has the same padding as the content under it
|
|
73
|
+
*/
|
|
74
|
+
export const themePadding = (theme, kind, fontScale = 1) => {
|
|
75
|
+
const { y, x } = theme.padding[kind];
|
|
76
|
+
return fontScale === 1
|
|
77
|
+
? { y, x }
|
|
78
|
+
: { y: `calc(${y} / ${fontScale})`, x: `calc(${x} / ${fontScale})` };
|
|
79
|
+
};
|
package/esm/Toast/ToastCard.js
CHANGED
|
@@ -12,7 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
14
|
import { css, keyframes } from '@emotion/react';
|
|
15
|
-
import { themeFocusRing, elevation } from '../ThemeProvider/tokens';
|
|
15
|
+
import { themeFocusRing, elevation, themePadding } from '../ThemeProvider/tokens';
|
|
16
16
|
export const TOAST_ANIMATION_MS = 200;
|
|
17
17
|
/**
|
|
18
18
|
* The toasts slide from the edge of the screen they are attached to
|
|
@@ -35,12 +35,15 @@ const StyledCard = styled.div `
|
|
|
35
35
|
width: max-content;
|
|
36
36
|
max-width: 100%;
|
|
37
37
|
min-width: 14em;
|
|
38
|
-
padding:
|
|
38
|
+
padding: ${({ theme }) => {
|
|
39
|
+
const { y, x } = themePadding(theme, 'container');
|
|
40
|
+
return `calc(${y} * 0.75) ${x}`;
|
|
41
|
+
}};
|
|
39
42
|
border-radius: ${({ theme }) => theme.shape.radiusFactor * 1.5}em;
|
|
40
43
|
border: 1px solid ${({ theme }) => theme.color.textPrimary.alpha(0.08).toString()};
|
|
41
44
|
background-color: ${({ theme }) => theme.color.surface.toString()};
|
|
42
45
|
color: ${({ theme }) => theme.color.textPrimary.toString()};
|
|
43
|
-
box-shadow: ${({ theme }) => elevation(theme, 'popup'
|
|
46
|
+
box-shadow: ${({ theme }) => elevation(theme, 'popup')};
|
|
44
47
|
font-size: 0.875em;
|
|
45
48
|
line-height: 1.4;
|
|
46
49
|
pointer-events: auto;
|
|
@@ -8,7 +8,6 @@ import CloseButton from './ToastCloseButton';
|
|
|
8
8
|
import Action from './ToastAction';
|
|
9
9
|
import ToastItem from './ToastItem';
|
|
10
10
|
import { toastStore } from './store';
|
|
11
|
-
import useThemeProps from '../ThemeProvider/useThemeProps';
|
|
12
11
|
const POSITIONS = [
|
|
13
12
|
'top-left',
|
|
14
13
|
'top-center',
|
|
@@ -85,7 +84,7 @@ const useWindowFocused = () => {
|
|
|
85
84
|
return isFocused;
|
|
86
85
|
};
|
|
87
86
|
const ToastContainer = props => {
|
|
88
|
-
const { containerId, position = 'top-right', autoClose = 5000, limit, closeButton = true, closeButtonLabel = 'Close', closeOnClick = true, pauseOnHover = true, pauseOnFocusLoss = true, newestOnTop = false, hotkey = 'F8', label = 'Notifications', zIndex, overrides, } =
|
|
87
|
+
const { containerId, position = 'top-right', autoClose = 5000, limit, closeButton = true, closeButtonLabel = 'Close', closeOnClick = true, pauseOnHover = true, pauseOnFocusLoss = true, newestOnTop = false, hotkey = 'F8', label = 'Notifications', zIndex, overrides, } = props;
|
|
89
88
|
const theme = useTheme();
|
|
90
89
|
const allToasts = React.useSyncExternalStore(toastStore.subscribe, toastStore.getSnapshot, toastStore.getServerSnapshot);
|
|
91
90
|
const toasts = React.useMemo(() => allToasts.filter(item => item.containerId === containerId), [allToasts, containerId]);
|
|
@@ -12,6 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
14
|
import { keyframes } from '@emotion/react';
|
|
15
|
+
import { elevation } from '../ThemeProvider/tokens';
|
|
15
16
|
const appear = keyframes `
|
|
16
17
|
from {
|
|
17
18
|
opacity: 0;
|
|
@@ -33,6 +34,7 @@ const StyledContainer = styled.div `
|
|
|
33
34
|
overflow-wrap: break-word;
|
|
34
35
|
/* Inverted colors: dark on the light theme, light on the dark one */
|
|
35
36
|
background-color: ${({ theme }) => theme.color.textPrimary.toString()};
|
|
37
|
+
box-shadow: ${({ theme }) => elevation(theme, 'popup')};
|
|
36
38
|
color: ${({ theme }) => theme.color.surface.toString()};
|
|
37
39
|
animation: ${appear} 120ms ease-out;
|
|
38
40
|
|
package/esm/Tooltip/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useTheme } from '@emotion/react';
|
|
|
3
3
|
import Popper from '../Popper';
|
|
4
4
|
import Container from './TooltipContainer';
|
|
5
5
|
import Arrow from './TooltipArrow';
|
|
6
|
-
import
|
|
6
|
+
import getElementRef from '../utils/getElementRef';
|
|
7
7
|
/**
|
|
8
8
|
* Pointer types that have the hover. A tap on the touch screen fires `pointerenter` too,
|
|
9
9
|
* the tooltip would flash on every tap
|
|
@@ -40,7 +40,7 @@ const setRef = (ref, value) => {
|
|
|
40
40
|
const isEmptyTitle = (title) => title === null || typeof title === 'undefined' || title === false || title === '';
|
|
41
41
|
const Tooltip = props => {
|
|
42
42
|
var _a;
|
|
43
|
-
const { title, children, placement = 'top', arrow = false, enterDelay = 400, leaveDelay = 100, isOpen, onOpenChange, describeChild = false, offset = 8, zIndex, id, overrides, } =
|
|
43
|
+
const { title, children, placement = 'top', arrow = false, enterDelay = 400, leaveDelay = 100, isOpen, onOpenChange, describeChild = false, offset = 8, zIndex, id, overrides, } = props;
|
|
44
44
|
const theme = useTheme();
|
|
45
45
|
const generatedId = `tooltip-${React.useId().replace(/:/g, '')}`;
|
|
46
46
|
const tooltipId = id || generatedId;
|
|
@@ -132,8 +132,7 @@ const Tooltip = props => {
|
|
|
132
132
|
}
|
|
133
133
|
const child = children;
|
|
134
134
|
const childProps = child.props;
|
|
135
|
-
|
|
136
|
-
childRefRef.current = child.ref;
|
|
135
|
+
childRefRef.current = getElementRef(child);
|
|
137
136
|
if (isEmpty) {
|
|
138
137
|
return child;
|
|
139
138
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the ref of the element.
|
|
4
|
+
* React 19 keeps the ref in props and warns when `element.ref` is read,
|
|
5
|
+
* React 18 keeps it outside of props
|
|
6
|
+
*/
|
|
7
|
+
const getElementRef = (element) => {
|
|
8
|
+
if (parseInt(React.version, 10) >= 19) {
|
|
9
|
+
return element.props.ref;
|
|
10
|
+
}
|
|
11
|
+
return element.ref;
|
|
12
|
+
};
|
|
13
|
+
export default getElementRef;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@via-profit/ui-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "UI Kit",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -820,6 +820,46 @@
|
|
|
820
820
|
"import": "./esm/NoSSR/index.js",
|
|
821
821
|
"require": "./NoSSR/index.js"
|
|
822
822
|
},
|
|
823
|
+
"./Pagination/PaginationContainer": {
|
|
824
|
+
"types": "./Pagination/PaginationContainer.d.ts",
|
|
825
|
+
"import": "./esm/Pagination/PaginationContainer.js",
|
|
826
|
+
"require": "./Pagination/PaginationContainer.js"
|
|
827
|
+
},
|
|
828
|
+
"./Pagination/PaginationGap": {
|
|
829
|
+
"types": "./Pagination/PaginationGap.d.ts",
|
|
830
|
+
"import": "./esm/Pagination/PaginationGap.js",
|
|
831
|
+
"require": "./Pagination/PaginationGap.js"
|
|
832
|
+
},
|
|
833
|
+
"./Pagination/PaginationIcons": {
|
|
834
|
+
"types": "./Pagination/PaginationIcons.d.ts",
|
|
835
|
+
"import": "./esm/Pagination/PaginationIcons.js",
|
|
836
|
+
"require": "./Pagination/PaginationIcons.js"
|
|
837
|
+
},
|
|
838
|
+
"./Pagination/PaginationItem": {
|
|
839
|
+
"types": "./Pagination/PaginationItem.d.ts",
|
|
840
|
+
"import": "./esm/Pagination/PaginationItem.js",
|
|
841
|
+
"require": "./Pagination/PaginationItem.js"
|
|
842
|
+
},
|
|
843
|
+
"./Pagination/getPaginationItems": {
|
|
844
|
+
"types": "./Pagination/getPaginationItems.d.ts",
|
|
845
|
+
"import": "./esm/Pagination/getPaginationItems.js",
|
|
846
|
+
"require": "./Pagination/getPaginationItems.js"
|
|
847
|
+
},
|
|
848
|
+
"./Pagination/index": {
|
|
849
|
+
"types": "./Pagination/index.d.ts",
|
|
850
|
+
"import": "./esm/Pagination/index.js",
|
|
851
|
+
"require": "./Pagination/index.js"
|
|
852
|
+
},
|
|
853
|
+
"./Pagination": {
|
|
854
|
+
"types": "./Pagination/index.d.ts",
|
|
855
|
+
"import": "./esm/Pagination/index.js",
|
|
856
|
+
"require": "./Pagination/index.js"
|
|
857
|
+
},
|
|
858
|
+
"./Pagination/usePagination": {
|
|
859
|
+
"types": "./Pagination/usePagination.d.ts",
|
|
860
|
+
"import": "./esm/Pagination/usePagination.js",
|
|
861
|
+
"require": "./Pagination/usePagination.js"
|
|
862
|
+
},
|
|
823
863
|
"./PhoneField/CountryFlagComponent": {
|
|
824
864
|
"types": "./PhoneField/CountryFlagComponent.d.ts",
|
|
825
865
|
"import": "./esm/PhoneField/CountryFlagComponent.js",
|
|
@@ -1375,11 +1415,6 @@
|
|
|
1375
1415
|
"import": "./esm/TextField/index.js",
|
|
1376
1416
|
"require": "./TextField/index.js"
|
|
1377
1417
|
},
|
|
1378
|
-
"./ThemeProvider/components": {
|
|
1379
|
-
"types": "./ThemeProvider/components.d.ts",
|
|
1380
|
-
"import": "./esm/ThemeProvider/components.js",
|
|
1381
|
-
"require": "./ThemeProvider/components.js"
|
|
1382
|
-
},
|
|
1383
1418
|
"./ThemeProvider/createTheme": {
|
|
1384
1419
|
"types": "./ThemeProvider/createTheme.d.ts",
|
|
1385
1420
|
"import": "./esm/ThemeProvider/createTheme.js",
|
|
@@ -1400,11 +1435,6 @@
|
|
|
1400
1435
|
"import": "./esm/ThemeProvider/tokens.js",
|
|
1401
1436
|
"require": "./ThemeProvider/tokens.js"
|
|
1402
1437
|
},
|
|
1403
|
-
"./ThemeProvider/useThemeProps": {
|
|
1404
|
-
"types": "./ThemeProvider/useThemeProps.d.ts",
|
|
1405
|
-
"import": "./esm/ThemeProvider/useThemeProps.js",
|
|
1406
|
-
"require": "./ThemeProvider/useThemeProps.js"
|
|
1407
|
-
},
|
|
1408
1438
|
"./Toast/ToastAction": {
|
|
1409
1439
|
"types": "./Toast/ToastAction.d.ts",
|
|
1410
1440
|
"import": "./esm/Toast/ToastAction.js",
|
|
@@ -1575,6 +1605,11 @@
|
|
|
1575
1605
|
"import": "./esm/utils/TabManager.js",
|
|
1576
1606
|
"require": "./utils/TabManager.js"
|
|
1577
1607
|
},
|
|
1608
|
+
"./utils/getElementRef": {
|
|
1609
|
+
"types": "./utils/getElementRef.d.ts",
|
|
1610
|
+
"import": "./esm/utils/getElementRef.js",
|
|
1611
|
+
"require": "./utils/getElementRef.js"
|
|
1612
|
+
},
|
|
1578
1613
|
"./utils/spacing": {
|
|
1579
1614
|
"types": "./utils/spacing.d.ts",
|
|
1580
1615
|
"import": "./esm/utils/spacing.js",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the ref of the element.
|
|
4
|
+
* React 19 keeps the ref in props and warns when `element.ref` is read,
|
|
5
|
+
* React 18 keeps it outside of props
|
|
6
|
+
*/
|
|
7
|
+
declare const getElementRef: <T>(element: React.ReactElement) => React.Ref<T> | undefined;
|
|
8
|
+
export default getElementRef;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
/**
|
|
8
|
+
* Returns the ref of the element.
|
|
9
|
+
* React 19 keeps the ref in props and warns when `element.ref` is read,
|
|
10
|
+
* React 18 keeps it outside of props
|
|
11
|
+
*/
|
|
12
|
+
const getElementRef = (element) => {
|
|
13
|
+
if (parseInt(react_1.default.version, 10) >= 19) {
|
|
14
|
+
return element.props.ref;
|
|
15
|
+
}
|
|
16
|
+
return element.ref;
|
|
17
|
+
};
|
|
18
|
+
exports.default = getElementRef;
|