@astral/ui 4.12.0 → 4.13.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.
@@ -12,11 +12,12 @@ import { OrganizationListSkeleton } from './OrganizationListSkeleton';
12
12
  import { ActionWrapper, OrganizationsWrapper, SearchWrapper, StyledTypography, } from './styles';
13
13
  import { useLogic } from './useLogic';
14
14
  export const MenuOrganization = (props) => {
15
+ const { anchorOrigin = { vertical: 'bottom', horizontal: 'right' }, transformOrigin = { vertical: 'top', horizontal: 'right' }, } = props;
15
16
  const { action, isLoading, isError, onRetry, isComponentLoading, isShowOrganizationList, searchProps, popoverProps, organizationListProps, organizationButtonProps, isShowSearchField, } = useLogic(props);
16
17
  if (isComponentLoading) {
17
18
  return _jsx(MenuOrganizationSkeleton, {});
18
19
  }
19
- return (_jsxs(_Fragment, { children: [_jsx(OrganizationButton, { ...organizationButtonProps }), _jsxs(Popover, { ...popoverProps, anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, transformOrigin: { vertical: 'top', horizontal: 'right' }, children: [isShowSearchField && (_jsx(SearchWrapper, { children: _jsx(SearchField, { fullWidth: true, ...searchProps }) })), _jsx(OrganizationsWrapper, { "$isLoading": isLoading, className: menuOrganizationClassnames.root, children: _jsx(ContentState, { isLoading: isLoading, isCustom: isError, customState: {
20
+ return (_jsxs(_Fragment, { children: [_jsx(OrganizationButton, { ...organizationButtonProps }), _jsxs(Popover, { ...popoverProps, anchorOrigin: anchorOrigin, transformOrigin: transformOrigin, children: [isShowSearchField && (_jsx(SearchWrapper, { children: _jsx(SearchField, { fullWidth: true, ...searchProps }) })), _jsx(OrganizationsWrapper, { "$isLoading": isLoading, className: menuOrganizationClassnames.root, children: _jsx(ContentState, { isLoading: isLoading, isCustom: isError, customState: {
20
21
  title: (_jsx(StyledTypography, { children: "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435" })),
21
22
  Actions: (_jsx(Button, { variant: "light", color: "grey", onClick: onRetry, children: "\u041F\u043E\u043F\u0440\u043E\u0431\u043E\u0432\u0430\u0442\u044C \u0441\u043D\u043E\u0432\u0430" })),
22
23
  className: menuOrganizationClassnames.errorPlaceholder,
@@ -1,3 +1,4 @@
1
+ import type { PopoverOrigin } from '@mui/material';
1
2
  import type { ComponentProps, ElementType, ReactNode } from 'react';
2
3
  import type { ButtonProps } from '../Button';
3
4
  export type Organization = {
@@ -126,4 +127,16 @@ export type MenuOrganizationProps<TData extends Organization = Organization> = {
126
127
  renderPreview?: (organization: TData, params: {
127
128
  className?: string;
128
129
  }) => ReactNode;
130
+ /**
131
+ * Позиция точки привязки на кнопке
132
+ * @example
133
+ * anchorOrigin={{ vertical: 'bottom', horizontal: 'left' }}
134
+ */
135
+ anchorOrigin?: PopoverOrigin;
136
+ /**
137
+ * Позиция точки привязки на Popover
138
+ * @example
139
+ * transformOrigin={{ vertical: 'top', horizontal: 'left' }}
140
+ */
141
+ transformOrigin?: PopoverOrigin;
129
142
  };
@@ -15,11 +15,12 @@ const OrganizationListSkeleton_1 = require("./OrganizationListSkeleton");
15
15
  const styles_1 = require("./styles");
16
16
  const useLogic_1 = require("./useLogic");
17
17
  const MenuOrganization = (props) => {
18
+ const { anchorOrigin = { vertical: 'bottom', horizontal: 'right' }, transformOrigin = { vertical: 'top', horizontal: 'right' }, } = props;
18
19
  const { action, isLoading, isError, onRetry, isComponentLoading, isShowOrganizationList, searchProps, popoverProps, organizationListProps, organizationButtonProps, isShowSearchField, } = (0, useLogic_1.useLogic)(props);
19
20
  if (isComponentLoading) {
20
21
  return (0, jsx_runtime_1.jsx)(MenuOrganizationSkeleton_1.MenuOrganizationSkeleton, {});
21
22
  }
22
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrganizationButton_1.OrganizationButton, { ...organizationButtonProps }), (0, jsx_runtime_1.jsxs)(Popover_1.Popover, { ...popoverProps, anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, transformOrigin: { vertical: 'top', horizontal: 'right' }, children: [isShowSearchField && ((0, jsx_runtime_1.jsx)(styles_1.SearchWrapper, { children: (0, jsx_runtime_1.jsx)(SearchField_1.SearchField, { fullWidth: true, ...searchProps }) })), (0, jsx_runtime_1.jsx)(styles_1.OrganizationsWrapper, { "$isLoading": isLoading, className: constants_1.menuOrganizationClassnames.root, children: (0, jsx_runtime_1.jsx)(ContentState_1.ContentState, { isLoading: isLoading, isCustom: isError, customState: {
23
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(OrganizationButton_1.OrganizationButton, { ...organizationButtonProps }), (0, jsx_runtime_1.jsxs)(Popover_1.Popover, { ...popoverProps, anchorOrigin: anchorOrigin, transformOrigin: transformOrigin, children: [isShowSearchField && ((0, jsx_runtime_1.jsx)(styles_1.SearchWrapper, { children: (0, jsx_runtime_1.jsx)(SearchField_1.SearchField, { fullWidth: true, ...searchProps }) })), (0, jsx_runtime_1.jsx)(styles_1.OrganizationsWrapper, { "$isLoading": isLoading, className: constants_1.menuOrganizationClassnames.root, children: (0, jsx_runtime_1.jsx)(ContentState_1.ContentState, { isLoading: isLoading, isCustom: isError, customState: {
23
24
  title: ((0, jsx_runtime_1.jsx)(styles_1.StyledTypography, { children: "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0435" })),
24
25
  Actions: ((0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "light", color: "grey", onClick: onRetry, children: "\u041F\u043E\u043F\u0440\u043E\u0431\u043E\u0432\u0430\u0442\u044C \u0441\u043D\u043E\u0432\u0430" })),
25
26
  className: constants_1.menuOrganizationClassnames.errorPlaceholder,
@@ -1,3 +1,4 @@
1
+ import type { PopoverOrigin } from '@mui/material';
1
2
  import type { ComponentProps, ElementType, ReactNode } from 'react';
2
3
  import type { ButtonProps } from '../Button';
3
4
  export type Organization = {
@@ -126,4 +127,16 @@ export type MenuOrganizationProps<TData extends Organization = Organization> = {
126
127
  renderPreview?: (organization: TData, params: {
127
128
  className?: string;
128
129
  }) => ReactNode;
130
+ /**
131
+ * Позиция точки привязки на кнопке
132
+ * @example
133
+ * anchorOrigin={{ vertical: 'bottom', horizontal: 'left' }}
134
+ */
135
+ anchorOrigin?: PopoverOrigin;
136
+ /**
137
+ * Позиция точки привязки на Popover
138
+ * @example
139
+ * transformOrigin={{ vertical: 'top', horizontal: 'left' }}
140
+ */
141
+ transformOrigin?: PopoverOrigin;
129
142
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "4.12.0",
3
+ "version": "4.13.0",
4
4
  "browser": "./index.js",
5
5
  "main": "./node/index.js",
6
6
  "dependencies": {