@fibery/ui-kit 1.31.0 → 1.32.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 (39) hide show
  1. package/package.json +3 -6
  2. package/src/actions-menu/actions-menu-confirmation.tsx +3 -3
  3. package/src/actions-menu/actions-menu-sub-menu.tsx +5 -2
  4. package/src/actions-menu/actions-menu.tsx +6 -1
  5. package/src/actions-menu/contexts/actions-menu-context.tsx +11 -2
  6. package/src/button/actions-button-compact.tsx +1 -1
  7. package/src/button/actions-button.tsx +1 -17
  8. package/src/button/add-button.tsx +13 -6
  9. package/src/button/back-button.tsx +12 -23
  10. package/src/button/base-button.tsx +189 -0
  11. package/src/button/button.tsx +84 -237
  12. package/src/button/icon-button.tsx +71 -0
  13. package/src/button/make-button-colors.ts +33 -0
  14. package/src/design-system.ts +6 -5
  15. package/src/dropdown-menu/index.tsx +15 -14
  16. package/src/emoji-picker/emoji-picker-content-with-color.tsx +1 -1
  17. package/src/emoji-picker/emoji-picker-preview-footer.tsx +2 -2
  18. package/src/emoji-picker/icon-emoji-picker.tsx +3 -3
  19. package/src/emoji-picker/primitives/category-label.tsx +1 -1
  20. package/src/emoji-picker/primitives/grid-item.tsx +1 -1
  21. package/src/emoji-picker/primitives/search.tsx +1 -1
  22. package/src/emoji-picker/primitives/skin-tone.tsx +1 -1
  23. package/src/error-alert/error-alert-action.tsx +9 -6
  24. package/src/error-alert/error-alert.tsx +1 -1
  25. package/src/icons/Icon.tsx +1 -0
  26. package/src/icons/ast/Folder.ts +8 -0
  27. package/src/icons/ast/SmartFolder.ts +1 -1
  28. package/src/icons/ast/index.tsx +1 -0
  29. package/src/icons/react/Folder.tsx +13 -0
  30. package/src/icons/react/index.tsx +1 -0
  31. package/src/integration-compact-info-button.tsx +4 -3
  32. package/src/select/custom-select-partials/clear-indicator.tsx +1 -1
  33. package/src/toast/primitives.tsx +1 -1
  34. package/src/toast/toast-action.tsx +3 -6
  35. package/src/toggle.tsx +22 -16
  36. package/src/back-button.tsx +0 -3
  37. package/src/button/button-base.tsx +0 -180
  38. package/src/button.tsx +0 -3
  39. package/src/icon-button.tsx +0 -3
@@ -3,6 +3,6 @@
3
3
 
4
4
  import { IconDefinition } from '../types';
5
5
 
6
- const SmartFolder: IconDefinition = {"icon":{"type":"root","children":[{"type":"element","tagName":"svg","properties":{"viewBox":"0 0 20 20"},"children":[{"type":"element","tagName":"path","properties":{"d":"M7.134 3.38a1.846 1.846 0 0 1 1.943.368l4.476 4.218.012.013c.565.585.935 1.262.935 2.021 0 .76-.37 1.436-.935 2.021l-.012.013-4.476 4.218a1.846 1.846 0 0 1-1.943.37C6.527 16.384 6 15.804 6 15V5c0-.805.527-1.385 1.134-1.62Zm.544 1.397c-.133.051-.178.139-.178.223v10c0 .084.045.172.178.223a.346.346 0 0 0 .371-.064l4.449-4.192c.392-.41.502-.729.502-.967s-.11-.557-.502-.967L8.049 4.841a.347.347 0 0 0-.371-.064Z"},"children":[]}],"metadata":""}]},"name":"smart-folder"};
6
+ const SmartFolder: IconDefinition = {"icon":{"type":"root","children":[{"type":"element","tagName":"svg","properties":{"viewBox":"0 0 20 20"},"children":[{"type":"element","tagName":"path","properties":{"d":"M10.586 9.219a.75.75 0 0 0-1.172-.937l-2 2.5A.75.75 0 0 0 8 12h2l-.586 1.282a.75.75 0 0 0 1.172.937l2-2.5A.75.75 0 0 0 12 10.5h-2l.586-1.281Z","fill":"#51616C","fillOpacity":0.9},"children":[]},{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","clipRule":"evenodd","d":"M2.708 3.791a2.417 2.417 0 0 1 1.709-.708H7.5a.75.75 0 0 1 .53.22l2.28 2.28h5.273A2.417 2.417 0 0 1 18 8v6.667c0 .64-.255 1.255-.708 1.709-.274.273-.645.441-.912.537-.26.093-.572.17-.797.17H4.417A2.417 2.417 0 0 1 2 14.668V5.5c0-.64.255-1.255.708-1.709Zm1.709.792A.917.917 0 0 0 3.5 5.5v9.167a.917.917 0 0 0 .917.917h11.151c.008-.002.032-.005.072-.015a2.051 2.051 0 0 0 .472-.173.565.565 0 0 0 .12-.081.917.917 0 0 0 .268-.648V8a.917.917 0 0 0-.917-.917H10a.75.75 0 0 1-.53-.22l-2.28-2.28H4.416Z"},"children":[]}],"metadata":""}]},"name":"smart-folder"};
7
7
 
8
8
  export default SmartFolder;
@@ -93,6 +93,7 @@ export { default as FileUpload } from './FileUpload';
93
93
  export { default as Filter } from './Filter';
94
94
  export { default as FocusModeOff } from './FocusModeOff';
95
95
  export { default as FocusMode } from './FocusMode';
96
+ export { default as Folder } from './Folder';
96
97
  export { default as FormWithCover } from './FormWithCover';
97
98
  export { default as FormWithoutCover } from './FormWithoutCover';
98
99
  export { default as Github } from './Github';
@@ -0,0 +1,13 @@
1
+ // This icon file is generated automatically.
2
+
3
+ import {forwardRef} from 'react';
4
+ import FolderSvg from '../ast/Folder';
5
+ import { Icon } from '../Icon';
6
+ import { IconBaseProps } from '../types';
7
+
8
+ const Folder = forwardRef<SVGSVGElement, IconBaseProps>(function Folder(
9
+ props: IconBaseProps,
10
+ ref: React.Ref<SVGSVGElement>
11
+ ) {return <Icon {...props} className={props.className} ref={ref} icon={FolderSvg} />});
12
+
13
+ export default Folder;
@@ -93,6 +93,7 @@ export { default as FileUpload } from './FileUpload';
93
93
  export { default as Filter } from './Filter';
94
94
  export { default as FocusModeOff } from './FocusModeOff';
95
95
  export { default as FocusMode } from './FocusMode';
96
+ export { default as Folder } from './Folder';
96
97
  export { default as FormWithCover } from './FormWithCover';
97
98
  export { default as FormWithoutCover } from './FormWithoutCover';
98
99
  export { default as Github } from './Github';
@@ -1,10 +1,10 @@
1
1
  import {css, cx} from "@linaria/core";
2
- import {ButtonBase} from "./button/button-base";
3
2
  import {Tooltip} from "./tooltip";
4
3
  import {space, textStyles, themeVars} from "./design-system";
5
4
  import {useTheme} from "./theme-provider";
6
5
  import WarningIcon from "./icons/react/WarningTriangle";
7
6
  import {Spinner} from "./loaders";
7
+ import {BaseButton} from "./button/base-button";
8
8
 
9
9
  const buttonCss = css`
10
10
  ${textStyles.heading5}
@@ -12,6 +12,7 @@ const buttonCss = css`
12
12
  align-items: center;
13
13
  padding: ${space.s2}px ${space.s8}px ${space.s2}px ${space.s4}px;
14
14
  gap: ${space.s4}px;
15
+ border-radius: 6px;
15
16
  `;
16
17
 
17
18
  const loadingCss = css`
@@ -39,10 +40,10 @@ export const IntegrationCompactInfoButton: React.FC<{
39
40
  const className = cx(buttonCss, loading && loadingCss);
40
41
 
41
42
  const button = onClick ? (
42
- <ButtonBase dangerous={Boolean(error)} borderless className={className} onClick={onClick}>
43
+ <BaseButton color={error ? "error" : "neutral"} variant="ghost" className={className} onClick={onClick}>
43
44
  {iconNode}
44
45
  {name}
45
- </ButtonBase>
46
+ </BaseButton>
46
47
  ) : (
47
48
  <div className={className}>
48
49
  {iconNode}
@@ -1,5 +1,5 @@
1
1
  import {ClearIndicatorProps, GroupBase, MultiValueRemoveProps} from "react-select";
2
- import {IconButton} from "../../button-v2/icon-button";
2
+ import {IconButton} from "../../button/icon-button";
3
3
  import RemoveIcon from "../../icons/react/Remove";
4
4
 
5
5
  export function ClearIndicator<
@@ -2,7 +2,7 @@ import {preventDefault} from "@fibery/react/src/prevent-default";
2
2
  import {css, cx} from "@linaria/core";
3
3
  import * as ToastPrimitives from "@radix-ui/react-toast";
4
4
  import {ElementRef, forwardRef} from "react";
5
- import {IconButton} from "../button-v2/icon-button";
5
+ import {IconButton} from "../button/icon-button";
6
6
  import {border, space, textStyles, themeVars} from "../design-system";
7
7
  import CloseIcon from "../icons/react/Close";
8
8
 
@@ -1,9 +1,7 @@
1
+ import {css} from "@linaria/core";
1
2
  import {Action as RadixToastAction, type ToastActionProps} from "@radix-ui/react-toast";
2
3
  import {ElementRef, forwardRef} from "react";
3
- import {ButtonProps} from "../button/button";
4
- import {Button} from "../button";
5
- import {useTheme} from "../theme-provider";
6
- import {css} from "@linaria/core";
4
+ import {ButtonProps, Button} from "../button/button";
7
5
  import {space} from "../design-system";
8
6
 
9
7
  const toastActionCss = css`
@@ -16,10 +14,9 @@ export const ToastAction = forwardRef<
16
14
  ElementRef<typeof RadixToastAction>,
17
15
  ButtonProps & {altText: ToastActionProps["altText"]}
18
16
  >(({children, altText, ...props}, ref) => {
19
- const theme = useTheme();
20
17
  return (
21
18
  <RadixToastAction className={toastActionCss} ref={ref} altText={altText} asChild>
22
- <Button color={theme.textColor} {...props}>
19
+ <Button variant="outline" color="neutral" {...props}>
23
20
  {children}
24
21
  </Button>
25
22
  </RadixToastAction>
package/src/toggle.tsx CHANGED
@@ -4,6 +4,7 @@ import chroma from "chroma-js";
4
4
  import {ComponentProps, FC, ReactNode} from "react";
5
5
  import {layout, space, textStyles, transition} from "./design-system";
6
6
  import _ from "lodash";
7
+ import SpinnerIcon from "./icons/react/Spinner";
7
8
 
8
9
  const Input = styled.input<{containerSize: number; containerWidth: number; outlineColor: string}>`
9
10
  position: absolute;
@@ -85,12 +86,14 @@ interface ToggleProps extends Omit<ComponentProps<"input">, "value"> {
85
86
  backgroundColor: string;
86
87
  labelPosition?: "first" | "last";
87
88
  wrapperClassName?: string;
89
+ pending?: boolean;
88
90
  }
89
91
 
90
92
  export const Toggle: FC<ToggleProps> = ({
91
93
  value,
92
94
  label,
93
95
  labelTitle,
96
+ pending,
94
97
  disabled = false,
95
98
  backgroundColor,
96
99
  size = 16,
@@ -130,25 +133,28 @@ export const Toggle: FC<ToggleProps> = ({
130
133
  )}
131
134
  title={labelTitle}
132
135
  >
133
- <CircleContainer
134
- containerSize={size}
135
- containerWidth={width}
136
- backgroundColor={backgroundColor}
137
- disabled={disabled}
138
- >
139
- <Circle containerSize={size} style={circleTransformStyle} />
140
- <Input
136
+ {pending && <SpinnerIcon />}
137
+ {!pending && (
138
+ <CircleContainer
141
139
  containerSize={size}
142
140
  containerWidth={width}
143
- outlineColor={outlineColor}
144
- onChange={onChange}
145
- className={className}
146
- type="checkbox"
141
+ backgroundColor={backgroundColor}
147
142
  disabled={disabled}
148
- checked={value}
149
- {...rest}
150
- />
151
- </CircleContainer>
143
+ >
144
+ <Circle containerSize={size} style={circleTransformStyle} />
145
+ <Input
146
+ containerSize={size}
147
+ containerWidth={width}
148
+ outlineColor={outlineColor}
149
+ onChange={onChange}
150
+ className={className}
151
+ type="checkbox"
152
+ disabled={disabled}
153
+ checked={value}
154
+ {...rest}
155
+ />
156
+ </CircleContainer>
157
+ )}
152
158
 
153
159
  {label && (
154
160
  <Label disabled={disabled && labelMutedWhenDisabled} labelPosition={labelPosition}>
@@ -1,3 +0,0 @@
1
- import {BackButton} from "./button/back-button";
2
-
3
- export {BackButton};
@@ -1,180 +0,0 @@
1
- import {styled} from "@linaria/react";
2
- import {ComponentPropsWithoutRef, forwardRef} from "react";
3
- import {border, colors, fontWeight, getDarkenColor, getOpacities, opacity, ThemeColors} from "../design-system";
4
- import {useTheme} from "../theme-provider";
5
-
6
- export const getMainColor = ({color, dangerous, theme}: {color?: string; dangerous?: boolean; theme: ThemeColors}) => {
7
- if (color) {
8
- return color;
9
- }
10
- if (dangerous) {
11
- return theme.danger;
12
- }
13
- if (!theme) {
14
- return colors.primary;
15
- }
16
- return theme.buttonColor;
17
- };
18
-
19
- const getBorderColor = ({
20
- mainColor,
21
- borderless,
22
- primary,
23
- }: {
24
- mainColor: string;
25
- borderless?: boolean;
26
- primary?: boolean;
27
- }) => {
28
- if (borderless) {
29
- return colors.transparent;
30
- }
31
- if (primary) {
32
- return mainColor;
33
- }
34
- return getOpacities(mainColor).opacity30;
35
- };
36
-
37
- const getHoverBorderColor = ({
38
- mainColor,
39
- borderless,
40
- primary,
41
- hoverBgColor,
42
- }: {
43
- mainColor: string;
44
- borderless?: boolean;
45
- primary?: boolean;
46
- hoverBgColor: string;
47
- }) => {
48
- if (borderless) {
49
- return colors.transparent;
50
- }
51
- if (primary) {
52
- return hoverBgColor;
53
- }
54
- return mainColor;
55
- };
56
-
57
- export const getTextColor = ({
58
- mainColor,
59
- primary,
60
- theme,
61
- }: {
62
- mainColor: string;
63
- primary?: boolean;
64
- theme: ThemeColors;
65
- }) => {
66
- if (primary) {
67
- return theme.buttonPrimaryTextColor;
68
- }
69
- return mainColor;
70
- };
71
-
72
- const getBgColor = ({mainColor, primary}: {mainColor: string; primary?: boolean}) => {
73
- if (primary) {
74
- return mainColor;
75
- }
76
- return colors.transparent;
77
- };
78
-
79
- const getHoverBgColor = ({
80
- mainColor,
81
- borderless,
82
- primary,
83
- }: {
84
- mainColor: string;
85
- primary?: boolean;
86
- borderless?: boolean;
87
- }) => {
88
- if (primary) {
89
- return getDarkenColor(mainColor);
90
- }
91
- if (borderless) {
92
- return getOpacities(mainColor).opacity15;
93
- }
94
- return colors.transparent;
95
- };
96
-
97
- export const buttonBorderWidth = 1;
98
-
99
- type StyledProps = {
100
- textColor: string;
101
- bgColor: string;
102
- borderColor: string;
103
- hoverBgColor: string;
104
- hoverBorderColor: string;
105
- borderWidth: number;
106
- };
107
-
108
- export const StyledButtonBase = styled.button<StyledProps>`
109
- display: block;
110
- box-sizing: border-box;
111
- font-weight: ${fontWeight.medium};
112
- margin: 0;
113
- border-radius: ${border.radius6}px;
114
- border: 0;
115
- border-width: ${({borderWidth}) => `${borderWidth}px`};
116
- border-style: solid;
117
- padding: 0;
118
- cursor: pointer;
119
- transition: all 150ms ease-out;
120
- color: ${({textColor}) => textColor};
121
- background-color: ${({bgColor}) => bgColor};
122
- border-color: ${({borderColor}) => borderColor};
123
-
124
- &:disabled {
125
- cursor: default;
126
- opacity: ${opacity.opacity40};
127
- }
128
-
129
- &:focus {
130
- outline: none;
131
- }
132
-
133
- &:focus-visible {
134
- box-shadow: ${({borderColor}) => `0 0 0 3px ${getOpacities(borderColor).opacity25}`};
135
- background-color: ${({hoverBgColor}) => hoverBgColor};
136
- border-color: ${({hoverBorderColor}) => hoverBorderColor};
137
- }
138
-
139
- &:hover:not(:disabled) {
140
- background-color: ${({hoverBgColor}) => hoverBgColor};
141
- border-color: ${({hoverBorderColor}) => hoverBorderColor};
142
- }
143
- `;
144
-
145
- export type ButtonBaseProps = {
146
- color?: string;
147
- primary?: boolean;
148
- dangerous?: boolean;
149
- borderless?: boolean;
150
- } & ComponentPropsWithoutRef<"button">;
151
- export const ButtonBase = forwardRef<HTMLButtonElement, ButtonBaseProps>(function ButtonBase(
152
- {primary, color, borderless, dangerous, className, type = "button", ...buttonProps},
153
- ref
154
- ) {
155
- const theme = useTheme();
156
-
157
- const mainColor = getMainColor({color, dangerous, theme});
158
- const textColor = getTextColor({mainColor, primary, theme});
159
- const bgColor = getBgColor({mainColor, primary});
160
- const hoverBgColor = getHoverBgColor({mainColor, borderless, primary});
161
- const borderColor = getBorderColor({mainColor, borderless, primary});
162
- const hoverBorderColor = getHoverBorderColor({
163
- mainColor,
164
- borderless,
165
- primary,
166
- hoverBgColor,
167
- });
168
- const borderWidth = borderless ? 0 : buttonBorderWidth;
169
-
170
- const styledProps: StyledProps = {
171
- bgColor,
172
- borderColor,
173
- hoverBgColor,
174
- hoverBorderColor,
175
- textColor,
176
- borderWidth,
177
- };
178
-
179
- return <StyledButtonBase ref={ref} type={type} className={className} {...styledProps} {...buttonProps} />;
180
- });
package/src/button.tsx DELETED
@@ -1,3 +0,0 @@
1
- import {Button} from "./button/button";
2
-
3
- export {Button};
@@ -1,3 +0,0 @@
1
- import {IconButton} from "./button-v2/icon-button";
2
-
3
- export {IconButton};