@astral/ui 4.5.0 → 4.6.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 (53) hide show
  1. package/components/DataGrid/Head/Head.js +5 -4
  2. package/components/DataGrid/HeadCell/styles.js +5 -0
  3. package/components/DataGrid/types.d.ts +4 -0
  4. package/components/DataGridColumnHintIcon/DataGridColumnHintIcon.d.ts +4 -0
  5. package/components/DataGridColumnHintIcon/DataGridColumnHintIcon.js +6 -0
  6. package/components/DataGridColumnHintIcon/index.d.ts +1 -0
  7. package/components/DataGridColumnHintIcon/index.js +1 -0
  8. package/components/HintIcon/HintIcon.d.ts +2 -35
  9. package/components/HintIcon/HintIcon.js +2 -2
  10. package/components/HintIcon/Icon/Icon.d.ts +4 -5
  11. package/components/HintIcon/Icon/Icon.js +2 -1
  12. package/components/HintIcon/Icon/useLogic/hooks/useIconColor/useIconColor.d.ts +3 -1
  13. package/components/HintIcon/Icon/useLogic/hooks/useIconColor/useIconColor.js +4 -1
  14. package/components/HintIcon/Icon/useLogic/useLogic.d.ts +3 -3
  15. package/components/HintIcon/Icon/useLogic/useLogic.js +5 -2
  16. package/components/HintIcon/constants.d.ts +3 -0
  17. package/components/HintIcon/constants.js +4 -0
  18. package/components/HintIcon/index.d.ts +2 -0
  19. package/components/HintIcon/index.js +1 -0
  20. package/components/HintIcon/styles.d.ts +0 -6
  21. package/components/HintIcon/styles.js +0 -7
  22. package/components/HintIcon/types.d.ts +38 -0
  23. package/components/HintIcon/useLogic/useLogic.d.ts +3 -2
  24. package/components/HintIcon/useLogic/useLogic.js +4 -2
  25. package/components/index.d.ts +1 -0
  26. package/components/index.js +1 -0
  27. package/node/components/DataGrid/Head/Head.js +4 -3
  28. package/node/components/DataGrid/HeadCell/styles.js +5 -0
  29. package/node/components/DataGrid/types.d.ts +4 -0
  30. package/node/components/DataGridColumnHintIcon/DataGridColumnHintIcon.d.ts +4 -0
  31. package/node/components/DataGridColumnHintIcon/DataGridColumnHintIcon.js +10 -0
  32. package/node/components/DataGridColumnHintIcon/index.d.ts +1 -0
  33. package/node/components/DataGridColumnHintIcon/index.js +17 -0
  34. package/node/components/HintIcon/HintIcon.d.ts +2 -35
  35. package/node/components/HintIcon/HintIcon.js +2 -2
  36. package/node/components/HintIcon/Icon/Icon.d.ts +4 -5
  37. package/node/components/HintIcon/Icon/Icon.js +2 -1
  38. package/node/components/HintIcon/Icon/useLogic/hooks/useIconColor/useIconColor.d.ts +3 -1
  39. package/node/components/HintIcon/Icon/useLogic/hooks/useIconColor/useIconColor.js +4 -1
  40. package/node/components/HintIcon/Icon/useLogic/useLogic.d.ts +3 -3
  41. package/node/components/HintIcon/Icon/useLogic/useLogic.js +5 -2
  42. package/node/components/HintIcon/constants.d.ts +3 -0
  43. package/node/components/HintIcon/constants.js +5 -1
  44. package/node/components/HintIcon/index.d.ts +2 -0
  45. package/node/components/HintIcon/index.js +3 -0
  46. package/node/components/HintIcon/styles.d.ts +0 -6
  47. package/node/components/HintIcon/styles.js +1 -8
  48. package/node/components/HintIcon/types.d.ts +38 -0
  49. package/node/components/HintIcon/useLogic/useLogic.d.ts +3 -2
  50. package/node/components/HintIcon/useLogic/useLogic.js +4 -2
  51. package/node/components/index.d.ts +1 -0
  52. package/node/components/index.js +4 -2
  53. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useMemo } from 'react';
3
3
  import { Checkbox } from '../../Checkbox';
4
4
  import { dataGridClassnames } from '../constants';
@@ -9,13 +9,14 @@ export const Head = (props) => {
9
9
  const { checkboxProps, handleSort } = useLogic(props);
10
10
  const { columns, gridColumns, isSelectable, sorting, onSelectAllRows, isHideSelectAll, } = props;
11
11
  const renderColumns = useMemo(() => {
12
- return columns.map(({ field, label, sortable, align }, index) => {
12
+ return columns.map(({ field, label, sortable, align, columnHint }, index) => {
13
13
  const isFirstCell = !index;
14
14
  const startAdornmentRender = () => {
15
- if (isHideSelectAll || !isFirstCell || !isSelectable) {
15
+ const showCheckbox = isFirstCell && isSelectable && !isHideSelectAll;
16
+ if (!showCheckbox && !columnHint) {
16
17
  return null;
17
18
  }
18
- return (_jsx(CheckboxCell, { children: _jsx(Checkbox, { ...checkboxProps, onChange: onSelectAllRows }) }));
19
+ return (_jsxs(_Fragment, { children: [showCheckbox && (_jsx(CheckboxCell, { children: _jsx(Checkbox, { ...checkboxProps, onChange: onSelectAllRows }) })), columnHint] }));
19
20
  };
20
21
  return (_jsx(HeadCell, { sorting: sorting, field: field, label: label, isSortable: sortable, align: align, startAdornment: startAdornmentRender(), onSort: handleSort }, label));
21
22
  });
@@ -1,3 +1,4 @@
1
+ import { hintIconClassnames } from '../../HintIcon';
1
2
  import { styled } from '../../styles';
2
3
  import { alignToJustifyContent } from '../utils';
3
4
  export const Wrapper = styled('div', {
@@ -20,4 +21,8 @@ export const Wrapper = styled('div', {
20
21
  width: 16px;
21
22
  height: 16px;
22
23
  }
24
+
25
+ .${hintIconClassnames.iconWrapper} {
26
+ margin-right: ${({ theme }) => theme.spacing(1)};
27
+ }
23
28
  `;
@@ -223,6 +223,10 @@ export type DataGridColumns<TData extends Record<string, CellValue>> = {
223
223
  * Скрывает содержимое столбца от инструментов мониторинга
224
224
  */
225
225
  isHidePersonalData?: boolean;
226
+ /**
227
+ * Принимает компонент DataGridColumnHintIcon - подсказка в шапке колонки
228
+ */
229
+ columnHint?: ReactNode;
226
230
  };
227
231
  export type DataGridRowOptionColumns<TData extends Record<string, CellValue>> = {
228
232
  /**
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { type HintIconProps } from '../HintIcon';
3
+ export type DataGridColumnHintIconProps = Omit<HintIconProps, 'renderIcon' | 'variant' | 'iconOption'>;
4
+ export declare const DataGridColumnHintIcon: (props: DataGridColumnHintIconProps) => JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { InfoOutlineSm } from '../../icons';
3
+ import { HintIcon } from '../HintIcon';
4
+ export const DataGridColumnHintIcon = (props) => {
5
+ return (_jsx(HintIcon, { renderIcon: () => _jsx(InfoOutlineSm, {}), variant: "info", ...props }));
6
+ };
@@ -0,0 +1 @@
1
+ export * from './DataGridColumnHintIcon';
@@ -0,0 +1 @@
1
+ export * from './DataGridColumnHintIcon';
@@ -1,36 +1,3 @@
1
1
  /// <reference types="react" />
2
- import { type TooltipPlacement } from './types';
3
- export type HintIconProps = {
4
- /**
5
- * Определяет иконку отображения
6
- */
7
- variant: 'question' | 'info';
8
- /**
9
- * Опции для иконки
10
- */
11
- iconOption?: {
12
- /**
13
- * Определяет тип иконки
14
- * @default fill
15
- */
16
- variant?: 'fill' | 'outline';
17
- /**
18
- * Определяет цвет иконки
19
- * @default lightGrey
20
- */
21
- color?: 'warning' | 'grey' | 'lightGrey';
22
- };
23
- /**
24
- * Текст заголовка BottomDrawer
25
- */
26
- title: string;
27
- /**
28
- * Текст тултипа или контента BottomDrawer
29
- */
30
- note: string;
31
- /**
32
- * Положение тултипа
33
- */
34
- tooltipPlacement?: TooltipPlacement;
35
- };
36
- export declare const HintIcon: ({ variant, title, note, iconOption, tooltipPlacement, }: HintIconProps) => JSX.Element;
2
+ import { type HintIconProps } from './types';
3
+ export declare const HintIcon: ({ variant, title, note, iconOption, tooltipPlacement, renderIcon, }: HintIconProps) => JSX.Element;
@@ -3,7 +3,7 @@ import { BottomDrawer } from '../BottomDrawer';
3
3
  import { Icon } from './Icon';
4
4
  import { DrawerContent } from './styles';
5
5
  import { useLogic } from './useLogic';
6
- export const HintIcon = ({ variant, title, note, iconOption, tooltipPlacement = 'bottom', }) => {
6
+ export const HintIcon = ({ variant, title, note, iconOption, tooltipPlacement = 'bottom', renderIcon, }) => {
7
7
  const { handleClose, handleOpen, open } = useLogic();
8
- return (_jsxs(_Fragment, { children: [_jsx(Icon, { onClick: handleOpen, variant: variant, iconOption: iconOption, note: note, tooltipPlacement: tooltipPlacement }), _jsx(BottomDrawer, { title: title, open: open, onClose: handleClose, children: _jsx(DrawerContent, { children: note }) })] }));
8
+ return (_jsxs(_Fragment, { children: [_jsx(Icon, { onClick: handleOpen, variant: variant, iconOption: iconOption, note: note, tooltipPlacement: tooltipPlacement, renderIcon: renderIcon }), _jsx(BottomDrawer, { title: title, open: open, onClose: handleClose, children: _jsx(DrawerContent, { children: note }) })] }));
9
9
  };
@@ -1,8 +1,7 @@
1
- /// <reference types="react" />
2
- import { type HintIconProps } from '../HintIcon';
3
- import type { TooltipPlacement } from '../types';
4
- export type IconProps = Pick<HintIconProps, 'variant' | 'iconOption' | 'note'> & {
5
- onClick: () => void;
1
+ import type { SyntheticEvent } from 'react';
2
+ import type { HintIconProps, TooltipPlacement } from '../types';
3
+ export type IconProps = Pick<HintIconProps, 'variant' | 'iconOption' | 'note' | 'renderIcon'> & {
4
+ onClick: (e: SyntheticEvent) => void;
6
5
  tooltipPlacement: TooltipPlacement;
7
6
  };
8
7
  export declare const Icon: (props: IconProps) => JSX.Element;
@@ -1,9 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Tooltip } from '../../Tooltip';
3
+ import { hintIconClassnames } from '../constants';
3
4
  import { IconWrapper } from './styles';
4
5
  import { useLogic } from './useLogic';
5
6
  export const Icon = (props) => {
6
7
  const { getIcon, iconColor } = useLogic(props);
7
8
  const { onClick, note, tooltipPlacement } = props;
8
- return (_jsx(Tooltip, { title: note, placement: tooltipPlacement, children: _jsx(IconWrapper, { onClick: onClick, "$color": iconColor, children: getIcon() }) }));
9
+ return (_jsx(Tooltip, { title: note, placement: tooltipPlacement, children: _jsx(IconWrapper, { onClick: onClick, "$color": iconColor, className: hintIconClassnames.iconWrapper, children: getIcon() }) }));
9
10
  };
@@ -1,5 +1,7 @@
1
+ import { type ReactNode } from 'react';
1
2
  type UseIconColorParams = {
2
3
  color?: 'warning' | 'grey' | 'lightGrey';
4
+ renderIcon?: () => ReactNode;
3
5
  };
4
- export declare const useIconColor: ({ color }: UseIconColorParams) => string;
6
+ export declare const useIconColor: ({ color, renderIcon }: UseIconColorParams) => string;
5
7
  export {};
@@ -1,11 +1,14 @@
1
1
  import { useTheme } from '../../../../../theme';
2
- export const useIconColor = ({ color }) => {
2
+ export const useIconColor = ({ color, renderIcon }) => {
3
3
  const theme = useTheme();
4
4
  const colorMap = {
5
5
  warning: theme.palette.yellow[800],
6
6
  grey: theme.palette.grey[800],
7
7
  lightGrey: theme.palette.grey[400],
8
8
  };
9
+ if (renderIcon) {
10
+ return 'currentColor';
11
+ }
9
12
  if (color) {
10
13
  return colorMap[color];
11
14
  }
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
1
+ import { type ReactNode } from 'react';
2
2
  import { type IconProps } from '../Icon';
3
3
  type UseLogicParams = IconProps;
4
- export declare const useLogic: ({ iconOption, variant }: UseLogicParams) => {
5
- getIcon: () => JSX.Element;
4
+ export declare const useLogic: ({ iconOption, variant, renderIcon, }: UseLogicParams) => {
5
+ getIcon: () => ReactNode;
6
6
  iconColor: string;
7
7
  };
8
8
  export {};
@@ -1,9 +1,12 @@
1
1
  import { ICONS } from '../../constants';
2
2
  import { useIconColor } from './hooks';
3
- export const useLogic = ({ iconOption, variant }) => {
4
- const iconColor = useIconColor({ color: iconOption?.color });
3
+ export const useLogic = ({ iconOption, variant, renderIcon, }) => {
4
+ const iconColor = useIconColor({ color: iconOption?.color, renderIcon });
5
5
  const { variant: iconOptionVariant = 'fill' } = iconOption || {};
6
6
  const getIcon = () => {
7
+ if (renderIcon) {
8
+ return renderIcon();
9
+ }
7
10
  const icon = ICONS[variant][iconOptionVariant];
8
11
  if (icon) {
9
12
  return icon;
@@ -1,4 +1,7 @@
1
1
  /// <reference types="react" />
2
+ export declare const hintIconClassnames: {
3
+ iconWrapper: string;
4
+ };
2
5
  export declare const ICONS: {
3
6
  question: {
4
7
  fill: JSX.Element;
@@ -1,5 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { InfoFillMd, InfoOutlineMd, QuestionFillMd, QuestionOutlineMd, } from '../../icons';
3
+ import { createUIKitClassname } from '../utils';
4
+ export const hintIconClassnames = {
5
+ iconWrapper: createUIKitClassname('hint-icon__icon-wrapper'),
6
+ };
3
7
  export const ICONS = {
4
8
  question: {
5
9
  fill: _jsx(QuestionFillMd, {}),
@@ -1 +1,3 @@
1
1
  export * from './HintIcon';
2
+ export type { HintIconProps } from './types';
3
+ export { hintIconClassnames } from './constants';
@@ -1 +1,2 @@
1
1
  export * from './HintIcon';
2
+ export { hintIconClassnames } from './constants';
@@ -3,9 +3,3 @@ export declare const DrawerContent: import("@emotion/styled").StyledComponent<{
3
3
  theme?: import("@emotion/react").Theme | undefined;
4
4
  as?: import("react").ElementType<any> | undefined;
5
5
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
6
- export declare const IconWrapper: import("@emotion/styled").StyledComponent<{
7
- theme?: import("@emotion/react").Theme | undefined;
8
- as?: import("react").ElementType<any> | undefined;
9
- } & {
10
- $color: string;
11
- }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -2,10 +2,3 @@ import { styled } from '../styles';
2
2
  export const DrawerContent = styled.div `
3
3
  padding: ${({ theme }) => theme.spacing(5, 4)};
4
4
  `;
5
- export const IconWrapper = styled('div', {
6
- shouldForwardProp: (prop) => !['$color'].includes(prop),
7
- }) `
8
- display: flex;
9
-
10
- color: ${({ $color }) => $color};
11
- `;
@@ -1 +1,39 @@
1
+ import { type ReactNode } from 'react';
1
2
  export type TooltipPlacement = 'left' | 'top' | 'right' | 'bottom';
3
+ export type HintIconProps = {
4
+ /**
5
+ * Определяет иконку отображения
6
+ */
7
+ variant: 'question' | 'info';
8
+ /**
9
+ * Опции для иконки
10
+ */
11
+ iconOption?: {
12
+ /**
13
+ * Определяет тип иконки
14
+ * @default fill
15
+ */
16
+ variant?: 'fill' | 'outline';
17
+ /**
18
+ * Определяет цвет иконки
19
+ * @default lightGrey
20
+ */
21
+ color?: 'warning' | 'grey' | 'lightGrey';
22
+ };
23
+ /**
24
+ * Текст заголовка BottomDrawer
25
+ */
26
+ title: string;
27
+ /**
28
+ * Текст тултипа или контента BottomDrawer
29
+ */
30
+ note: string;
31
+ /**
32
+ * Положение тултипа
33
+ */
34
+ tooltipPlacement?: TooltipPlacement;
35
+ /**
36
+ * Задание кастомной иконки
37
+ */
38
+ renderIcon?: () => ReactNode;
39
+ };
@@ -1,5 +1,6 @@
1
+ import { type SyntheticEvent } from 'react';
1
2
  export declare const useLogic: () => {
2
3
  open: boolean;
3
- handleOpen: () => void;
4
- handleClose: () => void;
4
+ handleOpen: (e: SyntheticEvent) => void;
5
+ handleClose: (e: SyntheticEvent) => void;
5
6
  };
@@ -3,12 +3,14 @@ import { useViewportType } from '../../hooks';
3
3
  export const useLogic = () => {
4
4
  const [open, setOpen] = useState(false);
5
5
  const { isMobile } = useViewportType();
6
- const handleOpen = () => {
6
+ const handleOpen = (e) => {
7
+ e.stopPropagation();
7
8
  if (isMobile) {
8
9
  setOpen((prevState) => !prevState);
9
10
  }
10
11
  };
11
- const handleClose = () => {
12
+ const handleClose = (e) => {
13
+ e.stopPropagation();
12
14
  if (isMobile) {
13
15
  setOpen(false);
14
16
  }
@@ -94,6 +94,7 @@ export { MinimalisticPagination, type MinimalisticPaginationProps, } from './Min
94
94
  export * from './NavMenu';
95
95
  export { type DataGridColumns, type DataGridRow, type DataGridRowOptions, type DataGridSort, DataGrid, type DataGridProps, } from './DataGrid';
96
96
  export { DataGridInfinite, type DataGridInfiniteProps, } from './DataGridInfinite';
97
+ export { DataGridColumnHintIcon, type DataGridColumnHintIconProps, } from './DataGridColumnHintIcon';
97
98
  export { type DateItemProps, type DateRangePickerProps, type DateRangePickerValue, DateRangePicker, } from './DateRangePicker';
98
99
  export { MenuOrganization, type MenuOrganizationProps, MenuOrganizationSkeleton, } from './MenuOrganization';
99
100
  export { NotFoundPage, type NotFoundPageProps, notFoundPageClassnames, } from './NotFoundPage';
@@ -94,6 +94,7 @@ export { MinimalisticPagination, } from './MinimalisticPagination';
94
94
  export * from './NavMenu';
95
95
  export { DataGrid, } from './DataGrid';
96
96
  export { DataGridInfinite, } from './DataGridInfinite';
97
+ export { DataGridColumnHintIcon, } from './DataGridColumnHintIcon';
97
98
  export { DateRangePicker, } from './DateRangePicker';
98
99
  export { MenuOrganization, MenuOrganizationSkeleton, } from './MenuOrganization';
99
100
  export { NotFoundPage, notFoundPageClassnames, } from './NotFoundPage';
@@ -12,13 +12,14 @@ const Head = (props) => {
12
12
  const { checkboxProps, handleSort } = (0, useLogic_1.useLogic)(props);
13
13
  const { columns, gridColumns, isSelectable, sorting, onSelectAllRows, isHideSelectAll, } = props;
14
14
  const renderColumns = (0, react_1.useMemo)(() => {
15
- return columns.map(({ field, label, sortable, align }, index) => {
15
+ return columns.map(({ field, label, sortable, align, columnHint }, index) => {
16
16
  const isFirstCell = !index;
17
17
  const startAdornmentRender = () => {
18
- if (isHideSelectAll || !isFirstCell || !isSelectable) {
18
+ const showCheckbox = isFirstCell && isSelectable && !isHideSelectAll;
19
+ if (!showCheckbox && !columnHint) {
19
20
  return null;
20
21
  }
21
- return ((0, jsx_runtime_1.jsx)(styles_1.CheckboxCell, { children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { ...checkboxProps, onChange: onSelectAllRows }) }));
22
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showCheckbox && ((0, jsx_runtime_1.jsx)(styles_1.CheckboxCell, { children: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { ...checkboxProps, onChange: onSelectAllRows }) })), columnHint] }));
22
23
  };
23
24
  return ((0, jsx_runtime_1.jsx)(HeadCell_1.HeadCell, { sorting: sorting, field: field, label: label, isSortable: sortable, align: align, startAdornment: startAdornmentRender(), onSort: handleSort }, label));
24
25
  });
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Wrapper = void 0;
4
+ const HintIcon_1 = require("../../HintIcon");
4
5
  const styles_1 = require("../../styles");
5
6
  const utils_1 = require("../utils");
6
7
  exports.Wrapper = (0, styles_1.styled)('div', {
@@ -23,4 +24,8 @@ exports.Wrapper = (0, styles_1.styled)('div', {
23
24
  width: 16px;
24
25
  height: 16px;
25
26
  }
27
+
28
+ .${HintIcon_1.hintIconClassnames.iconWrapper} {
29
+ margin-right: ${({ theme }) => theme.spacing(1)};
30
+ }
26
31
  `;
@@ -223,6 +223,10 @@ export type DataGridColumns<TData extends Record<string, CellValue>> = {
223
223
  * Скрывает содержимое столбца от инструментов мониторинга
224
224
  */
225
225
  isHidePersonalData?: boolean;
226
+ /**
227
+ * Принимает компонент DataGridColumnHintIcon - подсказка в шапке колонки
228
+ */
229
+ columnHint?: ReactNode;
226
230
  };
227
231
  export type DataGridRowOptionColumns<TData extends Record<string, CellValue>> = {
228
232
  /**
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { type HintIconProps } from '../HintIcon';
3
+ export type DataGridColumnHintIconProps = Omit<HintIconProps, 'renderIcon' | 'variant' | 'iconOption'>;
4
+ export declare const DataGridColumnHintIcon: (props: DataGridColumnHintIconProps) => JSX.Element;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataGridColumnHintIcon = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const icons_1 = require("../../icons");
6
+ const HintIcon_1 = require("../HintIcon");
7
+ const DataGridColumnHintIcon = (props) => {
8
+ return ((0, jsx_runtime_1.jsx)(HintIcon_1.HintIcon, { renderIcon: () => (0, jsx_runtime_1.jsx)(icons_1.InfoOutlineSm, {}), variant: "info", ...props }));
9
+ };
10
+ exports.DataGridColumnHintIcon = DataGridColumnHintIcon;
@@ -0,0 +1 @@
1
+ export * from './DataGridColumnHintIcon';
@@ -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("./DataGridColumnHintIcon"), exports);
@@ -1,36 +1,3 @@
1
1
  /// <reference types="react" />
2
- import { type TooltipPlacement } from './types';
3
- export type HintIconProps = {
4
- /**
5
- * Определяет иконку отображения
6
- */
7
- variant: 'question' | 'info';
8
- /**
9
- * Опции для иконки
10
- */
11
- iconOption?: {
12
- /**
13
- * Определяет тип иконки
14
- * @default fill
15
- */
16
- variant?: 'fill' | 'outline';
17
- /**
18
- * Определяет цвет иконки
19
- * @default lightGrey
20
- */
21
- color?: 'warning' | 'grey' | 'lightGrey';
22
- };
23
- /**
24
- * Текст заголовка BottomDrawer
25
- */
26
- title: string;
27
- /**
28
- * Текст тултипа или контента BottomDrawer
29
- */
30
- note: string;
31
- /**
32
- * Положение тултипа
33
- */
34
- tooltipPlacement?: TooltipPlacement;
35
- };
36
- export declare const HintIcon: ({ variant, title, note, iconOption, tooltipPlacement, }: HintIconProps) => JSX.Element;
2
+ import { type HintIconProps } from './types';
3
+ export declare const HintIcon: ({ variant, title, note, iconOption, tooltipPlacement, renderIcon, }: HintIconProps) => JSX.Element;
@@ -6,8 +6,8 @@ const BottomDrawer_1 = require("../BottomDrawer");
6
6
  const Icon_1 = require("./Icon");
7
7
  const styles_1 = require("./styles");
8
8
  const useLogic_1 = require("./useLogic");
9
- const HintIcon = ({ variant, title, note, iconOption, tooltipPlacement = 'bottom', }) => {
9
+ const HintIcon = ({ variant, title, note, iconOption, tooltipPlacement = 'bottom', renderIcon, }) => {
10
10
  const { handleClose, handleOpen, open } = (0, useLogic_1.useLogic)();
11
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Icon_1.Icon, { onClick: handleOpen, variant: variant, iconOption: iconOption, note: note, tooltipPlacement: tooltipPlacement }), (0, jsx_runtime_1.jsx)(BottomDrawer_1.BottomDrawer, { title: title, open: open, onClose: handleClose, children: (0, jsx_runtime_1.jsx)(styles_1.DrawerContent, { children: note }) })] }));
11
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Icon_1.Icon, { onClick: handleOpen, variant: variant, iconOption: iconOption, note: note, tooltipPlacement: tooltipPlacement, renderIcon: renderIcon }), (0, jsx_runtime_1.jsx)(BottomDrawer_1.BottomDrawer, { title: title, open: open, onClose: handleClose, children: (0, jsx_runtime_1.jsx)(styles_1.DrawerContent, { children: note }) })] }));
12
12
  };
13
13
  exports.HintIcon = HintIcon;
@@ -1,8 +1,7 @@
1
- /// <reference types="react" />
2
- import { type HintIconProps } from '../HintIcon';
3
- import type { TooltipPlacement } from '../types';
4
- export type IconProps = Pick<HintIconProps, 'variant' | 'iconOption' | 'note'> & {
5
- onClick: () => void;
1
+ import type { SyntheticEvent } from 'react';
2
+ import type { HintIconProps, TooltipPlacement } from '../types';
3
+ export type IconProps = Pick<HintIconProps, 'variant' | 'iconOption' | 'note' | 'renderIcon'> & {
4
+ onClick: (e: SyntheticEvent) => void;
6
5
  tooltipPlacement: TooltipPlacement;
7
6
  };
8
7
  export declare const Icon: (props: IconProps) => JSX.Element;
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Icon = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const Tooltip_1 = require("../../Tooltip");
6
+ const constants_1 = require("../constants");
6
7
  const styles_1 = require("./styles");
7
8
  const useLogic_1 = require("./useLogic");
8
9
  const Icon = (props) => {
9
10
  const { getIcon, iconColor } = (0, useLogic_1.useLogic)(props);
10
11
  const { onClick, note, tooltipPlacement } = props;
11
- return ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { title: note, placement: tooltipPlacement, children: (0, jsx_runtime_1.jsx)(styles_1.IconWrapper, { onClick: onClick, "$color": iconColor, children: getIcon() }) }));
12
+ return ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { title: note, placement: tooltipPlacement, children: (0, jsx_runtime_1.jsx)(styles_1.IconWrapper, { onClick: onClick, "$color": iconColor, className: constants_1.hintIconClassnames.iconWrapper, children: getIcon() }) }));
12
13
  };
13
14
  exports.Icon = Icon;
@@ -1,5 +1,7 @@
1
+ import { type ReactNode } from 'react';
1
2
  type UseIconColorParams = {
2
3
  color?: 'warning' | 'grey' | 'lightGrey';
4
+ renderIcon?: () => ReactNode;
3
5
  };
4
- export declare const useIconColor: ({ color }: UseIconColorParams) => string;
6
+ export declare const useIconColor: ({ color, renderIcon }: UseIconColorParams) => string;
5
7
  export {};
@@ -2,13 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useIconColor = void 0;
4
4
  const theme_1 = require("../../../../../theme");
5
- const useIconColor = ({ color }) => {
5
+ const useIconColor = ({ color, renderIcon }) => {
6
6
  const theme = (0, theme_1.useTheme)();
7
7
  const colorMap = {
8
8
  warning: theme.palette.yellow[800],
9
9
  grey: theme.palette.grey[800],
10
10
  lightGrey: theme.palette.grey[400],
11
11
  };
12
+ if (renderIcon) {
13
+ return 'currentColor';
14
+ }
12
15
  if (color) {
13
16
  return colorMap[color];
14
17
  }
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
1
+ import { type ReactNode } from 'react';
2
2
  import { type IconProps } from '../Icon';
3
3
  type UseLogicParams = IconProps;
4
- export declare const useLogic: ({ iconOption, variant }: UseLogicParams) => {
5
- getIcon: () => JSX.Element;
4
+ export declare const useLogic: ({ iconOption, variant, renderIcon, }: UseLogicParams) => {
5
+ getIcon: () => ReactNode;
6
6
  iconColor: string;
7
7
  };
8
8
  export {};
@@ -3,10 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useLogic = void 0;
4
4
  const constants_1 = require("../../constants");
5
5
  const hooks_1 = require("./hooks");
6
- const useLogic = ({ iconOption, variant }) => {
7
- const iconColor = (0, hooks_1.useIconColor)({ color: iconOption?.color });
6
+ const useLogic = ({ iconOption, variant, renderIcon, }) => {
7
+ const iconColor = (0, hooks_1.useIconColor)({ color: iconOption?.color, renderIcon });
8
8
  const { variant: iconOptionVariant = 'fill' } = iconOption || {};
9
9
  const getIcon = () => {
10
+ if (renderIcon) {
11
+ return renderIcon();
12
+ }
10
13
  const icon = constants_1.ICONS[variant][iconOptionVariant];
11
14
  if (icon) {
12
15
  return icon;
@@ -1,4 +1,7 @@
1
1
  /// <reference types="react" />
2
+ export declare const hintIconClassnames: {
3
+ iconWrapper: string;
4
+ };
2
5
  export declare const ICONS: {
3
6
  question: {
4
7
  fill: JSX.Element;
@@ -1,8 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ICONS = void 0;
3
+ exports.ICONS = exports.hintIconClassnames = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const icons_1 = require("../../icons");
6
+ const utils_1 = require("../utils");
7
+ exports.hintIconClassnames = {
8
+ iconWrapper: (0, utils_1.createUIKitClassname)('hint-icon__icon-wrapper'),
9
+ };
6
10
  exports.ICONS = {
7
11
  question: {
8
12
  fill: (0, jsx_runtime_1.jsx)(icons_1.QuestionFillMd, {}),
@@ -1 +1,3 @@
1
1
  export * from './HintIcon';
2
+ export type { HintIconProps } from './types';
3
+ export { hintIconClassnames } from './constants';
@@ -14,4 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.hintIconClassnames = void 0;
17
18
  __exportStar(require("./HintIcon"), exports);
19
+ var constants_1 = require("./constants");
20
+ Object.defineProperty(exports, "hintIconClassnames", { enumerable: true, get: function () { return constants_1.hintIconClassnames; } });
@@ -3,9 +3,3 @@ export declare const DrawerContent: import("@emotion/styled").StyledComponent<{
3
3
  theme?: import("@emotion/react").Theme | undefined;
4
4
  as?: import("react").ElementType<any> | undefined;
5
5
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
6
- export declare const IconWrapper: import("@emotion/styled").StyledComponent<{
7
- theme?: import("@emotion/react").Theme | undefined;
8
- as?: import("react").ElementType<any> | undefined;
9
- } & {
10
- $color: string;
11
- }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -1,14 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IconWrapper = exports.DrawerContent = void 0;
3
+ exports.DrawerContent = void 0;
4
4
  const styles_1 = require("../styles");
5
5
  exports.DrawerContent = styles_1.styled.div `
6
6
  padding: ${({ theme }) => theme.spacing(5, 4)};
7
7
  `;
8
- exports.IconWrapper = (0, styles_1.styled)('div', {
9
- shouldForwardProp: (prop) => !['$color'].includes(prop),
10
- }) `
11
- display: flex;
12
-
13
- color: ${({ $color }) => $color};
14
- `;
@@ -1 +1,39 @@
1
+ import { type ReactNode } from 'react';
1
2
  export type TooltipPlacement = 'left' | 'top' | 'right' | 'bottom';
3
+ export type HintIconProps = {
4
+ /**
5
+ * Определяет иконку отображения
6
+ */
7
+ variant: 'question' | 'info';
8
+ /**
9
+ * Опции для иконки
10
+ */
11
+ iconOption?: {
12
+ /**
13
+ * Определяет тип иконки
14
+ * @default fill
15
+ */
16
+ variant?: 'fill' | 'outline';
17
+ /**
18
+ * Определяет цвет иконки
19
+ * @default lightGrey
20
+ */
21
+ color?: 'warning' | 'grey' | 'lightGrey';
22
+ };
23
+ /**
24
+ * Текст заголовка BottomDrawer
25
+ */
26
+ title: string;
27
+ /**
28
+ * Текст тултипа или контента BottomDrawer
29
+ */
30
+ note: string;
31
+ /**
32
+ * Положение тултипа
33
+ */
34
+ tooltipPlacement?: TooltipPlacement;
35
+ /**
36
+ * Задание кастомной иконки
37
+ */
38
+ renderIcon?: () => ReactNode;
39
+ };
@@ -1,5 +1,6 @@
1
+ import { type SyntheticEvent } from 'react';
1
2
  export declare const useLogic: () => {
2
3
  open: boolean;
3
- handleOpen: () => void;
4
- handleClose: () => void;
4
+ handleOpen: (e: SyntheticEvent) => void;
5
+ handleClose: (e: SyntheticEvent) => void;
5
6
  };
@@ -6,12 +6,14 @@ const hooks_1 = require("../../hooks");
6
6
  const useLogic = () => {
7
7
  const [open, setOpen] = (0, react_1.useState)(false);
8
8
  const { isMobile } = (0, hooks_1.useViewportType)();
9
- const handleOpen = () => {
9
+ const handleOpen = (e) => {
10
+ e.stopPropagation();
10
11
  if (isMobile) {
11
12
  setOpen((prevState) => !prevState);
12
13
  }
13
14
  };
14
- const handleClose = () => {
15
+ const handleClose = (e) => {
16
+ e.stopPropagation();
15
17
  if (isMobile) {
16
18
  setOpen(false);
17
19
  }
@@ -94,6 +94,7 @@ export { MinimalisticPagination, type MinimalisticPaginationProps, } from './Min
94
94
  export * from './NavMenu';
95
95
  export { type DataGridColumns, type DataGridRow, type DataGridRowOptions, type DataGridSort, DataGrid, type DataGridProps, } from './DataGrid';
96
96
  export { DataGridInfinite, type DataGridInfiniteProps, } from './DataGridInfinite';
97
+ export { DataGridColumnHintIcon, type DataGridColumnHintIconProps, } from './DataGridColumnHintIcon';
97
98
  export { type DateItemProps, type DateRangePickerProps, type DateRangePickerValue, DateRangePicker, } from './DateRangePicker';
98
99
  export { MenuOrganization, type MenuOrganizationProps, MenuOrganizationSkeleton, } from './MenuOrganization';
99
100
  export { NotFoundPage, type NotFoundPageProps, notFoundPageClassnames, } from './NotFoundPage';
@@ -15,8 +15,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.useFileUploader = exports.PreviewFileUploaderFile = exports.PreviewFileUploaderDropZone = exports.PreviewFileUploader = exports.FileUploaderFile = exports.FileUploaderDropzone = exports.FileUploader = exports.Filename = exports.Fieldset = exports.Grow = exports.Slide = exports.Zoom = exports.Fade = exports.expansionPanelClassnames = exports.ExpansionPanel = exports.EmailOrPhoneField = exports.EmailField = exports.DescriptionList = exports.DescriptionCell = exports.datePickerClassnames = exports.DatePicker = exports.DataGridMinimalisticPagination = exports.DataGridActionCell = exports.SidebarContext = exports.SidebarSkeleton = exports.DashboardContext = exports.SidebarPopover = exports.SidebarCounter = exports.SidebarButton = exports.MenuSidebarButton = exports.DashboardLayout = exports.DashboardAlert = exports.Counter = exports.CopyTypography = exports.ConfirmAction = exports.ComplianceStatus = exports.CodeField = exports.BulletListItem = exports.BulletListInlineItem = exports.BulletList = exports.Breadcrumbs = exports.AvatarGroup = exports.Avatar = exports.AutoSaveIndicator = exports.AsyncAutocomplete = exports.Alert = exports.alertClassnames = exports.AddressAutocomplete = exports.useMainActions = exports.ActionGroup = void 0;
18
- exports.RadioField = exports.radioCardClassnames = exports.RadioCard = exports.Radio = exports.radioClassnames = exports.Placeholder = exports.LoadingPlaceholder = exports.useHidePersonalData = exports.PersonalData = exports.Pagination = exports.pageHeaderClassnames = exports.pageContentClassnames = exports.PagePinnableAside = exports.PageLayoutLoader = exports.PageLayoutFooter = exports.PageLayoutContainer = exports.PageLayout = exports.PageHeader = exports.PageContextProvider = exports.PageContext = exports.PageContentHeaderActions = exports.PageContentHeader = exports.PageContent = exports.PageAsideBlock = exports.PageAside = exports.PageAlert = exports.PageActions = exports.PageActionSkeleton = exports.NumberField = exports.NumberedListItem = exports.NumberedList = exports.notFoundPageClassnames = exports.NotFoundPage = exports.MenuOrganizationSkeleton = exports.MenuOrganization = exports.DateRangePicker = exports.DataGridInfinite = exports.DataGrid = exports.MinimalisticPagination = exports.loaderClassnames = exports.Loader = exports.Link = exports.InfiniteDataList = exports.InputGroup = exports.Iframe = exports.HintIcon = exports.GuidTypography = exports.previewFileUploaderClassnames = exports.fileUploaderClassnames = exports.usePreviewFileUploader = void 0;
19
- exports.WelcomeScreen = exports.redirectToLink = exports.createUIKitClassname = exports.classNames = exports.TreeLikeList = exports.TreeLikeAutocomplete = exports.TreeAutocomplete = exports.TreeList = exports.MultipleTreeList = exports.UNSTABLE_SecondsCountdownService = exports.svgIconClassnames = exports.SvgIcon = exports.StepSlider = exports.StepperWizard = exports.staticDaysCalendarClassnames = exports.StaticDaysCalendar = exports.Skeleton = exports.SearchField = exports.ScrollToTopButton = exports.RadioGroupContext = exports.RadioGroup = void 0;
18
+ exports.radioCardClassnames = exports.RadioCard = exports.Radio = exports.radioClassnames = exports.Placeholder = exports.LoadingPlaceholder = exports.useHidePersonalData = exports.PersonalData = exports.Pagination = exports.pageHeaderClassnames = exports.pageContentClassnames = exports.PagePinnableAside = exports.PageLayoutLoader = exports.PageLayoutFooter = exports.PageLayoutContainer = exports.PageLayout = exports.PageHeader = exports.PageContextProvider = exports.PageContext = exports.PageContentHeaderActions = exports.PageContentHeader = exports.PageContent = exports.PageAsideBlock = exports.PageAside = exports.PageAlert = exports.PageActions = exports.PageActionSkeleton = exports.NumberField = exports.NumberedListItem = exports.NumberedList = exports.notFoundPageClassnames = exports.NotFoundPage = exports.MenuOrganizationSkeleton = exports.MenuOrganization = exports.DateRangePicker = exports.DataGridColumnHintIcon = exports.DataGridInfinite = exports.DataGrid = exports.MinimalisticPagination = exports.loaderClassnames = exports.Loader = exports.Link = exports.InfiniteDataList = exports.InputGroup = exports.Iframe = exports.HintIcon = exports.GuidTypography = exports.previewFileUploaderClassnames = exports.fileUploaderClassnames = exports.usePreviewFileUploader = void 0;
19
+ exports.WelcomeScreen = exports.redirectToLink = exports.createUIKitClassname = exports.classNames = exports.TreeLikeList = exports.TreeLikeAutocomplete = exports.TreeAutocomplete = exports.TreeList = exports.MultipleTreeList = exports.UNSTABLE_SecondsCountdownService = exports.svgIconClassnames = exports.SvgIcon = exports.StepSlider = exports.StepperWizard = exports.staticDaysCalendarClassnames = exports.StaticDaysCalendar = exports.Skeleton = exports.SearchField = exports.ScrollToTopButton = exports.RadioGroupContext = exports.RadioGroup = exports.RadioField = void 0;
20
20
  __exportStar(require("./Accordion"), exports);
21
21
  var ActionGroup_1 = require("./ActionGroup");
22
22
  Object.defineProperty(exports, "ActionGroup", { enumerable: true, get: function () { return ActionGroup_1.ActionGroup; } });
@@ -177,6 +177,8 @@ var DataGrid_1 = require("./DataGrid");
177
177
  Object.defineProperty(exports, "DataGrid", { enumerable: true, get: function () { return DataGrid_1.DataGrid; } });
178
178
  var DataGridInfinite_1 = require("./DataGridInfinite");
179
179
  Object.defineProperty(exports, "DataGridInfinite", { enumerable: true, get: function () { return DataGridInfinite_1.DataGridInfinite; } });
180
+ var DataGridColumnHintIcon_1 = require("./DataGridColumnHintIcon");
181
+ Object.defineProperty(exports, "DataGridColumnHintIcon", { enumerable: true, get: function () { return DataGridColumnHintIcon_1.DataGridColumnHintIcon; } });
180
182
  var DateRangePicker_1 = require("./DateRangePicker");
181
183
  Object.defineProperty(exports, "DateRangePicker", { enumerable: true, get: function () { return DateRangePicker_1.DateRangePicker; } });
182
184
  var MenuOrganization_1 = require("./MenuOrganization");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "4.5.0",
3
+ "version": "4.6.0",
4
4
  "browser": "./index.js",
5
5
  "main": "./node/index.js",
6
6
  "dependencies": {