@fibery/ui-kit 1.0.2 → 1.0.5
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 +8 -3
- package/src/Button.js +6 -6
- package/src/Select/components.tsx +87 -0
- package/src/Select/index.tsx +210 -0
- package/src/Select/{styles.js → styles.ts} +36 -19
- package/src/ThemeProvider.tsx +94 -5
- package/src/antd/styles.ts +119 -0
- package/src/designSystem.ts +98 -61
- package/src/error-alert.tsx +55 -0
- package/src/form-field-loader.tsx +0 -1
- package/src/icons/Icon.tsx +2 -2
- package/src/icons/ast/AppStoreOneColor.ts +1 -1
- package/src/icons/ast/Checked.ts +1 -1
- package/src/icons/ast/ExtensionAvatar.ts +1 -1
- package/src/icons/ast/Integration.ts +1 -1
- package/src/icons/ast/RicheditorImageAlignCenter.ts +1 -1
- package/src/icons/ast/RicheditorImageAlignLeft.ts +1 -1
- package/src/icons/ast/RicheditorImageAlignRight.ts +1 -1
- package/src/icons/ast/RicheditorImageUpload.ts +1 -1
- package/src/icons/ast/RicheditorImageWrapCenter.ts +1 -1
- package/src/icons/ast/RicheditorImageWrapLeft.ts +1 -1
- package/src/icons/ast/RicheditorImageWrapRight.ts +1 -1
- package/src/Select/components.js +0 -64
- package/src/Select/index.d.ts +0 -11
- package/src/Select/index.js +0 -140
- package/src/Select/lazy.js +0 -35
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
import { IconDefinition } from '../types';
|
|
5
5
|
|
|
6
|
-
const RicheditorImageWrapRight: IconDefinition = {"icon":{"type":"root","children":[{"type":"element","tagName":"svg","properties":{"viewBox":"0 0 20 20"},"children":[{"type":"element","tagName":"g","properties":{},"children":[{"type":"element","tagName":"path","properties":{"
|
|
6
|
+
const RicheditorImageWrapRight: IconDefinition = {"icon":{"type":"root","children":[{"type":"element","tagName":"svg","properties":{"viewBox":"0 0 20 20"},"children":[{"type":"element","tagName":"g","properties":{"fillRule":"evenodd","clipRule":"evenodd"},"children":[{"type":"element","tagName":"path","properties":{"d":"M10.6 8.6v2.8h4.8V8.6h-4.8ZM10 7a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V8a1 1 0 0 0-1-1h-6ZM3 4.15c0-.47.38-.85.85-.85h12.3a.85.85 0 0 1 0 1.7H3.85A.85.85 0 0 1 3 4.15ZM3 16.15c0-.47.38-.85.85-.85h12.3a.85.85 0 0 1 0 1.7H3.85a.85.85 0 0 1-.85-.85ZM3 8c0-.552.5-1 1-1h2c.5 0 1 .448 1 1s-.5 1-1 1H4c-.5 0-1-.448-1-1ZM3 12c0-.552.5-1 1-1h2c.5 0 1 .448 1 1s-.5 1-1 1H4c-.5 0-1-.448-1-1Z"},"children":[]}]}],"metadata":""}]},"name":"richeditor-image-wrap-right"};
|
|
7
7
|
|
|
8
8
|
export default RicheditorImageWrapRight;
|
package/src/Select/components.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import {useCallback} from "react";
|
|
2
|
-
import {css} from "@linaria/core";
|
|
3
|
-
import {components} from "react-windowed-select";
|
|
4
|
-
import RemoveIcon from "../icons/react/Remove";
|
|
5
|
-
import {Button} from "../Button";
|
|
6
|
-
import {themeVars, space} from "../designSystem";
|
|
7
|
-
import ArrowBottom from "../icons/react/ArrowBottom";
|
|
8
|
-
import {dropdownIndicatorSize, expanderStyle} from "./styles";
|
|
9
|
-
|
|
10
|
-
export const Option = ({children, ...props}) => {
|
|
11
|
-
const {onMouseMove, onMouseOver, ...rest} = props.innerProps;
|
|
12
|
-
const newProps = Object.assign(props, {innerProps: rest});
|
|
13
|
-
return <components.Option {...newProps}>{children}</components.Option>;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const DropdownIndicator = (props) => (
|
|
17
|
-
<div
|
|
18
|
-
className={expanderStyle}
|
|
19
|
-
style={{
|
|
20
|
-
transform: props.selectProps.menuIsOpen ? "rotate(180deg)" : "",
|
|
21
|
-
}}
|
|
22
|
-
>
|
|
23
|
-
<ArrowBottom iconSize={dropdownIndicatorSize} color={themeVars.disabledTextColor} />
|
|
24
|
-
</div>
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
export const ClearIndicator = ({innerProps, selectProps}) => {
|
|
28
|
-
const onMouseDown = innerProps.onMouseDown;
|
|
29
|
-
const wrappedOnMouseDown = useCallback(
|
|
30
|
-
(e) => {
|
|
31
|
-
onMouseDown(e);
|
|
32
|
-
// This prevents false positive triggering in rc-trigger
|
|
33
|
-
e.nativeEvent.stopImmediatePropagation();
|
|
34
|
-
},
|
|
35
|
-
[onMouseDown]
|
|
36
|
-
);
|
|
37
|
-
return (
|
|
38
|
-
<Button
|
|
39
|
-
borderless
|
|
40
|
-
Icon={RemoveIcon}
|
|
41
|
-
disabled={selectProps.isDisabled}
|
|
42
|
-
size={":button-size/super-small"}
|
|
43
|
-
{...innerProps}
|
|
44
|
-
onMouseDown={wrappedOnMouseDown}
|
|
45
|
-
/>
|
|
46
|
-
);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const NoOptionsMessage = ({children}) => {
|
|
50
|
-
return (
|
|
51
|
-
<div
|
|
52
|
-
className={css`
|
|
53
|
-
${{
|
|
54
|
-
paddingLeft: space.l + 2,
|
|
55
|
-
paddingRight: space.l + 2,
|
|
56
|
-
paddingTop: space.m,
|
|
57
|
-
paddingBottom: space.m,
|
|
58
|
-
}}
|
|
59
|
-
`}
|
|
60
|
-
>
|
|
61
|
-
{children}
|
|
62
|
-
</div>
|
|
63
|
-
);
|
|
64
|
-
};
|
package/src/Select/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import {FunctionComponent, ForwardRefRenderFunction} from "react";
|
|
2
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3
|
-
export const Select: ForwardRefRenderFunction<{focus: () => void}, any>;
|
|
4
|
-
export const CreatableSelect: FunctionComponent<any>;
|
|
5
|
-
export const components: {
|
|
6
|
-
GroupHeading: FunctionComponent<any>;
|
|
7
|
-
Option: FunctionComponent<any>;
|
|
8
|
-
SingleValue: FunctionComponent<any>;
|
|
9
|
-
MultiValue: FunctionComponent<any>;
|
|
10
|
-
};
|
|
11
|
-
export const combineStyles: (...args: any[]) => any;
|
package/src/Select/index.js
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import cn from "classnames";
|
|
2
|
-
import {useCallback, forwardRef} from "react";
|
|
3
|
-
import BaseSelect from "react-select";
|
|
4
|
-
import BaseCreatableSelect from "react-select/creatable";
|
|
5
|
-
import WindowedSelect, {components, WindowedMenuList} from "react-windowed-select";
|
|
6
|
-
import {createInlineTheme} from "../designSystem";
|
|
7
|
-
import {useTheme} from "../ThemeProvider";
|
|
8
|
-
import {ClearIndicator, DropdownIndicator, NoOptionsMessage, Option} from "./components";
|
|
9
|
-
import {componentsStyles, singleLineComponentsStyle} from "./styles";
|
|
10
|
-
|
|
11
|
-
const GroupHeading = (props) => {
|
|
12
|
-
if (!props.children) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
return <components.GroupHeading {...props} />;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
function Menu(props) {
|
|
19
|
-
const theme = useTheme();
|
|
20
|
-
const {innerProps, className} = props;
|
|
21
|
-
const overridedInnerProps = {...innerProps, style: {...innerProps.style, ...createInlineTheme(theme)}};
|
|
22
|
-
return <components.Menu {...props} innerProps={overridedInnerProps} className={cn(className, "react-select-menu")} />;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export {components};
|
|
26
|
-
|
|
27
|
-
export const combineStyles = (stylesArray) => {
|
|
28
|
-
return stylesArray.reduce((acc, style) => {
|
|
29
|
-
Object.keys(style).forEach((key) => {
|
|
30
|
-
if (acc[key]) {
|
|
31
|
-
const temp = acc[key];
|
|
32
|
-
acc[key] = (provided, state) => style[key](temp(provided, state), state);
|
|
33
|
-
} else {
|
|
34
|
-
acc[key] = (provided, state) => style[key](provided, state);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
return acc;
|
|
38
|
-
}, {});
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export function SingleRowSelect({styles = {}, ...rest}) {
|
|
42
|
-
return <Select {...rest} styles={combineStyles([singleLineComponentsStyle, styles])} />;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export const Select = forwardRef(function Select(
|
|
46
|
-
{components, isCollectionMode, menuPortalTarget, onKeyDown, styles = {}, virtualized = true, ...rest},
|
|
47
|
-
forwardedRef
|
|
48
|
-
) {
|
|
49
|
-
const theme = useTheme();
|
|
50
|
-
const combineThemes = useCallback((providedTheme) => ({...providedTheme, ...theme}), [theme]);
|
|
51
|
-
const handleKeyDown = useCallback(
|
|
52
|
-
(e) => {
|
|
53
|
-
switch (e.key) {
|
|
54
|
-
case "Escape":
|
|
55
|
-
if (rest.menuIsOpen) {
|
|
56
|
-
e.stopPropagation();
|
|
57
|
-
}
|
|
58
|
-
break;
|
|
59
|
-
case "Home":
|
|
60
|
-
e.preventDefault();
|
|
61
|
-
if (e.shiftKey) {
|
|
62
|
-
e.target.selectionStart = 0;
|
|
63
|
-
} else {
|
|
64
|
-
e.target.setSelectionRange(0, 0);
|
|
65
|
-
}
|
|
66
|
-
break;
|
|
67
|
-
case "End":
|
|
68
|
-
e.preventDefault();
|
|
69
|
-
const len = e.target.value.length;
|
|
70
|
-
if (e.shiftKey) {
|
|
71
|
-
e.target.selectionEnd = len;
|
|
72
|
-
} else {
|
|
73
|
-
e.target.setSelectionRange(len, len);
|
|
74
|
-
}
|
|
75
|
-
break;
|
|
76
|
-
default:
|
|
77
|
-
}
|
|
78
|
-
onKeyDown && onKeyDown(e);
|
|
79
|
-
},
|
|
80
|
-
[onKeyDown, rest.menuIsOpen]
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
const SelectComponent = virtualized ? WindowedSelect : BaseSelect;
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<SelectComponent
|
|
87
|
-
ref={forwardedRef}
|
|
88
|
-
menuPortalTarget={menuPortalTarget}
|
|
89
|
-
menuPlacement={"auto"}
|
|
90
|
-
style={createInlineTheme(theme)}
|
|
91
|
-
styles={combineStyles([componentsStyles, styles])}
|
|
92
|
-
theme={combineThemes}
|
|
93
|
-
isMulti={isCollectionMode}
|
|
94
|
-
backspaceRemovesValue={isCollectionMode}
|
|
95
|
-
tabSelectsValue={false}
|
|
96
|
-
components={{
|
|
97
|
-
Menu,
|
|
98
|
-
DropdownIndicator,
|
|
99
|
-
ClearIndicator,
|
|
100
|
-
Option,
|
|
101
|
-
MultiValueRemove: ClearIndicator,
|
|
102
|
-
NoOptionsMessage,
|
|
103
|
-
GroupHeading,
|
|
104
|
-
...components,
|
|
105
|
-
}}
|
|
106
|
-
{...rest}
|
|
107
|
-
onKeyDown={handleKeyDown}
|
|
108
|
-
isDisabled={rest.disabled}
|
|
109
|
-
/>
|
|
110
|
-
);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
export function CreatableSelect({components, isCollectionMode, menuPortalTarget, styles = {}, ...rest}) {
|
|
114
|
-
const theme = useTheme();
|
|
115
|
-
const combineThemes = useCallback((providedTheme) => ({...providedTheme, ...theme}), [theme]);
|
|
116
|
-
return (
|
|
117
|
-
<BaseCreatableSelect
|
|
118
|
-
menuPortalTarget={menuPortalTarget}
|
|
119
|
-
menuPlacement={"auto"}
|
|
120
|
-
styles={combineStyles([componentsStyles, styles])}
|
|
121
|
-
theme={combineThemes}
|
|
122
|
-
isMulti={isCollectionMode}
|
|
123
|
-
backspaceRemovesValue={isCollectionMode}
|
|
124
|
-
tabSelectsValue={false}
|
|
125
|
-
components={{
|
|
126
|
-
Menu,
|
|
127
|
-
MenuList: WindowedMenuList,
|
|
128
|
-
DropdownIndicator,
|
|
129
|
-
ClearIndicator,
|
|
130
|
-
Option,
|
|
131
|
-
MultiValueRemove: ClearIndicator,
|
|
132
|
-
NoOptionsMessage,
|
|
133
|
-
GroupHeading,
|
|
134
|
-
...components,
|
|
135
|
-
}}
|
|
136
|
-
{...rest}
|
|
137
|
-
isDisabled={rest.disabled}
|
|
138
|
-
/>
|
|
139
|
-
);
|
|
140
|
-
}
|
package/src/Select/lazy.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import {lazy, Suspense, forwardRef} from "react";
|
|
2
|
-
import {SelectLoader} from "./select-loader";
|
|
3
|
-
|
|
4
|
-
const LazySelect = lazy(async () => {
|
|
5
|
-
const {Select} = await import("./index");
|
|
6
|
-
return {default: Select};
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
export const ReactSelect = forwardRef((props, forwardedRef) => (
|
|
10
|
-
<Suspense fallback={<SelectLoader />}>
|
|
11
|
-
<LazySelect {...props} ref={forwardedRef} />
|
|
12
|
-
</Suspense>
|
|
13
|
-
));
|
|
14
|
-
|
|
15
|
-
const CreatableLazySelect = lazy(async () => {
|
|
16
|
-
const {CreatableSelect} = await import("./index");
|
|
17
|
-
return {default: CreatableSelect};
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export const CreatableReactSelect = (props) => (
|
|
21
|
-
<Suspense fallback={<SelectLoader />}>
|
|
22
|
-
<CreatableLazySelect {...props} />
|
|
23
|
-
</Suspense>
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
const SingleRowLazySelect = lazy(async () => {
|
|
27
|
-
const {SingleRowSelect} = await import("./index");
|
|
28
|
-
return {default: SingleRowSelect};
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
export const SingleRowReactSelect = (props) => (
|
|
32
|
-
<Suspense fallback={<SelectLoader />}>
|
|
33
|
-
<SingleRowLazySelect {...props} />
|
|
34
|
-
</Suspense>
|
|
35
|
-
);
|