@pushwoosh/dumb-components 1.1.79 → 1.1.80
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.
|
@@ -2,4 +2,5 @@ import React from 'react';
|
|
|
2
2
|
export declare const EnhancedInput: React.ForwardRefExoticComponent<React.InputHTMLAttributes<HTMLInputElement> & import("../native/Input").NativeInputProps & {
|
|
3
3
|
$icon?: React.ReactNode;
|
|
4
4
|
$onClear?: () => void;
|
|
5
|
+
hint?: string;
|
|
5
6
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import { CloseIcon } from '@pushwoosh/kit-icons';
|
|
3
|
-
import { Wrapper } from './styles';
|
|
3
|
+
import { Wrapper, RightSlot } from './styles';
|
|
4
4
|
import { NativeInput } from '../native';
|
|
5
5
|
export const EnhancedInput = forwardRef(({
|
|
6
6
|
$icon,
|
|
7
7
|
$onClear,
|
|
8
|
+
hint,
|
|
8
9
|
...props
|
|
9
10
|
}, ref) => {
|
|
10
11
|
return React.createElement(Wrapper, {
|
|
11
12
|
"$hasIcon": !!$icon,
|
|
12
13
|
"$hasClear": !!$onClear,
|
|
13
|
-
"$hasError": !!props.$isErrored
|
|
14
|
+
"$hasError": !!props.$isErrored,
|
|
15
|
+
"$hasHint": !!hint
|
|
14
16
|
}, $icon, React.createElement(NativeInput, {
|
|
15
17
|
...props,
|
|
16
18
|
ref: ref
|
|
17
|
-
}), $onClear && React.createElement(CloseIcon, {
|
|
19
|
+
}), hint && React.createElement(RightSlot, null, hint), $onClear && React.createElement(CloseIcon, {
|
|
18
20
|
size: "small",
|
|
19
21
|
onClick: $onClear
|
|
20
22
|
}));
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
+
import { Color } from '@pushwoosh/kit-constants';
|
|
2
|
+
export declare const RightSlot: import("styled-components").StyledComponent<"span", any, {
|
|
3
|
+
$color?: string | undefined;
|
|
4
|
+
$uppercase?: boolean | undefined;
|
|
5
|
+
$ellipsis?: boolean | undefined;
|
|
6
|
+
$variant?: import("@pushwoosh/kit-typography").TypographyVariant | undefined;
|
|
7
|
+
} & {
|
|
8
|
+
$color: Color;
|
|
9
|
+
}, "$color">;
|
|
1
10
|
export declare const Wrapper: import("styled-components").StyledComponent<"div", any, {
|
|
2
11
|
$hasIcon?: boolean;
|
|
3
12
|
$hasClear?: boolean;
|
|
4
13
|
$hasError?: boolean;
|
|
14
|
+
$hasHint?: boolean;
|
|
5
15
|
}, never>;
|
package/EnhancedInput/styles.js
CHANGED
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
import { Color } from '@pushwoosh/kit-constants';
|
|
3
|
+
import { Text } from '@pushwoosh/kit-typography';
|
|
3
4
|
import { NativeInput } from '../native';
|
|
5
|
+
export const RightSlot = styled(Text).attrs({
|
|
6
|
+
$color: Color.PHANTOM
|
|
7
|
+
}).withConfig({
|
|
8
|
+
displayName: "RightSlot",
|
|
9
|
+
componentId: "sc-5f7rba-0"
|
|
10
|
+
})(["pointer-events:none;"]);
|
|
4
11
|
export const Wrapper = styled.div.withConfig({
|
|
5
12
|
displayName: "Wrapper",
|
|
6
|
-
componentId: "sc-5f7rba-
|
|
7
|
-
})(["display:inline-grid;position:relative;& > :not(", "){position:absolute;top:50%;transform:translateY(-50%);}& > :not(", "):first-child{left:6px;color:", ";}&:focus-within > :not(", "):first-child{color:", ";}& > :not(", "):last-child{right:12px;cursor:pointer;color:", ";transition:transform 0.3s ease,color 0.3s ease;&:hover{transform:translateY(-50%) scale(1.2);color:", ";}}& > ", "{width:100%;", " ", "}"], NativeInput, NativeInput, ({
|
|
13
|
+
componentId: "sc-5f7rba-1"
|
|
14
|
+
})(["display:inline-grid;position:relative;& > :not(", "){position:absolute;top:50%;transform:translateY(-50%);}& > :not(", "):not(", "):first-child{left:6px;color:", ";}&:focus-within > :not(", "):not(", "):first-child{color:", ";}& > :not(", "):not(", "):last-child{right:12px;cursor:pointer;color:", ";transition:transform 0.3s ease,color 0.3s ease;&:hover{transform:translateY(-50%) scale(1.2);color:", ";}}& > ", "{right:", ";}& > ", "{width:100%;", " padding-right:", ";}"], NativeInput, NativeInput, RightSlot, ({
|
|
8
15
|
$hasError
|
|
9
|
-
}) => $hasError ? Color.DANGER : Color.PHANTOM, NativeInput, Color.BRIGHT, NativeInput, Color.PHANTOM, Color.MAIN,
|
|
16
|
+
}) => $hasError ? Color.DANGER : Color.PHANTOM, NativeInput, RightSlot, Color.BRIGHT, NativeInput, RightSlot, Color.PHANTOM, Color.MAIN, RightSlot, ({
|
|
17
|
+
$hasClear
|
|
18
|
+
}) => $hasClear ? '36px' : '12px', NativeInput, ({
|
|
10
19
|
$hasIcon
|
|
11
20
|
}) => $hasIcon && 'padding-left: 36px;', ({
|
|
12
|
-
$hasClear
|
|
13
|
-
|
|
21
|
+
$hasClear,
|
|
22
|
+
$hasHint: $hasRightSlot
|
|
23
|
+
}) => {
|
|
24
|
+
if ($hasClear && $hasRightSlot) return '125px';
|
|
25
|
+
if ($hasClear) return '34px';
|
|
26
|
+
if ($hasRightSlot) return '100px';
|
|
27
|
+
return '12px';
|
|
28
|
+
});
|
package/EnhancedInput/types.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ import type { NativeInputProps } from '../native/Input';
|
|
|
3
3
|
export type EnhancedInputProps = InputHTMLAttributes<HTMLInputElement> & NativeInputProps & {
|
|
4
4
|
$icon?: ReactNode;
|
|
5
5
|
$onClear?: () => void;
|
|
6
|
+
hint?: string;
|
|
6
7
|
};
|
|
7
8
|
export type SearchInputProps = Omit<EnhancedInputProps, '$icon'>;
|