@astral/ui 4.1.3 → 4.1.5

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.
@@ -1,4 +1,9 @@
1
1
  import type { ElementType } from 'react';
2
2
  import { type ButtonProps } from '../../Button';
3
- export type BannerActionButtonProps<TComponent extends ElementType = ElementType> = Omit<ButtonProps<TComponent>, 'size' | 'fullWidth'>;
3
+ export type BannerActionButtonProps<TComponent extends ElementType = 'button'> = Omit<ButtonProps<TComponent>, 'size' | 'fullWidth' | 'component'> & {
4
+ /**
5
+ * Тип html-элемента
6
+ */
7
+ component?: TComponent;
8
+ };
4
9
  export declare const BannerActionButton: <TComponent extends ElementType = "button">({ children, ...restProps }: BannerActionButtonProps<TComponent>) => JSX.Element;
@@ -15,8 +15,5 @@ import { useViewportType } from '../../hooks';
15
15
  export const BannerActionButton = (_a) => {
16
16
  var { children } = _a, restProps = __rest(_a, ["children"]);
17
17
  const { isMobile } = useViewportType();
18
- return (
19
- // biome-ignore lint/suspicious/noTsIgnore: Проблема c вложенностью типизации. Ts теряет типизацию при большой вложенности типов
20
- // @ts-ignore
21
- _jsx(Button, Object.assign({}, restProps, { fullWidth: isMobile, size: "large", children: children })));
18
+ return (_jsx(Button, Object.assign({}, restProps, { fullWidth: isMobile, size: "large", children: children })));
22
19
  };
@@ -5,7 +5,7 @@ import { TextField } from '../TextField';
5
5
  import { EndAdornmentWrapper, LoaderWrapper, SearchIcon, StyledIconButton, StyledLoader, TextFieldRoot, } from './styles';
6
6
  import { useLogic } from './useLogic';
7
7
  export const SearchField = forwardRef((props, ref) => {
8
- const { onChange, onClearValue, restProps, isLoading, inputRef, value, disabled, isClearButtonDisabled, onBlur, fullWidth, inputComponent, placeholder, } = useLogic(props);
8
+ const { onChange, onClearValue, restProps, isLoading, inputRef, value, disabled, isClearButtonDisabled, onBlur, fullWidth, inputComponent, placeholder, hideHelperText, } = useLogic(props);
9
9
  const RenderComponent = inputComponent || TextField;
10
- return (_jsx(TextFieldRoot, { "$isFullWidth": fullWidth, children: _jsx(RenderComponent, Object.assign({ type: "search", placeholder: placeholder, startAdornment: _jsx(SearchIcon, {}), disabled: disabled, endAdornment: _jsx(EndAdornmentWrapper, { children: isLoading ? (_jsx(LoaderWrapper, { children: _jsx(StyledLoader, {}) })) : (_jsx(StyledIconButton, { variant: "text", onClick: onClearValue, disabled: isClearButtonDisabled, "$isActive": !isClearButtonDisabled, children: _jsx(CrossOutlineMd, {}) })) }), onChange: onChange, value: value, ref: ref, inputRef: inputRef, trimmed: false, onBlur: onBlur, fullWidth: fullWidth }, restProps)) }));
10
+ return (_jsx(TextFieldRoot, { "$isFullWidth": fullWidth, children: _jsx(RenderComponent, Object.assign({ type: "search", placeholder: placeholder, startAdornment: _jsx(SearchIcon, {}), disabled: disabled, hideHelperText: hideHelperText, endAdornment: _jsx(EndAdornmentWrapper, { children: isLoading ? (_jsx(LoaderWrapper, { children: _jsx(StyledLoader, {}) })) : (_jsx(StyledIconButton, { variant: "text", onClick: onClearValue, disabled: isClearButtonDisabled, "$isActive": !isClearButtonDisabled, children: _jsx(CrossOutlineMd, {}) })) }), onChange: onChange, value: value, ref: ref, inputRef: inputRef, trimmed: false, onBlur: onBlur, fullWidth: fullWidth }, restProps)) }));
11
11
  });
@@ -16,11 +16,6 @@ export const StyledIconButton = styled(IconButton, {
16
16
  export const TextFieldRoot = styled.div `
17
17
  width: ${({ $isFullWidth }) => ($isFullWidth ? '100%' : 'auto')};
18
18
 
19
- & .MuiFormHelperText-root {
20
- /* TODO Убрать после реализации https://track.astral.ru/soft/browse/UIKIT-1333 */
21
- display: none;
22
- }
23
-
24
19
  /* @see https://stackoverflow.com/questions/9421551/how-do-i-remove-all-default-webkit-search-field-styling */
25
20
  input[type='search']::-webkit-search-decoration,
26
21
  input[type='search']::-webkit-search-cancel-button,
@@ -1,6 +1,6 @@
1
1
  import { type ChangeEvent, type FocusEvent } from 'react';
2
2
  import type { SearchFieldProps } from '../types';
3
- export declare const useLogic: ({ onChange: propsOnChange, defaultValue, value, inputRef: externalInputRef, disabled, onBlur: propsOnBlur, fullWidth, isLoading, placeholder, inputComponent, ...restProps }: SearchFieldProps) => {
3
+ export declare const useLogic: ({ onChange: propsOnChange, defaultValue, value, inputRef: externalInputRef, disabled, onBlur: propsOnBlur, fullWidth, isLoading, placeholder, inputComponent, hideHelperText, ...restProps }: SearchFieldProps) => {
4
4
  restProps: {
5
5
  label?: import("react").ReactNode;
6
6
  slot?: string | undefined;
@@ -277,7 +277,6 @@ export declare const useLogic: ({ onChange: propsOnChange, defaultValue, value,
277
277
  maxRows?: string | number | undefined;
278
278
  minRows?: string | number | undefined;
279
279
  hiddenLabel?: boolean | undefined;
280
- hideHelperText?: boolean | undefined;
281
280
  InputProps?: Partial<import("@mui/material").OutlinedInputProps> | Partial<import("@mui/material").FilledInputProps> | Partial<import("@mui/material").InputProps> | undefined;
282
281
  FormHelperTextProps?: Partial<import("@mui/material").FormHelperTextProps> | undefined;
283
282
  helperText?: import("react").ReactNode;
@@ -295,4 +294,5 @@ export declare const useLogic: ({ onChange: propsOnChange, defaultValue, value,
295
294
  disabled: boolean | undefined;
296
295
  isClearButtonDisabled: boolean;
297
296
  onBlur: (event: FocusEvent<HTMLInputElement>) => void;
297
+ hideHelperText: boolean;
298
298
  };
@@ -12,7 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import { useEffect, useState, } from 'react';
13
13
  import { useFirstMountState, useForwardedRef } from '../../hooks';
14
14
  export const useLogic = (_a) => {
15
- var { onChange: propsOnChange, defaultValue, value, inputRef: externalInputRef, disabled, onBlur: propsOnBlur, fullWidth, isLoading, placeholder = 'Поиск', inputComponent } = _a, restProps = __rest(_a, ["onChange", "defaultValue", "value", "inputRef", "disabled", "onBlur", "fullWidth", "isLoading", "placeholder", "inputComponent"]);
15
+ var { onChange: propsOnChange, defaultValue, value, inputRef: externalInputRef, disabled, onBlur: propsOnBlur, fullWidth, isLoading, placeholder = 'Поиск', inputComponent, hideHelperText = true } = _a, restProps = __rest(_a, ["onChange", "defaultValue", "value", "inputRef", "disabled", "onBlur", "fullWidth", "isLoading", "placeholder", "inputComponent", "hideHelperText"]);
16
16
  const inputRef = useForwardedRef(externalInputRef);
17
17
  const [internalValue, setInternalValue] = useState(defaultValue || value || '');
18
18
  const isFirstRender = useFirstMountState();
@@ -62,5 +62,6 @@ export const useLogic = (_a) => {
62
62
  disabled,
63
63
  isClearButtonDisabled,
64
64
  onBlur,
65
+ hideHelperText,
65
66
  };
66
67
  };
@@ -1,4 +1,9 @@
1
1
  import type { ElementType } from 'react';
2
2
  import { type ButtonProps } from '../../Button';
3
- export type BannerActionButtonProps<TComponent extends ElementType = ElementType> = Omit<ButtonProps<TComponent>, 'size' | 'fullWidth'>;
3
+ export type BannerActionButtonProps<TComponent extends ElementType = 'button'> = Omit<ButtonProps<TComponent>, 'size' | 'fullWidth' | 'component'> & {
4
+ /**
5
+ * Тип html-элемента
6
+ */
7
+ component?: TComponent;
8
+ };
4
9
  export declare const BannerActionButton: <TComponent extends ElementType = "button">({ children, ...restProps }: BannerActionButtonProps<TComponent>) => JSX.Element;
@@ -18,9 +18,6 @@ const hooks_1 = require("../../hooks");
18
18
  const BannerActionButton = (_a) => {
19
19
  var { children } = _a, restProps = __rest(_a, ["children"]);
20
20
  const { isMobile } = (0, hooks_1.useViewportType)();
21
- return (
22
- // biome-ignore lint/suspicious/noTsIgnore: Проблема c вложенностью типизации. Ts теряет типизацию при большой вложенности типов
23
- // @ts-ignore
24
- (0, jsx_runtime_1.jsx)(Button_1.Button, Object.assign({}, restProps, { fullWidth: isMobile, size: "large", children: children })));
21
+ return ((0, jsx_runtime_1.jsx)(Button_1.Button, Object.assign({}, restProps, { fullWidth: isMobile, size: "large", children: children })));
25
22
  };
26
23
  exports.BannerActionButton = BannerActionButton;
@@ -8,7 +8,7 @@ const TextField_1 = require("../TextField");
8
8
  const styles_1 = require("./styles");
9
9
  const useLogic_1 = require("./useLogic");
10
10
  exports.SearchField = (0, react_1.forwardRef)((props, ref) => {
11
- const { onChange, onClearValue, restProps, isLoading, inputRef, value, disabled, isClearButtonDisabled, onBlur, fullWidth, inputComponent, placeholder, } = (0, useLogic_1.useLogic)(props);
11
+ const { onChange, onClearValue, restProps, isLoading, inputRef, value, disabled, isClearButtonDisabled, onBlur, fullWidth, inputComponent, placeholder, hideHelperText, } = (0, useLogic_1.useLogic)(props);
12
12
  const RenderComponent = inputComponent || TextField_1.TextField;
13
- return ((0, jsx_runtime_1.jsx)(styles_1.TextFieldRoot, { "$isFullWidth": fullWidth, children: (0, jsx_runtime_1.jsx)(RenderComponent, Object.assign({ type: "search", placeholder: placeholder, startAdornment: (0, jsx_runtime_1.jsx)(styles_1.SearchIcon, {}), disabled: disabled, endAdornment: (0, jsx_runtime_1.jsx)(styles_1.EndAdornmentWrapper, { children: isLoading ? ((0, jsx_runtime_1.jsx)(styles_1.LoaderWrapper, { children: (0, jsx_runtime_1.jsx)(styles_1.StyledLoader, {}) })) : ((0, jsx_runtime_1.jsx)(styles_1.StyledIconButton, { variant: "text", onClick: onClearValue, disabled: isClearButtonDisabled, "$isActive": !isClearButtonDisabled, children: (0, jsx_runtime_1.jsx)(icons_1.CrossOutlineMd, {}) })) }), onChange: onChange, value: value, ref: ref, inputRef: inputRef, trimmed: false, onBlur: onBlur, fullWidth: fullWidth }, restProps)) }));
13
+ return ((0, jsx_runtime_1.jsx)(styles_1.TextFieldRoot, { "$isFullWidth": fullWidth, children: (0, jsx_runtime_1.jsx)(RenderComponent, Object.assign({ type: "search", placeholder: placeholder, startAdornment: (0, jsx_runtime_1.jsx)(styles_1.SearchIcon, {}), disabled: disabled, hideHelperText: hideHelperText, endAdornment: (0, jsx_runtime_1.jsx)(styles_1.EndAdornmentWrapper, { children: isLoading ? ((0, jsx_runtime_1.jsx)(styles_1.LoaderWrapper, { children: (0, jsx_runtime_1.jsx)(styles_1.StyledLoader, {}) })) : ((0, jsx_runtime_1.jsx)(styles_1.StyledIconButton, { variant: "text", onClick: onClearValue, disabled: isClearButtonDisabled, "$isActive": !isClearButtonDisabled, children: (0, jsx_runtime_1.jsx)(icons_1.CrossOutlineMd, {}) })) }), onChange: onChange, value: value, ref: ref, inputRef: inputRef, trimmed: false, onBlur: onBlur, fullWidth: fullWidth }, restProps)) }));
14
14
  });
@@ -19,11 +19,6 @@ exports.StyledIconButton = (0, styles_1.styled)(IconButton_1.IconButton, {
19
19
  exports.TextFieldRoot = styles_1.styled.div `
20
20
  width: ${({ $isFullWidth }) => ($isFullWidth ? '100%' : 'auto')};
21
21
 
22
- & .MuiFormHelperText-root {
23
- /* TODO Убрать после реализации https://track.astral.ru/soft/browse/UIKIT-1333 */
24
- display: none;
25
- }
26
-
27
22
  /* @see https://stackoverflow.com/questions/9421551/how-do-i-remove-all-default-webkit-search-field-styling */
28
23
  input[type='search']::-webkit-search-decoration,
29
24
  input[type='search']::-webkit-search-cancel-button,
@@ -1,6 +1,6 @@
1
1
  import { type ChangeEvent, type FocusEvent } from 'react';
2
2
  import type { SearchFieldProps } from '../types';
3
- export declare const useLogic: ({ onChange: propsOnChange, defaultValue, value, inputRef: externalInputRef, disabled, onBlur: propsOnBlur, fullWidth, isLoading, placeholder, inputComponent, ...restProps }: SearchFieldProps) => {
3
+ export declare const useLogic: ({ onChange: propsOnChange, defaultValue, value, inputRef: externalInputRef, disabled, onBlur: propsOnBlur, fullWidth, isLoading, placeholder, inputComponent, hideHelperText, ...restProps }: SearchFieldProps) => {
4
4
  restProps: {
5
5
  label?: import("react").ReactNode;
6
6
  slot?: string | undefined;
@@ -277,7 +277,6 @@ export declare const useLogic: ({ onChange: propsOnChange, defaultValue, value,
277
277
  maxRows?: string | number | undefined;
278
278
  minRows?: string | number | undefined;
279
279
  hiddenLabel?: boolean | undefined;
280
- hideHelperText?: boolean | undefined;
281
280
  InputProps?: Partial<import("@mui/material").OutlinedInputProps> | Partial<import("@mui/material").FilledInputProps> | Partial<import("@mui/material").InputProps> | undefined;
282
281
  FormHelperTextProps?: Partial<import("@mui/material").FormHelperTextProps> | undefined;
283
282
  helperText?: import("react").ReactNode;
@@ -295,4 +294,5 @@ export declare const useLogic: ({ onChange: propsOnChange, defaultValue, value,
295
294
  disabled: boolean | undefined;
296
295
  isClearButtonDisabled: boolean;
297
296
  onBlur: (event: FocusEvent<HTMLInputElement>) => void;
297
+ hideHelperText: boolean;
298
298
  };
@@ -15,7 +15,7 @@ exports.useLogic = void 0;
15
15
  const react_1 = require("react");
16
16
  const hooks_1 = require("../../hooks");
17
17
  const useLogic = (_a) => {
18
- var { onChange: propsOnChange, defaultValue, value, inputRef: externalInputRef, disabled, onBlur: propsOnBlur, fullWidth, isLoading, placeholder = 'Поиск', inputComponent } = _a, restProps = __rest(_a, ["onChange", "defaultValue", "value", "inputRef", "disabled", "onBlur", "fullWidth", "isLoading", "placeholder", "inputComponent"]);
18
+ var { onChange: propsOnChange, defaultValue, value, inputRef: externalInputRef, disabled, onBlur: propsOnBlur, fullWidth, isLoading, placeholder = 'Поиск', inputComponent, hideHelperText = true } = _a, restProps = __rest(_a, ["onChange", "defaultValue", "value", "inputRef", "disabled", "onBlur", "fullWidth", "isLoading", "placeholder", "inputComponent", "hideHelperText"]);
19
19
  const inputRef = (0, hooks_1.useForwardedRef)(externalInputRef);
20
20
  const [internalValue, setInternalValue] = (0, react_1.useState)(defaultValue || value || '');
21
21
  const isFirstRender = (0, hooks_1.useFirstMountState)();
@@ -65,6 +65,7 @@ const useLogic = (_a) => {
65
65
  disabled,
66
66
  isClearButtonDisabled,
67
67
  onBlur,
68
+ hideHelperText,
68
69
  };
69
70
  };
70
71
  exports.useLogic = useLogic;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "4.1.3",
3
+ "version": "4.1.5",
4
4
  "browser": "./index.js",
5
5
  "main": "./node/index.js",
6
6
  "dependencies": {