@fibery/ui-kit 1.0.3 → 1.0.4
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/package.json +3 -2
- package/src/Select/index.tsx +2 -9
- package/src/Select/styles.ts +17 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fibery/ui-kit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"main": "index.ts",
|
|
5
5
|
"private": false,
|
|
6
6
|
"files": [
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"react-popper": "2.2.5",
|
|
51
51
|
"react-select": "5.3.2",
|
|
52
52
|
"react-select-country-list": "2.2.1",
|
|
53
|
-
"react-windowed-select": "
|
|
53
|
+
"react-windowed-select": "5.0.0",
|
|
54
54
|
"screenfull": "6.0.1"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"@types/chroma-js": "2.1.3",
|
|
66
66
|
"@types/color-hash": "1.0.2",
|
|
67
67
|
"@types/emoji-mart": "3.0.8",
|
|
68
|
+
"csstype": "3.0.8",
|
|
68
69
|
"enzyme": "3.11.0",
|
|
69
70
|
"enzyme-adapter-react-16": "1.15.6",
|
|
70
71
|
"fs-extra": "10.0.0",
|
package/src/Select/index.tsx
CHANGED
|
@@ -46,7 +46,7 @@ export function combineStyles<
|
|
|
46
46
|
Option,
|
|
47
47
|
IsMulti extends boolean = boolean,
|
|
48
48
|
Group extends GroupBase<Option> = GroupBase<Option>
|
|
49
|
-
>(stylesArray: StylesConfig<Option, IsMulti, Group>[]) {
|
|
49
|
+
>(stylesArray: StylesConfig<Option, IsMulti, Group>[]): StylesConfig<Option, IsMulti, Group> {
|
|
50
50
|
return stylesArray.reduce<StylesConfig<Option, IsMulti, Group>>((acc, style) => {
|
|
51
51
|
Object.keys(style).forEach((key) => {
|
|
52
52
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
@@ -108,8 +108,6 @@ export const Select = forwardRef(function Select<
|
|
|
108
108
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
109
109
|
forwardedRef: any
|
|
110
110
|
) {
|
|
111
|
-
const theme = useTheme();
|
|
112
|
-
const combineThemes = useCallback((providedTheme) => ({...providedTheme, ...theme}), [theme]);
|
|
113
111
|
const handleKeyDown = useCallback(
|
|
114
112
|
(e) => {
|
|
115
113
|
switch (e.key) {
|
|
@@ -143,19 +141,17 @@ export const Select = forwardRef(function Select<
|
|
|
143
141
|
[onKeyDown, rest.menuIsOpen]
|
|
144
142
|
);
|
|
145
143
|
|
|
146
|
-
const SelectComponent = virtualized ? WindowedSelect : BaseSelect;
|
|
144
|
+
const SelectComponent = (virtualized ? WindowedSelect : BaseSelect) as unknown as typeof BaseSelect;
|
|
147
145
|
|
|
148
146
|
return (
|
|
149
147
|
<SelectComponent
|
|
150
148
|
ref={forwardedRef}
|
|
151
149
|
menuPortalTarget={menuPortalTarget}
|
|
152
150
|
menuPlacement={"auto"}
|
|
153
|
-
style={createInlineTheme(theme)}
|
|
154
151
|
styles={combineStyles<Option, IsMulti, Group>([
|
|
155
152
|
componentsStyles as unknown as StylesConfig<Option, IsMulti, Group>,
|
|
156
153
|
styles,
|
|
157
154
|
])}
|
|
158
|
-
theme={combineThemes}
|
|
159
155
|
isMulti={isCollectionMode}
|
|
160
156
|
backspaceRemovesValue={isCollectionMode}
|
|
161
157
|
tabSelectsValue={false}
|
|
@@ -185,8 +181,6 @@ export function CreatableSelect<
|
|
|
185
181
|
IsMulti extends boolean = boolean,
|
|
186
182
|
Group extends GroupBase<Option> = GroupBase<Option>
|
|
187
183
|
>({components, isCollectionMode, menuPortalTarget, styles = {}, ...rest}: SelectProps<Option, IsMulti, Group>) {
|
|
188
|
-
const theme = useTheme();
|
|
189
|
-
const combineThemes = useCallback((providedTheme) => ({...providedTheme, ...theme}), [theme]);
|
|
190
184
|
return (
|
|
191
185
|
<BaseCreatableSelect
|
|
192
186
|
menuPortalTarget={menuPortalTarget}
|
|
@@ -195,7 +189,6 @@ export function CreatableSelect<
|
|
|
195
189
|
componentsStyles as unknown as StylesConfig<Option, IsMulti, Group>,
|
|
196
190
|
styles,
|
|
197
191
|
])}
|
|
198
|
-
theme={combineThemes}
|
|
199
192
|
isMulti={isCollectionMode}
|
|
200
193
|
backspaceRemovesValue={isCollectionMode}
|
|
201
194
|
tabSelectsValue={false}
|
package/src/Select/styles.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {css} from "@linaria/core";
|
|
2
|
+
import {Property} from "csstype";
|
|
2
3
|
import type {StylesConfig, CSSObjectWithLabel, ControlProps} from "react-select";
|
|
3
4
|
import {inputOverrides} from "../antd/styles";
|
|
4
5
|
import {border, layout, space, textStyles, themeVars, transition} from "../designSystem";
|
|
@@ -27,20 +28,21 @@ function createControlStyle({
|
|
|
27
28
|
childDivStyle.flexWrap = "nowrap";
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
return (provided, state) =>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
return (provided, state) =>
|
|
32
|
+
({
|
|
33
|
+
display: "flex",
|
|
34
|
+
flexWrap: isSingleLine ? "nowrap" : "wrap",
|
|
35
|
+
justifyContent: "space-between",
|
|
36
|
+
width: "100%",
|
|
37
|
+
...inputOverrides.main,
|
|
38
|
+
minHeight: layout.inputHeight,
|
|
39
|
+
...(state.isFocused && inputOverrides.focus),
|
|
40
|
+
...(state.isDisabled && inputOverrides.disabled),
|
|
41
|
+
":hover": !state.isFocused && !state.isDisabled ? inputOverrides.hover : {},
|
|
42
|
+
paddingLeft: space.l,
|
|
43
|
+
paddingRight: space.l,
|
|
44
|
+
"& > div": childDivStyle,
|
|
45
|
+
} as unknown as CSSObjectWithLabel);
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
export const componentsStyles: StylesConfig = {
|
|
@@ -122,7 +124,7 @@ export const componentsStyles: StylesConfig = {
|
|
|
122
124
|
...provided,
|
|
123
125
|
zIndex: 1050,
|
|
124
126
|
backgroundColor: themeVars.actionMenuInnerBg,
|
|
125
|
-
boxShadow: themeVars.actionMenuShadow,
|
|
127
|
+
boxShadow: themeVars.actionMenuShadow as unknown as Property.BoxShadow,
|
|
126
128
|
borderRadius: border.radius6,
|
|
127
129
|
}),
|
|
128
130
|
container: (provided, state) => ({
|