@astral/ui 4.32.0 → 4.32.1

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.
@@ -39,6 +39,10 @@ export const StyledDivider = styled(Divider, {
39
39
 
40
40
  width: ${({ $isFullWidth, theme }) => $isFullWidth ? `calc(100% + ${theme.spacing(12)})` : '100%'};
41
41
 
42
+ ${({ theme }) => theme.breakpoints.down('laptop')} {
43
+ width: ${({ $isFullWidth, theme }) => ($isFullWidth ? `calc(100% + ${theme.spacing(10)})` : '100%')};
44
+ }
45
+
42
46
  ${({ theme }) => theme.breakpoints.down('sm')} {
43
47
  left: ${({ $isFullWidth, theme }) => $isFullWidth ? `${theme.spacing(-4)}` : '0'};
44
48
 
@@ -2,10 +2,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from 'react';
3
3
  import { CrossOutlineMd } from '../../icons/CrossOutlineMd';
4
4
  import { TextField } from '../TextField';
5
+ import { classNames } from '../utils/classNames';
6
+ import { searchFieldClassnames } from './constants';
5
7
  import { EndAdornmentWrapper, LoaderWrapper, SearchIcon, StyledIconButton, StyledLoader, TextFieldRoot, } from './styles';
6
8
  import { useLogic } from './useLogic';
7
9
  export const SearchField = forwardRef((props, ref) => {
8
10
  const { onChange, onClearValue, restProps, isLoading, inputRef, value, disabled, isClearButtonDisabled, onBlur, fullWidth, inputComponent, placeholder, hideHelperText, } = useLogic(props);
9
11
  const RenderComponent = inputComponent || TextField;
10
- return (_jsx(TextFieldRoot, { "$isFullWidth": fullWidth, children: _jsx(RenderComponent, { 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 }) }));
12
+ return (_jsx(TextFieldRoot, { "$isFullWidth": fullWidth, children: _jsx(RenderComponent, { type: "search", placeholder: placeholder, startAdornment: _jsx(SearchIcon, {}), disabled: disabled, hideHelperText: hideHelperText, endAdornment: _jsx(EndAdornmentWrapper, { className: classNames({
13
+ [searchFieldClassnames.endAdornmentVisible]: !isClearButtonDisabled,
14
+ }), 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
15
  });
@@ -0,0 +1,3 @@
1
+ export declare const searchFieldClassnames: {
2
+ endAdornmentVisible: string;
3
+ };
@@ -0,0 +1,4 @@
1
+ import { createUIKitClassname } from '../utils/createUIKitClassname';
2
+ export const searchFieldClassnames = {
3
+ endAdornmentVisible: createUIKitClassname('search-field__end-adornment_visible'),
4
+ };
@@ -2,6 +2,7 @@ import { SearchOutlineMd } from '../../icons/SearchOutlineMd';
2
2
  import { IconButton } from '../IconButton';
3
3
  import { Loader } from '../Loader';
4
4
  import { styled } from '../styled';
5
+ import { searchFieldClassnames } from './constants';
5
6
  export const SearchIcon = styled(SearchOutlineMd) `
6
7
  /* Задается чтобы клик по startAdornment приводил к клику в инпут */
7
8
  pointer-events: none;
@@ -32,8 +33,15 @@ export const LoaderWrapper = styled.div `
32
33
  height: 100%;
33
34
  `;
34
35
  export const EndAdornmentWrapper = styled.div `
36
+ /* Задается чтобы клик по endAdornment приводил к клику в инпут */
37
+ pointer-events: none;
38
+
35
39
  display: flex;
36
40
  align-items: center;
41
+
42
+ &.${searchFieldClassnames.endAdornmentVisible} {
43
+ pointer-events: unset;
44
+ }
37
45
  `;
38
46
  export const StyledLoader = styled(Loader) `
39
47
  width: 20px;
@@ -42,6 +42,10 @@ exports.StyledDivider = (0, styled_1.styled)(Divider_2.Divider, {
42
42
 
43
43
  width: ${({ $isFullWidth, theme }) => $isFullWidth ? `calc(100% + ${theme.spacing(12)})` : '100%'};
44
44
 
45
+ ${({ theme }) => theme.breakpoints.down('laptop')} {
46
+ width: ${({ $isFullWidth, theme }) => ($isFullWidth ? `calc(100% + ${theme.spacing(10)})` : '100%')};
47
+ }
48
+
45
49
  ${({ theme }) => theme.breakpoints.down('sm')} {
46
50
  left: ${({ $isFullWidth, theme }) => $isFullWidth ? `${theme.spacing(-4)}` : '0'};
47
51
 
@@ -5,10 +5,14 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const CrossOutlineMd_1 = require("../../icons/CrossOutlineMd");
7
7
  const TextField_1 = require("../TextField");
8
+ const classNames_1 = require("../utils/classNames");
9
+ const constants_1 = require("./constants");
8
10
  const styles_1 = require("./styles");
9
11
  const useLogic_1 = require("./useLogic");
10
12
  exports.SearchField = (0, react_1.forwardRef)((props, ref) => {
11
13
  const { onChange, onClearValue, restProps, isLoading, inputRef, value, disabled, isClearButtonDisabled, onBlur, fullWidth, inputComponent, placeholder, hideHelperText, } = (0, useLogic_1.useLogic)(props);
12
14
  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, { 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)(CrossOutlineMd_1.CrossOutlineMd, {}) })) }), onChange: onChange, value: value, ref: ref, inputRef: inputRef, trimmed: false, onBlur: onBlur, fullWidth: fullWidth, ...restProps }) }));
15
+ return ((0, jsx_runtime_1.jsx)(styles_1.TextFieldRoot, { "$isFullWidth": fullWidth, children: (0, jsx_runtime_1.jsx)(RenderComponent, { 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, { className: (0, classNames_1.classNames)({
16
+ [constants_1.searchFieldClassnames.endAdornmentVisible]: !isClearButtonDisabled,
17
+ }), 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)(CrossOutlineMd_1.CrossOutlineMd, {}) })) }), onChange: onChange, value: value, ref: ref, inputRef: inputRef, trimmed: false, onBlur: onBlur, fullWidth: fullWidth, ...restProps }) }));
14
18
  });
@@ -0,0 +1,3 @@
1
+ export declare const searchFieldClassnames: {
2
+ endAdornmentVisible: string;
3
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.searchFieldClassnames = void 0;
4
+ const createUIKitClassname_1 = require("../utils/createUIKitClassname");
5
+ exports.searchFieldClassnames = {
6
+ endAdornmentVisible: (0, createUIKitClassname_1.createUIKitClassname)('search-field__end-adornment_visible'),
7
+ };
@@ -5,6 +5,7 @@ const SearchOutlineMd_1 = require("../../icons/SearchOutlineMd");
5
5
  const IconButton_1 = require("../IconButton");
6
6
  const Loader_1 = require("../Loader");
7
7
  const styled_1 = require("../styled");
8
+ const constants_1 = require("./constants");
8
9
  exports.SearchIcon = (0, styled_1.styled)(SearchOutlineMd_1.SearchOutlineMd) `
9
10
  /* Задается чтобы клик по startAdornment приводил к клику в инпут */
10
11
  pointer-events: none;
@@ -35,8 +36,15 @@ exports.LoaderWrapper = styled_1.styled.div `
35
36
  height: 100%;
36
37
  `;
37
38
  exports.EndAdornmentWrapper = styled_1.styled.div `
39
+ /* Задается чтобы клик по endAdornment приводил к клику в инпут */
40
+ pointer-events: none;
41
+
38
42
  display: flex;
39
43
  align-items: center;
44
+
45
+ &.${constants_1.searchFieldClassnames.endAdornmentVisible} {
46
+ pointer-events: unset;
47
+ }
40
48
  `;
41
49
  exports.StyledLoader = (0, styled_1.styled)(Loader_1.Loader) `
42
50
  width: 20px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "4.32.0",
3
+ "version": "4.32.1",
4
4
  "browser": "./index.js",
5
5
  "main": "./node/index.js",
6
6
  "dependencies": {