@fibery/ui-kit 1.7.7 → 1.9.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fibery/ui-kit",
3
- "version": "1.7.7",
3
+ "version": "1.9.0",
4
4
  "main": "index.ts",
5
5
  "private": false,
6
6
  "files": [
@@ -22,7 +22,10 @@
22
22
  "src/Pallete.ts",
23
23
  "src/tooltip.tsx",
24
24
  "src/BackButton.tsx",
25
- "src/Button"
25
+ "src/Button",
26
+ "src/emoji-mart.tsx",
27
+ "src/emoji-picker.tsx",
28
+ "src/app-icon-picker.tsx"
26
29
  ],
27
30
  "license": "UNLICENSED",
28
31
  "dependencies": {
@@ -58,8 +61,8 @@
58
61
  "react-windowed-select": "5.0.0",
59
62
  "screenfull": "6.0.1",
60
63
  "ua-parser-js": "0.7.24",
61
- "@fibery/helpers": "1.0.2",
62
- "@fibery/react": "1.0.0"
64
+ "@fibery/helpers": "1.0.3",
65
+ "@fibery/react": "1.0.1"
63
66
  },
64
67
  "peerDependencies": {
65
68
  "react": "^18.2.0",
@@ -31,7 +31,7 @@ const getBorderColor = ({
31
31
  if (primary) {
32
32
  return mainColor;
33
33
  }
34
- return getOpacities(mainColor).opacity15;
34
+ return getOpacities(mainColor).opacity30;
35
35
  };
36
36
 
37
37
  const getHoverBorderColor = ({
@@ -17,6 +17,9 @@ import BaseSelect, {
17
17
  SingleValueProps,
18
18
  StylesConfig,
19
19
  ActionMeta,
20
+ OnChangeValue,
21
+ PropsValue,
22
+ components as reactSelectComponents,
20
23
  } from "react-select";
21
24
  import BaseCreatableSelect, {CreatableProps} from "react-select/creatable";
22
25
  import WindowedSelect, {components, WindowedMenuList} from "react-windowed-select";
@@ -46,6 +49,8 @@ export type {
46
49
  SingleValue,
47
50
  MultiValue,
48
51
  ActionMeta,
52
+ OnChangeValue,
53
+ PropsValue,
49
54
  };
50
55
 
51
56
  function GroupHeading<
@@ -241,6 +246,7 @@ export function CreatableSelectInner<
241
246
  isCollectionMode,
242
247
  menuPortalTarget,
243
248
  styles = {},
249
+ virtualized = true,
244
250
  ...rest
245
251
  }: CreatableProps<Option, IsMulti, Group> & SelectProps<Option, IsMulti, Group>,
246
252
  ref: any
@@ -259,7 +265,7 @@ export function CreatableSelectInner<
259
265
  tabSelectsValue={false}
260
266
  components={{
261
267
  Menu,
262
- MenuList: WindowedMenuList,
268
+ MenuList: virtualized ? WindowedMenuList : reactSelectComponents.MenuList,
263
269
  DropdownIndicator,
264
270
  ClearIndicator,
265
271
  Option: OptionComponent,
@@ -14,7 +14,17 @@ import React, {
14
14
  } from "react";
15
15
  import {Popup} from "../Popup";
16
16
  import {$TSFixMe} from "../tsfixme";
17
- import {combineStyles, GroupBase, OptionsOrGroups, Select as ReactSelect, SelectProps, StylesConfig} from "./index";
17
+ import {
18
+ combineStyles,
19
+ GroupBase,
20
+ OptionsOrGroups,
21
+ Select as ReactSelect,
22
+ SelectProps,
23
+ StylesConfig,
24
+ OnChangeValue,
25
+ ActionMeta,
26
+ PropsValue,
27
+ } from "./index";
18
28
  import {SelectControlSettingsProvider} from "./select-control-settings-context";
19
29
 
20
30
  const offset = [0, space.xs] as [number, number];
@@ -102,7 +112,7 @@ type Ref = {
102
112
  };
103
113
 
104
114
  type Props<Option, IsMulti extends boolean, Group extends GroupBase<Option>> = {
105
- value?: Option;
115
+ value?: PropsValue<Option>;
106
116
  menuIsOpen?: boolean;
107
117
  autoFocus?: boolean;
108
118
  defaultMenuIsOpen?: boolean;
@@ -116,7 +126,7 @@ type Props<Option, IsMulti extends boolean, Group extends GroupBase<Option>> = {
116
126
  onFocus?: () => void;
117
127
  isCollectionMode?: IsMulti;
118
128
  isClearable?: boolean;
119
- onChange: (...arg: $TSFixMe) => void;
129
+ onChange: (newValue: OnChangeValue<Option, IsMulti>, actionMeta: ActionMeta<Option>) => void;
120
130
  onMenuOpen: () => void;
121
131
  onMenuClose: () => void | boolean;
122
132
  renderValue?: () => ReactNode;
@@ -296,11 +306,11 @@ function SelectInPopoverInner<Option, IsMulti extends boolean, Group extends Gro
296
306
  controlShouldRenderValue
297
307
  closeMenuOnScroll={false}
298
308
  closeMenuOnSelect={false}
299
- onChange={(...arg) => {
309
+ onChange={(newValue, actionMeta) => {
300
310
  if (hideOnChange) {
301
311
  onHide();
302
312
  }
303
- onChange(...arg);
313
+ onChange(newValue, actionMeta);
304
314
  }}
305
315
  placeholder={placeholder}
306
316
  onInputChange={onInputChange}
@@ -0,0 +1,50 @@
1
+ import {forwardRef, useMemo} from "react";
2
+ import {EmojiMartWrapper, NimblePicker, PickerProps} from "./emoji-mart";
3
+ import {useThemeMode} from "./ThemeProvider";
4
+ import {alignTheme} from "./theme-settings";
5
+ import appIcons from "./appIcons.json";
6
+ import {getThemedUrl} from "./AppIconWithFallback";
7
+
8
+ const EMPTY_DATA = {
9
+ aliases: {},
10
+ emojis: {},
11
+ categories: [],
12
+ compressed: false,
13
+ };
14
+
15
+ export type AppIconPickerProps = {borderless?: boolean} & PickerProps;
16
+
17
+ export const AppIconPicker = forwardRef<HTMLDivElement, AppIconPickerProps>(function AppIconPicker(
18
+ {borderless = true, ...pickerProps},
19
+ ref
20
+ ) {
21
+ const themeMode = useThemeMode();
22
+
23
+ const alignedTheme = alignTheme(themeMode);
24
+
25
+ const customIcons = useMemo(
26
+ () =>
27
+ appIcons.map((icon) => {
28
+ return {
29
+ ...icon,
30
+ imageUrl: getThemedUrl(icon.file, alignedTheme),
31
+ };
32
+ }),
33
+ [alignedTheme]
34
+ );
35
+
36
+ return (
37
+ <EmojiMartWrapper ref={ref} borderless={borderless} hideCategories>
38
+ <NimblePicker
39
+ data={EMPTY_DATA}
40
+ theme={alignedTheme}
41
+ showSkinTones={false}
42
+ showPreview={false}
43
+ title=""
44
+ custom={customIcons}
45
+ emojiSize={22}
46
+ {...pickerProps}
47
+ />
48
+ </EmojiMartWrapper>
49
+ );
50
+ });
@@ -237,8 +237,8 @@ const lightColors = {
237
237
  filterGroupBorder: blackA.blackA3,
238
238
  //end
239
239
  disabledInversedTextColor: shades.opacity25,
240
- danger: brandColors.red,
241
- active: brandColors.red,
240
+ danger: red.red9,
241
+ active: red.red9,
242
242
  warning: "#FFD41E",
243
243
  cardBg: "#FFFFFF",
244
244
  cardSelected: "#FFFB8F",
@@ -397,8 +397,8 @@ const darkColors = {
397
397
  filterGroupBorder: whiteA.whiteA3,
398
398
  //end
399
399
  disabledInversedTextColor: lights.opacity25,
400
- danger: redDark.red9,
401
- active: brandColors.red,
400
+ danger: redDark.red10,
401
+ active: redDark.red10,
402
402
  warning: "#FFD41E",
403
403
  cardBg: slateDark.slate6,
404
404
  cardSelected: slateDark.slate5,
@@ -584,16 +584,11 @@ export const colors = {
584
584
  inversedTextColor: "#FFFFFF",
585
585
  disabledInversedTextColor: lights.opacity25,
586
586
  danger: brandColors.red,
587
- active: brandColors.red,
588
- warning: "#FFD41E",
589
- cardBg: "#FFFFFF",
590
587
  cardSelected: "#FFFB8F",
591
588
  cardSelectedHover: "rgba(240, 244, 247, 0.6)",
592
- selectedImageBorder: "rgba(42, 56, 68, 0.3)",
593
589
  unitBg: "rgba(220, 224, 228, 0.33)",
594
590
  infoBox: "rgba(255, 212, 0, 0.2)",
595
591
  errorBg: "rgba(255, 241, 240, 1)",
596
- timelineScaleSelectBorderColor: chroma("#FFFFFF").alpha(opacity.opacity40).css(),
597
592
  transparent,
598
593
  shades,
599
594
  lights,
@@ -892,7 +887,7 @@ export const textStyles = {
892
887
  lineHeight: lineHeight.regular,
893
888
  fontWeight: fontWeight.regular,
894
889
  color: themeVars.textColor,
895
- border: `1px solid ${colors.active}`,
890
+ border: `1px solid ${themeVars.active}`,
896
891
  borderRadius: radius,
897
892
  },
898
893
  } as const;
@@ -0,0 +1,111 @@
1
+ import "emoji-mart/css/emoji-mart.css";
2
+ import {forwardRef} from "react";
3
+ import {border, space, textStyles, themeVars} from "./designSystem";
4
+ import {cx, css} from "@linaria/core";
5
+ import {Emoji as EmojiMartEmoji, EmojiProps} from "emoji-mart";
6
+
7
+ export {detectEmojiSupportLevel} from "./emojiSupport";
8
+ export {emojiIndex, Picker, NimblePicker} from "emoji-mart";
9
+ export type {BaseEmoji, PickerProps, EmojiSkin} from "emoji-mart";
10
+
11
+ export const backgroundImageFn = () => "https://assets-temp.fibery.io/images/emoji-datasource-apple-5_0_1-64.png";
12
+
13
+ const emojiMartCss = css`
14
+ .emoji-mart {
15
+ background-color: ${themeVars.actionMenuBg};
16
+ margin-top: ${space.xxs}px;
17
+ display: block;
18
+ }
19
+
20
+ .emoji-mart-bar {
21
+ border-bottom: 1px solid ${themeVars.separatorColor};
22
+
23
+ &:last-child {
24
+ border-top: 1px solid ${themeVars.separatorColor};
25
+ }
26
+ }
27
+
28
+ .emoji-mart-search {
29
+ padding-bottom: ${space.s}px;
30
+
31
+ & input {
32
+ ${textStyles.regular}
33
+ background-color: ${themeVars.inputBgColor};
34
+ color: ${themeVars.textColor};
35
+ box-shadow: ${themeVars.inputBorderColor};
36
+ height: 34px;
37
+ border: 0;
38
+ }
39
+ }
40
+
41
+ .emoji-anchor-bar {
42
+ height: ${space.xxs}px;
43
+ }
44
+
45
+ .emoji-mart-category-label {
46
+ & span {
47
+ ${textStyles.heading6}
48
+ background-color: ${themeVars.actionMenuBg};
49
+ color: ${themeVars.textColor};
50
+ color: ${themeVars.accentTextColor};
51
+ padding-top: ${space.l}px;
52
+ }
53
+ }
54
+
55
+ .emoji-mart-category .emoji-mart-emoji span,
56
+ .emoji-mart-anchor {
57
+ cursor: pointer !important;
58
+ }
59
+
60
+ .emoji-mart-category .emoji-mart-emoji:hover::before {
61
+ background-color: ${themeVars.badgeBgColor} !important;
62
+ border-radius: ${border.radius8}px !important;
63
+ }
64
+ .emoji-mart-dark .emoji-mart-category-label span {
65
+ background-color: ${themeVars.actionMenuBg};
66
+ }
67
+
68
+ .emoji-mart-skin-swatch {
69
+ cursor: pointer;
70
+ }
71
+
72
+ .emoji-mart-preview {
73
+ height: 50px;
74
+ }
75
+
76
+ .emoji-mart-preview-skins {
77
+ right: 15px;
78
+ }
79
+ `;
80
+
81
+ const borderlessEmojiMartCss = css`
82
+ .emoji-mart {
83
+ border-radius: 0;
84
+ border: none;
85
+ }
86
+ `;
87
+ const hideCategoriesEmojiMartCss = css`
88
+ .emoji-mart-bar:first-child {
89
+ display: none;
90
+ }
91
+ `;
92
+
93
+ type EmojiMartWrapperProps = React.PropsWithChildren<{borderless?: boolean; hideCategories?: boolean}>;
94
+
95
+ export const EmojiMartWrapper = forwardRef<HTMLDivElement, EmojiMartWrapperProps>(function EmojiMartWrapper(
96
+ {borderless, hideCategories, children},
97
+ ref
98
+ ) {
99
+ return (
100
+ <div
101
+ ref={ref}
102
+ className={cx(emojiMartCss, borderless && borderlessEmojiMartCss, hideCategories && hideCategoriesEmojiMartCss)}
103
+ >
104
+ {children}
105
+ </div>
106
+ );
107
+ });
108
+
109
+ export const Emoji: React.FC<EmojiProps> = (props) => {
110
+ return <EmojiMartEmoji backgroundImageFn={backgroundImageFn} {...props} />;
111
+ };
@@ -0,0 +1,32 @@
1
+ import {forwardRef} from "react";
2
+ import {useTheme, useThemeMode} from "./ThemeProvider";
3
+ import {EmojiMartWrapper, Picker, PickerProps, backgroundImageFn} from "./emoji-mart";
4
+ import {alignTheme} from "./theme-settings";
5
+
6
+ type EmojiPickerProps = {
7
+ borderless?: boolean;
8
+ } & PickerProps;
9
+
10
+ export const EmojiPicker = forwardRef<HTMLDivElement, EmojiPickerProps>(function EmojiPickerComponent(
11
+ {borderless = true, ...pickerProps},
12
+ ref
13
+ ) {
14
+ const themeMode = useThemeMode();
15
+ const theme = useTheme();
16
+
17
+ return (
18
+ <EmojiMartWrapper ref={ref} borderless={borderless}>
19
+ <Picker
20
+ theme={alignTheme(themeMode)}
21
+ backgroundImageFn={backgroundImageFn}
22
+ native
23
+ title={""}
24
+ showPreview={false}
25
+ color={theme.primary}
26
+ emoji=""
27
+ emojiSize={22}
28
+ {...pickerProps}
29
+ />
30
+ </EmojiMartWrapper>
31
+ );
32
+ });
@@ -0,0 +1,8 @@
1
+
2
+ // This icon file is generated automatically.
3
+
4
+ import { IconDefinition } from '../types';
5
+
6
+ const FiberyMono: IconDefinition = {"icon":{"type":"root","children":[{"type":"element","tagName":"svg","properties":{"viewBox":"0 0 20 20"},"children":[{"type":"element","tagName":"path","properties":{"d":"M16.735 6.544a1.788 1.788 0 0 1 .644 2.112 1.764 1.764 0 0 1-.758.888l-9.98 5.826a1.733 1.733 0 0 1-2.16-.328 1.778 1.778 0 0 1-.161-2.201l6.493-9.628a1.734 1.734 0 0 1 2.387-.407 1.786 1.786 0 0 1 .504 2.394l-3.74 5.557 3.519-4.354 2.135-.162c.396-.03.79.077 1.117.303ZM9.575 4.64l-1.15-1.252a1.733 1.733 0 0 0-2.157-.329c-.343.2-.609.513-.753.886-.145.373-.16.785-.044 1.168l.45 1.477 1.41.28-3.22.242a1.74 1.74 0 0 0-1.056.471 1.785 1.785 0 0 0-.318 2.181c.199.346.508.614.877.76l1.54.61 4.42-6.494Zm5.584 6.086-6.777 3.93.482 1.592c.137.45.445.826.856 1.046.411.22.892.266 1.337.128a1.76 1.76 0 0 0 1.034-.866c.218-.415.263-.902.127-1.351l-.288-.944-1.078-.866 3.497 1.386c.368.144.775.157 1.152.038a1.75 1.75 0 0 0 .926-.694 1.784 1.784 0 0 0-.162-2.195l-1.106-1.204Z"},"children":[]}],"metadata":""}]},"name":"fibery-mono"};
7
+
8
+ export default FiberyMono;
@@ -0,0 +1,8 @@
1
+
2
+ // This icon file is generated automatically.
3
+
4
+ import { IconDefinition } from '../types';
5
+
6
+ const RicheditorBlockCallout: IconDefinition = {"icon":{"type":"root","children":[{"type":"element","tagName":"svg","properties":{"viewBox":"0 0 20 20"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","clipRule":"evenodd","d":"M4 4a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2H4Zm12 1.5H4a.5.5 0 0 0-.5.5v8a.5.5 0 0 0 .5.5h12a.5.5 0 0 0 .5-.5V6a.5.5 0 0 0-.5-.5ZM7.473 10H5.548C5.215 10 5 9.793 5 9.467V7.543C5 7.207 5.204 7 5.548 7h1.925c.323 0 .527.207.527.543v1.924c0 .326-.215.533-.527.533Z"},"children":[]}],"metadata":""}]},"name":"richeditor-block-callout"};
7
+
8
+ export default RicheditorBlockCallout;
@@ -56,6 +56,7 @@ export { default as ExtensionWorkflow } from './ExtensionWorkflow';
56
56
  export { default as FavoritesChecked } from './FavoritesChecked';
57
57
  export { default as FavoritesMenu } from './FavoritesMenu';
58
58
  export { default as Favorites } from './Favorites';
59
+ export { default as FiberyMono } from './FiberyMono';
59
60
  export { default as Fields } from './Fields';
60
61
  export { default as FileUpload } from './FileUpload';
61
62
  export { default as Filter } from './Filter';
@@ -100,6 +101,7 @@ export { default as Remove } from './Remove';
100
101
  export { default as Reply } from './Reply';
101
102
  export { default as Restore } from './Restore';
102
103
  export { default as RicheditorActionsMore } from './RicheditorActionsMore';
104
+ export { default as RicheditorBlockCallout } from './RicheditorBlockCallout';
103
105
  export { default as RicheditorBlockCode } from './RicheditorBlockCode';
104
106
  export { default as RicheditorBlockEntity } from './RicheditorBlockEntity';
105
107
  export { default as RicheditorBlockFile } from './RicheditorBlockFile';
@@ -0,0 +1,12 @@
1
+ // This icon file is generated automatically.
2
+
3
+ import FiberyMonoSvg from '../ast/FiberyMono';
4
+ import { Icon } from '../Icon';
5
+ import { IconBaseProps } from '../types';
6
+
7
+ const FiberyMono = (
8
+ props: IconBaseProps,
9
+ ): JSX.Element => <Icon {...props} icon={FiberyMonoSvg} />;
10
+
11
+ FiberyMono.displayName = 'FiberyMono';
12
+ export default FiberyMono;
@@ -0,0 +1,12 @@
1
+ // This icon file is generated automatically.
2
+
3
+ import RicheditorBlockCalloutSvg from '../ast/RicheditorBlockCallout';
4
+ import { Icon } from '../Icon';
5
+ import { IconBaseProps } from '../types';
6
+
7
+ const RicheditorBlockCallout = (
8
+ props: IconBaseProps,
9
+ ): JSX.Element => <Icon {...props} icon={RicheditorBlockCalloutSvg} />;
10
+
11
+ RicheditorBlockCallout.displayName = 'RicheditorBlockCallout';
12
+ export default RicheditorBlockCallout;
@@ -56,6 +56,7 @@ export { default as ExtensionWorkflow } from './ExtensionWorkflow';
56
56
  export { default as FavoritesChecked } from './FavoritesChecked';
57
57
  export { default as FavoritesMenu } from './FavoritesMenu';
58
58
  export { default as Favorites } from './Favorites';
59
+ export { default as FiberyMono } from './FiberyMono';
59
60
  export { default as Fields } from './Fields';
60
61
  export { default as FileUpload } from './FileUpload';
61
62
  export { default as Filter } from './Filter';
@@ -100,6 +101,7 @@ export { default as Remove } from './Remove';
100
101
  export { default as Reply } from './Reply';
101
102
  export { default as Restore } from './Restore';
102
103
  export { default as RicheditorActionsMore } from './RicheditorActionsMore';
104
+ export { default as RicheditorBlockCallout } from './RicheditorBlockCallout';
103
105
  export { default as RicheditorBlockCode } from './RicheditorBlockCode';
104
106
  export { default as RicheditorBlockEntity } from './RicheditorBlockEntity';
105
107
  export { default as RicheditorBlockFile } from './RicheditorBlockFile';