@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
|
@@ -3,6 +3,6 @@ export type AccordionActionsProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
3
3
|
readonly noPadding?: boolean;
|
|
4
4
|
};
|
|
5
5
|
declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
6
|
-
readonly noPadding?: boolean
|
|
6
|
+
readonly noPadding?: boolean;
|
|
7
7
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
8
8
|
export default _default;
|
|
@@ -16,11 +16,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
const react_1 = __importDefault(require("react"));
|
|
18
18
|
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
|
+
const tokens_1 = require("../ThemeProvider/tokens");
|
|
19
20
|
const StyledActions = styled_1.default.div `
|
|
20
21
|
display: flex;
|
|
21
22
|
align-items: center;
|
|
22
23
|
justify-content: flex-end;
|
|
23
|
-
padding: ${({ $noPadding }) =>
|
|
24
|
+
padding: ${({ $noPadding, theme }) => $noPadding ? '0' : `${(0, tokens_1.themePadding)(theme, 'container').y} 0`};
|
|
24
25
|
border-bottom-left-radius: inherit;
|
|
25
26
|
border-bottom-right-radius: inherit;
|
|
26
27
|
`;
|
|
@@ -3,6 +3,6 @@ export type AccordionContainerProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
3
3
|
readonly inline?: boolean;
|
|
4
4
|
};
|
|
5
5
|
declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
6
|
-
readonly inline?: boolean
|
|
6
|
+
readonly inline?: boolean;
|
|
7
7
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
8
8
|
export default _default;
|
|
@@ -16,6 +16,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
const react_1 = __importDefault(require("react"));
|
|
18
18
|
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
|
+
const tokens_1 = require("../ThemeProvider/tokens");
|
|
19
20
|
const StyledAccordionContainer = styled_1.default.div `
|
|
20
21
|
display: ${({ $inline }) => ($inline ? 'inline-flex' : 'flex')};
|
|
21
22
|
box-sizing: border-box;
|
|
@@ -26,20 +27,7 @@ const StyledAccordionContainer = styled_1.default.div `
|
|
|
26
27
|
font-size: 1em;
|
|
27
28
|
position: relative;
|
|
28
29
|
margin-top: 1px;
|
|
29
|
-
box-shadow:
|
|
30
|
-
${({ theme }) => theme.isDark
|
|
31
|
-
? theme.color.backgroundSecondary.lighten(80).alpha(0.2).toString()
|
|
32
|
-
: theme.color.backgroundSecondary.lighten(50).alpha(0.2).toString()}
|
|
33
|
-
0px 2px 1px -1px,
|
|
34
|
-
${({ theme }) => theme.isDark
|
|
35
|
-
? theme.color.backgroundSecondary.lighten(80).alpha(0.14).toString()
|
|
36
|
-
: theme.color.backgroundSecondary.lighten(50).alpha(0.14).toString()}
|
|
37
|
-
0px 1px 1px 0px,
|
|
38
|
-
${({ theme }) => theme.isDark
|
|
39
|
-
? theme.color.backgroundSecondary.lighten(80).alpha(0.12).toString()
|
|
40
|
-
: theme.color.backgroundSecondary.lighten(50).alpha(0.12).toString()}
|
|
41
|
-
0px 1px 3px 0px;
|
|
42
|
-
${({ theme }) => theme.elevation.surface && `box-shadow: ${theme.elevation.surface};`}
|
|
30
|
+
box-shadow: ${({ theme }) => (0, tokens_1.elevation)(theme, 'surface')};
|
|
43
31
|
|
|
44
32
|
/*
|
|
45
33
|
* Adjacent accordions form a group: the inner corners are square.
|
|
@@ -4,7 +4,7 @@ export type AccordionContentProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
4
4
|
readonly isOpen: boolean;
|
|
5
5
|
};
|
|
6
6
|
declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
7
|
-
readonly noPadding?: boolean
|
|
7
|
+
readonly noPadding?: boolean;
|
|
8
8
|
readonly isOpen: boolean;
|
|
9
9
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
10
10
|
export default _default;
|
|
@@ -16,6 +16,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
const react_1 = __importDefault(require("react"));
|
|
18
18
|
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
|
+
const tokens_1 = require("../ThemeProvider/tokens");
|
|
19
20
|
/**
|
|
20
21
|
* Animates the height with grid rows 0fr -> 1fr: no fixed max-height, so the tall content is not cut.
|
|
21
22
|
* `visibility: hidden` of the collapsed content removes it from the tab order and the accessibility tree
|
|
@@ -33,7 +34,10 @@ const Clip = styled_1.default.div `
|
|
|
33
34
|
overflow: hidden;
|
|
34
35
|
`;
|
|
35
36
|
const Wrapper = styled_1.default.div `
|
|
36
|
-
padding: ${({ $noPadding }) =>
|
|
37
|
+
padding: ${({ $noPadding, theme }) => {
|
|
38
|
+
const { y, x } = (0, tokens_1.themePadding)(theme, 'container');
|
|
39
|
+
return $noPadding ? '0' : `${y} ${x}`;
|
|
40
|
+
}};
|
|
37
41
|
`;
|
|
38
42
|
const AccordionContent = (props, ref) => {
|
|
39
43
|
const { children, noPadding, isOpen } = props, nativeProps = __rest(props, ["children", "noPadding", "isOpen"]);
|
|
@@ -23,10 +23,10 @@ declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTM
|
|
|
23
23
|
/**
|
|
24
24
|
* The id of the header button (the content is labelled by it)
|
|
25
25
|
*/
|
|
26
|
-
readonly headerID?: string
|
|
26
|
+
readonly headerID?: string;
|
|
27
27
|
/**
|
|
28
28
|
* The id of the content (the header button controls it)
|
|
29
29
|
*/
|
|
30
|
-
readonly contentID?: string
|
|
30
|
+
readonly contentID?: string;
|
|
31
31
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
32
32
|
export default _default;
|
|
@@ -32,10 +32,14 @@ const HeaderButton = styled_1.default.button `
|
|
|
32
32
|
flex-direction: row;
|
|
33
33
|
flex-wrap: nowrap;
|
|
34
34
|
align-items: center;
|
|
35
|
-
gap:
|
|
35
|
+
gap: 1em;
|
|
36
36
|
width: 100%;
|
|
37
37
|
margin: 0;
|
|
38
|
-
|
|
38
|
+
/* The text of the header is aligned with the content */
|
|
39
|
+
padding: ${({ theme }) => {
|
|
40
|
+
const { y, x } = (0, tokens_1.themePadding)(theme, 'container');
|
|
41
|
+
return `${y} ${x}`;
|
|
42
|
+
}};
|
|
39
43
|
border: 0;
|
|
40
44
|
border-radius: inherit;
|
|
41
45
|
background: none;
|
package/Accordion/index.d.ts
CHANGED
|
@@ -8,11 +8,11 @@ export type AccordionProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
8
8
|
/**
|
|
9
9
|
* Header content
|
|
10
10
|
*/
|
|
11
|
-
readonly header?: JSX.Element | string;
|
|
11
|
+
readonly header?: React.JSX.Element | string;
|
|
12
12
|
/**
|
|
13
13
|
* Actions content
|
|
14
14
|
*/
|
|
15
|
-
readonly actions?: JSX.Element | string;
|
|
15
|
+
readonly actions?: React.JSX.Element | string;
|
|
16
16
|
/**
|
|
17
17
|
* Overridable components map
|
|
18
18
|
*/
|
|
@@ -59,32 +59,32 @@ declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTM
|
|
|
59
59
|
/**
|
|
60
60
|
* Header content
|
|
61
61
|
*/
|
|
62
|
-
readonly header?:
|
|
62
|
+
readonly header?: React.JSX.Element | string;
|
|
63
63
|
/**
|
|
64
64
|
* Actions content
|
|
65
65
|
*/
|
|
66
|
-
readonly actions?:
|
|
66
|
+
readonly actions?: React.JSX.Element | string;
|
|
67
67
|
/**
|
|
68
68
|
* Overridable components map
|
|
69
69
|
*/
|
|
70
|
-
readonly overrides?: AccordionOverrides
|
|
70
|
+
readonly overrides?: AccordionOverrides;
|
|
71
71
|
/**
|
|
72
72
|
* The state of the controlled accordion. Pass it together with `onOpen`
|
|
73
73
|
*/
|
|
74
|
-
readonly isOpen?: boolean
|
|
74
|
+
readonly isOpen?: boolean;
|
|
75
75
|
/**
|
|
76
76
|
* The initial state of the uncontrolled accordion
|
|
77
77
|
* Default: false
|
|
78
78
|
*/
|
|
79
|
-
readonly defaultOpened?: boolean
|
|
79
|
+
readonly defaultOpened?: boolean;
|
|
80
80
|
/**
|
|
81
81
|
* Called when the user clicks the header, both to open and to close the accordion.\
|
|
82
82
|
* Receives the next state: `true` - should be opened, `false` - should be closed
|
|
83
83
|
*/
|
|
84
|
-
readonly onOpen?: (
|
|
84
|
+
readonly onOpen?: (isOpen: boolean) => void;
|
|
85
85
|
/**
|
|
86
86
|
* If `true` initial padding of accorion content would be disabled
|
|
87
87
|
*/
|
|
88
|
-
readonly noPadding?: boolean
|
|
88
|
+
readonly noPadding?: boolean;
|
|
89
89
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
90
90
|
export default _default;
|
package/Accordion/index.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
36
|
var t = {};
|
|
27
37
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -42,9 +52,8 @@ const AccordionContainer_1 = __importDefault(require("./AccordionContainer"));
|
|
|
42
52
|
const AccordionHeader_1 = __importDefault(require("./AccordionHeader"));
|
|
43
53
|
const AccordionContent_1 = __importDefault(require("./AccordionContent"));
|
|
44
54
|
const AccordionActions_1 = __importDefault(require("./AccordionActions"));
|
|
45
|
-
const useThemeProps_1 = __importDefault(require("../ThemeProvider/useThemeProps"));
|
|
46
55
|
const Accordion = (props, ref) => {
|
|
47
|
-
const
|
|
56
|
+
const { children, header, actions, isOpen, onOpen, overrides, noPadding, defaultOpened } = props, nativeProps = __rest(props, ["children", "header", "actions", "isOpen", "onOpen", "overrides", "noPadding", "defaultOpened"]);
|
|
48
57
|
const hasActions = typeof actions !== 'undefined' && actions !== null;
|
|
49
58
|
const hasHeader = typeof header !== 'undefined' && header !== null;
|
|
50
59
|
const [internalOpened, setInternalOpened] = React.useState(Boolean(defaultOpened));
|
|
@@ -152,6 +152,6 @@ export type AutocompleteRef = {
|
|
|
152
152
|
clear: () => void;
|
|
153
153
|
};
|
|
154
154
|
declare const _default: <T, Multiple extends boolean | undefined = undefined>(props: AutocompleteProps<T, Multiple> & {
|
|
155
|
-
ref?: React.Ref<AutocompleteRef
|
|
156
|
-
}) => JSX.Element;
|
|
155
|
+
ref?: React.Ref<AutocompleteRef>;
|
|
156
|
+
}) => React.JSX.Element;
|
|
157
157
|
export default _default;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
36
|
var t = {};
|
|
27
37
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -19,6 +19,7 @@ const react_1 = __importDefault(require("react"));
|
|
|
19
19
|
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
20
20
|
const react_2 = require("@emotion/react");
|
|
21
21
|
const MenuItem_1 = __importDefault(require("../Menu/MenuItem"));
|
|
22
|
+
const tokens_1 = require("../ThemeProvider/tokens");
|
|
22
23
|
const StyeldMenuItem = (0, styled_1.default)(MenuItem_1.default, {
|
|
23
24
|
shouldForwardProp: p => !['variant'].includes(p),
|
|
24
25
|
}) `
|
|
@@ -28,7 +29,7 @@ const StyeldMenuItem = (0, styled_1.default)(MenuItem_1.default, {
|
|
|
28
29
|
border-color: ${theme.color.accentPrimary.toString()};
|
|
29
30
|
color: ${theme.color.textPrimary.toString()};
|
|
30
31
|
border-style: dashed;
|
|
31
|
-
border-width:
|
|
32
|
+
border-width: ${tokens_1.BORDER_WIDTH};
|
|
32
33
|
|
|
33
34
|
:hover {
|
|
34
35
|
background-color: ${theme.color.accentPrimary.toString()};
|
|
@@ -14,15 +14,15 @@ type ActionSetPartial = {
|
|
|
14
14
|
readonly type: 'setPartial';
|
|
15
15
|
readonly payload: Partial<State>;
|
|
16
16
|
};
|
|
17
|
-
export declare const actionSetPartial: (payload: ActionSetPartial[
|
|
17
|
+
export declare const actionSetPartial: (payload: ActionSetPartial["payload"]) => ActionSetPartial;
|
|
18
18
|
export declare const defaultState: State;
|
|
19
19
|
export declare const reducer: React.Reducer<State, Action>;
|
|
20
20
|
export declare const createInitialState: <T, Multiple extends boolean | undefined = undefined>(params: {
|
|
21
21
|
readonly items: readonly T[];
|
|
22
22
|
readonly value: Value<T, Multiple> | null;
|
|
23
23
|
readonly selectedItemToString: ItemToString<T, Multiple>;
|
|
24
|
-
readonly isOpen?: boolean
|
|
25
|
-
readonly multiple?: Multiple
|
|
24
|
+
readonly isOpen?: boolean;
|
|
25
|
+
readonly multiple?: Multiple;
|
|
26
26
|
readonly filterItems: FilterItems<T> | undefined;
|
|
27
27
|
}) => State;
|
|
28
28
|
interface ContextProviderProps {
|
package/Autocomplete/index.d.ts
CHANGED
|
@@ -3,6 +3,6 @@ import { AutocompleteProps, AutocompleteRef } from './AutocompleteContainer';
|
|
|
3
3
|
export * from './AutocompleteContainer';
|
|
4
4
|
export * from './AutocompleteItem';
|
|
5
5
|
declare const _default: <T, Multiple extends boolean | undefined = undefined>(props: AutocompleteProps<T, Multiple> & {
|
|
6
|
-
ref?: React.Ref<AutocompleteRef
|
|
7
|
-
}) => JSX.Element;
|
|
6
|
+
ref?: React.Ref<AutocompleteRef>;
|
|
7
|
+
}) => React.JSX.Element;
|
|
8
8
|
export default _default;
|
|
@@ -15,12 +15,12 @@ declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTM
|
|
|
15
15
|
/**
|
|
16
16
|
* You can pass the primary, default, secondary name of the colors or your specified color value
|
|
17
17
|
*/
|
|
18
|
-
readonly color?:
|
|
18
|
+
readonly color?: "default" | "primary" | "secondary" | string;
|
|
19
19
|
/**
|
|
20
20
|
* Avatar size variant\
|
|
21
21
|
* \
|
|
22
22
|
* **Default**: `2.5em`
|
|
23
23
|
*/
|
|
24
|
-
readonly size?: string
|
|
24
|
+
readonly size?: string;
|
|
25
25
|
} & React.RefAttributes<HTMLSpanElement>>;
|
|
26
26
|
export default _default;
|
|
@@ -53,10 +53,10 @@ declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTM
|
|
|
53
53
|
* \
|
|
54
54
|
* **Default**: `circular`
|
|
55
55
|
*/
|
|
56
|
-
readonly variant?: "
|
|
56
|
+
readonly variant?: "circular" | "rounded" | "square";
|
|
57
57
|
/**
|
|
58
58
|
* HTML image alt attribute
|
|
59
59
|
*/
|
|
60
|
-
readonly alt?: string
|
|
60
|
+
readonly alt?: string;
|
|
61
61
|
} & React.RefAttributes<HTMLPictureElement>>;
|
|
62
62
|
export default _default;
|
package/Avatar/index.js
CHANGED
|
@@ -19,7 +19,6 @@ const styled_1 = __importDefault(require("@emotion/styled"));
|
|
|
19
19
|
const react_2 = require("@emotion/react");
|
|
20
20
|
const Color_1 = __importDefault(require("../Color"));
|
|
21
21
|
const AvatarBase_1 = __importDefault(require("./AvatarBase"));
|
|
22
|
-
const useThemeProps_1 = __importDefault(require("../ThemeProvider/useThemeProps"));
|
|
23
22
|
const StyledAvatarBase = (0, styled_1.default)(AvatarBase_1.default) `
|
|
24
23
|
position: relative;
|
|
25
24
|
color: ${({ $color }) => $color.toString()};
|
|
@@ -55,7 +54,7 @@ const StyledAvatarBase = (0, styled_1.default)(AvatarBase_1.default) `
|
|
|
55
54
|
}}
|
|
56
55
|
`;
|
|
57
56
|
const Avatar = (props, ref) => {
|
|
58
|
-
const
|
|
57
|
+
const { children, color, onClick, onKeyDown, isOnline, size, src, variant = 'circular', alt, overrides } = props, restProps = __rest(props, ["children", "color", "onClick", "onKeyDown", "isOnline", "size", "src", "variant", "alt", "overrides"]);
|
|
59
58
|
const theme = (0, react_2.useTheme)();
|
|
60
59
|
const clickable = react_1.default.useMemo(() => typeof onClick === 'function', [onClick]);
|
|
61
60
|
// A clickable avatar acts as a button, so it is activated by Enter and Space too
|
package/Badge/BadgeBase.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface BadgeBaseProps extends Omit<BadgeNativeProps, 'color'> {
|
|
|
14
14
|
* </Badge>
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
|
-
readonly startIcon?: JSX.Element;
|
|
17
|
+
readonly startIcon?: React.JSX.Element;
|
|
18
18
|
/**
|
|
19
19
|
* Badge style variant\
|
|
20
20
|
* Allowed variants: `standard` or `outlined`\
|
|
@@ -9,6 +9,6 @@ declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTM
|
|
|
9
9
|
/**
|
|
10
10
|
* You can pass the primary, default, secondary name of the colors or your specified color value
|
|
11
11
|
*/
|
|
12
|
-
readonly color?:
|
|
12
|
+
readonly color?: "default" | "primary" | "secondary" | string;
|
|
13
13
|
} & React.RefAttributes<HTMLSpanElement>>;
|
|
14
14
|
export default _default;
|
|
@@ -4,7 +4,7 @@ export type BadgeDeleteButtonProps = Omit<React.HTMLAttributes<HTMLButtonElement
|
|
|
4
4
|
readonly variant?: 'standard' | 'outlined';
|
|
5
5
|
};
|
|
6
6
|
declare const _default: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLButtonElement>, "children"> & {
|
|
7
|
-
readonly color?:
|
|
8
|
-
readonly variant?: "standard" | "outlined"
|
|
7
|
+
readonly color?: "primary" | "secondary" | "default" | string;
|
|
8
|
+
readonly variant?: "standard" | "outlined";
|
|
9
9
|
} & React.RefAttributes<HTMLButtonElement>>;
|
|
10
10
|
export default _default;
|
package/Badge/BadgeStyled.js
CHANGED
|
@@ -76,7 +76,7 @@ const getOutlinedColors = (color, theme) => {
|
|
|
76
76
|
*/
|
|
77
77
|
const StyledBadge = (0, styled_1.default)(BadgeBase_1.default) `
|
|
78
78
|
border-style: solid;
|
|
79
|
-
border-width:
|
|
79
|
+
border-width: ${tokens_1.BORDER_WIDTH};
|
|
80
80
|
border-color: ${({ $background }) => $background.toString()};
|
|
81
81
|
|
|
82
82
|
${({ $variant, $color, $background, theme }) => $variant === 'outlined'
|
package/Badge/index.d.ts
CHANGED
|
@@ -17,6 +17,6 @@ declare const _default: React.ForwardRefExoticComponent<import("./BadgeBase").Ba
|
|
|
17
17
|
* \
|
|
18
18
|
* **Default**: `standard`
|
|
19
19
|
*/
|
|
20
|
-
readonly variant?: "standard" | "outlined"
|
|
20
|
+
readonly variant?: "standard" | "outlined";
|
|
21
21
|
} & React.RefAttributes<HTMLSpanElement>>;
|
|
22
22
|
export default _default;
|
package/Badge/index.js
CHANGED
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
7
|
const BadgeStyled_1 = __importDefault(require("./BadgeStyled"));
|
|
8
|
-
const useThemeProps_1 = __importDefault(require("../ThemeProvider/useThemeProps"));
|
|
9
8
|
// One component for both variants, so changing the variant does not remount the badge
|
|
10
|
-
const Badge = (props, ref) => (react_1.default.createElement(BadgeStyled_1.default, Object.assign({},
|
|
9
|
+
const Badge = (props, ref) => (react_1.default.createElement(BadgeStyled_1.default, Object.assign({}, props, { ref: ref })));
|
|
11
10
|
exports.default = react_1.default.forwardRef(Badge);
|
package/Button/ButtonBase.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface ButtonBaseProps extends Omit<ButtonNativeProps, 'color'> {
|
|
|
13
13
|
* </Button>
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
|
16
|
-
readonly startIcon?: JSX.Element;
|
|
16
|
+
readonly startIcon?: React.JSX.Element;
|
|
17
17
|
/**
|
|
18
18
|
* Icon or another JSX element placed after button label
|
|
19
19
|
* Example:
|
|
@@ -23,7 +23,7 @@ export interface ButtonBaseProps extends Omit<ButtonNativeProps, 'color'> {
|
|
|
23
23
|
* </Button>
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
-
readonly endIcon?: JSX.Element;
|
|
26
|
+
readonly endIcon?: React.JSX.Element;
|
|
27
27
|
/**
|
|
28
28
|
* If true, then expect SVG icon as children. The button will be rendered as icon button
|
|
29
29
|
* Example:
|
|
@@ -30,7 +30,7 @@ declare const _default: React.ForwardRefExoticComponent<React.ButtonHTMLAttribut
|
|
|
30
30
|
/**
|
|
31
31
|
* You can pass the primary, default, secondary name of the colors or your specified color value
|
|
32
32
|
*/
|
|
33
|
-
readonly color?:
|
|
33
|
+
readonly color?: "default" | "primary" | "secondary" | string;
|
|
34
34
|
/**
|
|
35
35
|
* If true, then expect SVG icon as children. The button will be rendered as icon button
|
|
36
36
|
* Example:
|
|
@@ -41,14 +41,14 @@ declare const _default: React.ForwardRefExoticComponent<React.ButtonHTMLAttribut
|
|
|
41
41
|
* ```
|
|
42
42
|
`
|
|
43
43
|
*/
|
|
44
|
-
readonly iconOnly?: boolean
|
|
44
|
+
readonly iconOnly?: boolean;
|
|
45
45
|
/**
|
|
46
46
|
* The variant of the `<Button>`. Without it the button has no variant styles (the bare `ButtonBase`)
|
|
47
47
|
*/
|
|
48
|
-
readonly variant?: ButtonVariant
|
|
48
|
+
readonly variant?: ButtonVariant;
|
|
49
49
|
/**
|
|
50
50
|
* The orientation of the ButtonGroup the button is in
|
|
51
51
|
*/
|
|
52
|
-
readonly groupOrientation?: ButtonGroupOrientation
|
|
52
|
+
readonly groupOrientation?: ButtonGroupOrientation;
|
|
53
53
|
} & React.RefAttributes<HTMLButtonElement>>;
|
|
54
54
|
export default _default;
|
|
@@ -19,9 +19,19 @@ const styled_1 = __importDefault(require("@emotion/styled"));
|
|
|
19
19
|
const react_2 = require("@emotion/react");
|
|
20
20
|
const tokens_1 = require("../ThemeProvider/tokens");
|
|
21
21
|
const buttonVariants_1 = require("./buttonVariants");
|
|
22
|
+
/**
|
|
23
|
+
* The outlined buttons and all the buttons of the ButtonGroup have a border.
|
|
24
|
+
* The other ones get its width in the padding, so all the buttons have the same height
|
|
25
|
+
*/
|
|
26
|
+
const buttonPadding = ({ theme, $variant, $group }) => {
|
|
27
|
+
const { y, x } = theme.padding.control;
|
|
28
|
+
const hasBorder = $variant === 'outlined' || Boolean($group) || !$variant;
|
|
29
|
+
return hasBorder ? `${y} ${x}` : `calc(${y} + ${tokens_1.CONTROL_BORDER}) calc(${x} + ${tokens_1.CONTROL_BORDER})`;
|
|
30
|
+
};
|
|
22
31
|
const StyledButton = styled_1.default.button `
|
|
23
32
|
border-radius: ${({ theme }) => theme.shape.radiusFactor * 2}em;
|
|
24
|
-
padding:
|
|
33
|
+
padding: ${buttonPadding};
|
|
34
|
+
line-height: ${tokens_1.CONTROL_LINE_HEIGHT};
|
|
25
35
|
cursor: ${({ disabled }) => (disabled ? 'default' : 'pointer')};
|
|
26
36
|
font-size: 1em;
|
|
27
37
|
/* Buttons do not inherit the font by default */
|
|
@@ -30,7 +40,13 @@ const StyledButton = styled_1.default.button `
|
|
|
30
40
|
outline-style: solid;
|
|
31
41
|
outline-color: transparent;
|
|
32
42
|
outline-width: 0.14em;
|
|
33
|
-
|
|
43
|
+
/*
|
|
44
|
+
* The colors only: the variants have different border and padding, a transition of the sizes
|
|
45
|
+
* makes the button grow for a moment when the variant changes (the border width changes by whole pixels)
|
|
46
|
+
*/
|
|
47
|
+
transition-property: color, background-color, border-color, box-shadow, outline-color;
|
|
48
|
+
transition-duration: 180ms;
|
|
49
|
+
transition-timing-function: ease-out;
|
|
34
50
|
background: none;
|
|
35
51
|
display: inline-flex;
|
|
36
52
|
align-items: center;
|
|
@@ -45,10 +61,11 @@ const StyledButton = styled_1.default.button `
|
|
|
45
61
|
}};
|
|
46
62
|
${({ iconOnly, theme }) => iconOnly &&
|
|
47
63
|
(0, react_2.css) `
|
|
48
|
-
padding:
|
|
64
|
+
padding: 0;
|
|
49
65
|
justify-content: center;
|
|
50
|
-
|
|
51
|
-
|
|
66
|
+
box-sizing: border-box;
|
|
67
|
+
width: ${(0, tokens_1.controlHeight)(theme)};
|
|
68
|
+
height: ${(0, tokens_1.controlHeight)(theme)};
|
|
52
69
|
border-radius: ${theme.shape.radiusFactor * 3}em;
|
|
53
70
|
`}
|
|
54
71
|
${({ $variant, $group, color, disabled, theme }) => $variant && (0, buttonVariants_1.buttonVariantStyles)({ variant: $variant, color, disabled, group: $group, theme })}
|
package/Button/ButtonStyled.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ export type ButtonStyledProps = ButtonBaseProps & {
|
|
|
6
6
|
readonly variant?: ButtonVariant;
|
|
7
7
|
};
|
|
8
8
|
declare const _default: React.ForwardRefExoticComponent<ButtonBaseProps & {
|
|
9
|
-
readonly variant?: ButtonVariant
|
|
9
|
+
readonly variant?: ButtonVariant;
|
|
10
10
|
} & React.RefAttributes<HTMLButtonElement>>;
|
|
11
11
|
export default _default;
|
|
@@ -24,6 +24,6 @@ declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTM
|
|
|
24
24
|
* ```
|
|
25
25
|
`
|
|
26
26
|
*/
|
|
27
|
-
readonly iconOnly?:
|
|
27
|
+
readonly iconOnly?: ButtonContainerProps["iconOnly"];
|
|
28
28
|
} & React.RefAttributes<HTMLSpanElement>>;
|
|
29
29
|
export default _default;
|
|
@@ -12,5 +12,5 @@ export declare const buttonVariantStyles: (params: {
|
|
|
12
12
|
readonly disabled?: boolean;
|
|
13
13
|
readonly group?: ButtonGroupOrientation;
|
|
14
14
|
readonly theme: Theme;
|
|
15
|
-
}) => import("@emotion/
|
|
15
|
+
}) => import("@emotion/react").SerializedStyles;
|
|
16
16
|
export {};
|
package/Button/buttonVariants.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.buttonVariantStyles = void 0;
|
|
7
7
|
const react_1 = require("@emotion/react");
|
|
8
8
|
const Color_1 = __importDefault(require("../Color"));
|
|
9
|
+
const tokens_1 = require("../ThemeProvider/tokens");
|
|
9
10
|
const parseColor = (color, fallback) => {
|
|
10
11
|
try {
|
|
11
12
|
return Color_1.default.fromString(color);
|
|
@@ -88,7 +89,7 @@ const outlinedStyles = ({ $color, disabled, theme }) => (0, react_1.css) `
|
|
|
88
89
|
: $color.toString()};
|
|
89
90
|
background-color: transparent;
|
|
90
91
|
border-style: solid;
|
|
91
|
-
border-width:
|
|
92
|
+
border-width: ${tokens_1.CONTROL_BORDER};
|
|
92
93
|
|
|
93
94
|
${!disabled &&
|
|
94
95
|
(0, react_1.css) `
|
|
@@ -132,7 +133,7 @@ const plainStyles = ({ $color, disabled, theme }) => (0, react_1.css) `
|
|
|
132
133
|
const groupStyles = ({ $group, $variant, $color }) => $group &&
|
|
133
134
|
(0, react_1.css) `
|
|
134
135
|
border-style: solid;
|
|
135
|
-
border-width:
|
|
136
|
+
border-width: ${tokens_1.CONTROL_BORDER};
|
|
136
137
|
${$variant !== 'outlined' &&
|
|
137
138
|
(0, react_1.css) `
|
|
138
139
|
border-color: transparent;
|
package/Button/index.d.ts
CHANGED
|
@@ -18,6 +18,6 @@ declare const _default: React.ForwardRefExoticComponent<import("./ButtonBase").B
|
|
|
18
18
|
* \
|
|
19
19
|
* **Default**: `standard`
|
|
20
20
|
*/
|
|
21
|
-
readonly variant?: "standard" | "outlined" | "plain"
|
|
21
|
+
readonly variant?: "standard" | "outlined" | "plain";
|
|
22
22
|
} & React.RefAttributes<HTMLButtonElement>>;
|
|
23
23
|
export default _default;
|
package/Button/index.js
CHANGED
|
@@ -5,25 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
7
|
const ButtonStyled_1 = __importDefault(require("./ButtonStyled"));
|
|
8
|
-
const ButtonGroupContext_1 = __importDefault(require("../ButtonGroup/ButtonGroupContext"));
|
|
9
|
-
const useThemeProps_1 = __importDefault(require("../ThemeProvider/useThemeProps"));
|
|
10
|
-
/**
|
|
11
|
-
* The props the ButtonGroup gives to its buttons. Inside the group the theme does not set them:
|
|
12
|
-
* the own props of the button win, then the group, then the theme
|
|
13
|
-
*/
|
|
14
|
-
const GROUP_PROPS = ['variant', 'color', 'disabled'];
|
|
15
8
|
// One component for all the variants, so changing the variant does not remount the button
|
|
16
|
-
const Button = (props, ref) => {
|
|
17
|
-
const group = react_1.default.useContext(ButtonGroupContext_1.default);
|
|
18
|
-
const themedProps = (0, useThemeProps_1.default)('Button', props);
|
|
19
|
-
if (!group) {
|
|
20
|
-
return react_1.default.createElement(ButtonStyled_1.default, Object.assign({}, themedProps, { ref: ref }));
|
|
21
|
-
}
|
|
22
|
-
const ownProps = props;
|
|
23
|
-
const buttonProps = Object.assign({}, themedProps);
|
|
24
|
-
GROUP_PROPS.forEach(key => {
|
|
25
|
-
buttonProps[key] = ownProps[key];
|
|
26
|
-
});
|
|
27
|
-
return react_1.default.createElement(ButtonStyled_1.default, Object.assign({}, buttonProps, { ref: ref }));
|
|
28
|
-
};
|
|
9
|
+
const Button = (props, ref) => (react_1.default.createElement(ButtonStyled_1.default, Object.assign({}, props, { ref: ref })));
|
|
29
10
|
exports.default = react_1.default.forwardRef(Button);
|