@fibery/ui-kit 1.33.6 → 1.34.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 +3 -3
- package/src/button/make-button-colors.ts +52 -24
- package/src/icons/ast/ArrowUpCircle.ts +8 -0
- package/src/icons/ast/SlideMenu.ts +1 -1
- package/src/icons/ast/index.tsx +1 -0
- package/src/icons/react/ArrowUpCircle.tsx +13 -0
- package/src/icons/react/index.tsx +1 -0
- package/src/toggle.tsx +19 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fibery/ui-kit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.34.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"files": [
|
|
6
6
|
"src/antd/styles.ts",
|
|
@@ -74,9 +74,9 @@
|
|
|
74
74
|
"screenfull": "6.0.1",
|
|
75
75
|
"tabbable": "5.2.1",
|
|
76
76
|
"ua-parser-js": "1.0.39",
|
|
77
|
-
"@fibery/
|
|
77
|
+
"@fibery/emoji-data": "2.6.0",
|
|
78
78
|
"@fibery/helpers": "1.3.0",
|
|
79
|
-
"@fibery/
|
|
79
|
+
"@fibery/react": "1.4.0"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
82
|
"react": "^18.2.0",
|
|
@@ -3,31 +3,59 @@
|
|
|
3
3
|
// so it's easier to find buttons with custom colors
|
|
4
4
|
|
|
5
5
|
import {CSSProperties} from "@linaria/core";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
getDarkenColor,
|
|
8
|
+
getEnumBackgroundColor,
|
|
9
|
+
getIconColor,
|
|
10
|
+
getOpacities,
|
|
11
|
+
getThemeValue,
|
|
12
|
+
themeVars,
|
|
13
|
+
} from "../design-system";
|
|
7
14
|
import {ButtonVariant} from "./base-button";
|
|
15
|
+
import {ThemeMode} from "../theme-settings";
|
|
8
16
|
|
|
9
|
-
export const makeButtonColors = (color: string, variant: ButtonVariant) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
export const makeButtonColors = (color: string, variant: ButtonVariant, mode: ThemeMode = "light"): CSSProperties => {
|
|
18
|
+
switch (variant) {
|
|
19
|
+
case "solid":
|
|
20
|
+
return {
|
|
21
|
+
"--fibery-button-color": color,
|
|
22
|
+
"--fibery-button-hover-color": getDarkenColor(color),
|
|
23
|
+
"--fibery-button-text-color": themeVars.buttonPrimaryTextColor,
|
|
24
|
+
"--fibery-button-text-active-color": themeVars.buttonPrimaryTextColor,
|
|
25
|
+
"--fibery-button-focus-color": getOpacities(color).opacity30,
|
|
26
|
+
};
|
|
27
|
+
case "ghost":
|
|
28
|
+
return {
|
|
29
|
+
"--fibery-button-color": "transparent",
|
|
30
|
+
"--fibery-button-hover-color": getOpacities(color).opacity15,
|
|
31
|
+
"--fibery-button-text-color": color,
|
|
32
|
+
"--fibery-button-text-active-color": getOpacities(color).opacity80,
|
|
33
|
+
"--fibery-button-focus-color": getOpacities(color).opacity30,
|
|
34
|
+
};
|
|
35
|
+
case "outline":
|
|
36
|
+
return {
|
|
37
|
+
"--fibery-button-color": "transparent",
|
|
38
|
+
"--fibery-button-hover-color": getOpacities(color).opacity15,
|
|
39
|
+
"--fibery-button-text-color": color,
|
|
40
|
+
"--fibery-button-text-active-color": getOpacities(color).opacity80,
|
|
41
|
+
"--fibery-button-focus-color": getOpacities(color).opacity30,
|
|
42
|
+
"--fibery-button-border-color": getOpacities(color).opacity30,
|
|
43
|
+
};
|
|
44
|
+
default:
|
|
45
|
+
case "soft": {
|
|
46
|
+
const bgColor = getEnumBackgroundColor(mode, color) as string;
|
|
47
|
+
const textColor = getIconColor(mode, color) as string;
|
|
26
48
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
49
|
+
return {
|
|
50
|
+
"--fibery-button-color": bgColor,
|
|
51
|
+
"--fibery-button-hover-color": getThemeValue(mode, {
|
|
52
|
+
light: getOpacities(color).opacity30,
|
|
53
|
+
dark: getOpacities(color).opacity45,
|
|
54
|
+
}),
|
|
55
|
+
"--fibery-button-text-color": textColor,
|
|
56
|
+
"--fibery-button-text-active-color": getOpacities(textColor).opacity80,
|
|
57
|
+
"--fibery-button-focus-color": getOpacities(color).opacity30,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
33
61
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
|
|
2
|
+
// This icon file is generated automatically.
|
|
3
|
+
|
|
4
|
+
import { IconDefinition } from '../types';
|
|
5
|
+
|
|
6
|
+
const ArrowUpCircle: IconDefinition = {"icon":{"type":"root","children":[{"type":"element","tagName":"svg","properties":{"viewBox":"0 0 20 20"},"children":[{"type":"element","tagName":"path","properties":{"d":"M10 1.667a8.333 8.333 0 1 0 0 16.666 8.333 8.333 0 0 0 0-16.666Zm0 15a6.667 6.667 0 1 1 0-13.334 6.667 6.667 0 0 1 0 13.334Z"},"children":[]},{"type":"element","tagName":"path","properties":{"d":"M11.97 9.53a.75.75 0 1 0 1.06-1.06l-2.5-2.5a.75.75 0 0 0-1.06 0l-2.5 2.5a.75.75 0 0 0 1.06 1.06l1.22-1.22v5.19a.75.75 0 0 0 1.5 0V8.31l1.22 1.22Z"},"children":[]}],"metadata":""}]},"name":"arrow-up-circle"};
|
|
7
|
+
|
|
8
|
+
export default ArrowUpCircle;
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
import { IconDefinition } from '../types';
|
|
5
5
|
|
|
6
|
-
const SlideMenu: IconDefinition = {"icon":{"type":"root","children":[{"type":"element","tagName":"svg","properties":{"viewBox":"0 0 20 20"},"children":[{"type":"element","tagName":"path","properties":{"d":"M7.25 9.5a.75.75 0 0 0-.75-.75h-1a.75.75 0 0 0 0 1.5h1a.75.75 0 0 0 .75-.
|
|
6
|
+
const SlideMenu: IconDefinition = {"icon":{"type":"root","children":[{"type":"element","tagName":"svg","properties":{"viewBox":"0 0 20 20"},"children":[{"type":"element","tagName":"path","properties":{"d":"M7.25 9.5a.75.75 0 0 0-.75-.75h-1a.75.75 0 0 0 0 1.5h1a.75.75 0 0 0 .75-.75ZM6.5 6.25a.75.75 0 0 1 0 1.5h-1a.75.75 0 0 1 0-1.5h1Z"},"children":[]},{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","clipRule":"evenodd","d":"M15.25 3A2.75 2.75 0 0 1 18 5.75v8.5A2.75 2.75 0 0 1 15.25 17H4.75A2.75 2.75 0 0 1 2 14.25v-8.5A2.75 2.75 0 0 1 4.75 3h10.5Zm1.25 2.75c0-.69-.56-1.25-1.25-1.25h-5.5v11h5.5c.69 0 1.25-.56 1.25-1.25v-8.5ZM8.25 15.5v-11h-3.5c-.69 0-1.25.56-1.25 1.25v8.5c0 .69.56 1.25 1.25 1.25h3.5Z"},"children":[]}],"metadata":""}]},"name":"slide-menu"};
|
|
7
7
|
|
|
8
8
|
export default SlideMenu;
|
package/src/icons/ast/index.tsx
CHANGED
|
@@ -27,6 +27,7 @@ export { default as ArrowForward } from './ArrowForward';
|
|
|
27
27
|
export { default as ArrowLeft } from './ArrowLeft';
|
|
28
28
|
export { default as ArrowRight } from './ArrowRight';
|
|
29
29
|
export { default as ArrowTop } from './ArrowTop';
|
|
30
|
+
export { default as ArrowUpCircle } from './ArrowUpCircle';
|
|
30
31
|
export { default as AskForInput } from './AskForInput';
|
|
31
32
|
export { default as Atom } from './Atom';
|
|
32
33
|
export { default as AutomationsCancelled } from './AutomationsCancelled';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// This icon file is generated automatically.
|
|
2
|
+
|
|
3
|
+
import {forwardRef} from 'react';
|
|
4
|
+
import ArrowUpCircleSvg from '../ast/ArrowUpCircle';
|
|
5
|
+
import { Icon } from '../Icon';
|
|
6
|
+
import { IconBaseProps } from '../types';
|
|
7
|
+
|
|
8
|
+
const ArrowUpCircle = forwardRef<SVGSVGElement, IconBaseProps>(function ArrowUpCircle(
|
|
9
|
+
props: IconBaseProps,
|
|
10
|
+
ref: React.Ref<SVGSVGElement>
|
|
11
|
+
) {return <Icon {...props} className={props.className} ref={ref} icon={ArrowUpCircleSvg} />});
|
|
12
|
+
|
|
13
|
+
export default ArrowUpCircle;
|
|
@@ -27,6 +27,7 @@ export { default as ArrowForward } from './ArrowForward';
|
|
|
27
27
|
export { default as ArrowLeft } from './ArrowLeft';
|
|
28
28
|
export { default as ArrowRight } from './ArrowRight';
|
|
29
29
|
export { default as ArrowTop } from './ArrowTop';
|
|
30
|
+
export { default as ArrowUpCircle } from './ArrowUpCircle';
|
|
30
31
|
export { default as AskForInput } from './AskForInput';
|
|
31
32
|
export { default as Atom } from './Atom';
|
|
32
33
|
export { default as AutomationsCancelled } from './AutomationsCancelled';
|
package/src/toggle.tsx
CHANGED
|
@@ -80,7 +80,16 @@ const Circle = styled.div<{containerSize: number}>`
|
|
|
80
80
|
transition: transform ${transition};
|
|
81
81
|
`;
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
export type ToggleSize = "small" | "medium" | "large" | "extra-large";
|
|
84
|
+
|
|
85
|
+
const toggleSize = {
|
|
86
|
+
small: 14,
|
|
87
|
+
medium: 16,
|
|
88
|
+
large: 18,
|
|
89
|
+
"extra-large": 20,
|
|
90
|
+
} as const;
|
|
91
|
+
|
|
92
|
+
type ToggleProps = Omit<ComponentProps<"input">, "value" | "size"> & {
|
|
84
93
|
value?: boolean;
|
|
85
94
|
label?: ReactNode;
|
|
86
95
|
labelTitle?: string;
|
|
@@ -89,7 +98,8 @@ interface ToggleProps extends Omit<ComponentProps<"input">, "value"> {
|
|
|
89
98
|
labelPosition?: "first" | "last";
|
|
90
99
|
wrapperClassName?: string;
|
|
91
100
|
pending?: boolean;
|
|
92
|
-
|
|
101
|
+
size?: ToggleSize;
|
|
102
|
+
};
|
|
93
103
|
|
|
94
104
|
export const Toggle: FC<ToggleProps> = ({
|
|
95
105
|
value,
|
|
@@ -98,7 +108,7 @@ export const Toggle: FC<ToggleProps> = ({
|
|
|
98
108
|
pending,
|
|
99
109
|
disabled = false,
|
|
100
110
|
backgroundColor,
|
|
101
|
-
size =
|
|
111
|
+
size = "medium",
|
|
102
112
|
onChange,
|
|
103
113
|
labelPosition = "last",
|
|
104
114
|
labelMutedWhenDisabled = true,
|
|
@@ -106,11 +116,12 @@ export const Toggle: FC<ToggleProps> = ({
|
|
|
106
116
|
wrapperClassName,
|
|
107
117
|
...rest
|
|
108
118
|
}) => {
|
|
109
|
-
const
|
|
119
|
+
const height = toggleSize[size];
|
|
120
|
+
const width = height * 1.75;
|
|
110
121
|
const outlineColor = getOutlineColor(backgroundColor);
|
|
111
122
|
|
|
112
123
|
const circleTransformStyle = {
|
|
113
|
-
transform: `translateX(${value ? width -
|
|
124
|
+
transform: `translateX(${value ? width - height : 0}px)`,
|
|
114
125
|
};
|
|
115
126
|
|
|
116
127
|
return (
|
|
@@ -138,14 +149,14 @@ export const Toggle: FC<ToggleProps> = ({
|
|
|
138
149
|
{pending && <SpinnerIcon />}
|
|
139
150
|
{!pending && (
|
|
140
151
|
<CircleContainer
|
|
141
|
-
containerSize={
|
|
152
|
+
containerSize={height}
|
|
142
153
|
containerWidth={width}
|
|
143
154
|
backgroundColor={backgroundColor}
|
|
144
155
|
disabled={disabled}
|
|
145
156
|
>
|
|
146
|
-
<Circle containerSize={
|
|
157
|
+
<Circle containerSize={height} style={circleTransformStyle} />
|
|
147
158
|
<Input
|
|
148
|
-
containerSize={
|
|
159
|
+
containerSize={height}
|
|
149
160
|
containerWidth={width}
|
|
150
161
|
outlineColor={outlineColor}
|
|
151
162
|
onChange={onChange}
|