@astral/ui 4.9.0 → 4.11.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.
@@ -29,9 +29,7 @@ export declare const CheckboxField: import("react").ForwardRefExoticComponent<im
29
29
  checked?: boolean | undefined;
30
30
  indeterminate?: boolean | undefined;
31
31
  isError?: boolean | undefined;
32
- onChange?: ((event: import("react").ChangeEvent<HTMLInputElement>, checked: boolean) => void) | undefined; /**
33
- * Флаг принудительного скрытия блока helperText
34
- */
32
+ onChange?: ((event: import("react").ChangeEvent<HTMLInputElement>, checked: boolean) => void) | undefined;
35
33
  name?: string | undefined;
36
34
  value?: string | undefined;
37
35
  defaultChecked?: boolean | undefined;
@@ -3,11 +3,12 @@ import { forwardRef, useMemo } from 'react';
3
3
  import { Checkbox } from '../Checkbox';
4
4
  import { FormControl } from '../FormControl';
5
5
  import { Tooltip } from '../Tooltip';
6
+ import { checkboxFieldClassnames } from './constants';
6
7
  import { StyledFormControlledLabel, StyledFormHelperText } from './styles';
7
8
  /**
8
9
  * Составной компонент чекбокса. Содержит label, tooltip, helperText и т.д.
9
10
  */
10
11
  export const CheckboxField = forwardRef(({ isSuccess, helperText, hideHelperText = false, label, isError, ...restProps }, ref) => {
11
12
  const showTooltip = useMemo(() => Boolean(isError && hideHelperText), [isError, hideHelperText]);
12
- return (_jsxs(FormControl, { ref: ref, children: [_jsx(Tooltip, { title: showTooltip && helperText, placement: "bottom-start", withoutContainer: false, children: _jsx(StyledFormControlledLabel, { control: _jsx(Checkbox, { isError: isError, ...restProps }), label: label }) }), !hideHelperText && (_jsx(StyledFormHelperText, { error: isError, success: isSuccess, children: helperText }))] }));
13
+ return (_jsxs(FormControl, { ref: ref, children: [_jsx(Tooltip, { title: showTooltip && helperText, placement: "bottom-start", withoutContainer: false, children: _jsx(StyledFormControlledLabel, { classes: { label: checkboxFieldClassnames.label }, control: _jsx(Checkbox, { isError: isError, ...restProps }), label: label }) }), !hideHelperText && (_jsx(StyledFormHelperText, { error: isError, success: isSuccess, children: helperText }))] }));
13
14
  });
@@ -0,0 +1,3 @@
1
+ export declare const checkboxFieldClassnames: {
2
+ label: string;
3
+ };
@@ -0,0 +1,4 @@
1
+ import { createUIKitClassname } from '../utils';
2
+ export const checkboxFieldClassnames = {
3
+ label: createUIKitClassname('checkbox-field__label'),
4
+ };
@@ -1 +1,2 @@
1
1
  export * from './CheckboxField';
2
+ export { checkboxFieldClassnames } from './constants';
@@ -1 +1,2 @@
1
1
  export * from './CheckboxField';
2
+ export { checkboxFieldClassnames } from './constants';
@@ -1,11 +1,11 @@
1
- import { typographyClasses } from '@mui/material';
2
1
  import { FormControlLabel } from '../FormControlLabel';
3
2
  import { FormHelperText } from '../FormHelperText';
4
3
  import { styled } from '../styles';
4
+ import { checkboxFieldClassnames } from './constants';
5
5
  export const StyledFormControlledLabel = styled(FormControlLabel) `
6
6
  align-items: flex-start;
7
7
 
8
- .${typographyClasses.root} {
8
+ .${checkboxFieldClassnames.label} {
9
9
  margin-left: 0;
10
10
  padding-top: calc(${({ theme }) => theme.spacing(1)} + 2px);
11
11
 
@@ -13,5 +13,5 @@ export const HeaderContent = ({ backButton, description, subheader, breadcrumbs,
13
13
  }
14
14
  return (_jsx(BreadcrumbsWrapper, { children: Array.isArray(breadcrumbs) ? (_jsx(Breadcrumbs, { children: breadcrumbs })) : (breadcrumbs) }));
15
15
  };
16
- return (_jsxs(_Fragment, { children: [renderBreadcrumbs(), _jsx(DesktopTitleWrapper, { children: _jsx(Title, { backButton: backButton, title: title, isLoading: isLoading, hasDescription: Boolean(description), hasBreadcrumbs: Boolean(breadcrumbs) }) }), _jsx(Description, { description: description, isLoading: isLoading }), actions && (_jsx(PageActions, { className: classNames(pageHeaderClassnames.pageHeaderActions), isLoading: isLoading, size: "large", ...actions })), subheader && _jsx(PageSubheader, { children: subheader })] }));
16
+ return (_jsxs(_Fragment, { children: [renderBreadcrumbs(), _jsx(DesktopTitleWrapper, { children: _jsx(Title, { backButton: backButton, title: title, isLoading: isLoading, hasDescription: Boolean(description), hasBreadcrumbs: Boolean(breadcrumbs) }) }), _jsx(Description, { description: description, isLoading: isLoading }), actions && (_jsx(PageActions, { className: classNames(pageHeaderClassnames.pageHeaderActions), isLoading: isLoading, size: "medium", ...actions })), subheader && _jsx(PageSubheader, { children: subheader })] }));
17
17
  };
@@ -6,5 +6,5 @@ export const Title = ({ backButton, title, isLoading, hasDescription, hasBreadcr
6
6
  if (!title && isLoading) {
7
7
  return _jsx(StyledSkeleton, { height: 20, width: 280, variant: "rounded" });
8
8
  }
9
- return (_jsxs(_Fragment, { children: [backButton && (_jsx(BackButton, { ...backButton, variant: "outlined", color: "grey", size: "large", children: _jsx(ArrowLOutlineMd, {}) })), typeof title === 'string' ? (_jsx(TitleWrapper, { component: "h1", variant: "h3", "$hasDescription": hasDescription, "$hasBreadcrumbs": hasBreadcrumbs, children: _jsx(OverflowTypography, { component: "div", variant: "inherit", children: title }) })) : (_jsx(TitleWrapper, { component: "div", role: "heading", variant: "h3", "aria-level": 1, "$hasDescription": hasDescription, "$hasBreadcrumbs": hasBreadcrumbs, children: title }))] }));
9
+ return (_jsxs(_Fragment, { children: [backButton && (_jsx(BackButton, { ...backButton, variant: "outlined", color: "grey", size: "medium", children: _jsx(ArrowLOutlineMd, {}) })), typeof title === 'string' ? (_jsx(TitleWrapper, { component: "h1", variant: "h3", "$hasDescription": hasDescription, "$hasBreadcrumbs": hasBreadcrumbs, children: _jsx(OverflowTypography, { component: "div", variant: "inherit", children: title }) })) : (_jsx(TitleWrapper, { component: "div", role: "heading", variant: "h3", "aria-level": 1, "$hasDescription": hasDescription, "$hasBreadcrumbs": hasBreadcrumbs, children: title }))] }));
10
10
  };
@@ -23,6 +23,8 @@ export const TitleWrapper = styled(Typography, {
23
23
  align-self: center;
24
24
 
25
25
  margin-right: ${({ theme }) => theme.spacing(3)};
26
+
27
+ line-height: ${({ theme }) => theme.typography.h2.lineHeight};
26
28
 
27
29
  ${({ theme }) => theme.breakpoints.down('sm')} {
28
30
  font-size: ${({ theme }) => theme.typography.h5.fontSize};
@@ -11,6 +11,6 @@ export const StyledTextField = styled(TextField) `
11
11
  &:not(:empty) {
12
12
  margin: ${({ theme }) => theme.spacing(1, 0, 0)};
13
13
  }
14
- }
14
+ }
15
15
  }
16
16
  `;
@@ -46,6 +46,9 @@ export const MuiOutlinedInput = {
46
46
  paddingLeft: isStartAdornmentString
47
47
  ? theme.spacing(1)
48
48
  : theme.spacing(3),
49
+ '&:autofill': {
50
+ boxShadow: '0 0 0 1000px white inset',
51
+ },
49
52
  '&::placeholder': {
50
53
  opacity: 1,
51
54
  color: theme.palette.grey[400],
@@ -29,9 +29,7 @@ export declare const CheckboxField: import("react").ForwardRefExoticComponent<im
29
29
  checked?: boolean | undefined;
30
30
  indeterminate?: boolean | undefined;
31
31
  isError?: boolean | undefined;
32
- onChange?: ((event: import("react").ChangeEvent<HTMLInputElement>, checked: boolean) => void) | undefined; /**
33
- * Флаг принудительного скрытия блока helperText
34
- */
32
+ onChange?: ((event: import("react").ChangeEvent<HTMLInputElement>, checked: boolean) => void) | undefined;
35
33
  name?: string | undefined;
36
34
  value?: string | undefined;
37
35
  defaultChecked?: boolean | undefined;
@@ -6,11 +6,12 @@ const react_1 = require("react");
6
6
  const Checkbox_1 = require("../Checkbox");
7
7
  const FormControl_1 = require("../FormControl");
8
8
  const Tooltip_1 = require("../Tooltip");
9
+ const constants_1 = require("./constants");
9
10
  const styles_1 = require("./styles");
10
11
  /**
11
12
  * Составной компонент чекбокса. Содержит label, tooltip, helperText и т.д.
12
13
  */
13
14
  exports.CheckboxField = (0, react_1.forwardRef)(({ isSuccess, helperText, hideHelperText = false, label, isError, ...restProps }, ref) => {
14
15
  const showTooltip = (0, react_1.useMemo)(() => Boolean(isError && hideHelperText), [isError, hideHelperText]);
15
- return ((0, jsx_runtime_1.jsxs)(FormControl_1.FormControl, { ref: ref, children: [(0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { title: showTooltip && helperText, placement: "bottom-start", withoutContainer: false, children: (0, jsx_runtime_1.jsx)(styles_1.StyledFormControlledLabel, { control: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { isError: isError, ...restProps }), label: label }) }), !hideHelperText && ((0, jsx_runtime_1.jsx)(styles_1.StyledFormHelperText, { error: isError, success: isSuccess, children: helperText }))] }));
16
+ return ((0, jsx_runtime_1.jsxs)(FormControl_1.FormControl, { ref: ref, children: [(0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { title: showTooltip && helperText, placement: "bottom-start", withoutContainer: false, children: (0, jsx_runtime_1.jsx)(styles_1.StyledFormControlledLabel, { classes: { label: constants_1.checkboxFieldClassnames.label }, control: (0, jsx_runtime_1.jsx)(Checkbox_1.Checkbox, { isError: isError, ...restProps }), label: label }) }), !hideHelperText && ((0, jsx_runtime_1.jsx)(styles_1.StyledFormHelperText, { error: isError, success: isSuccess, children: helperText }))] }));
16
17
  });
@@ -0,0 +1,3 @@
1
+ export declare const checkboxFieldClassnames: {
2
+ label: string;
3
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkboxFieldClassnames = void 0;
4
+ const utils_1 = require("../utils");
5
+ exports.checkboxFieldClassnames = {
6
+ label: (0, utils_1.createUIKitClassname)('checkbox-field__label'),
7
+ };
@@ -1 +1,2 @@
1
1
  export * from './CheckboxField';
2
+ export { checkboxFieldClassnames } 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.checkboxFieldClassnames = void 0;
17
18
  __exportStar(require("./CheckboxField"), exports);
19
+ var constants_1 = require("./constants");
20
+ Object.defineProperty(exports, "checkboxFieldClassnames", { enumerable: true, get: function () { return constants_1.checkboxFieldClassnames; } });
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StyledFormHelperText = exports.StyledFormControlledLabel = void 0;
4
- const material_1 = require("@mui/material");
5
4
  const FormControlLabel_1 = require("../FormControlLabel");
6
5
  const FormHelperText_1 = require("../FormHelperText");
7
6
  const styles_1 = require("../styles");
7
+ const constants_1 = require("./constants");
8
8
  exports.StyledFormControlledLabel = (0, styles_1.styled)(FormControlLabel_1.FormControlLabel) `
9
9
  align-items: flex-start;
10
10
 
11
- .${material_1.typographyClasses.root} {
11
+ .${constants_1.checkboxFieldClassnames.label} {
12
12
  margin-left: 0;
13
13
  padding-top: calc(${({ theme }) => theme.spacing(1)} + 2px);
14
14
 
@@ -16,6 +16,6 @@ const HeaderContent = ({ backButton, description, subheader, breadcrumbs, action
16
16
  }
17
17
  return ((0, jsx_runtime_1.jsx)(styles_1.BreadcrumbsWrapper, { children: Array.isArray(breadcrumbs) ? ((0, jsx_runtime_1.jsx)(Breadcrumbs_1.Breadcrumbs, { children: breadcrumbs })) : (breadcrumbs) }));
18
18
  };
19
- 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, utils_1.classNames)(constants_1.pageHeaderClassnames.pageHeaderActions), isLoading: isLoading, size: "large", ...actions })), subheader && (0, jsx_runtime_1.jsx)(styles_1.PageSubheader, { children: subheader })] }));
19
+ 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, utils_1.classNames)(constants_1.pageHeaderClassnames.pageHeaderActions), isLoading: isLoading, size: "medium", ...actions })), subheader && (0, jsx_runtime_1.jsx)(styles_1.PageSubheader, { children: subheader })] }));
20
20
  };
21
21
  exports.HeaderContent = HeaderContent;
@@ -9,6 +9,6 @@ const Title = ({ backButton, title, isLoading, hasDescription, hasBreadcrumbs, }
9
9
  if (!title && isLoading) {
10
10
  return (0, jsx_runtime_1.jsx)(styles_1.StyledSkeleton, { height: 20, width: 280, variant: "rounded" });
11
11
  }
12
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [backButton && ((0, jsx_runtime_1.jsx)(styles_1.BackButton, { ...backButton, variant: "outlined", color: "grey", size: "large", children: (0, jsx_runtime_1.jsx)(icons_1.ArrowLOutlineMd, {}) })), typeof title === 'string' ? ((0, jsx_runtime_1.jsx)(styles_1.TitleWrapper, { component: "h1", variant: "h3", "$hasDescription": hasDescription, "$hasBreadcrumbs": hasBreadcrumbs, children: (0, jsx_runtime_1.jsx)(OverflowTypography_1.OverflowTypography, { component: "div", variant: "inherit", children: title }) })) : ((0, jsx_runtime_1.jsx)(styles_1.TitleWrapper, { component: "div", role: "heading", variant: "h3", "aria-level": 1, "$hasDescription": hasDescription, "$hasBreadcrumbs": hasBreadcrumbs, children: title }))] }));
12
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [backButton && ((0, jsx_runtime_1.jsx)(styles_1.BackButton, { ...backButton, variant: "outlined", color: "grey", size: "medium", children: (0, jsx_runtime_1.jsx)(icons_1.ArrowLOutlineMd, {}) })), typeof title === 'string' ? ((0, jsx_runtime_1.jsx)(styles_1.TitleWrapper, { component: "h1", variant: "h3", "$hasDescription": hasDescription, "$hasBreadcrumbs": hasBreadcrumbs, children: (0, jsx_runtime_1.jsx)(OverflowTypography_1.OverflowTypography, { component: "div", variant: "inherit", children: title }) })) : ((0, jsx_runtime_1.jsx)(styles_1.TitleWrapper, { component: "div", role: "heading", variant: "h3", "aria-level": 1, "$hasDescription": hasDescription, "$hasBreadcrumbs": hasBreadcrumbs, children: title }))] }));
13
13
  };
14
14
  exports.Title = Title;
@@ -26,6 +26,8 @@ exports.TitleWrapper = (0, styles_1.styled)(Typography_1.Typography, {
26
26
  align-self: center;
27
27
 
28
28
  margin-right: ${({ theme }) => theme.spacing(3)};
29
+
30
+ line-height: ${({ theme }) => theme.typography.h2.lineHeight};
29
31
 
30
32
  ${({ theme }) => theme.breakpoints.down('sm')} {
31
33
  font-size: ${({ theme }) => theme.typography.h5.fontSize};
@@ -14,6 +14,6 @@ exports.StyledTextField = (0, styles_1.styled)(material_1.TextField) `
14
14
  &:not(:empty) {
15
15
  margin: ${({ theme }) => theme.spacing(1, 0, 0)};
16
16
  }
17
- }
17
+ }
18
18
  }
19
19
  `;
@@ -49,6 +49,9 @@ exports.MuiOutlinedInput = {
49
49
  paddingLeft: isStartAdornmentString
50
50
  ? theme.spacing(1)
51
51
  : theme.spacing(3),
52
+ '&:autofill': {
53
+ boxShadow: '0 0 0 1000px white inset',
54
+ },
52
55
  '&::placeholder': {
53
56
  opacity: 1,
54
57
  color: theme.palette.grey[400],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "4.9.0",
3
+ "version": "4.11.0",
4
4
  "browser": "./index.js",
5
5
  "main": "./node/index.js",
6
6
  "dependencies": {