@fibery/ui-kit 1.30.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.
- package/package.json +4 -7
- package/src/actions-menu/actions-menu-confirmation.tsx +3 -3
- package/src/actions-menu/actions-menu-sub-menu.tsx +5 -2
- package/src/actions-menu/actions-menu.tsx +6 -1
- package/src/actions-menu/contexts/actions-menu-context.tsx +11 -2
- package/src/button/actions-button-compact.tsx +2 -2
- package/src/button/actions-button.tsx +3 -19
- package/src/button/add-button.tsx +13 -6
- package/src/button/back-button.tsx +12 -23
- package/src/button/base-button.tsx +189 -0
- package/src/button/button.tsx +84 -235
- package/src/button/icon-button.tsx +53 -53
- package/src/button/make-button-colors.ts +33 -0
- package/src/design-system.ts +8 -7
- package/src/dropdown-menu/index.tsx +15 -14
- package/src/emoji-picker/emoji-picker-content-with-color.tsx +3 -10
- package/src/emoji-picker/emoji-picker-preview-footer.tsx +2 -2
- package/src/emoji-picker/icon-emoji-picker.tsx +3 -3
- package/src/emoji-picker/primitives/category-label.tsx +4 -4
- package/src/emoji-picker/primitives/grid-item.tsx +1 -4
- package/src/emoji-picker/primitives/search.tsx +7 -7
- package/src/emoji-picker/primitives/skin-tone.tsx +2 -2
- package/src/error-alert/error-alert-action.tsx +9 -6
- package/src/error-alert/error-alert.tsx +2 -2
- package/src/icons/Icon.tsx +1 -0
- package/src/icons/ast/Folder.ts +8 -0
- package/src/icons/ast/SmartFolder.ts +1 -1
- package/src/icons/ast/index.tsx +1 -0
- package/src/icons/react/Folder.tsx +13 -0
- package/src/icons/react/index.tsx +1 -0
- package/src/integration-compact-info-button.tsx +4 -3
- package/src/select/custom-select-partials/clear-indicator.tsx +5 -4
- package/src/select/select-in-popover.tsx +20 -6
- package/src/toast/primitives.tsx +2 -2
- package/src/toast/toast-action.tsx +3 -6
- package/src/toggle.tsx +22 -16
- package/src/back-button.tsx +0 -3
- package/src/button/button-base.tsx +0 -180
- package/src/button.tsx +0 -3
- package/src/icon-button.tsx +0 -3
package/src/button/button.tsx
CHANGED
|
@@ -1,256 +1,105 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
type PositionInGroup = "first" | "middle" | "last";
|
|
17
|
-
|
|
18
|
-
export const ButtonSize = {
|
|
19
|
-
superSmall: ":button-size/super-small",
|
|
20
|
-
smaller: ":button-size/smaller",
|
|
21
|
-
small: ":button-size/small",
|
|
22
|
-
normal: ":button-size/normal",
|
|
23
|
-
big: ":button-size/big",
|
|
24
|
-
} as const;
|
|
25
|
-
export type ButtonSize = (typeof ButtonSize)[keyof typeof ButtonSize];
|
|
26
|
-
|
|
27
|
-
const FontSizes = {
|
|
28
|
-
":button-size/super-small": 10,
|
|
29
|
-
":button-size/smaller": 12,
|
|
30
|
-
":button-size/small": 12,
|
|
31
|
-
":button-size/normal": 14,
|
|
32
|
-
":button-size/big": 16,
|
|
33
|
-
} as const;
|
|
34
|
-
|
|
35
|
-
const HorizontalPaddings = {
|
|
36
|
-
":button-size/super-small": 6,
|
|
37
|
-
":button-size/smaller": 8,
|
|
38
|
-
":button-size/small": 8,
|
|
39
|
-
":button-size/normal": 12,
|
|
40
|
-
":button-size/big": 16,
|
|
41
|
-
} as const;
|
|
42
|
-
|
|
43
|
-
const IconSizes = {
|
|
44
|
-
":button-size/super-small": 14,
|
|
45
|
-
":button-size/smaller": 16,
|
|
46
|
-
":button-size/small": 18,
|
|
47
|
-
":button-size/normal": 18,
|
|
48
|
-
":button-size/big": 20,
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
type StyledProps = {
|
|
52
|
-
buttonSize: ButtonSize;
|
|
53
|
-
borderless?: boolean;
|
|
54
|
-
buttonWidth?: number | string;
|
|
55
|
-
buttonHeight?: number | string;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const getFontSize = ({buttonSize}: StyledProps) => FontSizes[buttonSize];
|
|
59
|
-
const getButtonMinSize = ({buttonSize}: StyledProps) => FontSizes[buttonSize] * 2;
|
|
60
|
-
const getHorizontalPadding = ({buttonSize, borderless}: StyledProps) =>
|
|
61
|
-
borderless ? HorizontalPaddings[buttonSize] : HorizontalPaddings[buttonSize] - buttonBorderWidth;
|
|
1
|
+
import {css, cx} from "@linaria/core";
|
|
2
|
+
import {forwardRef} from "react";
|
|
3
|
+
import {border, fontWeight, space, textStyles} from "../design-system";
|
|
4
|
+
import {iconSizeVar} from "../icons/Icon";
|
|
5
|
+
import SpinnerIcon from "../icons/react/Spinner";
|
|
6
|
+
import {BaseButtonProps, BaseButton, ButtonSize} from "./base-button";
|
|
7
|
+
|
|
8
|
+
export type ButtonProps = {
|
|
9
|
+
size?: ButtonSize;
|
|
10
|
+
pending?: boolean;
|
|
11
|
+
shortcut?: string;
|
|
12
|
+
fullWidth?: boolean;
|
|
13
|
+
iconStart?: React.ReactNode;
|
|
14
|
+
iconEnd?: React.ReactNode;
|
|
15
|
+
} & BaseButtonProps;
|
|
62
16
|
|
|
63
|
-
const
|
|
17
|
+
const button = css`
|
|
64
18
|
display: flex;
|
|
65
|
-
justify-content: center;
|
|
66
19
|
align-items: center;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
height: ${({buttonHeight = "auto"}) => (typeof buttonHeight === "string" ? buttonHeight : `${buttonHeight}px`)};
|
|
20
|
+
justify-content: center;
|
|
21
|
+
font-weight: ${fontWeight.medium};
|
|
22
|
+
white-space: nowrap;
|
|
23
|
+
`;
|
|
72
24
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
padding-right: ${getHorizontalPadding}px;
|
|
25
|
+
const shortcutContainer = css`
|
|
26
|
+
font-size: ${textStyles.small.fontSize}px;
|
|
27
|
+
font-weight: ${fontWeight.regular};
|
|
28
|
+
opacity: 0.7;
|
|
78
29
|
`;
|
|
79
|
-
export const buttonClassName = StyledButton;
|
|
80
30
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
${{
|
|
92
|
-
display: "inline-flex",
|
|
93
|
-
borderRadius: border.radius0,
|
|
94
|
-
marginRight: -1,
|
|
95
|
-
}}
|
|
31
|
+
const buttonSize = {
|
|
32
|
+
tiny: css`
|
|
33
|
+
font-size: 10px;
|
|
34
|
+
line-height: 14px;
|
|
35
|
+
border-radius: ${border.radius4}px;
|
|
36
|
+
min-height: 20px;
|
|
37
|
+
padding: ${space.s2}px ${space.s6}px;
|
|
38
|
+
gap: ${space.s2}px;
|
|
39
|
+
|
|
40
|
+
${iconSizeVar}: 14px;
|
|
96
41
|
`,
|
|
97
|
-
|
|
98
|
-
${
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
42
|
+
small: css`
|
|
43
|
+
font-size: ${textStyles.small.fontSize}px;
|
|
44
|
+
line-height: 16px;
|
|
45
|
+
border-radius: ${border.radius5}px;
|
|
46
|
+
min-height: 24px;
|
|
47
|
+
padding: ${space.s4}px ${space.s8}px;
|
|
48
|
+
gap: ${space.s4}px;
|
|
49
|
+
|
|
50
|
+
${iconSizeVar}: 16px;
|
|
102
51
|
`,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return colors.inversedTextColor;
|
|
108
|
-
}
|
|
109
|
-
return mainColor;
|
|
110
|
-
};
|
|
52
|
+
medium: css`
|
|
53
|
+
font-size: ${textStyles.regular.fontSize}px;
|
|
54
|
+
line-height: 20px;
|
|
55
|
+
letter-spacing: ${textStyles.regular.letterSpacing};
|
|
111
56
|
|
|
112
|
-
|
|
113
|
-
|
|
57
|
+
border-radius: ${border.radius6}px;
|
|
58
|
+
min-height: 28px;
|
|
59
|
+
padding: ${space.s4}px ${space.s12}px;
|
|
60
|
+
gap: ${space.s6}px;
|
|
114
61
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
62
|
+
${iconSizeVar}: 18px;
|
|
63
|
+
`,
|
|
64
|
+
large: css`
|
|
65
|
+
font-size: ${textStyles.regular.fontSize}px;
|
|
66
|
+
line-height: 20px;
|
|
67
|
+
letter-spacing: ${textStyles.regular.letterSpacing};
|
|
119
68
|
|
|
120
|
-
|
|
121
|
-
|
|
69
|
+
border-radius: ${border.radius6}px;
|
|
70
|
+
min-height: 32px;
|
|
71
|
+
padding: ${space.s6}px ${space.s14}px;
|
|
72
|
+
gap: ${space.s8}px;
|
|
122
73
|
|
|
123
|
-
|
|
124
|
-
${{
|
|
125
|
-
...textStyles.small,
|
|
126
|
-
color: "currentColor",
|
|
127
|
-
borderRadius: border.radius4,
|
|
128
|
-
paddingLeft: space.s4,
|
|
129
|
-
paddingRight: space.s4,
|
|
130
|
-
paddingBottom: space.s2,
|
|
131
|
-
marginRight: -space.s4,
|
|
132
|
-
marginLeft: space.s2,
|
|
133
|
-
opacity: opacity.opacity80,
|
|
134
|
-
display: "inline-block",
|
|
135
|
-
}}
|
|
136
|
-
`;
|
|
74
|
+
${iconSizeVar}: 18px;
|
|
137
75
|
|
|
138
|
-
|
|
76
|
+
& > .${shortcutContainer} {
|
|
77
|
+
font-size: ${textStyles.regular.fontSize}px;
|
|
78
|
+
}
|
|
79
|
+
`,
|
|
80
|
+
} as const;
|
|
139
81
|
|
|
140
|
-
const
|
|
141
|
-
|
|
82
|
+
const fullWidthMod = css`
|
|
83
|
+
width: 100%;
|
|
142
84
|
`;
|
|
143
85
|
|
|
144
|
-
export
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
shortcut?: string;
|
|
150
|
-
noOverflow?: boolean;
|
|
151
|
-
width?: string | number;
|
|
152
|
-
height?: string | number;
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
export const ButtonComponent = forwardRef<HTMLButtonElement, ButtonProps>(function Button(
|
|
156
|
-
{
|
|
157
|
-
disabled,
|
|
158
|
-
pending,
|
|
159
|
-
Icon,
|
|
160
|
-
inGroup,
|
|
161
|
-
shortcut,
|
|
162
|
-
noOverflow = true,
|
|
163
|
-
width,
|
|
164
|
-
height,
|
|
165
|
-
size = ":button-size/normal",
|
|
166
|
-
className,
|
|
167
|
-
children,
|
|
168
|
-
...baseProps
|
|
169
|
-
},
|
|
170
|
-
forwardedRef
|
|
171
|
-
) {
|
|
172
|
-
const theme = useTheme();
|
|
173
|
-
const mainColor = getMainColor({color: baseProps.color, dangerous: baseProps.dangerous, theme});
|
|
174
|
-
const textColor = getTextColor({mainColor, primary: baseProps.primary, theme});
|
|
175
|
-
const spinnerBgColor = getOpacities(textColor).opacity25;
|
|
176
|
-
const spinnerColor = getSpinnerColor({mainColor, primary: baseProps.primary});
|
|
177
|
-
|
|
178
|
-
const {iconSize, spinnerSize, leftContainerSize, leftContainerMarginRight} = getIconMagicConstants(size);
|
|
179
|
-
|
|
180
|
-
const leftContainer = pending ? (
|
|
181
|
-
<Spinner
|
|
182
|
-
backgroundColor={spinnerBgColor}
|
|
183
|
-
color={spinnerColor}
|
|
184
|
-
size={spinnerSize}
|
|
185
|
-
containerSize={leftContainerSize}
|
|
186
|
-
/>
|
|
187
|
-
) : Icon ? (
|
|
188
|
-
<Icon color={textColor} iconSize={iconSize} containerSize={leftContainerSize} />
|
|
189
|
-
) : null;
|
|
190
|
-
|
|
191
|
-
const styleVariable: StyledProps = {
|
|
192
|
-
buttonHeight: height,
|
|
193
|
-
buttonWidth: width,
|
|
194
|
-
buttonSize: size,
|
|
195
|
-
borderless: baseProps.borderless,
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
const isDisabled = disabled || pending;
|
|
199
|
-
|
|
200
|
-
return (
|
|
201
|
-
<StyledButton
|
|
202
|
-
{...styleVariable}
|
|
203
|
-
ref={forwardedRef}
|
|
204
|
-
onClick={!isDisabled && baseProps.onClick ? baseProps.onClick : _.noop}
|
|
205
|
-
disabled={isDisabled}
|
|
206
|
-
className={cx(className, inGroup && ordersInGroup[inGroup])}
|
|
207
|
-
{...baseProps}
|
|
208
|
-
>
|
|
209
|
-
<Item
|
|
210
|
-
leftContainer={leftContainer}
|
|
211
|
-
style={
|
|
212
|
-
{
|
|
213
|
-
[leftContainerMarginRightVar]: `${leftContainerMarginRight}px`,
|
|
214
|
-
} as React.CSSProperties
|
|
215
|
-
}
|
|
216
|
-
containerClassName={cx({[leftContainerClassName]: leftContainer && hasNonEmptyChild(children)})}
|
|
217
|
-
rightContainer={shortcut && <span className={cx(shortcutStyle)}>{shortcut}</span>}
|
|
218
|
-
noOverflow={noOverflow}
|
|
219
|
-
>
|
|
220
|
-
{children}
|
|
221
|
-
</Item>
|
|
222
|
-
</StyledButton>
|
|
223
|
-
);
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
/** @deprecated Please consider using ButtonV2 */
|
|
227
|
-
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(props, ref) {
|
|
228
|
-
if (isButtonsV2) {
|
|
229
|
-
const {
|
|
230
|
-
Icon,
|
|
231
|
-
dangerous,
|
|
232
|
-
borderless,
|
|
233
|
-
size = ":button-size/normal",
|
|
234
|
-
primary,
|
|
235
|
-
className,
|
|
236
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
237
|
-
noOverflow: _noOverflow,
|
|
238
|
-
...buttonProps
|
|
239
|
-
} = props;
|
|
240
|
-
|
|
241
|
-
const newSize = size === ":button-size/big" || size === ":button-size/normal" ? "medium" : "small";
|
|
242
|
-
|
|
86
|
+
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
87
|
+
(
|
|
88
|
+
{size = "medium", iconStart, iconEnd, className, children, pending, disabled, shortcut, fullWidth, ...buttonProps},
|
|
89
|
+
ref
|
|
90
|
+
) => {
|
|
243
91
|
return (
|
|
244
|
-
<
|
|
92
|
+
<BaseButton
|
|
245
93
|
ref={ref}
|
|
246
|
-
|
|
94
|
+
disabled={disabled || pending}
|
|
95
|
+
className={cx(className, button, buttonSize[size], fullWidth && fullWidthMod)}
|
|
247
96
|
{...buttonProps}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
97
|
+
>
|
|
98
|
+
{pending ? <SpinnerIcon /> : iconStart}
|
|
99
|
+
{children}
|
|
100
|
+
{iconEnd}
|
|
101
|
+
{shortcut ? <span className={shortcutContainer}>{shortcut}</span> : null}
|
|
102
|
+
</BaseButton>
|
|
253
103
|
);
|
|
254
104
|
}
|
|
255
|
-
|
|
256
|
-
});
|
|
105
|
+
);
|
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
import {css} from "@linaria/core";
|
|
2
|
-
import {styled} from "@linaria/react";
|
|
3
|
-
import cx from "classnames";
|
|
1
|
+
import {css, cx} from "@linaria/core";
|
|
4
2
|
import {forwardRef} from "react";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
3
|
+
import {BaseButtonProps, BaseButton, ButtonSize} from "./base-button";
|
|
4
|
+
import {border, space} from "../design-system";
|
|
5
|
+
import {iconSizeVar} from "../icons/Icon";
|
|
6
|
+
import Spinner from "../icons/react/Spinner";
|
|
9
7
|
|
|
10
|
-
export type
|
|
8
|
+
export type IconButtonProps = {
|
|
9
|
+
size?: ButtonSize;
|
|
10
|
+
pending?: boolean;
|
|
11
|
+
} & BaseButtonProps;
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const iconButton = css`
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
gap: ${space.s2}px;
|
|
18
|
+
`;
|
|
15
19
|
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
20
|
+
const iconButtonSizes = {
|
|
21
|
+
tiny: css`
|
|
22
|
+
padding: ${space.s2}px;
|
|
23
|
+
min-width: 20px;
|
|
24
|
+
min-height: 20px;
|
|
25
|
+
border-radius: ${border.radius4}px;
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
+
${iconSizeVar}: 16px;
|
|
28
|
+
`,
|
|
29
|
+
small: css`
|
|
30
|
+
padding: ${space.s4}px;
|
|
31
|
+
min-width: 24px;
|
|
32
|
+
min-height: 24px;
|
|
33
|
+
border-radius: ${border.radius5}px;
|
|
27
34
|
|
|
28
|
-
|
|
35
|
+
${iconSizeVar}: 16px;
|
|
36
|
+
`,
|
|
37
|
+
medium: css`
|
|
38
|
+
padding: ${space.s4}px;
|
|
39
|
+
min-width: 28px;
|
|
40
|
+
min-height: 28px;
|
|
41
|
+
border-radius: ${border.radius6}px;
|
|
29
42
|
|
|
30
|
-
|
|
43
|
+
${iconSizeVar}: 18px;
|
|
44
|
+
`,
|
|
45
|
+
large: css`
|
|
46
|
+
padding: ${space.s6}px;
|
|
31
47
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
48
|
+
min-width: 32px;
|
|
49
|
+
min-height: 32px;
|
|
50
|
+
border-radius: ${border.radius6}px;
|
|
36
51
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
`;
|
|
52
|
+
${iconSizeVar}: 18px;
|
|
53
|
+
`,
|
|
54
|
+
};
|
|
41
55
|
|
|
42
|
-
/** @deprecated Please consider using IconButtonV2 */
|
|
43
56
|
export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton(
|
|
44
|
-
{size = "
|
|
57
|
+
{size = "medium", className, variant = "ghost", color = "neutral", pending, children, ...rest},
|
|
45
58
|
ref
|
|
46
59
|
) {
|
|
47
|
-
if (isButtonsV2) {
|
|
48
|
-
return (
|
|
49
|
-
<IconButtonV2
|
|
50
|
-
ref={ref}
|
|
51
|
-
className={className}
|
|
52
|
-
{...rest}
|
|
53
|
-
size={size === "big" || size === "normal" ? "medium" : "small"}
|
|
54
|
-
color={dangerous ? "error" : primary ? "accent" : "neutral"}
|
|
55
|
-
variant={primary ? "solid" : borderless ? "ghost" : "outline"}
|
|
56
|
-
/>
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
60
|
return (
|
|
61
|
-
<
|
|
61
|
+
<BaseButton
|
|
62
62
|
ref={ref}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
dangerous={dangerous}
|
|
67
|
-
borderless={borderless}
|
|
63
|
+
className={cx(className, iconButton, iconButtonSizes[size])}
|
|
64
|
+
variant={variant}
|
|
65
|
+
color={color}
|
|
68
66
|
{...rest}
|
|
69
|
-
|
|
67
|
+
>
|
|
68
|
+
{pending ? <Spinner /> : children}
|
|
69
|
+
</BaseButton>
|
|
70
70
|
);
|
|
71
71
|
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// TODO: this can be incorporated inside Button component
|
|
2
|
+
// but let's keep it separate while migration is on
|
|
3
|
+
// so it's easier to find buttons with custom colors
|
|
4
|
+
|
|
5
|
+
import {CSSProperties} from "@linaria/core";
|
|
6
|
+
import {getDarkenColor, getOpacities, themeVars} from "../design-system";
|
|
7
|
+
import {ButtonVariant} from "./base-button";
|
|
8
|
+
|
|
9
|
+
export const makeButtonColors = (color: string, variant: ButtonVariant) => {
|
|
10
|
+
if (variant === "solid") {
|
|
11
|
+
return {
|
|
12
|
+
"--fibery-button-color": color,
|
|
13
|
+
"--fibery-button-hover-color": getDarkenColor(color),
|
|
14
|
+
"--fibery-button-text-color": themeVars.buttonPrimaryTextColor,
|
|
15
|
+
"--fibery-button-text-active-color": themeVars.buttonPrimaryTextColor,
|
|
16
|
+
"--fibery-button-focus-color": getOpacities(color).opacity30,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
"--fibery-button-color": "transparent",
|
|
22
|
+
"--fibery-button-hover-color": getOpacities(color).opacity15,
|
|
23
|
+
"--fibery-button-text-color": color,
|
|
24
|
+
"--fibery-button-text-active-color": getOpacities(color).opacity80,
|
|
25
|
+
"--fibery-button-focus-color": getOpacities(color).opacity30,
|
|
26
|
+
|
|
27
|
+
...(variant === "outline"
|
|
28
|
+
? {
|
|
29
|
+
"--fibery-button-border-color": getOpacities(color).opacity30,
|
|
30
|
+
}
|
|
31
|
+
: undefined),
|
|
32
|
+
} as CSSProperties;
|
|
33
|
+
};
|
package/src/design-system.ts
CHANGED
|
@@ -419,7 +419,6 @@ export const themeColors = {
|
|
|
419
419
|
// :focus, :focus:hover
|
|
420
420
|
colorBgPinnedFieldsLabel: [slate.slate11, slateDark.slate11],
|
|
421
421
|
colorBgObjectEditorSeparator: [slate.slate12, slateDark.slate12],
|
|
422
|
-
colorBgObjectEditorSeparatorButton: [slate.slate4, slateDark.slate4],
|
|
423
422
|
colorBgMenuItemSelectedFocused: [indigo.indigo6, indigoDark.indigo6],
|
|
424
423
|
colorBgFieldEditorContainer: [slate.slate2, slateDark.slate3],
|
|
425
424
|
colorBgFieldEditorLinkEqualSign: [slate.slate6, slateDark.slate2],
|
|
@@ -592,7 +591,7 @@ export const themeColors = {
|
|
|
592
591
|
colorBgButtonGhostAccentDefault: [transparent, transparent],
|
|
593
592
|
colorBgButtonGhostAccentHover: [indigo.indigo3, indigoDark.indigo3],
|
|
594
593
|
colorBgButtonGhostNeutralDefault: [transparent, transparent],
|
|
595
|
-
colorBgButtonGhostNeutralHover: [slate.
|
|
594
|
+
colorBgButtonGhostNeutralHover: [getOpacities(slate.slate6).opacity60, getOpacities(slateDark.slate6).opacity80],
|
|
596
595
|
colorBgButtonGhostDestructiveDefault: [transparent, transparent],
|
|
597
596
|
colorBgButtonGhostDestructiveHover: [red.red4, redDark.red4],
|
|
598
597
|
colorTextButtonGhostAccent: [indigo.indigo11, indigoDark.indigo11],
|
|
@@ -881,14 +880,15 @@ export const space = {
|
|
|
881
880
|
s128: 128,
|
|
882
881
|
} as const;
|
|
883
882
|
/** Token for nested items spacing in nested trees */
|
|
884
|
-
export const spaceNestedTreeLevel =
|
|
883
|
+
export const spaceNestedTreeLevel = 12;
|
|
885
884
|
export const spaceNestedTreeInterval = 0;
|
|
886
885
|
export const layout = {
|
|
887
|
-
logoSize:
|
|
886
|
+
logoSize: 15,
|
|
888
887
|
menuDefaultWidth: 243,
|
|
889
888
|
desktopToolbarHeight: 32,
|
|
890
|
-
desktopMenuMinWidth:
|
|
891
|
-
|
|
889
|
+
desktopMenuMinWidth: 240,
|
|
890
|
+
collapsedMenuMinWidth: 48,
|
|
891
|
+
menuMinWidth: 240, //TODO: make dependency to itemHeight
|
|
892
892
|
menuMaxWidth: 480,
|
|
893
893
|
menuItemMinWidth: 80,
|
|
894
894
|
menuGroupHeaderIndent: 28, // I'm ok
|
|
@@ -899,7 +899,8 @@ export const layout = {
|
|
|
899
899
|
groupTitleHeight: 30,
|
|
900
900
|
enumItemHeight: 32,
|
|
901
901
|
menuItemHeight: 32,
|
|
902
|
-
newMenuItemHeight:
|
|
902
|
+
newMenuItemHeight: 28, // I'm ok
|
|
903
|
+
newMenuIconSize: 20,
|
|
903
904
|
viewHeaderHeight: space.s12 * 7,
|
|
904
905
|
viewHeaderCompactHeight: 52,
|
|
905
906
|
columnMinWidth: 240,
|
|
@@ -133,20 +133,21 @@ export const Content = forwardRef<HTMLDivElement, ContentProps>(function Dropdow
|
|
|
133
133
|
|
|
134
134
|
export const Sub = DropdownMenuPrimitive.Sub;
|
|
135
135
|
|
|
136
|
-
export const SubContent = forwardRef<
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
);
|
|
136
|
+
export const SubContent = forwardRef<
|
|
137
|
+
HTMLDivElement,
|
|
138
|
+
DropdownMenuPrimitive.DropdownMenuSubContentProps & {container?: HTMLElement | null}
|
|
139
|
+
>(function DropdownMenuSubContent({className, collisionPadding = space.s12, container, ...rest}, ref) {
|
|
140
|
+
return (
|
|
141
|
+
<DropdownMenuPrimitive.Portal container={container}>
|
|
142
|
+
<DropdownMenuPrimitive.SubContent
|
|
143
|
+
ref={ref}
|
|
144
|
+
className={cx(dropdownMenuContentStyles, className)}
|
|
145
|
+
collisionPadding={collisionPadding}
|
|
146
|
+
{...rest}
|
|
147
|
+
/>
|
|
148
|
+
</DropdownMenuPrimitive.Portal>
|
|
149
|
+
);
|
|
150
|
+
});
|
|
150
151
|
|
|
151
152
|
export const SubTrigger = styled(DropdownMenuPrimitive.SubTrigger)`
|
|
152
153
|
${rowItemStyles}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {css} from "@linaria/core";
|
|
2
|
-
import {
|
|
2
|
+
import {useRef, useState} from "react";
|
|
3
3
|
import {IconButton} from "../button/icon-button";
|
|
4
4
|
import {CollapsibleContent, CollapsibleRoot, CollapsibleTrigger} from "../collapsible";
|
|
5
5
|
import {ColorPicker} from "../color-picker";
|
|
@@ -30,15 +30,8 @@ const ColorPickerCollapsibleTrigger: React.FC<ColorPickerCollapsibleTrigger> = (
|
|
|
30
30
|
return (
|
|
31
31
|
<CollapsibleTrigger asChild>
|
|
32
32
|
<Tooltip title={label}>
|
|
33
|
-
<IconButton
|
|
34
|
-
|
|
35
|
-
size="big"
|
|
36
|
-
className={css`
|
|
37
|
-
border-top-left-radius: 0;
|
|
38
|
-
border-bottom-left-radius: 0;
|
|
39
|
-
`}
|
|
40
|
-
>
|
|
41
|
-
<Icon color={iconColor} iconSize={18} containerSize={20} />
|
|
33
|
+
<IconButton data-testid="emoji-picker-color-trigger" size="small">
|
|
34
|
+
<Icon color={iconColor} />
|
|
42
35
|
</IconButton>
|
|
43
36
|
</Tooltip>
|
|
44
37
|
</CollapsibleTrigger>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type {EmojiItem} from "@fibery/emoji-data";
|
|
2
2
|
import {measureScrollbar} from "@fibery/helpers/utils/measure-scrollbar";
|
|
3
3
|
import {css} from "@linaria/core";
|
|
4
|
-
import {Button} from "../button";
|
|
4
|
+
import {Button} from "../button/button";
|
|
5
5
|
import {fontFamily, space, themeVars, typeSizes} from "../design-system";
|
|
6
6
|
import {Emoji} from "./primitives/emoji";
|
|
7
7
|
import {EmojiPickerFooter} from "./primitives/footer";
|
|
@@ -70,7 +70,7 @@ export const EmojiPickerPreviewFooter: React.FC<{
|
|
|
70
70
|
{emojiPreview ? (
|
|
71
71
|
<EmojiPreview emoji={emojiPreview.emoji} />
|
|
72
72
|
) : onAddCustomEmoji ? (
|
|
73
|
-
<Button size="
|
|
73
|
+
<Button variant="outline" color="neutral" size="small" onClick={onAddCustomEmoji}>
|
|
74
74
|
Add Emoji
|
|
75
75
|
</Button>
|
|
76
76
|
) : null}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {css} from "@linaria/core";
|
|
2
2
|
import {compact} from "lodash";
|
|
3
|
-
import {Button} from "../button";
|
|
4
3
|
import {AntTabs} from "../antd/Tabs";
|
|
4
|
+
import {Button} from "../button/button";
|
|
5
5
|
import {space, textStyles} from "../design-system";
|
|
6
|
+
import EmojiDelete from "../icons/react/EmojiDelete";
|
|
6
7
|
import {$TSFixMe} from "../tsfixme";
|
|
7
8
|
import {AppIconPicker, AppIconPickerProps} from "./app-icon-picker";
|
|
8
9
|
import {EmojiPicker, EmojiPickerProps} from "./emoji-picker";
|
|
9
|
-
import EmojiDelete from "../icons/react/EmojiDelete";
|
|
10
10
|
|
|
11
11
|
const TabHeader: React.FC<React.PropsWithChildren> = ({children}) => (
|
|
12
12
|
<div
|
|
@@ -89,7 +89,7 @@ export const IconEmojiPicker: React.FC<IconEmojiPickerProps> = ({
|
|
|
89
89
|
padding-right: ${space.s12}px;
|
|
90
90
|
`}
|
|
91
91
|
>
|
|
92
|
-
<Button
|
|
92
|
+
<Button variant="outline" color="neutral" iconStart={<EmojiDelete />} size={"small"} onClick={onReset}>
|
|
93
93
|
{resetLabel}
|
|
94
94
|
</Button>
|
|
95
95
|
</div>
|