@fibery/ui-kit 1.10.0 → 1.10.1
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fibery/ui-kit",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.1",
|
|
4
4
|
"main": "index.ts",
|
|
5
5
|
"private": false,
|
|
6
6
|
"files": [
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"rc-input-number": "7.3.11",
|
|
52
52
|
"rc-menu": "9.8.1",
|
|
53
53
|
"rc-progress": "3.4.1",
|
|
54
|
-
"react-color": "2.
|
|
54
|
+
"react-color": "2.19.3",
|
|
55
55
|
"react-day-picker": "8.1.4",
|
|
56
56
|
"react-popper": "2.3.0",
|
|
57
57
|
"react-select": "5.3.2",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"react-windowed-select": "5.0.0",
|
|
60
60
|
"screenfull": "6.0.1",
|
|
61
61
|
"ua-parser-js": "0.7.24",
|
|
62
|
-
"@fibery/
|
|
63
|
-
"@fibery/
|
|
62
|
+
"@fibery/react": "1.0.2",
|
|
63
|
+
"@fibery/helpers": "1.0.4"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"react": "^18.2.0",
|
package/src/designSystem.ts
CHANGED
|
@@ -202,6 +202,7 @@ const lightColors = {
|
|
|
202
202
|
cellBackgroundColor: slate.slate2,
|
|
203
203
|
cellBackgroundHoverColor: getOpacities(slate.slate6).opacity30,
|
|
204
204
|
cellBorderColor: getOpacities(slate.slate8).opacity50,
|
|
205
|
+
cellPinnedBorderColor: getOpacities(slate.slate8).opacity70,
|
|
205
206
|
tableRowWarningColor: getOpacities(yellow.yellow6).opacity60,
|
|
206
207
|
errorBgColor: getOpacities(red.red9).opacity20,
|
|
207
208
|
errorTextColor: red.red11,
|
|
@@ -254,6 +255,7 @@ const lightColors = {
|
|
|
254
255
|
progressFillBg: slate.slate11,
|
|
255
256
|
progressFillText: whiteA.whiteA0,
|
|
256
257
|
searchFiltersBg: slate.slate1,
|
|
258
|
+
colorPickerSwatchBorder: blackA.blackA7,
|
|
257
259
|
} as const;
|
|
258
260
|
|
|
259
261
|
const darkMenu = {
|
|
@@ -364,6 +366,7 @@ const darkColors = {
|
|
|
364
366
|
cellBackgroundColor: slateDark.slate2,
|
|
365
367
|
cellBackgroundHoverColor: getOpacities(slateDark.slate6).opacity30,
|
|
366
368
|
cellBorderColor: getOpacities(slateDark.slate9).opacity50,
|
|
369
|
+
cellPinnedBorderColor: getOpacities(slateDark.slate9).opacity70,
|
|
367
370
|
tableRowWarningColor: getOpacities(yellowDark.yellow9).opacity40,
|
|
368
371
|
errorBgColor: getOpacities(redDark.red9).opacity60,
|
|
369
372
|
errorTextColor: red.red7,
|
|
@@ -414,6 +417,7 @@ const darkColors = {
|
|
|
414
417
|
progressFillBg: slate.slate11,
|
|
415
418
|
progressFillText: whiteA.whiteA0,
|
|
416
419
|
searchFiltersBg: slateDark.slate2,
|
|
420
|
+
colorPickerSwatchBorder: blackA.blackA7,
|
|
417
421
|
...darkMenu,
|
|
418
422
|
} as const;
|
|
419
423
|
|
|
@@ -554,6 +558,9 @@ export const getEnumBackgroundColor = _.memoize(
|
|
|
554
558
|
);
|
|
555
559
|
|
|
556
560
|
export const cardTypeColors = [
|
|
561
|
+
"#4A4A4A",
|
|
562
|
+
"#6A849B",
|
|
563
|
+
"#BEC5CC",
|
|
557
564
|
"#D40915",
|
|
558
565
|
"#E72065",
|
|
559
566
|
"#9C2BAF",
|
|
@@ -568,8 +575,6 @@ export const cardTypeColors = [
|
|
|
568
575
|
"#FBA32F",
|
|
569
576
|
"#FC551F",
|
|
570
577
|
"#B04E31",
|
|
571
|
-
"#6A849B",
|
|
572
|
-
"#4A4A4A",
|
|
573
578
|
] as const;
|
|
574
579
|
|
|
575
580
|
export const pastelColors = cardTypeColors.map((color) => makeChromaColor(color).luminance(0.8).hex());
|
|
@@ -4,6 +4,9 @@ import {useThemeMode} from "../ThemeProvider";
|
|
|
4
4
|
import {alignTheme} from "../theme-settings";
|
|
5
5
|
import appIcons from "../appIcons.json";
|
|
6
6
|
import {getThemedUrl} from "../AppIconWithFallback";
|
|
7
|
+
import {$TSFixMe} from "../tsfixme";
|
|
8
|
+
import {cardTypeColors} from "../designSystem";
|
|
9
|
+
import {ColorPicker} from "../ColorPicker";
|
|
7
10
|
|
|
8
11
|
const EMPTY_DATA = {
|
|
9
12
|
aliases: {},
|
|
@@ -12,10 +15,16 @@ const EMPTY_DATA = {
|
|
|
12
15
|
compressed: false,
|
|
13
16
|
};
|
|
14
17
|
|
|
15
|
-
export type AppIconPickerProps = {
|
|
18
|
+
export type AppIconPickerProps = {
|
|
19
|
+
borderless?: boolean;
|
|
20
|
+
color?: string;
|
|
21
|
+
onColorSelect?: (c: $TSFixMe) => void;
|
|
22
|
+
} & PickerProps;
|
|
23
|
+
|
|
24
|
+
const i18n = {search: "Search icon..."};
|
|
16
25
|
|
|
17
26
|
export const AppIconPicker = forwardRef<HTMLDivElement, AppIconPickerProps>(function AppIconPicker(
|
|
18
|
-
{borderless = true, ...pickerProps},
|
|
27
|
+
{borderless = true, onColorSelect, color, ...pickerProps},
|
|
19
28
|
ref
|
|
20
29
|
) {
|
|
21
30
|
const themeMode = useThemeMode();
|
|
@@ -34,17 +43,20 @@ export const AppIconPicker = forwardRef<HTMLDivElement, AppIconPickerProps>(func
|
|
|
34
43
|
);
|
|
35
44
|
|
|
36
45
|
return (
|
|
37
|
-
<EmojiMartWrapper ref={ref} borderless={borderless} hideCategories>
|
|
46
|
+
<EmojiMartWrapper ref={ref} color={color} borderless={borderless} hideCategories>
|
|
38
47
|
<NimblePicker
|
|
39
48
|
data={EMPTY_DATA}
|
|
40
49
|
theme={alignedTheme}
|
|
41
50
|
showSkinTones={false}
|
|
42
51
|
showPreview={false}
|
|
52
|
+
emojiTooltip
|
|
43
53
|
title=""
|
|
44
54
|
custom={customIcons}
|
|
45
|
-
emojiSize={
|
|
55
|
+
emojiSize={20}
|
|
56
|
+
i18n={i18n}
|
|
46
57
|
{...pickerProps}
|
|
47
58
|
/>
|
|
59
|
+
{onColorSelect ? <ColorPicker colors={cardTypeColors} color={color} onChangeComplete={onColorSelect} /> : null}
|
|
48
60
|
</EmojiMartWrapper>
|
|
49
61
|
);
|
|
50
62
|
});
|
|
@@ -1,40 +1,63 @@
|
|
|
1
|
+
import {CSSProperties, css, cx} from "@linaria/core";
|
|
2
|
+
import {Emoji, EmojiProps} from "emoji-mart";
|
|
1
3
|
import "emoji-mart/css/emoji-mart.css";
|
|
2
4
|
import {forwardRef} from "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
5
|
+
import {useTheme} from "../ThemeProvider";
|
|
6
|
+
import {a11yColor} from "../a11y-color";
|
|
7
|
+
import {border, fontFamily, getOpacities, space, textStyles, themeVars} from "../designSystem";
|
|
6
8
|
|
|
7
|
-
export {
|
|
8
|
-
export type {BaseEmoji,
|
|
9
|
+
export {NimblePicker, Picker, emojiIndex} from "emoji-mart";
|
|
10
|
+
export type {BaseEmoji, EmojiSkin, PickerProps} from "emoji-mart";
|
|
9
11
|
|
|
10
12
|
export const backgroundImageFn = () => "https://assets-temp.fibery.io/images/emoji-datasource-apple-5_0_1-64.png";
|
|
11
13
|
|
|
12
14
|
const emojiMartCss = css`
|
|
15
|
+
padding: 0 ${space.l}px;
|
|
16
|
+
position: relative;
|
|
17
|
+
|
|
13
18
|
.emoji-mart {
|
|
19
|
+
font-family: ${fontFamily};
|
|
14
20
|
background-color: ${themeVars.actionMenuBg};
|
|
15
21
|
margin-top: ${space.xxs}px;
|
|
16
22
|
display: block;
|
|
23
|
+
width: 288px !important;
|
|
24
|
+
|
|
25
|
+
+ * {
|
|
26
|
+
border-top: 1px solid ${themeVars.separatorColor};
|
|
27
|
+
}
|
|
17
28
|
}
|
|
18
29
|
|
|
19
30
|
.emoji-mart-bar {
|
|
20
31
|
border-bottom: 1px solid ${themeVars.separatorColor};
|
|
21
32
|
|
|
22
33
|
&:last-child {
|
|
23
|
-
border
|
|
34
|
+
border: 0;
|
|
24
35
|
}
|
|
25
36
|
}
|
|
26
37
|
|
|
27
38
|
.emoji-mart-search {
|
|
28
39
|
padding-bottom: ${space.s}px;
|
|
40
|
+
padding-left: 0;
|
|
41
|
+
padding-right: 0;
|
|
29
42
|
|
|
30
43
|
& input {
|
|
31
44
|
${textStyles.regular}
|
|
32
45
|
background-color: ${themeVars.inputBgColor};
|
|
33
46
|
color: ${themeVars.textColor};
|
|
34
47
|
box-shadow: ${themeVars.inputBorderColor};
|
|
35
|
-
height:
|
|
48
|
+
height: 32px;
|
|
36
49
|
border: 0;
|
|
37
50
|
}
|
|
51
|
+
|
|
52
|
+
& .emoji-mart-search-icon {
|
|
53
|
+
top: 5px;
|
|
54
|
+
right: 4px;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.emoji-mart-scroll {
|
|
59
|
+
padding-left: 0;
|
|
60
|
+
padding-right: 0;
|
|
38
61
|
}
|
|
39
62
|
|
|
40
63
|
.emoji-anchor-bar {
|
|
@@ -57,7 +80,7 @@ const emojiMartCss = css`
|
|
|
57
80
|
}
|
|
58
81
|
|
|
59
82
|
.emoji-mart-category .emoji-mart-emoji:hover::before {
|
|
60
|
-
background-color:
|
|
83
|
+
background-color: var(--emoji-bg-color) !important;
|
|
61
84
|
border-radius: ${border.radius8}px !important;
|
|
62
85
|
}
|
|
63
86
|
.emoji-mart-dark .emoji-mart-category-label span {
|
|
@@ -69,23 +92,70 @@ const emojiMartCss = css`
|
|
|
69
92
|
}
|
|
70
93
|
|
|
71
94
|
.emoji-mart-preview {
|
|
72
|
-
height:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
.emoji-mart-preview-skins {
|
|
76
|
-
right: 15px;
|
|
95
|
+
height: 0px;
|
|
96
|
+
position: unset;
|
|
77
97
|
}
|
|
78
98
|
|
|
79
99
|
.emoji-mart-emoji {
|
|
80
100
|
/* pathetic attemts to make it a bit faster without forking */
|
|
81
101
|
content-visibility: auto;
|
|
82
|
-
contain-intrinsic-size:
|
|
102
|
+
contain-intrinsic-size: 20px;
|
|
103
|
+
cursor: pointer;
|
|
83
104
|
}
|
|
84
105
|
.emoji-mart-category-list,
|
|
85
106
|
.emoji-mart-category-list li {
|
|
86
107
|
/* hack to maintain correct size of hidden emojis becuase of content-visibility */
|
|
87
108
|
line-height: 0;
|
|
88
109
|
}
|
|
110
|
+
.emoji-mart-preview-skins {
|
|
111
|
+
top: 16px;
|
|
112
|
+
right: 12px !important;
|
|
113
|
+
z-index: 2;
|
|
114
|
+
background-color: ${themeVars.actionMenuBg};
|
|
115
|
+
|
|
116
|
+
& .emoji-mart-skin-swatches {
|
|
117
|
+
background-color: ${themeVars.actionMenuBg};
|
|
118
|
+
|
|
119
|
+
&.opened {
|
|
120
|
+
& .emoji-mart-skin-swatch {
|
|
121
|
+
width: 32px !important;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
& .emoji-mart-skin-swatch {
|
|
126
|
+
height: 32px !important;
|
|
127
|
+
|
|
128
|
+
&.selected {
|
|
129
|
+
width: 32px !important;
|
|
130
|
+
padding: 0;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
& .emoji-mart-emoji-native span {
|
|
134
|
+
width: 20px;
|
|
135
|
+
font-size: 20px !important;
|
|
136
|
+
height: 20px;
|
|
137
|
+
display: inline-block;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
&:hover {
|
|
141
|
+
background-color: ${themeVars.badgeBgColor} !important;
|
|
142
|
+
border-radius: ${border.radius8}px !important;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
& .emoji-mart-skin-text {
|
|
146
|
+
height: auto;
|
|
147
|
+
padding: 0;
|
|
148
|
+
background-color: ${themeVars.actionMenuBg};
|
|
149
|
+
color: ${themeVars.accentTextColor};
|
|
150
|
+
border-radius: 0;
|
|
151
|
+
|
|
152
|
+
&.opened {
|
|
153
|
+
width: 98px;
|
|
154
|
+
padding-left: 8px;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
89
159
|
`;
|
|
90
160
|
|
|
91
161
|
const borderlessEmojiMartCss = css`
|
|
@@ -100,16 +170,37 @@ const hideCategoriesEmojiMartCss = css`
|
|
|
100
170
|
}
|
|
101
171
|
`;
|
|
102
172
|
|
|
103
|
-
|
|
173
|
+
const emojiMartWithShortSearchCss = css`
|
|
174
|
+
.emoji-mart-search {
|
|
175
|
+
width: 250px;
|
|
176
|
+
}
|
|
177
|
+
`;
|
|
178
|
+
|
|
179
|
+
type EmojiMartWrapperProps = React.PropsWithChildren<{
|
|
180
|
+
borderless?: boolean;
|
|
181
|
+
hideCategories?: boolean;
|
|
182
|
+
shortSearch?: boolean;
|
|
183
|
+
color?: string;
|
|
184
|
+
}>;
|
|
104
185
|
|
|
105
186
|
export const EmojiMartWrapper = forwardRef<HTMLDivElement, EmojiMartWrapperProps>(function EmojiMartWrapper(
|
|
106
|
-
{borderless, hideCategories, children},
|
|
187
|
+
{borderless, hideCategories, color, shortSearch, children},
|
|
107
188
|
ref
|
|
108
189
|
) {
|
|
190
|
+
const theme = useTheme();
|
|
191
|
+
|
|
192
|
+
const bgColor = color ? a11yColor(getOpacities(color).opacity20, theme.menuBg, 1.3) : theme.badgeBgColor;
|
|
193
|
+
|
|
109
194
|
return (
|
|
110
195
|
<div
|
|
196
|
+
style={{"--emoji-bg-color": bgColor} as CSSProperties}
|
|
111
197
|
ref={ref}
|
|
112
|
-
className={cx(
|
|
198
|
+
className={cx(
|
|
199
|
+
emojiMartCss,
|
|
200
|
+
borderless && borderlessEmojiMartCss,
|
|
201
|
+
hideCategories && hideCategoriesEmojiMartCss,
|
|
202
|
+
shortSearch && emojiMartWithShortSearchCss
|
|
203
|
+
)}
|
|
113
204
|
>
|
|
114
205
|
{children}
|
|
115
206
|
</div>
|
|
@@ -2,31 +2,44 @@ import {forwardRef} from "react";
|
|
|
2
2
|
import {useTheme, useThemeMode} from "../ThemeProvider";
|
|
3
3
|
import {EmojiMartWrapper, Picker, PickerProps, backgroundImageFn} from "./emoji-mart";
|
|
4
4
|
import {alignTheme} from "../theme-settings";
|
|
5
|
+
import {$TSFixMe} from "../tsfixme";
|
|
6
|
+
import {ColorPicker} from "../ColorPicker";
|
|
7
|
+
import {cardTypeColors} from "../designSystem";
|
|
5
8
|
|
|
6
9
|
export type EmojiPickerProps = {
|
|
7
10
|
borderless?: boolean;
|
|
11
|
+
color?: string;
|
|
12
|
+
colors?: string[];
|
|
13
|
+
onColorSelect?: (c: $TSFixMe) => void;
|
|
8
14
|
} & PickerProps;
|
|
9
15
|
|
|
16
|
+
const i18n = {search: "Search emoji..."};
|
|
17
|
+
|
|
10
18
|
export const EmojiPicker = forwardRef<HTMLDivElement, EmojiPickerProps>(function EmojiPickerComponent(
|
|
11
|
-
{borderless = true, ...pickerProps},
|
|
19
|
+
{borderless = true, color, colors = cardTypeColors, onColorSelect, showSkinTones = true, ...pickerProps},
|
|
12
20
|
ref
|
|
13
21
|
) {
|
|
14
22
|
const themeMode = useThemeMode();
|
|
15
23
|
const theme = useTheme();
|
|
16
24
|
|
|
17
25
|
return (
|
|
18
|
-
<EmojiMartWrapper ref={ref} borderless={borderless}>
|
|
26
|
+
<EmojiMartWrapper ref={ref} color={color} borderless={borderless} hideCategories shortSearch={showSkinTones}>
|
|
19
27
|
<Picker
|
|
20
28
|
theme={alignTheme(themeMode)}
|
|
21
29
|
backgroundImageFn={backgroundImageFn}
|
|
22
30
|
native
|
|
23
31
|
title={""}
|
|
24
32
|
showPreview={false}
|
|
33
|
+
showSkinTones={showSkinTones}
|
|
34
|
+
skinEmoji="hand"
|
|
25
35
|
color={theme.primary}
|
|
26
36
|
emoji=""
|
|
27
|
-
emojiSize={
|
|
37
|
+
emojiSize={20}
|
|
38
|
+
emojiTooltip
|
|
39
|
+
i18n={i18n}
|
|
28
40
|
{...pickerProps}
|
|
29
41
|
/>
|
|
42
|
+
{onColorSelect ? <ColorPicker colors={colors} color={color} onChangeComplete={onColorSelect} /> : null}
|
|
30
43
|
</EmojiMartWrapper>
|
|
31
44
|
);
|
|
32
45
|
});
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {css} from "@linaria/core";
|
|
2
|
+
import {Button} from "../Button";
|
|
2
3
|
import {AntTabs} from "../antd";
|
|
3
|
-
import {AppIconPicker, AppIconPickerProps} from "./app-icon-picker";
|
|
4
4
|
import {space, textStyles} from "../designSystem";
|
|
5
|
+
import {$TSFixMe} from "../tsfixme";
|
|
6
|
+
import {AppIconPicker, AppIconPickerProps} from "./app-icon-picker";
|
|
5
7
|
import {EmojiPicker, EmojiPickerProps} from "./emoji-picker";
|
|
6
|
-
import {Button} from "../Button";
|
|
7
8
|
|
|
8
9
|
const TabHeader: React.FC<React.PropsWithChildren> = ({children}) => (
|
|
9
10
|
<div
|
|
@@ -18,36 +19,43 @@ const TabHeader: React.FC<React.PropsWithChildren> = ({children}) => (
|
|
|
18
19
|
type IconEmojiPickerProps = React.PropsWithChildren<{
|
|
19
20
|
onIconSelect: NonNullable<AppIconPickerProps["onSelect"]>;
|
|
20
21
|
onEmojiSelect: NonNullable<EmojiPickerProps["onSelect"]>;
|
|
22
|
+
onColorSelect?: (c: $TSFixMe) => void;
|
|
21
23
|
onReset?: () => void;
|
|
22
24
|
resetLabel?: string;
|
|
25
|
+
defaultTab?: "icons" | "emojis";
|
|
26
|
+
color?: string;
|
|
23
27
|
}>;
|
|
24
28
|
export const IconEmojiPicker: React.FC<IconEmojiPickerProps> = ({
|
|
25
29
|
onIconSelect,
|
|
26
30
|
onEmojiSelect,
|
|
31
|
+
onColorSelect,
|
|
32
|
+
defaultTab,
|
|
27
33
|
onReset,
|
|
28
34
|
resetLabel = "Reset",
|
|
35
|
+
color,
|
|
29
36
|
}) => {
|
|
30
37
|
return (
|
|
31
38
|
<AntTabs
|
|
32
39
|
animated={false}
|
|
33
40
|
destroyInactiveTabPane
|
|
41
|
+
defaultActiveKey={defaultTab}
|
|
34
42
|
items={[
|
|
35
43
|
{
|
|
36
|
-
key: "
|
|
44
|
+
key: "icons",
|
|
37
45
|
label: <TabHeader>Icons</TabHeader>,
|
|
38
|
-
children: <AppIconPicker onSelect={onIconSelect} />,
|
|
46
|
+
children: <AppIconPicker color={color} onColorSelect={onColorSelect} onSelect={onIconSelect} />,
|
|
39
47
|
},
|
|
40
48
|
{
|
|
41
|
-
key: "
|
|
49
|
+
key: "emojis",
|
|
42
50
|
label: <TabHeader>Emojis</TabHeader>,
|
|
43
|
-
children: <EmojiPicker onSelect={onEmojiSelect} />,
|
|
51
|
+
children: <EmojiPicker color={color} onColorSelect={onColorSelect} onSelect={onEmojiSelect} />,
|
|
44
52
|
},
|
|
45
53
|
]}
|
|
46
54
|
tabBarExtraContent={
|
|
47
55
|
onReset ? (
|
|
48
56
|
<div
|
|
49
57
|
className={css`
|
|
50
|
-
padding-right: ${space.
|
|
58
|
+
padding-right: ${space.l}px;
|
|
51
59
|
`}
|
|
52
60
|
>
|
|
53
61
|
<Button size={":button-size/small"} onClick={onReset}>
|