@pushwoosh/dumb-components 1.1.79 → 1.1.81
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.
- package/Calendar/CalendarDropdown/CalendarDropdown.js +5 -13
- package/Calendar/CalendarDropdown/styles.d.ts +1 -0
- package/Calendar/CalendarDropdown/styles.js +5 -1
- package/Calendar/CalendarDropdown/types.d.ts +1 -0
- package/Chip/styles.js +3 -1
- package/EnhancedInput/EnhancedInput.d.ts +1 -0
- package/EnhancedInput/EnhancedInput.js +5 -3
- package/EnhancedInput/styles.d.ts +10 -0
- package/EnhancedInput/styles.js +20 -5
- package/EnhancedInput/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { Color } from '@pushwoosh/kit-constants';
|
|
|
3
3
|
import { Horizontal, useClickAway, Vertical } from '@pushwoosh/kit-helpers';
|
|
4
4
|
import { CalendarIcon } from '@pushwoosh/kit-icons';
|
|
5
5
|
import { stringifyValue } from './helpers';
|
|
6
|
-
import { PopoverContent } from './styles';
|
|
6
|
+
import { PopoverContent, PresetsContainer } from './styles';
|
|
7
7
|
import { Button } from '../../Button';
|
|
8
8
|
import { Chip } from '../../Chip';
|
|
9
9
|
import { Popover } from '../../Popover';
|
|
@@ -15,7 +15,8 @@ export const CalendarDropdown = props => {
|
|
|
15
15
|
buttonColor = 'secondary',
|
|
16
16
|
buttonSize = 'field',
|
|
17
17
|
buttonTextCustom,
|
|
18
|
-
allowEmpty
|
|
18
|
+
allowEmpty,
|
|
19
|
+
buttonView
|
|
19
20
|
} = props;
|
|
20
21
|
const isRangePicker = mode === 'range-date' || mode === 'range-datetime';
|
|
21
22
|
const withTime = mode === 'single-datetime' || mode === 'range-datetime';
|
|
@@ -59,6 +60,7 @@ export const CalendarDropdown = props => {
|
|
|
59
60
|
}, React.createElement(Button, {
|
|
60
61
|
boxRef: buttonRef,
|
|
61
62
|
type: "button",
|
|
63
|
+
view: buttonView,
|
|
62
64
|
size: buttonSize,
|
|
63
65
|
color: buttonColor,
|
|
64
66
|
icon: React.createElement(CalendarIcon, {
|
|
@@ -77,17 +79,7 @@ export const CalendarDropdown = props => {
|
|
|
77
79
|
}, React.createElement(PopoverContent, {
|
|
78
80
|
"$isShaking": isShaking,
|
|
79
81
|
onAnimationEnd: () => setIsShaking(false)
|
|
80
|
-
}, React.createElement(Vertical, null, presets && presets.length > 0 && React.createElement(
|
|
81
|
-
"$padding": {
|
|
82
|
-
horizontal: 16,
|
|
83
|
-
vertical: 12
|
|
84
|
-
},
|
|
85
|
-
"$border": {
|
|
86
|
-
bottom: `1px solid ${Color.DIVIDER}`
|
|
87
|
-
},
|
|
88
|
-
"$justifyContent": "start",
|
|
89
|
-
"$gap": 4
|
|
90
|
-
}, presets.map((preset, i) => React.createElement(Chip, {
|
|
82
|
+
}, React.createElement(Vertical, null, presets && presets.length > 0 && React.createElement(PresetsContainer, null, presets.map((preset, i) => React.createElement(Chip, {
|
|
91
83
|
key: i,
|
|
92
84
|
onClick: () => onChangeHandler(preset.value)
|
|
93
85
|
}, preset.label))), React.createElement(Horizontal, {
|
|
@@ -6,4 +6,8 @@ export const PopoverContent = styled.div.withConfig({
|
|
|
6
6
|
componentId: "sc-h6jz87-0"
|
|
7
7
|
})(["overflow:hidden;box-shadow:", ";background:", ";", ""], Shadow.REGULAR, Color.CLEAR, ({
|
|
8
8
|
$isShaking
|
|
9
|
-
}) => $isShaking && css(["animation:", " 0.4s ease-in-out;"], shakeAnimation));
|
|
9
|
+
}) => $isShaking && css(["animation:", " 0.4s ease-in-out;"], shakeAnimation));
|
|
10
|
+
export const PresetsContainer = styled.div.withConfig({
|
|
11
|
+
displayName: "PresetsContainer",
|
|
12
|
+
componentId: "sc-h6jz87-1"
|
|
13
|
+
})(["display flex;flex-wrap:wrap;padding:12px 16px;border-bottom:1px solid ", ";justify-content:start;gap:4px;"], Color.DIVIDER);
|
|
@@ -5,6 +5,7 @@ import type { DateStruct, DateTimeStruct, RangeValue, TzValue } from '../types';
|
|
|
5
5
|
interface BaseProps {
|
|
6
6
|
buttonSize?: RequiredButtonProps['size'];
|
|
7
7
|
buttonColor?: RequiredButtonProps['color'];
|
|
8
|
+
buttonView?: RequiredButtonProps['view'];
|
|
8
9
|
buttonTextCustom?: string;
|
|
9
10
|
allowEmpty?: boolean;
|
|
10
11
|
}
|
package/Chip/styles.js
CHANGED
|
@@ -4,9 +4,11 @@ import { variants } from './Chip.constants';
|
|
|
4
4
|
export const ChipStyled = styled.div.withConfig({
|
|
5
5
|
displayName: "ChipStyled",
|
|
6
6
|
componentId: "sc-e2g39l-0"
|
|
7
|
-
})(["display:inline-flex;min-height:24px;padding:0 ", " 0 8px;align-items:center;gap:4px;cursor:
|
|
7
|
+
})(["display:inline-flex;min-height:24px;padding:0 ", " 0 8px;align-items:center;gap:4px;cursor:", ";border-radius:4px;color:", ";background:", ";font-weight:400;line-height:140%;& > .closeIcon{transition:transform 0.2s;&:hover{transform:scale(1.3);}}"], ({
|
|
8
8
|
$closeable
|
|
9
9
|
}) => $closeable ? '4px' : '8px', ({
|
|
10
|
+
$readOnly
|
|
11
|
+
}) => $readOnly ? 'default' : 'pointer', ({
|
|
10
12
|
$variant,
|
|
11
13
|
$selected,
|
|
12
14
|
$readOnly
|
|
@@ -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'>;
|