@astral/ui 4.50.0 → 4.52.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 (99) hide show
  1. package/components/DashboardContext/DashboardContext.d.ts +2 -0
  2. package/components/DashboardContext/DashboardContext.js +2 -0
  3. package/components/DashboardContext/DashboardContextProvider/DashboardContextProvider.d.ts +2 -2
  4. package/components/DashboardContext/DashboardContextProvider/DashboardContextProvider.js +4 -1
  5. package/components/DashboardLayout/DashboardLayout.d.ts +1 -1
  6. package/components/DashboardLayout/DashboardLayout.js +2 -2
  7. package/components/DashboardLayout/Header/Header.js +28 -3
  8. package/components/DashboardLayout/Header/constants.d.ts +5 -1
  9. package/components/DashboardLayout/Header/constants.js +5 -1
  10. package/components/DashboardLayout/Header/styles.d.ts +4 -3
  11. package/components/DashboardLayout/Header/styles.js +66 -24
  12. package/components/DashboardLayout/Header/useLogic/useLogic.d.ts +4 -1
  13. package/components/DashboardLayout/Header/useLogic/useLogic.js +16 -11
  14. package/components/DashboardLayout/types.d.ts +5 -0
  15. package/components/DashboardSidebar/DashboardSidebar.js +17 -2
  16. package/components/DashboardSidebar/constants.d.ts +1 -0
  17. package/components/DashboardSidebar/constants.js +1 -0
  18. package/components/DashboardSidebar/styles.js +1 -1
  19. package/components/DashboardSidebar/useLogic/useLogic.d.ts +2 -1
  20. package/components/DashboardSidebar/useLogic/useLogic.js +5 -6
  21. package/components/MenuOrganization/OrganizationButton/OrganizationButton.js +1 -1
  22. package/components/MenuOrganization/constants.d.ts +1 -0
  23. package/components/MenuOrganization/constants.js +1 -0
  24. package/components/NewStepper/NewStepper.js +1 -1
  25. package/components/NewStepper/Step/Label/Label.d.ts +1 -2
  26. package/components/NewStepper/Step/Label/Label.js +2 -2
  27. package/components/NewStepper/Step/Label/styles.js +5 -0
  28. package/components/NewStepper/Step/Step.js +2 -2
  29. package/components/NewStepper/Step/styles.js +9 -0
  30. package/components/NewStepper/StepperContext/StepperContext.d.ts +0 -1
  31. package/components/NewStepper/StepperContext/StepperContext.js +0 -1
  32. package/components/NewStepper/StepperContext/StepperContextProvider/StepperContextProvider.d.ts +1 -1
  33. package/components/NewStepper/StepperContext/StepperContextProvider/StepperContextProvider.js +1 -3
  34. package/components/NewStepper/constants.d.ts +1 -0
  35. package/components/NewStepper/constants.js +1 -0
  36. package/components/NewStepper/styles.js +11 -1
  37. package/components/Profile/Profile.js +1 -1
  38. package/components/Profile/constants.d.ts +3 -0
  39. package/components/Profile/constants.js +3 -0
  40. package/hook-form/FormWizard/FormWizard.js +4 -3
  41. package/hook-form/FormWizard/styles.d.ts +1 -4
  42. package/hook-form/FormWizard/styles.js +4 -6
  43. package/hook-form/FormWizard/useLogic/useLogic.d.ts +5 -6
  44. package/hook-form/FormWizard/useLogic/useLogic.js +4 -5
  45. package/hook-form/useFormWizard/useFormWizard.js +4 -2
  46. package/node/components/DashboardContext/DashboardContext.d.ts +2 -0
  47. package/node/components/DashboardContext/DashboardContext.js +2 -0
  48. package/node/components/DashboardContext/DashboardContextProvider/DashboardContextProvider.d.ts +2 -2
  49. package/node/components/DashboardContext/DashboardContextProvider/DashboardContextProvider.js +4 -1
  50. package/node/components/DashboardLayout/DashboardLayout.d.ts +1 -1
  51. package/node/components/DashboardLayout/DashboardLayout.js +2 -2
  52. package/node/components/DashboardLayout/Header/Header.js +27 -2
  53. package/node/components/DashboardLayout/Header/constants.d.ts +5 -1
  54. package/node/components/DashboardLayout/Header/constants.js +5 -1
  55. package/node/components/DashboardLayout/Header/styles.d.ts +4 -3
  56. package/node/components/DashboardLayout/Header/styles.js +74 -32
  57. package/node/components/DashboardLayout/Header/useLogic/useLogic.d.ts +4 -1
  58. package/node/components/DashboardLayout/Header/useLogic/useLogic.js +15 -10
  59. package/node/components/DashboardLayout/types.d.ts +5 -0
  60. package/node/components/DashboardSidebar/DashboardSidebar.js +17 -2
  61. package/node/components/DashboardSidebar/constants.d.ts +1 -0
  62. package/node/components/DashboardSidebar/constants.js +1 -0
  63. package/node/components/DashboardSidebar/styles.js +1 -1
  64. package/node/components/DashboardSidebar/useLogic/useLogic.d.ts +2 -1
  65. package/node/components/DashboardSidebar/useLogic/useLogic.js +4 -5
  66. package/node/components/MenuOrganization/OrganizationButton/OrganizationButton.js +1 -1
  67. package/node/components/MenuOrganization/constants.d.ts +1 -0
  68. package/node/components/MenuOrganization/constants.js +1 -0
  69. package/node/components/NewStepper/NewStepper.js +1 -1
  70. package/node/components/NewStepper/Step/Label/Label.d.ts +1 -2
  71. package/node/components/NewStepper/Step/Label/Label.js +2 -2
  72. package/node/components/NewStepper/Step/Label/styles.js +5 -0
  73. package/node/components/NewStepper/Step/Step.js +2 -2
  74. package/node/components/NewStepper/Step/styles.js +56 -47
  75. package/node/components/NewStepper/StepperContext/StepperContext.d.ts +0 -1
  76. package/node/components/NewStepper/StepperContext/StepperContext.js +0 -1
  77. package/node/components/NewStepper/StepperContext/StepperContextProvider/StepperContextProvider.d.ts +1 -1
  78. package/node/components/NewStepper/StepperContext/StepperContextProvider/StepperContextProvider.js +1 -3
  79. package/node/components/NewStepper/constants.d.ts +1 -0
  80. package/node/components/NewStepper/constants.js +2 -1
  81. package/node/components/NewStepper/styles.js +10 -0
  82. package/node/components/Profile/Profile.js +1 -1
  83. package/node/components/Profile/constants.d.ts +3 -0
  84. package/node/components/Profile/constants.js +3 -0
  85. package/node/hook-form/FormWizard/FormWizard.js +3 -2
  86. package/node/hook-form/FormWizard/styles.d.ts +1 -4
  87. package/node/hook-form/FormWizard/styles.js +5 -7
  88. package/node/hook-form/FormWizard/useLogic/useLogic.d.ts +5 -6
  89. package/node/hook-form/FormWizard/useLogic/useLogic.js +4 -5
  90. package/node/hook-form/useFormWizard/useFormWizard.js +4 -2
  91. package/package.json +1 -1
  92. package/components/NewStepper/Step/Label/useLogic/index.d.ts +0 -1
  93. package/components/NewStepper/Step/Label/useLogic/index.js +0 -1
  94. package/components/NewStepper/Step/Label/useLogic/useLogic.d.ts +0 -7
  95. package/components/NewStepper/Step/Label/useLogic/useLogic.js +0 -7
  96. package/node/components/NewStepper/Step/Label/useLogic/index.d.ts +0 -1
  97. package/node/components/NewStepper/Step/Label/useLogic/index.js +0 -17
  98. package/node/components/NewStepper/Step/Label/useLogic/useLogic.d.ts +0 -7
  99. package/node/components/NewStepper/Step/Label/useLogic/useLogic.js +0 -11
@@ -3,5 +3,5 @@ import { type StepperContextProps } from '../StepperContext';
3
3
  type Props = StepperContextProps & {
4
4
  children: ReactNode;
5
5
  };
6
- export declare const StepperContextProvider: ({ children, orientation, activeStep, setActiveStep, connector, alternativeLabel, onClickPrevStep, onClickStep, }: Props) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const StepperContextProvider: ({ children, orientation, activeStep, connector, alternativeLabel, onClickPrevStep, onClickStep, }: Props) => import("react/jsx-runtime").JSX.Element;
7
7
  export {};
@@ -1,11 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useMemo } from 'react';
3
3
  import { StepperContext } from '../StepperContext';
4
- export const StepperContextProvider = ({ children, orientation, activeStep, setActiveStep, connector, alternativeLabel, onClickPrevStep, onClickStep, }) => {
4
+ export const StepperContextProvider = ({ children, orientation, activeStep, connector, alternativeLabel, onClickPrevStep, onClickStep, }) => {
5
5
  const contextValue = useMemo(() => ({
6
6
  activeStep,
7
7
  orientation,
8
- setActiveStep,
9
8
  connector,
10
9
  alternativeLabel,
11
10
  onClickPrevStep,
@@ -13,7 +12,6 @@ export const StepperContextProvider = ({ children, orientation, activeStep, setA
13
12
  }), [
14
13
  activeStep,
15
14
  orientation,
16
- setActiveStep,
17
15
  connector,
18
16
  alternativeLabel,
19
17
  onClickPrevStep,
@@ -6,6 +6,7 @@ export declare const stepperClassnames: {
6
6
  orientationVertical: string;
7
7
  alternativeLabel: string;
8
8
  };
9
+ export declare const STEPPER_ORDER_COUNTER_NAME = "astral-ui-stepper-order";
9
10
  /**
10
11
  * Задержка перед scrollIntoView после смены activeStep, что бы анимация появления текста завершилась
11
12
  */
@@ -7,6 +7,7 @@ export const stepperClassnames = {
7
7
  orientationVertical: createUIKitClassname('stepper_orientation-vertical'),
8
8
  alternativeLabel: createUIKitClassname('stepper_alternative-label'),
9
9
  };
10
+ export const STEPPER_ORDER_COUNTER_NAME = 'astral-ui-stepper-order';
10
11
  /**
11
12
  * Задержка перед scrollIntoView после смены activeStep, что бы анимация появления текста завершилась
12
13
  */
@@ -1,6 +1,8 @@
1
1
  import { styled } from '../styled';
2
- import { stepperClassnames } from './constants';
2
+ import { STEPPER_ORDER_COUNTER_NAME, stepperClassnames } from './constants';
3
3
  export const Wrapper = styled.div `
4
+ counter-reset: ${STEPPER_ORDER_COUNTER_NAME} 0;
5
+
4
6
  display: flex;
5
7
  align-items: flex-start;
6
8
 
@@ -27,8 +29,16 @@ export const Wrapper = styled.div `
27
29
  }
28
30
 
29
31
  ${({ theme }) => theme.breakpoints.down('sm')} {
32
+ /* Убираем видимую полосу прокрутки в firefox */
33
+ scrollbar-width: none;
34
+
30
35
  overflow-x: auto;
31
36
 
32
37
  width: 100%;
38
+
39
+ /* Убираем видимую полосу прокрутки в chrome */
40
+ &::-webkit-scrollbar {
41
+ display: none;
42
+ }
33
43
  }
34
44
  `;
@@ -23,7 +23,7 @@ export const Profile = (props) => {
23
23
  if (isLoading) {
24
24
  return _jsx(ProfileSkeleton, {});
25
25
  }
26
- return (_jsxs(_Fragment, { children: [_jsx(ClickAwayListener, { onClickAway: handleCloseMenu, children: _jsxs(ProfileRoot, { ref: anchorRef, variant: "text", onClick: handleOpenMenu, children: [_jsx(StyledAvatar, { ...avatar }), _jsxs(User, { children: [_jsxs(Credentials, { className: hidePersonalDataClassname, children: [_jsx(Typography, { variant: "body1", className: profileClassnames.credentials, children: displayName }), _jsx(Typography, { variant: "caption", color: "textSecondary", className: profileClassnames.credentials, children: annotation })] }), _jsx(StyledChevron, { isActive: open })] })] }) }), Menu ? (_jsx(Menu, { open: open, anchorEl: anchorRef.current, onClose: handleCloseMenu, anchorOrigin: {
26
+ return (_jsxs(_Fragment, { children: [_jsx(ClickAwayListener, { onClickAway: handleCloseMenu, children: _jsxs(ProfileRoot, { ref: anchorRef, variant: "text", onClick: handleOpenMenu, className: profileClassnames.button, children: [_jsx(StyledAvatar, { ...avatar, className: profileClassnames.avatar }), _jsxs(User, { className: profileClassnames.user, children: [_jsxs(Credentials, { className: hidePersonalDataClassname, children: [_jsx(Typography, { variant: "body1", className: profileClassnames.credentials, children: displayName }), _jsx(Typography, { variant: "caption", color: "textSecondary", className: profileClassnames.credentials, children: annotation })] }), _jsx(StyledChevron, { isActive: open })] })] }) }), Menu ? (_jsx(Menu, { open: open, anchorEl: anchorRef.current, onClose: handleCloseMenu, anchorOrigin: {
27
27
  vertical: 'bottom',
28
28
  horizontal: 'right',
29
29
  }, transformOrigin: {
@@ -1,3 +1,6 @@
1
1
  export declare const profileClassnames: {
2
2
  credentials: string;
3
+ button: string;
4
+ avatar: string;
5
+ user: string;
3
6
  };
@@ -1,4 +1,7 @@
1
1
  import { createUIKitClassname } from '../utils/createUIKitClassname';
2
2
  export const profileClassnames = {
3
3
  credentials: createUIKitClassname('profile__credentials'),
4
+ button: createUIKitClassname('profile__button'),
5
+ avatar: createUIKitClassname('profile__avatar'),
6
+ user: createUIKitClassname('profile__user'),
4
7
  };
@@ -1,14 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ContentState } from '../../components/ContentState';
3
+ import { Step } from '../../components/NewStepper';
3
4
  import { Form } from '../Form';
4
5
  import { Footer } from './Footer';
5
- import { BeforeContentWrapper, FormContent, StyledStepperWizard, Wrapper, } from './styles';
6
+ import { BeforeContentWrapper, FormContent, StyledNewStepper, Wrapper, } from './styles';
6
7
  import { useLogic } from './useLogic';
7
8
  /**
8
9
  * FormWizard предназначен для построения форм со степпером.
9
10
  */
10
11
  export const FormWizard = (props) => {
11
- const { Component, footerProps, stepWizardProps } = useLogic(props);
12
+ const { Component, footerProps, activeStep, steps } = useLogic(props);
12
13
  const { className, isFirstStep, isLastStep, isDisabled, isLoading, isError, form, customFooter, errorMsg, onRetry, onClickStep, onPrevStep, onSubmit, onSubmitError, beforeContent, } = props;
13
14
  const renderFooter = () => {
14
15
  if (customFooter) {
@@ -22,7 +23,7 @@ export const FormWizard = (props) => {
22
23
  }
23
24
  return (_jsx(Footer, { isDisabled: isDisabled, isFirstStep: isFirstStep, isLastStep: isLastStep, onPrevStep: onPrevStep, ...footerProps }));
24
25
  };
25
- return (_jsxs(Wrapper, { className: className, children: [beforeContent && (_jsx(BeforeContentWrapper, { children: beforeContent })), _jsx(StyledStepperWizard, { connector: "arrow", onClickPrevStep: onClickStep, ...stepWizardProps }), _jsx(ContentState, { isLoading: isLoading, isError: isError,
26
+ return (_jsxs(Wrapper, { className: className, children: [beforeContent && (_jsx(BeforeContentWrapper, { children: beforeContent })), _jsx(StyledNewStepper, { connector: "arrow", onClickPrevStep: onClickStep, activeStep: activeStep, children: steps.map((step) => (_jsx(Step, { ...step }, step.stepId))) }), _jsx(ContentState, { isLoading: isLoading, isError: isError,
26
27
  // biome-ignore lint/suspicious/noTsIgnore: onRetry не требуется, если форма не инициализируется данными, получаемыми с backend
27
28
  // @ts-ignore
28
29
  errorState: { errorList: [errorMsg || ''], onRetry }, children: _jsxs(Form, { form: form, isDisabled: isDisabled, onSubmit: form.handleSubmit(onSubmit, onSubmitError), children: [_jsx(FormContent, { children: _jsx(Component, {}) }), renderFooter()] }) })] }));
@@ -7,10 +7,7 @@ export declare const BeforeContentWrapper: import("../../components/styled").Sty
7
7
  theme?: import("@emotion/react").Theme | undefined;
8
8
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
9
9
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
10
- export declare const StyledStepperWizard: import("../../components/styled").StyledComponent<Omit<import("../..").StepperProps, "children"> & {
11
- steps: import("../../components/StepperWizard").StepWizard[];
12
- onClickPrevStep?: ((index: number) => void) | undefined;
13
- } & {
10
+ export declare const StyledNewStepper: import("../../components/styled").StyledComponent<import("../../components/NewStepper").StepperProps & {
14
11
  theme?: import("@emotion/react").Theme | undefined;
15
12
  }, {}, {}>;
16
13
  export declare const FormContent: import("../../components/styled").StyledComponent<{
@@ -1,4 +1,4 @@
1
- import { StepperWizard } from '../../components/StepperWizard';
1
+ import { NewStepper } from '../../components/NewStepper';
2
2
  import { styled } from '../../components/styled';
3
3
  export const Wrapper = styled.section `
4
4
  display: flex;
@@ -13,14 +13,12 @@ export const BeforeContentWrapper = styled.div `
13
13
  padding: ${({ theme }) => theme.spacing(0, 4)};
14
14
  }
15
15
  `;
16
- export const StyledStepperWizard = styled(StepperWizard) `
17
- margin-bottom: ${({ theme }) => theme.spacing(4)};
16
+ export const StyledNewStepper = styled(NewStepper) `
17
+ margin-bottom: ${({ theme }) => theme.spacing(5)};
18
18
  padding: ${({ theme }) => theme.spacing(0, 6)};
19
19
 
20
20
  ${({ theme }) => theme.breakpoints.down('sm')} {
21
- overflow-x: auto;
22
-
23
- margin-bottom: ${({ theme }) => theme.spacing(6)};
21
+ margin-bottom: ${({ theme }) => theme.spacing(4)};
24
22
  padding: ${({ theme }) => theme.spacing(0, 4)};
25
23
  }
26
24
  `;
@@ -3,12 +3,11 @@ import { type FormWizardProps } from '../FormWizard';
3
3
  type UseLogicParams<TFormValues extends Record<string, unknown>> = FormWizardProps<TFormValues>;
4
4
  export declare const useLogic: <TFormValues extends Record<string, unknown>>({ currentStepId, steps, submitButtonText, isLastStep, }: UseLogicParams<TFormValues>) => {
5
5
  Component: import("react").FunctionComponent<{}>;
6
- stepWizardProps: {
7
- activeStep: number;
8
- steps: {
9
- label: string;
10
- }[];
11
- };
6
+ steps: {
7
+ label: string;
8
+ stepId: number;
9
+ }[];
10
+ activeStep: number;
12
11
  footerProps: {
13
12
  prevButtonText: string;
14
13
  submitButtonText: string;
@@ -5,17 +5,16 @@ export const useLogic = ({ currentStepId, steps, submitButtonText, isLastStep, }
5
5
  ? steps?.findIndex(({ id }) => Object.is(id, currentStepId))
6
6
  : 0, [currentStepId, steps]);
7
7
  const currentStep = steps[indexStep];
8
- const stepsByLabel = steps.map(({ label }) => ({
8
+ const stepsByLabel = steps.map(({ label }, index) => ({
9
9
  label,
10
+ stepId: index,
10
11
  }));
11
12
  const prevButtonText = currentStep.prevButtonText || DEFAULT_PREV_BUTTON_TEXT;
12
13
  const nextButtonText = currentStep.nextButtonText || DEFAULT_NEXT_BUTTON_TEXT;
13
14
  return {
14
15
  Component: currentStep.component,
15
- stepWizardProps: {
16
- activeStep: indexStep,
17
- steps: stepsByLabel,
18
- },
16
+ steps: stepsByLabel,
17
+ activeStep: indexStep,
19
18
  footerProps: {
20
19
  prevButtonText,
21
20
  submitButtonText: isLastStep ? submitButtonText : nextButtonText,
@@ -65,8 +65,10 @@ export const useFormWizard = ({ initialStepId, defaultValues, isDisabled, steps,
65
65
  return;
66
66
  };
67
67
  const handleClickStep = (index) => {
68
- const stepId = steps[index].id;
69
- setCurrentStepId(stepId);
68
+ if (index < 0 || index >= visibleSteps.length) {
69
+ return;
70
+ }
71
+ setCurrentStepId(visibleSteps[index].id);
70
72
  };
71
73
  const handlePrevStep = () => {
72
74
  if (isFirstStep) {
@@ -1,10 +1,12 @@
1
1
  import { type RefObject } from 'react';
2
2
  export type DashboardContextProps = {
3
3
  isFocusedMode: boolean;
4
+ mobileHeaderPriorityFeature: 'profile' | 'menuOrg';
4
5
  setAlertElement?: (element: HTMLElement | null) => void;
5
6
  alertHeight: number;
6
7
  isLoading: boolean;
7
8
  hasMenuOrganizationRef: RefObject<boolean | null>;
9
+ hasProfileRef: RefObject<boolean | null>;
8
10
  setFocusedMode: (isFocusedMode: boolean) => void;
9
11
  };
10
12
  export declare const DashboardContext: import("react").Context<DashboardContextProps>;
@@ -4,8 +4,10 @@ exports.DashboardContext = void 0;
4
4
  const react_1 = require("react");
5
5
  exports.DashboardContext = (0, react_1.createContext)({
6
6
  isFocusedMode: false,
7
+ mobileHeaderPriorityFeature: 'menuOrg',
7
8
  alertHeight: 0,
8
9
  isLoading: false,
9
10
  hasMenuOrganizationRef: (0, react_1.createRef)(),
11
+ hasProfileRef: (0, react_1.createRef)(),
10
12
  setFocusedMode: () => undefined,
11
13
  });
@@ -1,8 +1,8 @@
1
1
  import { type ReactNode } from 'react';
2
2
  import { type DashboardContextProps } from '../DashboardContext';
3
- type Props = Pick<DashboardContextProps, 'isFocusedMode'> & {
3
+ type Props = Pick<DashboardContextProps, 'isFocusedMode' | 'mobileHeaderPriorityFeature'> & {
4
4
  children: ReactNode;
5
5
  isLoading: boolean;
6
6
  };
7
- export declare const DashboardContextProvider: ({ children, isFocusedMode, isLoading, }: Props) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const DashboardContextProvider: ({ children, isFocusedMode, isLoading, mobileHeaderPriorityFeature, }: Props) => import("react/jsx-runtime").JSX.Element;
8
8
  export {};
@@ -4,11 +4,12 @@ exports.DashboardContextProvider = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const DashboardContext_1 = require("../DashboardContext");
7
- const DashboardContextProvider = ({ children, isFocusedMode, isLoading, }) => {
7
+ const DashboardContextProvider = ({ children, isFocusedMode, isLoading, mobileHeaderPriorityFeature, }) => {
8
8
  const [alertElement, setAlertElement] = (0, react_1.useState)(null);
9
9
  const [alertHeight, setAlertHeight] = (0, react_1.useState)(0);
10
10
  const [isFocusedModeInternal, setFocusedMode] = (0, react_1.useState)(isFocusedMode);
11
11
  const hasMenuOrganizationRef = (0, react_1.useRef)(false);
12
+ const hasProfileRef = (0, react_1.useRef)(false);
12
13
  (0, react_1.useEffect)(() => {
13
14
  if (isFocusedMode !== isFocusedModeInternal) {
14
15
  setFocusedMode(isFocusedMode);
@@ -30,9 +31,11 @@ const DashboardContextProvider = ({ children, isFocusedMode, isLoading, }) => {
30
31
  }, [alertElement]);
31
32
  return ((0, jsx_runtime_1.jsx)(DashboardContext_1.DashboardContext.Provider, { value: {
32
33
  isFocusedMode: isFocusedModeInternal,
34
+ mobileHeaderPriorityFeature,
33
35
  setAlertElement,
34
36
  alertHeight,
35
37
  isLoading,
38
+ hasProfileRef,
36
39
  hasMenuOrganizationRef,
37
40
  setFocusedMode,
38
41
  }, children: children }));
@@ -4,7 +4,7 @@ import { type DashboardLayoutProps } from './types';
4
4
  * Общий Layout приложения
5
5
  */
6
6
  export declare const DashboardLayout: {
7
- ({ children, isFocusedMode, isLoading, }: DashboardLayoutProps): import("react/jsx-runtime").JSX.Element;
7
+ ({ children, isFocusedMode, isLoading, mobileHeaderPriorityFeature, }: DashboardLayoutProps): import("react/jsx-runtime").JSX.Element;
8
8
  Header: import("react").ForwardRefExoticComponent<import("./Header").HeaderProps & import("react").RefAttributes<HTMLDivElement>>;
9
9
  Sidebar: import("react").ForwardRefExoticComponent<import("../DashboardSidebar").DashboardSidebarProps & import("react").RefAttributes<HTMLBaseElement>>;
10
10
  Main: import("react").ForwardRefExoticComponent<import("./Main").MainProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -10,8 +10,8 @@ const Main_1 = require("./Main");
10
10
  /**
11
11
  * Общий Layout приложения
12
12
  */
13
- const DashboardLayout = ({ children, isFocusedMode = false, isLoading = false, }) => {
14
- return ((0, jsx_runtime_1.jsx)(DashboardContext_1.DashboardContextProvider, { isFocusedMode: isFocusedMode, isLoading: isLoading, children: (0, jsx_runtime_1.jsx)(DashboardWrapper_1.DashboardWrapper, { children: children }) }));
13
+ const DashboardLayout = ({ children, isFocusedMode = false, isLoading = false, mobileHeaderPriorityFeature = 'menuOrg', }) => {
14
+ return ((0, jsx_runtime_1.jsx)(DashboardContext_1.DashboardContextProvider, { isFocusedMode: isFocusedMode, isLoading: isLoading, mobileHeaderPriorityFeature: mobileHeaderPriorityFeature, children: (0, jsx_runtime_1.jsx)(DashboardWrapper_1.DashboardWrapper, { children: children }) }));
15
15
  };
16
16
  exports.DashboardLayout = DashboardLayout;
17
17
  exports.DashboardLayout.Header = Header_1.Header;
@@ -9,15 +9,40 @@ const QuitOutlineMd_1 = require("../../../icons/QuitOutlineMd");
9
9
  const Button_1 = require("../../Button");
10
10
  const Product_1 = require("../../Product");
11
11
  const Profile_1 = require("../../Profile");
12
+ const cva_1 = require("../../utils/cva");
12
13
  const getInertProps_1 = require("../../utils/getInertProps");
13
14
  const constants_1 = require("./constants");
14
15
  const styles_1 = require("./styles");
15
16
  const useLogic_1 = require("./useLogic");
17
+ const headerPriorityFeature = (0, cva_1.cva)('', {
18
+ variants: {
19
+ feature: {
20
+ menuOrg: constants_1.dashboardLayoutHeaderClassnames.priorityFeatureMenuOrg,
21
+ profile: constants_1.dashboardLayoutHeaderClassnames.priorityFeatureProfile,
22
+ },
23
+ isPinned: {
24
+ true: constants_1.dashboardLayoutHeaderClassnames.mobileSidebarPriorityFeatureVisible,
25
+ },
26
+ featureInSidebar: {
27
+ true: constants_1.dashboardLayoutHeaderClassnames.featureInSidebar,
28
+ },
29
+ },
30
+ });
16
31
  /**
17
32
  * Основной header приложения
18
33
  */
19
34
  exports.Header = (0, react_1.forwardRef)((props, ref) => {
20
35
  const { productSwitcher: ProductSwitcher, product, profile, menuOrganization, children, } = props;
21
- const { isShowExitButton, isShowProfile, isFocusedMode, isMobile, collapsedIn, onToggleSidebar, isLoading, alertHeight, menuOrganizationClassnames, } = (0, useLogic_1.useLogic)(props);
22
- return ((0, jsx_runtime_1.jsx)(styles_1.HeaderRoot, { ref: ref, "$isFocusedMode": isFocusedMode, ...(0, getInertProps_1.getInertProps)(!isMobile && isFocusedMode), className: constants_1.dashboardLayoutHeaderClassnames.root, children: (0, jsx_runtime_1.jsxs)(styles_1.HeaderContent, { children: [(0, jsx_runtime_1.jsx)(styles_1.MobileSidebarTogglerWrapper, { className: constants_1.dashboardLayoutHeaderClassnames.mobileSidebarButton, children: (0, jsx_runtime_1.jsx)(Button_1.Button, { startIcon: collapsedIn ? (0, jsx_runtime_1.jsx)(CrossOutlineMd_1.CrossOutlineMd, {}) : (0, jsx_runtime_1.jsx)(MenuOnOutlineMd_1.MenuOnOutlineMd, {}), variant: "text", onClick: () => onToggleSidebar(), title: "\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0431\u043E\u043A\u043E\u0432\u043E\u0435 \u043C\u0435\u043D\u044E" }) }), (0, jsx_runtime_1.jsxs)(styles_1.HeaderSection, { children: [ProductSwitcher && ((0, jsx_runtime_1.jsx)(styles_1.ProductSwitcherWrapper, { children: (0, jsx_runtime_1.jsx)(ProductSwitcher, {}) })), (0, jsx_runtime_1.jsx)(Product_1.Product, { ...product })] }), (0, jsx_runtime_1.jsxs)(styles_1.HeaderContentSection, { children: [children, menuOrganization && ((0, jsx_runtime_1.jsx)(styles_1.MenuOrganizationWrapper, { className: menuOrganizationClassnames, "$alertHeight": alertHeight, children: menuOrganization() })), profile && ((0, jsx_runtime_1.jsx)(styles_1.ProfileWrapper, { "$isShow": isShowProfile, children: (0, jsx_runtime_1.jsx)(Profile_1.Profile, { isLoading: isLoading, ...profile }) })), (0, jsx_runtime_1.jsx)(styles_1.ExitButton, { "$isShow": isShowExitButton, onClick: profile?.exitButton?.onClick, title: "\u0412\u044B\u0445\u043E\u0434", variant: "text", children: (0, jsx_runtime_1.jsx)(QuitOutlineMd_1.QuitOutlineMd, {}) })] })] }) }));
36
+ const { isShowExitButton, isShowProfile, isFocusedMode, isMobile, collapsedIn, onToggleSidebar, isLoading, mobileHeaderPriorityFeature, headerStyle, isPinned, } = (0, useLogic_1.useLogic)(props);
37
+ return ((0, jsx_runtime_1.jsx)(styles_1.HeaderRoot, { ref: ref, "$isFocusedMode": isFocusedMode, ...(0, getInertProps_1.getInertProps)(!isMobile && isFocusedMode), className: constants_1.dashboardLayoutHeaderClassnames.root, style: headerStyle, children: (0, jsx_runtime_1.jsxs)(styles_1.HeaderContent, { children: [(0, jsx_runtime_1.jsx)(styles_1.MobileSidebarTogglerWrapper, { className: constants_1.dashboardLayoutHeaderClassnames.mobileSidebarButton, children: (0, jsx_runtime_1.jsx)(Button_1.Button, { startIcon: collapsedIn ? (0, jsx_runtime_1.jsx)(CrossOutlineMd_1.CrossOutlineMd, {}) : (0, jsx_runtime_1.jsx)(MenuOnOutlineMd_1.MenuOnOutlineMd, {}), variant: "text", onClick: () => onToggleSidebar(), title: "\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0431\u043E\u043A\u043E\u0432\u043E\u0435 \u043C\u0435\u043D\u044E" }) }), (0, jsx_runtime_1.jsxs)(styles_1.HeaderSection, { children: [ProductSwitcher && ((0, jsx_runtime_1.jsx)(styles_1.ProductSwitcherWrapper, { children: (0, jsx_runtime_1.jsx)(ProductSwitcher, {}) })), (0, jsx_runtime_1.jsx)(Product_1.Product, { ...product })] }), (0, jsx_runtime_1.jsxs)(styles_1.HeaderContentSection, { className: headerPriorityFeature({
38
+ feature: mobileHeaderPriorityFeature,
39
+ }), children: [children, menuOrganization && ((0, jsx_runtime_1.jsx)(styles_1.PriorityFeatureWrapper, { className: headerPriorityFeature({
40
+ feature: mobileHeaderPriorityFeature,
41
+ isPinned,
42
+ featureInSidebar: mobileHeaderPriorityFeature === 'profile',
43
+ }), children: menuOrganization() })), profile && ((0, jsx_runtime_1.jsx)(styles_1.PriorityFeatureWrapper, { className: headerPriorityFeature({
44
+ feature: mobileHeaderPriorityFeature,
45
+ isPinned,
46
+ featureInSidebar: mobileHeaderPriorityFeature === 'menuOrg',
47
+ }), children: (0, jsx_runtime_1.jsx)(styles_1.ProfileWrapper, { className: constants_1.dashboardLayoutHeaderClassnames.profile, "$isShow": isShowProfile, children: (0, jsx_runtime_1.jsx)(Profile_1.Profile, { isLoading: isLoading, ...profile }) }) })), (0, jsx_runtime_1.jsx)(styles_1.ExitButton, { "$isShow": isShowExitButton, onClick: profile?.exitButton?.onClick, title: "\u0412\u044B\u0445\u043E\u0434", variant: "text", children: (0, jsx_runtime_1.jsx)(QuitOutlineMd_1.QuitOutlineMd, {}) })] })] }) }));
23
48
  });
@@ -1,5 +1,9 @@
1
1
  export declare const dashboardLayoutHeaderClassnames: {
2
2
  root: string;
3
3
  mobileSidebarButton: string;
4
- mobileMenuOrganizationVisible: string;
4
+ priorityFeatureMenuOrg: string;
5
+ priorityFeatureProfile: string;
6
+ mobileSidebarPriorityFeatureVisible: string;
7
+ featureInSidebar: string;
8
+ profile: string;
5
9
  };
@@ -5,5 +5,9 @@ const createUIKitClassname_1 = require("../../utils/createUIKitClassname");
5
5
  exports.dashboardLayoutHeaderClassnames = {
6
6
  root: (0, createUIKitClassname_1.createUIKitClassname)('dashboard-layout-header'),
7
7
  mobileSidebarButton: (0, createUIKitClassname_1.createUIKitClassname)('dashboard-layout-header__sidebar-button_mobile'),
8
- mobileMenuOrganizationVisible: (0, createUIKitClassname_1.createUIKitClassname)('dashboard-layout-header__menu-organization_visible'),
8
+ priorityFeatureMenuOrg: (0, createUIKitClassname_1.createUIKitClassname)('dashboard-layout-header__priority-feature_menu-org'),
9
+ priorityFeatureProfile: (0, createUIKitClassname_1.createUIKitClassname)('dashboard-layout-header__priority-feature_profile'),
10
+ mobileSidebarPriorityFeatureVisible: (0, createUIKitClassname_1.createUIKitClassname)('dashboard-layout-header__sidebar-priority-feature_visible'),
11
+ featureInSidebar: (0, createUIKitClassname_1.createUIKitClassname)('dashboard-layout-header__feature-in-sidebar'),
12
+ profile: (0, createUIKitClassname_1.createUIKitClassname)('dashboard-layout-header__profile'),
9
13
  };
@@ -44,9 +44,10 @@ export declare const HeaderContent: import("@emotion/styled/dist/declarations/sr
44
44
  theme?: import("@emotion/react").Theme | undefined;
45
45
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
46
46
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
47
- export declare const MenuOrganizationWrapper: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
47
+ /**
48
+ * Обертка для элементов которые должны быть в мобильном хедере или помещены в sidebar.
49
+ */
50
+ export declare const PriorityFeatureWrapper: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
48
51
  theme?: import("@emotion/react").Theme | undefined;
49
52
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
50
- } & {
51
- $alertHeight?: number | undefined;
52
53
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MenuOrganizationWrapper = exports.HeaderContent = exports.ExitButton = exports.ProfileWrapper = exports.ProductSwitcherWrapper = exports.HeaderContentSection = exports.HeaderSection = exports.MobileSidebarTogglerWrapper = exports.HeaderRoot = void 0;
3
+ exports.PriorityFeatureWrapper = exports.HeaderContent = exports.ExitButton = exports.ProfileWrapper = exports.ProductSwitcherWrapper = exports.HeaderContentSection = exports.HeaderSection = exports.MobileSidebarTogglerWrapper = exports.HeaderRoot = void 0;
4
4
  const Button_1 = require("@mui/material/Button");
5
5
  const constants_1 = require("../../DashboardSidebar/constants");
6
6
  const IconButton_1 = require("../../IconButton");
7
7
  const constants_2 = require("../../MenuOrganization/constants");
8
8
  const constants_3 = require("../../MenuOrganization/OrganizationButton/constants");
9
+ const constants_4 = require("../../Profile/constants");
9
10
  const styled_1 = require("../../styled");
10
- const constants_4 = require("../constants");
11
- const constants_5 = require("./constants");
11
+ const constants_5 = require("../constants");
12
+ const constants_6 = require("./constants");
12
13
  exports.HeaderRoot = (0, styled_1.styled)('header', {
13
14
  shouldForwardProp: (prop) => !['$isFocusedMode'].includes(prop),
14
15
  }) `
@@ -21,8 +22,8 @@ exports.HeaderRoot = (0, styled_1.styled)('header', {
21
22
  justify-content: space-between;
22
23
 
23
24
  width: 100%;
24
- height: ${constants_4.HEADER_HEIGHT_DESKTOP};
25
- margin-top: ${({ $isFocusedMode }) => $isFocusedMode ? `-${constants_4.HEADER_HEIGHT_DESKTOP}` : 0};
25
+ height: ${constants_5.HEADER_HEIGHT_DESKTOP};
26
+ margin-top: ${({ $isFocusedMode }) => $isFocusedMode ? `-${constants_5.HEADER_HEIGHT_DESKTOP}` : 0};
26
27
  margin-bottom: ${({ theme }) => theme.spacing(4)};
27
28
 
28
29
  transition: ${({ theme }) => {
@@ -32,14 +33,14 @@ exports.HeaderRoot = (0, styled_1.styled)('header', {
32
33
  }};
33
34
 
34
35
  ${({ theme }) => theme.breakpoints.down('laptop')} {
35
- height: ${constants_4.HEADER_HEIGHT_LAPTOP};
36
+ height: ${constants_5.HEADER_HEIGHT_LAPTOP};
36
37
  }
37
38
 
38
39
  ${({ theme }) => theme.breakpoints.down('sm')} {
39
40
  grid-row: 2;
40
41
  justify-content: flex-start;
41
42
 
42
- height: ${constants_4.HEADER_HEIGHT_MOBILE};
43
+ height: ${constants_5.HEADER_HEIGHT_MOBILE};
43
44
  margin-bottom: 0;
44
45
  padding: ${({ theme }) => theme.spacing(0, 2, 0, 1)};
45
46
 
@@ -60,7 +61,7 @@ exports.MobileSidebarTogglerWrapper = styled_1.styled.div `
60
61
 
61
62
  /* Причина игнора: Не критично для отображения */
62
63
  /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
63
- .${constants_4.dashboardLayoutClassnames.root}:not(:has(.${constants_1.dashboardSidebarClassnames.root}))
64
+ .${constants_5.dashboardLayoutClassnames.root}:not(:has(.${constants_1.dashboardSidebarClassnames.root}))
64
65
  & {
65
66
  display: none;
66
67
  }
@@ -80,6 +81,15 @@ exports.HeaderContentSection = (0, styled_1.styled)(exports.HeaderSection) `
80
81
 
81
82
  ${({ theme }) => theme.breakpoints.down('sm')} {
82
83
  gap: ${({ theme }) => theme.spacing(2)};
84
+
85
+ &.${constants_6.dashboardLayoutHeaderClassnames.priorityFeatureMenuOrg} {
86
+ & .${constants_2.menuOrganizationClassnames.organizationData} {
87
+ display: none;
88
+ }
89
+ & .${constants_2.menuOrganizationClassnames.button} {
90
+ border-radius: ${({ theme }) => theme.shape.medium};
91
+ }
92
+ }
83
93
  }
84
94
  `;
85
95
  exports.ProductSwitcherWrapper = styled_1.styled.div `
@@ -114,45 +124,77 @@ exports.HeaderContent = styled_1.styled.div `
114
124
  padding: 0;
115
125
  }
116
126
  `;
117
- exports.MenuOrganizationWrapper = styled_1.styled.div `
127
+ /**
128
+ * Обертка для элементов которые должны быть в мобильном хедере или помещены в sidebar.
129
+ */
130
+ exports.PriorityFeatureWrapper = styled_1.styled.div `
118
131
  ${({ theme }) => theme.breakpoints.down('sm')} {
119
- position: absolute;
120
- z-index: ${({ theme }) => theme.zIndex.appBar - 1};
121
- top: ${({ $alertHeight }) => `calc(${$alertHeight}px + ${constants_4.HEADER_HEIGHT_MOBILE}) `};
122
- left: 0;
123
-
124
- /* Необходимо для анимации компонента вместе с sidebar */
125
- transform: translateX(-100vw);
126
132
 
127
- display: flex;
128
- flex-direction: column;
133
+ &.${constants_6.dashboardLayoutHeaderClassnames.featureInSidebar} {
134
+ position: absolute;
135
+ z-index: ${({ theme }) => theme.zIndex.appBar - 1};
136
+ top: calc(var(--alert-height, 0px) + ${constants_5.HEADER_HEIGHT_MOBILE});
137
+ left: 0;
138
+
139
+ /* Необходимо для анимации компонента вместе с sidebar */
140
+ transform: translateX(-100vw);
129
141
 
130
- width: 100vw;
142
+ display: flex;
143
+ flex-direction: column;
131
144
 
132
- background-color: ${({ theme }) => theme.palette.background.default};
145
+ width: 100vw;
133
146
 
134
- transition: ${({ theme }) => {
147
+ background-color: ${({ theme }) => theme.palette.background.default};
148
+
149
+ transition: ${({ theme }) => {
135
150
  return theme.transitions.create(['transform'], {
136
151
  duration: theme.transitions.duration.standard,
137
152
  });
138
153
  }};
139
154
 
140
- &.${constants_5.dashboardLayoutHeaderClassnames.mobileMenuOrganizationVisible} {
141
- transform: translateX(0);
142
- }
143
-
144
- & .${constants_2.menuOrganizationClassnames.button} {
145
- height: ${constants_3.MOBILE_BUTTON_HEIGHT};
146
- padding: ${({ theme }) => theme.spacing(3, 4)};
155
+ &.${constants_6.dashboardLayoutHeaderClassnames.mobileSidebarPriorityFeatureVisible} {
156
+ transform: translateX(0);
157
+ }
147
158
 
148
- border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
159
+ & .${constants_2.menuOrganizationClassnames.button}, & .${constants_4.profileClassnames.button} {
160
+ height: ${constants_3.MOBILE_BUTTON_HEIGHT};
161
+ padding: ${({ theme }) => theme.spacing(3, 4)};
149
162
 
150
- &:hover {
151
163
  border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
164
+
165
+ &:hover {
166
+ border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
167
+ }
168
+
169
+ &:active {
170
+ border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
171
+ }
152
172
  }
153
173
 
154
- &:active {
155
- border-bottom: 1px solid ${({ theme }) => theme.palette.grey[300]};
174
+ &.${constants_6.dashboardLayoutHeaderClassnames.priorityFeatureMenuOrg} {
175
+ & .${constants_6.dashboardLayoutHeaderClassnames.profile} {
176
+ display: block;
177
+ }
178
+
179
+
180
+ & .${constants_4.profileClassnames.button} {
181
+ width: 100%;
182
+ max-width: unset;
183
+
184
+ border-radius: 0;
185
+ }
186
+
187
+ & .${constants_4.profileClassnames.avatar} {
188
+ display: none;
189
+ }
190
+
191
+ & .${constants_4.profileClassnames.user} {
192
+ display: flex;
193
+ align-items: center;
194
+ justify-content: space-between;
195
+
196
+ width: 100%;
197
+ }
156
198
  }
157
199
  }
158
200
  }
@@ -1,12 +1,15 @@
1
+ import { type CSSProperties } from 'react';
1
2
  import { type HeaderProps } from '../types';
2
3
  export declare const useLogic: ({ profile, menuOrganization }: HeaderProps) => {
3
4
  isShowExitButton: boolean;
4
5
  isShowProfile: boolean;
5
6
  isMobile: boolean;
6
7
  isFocusedMode: boolean;
8
+ mobileHeaderPriorityFeature: "profile" | "menuOrg";
7
9
  isLoading: boolean;
8
10
  collapsedIn: boolean;
9
11
  onToggleSidebar: (newValue?: boolean | undefined) => void;
10
12
  alertHeight: number;
11
- menuOrganizationClassnames: string;
13
+ isPinned: boolean;
14
+ headerStyle: CSSProperties;
12
15
  };