@pushwoosh/dumb-components 1.0.22 → 1.0.24
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/EnhancedInput/EnhancedInput.d.ts +3 -0
- package/EnhancedInput/EnhancedInput.js +20 -0
- package/EnhancedInput/SearchInput.d.ts +3 -0
- package/EnhancedInput/SearchInput.js +12 -0
- package/EnhancedInput/index.d.ts +2 -0
- package/EnhancedInput/index.js +2 -0
- package/EnhancedInput/styles.d.ts +5 -0
- package/EnhancedInput/styles.js +13 -0
- package/EnhancedInput/types.d.ts +7 -0
- package/SortButton/index.d.ts +1 -0
- package/Table/components/DataTableSearchInput/DataTableSearchInput.js +12 -3
- package/Table/index.d.ts +0 -1
- package/Table/index.js +0 -1
- package/index.d.ts +3 -2
- package/index.js +3 -2
- package/native/Input.d.ts +3 -2
- package/package.json +1 -1
- package/Table/components/ClearableInput/ClearableInput.d.ts +0 -3
- package/Table/components/ClearableInput/ClearableInput.js +0 -20
- package/Table/components/ClearableInput/index.d.ts +0 -1
- package/Table/components/ClearableInput/index.js +0 -1
- package/Table/components/ClearableInput/styles.d.ts +0 -14
- package/Table/components/ClearableInput/styles.js +0 -10
- package/Table/components/ClearableInput/types.d.ts +0 -5
- /package/{Table/components/ClearableInput → EnhancedInput}/types.js +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CloseIcon } from '@pushwoosh/kit-icons';
|
|
3
|
+
import { Wrapper } from './styles';
|
|
4
|
+
import { NativeInput } from '../native';
|
|
5
|
+
export const EnhancedInput = ({
|
|
6
|
+
$icon,
|
|
7
|
+
$onClear,
|
|
8
|
+
...props
|
|
9
|
+
}) => {
|
|
10
|
+
return React.createElement(Wrapper, {
|
|
11
|
+
"$hasIcon": !!$icon,
|
|
12
|
+
"$hasClear": !!$onClear,
|
|
13
|
+
"$hasError": !!props.$isErrored
|
|
14
|
+
}, $icon, React.createElement(NativeInput, {
|
|
15
|
+
...props
|
|
16
|
+
}), $onClear && React.createElement(CloseIcon, {
|
|
17
|
+
size: "small",
|
|
18
|
+
onClick: $onClear
|
|
19
|
+
}));
|
|
20
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SearchIcon } from '@pushwoosh/kit-icons';
|
|
3
|
+
import { EnhancedInput } from './EnhancedInput';
|
|
4
|
+
export const SearchInput = props => {
|
|
5
|
+
return React.createElement(EnhancedInput, {
|
|
6
|
+
...props,
|
|
7
|
+
"$icon": React.createElement(SearchIcon, {
|
|
8
|
+
size: "medium",
|
|
9
|
+
view: "lined"
|
|
10
|
+
})
|
|
11
|
+
});
|
|
12
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Color } from '@pushwoosh/kit-constants';
|
|
3
|
+
import { NativeInput } from '../native';
|
|
4
|
+
export const Wrapper = styled.div.withConfig({
|
|
5
|
+
displayName: "Wrapper",
|
|
6
|
+
componentId: "sc-5f7rba-0"
|
|
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, ({
|
|
8
|
+
$hasError
|
|
9
|
+
}) => $hasError ? Color.DANGER : Color.PHANTOM, NativeInput, Color.BRIGHT, NativeInput, Color.PHANTOM, Color.MAIN, NativeInput, ({
|
|
10
|
+
$hasIcon
|
|
11
|
+
}) => $hasIcon && 'padding-left: 36px;', ({
|
|
12
|
+
$hasClear
|
|
13
|
+
}) => $hasClear && `padding-right: 34px;`);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import type { NativeInputProps } from '../native/Input';
|
|
3
|
+
export type EnhancedInputProps = InputHTMLAttributes<HTMLInputElement> & NativeInputProps & {
|
|
4
|
+
$icon?: ReactNode;
|
|
5
|
+
$onClear?: () => void;
|
|
6
|
+
};
|
|
7
|
+
export type SearchInputProps = Omit<EnhancedInputProps, '$icon'>;
|
package/SortButton/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useRef, useState, useEffect, useContext } from 'react';
|
|
2
|
+
import { SearchInput } from '../../../EnhancedInput';
|
|
2
3
|
import { DataTableContext } from '../../context';
|
|
3
|
-
import { ClearableInput } from '../ClearableInput';
|
|
4
4
|
export function DataTableSearchInput(props) {
|
|
5
5
|
const context = useContext(DataTableContext);
|
|
6
6
|
const [inputValue, setInputValue] = useState(context.params.search);
|
|
@@ -10,10 +10,19 @@ export function DataTableSearchInput(props) {
|
|
|
10
10
|
setInputValue(context.params.search);
|
|
11
11
|
}
|
|
12
12
|
}, [context.params.search]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
13
|
-
return React.createElement(
|
|
13
|
+
return React.createElement(SearchInput, {
|
|
14
14
|
...props,
|
|
15
15
|
value: inputValue,
|
|
16
|
-
|
|
16
|
+
"$onClear": () => {
|
|
17
|
+
setInputValue('');
|
|
18
|
+
context.onChangeParams({
|
|
19
|
+
...context.params,
|
|
20
|
+
search: '',
|
|
21
|
+
page: 1
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
onChange: event => {
|
|
25
|
+
const value = event.target.value;
|
|
17
26
|
setInputValue(value);
|
|
18
27
|
if (timeoutRef.current) {
|
|
19
28
|
clearTimeout(timeoutRef.current);
|
package/Table/index.d.ts
CHANGED
package/Table/index.js
CHANGED
package/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export { Popover } from './Popover';
|
|
|
15
15
|
export { Radio } from './Radio';
|
|
16
16
|
export { ReCaptcha, useRecaptcha, asyncScriptLoad } from './ReCaptcha';
|
|
17
17
|
export { Spinner } from './Spinner';
|
|
18
|
-
export { SortButton } from './SortButton';
|
|
18
|
+
export { SortButton, type SortButtonParams } from './SortButton';
|
|
19
19
|
export { Select, SelectAsync, CreatableSelect, CLASS_NAME_PREFIX, type SelectBase, type MultiSelectOptions, } from './Select';
|
|
20
20
|
export { Switch } from './Switch';
|
|
21
21
|
export { TextSkeleton, RectangularSkeleton, CircularSkeleton } from './Skeleton';
|
|
@@ -26,9 +26,10 @@ export { StatisticCard } from './StatisticCard';
|
|
|
26
26
|
export { EmailTemplatePreview, NoEmailTemplatePreview } from './EmailTemplatePreview';
|
|
27
27
|
export { PushPreview } from './PushPreview';
|
|
28
28
|
export { Toast, ToastProvider, useToast } from './Toast';
|
|
29
|
-
export {
|
|
29
|
+
export { DataTable, DataTableList, DataTableGetContext, DataTablePagination, DataTableSearchInput, DataTableSortableCell, Loading, TableList, TablePagination, useDataTableContext, useDataTableGetParams, Table, Td, Tr, Th, ElementHover, ItemDetailLink, ItemName, LockedText, Description, type DataTableParams, type DataTableData, type DataTableContextType, } from './Table';
|
|
30
30
|
export { AutosizeInput, PageHeader, PageHeaderEditable } from './PageHeader';
|
|
31
31
|
export { ExportResult } from './ExportResult';
|
|
32
32
|
export { NativeInput, NativeTextarea, NativeSelect } from './native';
|
|
33
33
|
export { FieldBox } from './FieldBox';
|
|
34
34
|
export { NumberPicker } from './NumberPicker';
|
|
35
|
+
export { EnhancedInput, SearchInput } from './EnhancedInput';
|
package/index.js
CHANGED
|
@@ -26,9 +26,10 @@ export { StatisticCard } from './StatisticCard';
|
|
|
26
26
|
export { EmailTemplatePreview, NoEmailTemplatePreview } from './EmailTemplatePreview';
|
|
27
27
|
export { PushPreview } from './PushPreview';
|
|
28
28
|
export { Toast, ToastProvider, useToast } from './Toast';
|
|
29
|
-
export {
|
|
29
|
+
export { DataTable, DataTableList, DataTableGetContext, DataTablePagination, DataTableSearchInput, DataTableSortableCell, Loading, TableList, TablePagination, useDataTableContext, useDataTableGetParams, Table, Td, Tr, Th, ElementHover, ItemDetailLink, ItemName, LockedText, Description } from './Table';
|
|
30
30
|
export { AutosizeInput, PageHeader, PageHeaderEditable } from './PageHeader';
|
|
31
31
|
export { ExportResult } from './ExportResult';
|
|
32
32
|
export { NativeInput, NativeTextarea, NativeSelect } from './native';
|
|
33
33
|
export { FieldBox } from './FieldBox';
|
|
34
|
-
export { NumberPicker } from './NumberPicker';
|
|
34
|
+
export { NumberPicker } from './NumberPicker';
|
|
35
|
+
export { EnhancedInput, SearchInput } from './EnhancedInput';
|
package/native/Input.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type NativeInputProps = {
|
|
2
2
|
$isErrored?: boolean;
|
|
3
|
-
}
|
|
3
|
+
};
|
|
4
|
+
export declare const NativeInput: import("styled-components").StyledComponent<"input", any, NativeInputProps, never>;
|
package/package.json
CHANGED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { CloseIcon } from '@pushwoosh/kit-icons';
|
|
3
|
-
import { Wrapper, ClearButton } from './styles';
|
|
4
|
-
import { NativeInput } from '../../../native';
|
|
5
|
-
export function ClearableInput(props) {
|
|
6
|
-
const {
|
|
7
|
-
value,
|
|
8
|
-
placeholder,
|
|
9
|
-
onChange
|
|
10
|
-
} = props;
|
|
11
|
-
return React.createElement(Wrapper, null, React.createElement(NativeInput, {
|
|
12
|
-
value: value,
|
|
13
|
-
placeholder: placeholder,
|
|
14
|
-
onChange: e => onChange(e.target.value)
|
|
15
|
-
}), value && React.createElement(ClearButton, {
|
|
16
|
-
onClick: () => onChange('')
|
|
17
|
-
}, React.createElement(CloseIcon, {
|
|
18
|
-
size: "small"
|
|
19
|
-
})));
|
|
20
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ClearableInput } from './ClearableInput';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ClearableInput } from './ClearableInput';
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare const Wrapper: import("styled-components").StyledComponent<"div", any, {
|
|
2
|
-
$alignContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
|
|
3
|
-
$alignItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
|
|
4
|
-
$gap?: string | number | undefined;
|
|
5
|
-
$gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense" | undefined;
|
|
6
|
-
$justifyContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
|
|
7
|
-
$justifyItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
|
|
8
|
-
$margin?: string | number | undefined;
|
|
9
|
-
$padding?: string | number | undefined;
|
|
10
|
-
$placeItems?: "end" | "start" | "center" | "stretch" | undefined;
|
|
11
|
-
} & {
|
|
12
|
-
$gridAutoFlow: string;
|
|
13
|
-
}, "$gridAutoFlow">;
|
|
14
|
-
export declare const ClearButton: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
import { Horizontal } from '@pushwoosh/kit-helpers';
|
|
3
|
-
export const Wrapper = styled(Horizontal).withConfig({
|
|
4
|
-
displayName: "Wrapper",
|
|
5
|
-
componentId: "sc-1c8truw-0"
|
|
6
|
-
})(["position:relative;"]);
|
|
7
|
-
export const ClearButton = styled.div.withConfig({
|
|
8
|
-
displayName: "ClearButton",
|
|
9
|
-
componentId: "sc-1c8truw-1"
|
|
10
|
-
})(["position:absolute;right:8px;top:50%;transform:translateY(-50%);cursor:pointer;"]);
|
|
File without changes
|