@fibery/ui-kit 1.13.0 → 1.15.0

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.
Files changed (53) hide show
  1. package/package.json +7 -9
  2. package/src/antd/styles.ts +20 -3
  3. package/src/designSystem.ts +14 -11
  4. package/src/emoji-picker/app-icon-picker.tsx +54 -0
  5. package/src/emoji-picker/emoji-index.ts +8 -0
  6. package/src/emoji-picker/emoji-picker.tsx +77 -0
  7. package/src/emoji-picker/emoji.tsx +8 -0
  8. package/src/{emoji-mart → emoji-picker}/icon-emoji-picker.tsx +39 -17
  9. package/src/emoji-picker/index.tsx +5 -0
  10. package/src/emoji-picker/primitives/category.tsx +120 -0
  11. package/src/emoji-picker/primitives/content.tsx +48 -0
  12. package/src/emoji-picker/primitives/emoji.tsx +131 -0
  13. package/src/emoji-picker/primitives/footer.tsx +12 -0
  14. package/src/emoji-picker/primitives/grid.tsx +67 -0
  15. package/src/emoji-picker/primitives/header.tsx +11 -0
  16. package/src/emoji-picker/primitives/layout.ts +5 -0
  17. package/src/emoji-picker/primitives/root.tsx +89 -0
  18. package/src/emoji-picker/primitives/search-provider.tsx +22 -0
  19. package/src/emoji-picker/primitives/search.tsx +141 -0
  20. package/src/emoji-picker/primitives/skin-provider.tsx +27 -0
  21. package/src/emoji-picker/primitives/skin-tone.tsx +103 -0
  22. package/src/emoji-picker/stores/emoji-data-store.tsx +50 -0
  23. package/src/emoji-picker/stores/lazy-emoji-data-store.tsx +29 -0
  24. package/src/emoji-picker/stores/lazy-icon-data-store.tsx +55 -0
  25. package/src/emoji-picker/stores/static-emoji-data-store.tsx +16 -0
  26. package/src/emoji-picker/utils/emoji-set.ts +5 -0
  27. package/src/{emoji-mart → emoji-picker/utils}/emoji-support.ts +6 -10
  28. package/src/emoji-picker/utils/frequently.ts +82 -0
  29. package/src/emoji-picker/utils/load-emoji-data.ts +4 -0
  30. package/src/emoji-picker/utils/store.ts +40 -0
  31. package/src/icons/ast/AddAfter.ts +8 -0
  32. package/src/icons/ast/AddBefore.ts +8 -0
  33. package/src/icons/ast/ArrowBarLeft.ts +8 -0
  34. package/src/icons/ast/ArrowBarRight.ts +8 -0
  35. package/src/icons/ast/Columns2.ts +8 -0
  36. package/src/icons/ast/Columns4.ts +8 -0
  37. package/src/icons/ast/LineDivider.ts +8 -0
  38. package/src/icons/ast/index.tsx +7 -0
  39. package/src/icons/react/AddAfter.tsx +12 -0
  40. package/src/icons/react/AddBefore.tsx +12 -0
  41. package/src/icons/react/ArrowBarLeft.tsx +12 -0
  42. package/src/icons/react/ArrowBarRight.tsx +12 -0
  43. package/src/icons/react/Columns2.tsx +12 -0
  44. package/src/icons/react/Columns4.tsx +12 -0
  45. package/src/icons/react/LineDivider.tsx +12 -0
  46. package/src/icons/react/index.tsx +7 -0
  47. package/src/emoji-mart/app-icon-picker.tsx +0 -68
  48. package/src/emoji-mart/data/get-data.tsx +0 -58
  49. package/src/emoji-mart/emoji/emoji.tsx +0 -26
  50. package/src/emoji-mart/emoji/index.tsx +0 -24
  51. package/src/emoji-mart/emoji-index.ts +0 -5
  52. package/src/emoji-mart/emoji-mart.tsx +0 -216
  53. package/src/emoji-mart/emoji-picker.tsx +0 -78
@@ -1,5 +0,0 @@
1
- import {NimbleEmojiIndex} from "@fibery/emoji-data";
2
-
3
- import data from "@fibery/emoji-data/data/all.json";
4
-
5
- export const emojiIndex = new NimbleEmojiIndex(data);
@@ -1,216 +0,0 @@
1
- import {CSSProperties, css, cx} from "@linaria/core";
2
- import "emoji-mart/css/emoji-mart.css";
3
- import {forwardRef} from "react";
4
- import {useTheme, useThemeMode} from "../ThemeProvider";
5
- import {border, fontFamily, space, textStyles, themeVars} from "../designSystem";
6
-
7
- import {NimblePickerProps, NimblePicker as Picker} from "emoji-mart";
8
- import {alignTheme} from "../theme-settings";
9
-
10
- export type {BaseEmoji, EmojiSkin, NimblePickerProps} from "emoji-mart";
11
-
12
- export const NimblePicker = (props: NimblePickerProps) => {
13
- const themeMode = useThemeMode();
14
- const theme = useTheme();
15
-
16
- return (
17
- <Picker
18
- theme={alignTheme(themeMode)}
19
- title={""}
20
- showPreview={false}
21
- skinEmoji="hand"
22
- color={theme.primary}
23
- emoji=""
24
- emojiSize={20}
25
- emojiTooltip
26
- {...props}
27
- />
28
- );
29
- };
30
-
31
- const emojiMartCss = css`
32
- padding: 0 ${space.l}px;
33
- position: relative;
34
-
35
- .emoji-mart {
36
- font-family: ${fontFamily};
37
- background-color: ${themeVars.actionMenuBg};
38
- margin-top: ${space.xxs}px;
39
- display: block;
40
- width: 288px !important;
41
-
42
- + * {
43
- border-top: 1px solid ${themeVars.separatorColor};
44
- }
45
- }
46
-
47
- .emoji-mart-bar {
48
- border-bottom: 1px solid ${themeVars.separatorColor};
49
-
50
- &:last-child {
51
- border: 0;
52
- }
53
- }
54
-
55
- .emoji-mart-search {
56
- padding-bottom: ${space.s}px;
57
- padding-left: 0;
58
- padding-right: 0;
59
-
60
- & input {
61
- ${textStyles.regular}
62
- background-color: ${themeVars.inputBgColor};
63
- color: ${themeVars.textColor};
64
- box-shadow: ${themeVars.inputBorderColor};
65
- height: 32px;
66
- border: 0;
67
- }
68
-
69
- & .emoji-mart-search-icon {
70
- top: 5px;
71
- right: 4px;
72
- }
73
- }
74
-
75
- .emoji-mart-scroll {
76
- padding-left: 0;
77
- padding-right: 0;
78
- height: 238px;
79
- }
80
-
81
- .emoji-anchor-bar {
82
- height: ${space.xxs}px;
83
- }
84
-
85
- .emoji-mart-category-label {
86
- & span {
87
- ${textStyles.heading6}
88
- background-color: ${themeVars.actionMenuBg};
89
- color: ${themeVars.textColor};
90
- color: ${themeVars.accentTextColor};
91
- padding-top: ${space.l}px;
92
- }
93
- }
94
-
95
- .emoji-mart-category .emoji-mart-emoji span,
96
- .emoji-mart-anchor {
97
- cursor: pointer !important;
98
- }
99
-
100
- .emoji-mart-category .emoji-mart-emoji:hover::before {
101
- background-color: var(--fibery-emoji-hover-color, ${themeVars.badgeBgColor}) !important;
102
- border-radius: ${border.radius8}px !important;
103
- }
104
- .emoji-mart-dark .emoji-mart-category-label span {
105
- background-color: ${themeVars.actionMenuBg};
106
- }
107
-
108
- .emoji-mart-skin-swatch {
109
- cursor: pointer;
110
- }
111
-
112
- .emoji-mart-preview {
113
- height: 0px;
114
- position: unset;
115
- }
116
-
117
- .emoji-mart-emoji {
118
- color: ${themeVars.textColor};
119
- /* pathetic attemts to make it a bit faster without forking */
120
- content-visibility: auto;
121
- contain-intrinsic-size: 20px;
122
- cursor: pointer;
123
- }
124
- .emoji-mart-category-list,
125
- .emoji-mart-category-list li {
126
- /* hack to maintain correct size of hidden emojis becuase of content-visibility */
127
- line-height: 0;
128
- }
129
- .emoji-mart-preview-skins {
130
- top: 16px;
131
- right: 12px !important;
132
- z-index: 2;
133
- background-color: ${themeVars.actionMenuBg};
134
-
135
- & .emoji-mart-skin-swatches {
136
- background-color: ${themeVars.actionMenuBg};
137
-
138
- &.opened {
139
- & .emoji-mart-skin-swatch {
140
- width: 32px !important;
141
- }
142
- }
143
-
144
- & .emoji-mart-skin-swatch {
145
- height: 32px !important;
146
-
147
- &.selected {
148
- width: 32px !important;
149
- padding: 0;
150
- }
151
-
152
- &:hover {
153
- background-color: ${themeVars.badgeBgColor} !important;
154
- border-radius: ${border.radius8}px !important;
155
- }
156
- }
157
- & .emoji-mart-skin-text {
158
- height: auto;
159
- padding: 0;
160
- background-color: ${themeVars.actionMenuBg};
161
- color: ${themeVars.accentTextColor};
162
- border-radius: 0;
163
-
164
- &.opened {
165
- width: 98px;
166
- padding-left: 8px;
167
- }
168
- }
169
- }
170
- }
171
- `;
172
-
173
- const borderlessEmojiMartCss = css`
174
- .emoji-mart {
175
- border-radius: 0;
176
- border: none;
177
- }
178
- `;
179
- const hideCategoriesEmojiMartCss = css`
180
- .emoji-mart-bar:first-child {
181
- display: none;
182
- }
183
- `;
184
-
185
- const emojiMartWithShortSearchCss = css`
186
- .emoji-mart-search {
187
- width: 250px;
188
- }
189
- `;
190
-
191
- type EmojiMartWrapperProps = React.PropsWithChildren<{
192
- borderless?: boolean;
193
- hideCategories?: boolean;
194
- shortSearch?: boolean;
195
- emojiHoverColor?: string;
196
- }>;
197
-
198
- export const EmojiMartWrapper = forwardRef<HTMLDivElement, EmojiMartWrapperProps>(function EmojiMartWrapper(
199
- {borderless, hideCategories, emojiHoverColor, shortSearch, children},
200
- ref
201
- ) {
202
- return (
203
- <div
204
- style={{"--fibery-emoji-hover-color": emojiHoverColor} as CSSProperties}
205
- ref={ref}
206
- className={cx(
207
- emojiMartCss,
208
- borderless && borderlessEmojiMartCss,
209
- hideCategories && hideCategoriesEmojiMartCss,
210
- shortSearch && emojiMartWithShortSearchCss
211
- )}
212
- >
213
- {children}
214
- </div>
215
- );
216
- });
@@ -1,78 +0,0 @@
1
- import {Suspense, forwardRef, lazy} from "react";
2
- import {ColorPicker} from "../ColorPicker";
3
- import {cardTypeColors} from "../designSystem";
4
- import {$TSFixMe} from "../tsfixme";
5
- import {EmojiMartWrapper, NimblePicker, NimblePickerProps} from "./emoji-mart";
6
- import {EmojiDataProps, getEmojiDataProps} from "./data/get-data";
7
-
8
- type NimblePickerWithData = Omit<NimblePickerProps, keyof EmojiDataProps>;
9
-
10
- const NimblePickerWithData = lazy(async () => {
11
- const emojiDataProps = await getEmojiDataProps();
12
-
13
- return {
14
- default: function EmojiPicker(props: NimblePickerWithData) {
15
- return <NimblePicker {...props} {...emojiDataProps} />;
16
- },
17
- };
18
- });
19
-
20
- const EmojiPickerComponent: React.FC<NimblePickerWithData> = (props) => {
21
- return (
22
- <Suspense
23
- fallback={
24
- <div
25
- className="emoji-mart"
26
- style={{
27
- height: "280px",
28
- }}
29
- />
30
- }
31
- >
32
- <NimblePickerWithData {...props} />
33
- </Suspense>
34
- );
35
- };
36
-
37
- export type EmojiPickerProps = {
38
- borderless?: boolean;
39
- color?: string;
40
- getHoverColor?: (color: string) => string | undefined;
41
- colors?: string[];
42
- onColorSelect?: (c: $TSFixMe) => void;
43
- } & NimblePickerWithData;
44
-
45
- const i18n = {search: "Search emoji..."};
46
-
47
- export const EmojiPicker = forwardRef<HTMLDivElement, EmojiPickerProps>(function EmojiPicker(
48
- {
49
- borderless = true,
50
- color,
51
- getHoverColor,
52
- colors = cardTypeColors,
53
- onColorSelect,
54
- showSkinTones = true,
55
- ...pickerProps
56
- },
57
- ref
58
- ) {
59
- return (
60
- <EmojiMartWrapper
61
- ref={ref}
62
- emojiHoverColor={color ? getHoverColor?.(color) : undefined}
63
- borderless={borderless}
64
- hideCategories
65
- shortSearch={showSkinTones}
66
- >
67
- <EmojiPickerComponent showSkinTones={showSkinTones} i18n={i18n} {...pickerProps} />
68
- {onColorSelect ? (
69
- <ColorPicker
70
- colors={colors}
71
- getSwatchHoverColor={getHoverColor}
72
- color={color}
73
- onChangeComplete={onColorSelect}
74
- />
75
- ) : null}
76
- </EmojiMartWrapper>
77
- );
78
- });