@astral/ui 4.91.0 → 4.91.2

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.
Files changed (29) hide show
  1. package/components/DialogHeader/DialogHeader.js +2 -3
  2. package/components/DialogHeader/styles.d.ts +10 -0
  3. package/components/DialogHeader/styles.js +4 -0
  4. package/components/DialogTitle/DialogTitle.js +2 -2
  5. package/components/DialogTitle/styles.d.ts +11 -0
  6. package/components/DialogTitle/styles.js +6 -0
  7. package/components/HintPopover/types.d.ts +1 -1
  8. package/components/Onboarding/ui/StepStrategy/steps/HighlightStep/HighlightStep.js +2 -2
  9. package/components/Onboarding/ui/StepStrategy/steps/HighlightStep/useLogic/useLogic.d.ts +1 -2
  10. package/components/Onboarding/ui/StepStrategy/steps/HighlightStep/useLogic/useLogic.js +4 -10
  11. package/node/components/DialogHeader/DialogHeader.js +1 -2
  12. package/node/components/DialogHeader/styles.d.ts +10 -0
  13. package/node/components/DialogHeader/styles.js +5 -1
  14. package/node/components/DialogTitle/DialogTitle.js +2 -2
  15. package/node/components/DialogTitle/styles.d.ts +11 -0
  16. package/node/components/DialogTitle/styles.js +9 -0
  17. package/node/components/HintPopover/types.d.ts +1 -1
  18. package/node/components/Onboarding/ui/StepStrategy/steps/HighlightStep/HighlightStep.js +2 -2
  19. package/node/components/Onboarding/ui/StepStrategy/steps/HighlightStep/useLogic/useLogic.d.ts +1 -2
  20. package/node/components/Onboarding/ui/StepStrategy/steps/HighlightStep/useLogic/useLogic.js +3 -9
  21. package/package.json +1 -1
  22. package/components/Onboarding/ui/hooks/useFocusTrap/index.d.ts +0 -1
  23. package/components/Onboarding/ui/hooks/useFocusTrap/index.js +0 -1
  24. package/components/Onboarding/ui/hooks/useFocusTrap/useFocusTrap.d.ts +0 -6
  25. package/components/Onboarding/ui/hooks/useFocusTrap/useFocusTrap.js +0 -33
  26. package/node/components/Onboarding/ui/hooks/useFocusTrap/index.d.ts +0 -1
  27. package/node/components/Onboarding/ui/hooks/useFocusTrap/index.js +0 -5
  28. package/node/components/Onboarding/ui/hooks/useFocusTrap/useFocusTrap.d.ts +0 -6
  29. package/node/components/Onboarding/ui/hooks/useFocusTrap/useFocusTrap.js +0 -37
@@ -1,13 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { CrossOutlineMd } from '../../icons/CrossOutlineMd';
3
- import { IconButton } from '../IconButton';
4
3
  import { Typography } from '../Typography';
5
- import { HeaderContent, Wrapper } from './styles';
4
+ import { HeaderContent, StyledIconButton, Wrapper } from './styles';
6
5
  export const DialogHeader = ({ children, title, justifyContent = 'flex-start', disableSpacing, onClose, className, }) => {
7
6
  const handleTitleClick = (e) => {
8
7
  if (onClose) {
9
8
  onClose(e, 'escapeKeyDown');
10
9
  }
11
10
  };
12
- return (_jsxs(Wrapper, { className: className, hasTitle: Boolean(title), hasOnClose: Boolean(onClose), children: [title && _jsx(Typography, { variant: "h4", children: title }), _jsx(HeaderContent, { justifyContent: justifyContent, columnSpacing: disableSpacing ? 0 : 2, children: children }), onClose && (_jsx(IconButton, { variant: "text", onClick: handleTitleClick, "aria-label": "\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u043C\u043E\u0434\u0430\u043B\u044C\u043D\u043E\u0435 \u043E\u043A\u043D\u043E", children: _jsx(CrossOutlineMd, {}) }))] }));
11
+ return (_jsxs(Wrapper, { className: className, hasTitle: Boolean(title), hasOnClose: Boolean(onClose), children: [title && _jsx(Typography, { variant: "h4", children: title }), _jsx(HeaderContent, { justifyContent: justifyContent, columnSpacing: disableSpacing ? 0 : 2, children: children }), onClose && (_jsx(StyledIconButton, { variant: "text", onClick: handleTitleClick, "aria-label": "\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u043C\u043E\u0434\u0430\u043B\u044C\u043D\u043E\u0435 \u043E\u043A\u043D\u043E", children: _jsx(CrossOutlineMd, {}) }))] }));
13
12
  };
@@ -13,6 +13,16 @@ export declare const Wrapper: import("../styled").StyledComponent<{
13
13
  theme?: import("@emotion/react").Theme | undefined;
14
14
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
15
15
  } & DialogHeaderRootProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
16
+ export declare const StyledIconButton: import("../styled").StyledComponent<Omit<import("..").WithoutEmotionSpecific<import("@mui/material").ButtonProps>, "color" | "component" | "size" | "variant" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple"> & {
17
+ variant?: "light" | "link" | "text" | "contained" | "outlined" | undefined;
18
+ loading?: boolean | undefined;
19
+ color?: "primary" | "success" | "warning" | "error" | "grey" | undefined;
20
+ component?: import("react").ElementType | undefined;
21
+ selected?: boolean | undefined;
22
+ size?: "large" | "medium" | undefined;
23
+ } & Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, ""> & import("react").RefAttributes<HTMLButtonElement> & {
24
+ theme?: import("@emotion/react").Theme | undefined;
25
+ }, {}, {}>;
16
26
  export type DialogHeaderContentProps = {
17
27
  justifyContent: CSSProperties['justifyContent'];
18
28
  columnSpacing: number;
@@ -1,3 +1,4 @@
1
+ import { IconButton } from '../IconButton';
1
2
  import { styled } from '../styled';
2
3
  export const Wrapper = styled('div', {
3
4
  label: 'DialogHeader-root',
@@ -23,6 +24,9 @@ export const Wrapper = styled('div', {
23
24
  height: auto;
24
25
  padding: ${({ theme }) => theme.spacing(4, 6)};
25
26
  `;
27
+ export const StyledIconButton = styled(IconButton) `
28
+ align-self: start;
29
+ `;
26
30
  export const HeaderContent = styled('div', {
27
31
  shouldForwardProp: (prop) => !['justifyContent', 'columnSpacing'].includes(prop),
28
32
  label: 'DialogHeader-content',
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import MuiDialogTitle from '@mui/material/DialogTitle';
3
3
  import { CrossOutlineMd } from '../../icons/CrossOutlineMd';
4
- import { IconButton } from '../IconButton';
4
+ import { StyledIconButton } from './styles';
5
5
  export const DialogTitle = ({ children, onClose, headerContent, ...props }) => {
6
6
  // 'escapeKeyDown' в документашке написано что это опциональный тип, и можно стрингу любую туда закидывать, а по факту либо escapeKeyDown либо backdropClick
7
7
  const handleTitleClick = (e) => {
@@ -9,5 +9,5 @@ export const DialogTitle = ({ children, onClose, headerContent, ...props }) => {
9
9
  onClose(e, 'escapeKeyDown');
10
10
  }
11
11
  };
12
- return (_jsxs(MuiDialogTitle, { ...props, children: [children, headerContent, onClose && (_jsx(IconButton, { variant: "text", onClick: handleTitleClick, "aria-label": "\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u043C\u043E\u0434\u0430\u043B\u044C\u043D\u043E\u0435 \u043E\u043A\u043D\u043E", children: _jsx(CrossOutlineMd, {}) }))] }));
12
+ return (_jsxs(MuiDialogTitle, { ...props, children: [children, headerContent, onClose && (_jsx(StyledIconButton, { variant: "text", onClick: handleTitleClick, "aria-label": "\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u043C\u043E\u0434\u0430\u043B\u044C\u043D\u043E\u0435 \u043E\u043A\u043D\u043E", children: _jsx(CrossOutlineMd, {}) }))] }));
13
13
  };
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ export declare const StyledIconButton: import("../styled").StyledComponent<Omit<import("..").WithoutEmotionSpecific<import("@mui/material").ButtonProps>, "color" | "component" | "size" | "variant" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple"> & {
3
+ variant?: "light" | "link" | "text" | "contained" | "outlined" | undefined;
4
+ loading?: boolean | undefined;
5
+ color?: "primary" | "success" | "warning" | "error" | "grey" | undefined;
6
+ component?: import("react").ElementType | undefined;
7
+ selected?: boolean | undefined;
8
+ size?: "large" | "medium" | undefined;
9
+ } & Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, ""> & import("react").RefAttributes<HTMLButtonElement> & {
10
+ theme?: import("@emotion/react").Theme | undefined;
11
+ }, {}, {}>;
@@ -0,0 +1,6 @@
1
+ import { IconButton } from '../IconButton';
2
+ import { styled } from '../styled';
3
+ export const StyledIconButton = styled(IconButton) `
4
+ flex-shrink: 0;
5
+ align-self: start;
6
+ `;
@@ -18,7 +18,7 @@ export type HintPopoverProps = Omit<NewPopoverProps, 'hasArrow' | 'disableMobile
18
18
  */
19
19
  action?: ReactNode;
20
20
  /**
21
- * Ref на узел контента — для фокус-трапа/определения кликов у потребителя.
21
+ * Ref на узел контента — для focus-trap/определения кликов у потребителя.
22
22
  */
23
23
  contentRef?: Ref<HTMLDivElement>;
24
24
  };
@@ -9,10 +9,10 @@ import { useLogic } from './useLogic';
9
9
  export const HighlightStep = ({ activeStep, isClosing, geometry, }) => {
10
10
  const { step } = activeStep;
11
11
  const { anchorEl } = geometry;
12
- const { isOpen, shouldShowPopover, setPopoverNode, handleClose } = useLogic(activeStep, isClosing, geometry);
12
+ const { isOpen, shouldShowPopover, handleClose } = useLogic(activeStep, isClosing, geometry);
13
13
  // Без якоря popover не рисуем.
14
14
  if (!anchorEl) {
15
15
  return null;
16
16
  }
17
- return (_jsx(_Fragment, { children: shouldShowPopover && (_jsx(StepPopover, { variant: "light", isOpen: isOpen, disableAutoFocus: true, anchorEl: anchorEl, placement: step.position, onClose: handleClose, contentRef: setPopoverNode, title: step.title, action: _jsx(StepFooter, { activeStep: activeStep }), children: step.content && (_jsx(Typography, { component: "div", variant: "body1", color: "grey", colorIntensity: "900", children: step.content })) })) }));
17
+ return (_jsx(_Fragment, { children: shouldShowPopover && (_jsx(StepPopover, { variant: "light", isOpen: isOpen, disableAutoFocus: true, anchorEl: anchorEl, placement: step.position, onClose: handleClose, title: step.title, action: _jsx(StepFooter, { activeStep: activeStep }), children: step.content && (_jsx(Typography, { component: "div", variant: "body1", color: "grey", colorIntensity: "900", children: step.content })) })) }));
18
18
  };
@@ -3,10 +3,9 @@ import { type OverlayGeometry } from '../../../useLogic';
3
3
  export type UseLogicResult = {
4
4
  isOpen: boolean;
5
5
  shouldShowPopover: boolean;
6
- setPopoverNode: (node: HTMLElement | null) => void;
7
6
  handleClose: () => void;
8
7
  };
9
8
  /**
10
- * Логика highlight-шага: задержка popover, фокус-трап, закрытие.
9
+ * Логика highlight-шага: задержка popover, закрытие.
11
10
  */
12
11
  export declare const useLogic: (activeStep: ActiveStepState, isClosing: boolean, geometry: OverlayGeometry) => UseLogicResult;
@@ -1,12 +1,11 @@
1
- import { useCallback, useEffect, useMemo, useState } from 'react';
1
+ import { useCallback, useEffect, useState } from 'react';
2
2
  import { useTheme } from '../../../../../../theme/hooks/useTheme';
3
- import { useFocusTrap } from '../../../../hooks/useFocusTrap';
4
3
  /**
5
- * Логика highlight-шага: задержка popover, фокус-трап, закрытие.
4
+ * Логика highlight-шага: задержка popover, закрытие.
6
5
  */
7
6
  export const useLogic = (activeStep, isClosing, geometry) => {
8
- const { isInteractive, isConfirming } = activeStep;
9
- const { anchorEl, element, isTransitioning } = geometry;
7
+ const { isConfirming } = activeStep;
8
+ const { anchorEl, isTransitioning } = geometry;
10
9
  const theme = useTheme();
11
10
  const isOpen = !isClosing;
12
11
  // Задержка до появления popover после готовности hole.
@@ -19,10 +18,6 @@ export const useLogic = (activeStep, isClosing, geometry) => {
19
18
  const timer = setTimeout(() => setIsEntered(true), theme.transitions.duration.shortest);
20
19
  return () => clearTimeout(timer);
21
20
  }, [isEntered, isHoleReady]);
22
- const [popoverNode, setPopoverNode] = useState(null);
23
- const trapNodes = useMemo(() => [popoverNode, isInteractive ? element : null], [popoverNode, isInteractive, element]);
24
- // Трап выключен при закрытии/подтверждении.
25
- useFocusTrap(trapNodes, isOpen && !isConfirming);
26
21
  const handleClose = useCallback(() => {
27
22
  activeStep.requestClose();
28
23
  }, [activeStep]);
@@ -31,7 +26,6 @@ export const useLogic = (activeStep, isClosing, geometry) => {
31
26
  return {
32
27
  isOpen,
33
28
  shouldShowPopover,
34
- setPopoverNode,
35
29
  handleClose,
36
30
  };
37
31
  };
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DialogHeader = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const CrossOutlineMd_1 = require("../../icons/CrossOutlineMd");
6
- const IconButton_1 = require("../IconButton");
7
6
  const Typography_1 = require("../Typography");
8
7
  const styles_1 = require("./styles");
9
8
  const DialogHeader = ({ children, title, justifyContent = 'flex-start', disableSpacing, onClose, className, }) => {
@@ -12,6 +11,6 @@ const DialogHeader = ({ children, title, justifyContent = 'flex-start', disableS
12
11
  onClose(e, 'escapeKeyDown');
13
12
  }
14
13
  };
15
- return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { className: className, hasTitle: Boolean(title), hasOnClose: Boolean(onClose), children: [title && (0, jsx_runtime_1.jsx)(Typography_1.Typography, { variant: "h4", children: title }), (0, jsx_runtime_1.jsx)(styles_1.HeaderContent, { justifyContent: justifyContent, columnSpacing: disableSpacing ? 0 : 2, children: children }), onClose && ((0, jsx_runtime_1.jsx)(IconButton_1.IconButton, { variant: "text", onClick: handleTitleClick, "aria-label": "\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u043C\u043E\u0434\u0430\u043B\u044C\u043D\u043E\u0435 \u043E\u043A\u043D\u043E", children: (0, jsx_runtime_1.jsx)(CrossOutlineMd_1.CrossOutlineMd, {}) }))] }));
14
+ return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { className: className, hasTitle: Boolean(title), hasOnClose: Boolean(onClose), children: [title && (0, jsx_runtime_1.jsx)(Typography_1.Typography, { variant: "h4", children: title }), (0, jsx_runtime_1.jsx)(styles_1.HeaderContent, { justifyContent: justifyContent, columnSpacing: disableSpacing ? 0 : 2, children: children }), onClose && ((0, jsx_runtime_1.jsx)(styles_1.StyledIconButton, { variant: "text", onClick: handleTitleClick, "aria-label": "\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u043C\u043E\u0434\u0430\u043B\u044C\u043D\u043E\u0435 \u043E\u043A\u043D\u043E", children: (0, jsx_runtime_1.jsx)(CrossOutlineMd_1.CrossOutlineMd, {}) }))] }));
16
15
  };
17
16
  exports.DialogHeader = DialogHeader;
@@ -13,6 +13,16 @@ export declare const Wrapper: import("@emotion/styled/dist/declarations/src/type
13
13
  theme?: import("@emotion/react").Theme | undefined;
14
14
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
15
15
  } & DialogHeaderRootProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
16
+ export declare const StyledIconButton: import("@emotion/styled/dist/declarations/src/types").StyledComponent<Omit<import("..").WithoutEmotionSpecific<import("@mui/material").ButtonProps>, "color" | "component" | "size" | "variant" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple"> & {
17
+ variant?: "light" | "link" | "text" | "contained" | "outlined" | undefined;
18
+ loading?: boolean | undefined;
19
+ color?: "primary" | "success" | "warning" | "error" | "grey" | undefined;
20
+ component?: import("react").ElementType | undefined;
21
+ selected?: boolean | undefined;
22
+ size?: "large" | "medium" | undefined;
23
+ } & Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, ""> & import("react").RefAttributes<HTMLButtonElement> & {
24
+ theme?: import("@emotion/react").Theme | undefined;
25
+ }, {}, {}>;
16
26
  export type DialogHeaderContentProps = {
17
27
  justifyContent: CSSProperties['justifyContent'];
18
28
  columnSpacing: number;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HeaderContent = exports.Wrapper = void 0;
3
+ exports.HeaderContent = exports.StyledIconButton = exports.Wrapper = void 0;
4
+ const IconButton_1 = require("../IconButton");
4
5
  const styled_1 = require("../styled");
5
6
  exports.Wrapper = (0, styled_1.styled)('div', {
6
7
  label: 'DialogHeader-root',
@@ -26,6 +27,9 @@ exports.Wrapper = (0, styled_1.styled)('div', {
26
27
  height: auto;
27
28
  padding: ${({ theme }) => theme.spacing(4, 6)};
28
29
  `;
30
+ exports.StyledIconButton = (0, styled_1.styled)(IconButton_1.IconButton) `
31
+ align-self: start;
32
+ `;
29
33
  exports.HeaderContent = (0, styled_1.styled)('div', {
30
34
  shouldForwardProp: (prop) => !['justifyContent', 'columnSpacing'].includes(prop),
31
35
  label: 'DialogHeader-content',
@@ -7,7 +7,7 @@ exports.DialogTitle = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const DialogTitle_1 = __importDefault(require("@mui/material/DialogTitle"));
9
9
  const CrossOutlineMd_1 = require("../../icons/CrossOutlineMd");
10
- const IconButton_1 = require("../IconButton");
10
+ const styles_1 = require("./styles");
11
11
  const DialogTitle = ({ children, onClose, headerContent, ...props }) => {
12
12
  // 'escapeKeyDown' в документашке написано что это опциональный тип, и можно стрингу любую туда закидывать, а по факту либо escapeKeyDown либо backdropClick
13
13
  const handleTitleClick = (e) => {
@@ -15,6 +15,6 @@ const DialogTitle = ({ children, onClose, headerContent, ...props }) => {
15
15
  onClose(e, 'escapeKeyDown');
16
16
  }
17
17
  };
18
- return ((0, jsx_runtime_1.jsxs)(DialogTitle_1.default, { ...props, children: [children, headerContent, onClose && ((0, jsx_runtime_1.jsx)(IconButton_1.IconButton, { variant: "text", onClick: handleTitleClick, "aria-label": "\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u043C\u043E\u0434\u0430\u043B\u044C\u043D\u043E\u0435 \u043E\u043A\u043D\u043E", children: (0, jsx_runtime_1.jsx)(CrossOutlineMd_1.CrossOutlineMd, {}) }))] }));
18
+ return ((0, jsx_runtime_1.jsxs)(DialogTitle_1.default, { ...props, children: [children, headerContent, onClose && ((0, jsx_runtime_1.jsx)(styles_1.StyledIconButton, { variant: "text", onClick: handleTitleClick, "aria-label": "\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u043C\u043E\u0434\u0430\u043B\u044C\u043D\u043E\u0435 \u043E\u043A\u043D\u043E", children: (0, jsx_runtime_1.jsx)(CrossOutlineMd_1.CrossOutlineMd, {}) }))] }));
19
19
  };
20
20
  exports.DialogTitle = DialogTitle;
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ export declare const StyledIconButton: import("@emotion/styled/dist/declarations/src/types").StyledComponent<Omit<import("..").WithoutEmotionSpecific<import("@mui/material").ButtonProps>, "color" | "component" | "size" | "variant" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple"> & {
3
+ variant?: "light" | "link" | "text" | "contained" | "outlined" | undefined;
4
+ loading?: boolean | undefined;
5
+ color?: "primary" | "success" | "warning" | "error" | "grey" | undefined;
6
+ component?: import("react").ElementType | undefined;
7
+ selected?: boolean | undefined;
8
+ size?: "large" | "medium" | undefined;
9
+ } & Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, ""> & import("react").RefAttributes<HTMLButtonElement> & {
10
+ theme?: import("@emotion/react").Theme | undefined;
11
+ }, {}, {}>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StyledIconButton = void 0;
4
+ const IconButton_1 = require("../IconButton");
5
+ const styled_1 = require("../styled");
6
+ exports.StyledIconButton = (0, styled_1.styled)(IconButton_1.IconButton) `
7
+ flex-shrink: 0;
8
+ align-self: start;
9
+ `;
@@ -18,7 +18,7 @@ export type HintPopoverProps = Omit<NewPopoverProps, 'hasArrow' | 'disableMobile
18
18
  */
19
19
  action?: ReactNode;
20
20
  /**
21
- * Ref на узел контента — для фокус-трапа/определения кликов у потребителя.
21
+ * Ref на узел контента — для focus-trap/определения кликов у потребителя.
22
22
  */
23
23
  contentRef?: Ref<HTMLDivElement>;
24
24
  };
@@ -12,11 +12,11 @@ const useLogic_1 = require("./useLogic");
12
12
  const HighlightStep = ({ activeStep, isClosing, geometry, }) => {
13
13
  const { step } = activeStep;
14
14
  const { anchorEl } = geometry;
15
- const { isOpen, shouldShowPopover, setPopoverNode, handleClose } = (0, useLogic_1.useLogic)(activeStep, isClosing, geometry);
15
+ const { isOpen, shouldShowPopover, handleClose } = (0, useLogic_1.useLogic)(activeStep, isClosing, geometry);
16
16
  // Без якоря popover не рисуем.
17
17
  if (!anchorEl) {
18
18
  return null;
19
19
  }
20
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: shouldShowPopover && ((0, jsx_runtime_1.jsx)(styles_1.StepPopover, { variant: "light", isOpen: isOpen, disableAutoFocus: true, anchorEl: anchorEl, placement: step.position, onClose: handleClose, contentRef: setPopoverNode, title: step.title, action: (0, jsx_runtime_1.jsx)(StepFooter_1.StepFooter, { activeStep: activeStep }), children: step.content && ((0, jsx_runtime_1.jsx)(Typography_1.Typography, { component: "div", variant: "body1", color: "grey", colorIntensity: "900", children: step.content })) })) }));
20
+ return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: shouldShowPopover && ((0, jsx_runtime_1.jsx)(styles_1.StepPopover, { variant: "light", isOpen: isOpen, disableAutoFocus: true, anchorEl: anchorEl, placement: step.position, onClose: handleClose, title: step.title, action: (0, jsx_runtime_1.jsx)(StepFooter_1.StepFooter, { activeStep: activeStep }), children: step.content && ((0, jsx_runtime_1.jsx)(Typography_1.Typography, { component: "div", variant: "body1", color: "grey", colorIntensity: "900", children: step.content })) })) }));
21
21
  };
22
22
  exports.HighlightStep = HighlightStep;
@@ -3,10 +3,9 @@ import { type OverlayGeometry } from '../../../useLogic';
3
3
  export type UseLogicResult = {
4
4
  isOpen: boolean;
5
5
  shouldShowPopover: boolean;
6
- setPopoverNode: (node: HTMLElement | null) => void;
7
6
  handleClose: () => void;
8
7
  };
9
8
  /**
10
- * Логика highlight-шага: задержка popover, фокус-трап, закрытие.
9
+ * Логика highlight-шага: задержка popover, закрытие.
11
10
  */
12
11
  export declare const useLogic: (activeStep: ActiveStepState, isClosing: boolean, geometry: OverlayGeometry) => UseLogicResult;
@@ -3,13 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useLogic = void 0;
4
4
  const react_1 = require("react");
5
5
  const useTheme_1 = require("../../../../../../theme/hooks/useTheme");
6
- const useFocusTrap_1 = require("../../../../hooks/useFocusTrap");
7
6
  /**
8
- * Логика highlight-шага: задержка popover, фокус-трап, закрытие.
7
+ * Логика highlight-шага: задержка popover, закрытие.
9
8
  */
10
9
  const useLogic = (activeStep, isClosing, geometry) => {
11
- const { isInteractive, isConfirming } = activeStep;
12
- const { anchorEl, element, isTransitioning } = geometry;
10
+ const { isConfirming } = activeStep;
11
+ const { anchorEl, isTransitioning } = geometry;
13
12
  const theme = (0, useTheme_1.useTheme)();
14
13
  const isOpen = !isClosing;
15
14
  // Задержка до появления popover после готовности hole.
@@ -22,10 +21,6 @@ const useLogic = (activeStep, isClosing, geometry) => {
22
21
  const timer = setTimeout(() => setIsEntered(true), theme.transitions.duration.shortest);
23
22
  return () => clearTimeout(timer);
24
23
  }, [isEntered, isHoleReady]);
25
- const [popoverNode, setPopoverNode] = (0, react_1.useState)(null);
26
- const trapNodes = (0, react_1.useMemo)(() => [popoverNode, isInteractive ? element : null], [popoverNode, isInteractive, element]);
27
- // Трап выключен при закрытии/подтверждении.
28
- (0, useFocusTrap_1.useFocusTrap)(trapNodes, isOpen && !isConfirming);
29
24
  const handleClose = (0, react_1.useCallback)(() => {
30
25
  activeStep.requestClose();
31
26
  }, [activeStep]);
@@ -34,7 +29,6 @@ const useLogic = (activeStep, isClosing, geometry) => {
34
29
  return {
35
30
  isOpen,
36
31
  shouldShowPopover,
37
- setPopoverNode,
38
32
  handleClose,
39
33
  };
40
34
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "4.91.0",
3
+ "version": "4.91.2",
4
4
  "browser": "./index.js",
5
5
  "main": "./node/index.js",
6
6
  "dependencies": {
@@ -1 +0,0 @@
1
- export { useFocusTrap } from './useFocusTrap';
@@ -1 +0,0 @@
1
- export { useFocusTrap } from './useFocusTrap';
@@ -1,6 +0,0 @@
1
- /**
2
- * Мульти-контейнерный фокус-трап для highlight-шага.
3
- * @param nodes контейнеры
4
- * @param isActive включение трапа
5
- */
6
- export declare const useFocusTrap: (nodes: (HTMLElement | null)[], isActive?: boolean) => void;
@@ -1,33 +0,0 @@
1
- import { createFocusTrap } from 'focus-trap';
2
- import { useEffect } from 'react';
3
- /**
4
- * Мульти-контейнерный фокус-трап для highlight-шага.
5
- * @param nodes контейнеры
6
- * @param isActive включение трапа
7
- */
8
- export const useFocusTrap = (nodes, isActive = true) => {
9
- useEffect(() => {
10
- const containers = nodes.filter((node) => node !== null);
11
- if (!isActive || containers.length === 0) {
12
- return;
13
- }
14
- const trap = createFocusTrap(containers, {
15
- escapeDeactivates: false,
16
- clickOutsideDeactivates: false,
17
- allowOutsideClick: true,
18
- returnFocusOnDeactivate: false,
19
- fallbackFocus: containers[0],
20
- initialFocus: () => containers[0],
21
- });
22
- try {
23
- trap.activate();
24
- }
25
- catch {
26
- // Нет фокусируемых узлов.
27
- return;
28
- }
29
- return () => {
30
- trap.deactivate();
31
- };
32
- }, [nodes, isActive]);
33
- };
@@ -1 +0,0 @@
1
- export { useFocusTrap } from './useFocusTrap';
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useFocusTrap = void 0;
4
- var useFocusTrap_1 = require("./useFocusTrap");
5
- Object.defineProperty(exports, "useFocusTrap", { enumerable: true, get: function () { return useFocusTrap_1.useFocusTrap; } });
@@ -1,6 +0,0 @@
1
- /**
2
- * Мульти-контейнерный фокус-трап для highlight-шага.
3
- * @param nodes контейнеры
4
- * @param isActive включение трапа
5
- */
6
- export declare const useFocusTrap: (nodes: (HTMLElement | null)[], isActive?: boolean) => void;
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useFocusTrap = void 0;
4
- const focus_trap_1 = require("focus-trap");
5
- const react_1 = require("react");
6
- /**
7
- * Мульти-контейнерный фокус-трап для highlight-шага.
8
- * @param nodes контейнеры
9
- * @param isActive включение трапа
10
- */
11
- const useFocusTrap = (nodes, isActive = true) => {
12
- (0, react_1.useEffect)(() => {
13
- const containers = nodes.filter((node) => node !== null);
14
- if (!isActive || containers.length === 0) {
15
- return;
16
- }
17
- const trap = (0, focus_trap_1.createFocusTrap)(containers, {
18
- escapeDeactivates: false,
19
- clickOutsideDeactivates: false,
20
- allowOutsideClick: true,
21
- returnFocusOnDeactivate: false,
22
- fallbackFocus: containers[0],
23
- initialFocus: () => containers[0],
24
- });
25
- try {
26
- trap.activate();
27
- }
28
- catch {
29
- // Нет фокусируемых узлов.
30
- return;
31
- }
32
- return () => {
33
- trap.deactivate();
34
- };
35
- }, [nodes, isActive]);
36
- };
37
- exports.useFocusTrap = useFocusTrap;