@astral/ui 4.84.0 → 4.86.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.
Files changed (90) hide show
  1. package/components/HintPopover/HintPopover.d.ts +6 -0
  2. package/components/HintPopover/HintPopover.js +23 -0
  3. package/components/HintPopover/constants.d.ts +4 -0
  4. package/components/HintPopover/constants.js +5 -0
  5. package/components/HintPopover/index.d.ts +2 -0
  6. package/components/HintPopover/index.js +1 -0
  7. package/components/HintPopover/public.d.ts +2 -0
  8. package/components/HintPopover/public.js +1 -0
  9. package/components/HintPopover/styles.d.ts +38 -0
  10. package/components/HintPopover/styles.js +69 -0
  11. package/components/HintPopover/types.d.ts +24 -0
  12. package/components/HintPopover/types.js +1 -0
  13. package/components/NewPopover/NewPopover.d.ts +1 -1
  14. package/components/NewPopover/NewPopover.js +5 -4
  15. package/components/NewPopover/constants.d.ts +11 -0
  16. package/components/NewPopover/constants.js +11 -0
  17. package/components/NewPopover/styles.js +35 -30
  18. package/components/NewPopover/types.d.ts +5 -0
  19. package/components/NewPopover/useLogic/useLogic.d.ts +4 -3
  20. package/components/NewPopover/useLogic/useLogic.js +17 -8
  21. package/components/NewPopover/useLogic/utils/getArrowPadding/getArrowPadding.d.ts +14 -0
  22. package/components/NewPopover/useLogic/utils/getArrowPadding/getArrowPadding.js +12 -0
  23. package/components/NewPopover/useLogic/utils/getArrowPadding/index.d.ts +1 -0
  24. package/components/NewPopover/useLogic/utils/getArrowPadding/index.js +1 -0
  25. package/components/NewPopover/useLogic/utils/getPopoverCssVars/getPopoverCssVars.d.ts +2 -0
  26. package/components/NewPopover/useLogic/utils/getPopoverCssVars/getPopoverCssVars.js +6 -0
  27. package/components/NewPopover/useLogic/utils/getPopoverCssVars/index.d.ts +1 -0
  28. package/components/NewPopover/useLogic/utils/getPopoverCssVars/index.js +1 -0
  29. package/components/NewPopover/useLogic/utils/resolveAnchorNode/resolveAnchorNode.d.ts +6 -0
  30. package/components/NewPopover/useLogic/utils/resolveAnchorNode/resolveAnchorNode.js +8 -0
  31. package/components/Onboarding/ui/StepStrategy/steps/HighlightStep/HighlightStep.js +3 -4
  32. package/components/Onboarding/ui/StepStrategy/steps/HighlightStep/styles.d.ts +6 -22
  33. package/components/Onboarding/ui/StepStrategy/steps/HighlightStep/styles.js +2 -45
  34. package/components/PageHeader/HeaderContent/HeaderContent.d.ts +2 -2
  35. package/components/PageHeader/HeaderContent/HeaderContent.js +3 -3
  36. package/components/PageHeader/HeaderContent/styles.d.ts +4 -0
  37. package/components/PageHeader/HeaderContent/styles.js +11 -1
  38. package/components/PageHeader/PageHeader.js +2 -2
  39. package/components/PageHeader/styles.js +2 -2
  40. package/components/PageHeader/types.d.ts +10 -0
  41. package/hook-form/FormPageLayoutBase/useLogic/useLogic.d.ts +1 -0
  42. package/node/components/HintPopover/HintPopover.d.ts +6 -0
  43. package/node/components/HintPopover/HintPopover.js +27 -0
  44. package/node/components/HintPopover/constants.d.ts +4 -0
  45. package/node/components/HintPopover/constants.js +8 -0
  46. package/node/components/HintPopover/index.d.ts +2 -0
  47. package/node/components/HintPopover/index.js +5 -0
  48. package/node/components/HintPopover/public.d.ts +2 -0
  49. package/node/components/HintPopover/public.js +5 -0
  50. package/node/components/HintPopover/styles.d.ts +38 -0
  51. package/node/components/HintPopover/styles.js +72 -0
  52. package/node/components/HintPopover/types.d.ts +24 -0
  53. package/node/components/HintPopover/types.js +2 -0
  54. package/node/components/NewPopover/NewPopover.d.ts +1 -1
  55. package/node/components/NewPopover/NewPopover.js +5 -4
  56. package/node/components/NewPopover/constants.d.ts +11 -0
  57. package/node/components/NewPopover/constants.js +12 -1
  58. package/node/components/NewPopover/styles.js +34 -29
  59. package/node/components/NewPopover/types.d.ts +5 -0
  60. package/node/components/NewPopover/useLogic/useLogic.d.ts +4 -3
  61. package/node/components/NewPopover/useLogic/useLogic.js +18 -9
  62. package/node/components/NewPopover/useLogic/utils/getArrowPadding/getArrowPadding.d.ts +14 -0
  63. package/node/components/NewPopover/useLogic/utils/getArrowPadding/getArrowPadding.js +16 -0
  64. package/node/components/NewPopover/useLogic/utils/getArrowPadding/index.d.ts +1 -0
  65. package/node/components/NewPopover/useLogic/utils/getArrowPadding/index.js +17 -0
  66. package/node/components/NewPopover/useLogic/utils/getPopoverCssVars/getPopoverCssVars.d.ts +2 -0
  67. package/node/components/NewPopover/useLogic/utils/getPopoverCssVars/getPopoverCssVars.js +10 -0
  68. package/node/components/NewPopover/useLogic/utils/getPopoverCssVars/index.d.ts +1 -0
  69. package/node/components/NewPopover/useLogic/utils/getPopoverCssVars/index.js +5 -0
  70. package/node/components/NewPopover/useLogic/utils/resolveAnchorNode/resolveAnchorNode.d.ts +6 -0
  71. package/node/components/NewPopover/{utils → useLogic/utils/resolveAnchorNode}/resolveAnchorNode.js +2 -2
  72. package/node/components/Onboarding/ui/StepStrategy/steps/HighlightStep/HighlightStep.js +1 -2
  73. package/node/components/Onboarding/ui/StepStrategy/steps/HighlightStep/styles.d.ts +6 -22
  74. package/node/components/Onboarding/ui/StepStrategy/steps/HighlightStep/styles.js +3 -46
  75. package/node/components/PageHeader/HeaderContent/HeaderContent.d.ts +2 -2
  76. package/node/components/PageHeader/HeaderContent/HeaderContent.js +2 -2
  77. package/node/components/PageHeader/HeaderContent/styles.d.ts +4 -0
  78. package/node/components/PageHeader/HeaderContent/styles.js +12 -2
  79. package/node/components/PageHeader/PageHeader.js +2 -2
  80. package/node/components/PageHeader/styles.js +2 -2
  81. package/node/components/PageHeader/types.d.ts +10 -0
  82. package/node/hook-form/FormPageLayoutBase/useLogic/useLogic.d.ts +1 -0
  83. package/package.json +1 -1
  84. package/components/NewPopover/utils/resolveAnchorNode.d.ts +0 -6
  85. package/components/NewPopover/utils/resolveAnchorNode.js +0 -8
  86. package/node/components/NewPopover/utils/resolveAnchorNode.d.ts +0 -6
  87. /package/components/NewPopover/{utils → useLogic/utils/resolveAnchorNode}/index.d.ts +0 -0
  88. /package/components/NewPopover/{utils → useLogic/utils/resolveAnchorNode}/index.js +0 -0
  89. /package/node/components/NewPopover/{utils → useLogic/utils/resolveAnchorNode}/index.d.ts +0 -0
  90. /package/node/components/NewPopover/{utils → useLogic/utils/resolveAnchorNode}/index.js +0 -0
@@ -8,8 +8,10 @@ const useFocusTrapEffect_1 = require("../../useFocusTrapEffect");
8
8
  const usePopoverAnimation_1 = require("../../usePopoverAnimation");
9
9
  const useViewportType_1 = require("../../useViewportType");
10
10
  const constants_1 = require("../constants");
11
- const utils_1 = require("../utils");
12
- const useLogic = ({ isOpen, anchorEl, onClose, disableAutoFocus, hasArrow, }) => {
11
+ const getArrowPadding_1 = require("./utils/getArrowPadding");
12
+ const getPopoverCssVars_1 = require("./utils/getPopoverCssVars");
13
+ const resolveAnchorNode_1 = require("./utils/resolveAnchorNode");
14
+ const useLogic = ({ isOpen, anchorEl, onClose, disableAutoFocus, hasArrow, disableMobileDrawer, }) => {
13
15
  const containerRef = (0, react_1.useRef)(null);
14
16
  const [isContainerMounted, setIsContainerMounted] = (0, react_1.useState)(false);
15
17
  const [arrowElement, setArrowElement] = (0, react_1.useState)(null);
@@ -21,8 +23,10 @@ const useLogic = ({ isOpen, anchorEl, onClose, disableAutoFocus, hasArrow, }) =>
21
23
  const isControlled = isOpen !== undefined;
22
24
  const { isMobile } = (0, useViewportType_1.useViewportType)();
23
25
  const { shouldRender, handleAnimationEnd } = (0, usePopoverAnimation_1.usePopoverAnimation)(isOpened);
24
- const isEffectActive = !isMobile && isOpened && isContainerMounted;
25
- const anchorNode = (0, react_1.useMemo)(() => (0, utils_1.resolveAnchorNode)(anchorEl), [anchorEl]);
26
+ const animatedWrapperStyle = (0, getPopoverCssVars_1.getPopoverCssVars)();
27
+ const shouldRenderDrawer = isMobile && !disableMobileDrawer;
28
+ const isPopoverActive = !shouldRenderDrawer && isOpened && isContainerMounted;
29
+ const anchorNode = (0, react_1.useMemo)(() => (0, resolveAnchorNode_1.resolveAnchorNode)(anchorEl), [anchorEl]);
26
30
  const excludeNodes = (0, react_1.useMemo)(() => [anchorNode], [anchorNode]);
27
31
  const handleClose = (event) => {
28
32
  onClose?.(event);
@@ -30,18 +34,18 @@ const useLogic = ({ isOpen, anchorEl, onClose, disableAutoFocus, hasArrow, }) =>
30
34
  (0, useClickAwayEffect_1.useClickAwayEffect)({
31
35
  ref: containerRef,
32
36
  onClickAway: handleClose,
33
- isActive: isEffectActive && !isControlled,
37
+ isActive: isPopoverActive && !isControlled,
34
38
  preventBubbling: true,
35
39
  excludeNodes,
36
40
  });
37
41
  (0, useEscapeClickEffect_1.useEscapeClickEffect)({
38
42
  onEscape: handleClose,
39
- isActive: isEffectActive,
43
+ isActive: isPopoverActive,
40
44
  preventBubbling: true,
41
45
  });
42
46
  (0, useFocusTrapEffect_1.useFocusTrapEffect)({
43
47
  ref: containerRef,
44
- isActive: isEffectActive && !disableAutoFocus,
48
+ isActive: isPopoverActive && !disableAutoFocus,
45
49
  returnFocusOnDeactivate: true,
46
50
  escapeDeactivates: false,
47
51
  clickOutsideDeactivates: false,
@@ -54,11 +58,15 @@ const useLogic = ({ isOpen, anchorEl, onClose, disableAutoFocus, hasArrow, }) =>
54
58
  }
55
59
  return [
56
60
  ...constants_1.DEFAULT_MODIFIERS,
57
- { name: 'arrow', enabled: true, options: { element: arrowElement } },
61
+ {
62
+ name: 'arrow',
63
+ enabled: true,
64
+ options: { element: arrowElement, padding: getArrowPadding_1.getArrowPadding },
65
+ },
58
66
  ];
59
67
  }, [hasArrow, arrowElement]);
60
68
  return {
61
- isMobile,
69
+ shouldRenderDrawer,
62
70
  isOpened,
63
71
  shouldRender,
64
72
  handleAnimationEnd,
@@ -67,6 +75,7 @@ const useLogic = ({ isOpen, anchorEl, onClose, disableAutoFocus, hasArrow, }) =>
67
75
  arrowElement,
68
76
  setArrowElement,
69
77
  mergedModifiers,
78
+ animatedWrapperStyle,
70
79
  };
71
80
  };
72
81
  exports.useLogic = useLogic;
@@ -0,0 +1,14 @@
1
+ import { type NewPopoverPlacement } from '../../../types';
2
+ type ArrowPaddingArgs = {
3
+ /** Прямоугольник поповера от Popper (нужны только габариты). */
4
+ popper: {
5
+ width: number;
6
+ height: number;
7
+ };
8
+ placement: NewPopoverPlacement;
9
+ };
10
+ /**
11
+ * Фиксированный padding отобразил бы стрелку на скруглённый угол
12
+ */
13
+ export declare const getArrowPadding: ({ popper, placement }: ArrowPaddingArgs) => number;
14
+ export {};
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getArrowPadding = void 0;
4
+ const constants_1 = require("../../../constants");
5
+ /**
6
+ * Фиксированный padding отобразил бы стрелку на скруглённый угол
7
+ */
8
+ const getArrowPadding = ({ popper, placement }) => {
9
+ const isVertical = placement.startsWith('left') || placement.startsWith('right');
10
+ const side = isVertical ? popper.height : popper.width;
11
+ const free = Math.max(0, side - constants_1.ARROW_BASE);
12
+ const centerPadding = free / 2;
13
+ const desiredPadding = Math.min(constants_1.ARROW_PADDING, Math.max(constants_1.ARROW_MIN_PADDING, (free - constants_1.ARROW_MIN_TRACK) / 2));
14
+ return Math.min(centerPadding, desiredPadding);
15
+ };
16
+ exports.getArrowPadding = getArrowPadding;
@@ -0,0 +1 @@
1
+ export * from './getArrowPadding';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./getArrowPadding"), exports);
@@ -0,0 +1,2 @@
1
+ import type { CSSProperties } from 'react';
2
+ export declare const getPopoverCssVars: () => CSSProperties;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPopoverCssVars = void 0;
4
+ const getPopoverCssVars = () => ({
5
+ // Единая тень на весь силуэт (поповер + уголок стрелки).
6
+ // Эквивалент elevation[200], переведённого в drop-shadow(): box-shadow
7
+ // не умеет обводить единый силуэт поповера со стрелкой.
8
+ '--drop-shadow': 'drop-shadow(0px 0px 1px #072D574F) drop-shadow(0px 3px 5px #072D5733)',
9
+ });
10
+ exports.getPopoverCssVars = getPopoverCssVars;
@@ -0,0 +1 @@
1
+ export { getPopoverCssVars } from './getPopoverCssVars';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPopoverCssVars = void 0;
4
+ var getPopoverCssVars_1 = require("./getPopoverCssVars");
5
+ Object.defineProperty(exports, "getPopoverCssVars", { enumerable: true, get: function () { return getPopoverCssVars_1.getPopoverCssVars; } });
@@ -0,0 +1,6 @@
1
+ import { type NewPopoverAnchorEl } from '../../../types';
2
+ /**
3
+ * Приводит anchorEl к DOM-ноде (virtual-anchor → null), чтобы исключить якорь из
4
+ * клика-вне — иначе клик по нему закрывал бы поповер.
5
+ */
6
+ export declare const resolveAnchorNode: (anchorEl: NewPopoverAnchorEl | undefined) => Node | null;
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolveAnchorNode = void 0;
4
4
  /**
5
- * Резолвит anchorEl в DOM-ноду, если это возможно.
6
- * Для virtual-элементов вернёт null.
5
+ * Приводит anchorEl к DOM-ноде (virtual-anchor null), чтобы исключить якорь из
6
+ * клика-вне иначе клик по нему закрывал бы поповер.
7
7
  */
8
8
  const resolveAnchorNode = (anchorEl) => {
9
9
  const value = typeof anchorEl === 'function' ? anchorEl() : anchorEl;
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HighlightStep = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const CrossOutlineMd_1 = require("../../../../../../icons/CrossOutlineMd");
6
5
  const Typography_1 = require("../../../../../Typography");
7
6
  const StepFooter_1 = require("../StepFooter");
8
7
  const styles_1 = require("./styles");
@@ -18,6 +17,6 @@ const HighlightStep = ({ activeStep, isClosing, geometry, }) => {
18
17
  if (!anchorEl) {
19
18
  return null;
20
19
  }
21
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: shouldShowPopover && ((0, jsx_runtime_1.jsx)(styles_1.StepPopover, { isOpen: isOpen, disableAutoFocus: true, hasArrow: true, anchorEl: anchorEl, placement: step.position, children: (0, jsx_runtime_1.jsxs)(styles_1.PopoverBody, { ref: setPopoverNode, tabIndex: -1, children: [(0, jsx_runtime_1.jsx)(styles_1.CloseButton, { variant: "text", onClick: handleClose, "aria-label": "\u0417\u0430\u043A\u0440\u044B\u0442\u044C", children: (0, jsx_runtime_1.jsx)(CrossOutlineMd_1.CrossOutlineMd, {}) }), (0, jsx_runtime_1.jsxs)(styles_1.Content, { children: [step.title && ((0, jsx_runtime_1.jsx)(Typography_1.Typography, { component: "div", variant: "h5", children: step.title })), step.content && ((0, jsx_runtime_1.jsx)(Typography_1.Typography, { component: "div", variant: "body1", color: "grey", colorIntensity: "900", children: step.content }))] }), (0, jsx_runtime_1.jsx)(StepFooter_1.StepFooter, { activeStep: activeStep })] }) })) }));
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 })) })) }));
22
21
  };
23
22
  exports.HighlightStep = HighlightStep;
@@ -1,25 +1,9 @@
1
1
  /// <reference types="react" />
2
- /**
3
- * Popover шага, z-index над overlay, быстрое закрытие.
4
- */
5
- export declare const StepPopover: import("@emotion/styled/dist/declarations/src/types").StyledComponent<import("../../../../../NewPopover").NewPopoverProps & {
2
+ export declare const StepPopover: import("@emotion/styled/dist/declarations/src/types").StyledComponent<Omit<import("../../../../../NewPopover").NewPopoverProps, "title" | "hasArrow" | "disableMobileDrawer"> & {
3
+ variant?: import("../../../../../HintPopover").HintPopoverVariant | undefined;
4
+ title?: import("react").ReactNode;
5
+ action?: import("react").ReactNode;
6
+ contentRef?: import("react").Ref<HTMLDivElement> | undefined;
7
+ } & {
6
8
  theme?: import("@emotion/react").Theme | undefined;
7
9
  }, {}, {}>;
8
- export declare const PopoverBody: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
9
- theme?: import("@emotion/react").Theme | undefined;
10
- as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
11
- }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
12
- export declare const CloseButton: 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"> & {
13
- variant?: "light" | "link" | "text" | "contained" | "outlined" | undefined;
14
- loading?: boolean | undefined;
15
- color?: "primary" | "success" | "warning" | "error" | "grey" | undefined;
16
- component?: import("react").ElementType | undefined;
17
- selected?: boolean | undefined;
18
- size?: "large" | "medium" | undefined;
19
- } & Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, ""> & import("react").RefAttributes<HTMLButtonElement> & {
20
- theme?: import("@emotion/react").Theme | undefined;
21
- }, {}, {}>;
22
- export declare const Content: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
23
- theme?: import("@emotion/react").Theme | undefined;
24
- as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
25
- }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -1,59 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Content = exports.CloseButton = exports.PopoverBody = exports.StepPopover = void 0;
4
- const IconButton_1 = require("../../../../../IconButton");
5
- const NewPopover_1 = require("../../../../../NewPopover");
3
+ exports.StepPopover = void 0;
4
+ const HintPopover_1 = require("../../../../../HintPopover");
6
5
  const constants_1 = require("../../../../../NewPopover/constants");
7
6
  const styled_1 = require("../../../../../styled");
8
7
  const constants_2 = require("../../../../constants");
9
- /**
10
- * Popover шага, z-index над overlay, быстрое закрытие.
11
- */
12
- exports.StepPopover = (0, styled_1.styled)(NewPopover_1.NewPopover) `
8
+ exports.StepPopover = (0, styled_1.styled)(HintPopover_1.HintPopover) `
13
9
  && {
14
10
  z-index: ${({ theme }) => theme.zIndex.tooltip + constants_2.ONBOARDING_Z_INDEX_OFFSET.popover};
15
11
  }
16
-
17
- .${constants_1.popoverClassnames.innerContainer} {
18
- border-radius: calc(${({ theme }) => theme.shape.medium} * 2);
19
- }
20
12
 
21
13
  .${constants_1.popoverClassnames.animatedWrapper}:not(.${constants_1.popoverClassnames.animatedWrapperOpen}) {
22
14
  animation-duration: ${({ theme }) => theme.transitions.duration.shortest}ms;
23
15
  }
24
16
  `;
25
- exports.PopoverBody = styled_1.styled.div `
26
- position: relative;
27
-
28
- width: 400px;
29
- padding: ${({ theme }) => theme.spacing(6)};
30
-
31
- border-radius: calc(${({ theme }) => theme.shape.medium} * 2);
32
-
33
- /* Фокус-трап ставит фокус на контейнер, браузерную рамку убираем. */
34
- &:focus {
35
- outline: none;
36
- }
37
- `;
38
- exports.CloseButton = (0, styled_1.styled)(IconButton_1.IconButton) `
39
- position: absolute;
40
- top: ${({ theme }) => theme.spacing(6)};
41
- right: ${({ theme }) => theme.spacing(6)};
42
- `;
43
- exports.Content = styled_1.styled.div `
44
- display: flex;
45
- flex-direction: column;
46
- gap: ${({ theme }) => theme.spacing(4)};
47
-
48
- margin-bottom: ${({ theme }) => theme.spacing(6)};
49
-
50
- &:last-child {
51
- margin-bottom: 0;
52
- }
53
-
54
- /* Резерв справа под крестик — только у верхнего элемента (заголовок, а если
55
- его нет — текст) */
56
- & > *:first-of-type {
57
- padding-right: ${({ theme }) => theme.spacing(10)};
58
- }
59
- `;
@@ -1,5 +1,5 @@
1
1
  import { type ElementType } from 'react';
2
2
  import type { PageHeaderProps } from '../types';
3
- type HeaderContentProps<TMainActionComponent extends ElementType, TSecondaryActionComponent extends ElementType, TBackButtonComponent extends ElementType> = Pick<PageHeaderProps<TMainActionComponent, TSecondaryActionComponent, TBackButtonComponent>, 'breadcrumbs' | 'backButton' | 'description' | 'actions' | 'subheader' | 'filters' | 'title' | 'isLoading'>;
4
- export declare const HeaderContent: <TMainActionComponent extends ElementType, TSecondaryActionComponent extends ElementType, TBackButtonComponent extends ElementType>({ backButton, description, subheader, breadcrumbs, actions, title, filters, isLoading, }: HeaderContentProps<TMainActionComponent, TSecondaryActionComponent, TBackButtonComponent>) => import("react/jsx-runtime").JSX.Element;
3
+ type HeaderContentProps<TMainActionComponent extends ElementType, TSecondaryActionComponent extends ElementType, TBackButtonComponent extends ElementType> = Pick<PageHeaderProps<TMainActionComponent, TSecondaryActionComponent, TBackButtonComponent>, 'breadcrumbs' | 'backButton' | 'description' | 'actions' | 'subheader' | 'tabs' | 'filters' | 'title' | 'isLoading'>;
4
+ export declare const HeaderContent: <TMainActionComponent extends ElementType, TSecondaryActionComponent extends ElementType, TBackButtonComponent extends ElementType>({ backButton, description, subheader, breadcrumbs, tabs, actions, title, filters, isLoading, }: HeaderContentProps<TMainActionComponent, TSecondaryActionComponent, TBackButtonComponent>) => import("react/jsx-runtime").JSX.Element;
5
5
  export {};
@@ -10,13 +10,13 @@ const Title_1 = require("../Title");
10
10
  const Description_1 = require("./Description");
11
11
  const FormFiltersProvider_1 = require("./FormFiltersProvider");
12
12
  const styles_1 = require("./styles");
13
- const HeaderContent = ({ backButton, description, subheader, breadcrumbs, actions, title, filters, isLoading, }) => {
13
+ const HeaderContent = ({ backButton, description, subheader, breadcrumbs, tabs, actions, title, filters, isLoading, }) => {
14
14
  const renderBreadcrumbs = () => {
15
15
  if (!breadcrumbs) {
16
16
  return null;
17
17
  }
18
18
  return ((0, jsx_runtime_1.jsx)(styles_1.BreadcrumbsWrapper, { children: Array.isArray(breadcrumbs) ? ((0, jsx_runtime_1.jsx)(Breadcrumbs_1.Breadcrumbs, { children: breadcrumbs })) : (breadcrumbs) }));
19
19
  };
20
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [renderBreadcrumbs(), (0, jsx_runtime_1.jsx)(styles_1.DesktopTitleWrapper, { children: (0, jsx_runtime_1.jsx)(Title_1.Title, { backButton: backButton, title: title, isLoading: isLoading, hasDescription: Boolean(description), hasBreadcrumbs: Boolean(breadcrumbs) }) }), (0, jsx_runtime_1.jsx)(Description_1.Description, { description: description, isLoading: isLoading }), actions && ((0, jsx_runtime_1.jsx)(PageActions_1.PageActions, { className: (0, classNames_1.classNames)(constants_1.pageHeaderClassnames.pageHeaderActions), isLoading: isLoading, size: "medium", withCollapseOnLaptop: Boolean(filters), ...actions })), filters && ((0, jsx_runtime_1.jsx)(FormFiltersProvider_1.FormFiltersProvider, { filtersClassName: constants_1.pageHeaderClassnames.filters, quickFiltersClassName: constants_1.pageHeaderClassnames.quickFilters, children: filters })), subheader && ((0, jsx_runtime_1.jsx)(styles_1.PageSubheader, { className: constants_1.pageHeaderClassnames.subheader, children: subheader }))] }));
20
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [renderBreadcrumbs(), (0, jsx_runtime_1.jsx)(styles_1.DesktopTitleWrapper, { children: (0, jsx_runtime_1.jsx)(Title_1.Title, { backButton: backButton, title: title, isLoading: isLoading, hasDescription: Boolean(description), hasBreadcrumbs: Boolean(breadcrumbs) }) }), (0, jsx_runtime_1.jsx)(Description_1.Description, { description: description, isLoading: isLoading }), actions && ((0, jsx_runtime_1.jsx)(PageActions_1.PageActions, { className: (0, classNames_1.classNames)(constants_1.pageHeaderClassnames.pageHeaderActions), isLoading: isLoading, size: "medium", withCollapseOnLaptop: Boolean(filters), ...actions })), filters && ((0, jsx_runtime_1.jsx)(FormFiltersProvider_1.FormFiltersProvider, { filtersClassName: constants_1.pageHeaderClassnames.filters, quickFiltersClassName: constants_1.pageHeaderClassnames.quickFilters, children: filters })), tabs && (0, jsx_runtime_1.jsx)(styles_1.TabsWrapper, { children: tabs }), subheader && ((0, jsx_runtime_1.jsx)(styles_1.PageSubheader, { className: constants_1.pageHeaderClassnames.subheader, children: subheader }))] }));
21
21
  };
22
22
  exports.HeaderContent = HeaderContent;
@@ -3,6 +3,10 @@ export declare const BreadcrumbsWrapper: import("@emotion/styled/dist/declaratio
3
3
  theme?: import("@emotion/react").Theme | undefined;
4
4
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
5
5
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
6
+ export declare const TabsWrapper: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
7
+ theme?: import("@emotion/react").Theme | undefined;
8
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
9
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
6
10
  export declare const PageSubheader: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
7
11
  theme?: import("@emotion/react").Theme | undefined;
8
12
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DesktopTitleWrapper = exports.PageSubheader = exports.BreadcrumbsWrapper = void 0;
3
+ exports.DesktopTitleWrapper = exports.PageSubheader = exports.TabsWrapper = exports.BreadcrumbsWrapper = void 0;
4
4
  const styled_1 = require("../../styled");
5
5
  exports.BreadcrumbsWrapper = styled_1.styled.div `
6
6
  grid-column: 2;
@@ -12,9 +12,19 @@ exports.BreadcrumbsWrapper = styled_1.styled.div `
12
12
  display: none;
13
13
  }
14
14
  `;
15
+ exports.TabsWrapper = styled_1.styled.div `
16
+ grid-column: 1 / -1;
17
+ grid-row: 4;
18
+
19
+ padding-top: ${({ theme }) => theme.spacing(3)};
20
+
21
+ ${({ theme }) => theme.breakpoints.down('sm')} {
22
+ padding: ${({ theme }) => theme.spacing(0, 3, 3, 3)};
23
+ }
24
+ `;
15
25
  exports.PageSubheader = styled_1.styled.div `
16
26
  grid-column: 1 / -1;
17
- grid-row: 6;
27
+ grid-row: 5;
18
28
 
19
29
  padding-top: ${({ theme }) => theme.spacing(4)};
20
30
 
@@ -34,7 +34,7 @@ const rootCva = (0, cva_1.cva)(constants_1.pageHeaderClassnames.root, {
34
34
  },
35
35
  });
36
36
  const PageHeader = (props) => {
37
- const { title, description, subheader, breadcrumbs, actions, backButton, className, filters, } = props;
37
+ const { title, description, subheader, breadcrumbs, tabs, actions, backButton, className, filters, } = props;
38
38
  const { isLoading, mobileTitleActions, isShowMobileActions } = (0, useLogic_1.useLogic)(props);
39
39
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(styles_1.MobileTitleWrapper, { className: mobilePageHeaderCva({
40
40
  hasTitle: Boolean(title) || isLoading,
@@ -43,6 +43,6 @@ const PageHeader = (props) => {
43
43
  hasActions: Boolean(actions),
44
44
  hasSubheader: Boolean(subheader),
45
45
  hasFilters: Boolean(filters),
46
- }), className), children: (0, jsx_runtime_1.jsx)(HeaderContent_1.HeaderContent, { breadcrumbs: breadcrumbs, backButton: backButton, title: title, description: description, actions: actions, subheader: subheader, filters: filters, isLoading: isLoading }) }), isShowMobileActions && ((0, jsx_runtime_1.jsx)(MobilePageActions_1.MobilePageActions, { className: (0, classNames_1.classNames)(constants_1.pageHeaderClassnames.pageHeaderActions), isLoading: isLoading, ...actions }))] }));
46
+ }), className), children: (0, jsx_runtime_1.jsx)(HeaderContent_1.HeaderContent, { breadcrumbs: breadcrumbs, backButton: backButton, title: title, description: description, actions: actions, subheader: subheader, tabs: tabs, filters: filters, isLoading: isLoading }) }), isShowMobileActions && ((0, jsx_runtime_1.jsx)(MobilePageActions_1.MobilePageActions, { className: (0, classNames_1.classNames)(constants_1.pageHeaderClassnames.pageHeaderActions), isLoading: isLoading, ...actions }))] }));
47
47
  };
48
48
  exports.PageHeader = PageHeader;
@@ -41,7 +41,7 @@ exports.Wrapper = styled_1.styled.header `
41
41
 
42
42
  .${constants_2.pageHeaderClassnames.filters} {
43
43
  grid-column: 1 / -1;
44
- grid-row: 4;
44
+ grid-row: 6;
45
45
 
46
46
  ${({ theme }) => theme.breakpoints.down('laptop')} {
47
47
  grid-column: 3;
@@ -51,7 +51,7 @@ exports.Wrapper = styled_1.styled.header `
51
51
 
52
52
  .${constants_2.pageHeaderClassnames.quickFilters} {
53
53
  grid-column: 1 / -1;
54
- grid-row: 5;
54
+ grid-row: 7;
55
55
 
56
56
  margin-top: ${({ theme }) => theme.spacing(4)};
57
57
 
@@ -34,6 +34,16 @@ export type PageHeaderProps<TMainActionComponent extends ElementType = ElementTy
34
34
  * } />
35
35
  */
36
36
  breadcrumbs?: ReactNode;
37
+ /**
38
+ * Слот для tabs
39
+ * @example <PageHeader tabs={
40
+ * <Tabs value={tabValue} onChange={handleChange}>
41
+ * <Tab label="Вкладка 1" />
42
+ * <Tab label="Вкладка 2" />
43
+ * </Tabs>
44
+ * } />
45
+ */
46
+ tabs?: ReactNode;
37
47
  /**
38
48
  * Набор кнопок, видимые конфигурируются через объект main, скрытые в меню -
39
49
  * через secondary
@@ -9,6 +9,7 @@ export declare const useLogic: <TFormValues extends Record<string, unknown>>({ a
9
9
  subheader?: import("react").ReactNode;
10
10
  filters?: import("react").ReactNode;
11
11
  breadcrumbs?: import("react").ReactNode;
12
+ tabs?: import("react").ReactNode;
12
13
  className?: string | undefined;
13
14
  isLoading?: boolean | undefined;
14
15
  shouldUpdateDocumentTitle?: boolean | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "4.84.0",
3
+ "version": "4.86.0",
4
4
  "browser": "./index.js",
5
5
  "main": "./node/index.js",
6
6
  "dependencies": {
@@ -1,6 +0,0 @@
1
- import { type NewPopoverAnchorEl } from '../types';
2
- /**
3
- * Резолвит anchorEl в DOM-ноду, если это возможно.
4
- * Для virtual-элементов вернёт null.
5
- */
6
- export declare const resolveAnchorNode: (anchorEl: NewPopoverAnchorEl | undefined) => Node | null;
@@ -1,8 +0,0 @@
1
- /**
2
- * Резолвит anchorEl в DOM-ноду, если это возможно.
3
- * Для virtual-элементов вернёт null.
4
- */
5
- export const resolveAnchorNode = (anchorEl) => {
6
- const value = typeof anchorEl === 'function' ? anchorEl() : anchorEl;
7
- return value instanceof Node ? value : null;
8
- };
@@ -1,6 +0,0 @@
1
- import { type NewPopoverAnchorEl } from '../types';
2
- /**
3
- * Резолвит anchorEl в DOM-ноду, если это возможно.
4
- * Для virtual-элементов вернёт null.
5
- */
6
- export declare const resolveAnchorNode: (anchorEl: NewPopoverAnchorEl | undefined) => Node | null;