@fibery/ui-kit 1.20.2 → 1.21.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.20.2",
3
+ "version": "1.21.1",
4
4
  "main": "index.ts",
5
5
  "private": false,
6
6
  "files": [
@@ -26,7 +26,8 @@
26
26
  "src/emoji-picker/**/*.ts*",
27
27
  "src/toast/**/*.ts*",
28
28
  "src/lists/**/*.ts*",
29
- "src/a11y-color.ts"
29
+ "src/a11y-color.ts",
30
+ "src/integration-compact-info-button.tsx"
30
31
  ],
31
32
  "license": "UNLICENSED",
32
33
  "dependencies": {
@@ -67,9 +68,9 @@
67
68
  "react-windowed-select": "5.0.0",
68
69
  "screenfull": "6.0.1",
69
70
  "ua-parser-js": "0.7.24",
70
- "@fibery/react": "1.3.0",
71
71
  "@fibery/emoji-data": "2.2.1",
72
- "@fibery/helpers": "1.2.0"
72
+ "@fibery/helpers": "1.2.0",
73
+ "@fibery/react": "1.3.0"
73
74
  },
74
75
  "peerDependencies": {
75
76
  "react": "^18.2.0",
@@ -786,6 +786,7 @@ export const border = {
786
786
  export const lineHeight = {
787
787
  text: 1.6,
788
788
  regular: 1.5,
789
+ narrow: 1.4,
789
790
  heading: 1.25,
790
791
  nowrap: 1,
791
792
  } as const;
@@ -0,0 +1,54 @@
1
+ import {css, cx} from "@linaria/core";
2
+ import {ButtonBase} from "./button/button-base";
3
+ import {Tooltip} from "./tooltip";
4
+ import {space, textStyles, themeVars} from "./design-system";
5
+ import {useTheme} from "./theme-provider";
6
+ import WarningIcon from "./icons/react/WarningTriangle";
7
+ import {Spinner} from "./loaders";
8
+
9
+ const buttonCss = css`
10
+ ${textStyles.heading5}
11
+ display: flex;
12
+ align-items: center;
13
+ padding: ${space.s2}px ${space.s8}px ${space.s2}px ${space.s4}px;
14
+ gap: ${space.s4}px;
15
+ `;
16
+
17
+ const loadingCss = css`
18
+ color: ${themeVars.accentTextColor};
19
+ `;
20
+
21
+ export const IntegrationCompactInfoButton: React.FC<{
22
+ name: string;
23
+ icon: React.ReactNode;
24
+ title?: React.ReactNode;
25
+ error?: Error;
26
+ loading?: boolean;
27
+ onClick?: () => void;
28
+ }> = ({onClick, loading, icon, name, title, error}) => {
29
+ const colors = useTheme();
30
+
31
+ let iconNode = icon;
32
+
33
+ if (error) {
34
+ iconNode = <WarningIcon color={colors.errorButtonColor} iconSize={18} containerSize={24} />;
35
+ } else if (loading) {
36
+ iconNode = <Spinner color={colors.accentTextColor} backgroundColor={colors.mainBg} size={16} containerSize={24} />;
37
+ }
38
+
39
+ const className = cx(buttonCss, loading && loadingCss);
40
+
41
+ const button = onClick ? (
42
+ <ButtonBase dangerous={Boolean(error)} borderless className={className} onClick={onClick}>
43
+ {iconNode}
44
+ {name}
45
+ </ButtonBase>
46
+ ) : (
47
+ <div className={className}>
48
+ {iconNode}
49
+ {name}
50
+ </div>
51
+ );
52
+
53
+ return <Tooltip title={error?.message || title}>{button}</Tooltip>;
54
+ };