@fibery/ui-kit 1.5.0 → 1.7.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/index.ts +0 -1
- package/package.json +37 -23
- package/src/Item.tsx +5 -2
- package/src/Pallete.ts +191 -191
- package/src/Select/components.tsx +22 -21
- package/src/Select/index.tsx +60 -25
- package/src/Select/select-control-settings-context.tsx +20 -0
- package/src/Select/select-in-popover.tsx +333 -0
- package/src/Select/styles.ts +27 -1
- package/src/ThemeProvider.tsx +1 -1
- package/src/antd/styles.ts +3 -3
- package/src/designSystem.ts +80 -63
- package/src/error-alert.tsx +2 -2
- package/src/icons/Icon.tsx +17 -12
- package/src/icons/ast/AddGroup.ts +8 -0
- package/src/icons/ast/AiAssistant.ts +8 -0
- package/src/icons/ast/AiAvatar.ts +8 -0
- package/src/icons/ast/ArrowBottom.ts +3 -27
- package/src/icons/ast/ArrowCollapse.ts +3 -27
- package/src/icons/ast/ArrowCollapseVertical.ts +3 -27
- package/src/icons/ast/ArrowLeft.ts +3 -27
- package/src/icons/ast/ArrowRight.ts +3 -27
- package/src/icons/ast/ArrowTop.ts +3 -27
- package/src/icons/ast/Atom.ts +8 -0
- package/src/icons/ast/Copy.ts +8 -0
- package/src/icons/ast/DynamicFilterValue.ts +8 -0
- package/src/icons/ast/ExtensionAssignments.ts +3 -35
- package/src/icons/ast/FileUpload.ts +8 -0
- package/src/icons/ast/FormWithCover.ts +8 -0
- package/src/icons/ast/FormWithoutCover.ts +8 -0
- package/src/icons/ast/Github.ts +3 -27
- package/src/icons/ast/Gitlab.ts +3 -25
- package/src/icons/ast/Hint.ts +1 -1
- package/src/icons/ast/Jira.ts +8 -0
- package/src/icons/ast/Markdown.ts +8 -0
- package/src/icons/ast/Minus.ts +3 -23
- package/src/icons/ast/MoreCompact.ts +1 -1
- package/src/icons/ast/RicheditorBlockFile.ts +8 -0
- package/src/icons/ast/RicheditorBlockH4.ts +1 -1
- package/src/icons/ast/SimpleCompass.ts +8 -0
- package/src/icons/ast/Templates.ts +8 -0
- package/src/icons/ast/TypeLocation.ts +8 -0
- package/src/icons/ast/ViewForm.ts +3 -25
- package/src/icons/ast/ViewMap.ts +8 -0
- package/src/icons/ast/index.tsx +199 -182
- package/src/icons/react/AddGroup.tsx +12 -0
- package/src/icons/react/AiAssistant.tsx +12 -0
- package/src/icons/react/AiAvatar.tsx +12 -0
- package/src/icons/react/Atom.tsx +12 -0
- package/src/icons/react/Copy.tsx +12 -0
- package/src/icons/react/DynamicFilterValue.tsx +12 -0
- package/src/icons/react/FileUpload.tsx +12 -0
- package/src/icons/react/FormWithCover.tsx +12 -0
- package/src/icons/react/FormWithoutCover.tsx +12 -0
- package/src/icons/react/Github.tsx +8 -6
- package/src/icons/react/Gitlab.tsx +8 -6
- package/src/icons/react/Jira.tsx +12 -0
- package/src/icons/react/Markdown.tsx +12 -0
- package/src/icons/react/Minus.tsx +8 -6
- package/src/icons/react/RicheditorBlockFile.tsx +12 -0
- package/src/icons/react/SimpleCompass.tsx +12 -0
- package/src/icons/react/Templates.tsx +12 -0
- package/src/icons/react/TypeLocation.tsx +12 -0
- package/src/icons/react/ViewForm.tsx +8 -6
- package/src/icons/react/ViewMap.tsx +12 -0
- package/src/icons/react/index.tsx +199 -182
- package/src/tooltip.tsx +132 -152
- package/src/BackButton.tsx +0 -27
- package/src/Button.d.ts +0 -28
- package/src/Button.js +0 -360
- package/src/antd/ant-tooltip.tsx +0 -5
- package/src/icons/IconAsBackground.tsx +0 -15
package/src/tooltip.tsx
CHANGED
|
@@ -1,184 +1,164 @@
|
|
|
1
|
-
import {css} from "@linaria/core";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import {css, cx} from "@linaria/core";
|
|
2
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
3
|
+
import type {ReactNode, SyntheticEvent} from "react";
|
|
4
|
+
import {border, lineHeight, space, themeVars, tooltipDelay} from "./designSystem";
|
|
5
|
+
|
|
6
|
+
const preventDefaultAndStopPropagation = (e: SyntheticEvent) => {
|
|
7
|
+
e.preventDefault();
|
|
8
|
+
e.stopPropagation();
|
|
9
|
+
};
|
|
7
10
|
|
|
8
11
|
const titleStyle = css`
|
|
9
|
-
${
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
opacity: opacity.opacity90,
|
|
13
|
-
}}
|
|
12
|
+
color: ${themeVars.whiteColor};
|
|
13
|
+
line-height: ${lineHeight.heading};
|
|
14
|
+
font-weight: 500;
|
|
14
15
|
`;
|
|
15
16
|
|
|
16
17
|
const descriptionStyle = css`
|
|
17
|
-
${
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}}
|
|
18
|
+
color: ${themeVars.shortcutTextColor};
|
|
19
|
+
line-height: ${lineHeight.heading};
|
|
20
|
+
font-weight: 400;
|
|
21
21
|
`;
|
|
22
22
|
|
|
23
23
|
const tooltipStyle = css`
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
24
|
+
font-size: 13px;
|
|
25
|
+
color: ${themeVars.whiteColor};
|
|
26
|
+
z-index: 100000;
|
|
27
|
+
min-height: 30px;
|
|
28
|
+
max-width: 300px;
|
|
29
|
+
background-color: ${themeVars.tooltipBgColor};
|
|
30
|
+
padding: ${space.s}px ${space.m}px;
|
|
31
|
+
border-radius: ${border.radius6}px;
|
|
32
|
+
box-shadow: ${themeVars.actionMenuShadow};
|
|
33
|
+
|
|
34
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
35
|
+
@keyframes zoomIn {
|
|
36
|
+
from {
|
|
37
|
+
opacity: 0;
|
|
38
|
+
transform: scale(0.8);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
to {
|
|
42
|
+
opacity: 1;
|
|
43
|
+
transform: scale(1);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@keyframes zoomOut {
|
|
48
|
+
from {
|
|
49
|
+
transform: scale(1);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
to {
|
|
53
|
+
opacity: 0;
|
|
54
|
+
transform: scale(0.8);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
will-change: transform, opacity;
|
|
59
|
+
transform-origin: var(--radix-tooltip-content-transform-origin);
|
|
60
|
+
animation-duration: 0.1s;
|
|
61
|
+
|
|
62
|
+
&[data-state="delayed-open"] {
|
|
63
|
+
animation-name: zoomIn;
|
|
64
|
+
animation-timing-function: ease-out;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
40
67
|
`;
|
|
41
68
|
|
|
42
69
|
const whiteBgStyle = css`
|
|
43
|
-
${
|
|
44
|
-
|
|
45
|
-
backgroundColor: themeVars.actionMenuInnerBg,
|
|
46
|
-
color: themeVars.textColor,
|
|
47
|
-
},
|
|
48
|
-
}}
|
|
70
|
+
background-color: ${themeVars.actionMenuInnerBg};
|
|
71
|
+
color: ${themeVars.textColor};
|
|
49
72
|
`;
|
|
50
73
|
|
|
51
|
-
type AlignPoint = string;
|
|
52
|
-
|
|
53
|
-
export interface AlignType {
|
|
54
|
-
/**
|
|
55
|
-
* move point of source node to align with point of target node.
|
|
56
|
-
* Such as ['tr','cc'], align top right point of source node with center point of target node.
|
|
57
|
-
* Point can be 't'(top), 'b'(bottom), 'c'(center), 'l'(left), 'r'(right) */
|
|
58
|
-
points?: AlignPoint[];
|
|
59
|
-
/**
|
|
60
|
-
* offset source node by offset[0] in x and offset[1] in y.
|
|
61
|
-
* If offset contains percentage string value, it is relative to sourceNode region.
|
|
62
|
-
*/
|
|
63
|
-
offset?: number[];
|
|
64
|
-
/**
|
|
65
|
-
* offset target node by offset[0] in x and offset[1] in y.
|
|
66
|
-
* If targetOffset contains percentage string value, it is relative to targetNode region.
|
|
67
|
-
*/
|
|
68
|
-
targetOffset?: number[];
|
|
69
|
-
/**
|
|
70
|
-
* If adjustX field is true, will adjust source node in x direction if source node is invisible.
|
|
71
|
-
* If adjustY field is true, will adjust source node in y direction if source node is invisible.
|
|
72
|
-
*/
|
|
73
|
-
overflow?: {
|
|
74
|
-
adjustX?: boolean | number;
|
|
75
|
-
adjustY?: boolean | number;
|
|
76
|
-
};
|
|
77
|
-
/**
|
|
78
|
-
* Whether use css right instead of left to position
|
|
79
|
-
*/
|
|
80
|
-
useCssRight?: boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Whether use css bottom instead of top to position
|
|
83
|
-
*/
|
|
84
|
-
useCssBottom?: boolean;
|
|
85
|
-
/**
|
|
86
|
-
* Whether use css transform instead of left/top/right/bottom to position if browser supports.
|
|
87
|
-
* Defaults to false.
|
|
88
|
-
*/
|
|
89
|
-
useCssTransform?: boolean;
|
|
90
|
-
ignoreShake?: boolean;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const alignByPlacement = {
|
|
94
|
-
bottom: {offset: [0, -2] as [number, number]},
|
|
95
|
-
};
|
|
96
|
-
|
|
97
74
|
export const TooltipTitle = ({children}: {children: ReactNode}) => <div className={titleStyle}>{children}</div>;
|
|
98
75
|
export const TooltipDescription = ({children}: {children: ReactNode}) => (
|
|
99
76
|
<div className={descriptionStyle}>{children}</div>
|
|
100
77
|
);
|
|
101
78
|
|
|
102
|
-
export
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
>
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
);
|
|
115
|
-
}
|
|
79
|
+
export const TooltipContent = ({title, shortcut}: {title: string; shortcut?: string}) => (
|
|
80
|
+
<div
|
|
81
|
+
className={css`
|
|
82
|
+
display: flex;
|
|
83
|
+
flex-direction: column;
|
|
84
|
+
align-items: center;
|
|
85
|
+
`}
|
|
86
|
+
>
|
|
87
|
+
<TooltipTitle>{title}</TooltipTitle>
|
|
88
|
+
{shortcut ? <TooltipDescription>{shortcut}</TooltipDescription> : null}
|
|
89
|
+
</div>
|
|
90
|
+
);
|
|
116
91
|
|
|
117
|
-
|
|
92
|
+
export const TooltipProvider: React.FC<TooltipPrimitive.TooltipProviderProps> = (props) => (
|
|
93
|
+
<TooltipPrimitive.Provider disableHoverableContent skipDelayDuration={150} {...props} />
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
export type TooltipProps = {
|
|
118
97
|
title?: ReactNode;
|
|
119
98
|
description?: ReactNode;
|
|
120
99
|
content?: ReactNode;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
100
|
+
side?: TooltipPrimitive.TooltipContentProps["side"];
|
|
101
|
+
sideOffset?: TooltipPrimitive.TooltipContentProps["sideOffset"];
|
|
102
|
+
align?: TooltipPrimitive.TooltipContentProps["align"];
|
|
103
|
+
alignOffset?: TooltipPrimitive.TooltipContentProps["alignOffset"];
|
|
125
104
|
instant?: boolean;
|
|
126
|
-
|
|
127
|
-
children: JSX.Element | string;
|
|
105
|
+
children: ReactNode;
|
|
128
106
|
whiteBg?: boolean;
|
|
107
|
+
visible?: boolean;
|
|
129
108
|
onVisibleChange?: (visible: boolean) => void;
|
|
130
|
-
|
|
131
|
-
|
|
109
|
+
disabled?: boolean;
|
|
110
|
+
/** should keep tooltip visible after click */
|
|
111
|
+
keepOnClick?: boolean;
|
|
132
112
|
};
|
|
133
113
|
|
|
134
|
-
export
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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;
|
|
157
141
|
|
|
158
142
|
return (
|
|
159
|
-
<
|
|
160
|
-
|
|
161
|
-
{
|
|
162
|
-
|
|
163
|
-
placement={placement}
|
|
164
|
-
mouseEnterDelay={mouseEnterDelay || (instant ? 0 : tooltipDelay.enter)}
|
|
165
|
-
mouseLeaveDelay={instant ? 0 : tooltipDelay.leave}
|
|
166
|
-
overlayClassName={cx(tooltipStyle, {[whiteBgStyle]: whiteBg})}
|
|
167
|
-
align={align || (placement === "bottom" ? alignByPlacement.bottom : undefined)}
|
|
168
|
-
onVisibleChange={onVisibleChange}
|
|
169
|
-
destroyTooltipOnHide={destroyTooltipOnHide}
|
|
170
|
-
getPopupContainer={getPopupContainer}
|
|
143
|
+
<TooltipPrimitive.Root
|
|
144
|
+
delayDuration={instant ? 0 : tooltipDelay.enter}
|
|
145
|
+
open={disabled ? false : Boolean(content) && visible}
|
|
146
|
+
onOpenChange={onVisibleChange}
|
|
171
147
|
>
|
|
172
|
-
{
|
|
173
|
-
|
|
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>
|
|
174
163
|
);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
Tooltip.propTypes = {
|
|
178
|
-
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
179
|
-
description: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
|
180
|
-
content: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
|
181
|
-
placement: PropTypes.string,
|
|
182
|
-
visible: PropTypes.bool,
|
|
183
|
-
instant: PropTypes.bool,
|
|
184
164
|
};
|
package/src/BackButton.tsx
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import {Button} from "@fibery/ui-kit";
|
|
2
|
-
import BackIcon from "./icons/react/Back";
|
|
3
|
-
import {Size} from "@fibery/ui-kit/src/Button";
|
|
4
|
-
|
|
5
|
-
type Props = {
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
pending?: boolean;
|
|
8
|
-
onClick: () => unknown;
|
|
9
|
-
size?: Size;
|
|
10
|
-
color?: string;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export function BackButton({disabled, onClick, pending, size, color}: Props) {
|
|
14
|
-
return (
|
|
15
|
-
<Button
|
|
16
|
-
borderless
|
|
17
|
-
Icon={BackIcon}
|
|
18
|
-
disabled={disabled}
|
|
19
|
-
onClick={onClick}
|
|
20
|
-
pending={pending}
|
|
21
|
-
size={size}
|
|
22
|
-
color={color}
|
|
23
|
-
>
|
|
24
|
-
Back
|
|
25
|
-
</Button>
|
|
26
|
-
);
|
|
27
|
-
}
|
package/src/Button.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type {ComponentPropsWithRef, FunctionComponent} from "react";
|
|
2
|
-
import {IconBaseProps} from "./icons/types";
|
|
3
|
-
export type Size = ":button-size/super-small" | ":button-size/small" | ":button-size/normal" | ":button-size/big";
|
|
4
|
-
type PositionInGroup = "first" | "middle" | "last";
|
|
5
|
-
type Props = {
|
|
6
|
-
size?: Size;
|
|
7
|
-
borderless?: boolean;
|
|
8
|
-
Icon?: ((props: IconBaseProps) => JSX.Element) | null;
|
|
9
|
-
color?: string;
|
|
10
|
-
primary?: boolean;
|
|
11
|
-
pending?: boolean;
|
|
12
|
-
width?: string | number;
|
|
13
|
-
height?: string | number;
|
|
14
|
-
inGroup?: PositionInGroup;
|
|
15
|
-
} & Omit<ComponentPropsWithRef<"button">, "size" | "width" | "height">;
|
|
16
|
-
|
|
17
|
-
export const Button: FunctionComponent<Props>;
|
|
18
|
-
export const buttonClassName: string;
|
|
19
|
-
|
|
20
|
-
export const ActionsButton: FunctionComponent<{
|
|
21
|
-
inverted?: boolean;
|
|
22
|
-
label?: string;
|
|
23
|
-
color?: string;
|
|
24
|
-
onClick?: Props["onClick"];
|
|
25
|
-
}>;
|
|
26
|
-
export const ActionsButtonCompact: FunctionComponent<
|
|
27
|
-
{inverted?: boolean} & Omit<Props, "color" | "borderless" | "Icon" | "size">
|
|
28
|
-
>;
|