@astral/ui 1.50.0 → 1.51.1
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/BackdropStack/hooks/useBackdropStackToggle/useBackdropStackToggle.d.ts +2 -2
- package/BackdropStack/services/BackdropStackManager/BackdropStackManager.d.ts +30 -2
- package/BackdropStack/services/BackdropStackManager/BackdropStackManager.js +35 -3
- package/Button/styles.d.ts +1 -1
- package/ClickAwayListener/ClickAwayListener.d.ts +9 -0
- package/ClickAwayListener/ClickAwayListener.js +14 -0
- package/{esm/MenuGroup/types.js → ClickAwayListener/ClickAwayListener.test.d.ts} +0 -0
- package/ClickAwayListener/ClickAwayListener.test.js +37 -0
- package/ClickAwayListener/index.d.ts +1 -0
- package/{DatePicker/DatePickerClickAwayListener → ClickAwayListener}/index.js +1 -1
- package/DataGrid/DataGridNoData/styles.d.ts +1 -1
- package/DatePicker/DatePicker.d.ts +5 -3
- package/DatePicker/DatePicker.js +3 -3
- package/DatePicker/DatePicker.test.js +6 -0
- package/DatePicker/DatePickerPopper/DatePickerPopper.d.ts +2 -2
- package/Fab/styles.d.ts +1 -1
- package/IconButton/styles.d.ts +1 -1
- package/ListItem/ListItem.d.ts +1 -1
- package/ListItem/ListItem.js +1 -13
- package/MenuGroup/MenuGroup.d.ts +8 -2
- package/MenuGroup/MenuGroup.js +2 -2
- package/MenuGroup/stories/styled.d.ts +1 -1
- package/MenuGroup/stories/styled.js +2 -2
- package/MenuGroup/styles.d.ts +8 -0
- package/MenuGroup/{styled.js → styles.js} +10 -5
- package/ProductSwitcher/ProductSwitcher.js +1 -1
- package/ProductSwitcher/ProductSwitcher.stories.js +8 -1
- package/ProductSwitcher/ProductSwitcherContent/ProductSwitcherContent.js +7 -5
- package/ProductSwitcher/ProductSwitcherContent/styles.d.ts +6 -30
- package/ProductSwitcher/ProductSwitcherContent/styles.js +13 -6
- package/ProductSwitcher/styles.d.ts +0 -5
- package/ProductSwitcher/styles.js +9 -13
- package/ProductSwitcher/types.d.ts +1 -0
- package/SwipeableDrawer/styles.d.ts +1 -1
- package/Tooltip/styled.d.ts +1 -1
- package/esm/BackdropStack/hooks/useBackdropStackToggle/useBackdropStackToggle.d.ts +2 -2
- package/esm/BackdropStack/services/BackdropStackManager/BackdropStackManager.d.ts +30 -2
- package/esm/BackdropStack/services/BackdropStackManager/BackdropStackManager.js +35 -3
- package/esm/Button/styles.d.ts +1 -1
- package/esm/ClickAwayListener/ClickAwayListener.d.ts +9 -0
- package/esm/ClickAwayListener/ClickAwayListener.js +10 -0
- package/esm/ClickAwayListener/ClickAwayListener.test.d.ts +1 -0
- package/esm/ClickAwayListener/ClickAwayListener.test.js +35 -0
- package/esm/ClickAwayListener/index.d.ts +1 -0
- package/esm/ClickAwayListener/index.js +1 -0
- package/esm/DataGrid/DataGridNoData/styles.d.ts +1 -1
- package/esm/DatePicker/DatePicker.d.ts +5 -3
- package/esm/DatePicker/DatePicker.js +3 -3
- package/esm/DatePicker/DatePicker.test.js +6 -0
- package/esm/DatePicker/DatePickerPopper/DatePickerPopper.d.ts +2 -2
- package/esm/Fab/styles.d.ts +1 -1
- package/esm/IconButton/styles.d.ts +1 -1
- package/esm/ListItem/ListItem.d.ts +1 -1
- package/esm/ListItem/ListItem.js +1 -13
- package/esm/MenuGroup/MenuGroup.d.ts +8 -2
- package/esm/MenuGroup/MenuGroup.js +2 -2
- package/esm/MenuGroup/stories/styled.d.ts +1 -1
- package/esm/MenuGroup/stories/styled.js +2 -2
- package/esm/MenuGroup/styles.d.ts +8 -0
- package/esm/MenuGroup/{styled.js → styles.js} +9 -4
- package/esm/ProductSwitcher/ProductSwitcher.js +2 -2
- package/esm/ProductSwitcher/ProductSwitcher.stories.js +8 -1
- package/esm/ProductSwitcher/ProductSwitcherContent/ProductSwitcherContent.js +8 -6
- package/esm/ProductSwitcher/ProductSwitcherContent/styles.d.ts +6 -30
- package/esm/ProductSwitcher/ProductSwitcherContent/styles.js +12 -5
- package/esm/ProductSwitcher/styles.d.ts +0 -5
- package/esm/ProductSwitcher/styles.js +8 -12
- package/esm/ProductSwitcher/types.d.ts +1 -0
- package/esm/SwipeableDrawer/styles.d.ts +1 -1
- package/esm/Tooltip/styled.d.ts +1 -1
- package/esm/hooks/index.d.ts +2 -0
- package/esm/hooks/index.js +2 -0
- package/esm/hooks/useClickAwayEffect/index.d.ts +1 -0
- package/esm/hooks/useClickAwayEffect/index.js +1 -0
- package/esm/hooks/useClickAwayEffect/useClickAwayEffect.d.ts +25 -0
- package/esm/hooks/useClickAwayEffect/useClickAwayEffect.js +26 -0
- package/esm/hooks/useClickAwayEffect/useClickAwayEffect.test.d.ts +1 -0
- package/esm/hooks/useClickAwayEffect/useClickAwayEffect.test.js +42 -0
- package/esm/hooks/useEscapeClickEffect/useEscapeClickEffect.d.ts +2 -2
- package/esm/index.d.ts +2 -0
- package/esm/index.js +2 -0
- package/esm/types.d.ts +5 -1
- package/hooks/index.d.ts +2 -0
- package/hooks/index.js +2 -0
- package/hooks/useClickAwayEffect/index.d.ts +1 -0
- package/hooks/useClickAwayEffect/index.js +17 -0
- package/hooks/useClickAwayEffect/useClickAwayEffect.d.ts +25 -0
- package/hooks/useClickAwayEffect/useClickAwayEffect.js +30 -0
- package/hooks/useClickAwayEffect/useClickAwayEffect.test.d.ts +1 -0
- package/hooks/useClickAwayEffect/useClickAwayEffect.test.js +44 -0
- package/hooks/useEscapeClickEffect/useEscapeClickEffect.d.ts +2 -2
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/package.json +2 -2
- package/types.d.ts +5 -1
- package/DatePicker/DatePickerClickAwayListener/DatePickerClickAwayListener.d.ts +0 -6
- package/DatePicker/DatePickerClickAwayListener/DatePickerClickAwayListener.js +0 -7
- package/DatePicker/DatePickerClickAwayListener/index.d.ts +0 -1
- package/MenuGroup/styled.d.ts +0 -8
- package/MenuGroup/types.d.ts +0 -8
- package/MenuGroup/types.js +0 -2
- package/esm/DatePicker/DatePickerClickAwayListener/DatePickerClickAwayListener.d.ts +0 -6
- package/esm/DatePicker/DatePickerClickAwayListener/DatePickerClickAwayListener.js +0 -3
- package/esm/DatePicker/DatePickerClickAwayListener/index.d.ts +0 -1
- package/esm/DatePicker/DatePickerClickAwayListener/index.js +0 -1
- package/esm/MenuGroup/styled.d.ts +0 -8
- package/esm/MenuGroup/types.d.ts +0 -8
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Logo = exports.ProductItem = void 0;
|
|
3
|
+
exports.TitleErrorContainer = exports.Logo = exports.ProductItem = void 0;
|
|
4
4
|
const styles_1 = require("../../styles");
|
|
5
5
|
const MenuItem_1 = require("../../MenuItem");
|
|
6
|
+
const Grid_1 = require("../../Grid");
|
|
7
|
+
// as typeof MenuItem необходим для возможности прокинуть component
|
|
8
|
+
// https://github.com/mui/material-ui/issues/15695
|
|
6
9
|
exports.ProductItem = (0, styles_1.styled)(MenuItem_1.MenuItem) `
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
border-radius: ${({ theme }) => theme.shape.small};
|
|
10
|
+
padding-left: ${({ theme }) => theme.spacing(6)};
|
|
10
11
|
`;
|
|
11
|
-
exports.Logo = styles_1.styled
|
|
12
|
+
exports.Logo = (0, styles_1.styled)('img', {
|
|
13
|
+
shouldForwardProp: (prop) => prop !== 'color',
|
|
14
|
+
}) `
|
|
12
15
|
width: 40px;
|
|
13
16
|
height: 40px;
|
|
14
|
-
margin-right: ${({ theme }) => theme.spacing(
|
|
17
|
+
margin-right: ${({ theme }) => theme.spacing(4)};
|
|
15
18
|
|
|
16
19
|
background-color: ${({ color }) => color};
|
|
17
20
|
border-radius: ${({ theme }) => theme.shape.small};
|
|
18
21
|
`;
|
|
22
|
+
exports.TitleErrorContainer = (0, styles_1.styled)(Grid_1.Grid) `
|
|
23
|
+
color: ${({ theme }) => theme.palette.error.dark};
|
|
24
|
+
column-gap: ${({ theme }) => theme.spacing(2)};
|
|
25
|
+
`;
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export declare const ContentWrapper: import("@emotion/styled").StyledComponent<{
|
|
3
|
-
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
-
as?: import("react").ElementType<any> | undefined;
|
|
5
|
-
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
6
1
|
export declare const WidgetMenu: import("@emotion/styled").StyledComponent<import("../Menu").MenuProps & {
|
|
7
2
|
theme?: import("@emotion/react").Theme | undefined;
|
|
8
3
|
}, {}, {}>;
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WidgetMenu =
|
|
3
|
+
exports.WidgetMenu = void 0;
|
|
4
4
|
const styles_1 = require("../styles");
|
|
5
5
|
const Menu_1 = require("../Menu");
|
|
6
|
-
exports.ContentWrapper = styles_1.styled.div `
|
|
7
|
-
display: flex;
|
|
8
|
-
flex-direction: column;
|
|
9
|
-
align-items: center;
|
|
10
|
-
justify-content: center;
|
|
11
|
-
min-width: 240px;
|
|
12
|
-
max-width: 280px;
|
|
13
|
-
min-height: 150px;
|
|
14
|
-
padding: ${({ theme }) => theme.spacing(2)};
|
|
15
|
-
`;
|
|
16
6
|
exports.WidgetMenu = (0, styles_1.styled)(Menu_1.Menu) `
|
|
17
|
-
.MuiList-root {
|
|
18
|
-
|
|
7
|
+
.MuiPaper-root > .MuiList-root {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
width: 285px;
|
|
13
|
+
min-height: 124px;
|
|
14
|
+
padding: ${({ theme }) => theme.spacing(3, 0)};
|
|
19
15
|
}
|
|
20
16
|
`;
|
|
@@ -40,7 +40,7 @@ export declare const SwipeableDrawerTitle: import("@emotion/styled").StyledCompo
|
|
|
40
40
|
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
41
41
|
}, "sx" | "children" | "variant" | keyof import("@mui/material/OverridableComponent").CommonProps | ("fontSize" | "fontWeight" | "lineHeight" | "fontFamily" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxShadow" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "zIndex" | "border" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "typography" | "p" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint") | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & {
|
|
42
42
|
theme?: import("@emotion/react").Theme | undefined;
|
|
43
|
-
} & Omit<import("@mui/material/OverridableComponent").OverrideProps<import("
|
|
43
|
+
} & Omit<import("@mui/material/OverridableComponent").OverrideProps<import("..").WithoutEmotionSpecific<import("@mui/material").TypographyTypeMap<{}, "span">>, import("react").ElementType<any>>, "color" | "variant"> & {
|
|
44
44
|
variant?: import("@mui/material").TypographyVariant | keyof import("@mui/material").TypographyPropsVariantOverrides | undefined;
|
|
45
45
|
component?: import("react").ElementType<any> | undefined;
|
|
46
46
|
color?: "primary" | "secondary" | "red" | "green" | "yellow" | "grey" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
|
package/Tooltip/styled.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const StyledTooltip: import("@emotion/styled").StyledComponent<import("
|
|
1
|
+
export declare const StyledTooltip: import("@emotion/styled").StyledComponent<import("..").WithoutEmotionSpecific<import("@mui/material").TooltipProps> & {
|
|
2
2
|
size?: "medium" | "small" | undefined;
|
|
3
3
|
} & {
|
|
4
4
|
theme?: import("@emotion/react").Theme | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SyntheticEvent } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { CloseEventReason } from '../../../types';
|
|
3
3
|
/**
|
|
4
4
|
* @description необязательные настройки для использоввания хука
|
|
5
5
|
*/
|
|
@@ -23,7 +23,7 @@ type ReturnElements = {
|
|
|
23
23
|
/**
|
|
24
24
|
* @description метод вызываемый при закрытии элемента, внутри него определяется состояние isOpened
|
|
25
25
|
*/
|
|
26
|
-
handleClose: (event?: SyntheticEvent<Element, Event> | Event | {}, reason?:
|
|
26
|
+
handleClose: (event?: SyntheticEvent<Element, Event> | Event | {}, reason?: CloseEventReason) => void;
|
|
27
27
|
};
|
|
28
28
|
type UseBackdropStackToggleFunc = (options?: Options) => ReturnElements;
|
|
29
29
|
/**
|
|
@@ -1,15 +1,43 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CloseEventReason } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* @description айдишка модалки/поппера/тултипа
|
|
4
|
+
*/
|
|
2
5
|
type PopId = string;
|
|
3
6
|
declare class BackdropStackManager {
|
|
4
7
|
private stack;
|
|
8
|
+
/**
|
|
9
|
+
* @description сохраняем информацию о том какой был предыдущий вызов pop,
|
|
10
|
+
* нужен для предотвращения синхронного закрытия при последовательности 'blur' и 'backdropClick' в рамках одного клика
|
|
11
|
+
*/
|
|
5
12
|
private previousPopInfo;
|
|
13
|
+
/**
|
|
14
|
+
* @description крайняя айдишка клика по странице
|
|
15
|
+
*/
|
|
6
16
|
private currentPointerId;
|
|
7
17
|
constructor();
|
|
18
|
+
/**
|
|
19
|
+
* @description метод проверки на конфликт причины закрытия с предыдущим
|
|
20
|
+
*/
|
|
8
21
|
private checkOn;
|
|
22
|
+
/**
|
|
23
|
+
* @description метод генерации случайной айдишки
|
|
24
|
+
*/
|
|
9
25
|
generateID: () => string;
|
|
26
|
+
/**
|
|
27
|
+
* @description форс метод для удалении подписанного компонента из очереди,
|
|
28
|
+
* может быть полезно при массовом анмаунте компонентов
|
|
29
|
+
*/
|
|
10
30
|
remove: (id: PopId) => void;
|
|
31
|
+
/**
|
|
32
|
+
* @description метод добавления в стек
|
|
33
|
+
*/
|
|
11
34
|
push: (id: PopId) => void;
|
|
12
|
-
|
|
35
|
+
/**
|
|
36
|
+
* @description метод для запроса на выход из очереди,
|
|
37
|
+
* если все ок, то вернется true, что означает разрешение на выход и компонент будет вычеркнут из очереди,
|
|
38
|
+
* соответственно возврат false означает запрет, и компонент остается в очереди
|
|
39
|
+
*/
|
|
40
|
+
pop: (id: PopId, reason?: CloseEventReason) => boolean;
|
|
13
41
|
}
|
|
14
42
|
export declare const backdropStackManager: BackdropStackManager;
|
|
15
43
|
export {};
|
|
@@ -1,26 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description расширяемый набор конфликтующих причин закрытия с кликом по бэкдропу модалки,
|
|
3
|
+
* т.к. некоторые способы закрытия вызываются раньше, чем вызов backdropClick,
|
|
4
|
+
* а при несоблюдении последовательности возникают конфликты
|
|
5
|
+
*/
|
|
6
|
+
const backdropConflictsReasons = new Set([
|
|
7
|
+
'blur',
|
|
8
|
+
'clickAway',
|
|
9
|
+
]);
|
|
1
10
|
class BackdropStackManager {
|
|
2
11
|
constructor() {
|
|
3
12
|
var _a;
|
|
4
13
|
this.stack = [];
|
|
5
|
-
|
|
6
|
-
|
|
14
|
+
/**
|
|
15
|
+
* @description сохраняем информацию о том какой был предыдущий вызов pop,
|
|
16
|
+
* нужен для предотвращения синхронного закрытия при последовательности 'blur' и 'backdropClick' в рамках одного клика
|
|
17
|
+
*/
|
|
7
18
|
this.previousPopInfo = [null, null];
|
|
19
|
+
/**
|
|
20
|
+
* @description крайняя айдишка клика по странице
|
|
21
|
+
*/
|
|
8
22
|
this.currentPointerId = null;
|
|
23
|
+
/**
|
|
24
|
+
* @description метод проверки на конфликт причины закрытия с предыдущим
|
|
25
|
+
*/
|
|
9
26
|
this.checkOn = (reason) => {
|
|
10
27
|
const [previousReason, previousPointerId] = this.previousPopInfo;
|
|
11
28
|
return (reason === 'backdropClick' &&
|
|
12
|
-
previousReason
|
|
29
|
+
backdropConflictsReasons.has(previousReason) &&
|
|
13
30
|
previousPointerId === this.currentPointerId);
|
|
14
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* @description метод генерации случайной айдишки
|
|
34
|
+
*/
|
|
15
35
|
this.generateID = () => {
|
|
16
36
|
return String(Math.random());
|
|
17
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* @description форс метод для удалении подписанного компонента из очереди,
|
|
40
|
+
* может быть полезно при массовом анмаунте компонентов
|
|
41
|
+
*/
|
|
18
42
|
this.remove = (id) => {
|
|
19
43
|
this.stack = this.stack.filter((item) => item !== id);
|
|
20
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* @description метод добавления в стек
|
|
47
|
+
*/
|
|
21
48
|
this.push = (id) => {
|
|
22
49
|
this.stack.push(id);
|
|
23
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* @description метод для запроса на выход из очереди,
|
|
53
|
+
* если все ок, то вернется true, что означает разрешение на выход и компонент будет вычеркнут из очереди,
|
|
54
|
+
* соответственно возврат false означает запрет, и компонент остается в очереди
|
|
55
|
+
*/
|
|
24
56
|
this.pop = (id, reason) => {
|
|
25
57
|
if (this.checkOn(reason)) {
|
|
26
58
|
return false;
|
package/esm/Button/styles.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ export declare const LoadingButtonWrapper: import("@emotion/styled").StyledCompo
|
|
|
64
64
|
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
65
65
|
}, "disabled" | "action" | "color" | "sx" | "href" | "onFocusVisible" | "tabIndex" | "children" | "variant" | "size" | keyof import("@mui/material/OverridableComponent").CommonProps | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "TouchRippleProps" | "touchRippleRef" | "disableElevation" | "disableFocusRipple" | "endIcon" | "fullWidth" | "startIcon" | "loading" | "loadingIndicator" | "loadingPosition"> & {
|
|
66
66
|
theme?: import("@emotion/react").Theme | undefined;
|
|
67
|
-
} & Omit<import("
|
|
67
|
+
} & Omit<import("..").WithoutEmotionSpecific<import("@mui/lab").LoadingButtonProps<"button", {}>>, "color" | "variant"> & {
|
|
68
68
|
variant?: "link" | "light" | "text" | "contained" | undefined;
|
|
69
69
|
color?: "primary" | "error" | "warning" | "success" | undefined;
|
|
70
70
|
component?: import("react").ElementType<any> | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { UseClickAwayListenerOptions } from '../hooks';
|
|
3
|
+
export type ClickAwayListenerProps = Omit<UseClickAwayListenerOptions, 'ref'> & {
|
|
4
|
+
children: JSX.Element;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* @description компонент предоставляющий обертку для работы с хуком useClickAwayEffect
|
|
8
|
+
*/
|
|
9
|
+
export declare const ClickAwayListener: ({ onClickAway, preventBubbling, isActive, children, }: ClickAwayListenerProps) => import("react").FunctionComponentElement<any>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Children, cloneElement, useRef } from 'react';
|
|
2
|
+
import { useClickAwayEffect } from '../hooks';
|
|
3
|
+
/**
|
|
4
|
+
* @description компонент предоставляющий обертку для работы с хуком useClickAwayEffect
|
|
5
|
+
*/
|
|
6
|
+
export const ClickAwayListener = ({ onClickAway, preventBubbling, isActive, children, }) => {
|
|
7
|
+
const ref = useRef(null);
|
|
8
|
+
useClickAwayEffect({ ref, onClickAway, preventBubbling, isActive });
|
|
9
|
+
return Children.only(cloneElement(children, { ref }));
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { renderWithTheme, screen, userEvents } from '@astral/tests';
|
|
12
|
+
import { vi } from 'vitest';
|
|
13
|
+
import { ClickAwayListener } from './ClickAwayListener';
|
|
14
|
+
describe('ClickAwayListener', () => {
|
|
15
|
+
it('Props:isActive=true: при клике внутри onClickAway не вызывается', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
const onClickAway = vi.fn();
|
|
17
|
+
renderWithTheme(_jsx(ClickAwayListener, Object.assign({ onClickAway: onClickAway, isActive: true }, { children: _jsx("div", { children: "Lorem" }) })));
|
|
18
|
+
const div = screen.getByText('Lorem');
|
|
19
|
+
yield userEvents.click(div);
|
|
20
|
+
expect(onClickAway).toBeCalledTimes(0);
|
|
21
|
+
}));
|
|
22
|
+
it('Props:isActive=false: при клике внутри onClickAway не вызывается', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
|
+
const onClickAway = vi.fn();
|
|
24
|
+
renderWithTheme(_jsx(ClickAwayListener, Object.assign({ onClickAway: onClickAway, isActive: false }, { children: _jsx("div", { children: "Lorem" }) })));
|
|
25
|
+
const div = screen.getByText('Lorem');
|
|
26
|
+
yield userEvents.click(div);
|
|
27
|
+
expect(onClickAway).toBeCalledTimes(0);
|
|
28
|
+
}));
|
|
29
|
+
it('Props:isActive=true: при клике снаружи, onClickAway вызывается', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
|
+
const onClickAway = vi.fn();
|
|
31
|
+
renderWithTheme(_jsx(ClickAwayListener, Object.assign({ onClickAway: onClickAway, isActive: true }, { children: _jsx("div", { children: "Lorem" }) })));
|
|
32
|
+
yield userEvents.click(document.body);
|
|
33
|
+
expect(onClickAway).toBeCalledTimes(1);
|
|
34
|
+
}));
|
|
35
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ClickAwayListener';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ClickAwayListener';
|
|
@@ -16,7 +16,7 @@ export declare const DataGridNoDataIcon: import("@emotion/styled").StyledCompone
|
|
|
16
16
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
17
17
|
export declare const DataGridNoDataFigcaption: import("@emotion/styled").StyledComponent<Pick<import("react").PropsWithChildren<TypographyProps>, string | number | symbol> & import("react").RefAttributes<HTMLElement> & {
|
|
18
18
|
theme?: import("@emotion/react").Theme | undefined;
|
|
19
|
-
} & Omit<import("@mui/material/OverridableComponent").OverrideProps<import("
|
|
19
|
+
} & Omit<import("@mui/material/OverridableComponent").OverrideProps<import("../..").WithoutEmotionSpecific<import("@mui/material").TypographyTypeMap<{}, "span">>, import("react").ElementType<any>>, "color" | "variant"> & {
|
|
20
20
|
variant?: import("@mui/material").TypographyVariant | keyof import("@mui/material").TypographyPropsVariantOverrides | undefined;
|
|
21
21
|
component?: import("react").ElementType<any> | undefined;
|
|
22
22
|
color?: "primary" | "secondary" | "red" | "green" | "yellow" | "grey" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SyntheticEvent } from 'react';
|
|
2
2
|
import { TextFieldProps } from '../TextField';
|
|
3
3
|
import { DateMask } from '../utils/date';
|
|
4
|
-
import {
|
|
4
|
+
import { CloseEventReason } from '../types';
|
|
5
5
|
import { MinMaxDate } from './types';
|
|
6
6
|
import { MondayFirst } from './DayPicker';
|
|
7
7
|
export type DatePickerProps = MondayFirst & Partial<MinMaxDate> & {
|
|
@@ -16,13 +16,14 @@ export type DatePickerProps = MondayFirst & Partial<MinMaxDate> & {
|
|
|
16
16
|
onChange?: (date?: Date) => void;
|
|
17
17
|
onBlur?: () => void;
|
|
18
18
|
onOpen?: () => void;
|
|
19
|
-
onClose?: (event?: SyntheticEvent<Element, Event> | Event, reason?:
|
|
19
|
+
onClose?: (event?: SyntheticEvent<Element, Event> | Event, reason?: CloseEventReason) => void;
|
|
20
20
|
inputProps?: Omit<TextFieldProps, 'ref' | 'value' | 'onChange'>;
|
|
21
21
|
disabled?: boolean;
|
|
22
22
|
/**
|
|
23
23
|
* @description Принимает только Date object, включая невалидную дату Invalid date
|
|
24
24
|
* */
|
|
25
25
|
value?: Date;
|
|
26
|
+
className?: string;
|
|
26
27
|
};
|
|
27
28
|
export declare const DatePicker: import("react").ForwardRefExoticComponent<MondayFirst & Partial<MinMaxDate> & {
|
|
28
29
|
/**
|
|
@@ -36,11 +37,12 @@ export declare const DatePicker: import("react").ForwardRefExoticComponent<Monda
|
|
|
36
37
|
onChange?: ((date?: Date) => void) | undefined;
|
|
37
38
|
onBlur?: (() => void) | undefined;
|
|
38
39
|
onOpen?: (() => void) | undefined;
|
|
39
|
-
onClose?: ((event?: SyntheticEvent<Element, Event> | Event, reason?:
|
|
40
|
+
onClose?: ((event?: SyntheticEvent<Element, Event> | Event, reason?: CloseEventReason) => void) | undefined;
|
|
40
41
|
inputProps?: Omit<TextFieldProps, "ref" | "value" | "onChange"> | undefined;
|
|
41
42
|
disabled?: boolean | undefined;
|
|
42
43
|
/**
|
|
43
44
|
* @description Принимает только Date object, включая невалидную дату Invalid date
|
|
44
45
|
* */
|
|
45
46
|
value?: Date | undefined;
|
|
47
|
+
className?: string | undefined;
|
|
46
48
|
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -12,13 +12,13 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { forwardRef, useContext } from 'react';
|
|
14
14
|
import { useForwardedRef, useToggle } from '../hooks';
|
|
15
|
-
import {
|
|
15
|
+
import { ClickAwayListener } from '../ClickAwayListener';
|
|
16
16
|
import { DatePickerInput } from './DatePickerInput';
|
|
17
17
|
import { DatePickerPopper } from './DatePickerPopper';
|
|
18
18
|
import { MinMaxDateContext, MinMaxDateContextProvider, } from './MinMaxDateContext';
|
|
19
19
|
import { YearMonthDayPicker } from './YearMonthDayPicker';
|
|
20
20
|
import { useBaseDateInRange, useMaskedValue, useSelectedBaseDate, } from './hooks';
|
|
21
|
-
const DatePickerInner = forwardRef(({ onChange, onOpen, onBlur, onClose, mask = 'DD.MM.YYYY', isMondayFirst, inputProps, disabled, value, }, forwardedRef) => {
|
|
21
|
+
const DatePickerInner = forwardRef(({ onChange, onOpen, onBlur, onClose, mask = 'DD.MM.YYYY', isMondayFirst, inputProps, disabled, value, className, }, forwardedRef) => {
|
|
22
22
|
const { maxDate, minDate } = useContext(MinMaxDateContext);
|
|
23
23
|
const ref = useForwardedRef(forwardedRef);
|
|
24
24
|
const [isOpenPopper, openPopper, closePopper] = useToggle({
|
|
@@ -44,7 +44,7 @@ const DatePickerInner = forwardRef(({ onChange, onOpen, onBlur, onClose, mask =
|
|
|
44
44
|
const handleChangeMaskInput = (e) => {
|
|
45
45
|
onChangeMaskedValue(e.target.value);
|
|
46
46
|
};
|
|
47
|
-
return (
|
|
47
|
+
return (_jsx(ClickAwayListener, Object.assign({ isActive: isOpenPopper, onClickAway: handleClosePopper }, { children: _jsxs("div", Object.assign({ className: className }, { children: [_jsx(DatePickerInput, Object.assign({}, inputProps, { mask: mask, onNativeChange: handleChangeMaskInput, disabled: disabled, value: maskedValue, ref: ref, onFocus: openPopper })), _jsx(DatePickerPopper, Object.assign({ open: isOpenPopper, onClose: handleClosePopper, anchorEl: ref === null || ref === void 0 ? void 0 : ref.current }, { children: _jsx(YearMonthDayPicker, { isMondayFirst: isMondayFirst, selectedDate: selectedBaseDate, onChange: handleDayPick, date: selectedBaseDate || baseDate }) }))] })) })));
|
|
48
48
|
});
|
|
49
49
|
export const DatePicker = forwardRef((_a, forwardedRef) => {
|
|
50
50
|
var { minDate, maxDate } = _a, props = __rest(_a, ["minDate", "maxDate"]);
|
|
@@ -87,4 +87,10 @@ describe('DatePicker', () => {
|
|
|
87
87
|
yield userEvents.tab();
|
|
88
88
|
expect(onBlur).not.toBeCalled();
|
|
89
89
|
}));
|
|
90
|
+
it('Props:onBlur: не вызывается при клике мимо инпута, если поповер закрыт', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
91
|
+
const onBlur = vi.fn();
|
|
92
|
+
renderWithTheme(_jsx(DatePicker, { onBlur: onBlur }));
|
|
93
|
+
yield userEvents.click(document.body);
|
|
94
|
+
expect(onBlur).not.toBeCalled();
|
|
95
|
+
}));
|
|
90
96
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PropsWithChildren, SyntheticEvent } from 'react';
|
|
2
2
|
import { PopperProps } from '@mui/material';
|
|
3
|
-
import {
|
|
3
|
+
import { CloseEventReason, WithoutEmotionSpecific } from '../../types';
|
|
4
4
|
export type DatePickerProps = PropsWithChildren<Omit<WithoutEmotionSpecific<PopperProps>, 'children'>> & {
|
|
5
|
-
onClose?: (_?: SyntheticEvent<Element, Event> | Event, reason?:
|
|
5
|
+
onClose?: (_?: SyntheticEvent<Element, Event> | Event, reason?: CloseEventReason) => void;
|
|
6
6
|
};
|
|
7
7
|
export declare const DatePickerPopper: ({ children, onClose, ...props }: DatePickerProps) => JSX.Element;
|
package/esm/Fab/styles.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export declare const StyledFab: import("@emotion/styled").StyledComponent<{
|
|
|
30
30
|
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
31
31
|
}, "disabled" | "action" | "color" | "sx" | "href" | "onFocusVisible" | "tabIndex" | "children" | "variant" | "size" | keyof import("@mui/material/OverridableComponent").CommonProps | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple"> & {
|
|
32
32
|
theme?: import("@emotion/react").Theme | undefined;
|
|
33
|
-
} & Omit<import("
|
|
33
|
+
} & Omit<import("..").WithoutEmotionSpecific<import("@mui/material").FabProps<"button", {}>>, "color" | "variant"> & {
|
|
34
34
|
color?: "primary" | "default" | "error" | "warning" | "success" | undefined;
|
|
35
35
|
variant?: "square" | "circular" | "extended" | undefined;
|
|
36
36
|
} & {
|
|
@@ -8,7 +8,7 @@ export declare const getButtonSize: ({ size, }: IconButtonWrapperThemeProps) =>
|
|
|
8
8
|
export declare const getButtonSizeMobile: ({ size, }: IconButtonWrapperThemeProps) => string;
|
|
9
9
|
export declare const IconButtonWrapper: import("@emotion/styled").StyledComponent<Pick<import("../ButtonBase").BaseButtonProps, "color" | "translate" | keyof import("@mui/base").ButtonUnstyledOwnProps | "form" | "slot" | "style" | "title" | "key" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "value" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "component" | "variant" | "size" | "selected"> & import("react").RefAttributes<HTMLButtonElement> & {
|
|
10
10
|
theme?: import("@emotion/react").Theme | undefined;
|
|
11
|
-
} & Omit<import("
|
|
11
|
+
} & Omit<import("..").WithoutEmotionSpecific<import("@mui/lab").LoadingButtonProps<"button", {}>>, "color" | "variant"> & {
|
|
12
12
|
variant?: "link" | "light" | "text" | "contained" | undefined;
|
|
13
13
|
color?: "primary" | "error" | "warning" | "success" | undefined;
|
|
14
14
|
component?: import("react").ElementType<any> | undefined;
|
package/esm/ListItem/ListItem.js
CHANGED
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
2
|
import { StyledListItem } from './styles';
|
|
14
|
-
export const ListItem = (
|
|
15
|
-
var props = __rest(_a, []);
|
|
3
|
+
export const ListItem = (props) => {
|
|
16
4
|
return _jsx(StyledListItem, Object.assign({}, props));
|
|
17
5
|
};
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type MenuGroupProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
/**
|
|
5
|
+
* Заголовок группы
|
|
6
|
+
*/
|
|
7
|
+
label: string;
|
|
8
|
+
};
|
|
3
9
|
export declare const MenuGroup: (props: MenuGroupProps) => JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { MenuGroupContent, MenuGroupLabel } from './styles';
|
|
4
4
|
export const MenuGroup = (props) => {
|
|
5
5
|
const { children, label } = props;
|
|
6
6
|
const upperCasedLabel = useMemo(() => label.toUpperCase(), [label]);
|
|
7
|
-
return (_jsxs(_Fragment, { children: [_jsx(
|
|
7
|
+
return (_jsxs(_Fragment, { children: [_jsx(MenuGroupLabel, Object.assign({ component: "li", variant: "h7" }, { children: upperCasedLabel })), _jsx(MenuGroupContent, { children: _jsx("ul", { children: children }) })] }));
|
|
8
8
|
};
|
|
@@ -35,4 +35,4 @@ export declare const StyledLabel: import("@emotion/styled").StyledComponent<Pick
|
|
|
35
35
|
export declare const StyledMenuWrapper: import("@emotion/styled").StyledComponent<{
|
|
36
36
|
theme?: import("@emotion/react").Theme | undefined;
|
|
37
37
|
as?: import("react").ElementType<any> | undefined;
|
|
38
|
-
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<
|
|
38
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, {}>;
|
|
@@ -7,6 +7,6 @@ export const StyledMenuItem = styled(MenuItem) `
|
|
|
7
7
|
export const StyledLabel = styled(Typography) `
|
|
8
8
|
font-size: ${({ theme }) => theme.typography.h5.fontSize};
|
|
9
9
|
`;
|
|
10
|
-
export const StyledMenuWrapper = styled.
|
|
11
|
-
padding
|
|
10
|
+
export const StyledMenuWrapper = styled.ul `
|
|
11
|
+
padding: ${({ theme }) => theme.spacing(2, 0, 0, 0)};
|
|
12
12
|
`;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const MenuGroupLabel: import("@emotion/styled").StyledComponent<Pick<import("react").PropsWithChildren<import("../Typography").TypographyProps>, string | number | symbol> & import("react").RefAttributes<HTMLElement> & {
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
}, {}, {}>;
|
|
5
|
+
export declare const MenuGroupContent: import("@emotion/styled").StyledComponent<{
|
|
6
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
7
|
+
as?: import("react").ElementType<any> | undefined;
|
|
8
|
+
}, import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, {}>;
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { styled } from '../styles';
|
|
2
2
|
import { Typography } from '../Typography';
|
|
3
|
-
export const
|
|
3
|
+
export const MenuGroupLabel = styled(Typography) `
|
|
4
4
|
display: block;
|
|
5
|
+
width: 100%;
|
|
5
6
|
padding: ${({ theme }) => theme.spacing(2, 4)};
|
|
6
7
|
|
|
7
8
|
color: ${({ theme }) => theme.palette.grey[700]};
|
|
8
9
|
line-height: ${({ theme }) => theme.typography.pxToRem(16)};
|
|
9
10
|
`;
|
|
10
|
-
export const
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
export const MenuGroupContent = styled.li `
|
|
12
|
+
width: 100%;
|
|
13
|
+
|
|
14
|
+
& ul {
|
|
15
|
+
padding: 0;
|
|
16
|
+
|
|
17
|
+
list-style: none;
|
|
13
18
|
}
|
|
14
19
|
`;
|
|
@@ -14,7 +14,7 @@ import { ConfigContext } from '../ConfigProvider';
|
|
|
14
14
|
import { IconButton } from '../IconButton';
|
|
15
15
|
import { useMenu } from '../hooks';
|
|
16
16
|
import { ProductSwitcherContent } from './ProductSwitcherContent';
|
|
17
|
-
import {
|
|
17
|
+
import { WidgetMenu } from './styles';
|
|
18
18
|
export const ProductSwitcher = ({ getProducts }) => {
|
|
19
19
|
const [products, setProducts] = useState([]);
|
|
20
20
|
const [isLoading, setIsLoading] = useState(false);
|
|
@@ -38,5 +38,5 @@ export const ProductSwitcher = ({ getProducts }) => {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
|
-
return (_jsxs(_Fragment, { children: [_jsx(IconButton, Object.assign({ ref: anchorRef, selected: open, variant: "text", onClick: handleShowProducts }, { children: _jsx(ProductsFillMd, {}) })), _jsx(WidgetMenu, Object.assign({ open: open, anchorEl: anchorRef.current, onClose: handleCloseMenu }, { children: _jsx(
|
|
41
|
+
return (_jsxs(_Fragment, { children: [_jsx(IconButton, Object.assign({ ref: anchorRef, selected: open, variant: "text", onClick: handleShowProducts }, { children: _jsx(ProductsFillMd, {}) })), _jsx(WidgetMenu, Object.assign({ open: open, anchorEl: anchorRef.current, onClose: handleCloseMenu }, { children: _jsx(ProductSwitcherContent, { isLoading: isLoading, isError: isError, products: products }) }))] }));
|
|
42
42
|
};
|