@fibery/ui-kit 1.16.0 → 1.17.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.16.0",
3
+ "version": "1.17.1",
4
4
  "main": "index.ts",
5
5
  "private": false,
6
6
  "files": [
@@ -28,7 +28,6 @@
28
28
  ],
29
29
  "license": "UNLICENSED",
30
30
  "dependencies": {
31
- "react-intersection-observer": "9.3.5",
32
31
  "@linaria/core": "3.0.0-beta.15",
33
32
  "@linaria/react": "3.0.0-beta.15",
34
33
  "@popperjs/core": "2.11.6",
@@ -41,6 +40,7 @@
41
40
  "chroma-js": "2.1.2",
42
41
  "chrono-node": "^2.4.1",
43
42
  "classnames": "2.3.1",
43
+ "cmdk": "0.2.0",
44
44
  "color-hash": "1.0.3",
45
45
  "d3-shape": "1.3.7",
46
46
  "date-fns": "^2.29.2",
@@ -54,15 +54,16 @@
54
54
  "rc-progress": "3.4.1",
55
55
  "react-color": "2.19.3",
56
56
  "react-day-picker": "8.1.4",
57
+ "react-intersection-observer": "9.3.5",
57
58
  "react-popper": "2.3.0",
58
59
  "react-select": "5.3.2",
59
60
  "react-select-country-list": "2.2.1",
60
61
  "react-windowed-select": "5.0.0",
61
62
  "screenfull": "6.0.1",
62
63
  "ua-parser-js": "0.7.24",
64
+ "@fibery/emoji-data": "2.1.1",
63
65
  "@fibery/helpers": "1.1.0",
64
- "@fibery/react": "1.0.3",
65
- "@fibery/emoji-data": "2.1.1"
66
+ "@fibery/react": "1.0.3"
66
67
  },
67
68
  "peerDependencies": {
68
69
  "react": "^18.2.0",
@@ -92,7 +93,7 @@
92
93
  "react-dom": "18.2.0",
93
94
  "svg-parser": "2.0.4",
94
95
  "svgo": "2.8.0",
95
- "typescript": "5.0.3",
96
+ "typescript": "5.1.6",
96
97
  "unist-util-reduce": "0.2.2",
97
98
  "@fibery/babel-preset": "7.2.0",
98
99
  "@fibery/eslint-config": "8.3.0"
@@ -0,0 +1,13 @@
1
+ import {IconButton, IconButtonProps} from "./icon-button";
2
+ import MoreCompactIcon from "../icons/react/MoreCompact";
3
+ import {forwardRef} from "react";
4
+
5
+ export const ActionsButtonCompact = forwardRef<HTMLButtonElement, IconButtonProps>(
6
+ function ActionsButtonCompactComponent({...rest}, ref) {
7
+ return (
8
+ <IconButton ref={ref} size="small" {...rest}>
9
+ <MoreCompactIcon iconSize={18} containerSize={20} />
10
+ </IconButton>
11
+ );
12
+ }
13
+ );
@@ -0,0 +1,30 @@
1
+ import {IconButton, IconButtonProps} from "./icon-button";
2
+ import MoreCompact from "../icons/react/MoreCompact";
3
+ import {forwardRef} from "react";
4
+ import {css} from "@linaria/core";
5
+ import {border, themeVars} from "../designSystem";
6
+
7
+ export const ActionsButton = forwardRef<HTMLButtonElement, IconButtonProps>(function ActionsButtonComponent(
8
+ {...rest},
9
+ ref
10
+ ) {
11
+ return (
12
+ <IconButton ref={ref} size="normal" {...rest}>
13
+ <MoreCompact iconSize={18} containerSize={20} />
14
+ </IconButton>
15
+ );
16
+ });
17
+
18
+ // TODO: Shoud be a variant inside button?
19
+ export const actionButtonInlineStyle = css`
20
+ background-color: ${themeVars.actionMenuButtonColor};
21
+ box-shadow: ${themeVars.entityCardShadow};
22
+ border-radius: ${border.radius6};
23
+
24
+ .Button:hover {
25
+ background-color: ${themeVars.actionMenuButtonHoverColor} !important;
26
+ }
27
+ .Button:focus {
28
+ background-color: ${themeVars.actionMenuButtonHoverColor} !important;
29
+ }
30
+ `;
@@ -143,14 +143,13 @@ const StyledButtonBase = styled.button<StyledProps>`
143
143
  `;
144
144
 
145
145
  export type ButtonBaseProps = {
146
- dataId?: string;
147
146
  color?: string;
148
147
  primary?: boolean;
149
148
  dangerous?: boolean;
150
149
  borderless?: boolean;
151
150
  } & ComponentPropsWithoutRef<"button">;
152
151
  export const ButtonBase = forwardRef<HTMLButtonElement, ButtonBaseProps>(function ButtonBase(
153
- {primary, color, borderless, dangerous, className, type = "button", dataId, ...buttonProps},
152
+ {primary, color, borderless, dangerous, className, type = "button", ...buttonProps},
154
153
  ref
155
154
  ) {
156
155
  const theme = useTheme();
@@ -177,14 +176,5 @@ export const ButtonBase = forwardRef<HTMLButtonElement, ButtonBaseProps>(functio
177
176
  borderWidth,
178
177
  };
179
178
 
180
- return (
181
- <StyledButtonBase
182
- ref={ref}
183
- type={type}
184
- className={className}
185
- data-testid={dataId}
186
- {...styledProps}
187
- {...buttonProps}
188
- />
189
- );
179
+ return <StyledButtonBase ref={ref} type={type} className={className} {...styledProps} {...buttonProps} />;
190
180
  });
@@ -4,14 +4,12 @@ import {styled} from "@linaria/react";
4
4
  import cx from "classnames";
5
5
  import _ from "lodash";
6
6
  import React, {forwardRef} from "react";
7
- import {ButtonBase, ButtonBaseProps, buttonBorderWidth, getMainColor, getTextColor} from "./button-base";
7
+ import {Item} from "../Item";
8
+ import {useTheme} from "../ThemeProvider";
8
9
  import {border, colors, getOpacities, opacity, space, textStyles} from "../designSystem";
9
- import MoreIcon from "../icons/react/More";
10
- import MoreCompactIcon from "../icons/react/MoreCompact";
11
10
  import {IconBaseProps} from "../icons/types";
12
- import {Item} from "../Item";
13
11
  import {Spinner} from "../loaders";
14
- import {useTheme} from "../ThemeProvider";
12
+ import {ButtonBase, ButtonBaseProps, buttonBorderWidth, getMainColor, getTextColor} from "./button-base";
15
13
 
16
14
  type PositionInGroup = "first" | "middle" | "last";
17
15
 
@@ -218,32 +216,3 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button
218
216
  </StyledButton>
219
217
  );
220
218
  });
221
-
222
- // TODO can be inlined
223
- export function ActionsButton({
224
- onClick,
225
- label = ``,
226
- disabled,
227
- }: {
228
- onClick: ButtonProps["onClick"];
229
- label?: string;
230
- disabled?: boolean;
231
- }) {
232
- return <Button Icon={MoreIcon} onClick={onClick} borderless aria-label={label} disabled={disabled} />;
233
- }
234
-
235
- export const ActionsButtonCompact = forwardRef<HTMLButtonElement, ButtonProps & {inverted?: boolean}>(
236
- ({inverted, ...rest}, ref) => {
237
- const theme = useTheme();
238
- return (
239
- <Button
240
- ref={ref}
241
- size={":button-size/small"}
242
- Icon={MoreCompactIcon}
243
- color={inverted ? colors.inversedTextColor : theme.buttonColor}
244
- borderless
245
- {...rest}
246
- />
247
- );
248
- }
249
- );
@@ -28,6 +28,9 @@ export function DropdownIndicator<
28
28
  IsMulti extends boolean = boolean,
29
29
  Group extends GroupBase<TOption> = GroupBase<TOption>
30
30
  >(props: DropdownIndicatorProps<TOption, IsMulti, Group>) {
31
+ if (props.selectProps.isDisabled) {
32
+ return null;
33
+ }
31
34
  return (
32
35
  <div className={cn(expanderStyle, props.selectProps.menuIsOpen && expanderExpandedStyle)}>
33
36
  <ArrowCollapseVertical color={themeVars.disabledTextColor} />
@@ -43,6 +46,9 @@ export function ClearIndicator<
43
46
  innerProps,
44
47
  selectProps,
45
48
  }: ClearIndicatorProps<TOption, IsMulti, Group> | MultiValueRemoveProps<TOption, IsMulti, Group>) {
49
+ if (selectProps.isDisabled) {
50
+ return null;
51
+ }
46
52
  return (
47
53
  <div {...innerProps}>
48
54
  <Button borderless Icon={RemoveIcon} disabled={selectProps.isDisabled} size={":button-size/super-small"} />
@@ -165,10 +165,15 @@ export const componentsStyles: StylesConfig = {
165
165
  cursor: state.isDisabled ? "not-allowed" : "default",
166
166
  }),
167
167
  indicatorSeparator: () => ({}),
168
- input: (provided) => ({
169
- ...provided,
170
- color: themeVars.textColor,
171
- }),
168
+ input: (provided, state) => {
169
+ if (state.isDisabled) {
170
+ return {display: "none"};
171
+ }
172
+ return {
173
+ ...provided,
174
+ color: themeVars.textColor,
175
+ };
176
+ },
172
177
  };
173
178
 
174
179
  export const singleLineComponentsStyle: StylesConfig = {
@@ -47,7 +47,7 @@ export const inputOverrides = {
47
47
  transition: `box-shadow ${transition}`,
48
48
  },
49
49
  disabled: {
50
- color: `${themeVars.accentTextColor}`,
50
+ color: `${themeVars.textColor}`,
51
51
  backgroundColor: `${themeVars.inputDisabledBgColor} !important`,
52
52
  borderColor: colors.transparent,
53
53
  boxShadow: `${themeVars.inputDisabledBorderColor} !important`,
@@ -61,7 +61,7 @@ const makeChromaColor = (color: string) => {
61
61
  try {
62
62
  return chroma(color);
63
63
  } catch (e) {
64
- return chroma(brandColors.green);
64
+ return chroma(brandColors.blue);
65
65
  }
66
66
  };
67
67
 
@@ -103,7 +103,7 @@ const brandColors = {
103
103
  } as const;
104
104
 
105
105
  export const getDarkenColor = _.memoize((color: string): string => {
106
- return makeChromaColor(color).darken(0.4).css();
106
+ return makeChromaColor(color).darken(0.6).css();
107
107
  });
108
108
 
109
109
  const lightColors = {
@@ -372,7 +372,7 @@ const darkColors = {
372
372
  }`,
373
373
  separatorColor: getOpacities(slateDark.slate8).opacity50,
374
374
  separatorBreadcrumbsColor: slateDark.slate8,
375
- iconColor: slate.slate9,
375
+ iconColor: slateDark.slate10,
376
376
  appIconColor: getOpacities(slate.slate2).opacity70,
377
377
  mentionBgColor: slateDark.slate5,
378
378
  entityCardBgColor: slateDark.slate5,
@@ -583,11 +583,7 @@ export const getThemeColors: (themeColor: string, theme: ThemeMode) => ThemeColo
583
583
  );
584
584
 
585
585
  export const getTextColor = _.memoize((color: string): string => {
586
- return makeChromaColor(color).luminance() > 0.45 ? makeChromaColor(color).luminance(0.1).saturate(3).hex() : "white";
587
- });
588
-
589
- export const getBrightenColor = _.memoize((color: string): string => {
590
- return makeChromaColor(color).brighten(0.15).hex();
586
+ return makeChromaColor(color).hex();
591
587
  });
592
588
 
593
589
  export const getLinkedHighlightBackgroundColor = _.memoize(
@@ -773,7 +769,7 @@ export const getObjectColorMemoized = _.memoize((name) => {
773
769
  return "#999999";
774
770
  }
775
771
  const colorHash = new ColorHash({
776
- lightness: [0.4, 0.5, 0.6],
772
+ lightness: [0.5, 0.6, 0.7],
777
773
  saturation: [0.6, 0.7, 0.8, 0.9, 1],
778
774
  });
779
775
  return colorHash.hex(name);
@@ -11,6 +11,7 @@ import {$TSFixMe} from "../tsfixme";
11
11
  import {EmojiPickerGrid, EmojiPickerGridProps} from "./primitives/grid";
12
12
  import {EmojiPickerHeader} from "./primitives/header";
13
13
  import {EmojiPickerSearch} from "./primitives/search";
14
+ import {Tooltip} from "../tooltip";
14
15
 
15
16
  const colorPickerWrapperCss = css`
16
17
  padding-top: ${space.l}px;
@@ -28,20 +29,22 @@ const ColorPickerCollapsibleTrigger: React.FC<ColorPickerCollapsibleTrigger> = (
28
29
 
29
30
  const Icon = opened ? ColorCodingFilled : ColorCoding;
30
31
 
31
- const label = opened ? "Close color picker" : "Open color picker";
32
+ const label = opened ? "Hide color picker" : "Show color picker";
32
33
 
33
34
  return (
34
35
  <CollapsibleTrigger asChild>
35
- <IconButton
36
- aria-label={label}
37
- size="big"
38
- className={css`
39
- border-top-left-radius: 0;
40
- border-bottom-left-radius: 0;
41
- `}
42
- >
43
- <Icon color={iconColor} iconSize={18} containerSize={20} />
44
- </IconButton>
36
+ <Tooltip title={label}>
37
+ <IconButton
38
+ data-testid="emoji-picker-color-trigger"
39
+ size="big"
40
+ className={css`
41
+ border-top-left-radius: 0;
42
+ border-bottom-left-radius: 0;
43
+ `}
44
+ >
45
+ <Icon color={iconColor} iconSize={18} containerSize={20} />
46
+ </IconButton>
47
+ </Tooltip>
45
48
  </CollapsibleTrigger>
46
49
  );
47
50
  };
@@ -74,7 +74,7 @@ const CategoryItem: React.FC<CategoryItemProps> = ({id, renderEmoji}) => {
74
74
  const emojiPickerCtx = useEmojiPickerCtx();
75
75
  const emojiContentSettings = useEmojiPickerContentSettings();
76
76
 
77
- const emoji = useEmojiDataStoreSelector((store) => store.get(id));
77
+ const emoji = useEmojiDataStoreSelector((store) => store.get(id, {skin}));
78
78
 
79
79
  if (!emoji) {
80
80
  return null;
@@ -1,3 +1,4 @@
1
+ import {FC} from "react";
1
2
  import {EmojiItem, EmojiSkin} from "@fibery/emoji-data";
2
3
  import {css, cx} from "@linaria/core";
3
4
  import {themeVars} from "../../designSystem";
@@ -41,12 +42,14 @@ export type EmojiProps = {
41
42
  skin?: EmojiSkin;
42
43
  /** render emoji as native unicode if possible */
43
44
  native?: boolean;
45
+ fallback?: "shortcode" | "hidden";
44
46
  };
45
- export const Emoji: React.FC<EmojiProps> = ({emoji: idOrColons, size, version = 14, skin, native}) => {
47
+
48
+ export const Emoji: FC<EmojiProps> = ({emoji: idOrColons, size, version = 14, fallback = "hidden", skin, native}) => {
46
49
  const emoji = useEmojiDataStoreSelector((store) => store.get(idOrColons, {skin}));
47
50
 
48
51
  if (!emoji) {
49
- return null;
52
+ return fallback === "shortcode" ? <>{idOrColons}</> : null;
50
53
  }
51
54
 
52
55
  let emojiNode: React.ReactNode;
@@ -45,17 +45,19 @@ const AllCategories: React.FC<AllCategoriesProps> = ({renderEmoji, scrollParent}
45
45
  renderEmoji={renderEmoji}
46
46
  />
47
47
  ) : null}
48
- {categories.map((category, idx) => {
49
- return (
50
- <EmojiPickerCategory
51
- preRender={idx < 2}
52
- key={category.id}
53
- category={category}
54
- scrollParent={scrollParent}
55
- renderEmoji={renderEmoji}
56
- />
57
- );
58
- })}
48
+ {categories
49
+ .filter((category) => category.emojis.length !== 0)
50
+ .map((category, idx) => {
51
+ return (
52
+ <EmojiPickerCategory
53
+ preRender={idx < 2}
54
+ key={category.id}
55
+ category={category}
56
+ scrollParent={scrollParent}
57
+ renderEmoji={renderEmoji}
58
+ />
59
+ );
60
+ })}
59
61
  </>
60
62
  );
61
63
  };
@@ -3,6 +3,6 @@
3
3
 
4
4
  import { IconDefinition } from '../types';
5
5
 
6
- const AppDetails: 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":{"d":"M2.545 6.455c0-.452.367-.819.819-.819H5v1.637H3.364a.818.818 0 0 1-.819-.818ZM17.5 6.455a.818.818 0 0 1-.818.818h-5.136V5.636h5.136c.452 0 .818.367.818.819Z"},"children":[]},{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","clipRule":"evenodd","d":"M8.273 8.91a2.454 2.454 0 1 1 0-4.91 2.454 2.454 0 0 1 0 4.91Zm-.818-2.455a.818.818 0 1 0 1.636 0 .818.818 0 0 0-1.636 0Z"},"children":[]},{"type":"element","tagName":"path","properties":{"d":"M17.5 13.286a.818.818 0 0 1-.818.818h-1.636v-1.636h1.636c.452 0 .818.366.818.818ZM2.682 13.286c0-.452.366-.819.818-.819h5v1.637h-5a.818.818 0 0 1-.818-.818Z"},"children":[]},{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","clipRule":"evenodd","d":"M11.773 15.74a2.454 2.454 0 1 1 0-4.909 2.454 2.454 0 0 1 0 4.91Zm-.818-2.454a.818.818 0 1 0 1.636 0 .818.818 0 0 0-1.636 0Z"},"children":[]}]}],"metadata":""}]},"name":"app-details"};
6
+ const AppDetails: 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":"M11.75 2a.75.75 0 0 1 .75.75v1h4.75a.75.75 0 0 1 0 1.5H12.5v1a.75.75 0 0 1-1.5 0v-3.5a.75.75 0 0 1 .75-.75ZM2 4.5a.75.75 0 0 1 .75-.75H8.5a.75.75 0 0 1 0 1.5H2.75A.75.75 0 0 1 2 4.5Zm4.75 3a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-1H2.75a.75.75 0 0 1 0-1.5H6v-1a.75.75 0 0 1 .75-.75Zm2.5 2.5a.75.75 0 0 1 .75-.75h7.25a.75.75 0 0 1 0 1.5H10a.75.75 0 0 1-.75-.75Zm4 3a.75.75 0 0 1 .75.75v1l3.25-.003a.75.75 0 1 1 0 1.5l-3.25.002v1.001a.75.75 0 0 1-1.5 0v-3.5a.75.75 0 0 1 .75-.75ZM2 15.497a.75.75 0 0 1 .75-.75H10a.75.75 0 0 1 0 1.5H2.75a.75.75 0 0 1-.75-.75Z"},"children":[]}],"metadata":""}]},"name":"app-details"};
7
7
 
8
8
  export default AppDetails;
@@ -3,6 +3,6 @@
3
3
 
4
4
  import { IconDefinition } from '../types';
5
5
 
6
- const BellCircle: 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":"M10 2c-1.509 0-2.966.559-4.047 1.569C4.869 4.579 4.25 5.963 4.25 7.417c0 2.105-.528 3.55-1.117 4.514l-.008.014c-.315.514-.56.916-.726 1.207-.082.145-.155.28-.208.397a1.632 1.632 0 0 0-.077.201.937.937 0 0 0-.04.352c.009.105.03.287.135.474.105.187.25.3.334.363a.94.94 0 0 0 .298.144c.073.02.144.033.205.042.12.017.259.026.405.031.29.01.694.01 1.203.01H6.75v.084a3.25 3.25 0 0 0 6.5 0v-.083h2.096c.51 0 .914 0 1.203-.011a4.06 4.06 0 0 0 .405-.031c.06-.009.132-.021.205-.042a.94.94 0 0 0 .298-.144c.085-.063.23-.176.334-.363.105-.187.126-.37.136-.474a.936.936 0 0 0-.04-.352 1.616 1.616 0 0 0-.078-.2 5.134 5.134 0 0 0-.208-.398c-.165-.29-.411-.693-.726-1.207l-.008-.014c-.388-.635-.747-1.474-.948-2.567a.75.75 0 0 0-1.475.272c.235 1.276.66 2.287 1.143 3.077.241.395.432.707.576.951a80.41 80.41 0 0 1-.835.003H4.672c-.338 0-.613 0-.836-.003.145-.244.336-.556.577-.95.738-1.209 1.337-2.926 1.337-5.297 0-1.022.434-2.013 1.226-2.752C7.77 3.925 8.856 3.5 10 3.5c.291 0 .579.028.86.081a.75.75 0 0 0 .28-1.473A6.095 6.095 0 0 0 10 2ZM8.25 15.167v.083a1.75 1.75 0 0 0 3.5 0v-.083h-3.5Z"},"children":[]},{"type":"element","tagName":"path","properties":{"d":"M18 4.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0Z"},"children":[]}],"metadata":""}]},"name":"bell-circle"};
6
+ const BellCircle: 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":"M5.953 3.569C7.034 2.559 8.49 2 10 2c.585 0 1.162.084 1.711.245a.75.75 0 0 1-.422 1.44A4.579 4.579 0 0 0 10 3.5c-1.143 0-2.23.424-3.024 1.165-.792.74-1.226 1.73-1.226 2.752 0 2.371-.599 4.088-1.337 5.296-.241.395-.432.707-.577.951.223.003.498.003.836.003h10.656c.338 0 .613 0 .835-.003a86.666 86.666 0 0 0-.576-.95c-.61-.998-1.126-2.346-1.286-4.126a.75.75 0 0 1 1.494-.135c.14 1.554.584 2.68 1.072 3.478l.008.014c.315.514.56.916.726 1.207.082.145.155.28.208.397.026.058.055.128.077.201a.934.934 0 0 1 .04.352 1.15 1.15 0 0 1-.135.474c-.105.187-.25.3-.334.363a.94.94 0 0 1-.298.144 1.49 1.49 0 0 1-.205.042c-.12.017-.259.026-.405.031-.29.01-.694.01-1.203.01H13.25v.084a3.25 3.25 0 0 1-6.5 0v-.083H4.654c-.51 0-.914 0-1.204-.011a4.06 4.06 0 0 1-.404-.031 1.491 1.491 0 0 1-.205-.042.94.94 0 0 1-.298-.144 1.151 1.151 0 0 1-.334-.363 1.152 1.152 0 0 1-.135-.474.937.937 0 0 1 .04-.352c.022-.073.05-.143.077-.2.053-.118.126-.253.208-.398.165-.29.411-.693.726-1.207l.008-.014c.589-.964 1.117-2.409 1.117-4.514 0-1.454.62-2.837 1.703-3.848ZM8.25 15.167v.083a1.75 1.75 0 0 0 3.5 0v-.083h-3.5Z"},"children":[]},{"type":"element","tagName":"path","properties":{"d":"M19 3.5a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0Z"},"children":[]}],"metadata":""}]},"name":"bell-circle"};
7
7
 
8
8
  export default BellCircle;
@@ -3,6 +3,6 @@
3
3
 
4
4
  import { IconDefinition } from '../types';
5
5
 
6
- const CheckCircle: 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":"M2 10a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13Zm4.155 3.432a.75.75 0 0 1 0 1.06L9.08 13.069a.75.75 0 0 1-1.06 0l-2.175-2.175a.75.75 0 1 1 1.06-1.06l1.645 1.644 4.545-4.545a.75.75 0 0 1 1.06 0Z"},"children":[]}],"metadata":""}]},"name":"check-circle"};
6
+ const CheckCircle: 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":"M2 10a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13Z"},"children":[]},{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","clipRule":"evenodd","d":"M13.73 7.032a.75.75 0 0 1 .043 1.06l-4.461 4.833a.75.75 0 0 1-1.102 0l-1.983-2.148A.75.75 0 1 1 7.329 9.76l1.432 1.55 3.91-4.235a.75.75 0 0 1 1.06-.043Z"},"children":[]}],"metadata":""}]},"name":"check-circle"};
7
7
 
8
8
  export default CheckCircle;
@@ -3,6 +3,6 @@
3
3
 
4
4
  import { IconDefinition } from '../types';
5
5
 
6
- const FocusMode: IconDefinition = {"icon":{"type":"root","children":[{"type":"element","tagName":"svg","properties":{"viewBox":"0 0 20 20"},"children":[{"type":"element","tagName":"path","properties":{"d":"M16.25 3H12a.75.75 0 0 0 0 1.5h2.44l-3.97 3.97a.75.75 0 0 0 1.06 1.06l3.97-3.97V8A.75.75 0 0 0 17 8V3.75a.75.75 0 0 0-.75-.75ZM3.75 17H8a.75.75 0 0 0 0-1.5H5.56l3.97-3.97a.75.75 0 1 0-1.06-1.06L4.5 14.44V12A.75.75 0 0 0 3 12v4.25a.75.75 0 0 0 .75.75Z"},"children":[]}],"metadata":""}]},"name":"focus-mode"};
6
+ const FocusMode: IconDefinition = {"icon":{"type":"root","children":[{"type":"element","tagName":"svg","properties":{"viewBox":"0 0 20 20"},"children":[{"type":"element","tagName":"path","properties":{"d":"M16.25 3H12a.75.75 0 0 0 0 1.5h2.44l-3.47 3.47a.75.75 0 0 0 1.06 1.06l3.47-3.47V8A.75.75 0 0 0 17 8V3.75a.75.75 0 0 0-.75-.75ZM3.75 17H8a.75.75 0 0 0 0-1.5H5.56l3.47-3.47a.75.75 0 1 0-1.06-1.06L4.5 14.44V12A.75.75 0 0 0 3 12v4.25a.75.75 0 0 0 .75.75Z"},"children":[]}],"metadata":""}]},"name":"focus-mode"};
7
7
 
8
8
  export default FocusMode;
@@ -3,6 +3,6 @@
3
3
 
4
4
  import { IconDefinition } from '../types';
5
5
 
6
- const RicheditorBlockCode: 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":{"d":"M8.377 5.554a.8.8 0 1 0-1.154-1.108l-4.8 5a.8.8 0 0 0 0 1.108l4.8 5a.8.8 0 0 0 1.154-1.108L4.11 10l4.268-4.446ZM12.777 4.446a.8.8 0 1 0-1.154 1.108L15.89 10l-4.268 4.446a.8.8 0 1 0 1.154 1.108l4.8-5a.8.8 0 0 0 0-1.108l-4.8-5Z"},"children":[]}]}],"metadata":""}]},"name":"richeditor-block-code"};
6
+ const RicheditorBlockCode: IconDefinition = {"icon":{"type":"root","children":[{"type":"element","tagName":"svg","properties":{"viewBox":"0 0 20 20"},"children":[{"type":"element","tagName":"path","properties":{"d":"M8.975 1.942a.75.75 0 0 0-1.45-.384l-2.25 8.5a.75.75 0 1 0 1.45.384l2.25-8.5Z"},"children":[]},{"type":"element","tagName":"path","properties":{"d":"M14 2a.75.75 0 0 0 0 1.5h1.25c.69 0 1.25.56 1.25 1.25v10.5c0 .69-.56 1.25-1.25 1.25H4.75c-.69 0-1.25-.56-1.25-1.25V12A.75.75 0 0 0 2 12v3.25A2.75 2.75 0 0 0 4.75 18h10.5A2.75 2.75 0 0 0 18 15.25V4.75A2.75 2.75 0 0 0 15.25 2H14ZM4.49 4.32a.75.75 0 0 0-1.06-1.06L1.22 5.47a.75.75 0 0 0 0 1.06l2.21 2.21a.75.75 0 0 0 1.06-1.06L2.81 6l1.68-1.68Z"},"children":[]},{"type":"element","tagName":"path","properties":{"d":"M9.87 3.26a.75.75 0 0 1 1.06 0l2.21 2.21a.75.75 0 0 1 0 1.06l-2.21 2.21a.75.75 0 1 1-1.06-1.06L11.55 6 9.87 4.32a.75.75 0 0 1 0-1.06Z"},"children":[]}],"metadata":""}]},"name":"richeditor-block-code"};
7
7
 
8
8
  export default RicheditorBlockCode;
@@ -0,0 +1,8 @@
1
+
2
+ // This icon file is generated automatically.
3
+
4
+ import { IconDefinition } from '../types';
5
+
6
+ const RicheditorBlockEmbed: 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.75 3.5c-.69 0-1.25.56-1.25 1.25V6H2V4.75A2.75 2.75 0 0 1 4.75 2H6v1.5H4.75Zm7.25 0H8V2h4v1.5Zm3.25 0H14V2h1.25A2.75 2.75 0 0 1 18 4.75V6h-1.5V4.75c0-.69-.56-1.25-1.25-1.25ZM16.5 12V8H18v4h-1.5Zm-13-4v4H2V8h1.5Zm0 6v1.25c0 .69.56 1.25 1.25 1.25H6V18H4.75A2.75 2.75 0 0 1 2 15.25V14h1.5Zm13 1.25V14H18v1.25A2.75 2.75 0 0 1 15.25 18H14v-1.5h1.25c.69 0 1.25-.56 1.25-1.25ZM8 16.5h4V18H8v-1.5ZM8.5 7.603v4.794L12.335 10 8.5 7.603ZM7 7.153a1.25 1.25 0 0 1 1.912-1.06L13.47 8.94a1.25 1.25 0 0 1 0 2.12l-4.556 2.848A1.25 1.25 0 0 1 7 12.848V7.152Z"},"children":[]}],"metadata":""}]},"name":"richeditor-block-embed"};
7
+
8
+ export default RicheditorBlockEmbed;
@@ -3,6 +3,6 @@
3
3
 
4
4
  import { IconDefinition } from '../types';
5
5
 
6
- const RicheditorImageZoom: 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":{"d":"M7.926 17a.778.778 0 1 0 0-1.555h-2.27l3.857-3.858a.778.778 0 1 0-1.1-1.1l-3.857 3.858v-2.27a.778.778 0 0 0-1.556 0v4.147c0 .43.348.778.778.778h4.148ZM12.074 3a.778.778 0 1 0 0 1.556h2.27l-3.857 3.857a.778.778 0 0 0 1.1 1.1l3.857-3.857v2.27a.778.778 0 0 0 1.556 0V3.778A.778.778 0 0 0 16.222 3h-4.148Z"},"children":[]}]}],"metadata":""}]},"name":"richeditor-image-zoom"};
6
+ const RicheditorImageZoom: IconDefinition = {"icon":{"type":"root","children":[{"type":"element","tagName":"svg","properties":{"viewBox":"0 0 20 20"},"children":[{"type":"element","tagName":"path","properties":{"d":"M8.75 5.75a.75.75 0 0 1 .75.75V8H11a.75.75 0 0 1 0 1.5H9.5V11A.75.75 0 0 1 8 11V9.5H6.5a.75.75 0 0 1 0-1.5H8V6.5a.75.75 0 0 1 .75-.75Z"},"children":[]},{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","clipRule":"evenodd","d":"M13.128 14.32a7.085 7.085 0 1 1 1.182-1.18l3.78 3.769a.835.835 0 1 1-1.18 1.182l-3.782-3.77ZM8.75 3.335a5.415 5.415 0 1 0 0 10.83 5.415 5.415 0 0 0 0-10.83Z"},"children":[]}],"metadata":""}]},"name":"richeditor-image-zoom"};
7
7
 
8
8
  export default RicheditorImageZoom;
@@ -3,6 +3,6 @@
3
3
 
4
4
  import { IconDefinition } from '../types';
5
5
 
6
- const RicheditorMarkCode: 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":{"d":"M8.377 5.554a.8.8 0 1 0-1.154-1.108l-4.8 5a.8.8 0 0 0 0 1.108l4.8 5a.8.8 0 0 0 1.154-1.108L4.11 10l4.268-4.446ZM12.777 4.446a.8.8 0 1 0-1.154 1.108L15.89 10l-4.268 4.446a.8.8 0 1 0 1.154 1.108l4.8-5a.8.8 0 0 0 0-1.108l-4.8-5Z"},"children":[]}]}],"metadata":""}]},"name":"richeditor-mark-code"};
6
+ const RicheditorMarkCode: IconDefinition = {"icon":{"type":"root","children":[{"type":"element","tagName":"svg","properties":{"viewBox":"0 0 20 20"},"children":[{"type":"element","tagName":"path","properties":{"d":"M12.23 3.925a.75.75 0 1 0-1.46-.35l-3 12.5a.75.75 0 1 0 1.46.35l3-12.5ZM6.53 6.22a.75.75 0 0 1 0 1.06L3.81 10l2.72 2.72a.75.75 0 1 1-1.06 1.06l-3.25-3.25a.75.75 0 0 1 0-1.06l3.25-3.25a.75.75 0 0 1 1.06 0ZM13.47 6.22a.75.75 0 0 1 1.06 0l3.25 3.25a.75.75 0 0 1 0 1.06l-3.25 3.25a.75.75 0 1 1-1.06-1.06L16.19 10l-2.72-2.72a.75.75 0 0 1 0-1.06Z"},"children":[]}],"metadata":""}]},"name":"richeditor-mark-code"};
7
7
 
8
8
  export default RicheditorMarkCode;
@@ -3,6 +3,6 @@
3
3
 
4
4
  import { IconDefinition } from '../types';
5
5
 
6
- const RicheditorOpenLink: 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.293 15.707a1 1 0 0 1 0-1.414l8.219-8.22H9.929a1 1 0 1 1 0-2h5a1 1 0 0 1 1 1v5a1 1 0 1 1-2 0V7.486l-8.222 8.222a1 1 0 0 1-1.414 0Z"},"children":[]}],"metadata":""}]},"name":"richeditor-open-link"};
6
+ const RicheditorOpenLink: IconDefinition = {"icon":{"type":"root","children":[{"type":"element","tagName":"svg","properties":{"viewBox":"0 0 20 20"},"children":[{"type":"element","tagName":"path","properties":{"d":"M14.25 5H9a.75.75 0 0 0 0 1.5h3.44l-7.22 7.22a.75.75 0 1 0 1.06 1.06l7.22-7.22V11a.75.75 0 0 0 1.5 0V5.75a.75.75 0 0 0-.75-.75Z"},"children":[]}],"metadata":""}]},"name":"richeditor-open-link"};
7
7
 
8
8
  export default RicheditorOpenLink;
@@ -125,6 +125,7 @@ export { default as Restore } from './Restore';
125
125
  export { default as RicheditorActionsMore } from './RicheditorActionsMore';
126
126
  export { default as RicheditorBlockCallout } from './RicheditorBlockCallout';
127
127
  export { default as RicheditorBlockCode } from './RicheditorBlockCode';
128
+ export { default as RicheditorBlockEmbed } from './RicheditorBlockEmbed';
128
129
  export { default as RicheditorBlockEntity } from './RicheditorBlockEntity';
129
130
  export { default as RicheditorBlockFile } from './RicheditorBlockFile';
130
131
  export { default as RicheditorBlockH1 } from './RicheditorBlockH1';
@@ -0,0 +1,12 @@
1
+ // This icon file is generated automatically.
2
+
3
+ import RicheditorBlockEmbedSvg from '../ast/RicheditorBlockEmbed';
4
+ import { Icon } from '../Icon';
5
+ import { IconBaseProps } from '../types';
6
+
7
+ const RicheditorBlockEmbed = (
8
+ props: IconBaseProps,
9
+ ): JSX.Element => <Icon {...props} icon={RicheditorBlockEmbedSvg} />;
10
+
11
+ RicheditorBlockEmbed.displayName = 'RicheditorBlockEmbed';
12
+ export default RicheditorBlockEmbed;
@@ -125,6 +125,7 @@ export { default as Restore } from './Restore';
125
125
  export { default as RicheditorActionsMore } from './RicheditorActionsMore';
126
126
  export { default as RicheditorBlockCallout } from './RicheditorBlockCallout';
127
127
  export { default as RicheditorBlockCode } from './RicheditorBlockCode';
128
+ export { default as RicheditorBlockEmbed } from './RicheditorBlockEmbed';
128
129
  export { default as RicheditorBlockEntity } from './RicheditorBlockEntity';
129
130
  export { default as RicheditorBlockFile } from './RicheditorBlockFile';
130
131
  export { default as RicheditorBlockH1 } from './RicheditorBlockH1';
package/src/tooltip.tsx CHANGED
@@ -1,6 +1,6 @@
1
1
  import {css, cx} from "@linaria/core";
2
2
  import * as TooltipPrimitive from "@radix-ui/react-tooltip";
3
- import type {ReactNode, SyntheticEvent} from "react";
3
+ import {forwardRef, type ReactNode, type SyntheticEvent} from "react";
4
4
  import {border, fontWeight, lineHeight, space, themeVars, tooltipDelay} from "./designSystem";
5
5
 
6
6
  const preventDefaultAndStopPropagation = (e: SyntheticEvent) => {
@@ -93,7 +93,7 @@ export const TooltipProvider: React.FC<TooltipPrimitive.TooltipProviderProps> =
93
93
  <TooltipPrimitive.Provider disableHoverableContent skipDelayDuration={150} {...props} />
94
94
  );
95
95
 
96
- export type TooltipProps = {
96
+ export type TooltipProps = Omit<React.ComponentPropsWithoutRef<"button">, "title"> & {
97
97
  title?: ReactNode;
98
98
  description?: ReactNode;
99
99
  content?: ReactNode;
@@ -111,54 +111,76 @@ export type TooltipProps = {
111
111
  keepOnClick?: boolean;
112
112
  };
113
113
 
114
- export const Tooltip: React.FC<TooltipProps> = ({
115
- title,
116
- description,
117
- content = (title || description) && (
118
- <>
119
- <TooltipTitle>{title}</TooltipTitle>
120
- <TooltipDescription>{description}</TooltipDescription>
121
- </>
122
- ),
123
- side,
124
- sideOffset = space.xs,
125
- align,
126
- alignOffset,
127
- instant,
128
- children,
129
- whiteBg,
130
- visible,
131
- onVisibleChange,
132
- keepOnClick,
133
- disabled,
134
- }) => {
135
- const triggerProps = keepOnClick
136
- ? {
137
- onPointerDown: preventDefaultAndStopPropagation,
138
- onClick: preventDefaultAndStopPropagation,
139
- }
140
- : null;
141
-
142
- return (
143
- <TooltipPrimitive.Root
144
- delayDuration={instant ? 0 : tooltipDelay.enter}
145
- open={disabled ? false : Boolean(content) && visible}
146
- onOpenChange={onVisibleChange}
147
- >
148
- <TooltipPrimitive.Trigger {...triggerProps} asChild>
149
- {children}
150
- </TooltipPrimitive.Trigger>
151
- <TooltipPrimitive.Portal>
152
- <TooltipPrimitive.Content
153
- side={side}
154
- sideOffset={sideOffset}
155
- align={align}
156
- alignOffset={alignOffset}
157
- className={cx(tooltipStyle, whiteBg && whiteBgStyle)}
158
- >
159
- {content}
160
- </TooltipPrimitive.Content>
161
- </TooltipPrimitive.Portal>
162
- </TooltipPrimitive.Root>
163
- );
164
- };
114
+ /**
115
+ * NOTE:
116
+ * When used together with other triggers (Collapsible, ActionsMenu...) of radix-based component it might
117
+ * overwrite [data-state] attribute of trigger element and make styling a bit harder. As a workaround you might:
118
+ * 1. Make sure that Tooltip is the lowest trigger. Usually we don't care about data-state of tooltip's trigger (e.g. `<CollapsibleTrigger asChilde><Tooltip><Button/></Tooltip></CollapsibleTrigger>`)
119
+ * 2. Use controlled state of components and add classes for open states
120
+ *
121
+ * Ref: https://github.com/radix-ui/primitives/issues/602
122
+ */
123
+ export const Tooltip = forwardRef<HTMLButtonElement, TooltipProps>(
124
+ (
125
+ {
126
+ title,
127
+ description,
128
+ content = (title || description) && (
129
+ <>
130
+ <TooltipTitle>{title}</TooltipTitle>
131
+ <TooltipDescription>{description}</TooltipDescription>
132
+ </>
133
+ ),
134
+ side,
135
+ sideOffset = space.xs,
136
+ align,
137
+ alignOffset,
138
+ instant,
139
+ children,
140
+ whiteBg,
141
+ visible,
142
+ onVisibleChange,
143
+ keepOnClick,
144
+ disabled,
145
+
146
+ ...triggerProps
147
+ },
148
+ ref
149
+ ) => {
150
+ const keepOnClickProps = keepOnClick
151
+ ? {
152
+ onPointerDown: (e: React.PointerEvent<HTMLButtonElement>) => {
153
+ preventDefaultAndStopPropagation(e);
154
+ triggerProps.onPointerDown?.(e);
155
+ },
156
+ onClick: (e: React.MouseEvent<HTMLButtonElement>) => {
157
+ preventDefaultAndStopPropagation(e);
158
+ triggerProps.onClick?.(e);
159
+ },
160
+ }
161
+ : null;
162
+
163
+ return (
164
+ <TooltipPrimitive.Root
165
+ delayDuration={instant ? 0 : tooltipDelay.enter}
166
+ open={disabled ? false : Boolean(content) && visible}
167
+ onOpenChange={onVisibleChange}
168
+ >
169
+ <TooltipPrimitive.Trigger ref={ref} {...triggerProps} {...keepOnClickProps} asChild>
170
+ {children}
171
+ </TooltipPrimitive.Trigger>
172
+ <TooltipPrimitive.Portal>
173
+ <TooltipPrimitive.Content
174
+ side={side}
175
+ sideOffset={sideOffset}
176
+ align={align}
177
+ alignOffset={alignOffset}
178
+ className={cx(tooltipStyle, whiteBg && whiteBgStyle)}
179
+ >
180
+ {content}
181
+ </TooltipPrimitive.Content>
182
+ </TooltipPrimitive.Portal>
183
+ </TooltipPrimitive.Root>
184
+ );
185
+ }
186
+ );