@pushwoosh/dumb-components 1.0.32 → 1.0.33
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/Select/Select.d.ts +1 -1
- package/Select/Select.js +13 -1
- package/Select/styles.d.ts +1 -0
- package/Select/styles.js +8 -4
- package/package.json +1 -1
package/Select/Select.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { GroupBase } from 'react-select';
|
|
3
3
|
import type { SelectProps, SelectAsyncProps, SelectCreatableProps } from './types';
|
|
4
4
|
export declare function Select<Option, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>(props: SelectProps<Option, IsMulti, Group>): ReactElement;
|
|
5
5
|
export declare function SelectAsync<Option, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>(props: SelectAsyncProps<Option, IsMulti, Group>): ReactElement;
|
package/Select/Select.js
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { CloseIcon } from '@pushwoosh/kit-icons';
|
|
2
3
|
import { CLASS_NAME_PREFIX } from './constants';
|
|
3
|
-
import { SelectStyled, SelectAsyncStyled, SelectCreatableStyled } from './styles';
|
|
4
|
+
import { SelectStyled, SelectAsyncStyled, SelectCreatableStyled, ClearIndicatorBox } from './styles';
|
|
5
|
+
const componentsProps = {
|
|
6
|
+
ClearIndicator: ({
|
|
7
|
+
clearValue
|
|
8
|
+
}) => React.createElement(ClearIndicatorBox, null, React.createElement(CloseIcon, {
|
|
9
|
+
size: "small",
|
|
10
|
+
onClick: clearValue
|
|
11
|
+
}))
|
|
12
|
+
};
|
|
4
13
|
export function Select(props) {
|
|
5
14
|
const {
|
|
6
15
|
classNamePrefix = CLASS_NAME_PREFIX
|
|
@@ -10,6 +19,7 @@ export function Select(props) {
|
|
|
10
19
|
classNamePrefix
|
|
11
20
|
};
|
|
12
21
|
return React.createElement(SelectStyled, {
|
|
22
|
+
components: componentsProps,
|
|
13
23
|
...customProps
|
|
14
24
|
});
|
|
15
25
|
}
|
|
@@ -22,6 +32,7 @@ export function SelectAsync(props) {
|
|
|
22
32
|
classNamePrefix
|
|
23
33
|
};
|
|
24
34
|
return React.createElement(SelectAsyncStyled, {
|
|
35
|
+
components: componentsProps,
|
|
25
36
|
...customProps
|
|
26
37
|
});
|
|
27
38
|
}
|
|
@@ -34,6 +45,7 @@ export function CreatableSelect(props) {
|
|
|
34
45
|
classNamePrefix
|
|
35
46
|
};
|
|
36
47
|
return React.createElement(SelectCreatableStyled, {
|
|
48
|
+
components: componentsProps,
|
|
37
49
|
...customProps
|
|
38
50
|
});
|
|
39
51
|
}
|
package/Select/styles.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ import ReactSelectCreatable from 'react-select/creatable';
|
|
|
4
4
|
export declare const SelectStyled: typeof ReactSelect;
|
|
5
5
|
export declare const SelectAsyncStyled: typeof ReactSelectAsync;
|
|
6
6
|
export declare const SelectCreatableStyled: typeof ReactSelectCreatable;
|
|
7
|
+
export declare const ClearIndicatorBox: import("styled-components").StyledComponent<"div", any, {}, never>;
|
package/Select/styles.js
CHANGED
|
@@ -4,11 +4,11 @@ import ReactSelectCreatable from 'react-select/creatable';
|
|
|
4
4
|
import styled, { css } from 'styled-components';
|
|
5
5
|
import { Color, Spacing, FontSize, LineHeight, UnitSize } from '@pushwoosh/kit-constants';
|
|
6
6
|
import { CLASS_NAME_PREFIX } from './constants';
|
|
7
|
-
const selectStyles = css([".", "__control{width:", ";min-width:", ";height:auto;min-height:", ";font-size:", ";line-height:", ";background-color:", ";border:", ";box-sizing:border-box;}.", "__indicator{display:flex;align-items:center;justify-content:center;padding:", " ", ";}.", "__menu{width:", ";min-width:", ";font-size:", ";line-height:", ";}.", "__indicator-separator{display:none;}.", "__control--is-focused{border:1px solid ", ";box-shadow:none;}.", "__control--is-disabled{background-color:", ";}.", "__control:hover{border:", ";}.", "__control--is-focused:hover{border:1px solid ", ";box-shadow:none;}.", "__placeholder{display:flex;width:100%;
|
|
7
|
+
const selectStyles = css([".", "__control{width:", ";min-width:", ";height:auto;min-height:", ";font-size:", ";line-height:", ";color:", ";background-color:", ";border:", ";box-sizing:border-box;}.", "__indicator{display:flex;align-items:center;justify-content:center;padding:", " ", ";}.", "__menu{width:", ";min-width:", ";font-size:", ";line-height:", ";}.", "__indicator-separator{display:none;}.", "__control--is-focused{border:1px solid ", ";box-shadow:none;}.", "__control--is-disabled{background-color:", ";}.", "__control:hover{border:", ";}.", "__control--is-focused:hover{border:1px solid ", ";box-shadow:none;}.", "__placeholder{display:flex;width:100%;color:", ";white-space:nowrap;text-overflow:clip;}"], CLASS_NAME_PREFIX, ({
|
|
8
8
|
width
|
|
9
9
|
}) => width || '100%', ({
|
|
10
10
|
width
|
|
11
|
-
}) => width || '150px', UnitSize.FIELD_HEIGHT, FontSize.REGULAR, LineHeight.REGULAR, Color.CLEAR, ({
|
|
11
|
+
}) => width || '150px', UnitSize.FIELD_HEIGHT, FontSize.REGULAR, LineHeight.REGULAR, Color.MAIN, Color.CLEAR, ({
|
|
12
12
|
$isErrored
|
|
13
13
|
}) => $isErrored ? `1px solid ${Color.DANGER}` : `1px solid ${Color.FORM}`, CLASS_NAME_PREFIX, Spacing.S2, Spacing.S3, CLASS_NAME_PREFIX, ({
|
|
14
14
|
width
|
|
@@ -16,7 +16,7 @@ const selectStyles = css([".", "__control{width:", ";min-width:", ";height:auto;
|
|
|
16
16
|
width
|
|
17
17
|
}) => width || '150px', FontSize.REGULAR, LineHeight.REGULAR, CLASS_NAME_PREFIX, CLASS_NAME_PREFIX, Color.BRIGHT, CLASS_NAME_PREFIX, Color.FROZEN, CLASS_NAME_PREFIX, ({
|
|
18
18
|
$isErrored
|
|
19
|
-
}) => $isErrored ? `1px solid ${Color.DANGER}` : `1px solid ${Color.FORM}`, CLASS_NAME_PREFIX, Color.BRIGHT, CLASS_NAME_PREFIX);
|
|
19
|
+
}) => $isErrored ? `1px solid ${Color.DANGER}` : `1px solid ${Color.FORM}`, CLASS_NAME_PREFIX, Color.BRIGHT, CLASS_NAME_PREFIX, Color.PHANTOM);
|
|
20
20
|
export const SelectStyled = styled(ReactSelect).withConfig({
|
|
21
21
|
displayName: "SelectStyled",
|
|
22
22
|
componentId: "sc-c2oq4h-0"
|
|
@@ -28,4 +28,8 @@ export const SelectAsyncStyled = styled(ReactSelectAsync).withConfig({
|
|
|
28
28
|
export const SelectCreatableStyled = styled(ReactSelectCreatable).withConfig({
|
|
29
29
|
displayName: "SelectCreatableStyled",
|
|
30
30
|
componentId: "sc-c2oq4h-2"
|
|
31
|
-
})(["", ";"], selectStyles);
|
|
31
|
+
})(["", ";"], selectStyles);
|
|
32
|
+
export const ClearIndicatorBox = styled.div.withConfig({
|
|
33
|
+
displayName: "ClearIndicatorBox",
|
|
34
|
+
componentId: "sc-c2oq4h-3"
|
|
35
|
+
})(["color:", ";transition:transform 0.3s ease,color 0.3s ease;&:hover{color:", ";transform:scale(1.2);}"], Color.PHANTOM, Color.MAIN);
|