@fibery/ui-kit 1.39.1 → 1.40.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/CHANGELOG.md +12 -0
- package/package.json +7 -7
- package/src/appIcons.json +10 -0
- package/src/box.tsx +2 -2
- package/src/button/base-button.tsx +18 -3
- package/src/button/button.tsx +14 -6
- package/src/button/icon-button.tsx +4 -1
- package/src/button/select-button.tsx +11 -3
- package/src/collapsible/index.tsx +2 -2
- package/src/command-menu/index.tsx +4 -2
- package/src/copy-to-clipboard.ts +10 -0
- package/src/dot.tsx +36 -0
- package/src/file-item-2.tsx +223 -133
- package/src/file-item.tsx +2 -0
- package/src/guide-link.tsx +1 -1
- package/src/html-styles.ts +13 -27
- package/src/icons/ast/FileImage.ts +1 -1
- package/src/icons/ast/Mermaid.ts +8 -0
- package/src/icons/ast/QuickFilter.ts +8 -0
- package/src/icons/ast/QuickFilterPersonal.ts +8 -0
- package/src/icons/ast/TextNoWrap.ts +8 -0
- package/src/icons/ast/TextWrap.ts +8 -0
- package/src/icons/ast/TypeId.ts +8 -0
- package/src/icons/ast/index.tsx +6 -0
- package/src/icons/react/Mermaid.tsx +13 -0
- package/src/icons/react/QuickFilter.tsx +13 -0
- package/src/icons/react/QuickFilterPersonal.tsx +13 -0
- package/src/icons/react/TextNoWrap.tsx +13 -0
- package/src/icons/react/TextWrap.tsx +13 -0
- package/src/icons/react/TypeId.tsx +13 -0
- package/src/icons/react/index.tsx +6 -0
- package/src/icons/svg/file-image.svg +2 -2
- package/src/icons/svg/mermaid.svg +3 -0
- package/src/icons/svg/quick-filter-personal.svg +3 -0
- package/src/icons/svg/quick-filter.svg +3 -0
- package/src/icons/svg/text-no-wrap.svg +3 -0
- package/src/icons/svg/text-wrap.svg +3 -0
- package/src/icons/svg/type/id.svg +3 -0
- package/src/images-gallery/get-gallery-src.ts +71 -0
- package/src/images-gallery/images-gallery-fall-through-provider.tsx +2 -1
- package/src/images-gallery/images-gallery.tsx +524 -185
- package/src/{images-gallery-2 → images-gallery}/slide-buttons.tsx +25 -13
- package/src/images-gallery/thumbnails-mime-types-white-list.ts +17 -0
- package/src/images-gallery/zoom.tsx +5 -94
- package/src/notification-dot.tsx +11 -21
- package/src/popover/index.tsx +8 -4
- package/src/select/components/menu-list-virtualized.tsx +123 -84
- package/src/select/components/menu.tsx +6 -3
- package/src/select/index.tsx +95 -259
- package/src/select/select-in-popover.tsx +11 -3
- package/src/select/select.tsx +288 -0
- package/src/table.tsx +13 -10
- package/src/toggle-button/toggle-button.tsx +21 -4
- package/src/toggle-on-off.tsx +10 -1
- package/src/images-gallery-2/images-gallery-2.tsx +0 -522
- package/src/images-gallery-2/zoom.tsx +0 -35
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fibery/ui-kit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.40.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"dependencies": {
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"@radix-ui/react-context-menu": "2.2.1",
|
|
12
12
|
"@radix-ui/react-dropdown-menu": "2.1.1",
|
|
13
13
|
"@radix-ui/react-navigation-menu": "1.2.1",
|
|
14
|
+
"@radix-ui/react-slot": "1.2.4",
|
|
14
15
|
"@radix-ui/react-toast": "1.2.2",
|
|
15
16
|
"@radix-ui/react-toggle": "1.1.10",
|
|
16
17
|
"@radix-ui/react-toggle-group": "1.1.11",
|
|
@@ -39,7 +40,6 @@
|
|
|
39
40
|
"react-color": "2.19.3",
|
|
40
41
|
"react-day-picker": "8.10.1",
|
|
41
42
|
"react-intersection-observer": "9.3.5",
|
|
42
|
-
"react-medium-image-zoom": "5.2.10",
|
|
43
43
|
"react-popper": "2.3.0",
|
|
44
44
|
"react-select": "5.3.2",
|
|
45
45
|
"react-select-country-list": "2.2.1",
|
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@babel/core": "7.28.5",
|
|
60
60
|
"@babel/runtime": "7.28.4",
|
|
61
|
-
"@testing-library/dom": "
|
|
61
|
+
"@testing-library/dom": "10.4.1",
|
|
62
62
|
"@testing-library/jest-dom": "6.9.1",
|
|
63
|
-
"@testing-library/react": "
|
|
64
|
-
"@testing-library/user-event": "
|
|
63
|
+
"@testing-library/react": "16.3.1",
|
|
64
|
+
"@testing-library/user-event": "14.6.1",
|
|
65
65
|
"@types/chroma-js": "2.1.3",
|
|
66
66
|
"@types/color-hash": "1.0.2",
|
|
67
67
|
"@types/history": "4.7.11",
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"svgo": "2.8.0",
|
|
84
84
|
"typescript": "5.9.3",
|
|
85
85
|
"unist-util-reduce": "0.2.2",
|
|
86
|
-
"@fibery/
|
|
87
|
-
"@fibery/
|
|
86
|
+
"@fibery/eslint-config": "8.6.2",
|
|
87
|
+
"@fibery/babel-preset": "7.4.1"
|
|
88
88
|
},
|
|
89
89
|
"jest": {
|
|
90
90
|
"testEnvironment": "jsdom",
|
package/src/appIcons.json
CHANGED
|
@@ -13063,6 +13063,16 @@
|
|
|
13063
13063
|
"imageUrl": "https://images-temp.fibery.io/ui/appIcons/linear.svg",
|
|
13064
13064
|
"file": "linear.svg"
|
|
13065
13065
|
},
|
|
13066
|
+
{
|
|
13067
|
+
"name": "Stripe",
|
|
13068
|
+
"short_names": ["stripe"],
|
|
13069
|
+
"customCategory": "Integrations",
|
|
13070
|
+
"text": "",
|
|
13071
|
+
"emoticons": [],
|
|
13072
|
+
"keywords": ["logo", "brand", "integration", "stripe"],
|
|
13073
|
+
"imageUrl": "https://images-temp.fibery.io/ui/appIcons/stripe.svg",
|
|
13074
|
+
"file": "stripe.svg"
|
|
13075
|
+
},
|
|
13066
13076
|
{
|
|
13067
13077
|
"name": "Openion",
|
|
13068
13078
|
"short_names": ["openion"],
|
package/src/box.tsx
CHANGED
|
@@ -296,7 +296,7 @@ const defaultRadius = {
|
|
|
296
296
|
rb: border.radius6,
|
|
297
297
|
lb: border.radius6,
|
|
298
298
|
};
|
|
299
|
-
type
|
|
299
|
+
export type BoxProps = HTMLProps<HTMLDivElement> & {
|
|
300
300
|
as?: React.ElementType;
|
|
301
301
|
} & {
|
|
302
302
|
ref?: Ref<HTMLDivElement>;
|
|
@@ -342,7 +342,7 @@ type Props = HTMLProps<HTMLDivElement> & {
|
|
|
342
342
|
* Fibery system card-like container with all mouse, focus and selected states support.
|
|
343
343
|
* States described at: https://www.figma.com/file/Qff2eEFvZhjpxSqeFD5n58/FI---UI-Projects?type=design&node-id=4085%3A30506&mode=design&t=UvkBPcZSg5hKi86D-1
|
|
344
344
|
*/
|
|
345
|
-
export const Box = forwardRef<HTMLDivElement,
|
|
345
|
+
export const Box = forwardRef<HTMLDivElement, BoxProps>((props, ref) => {
|
|
346
346
|
const {
|
|
347
347
|
selected,
|
|
348
348
|
done,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {css, CSSProperties, cx} from "@linaria/core";
|
|
2
|
+
import {Slot} from "@radix-ui/react-slot";
|
|
2
3
|
import {forwardRef} from "react";
|
|
3
4
|
import {themeVars} from "../design-system";
|
|
4
5
|
import {iconColorVar} from "../icons/Icon";
|
|
@@ -12,6 +13,7 @@ export type BaseButtonProps = {
|
|
|
12
13
|
color?: ButtonColor;
|
|
13
14
|
pressed?: boolean;
|
|
14
15
|
supportMobile?: boolean;
|
|
16
|
+
asChild?: boolean;
|
|
15
17
|
} & React.ComponentPropsWithRef<"button">;
|
|
16
18
|
|
|
17
19
|
export const xLargeButtonHeight = 40;
|
|
@@ -36,6 +38,7 @@ export const baseButton = css`
|
|
|
36
38
|
|
|
37
39
|
@media (any-hover: hover) {
|
|
38
40
|
&:hover:not(:disabled) {
|
|
41
|
+
color: var(--fibery-button-text-color);
|
|
39
42
|
background-color: var(--fibery-button-hover-color);
|
|
40
43
|
}
|
|
41
44
|
}
|
|
@@ -112,13 +115,25 @@ const getColors = (variant: ButtonVariant, color: ButtonColor) => {
|
|
|
112
115
|
|
|
113
116
|
export const BaseButton = forwardRef<HTMLButtonElement, BaseButtonProps>(
|
|
114
117
|
(
|
|
115
|
-
{
|
|
118
|
+
{
|
|
119
|
+
variant = "solid",
|
|
120
|
+
color = "accent",
|
|
121
|
+
type = "button",
|
|
122
|
+
className,
|
|
123
|
+
children,
|
|
124
|
+
style,
|
|
125
|
+
pressed,
|
|
126
|
+
asChild,
|
|
127
|
+
...buttonProps
|
|
128
|
+
},
|
|
116
129
|
ref
|
|
117
130
|
) => {
|
|
118
131
|
const colors = getColors(variant, color);
|
|
119
132
|
|
|
133
|
+
const Component = asChild ? Slot : "button";
|
|
134
|
+
|
|
120
135
|
return (
|
|
121
|
-
<
|
|
136
|
+
<Component
|
|
122
137
|
style={{...colors, ...style}}
|
|
123
138
|
aria-pressed={pressed || buttonProps["aria-pressed"]}
|
|
124
139
|
data-variant={variant}
|
|
@@ -129,7 +144,7 @@ export const BaseButton = forwardRef<HTMLButtonElement, BaseButtonProps>(
|
|
|
129
144
|
{...buttonProps}
|
|
130
145
|
>
|
|
131
146
|
{children}
|
|
132
|
-
</
|
|
147
|
+
</Component>
|
|
133
148
|
);
|
|
134
149
|
}
|
|
135
150
|
);
|
package/src/button/button.tsx
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {css, cx} from "@linaria/core";
|
|
2
|
+
import {Slot, Slottable} from "@radix-ui/react-slot";
|
|
2
3
|
import {forwardRef} from "react";
|
|
3
4
|
import {border, fontWeight, space, textStyles} from "../design-system";
|
|
4
5
|
import {iconSizeVar} from "../icons/Icon";
|
|
5
6
|
import SpinnerIcon from "../icons/react/Spinner";
|
|
6
|
-
import {BaseButton, BaseButtonProps, ButtonSize, xLargeButtonHeight} from "./base-button";
|
|
7
|
-
import {useIsSupportHardwareKeyboard} from "../use-is-support-hardware-keyboard";
|
|
8
7
|
import {useIsPhone} from "../use-is-phone";
|
|
8
|
+
import {useIsSupportHardwareKeyboard} from "../use-is-support-hardware-keyboard";
|
|
9
|
+
import {BaseButton, BaseButtonProps, ButtonSize, xLargeButtonHeight} from "./base-button";
|
|
9
10
|
|
|
10
11
|
export type ButtonProps = {
|
|
11
12
|
size?: ButtonSize;
|
|
@@ -193,12 +194,16 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
193
194
|
disabled,
|
|
194
195
|
shortcut,
|
|
195
196
|
fullWidth,
|
|
197
|
+
asChild,
|
|
196
198
|
...buttonProps
|
|
197
199
|
},
|
|
198
200
|
ref
|
|
199
201
|
) => {
|
|
200
202
|
const isSupportHardwareKeyboard = useIsSupportHardwareKeyboard();
|
|
201
203
|
const isPhone = useIsPhone();
|
|
204
|
+
|
|
205
|
+
const Component = asChild ? Slot : "button";
|
|
206
|
+
|
|
202
207
|
return (
|
|
203
208
|
<BaseButton
|
|
204
209
|
ref={ref}
|
|
@@ -213,12 +218,15 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
213
218
|
iconEnd && withIconEnd,
|
|
214
219
|
!children && withoutChildren
|
|
215
220
|
)}
|
|
221
|
+
asChild
|
|
216
222
|
{...buttonProps}
|
|
217
223
|
>
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
224
|
+
<Component>
|
|
225
|
+
{pending ? <SpinnerIcon /> : iconStart}
|
|
226
|
+
<Slottable>{children}</Slottable>
|
|
227
|
+
{iconEnd}
|
|
228
|
+
{shortcut && isSupportHardwareKeyboard ? <span className={shortcutContainer}>{shortcut}</span> : null}
|
|
229
|
+
</Component>
|
|
222
230
|
</BaseButton>
|
|
223
231
|
);
|
|
224
232
|
}
|
|
@@ -9,7 +9,10 @@ import {useIsPhone} from "../use-is-phone";
|
|
|
9
9
|
export type IconButtonProps = {
|
|
10
10
|
size?: ButtonSize;
|
|
11
11
|
pending?: boolean;
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
/** NOTE: it won't work properly together with `pending` prop. TODO: figure out how to use Slottable correctly (position spinner as absolute above?) */
|
|
14
|
+
asChild?: boolean;
|
|
15
|
+
} & Omit<BaseButtonProps, "asChild">;
|
|
13
16
|
|
|
14
17
|
export const iconButton = css`
|
|
15
18
|
display: flex;
|
|
@@ -34,10 +34,18 @@ export type SelectButtonProps = {
|
|
|
34
34
|
* Should be used as an escape hatch for components like ui-kit/src/popup that don't set "aria-expanded"
|
|
35
35
|
*/
|
|
36
36
|
open?: boolean;
|
|
37
|
-
} &
|
|
37
|
+
} & ButtonProps;
|
|
38
38
|
|
|
39
39
|
export const SelectButton = forwardRef<HTMLButtonElement, SelectButtonProps>(function SelectButton(
|
|
40
|
-
{
|
|
40
|
+
{
|
|
41
|
+
size = "medium",
|
|
42
|
+
className,
|
|
43
|
+
open,
|
|
44
|
+
variant = "ghost",
|
|
45
|
+
iconEnd = <ArrowBottom className={iconSize[size]} />,
|
|
46
|
+
color = "neutral",
|
|
47
|
+
...rest
|
|
48
|
+
},
|
|
41
49
|
forwardedRef
|
|
42
50
|
) {
|
|
43
51
|
return (
|
|
@@ -45,7 +53,7 @@ export const SelectButton = forwardRef<HTMLButtonElement, SelectButtonProps>(fun
|
|
|
45
53
|
ref={forwardedRef}
|
|
46
54
|
aria-expanded={open}
|
|
47
55
|
size={size}
|
|
48
|
-
iconEnd={
|
|
56
|
+
iconEnd={iconEnd}
|
|
49
57
|
variant={variant}
|
|
50
58
|
color={color}
|
|
51
59
|
className={className}
|
|
@@ -36,10 +36,10 @@ export const CollapsibleContent = styled(Collapsible.Content)`
|
|
|
36
36
|
|
|
37
37
|
@media (prefers-reduced-motion: no-preference) {
|
|
38
38
|
&[data-state="open"] {
|
|
39
|
-
animation: slideDown
|
|
39
|
+
animation: slideDown 120ms ease-out;
|
|
40
40
|
}
|
|
41
41
|
&[data-state="closed"] {
|
|
42
|
-
animation: slideUp
|
|
42
|
+
animation: slideUp 120ms ease-out;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
`;
|
|
@@ -10,8 +10,10 @@ import Search from "../icons/react/Search";
|
|
|
10
10
|
|
|
11
11
|
export const CommandMenuRoot = styled(CommandRoot)`
|
|
12
12
|
display: flex;
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
:where(&) {
|
|
14
|
+
height: 100%;
|
|
15
|
+
width: 100%;
|
|
16
|
+
}
|
|
15
17
|
flex-direction: column;
|
|
16
18
|
overflow: hidden;
|
|
17
19
|
border-radius: ${border.radius8}px;
|
package/src/copy-to-clipboard.ts
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
1
|
export const copyToClipboard = (text: string) => window.navigator.clipboard.writeText(text);
|
|
2
|
+
export const copyUrlToClipboard = ({url, label}: {url: string; label?: string}) => {
|
|
3
|
+
const htmlString = `<a href="${url}" target="_blank">${label || url}</a>`;
|
|
4
|
+
|
|
5
|
+
return window.navigator.clipboard.write([
|
|
6
|
+
new ClipboardItem({
|
|
7
|
+
"text/html": new Blob([htmlString], {type: "text/html"}),
|
|
8
|
+
"text/plain": url,
|
|
9
|
+
}),
|
|
10
|
+
]);
|
|
11
|
+
};
|
package/src/dot.tsx
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {css, CSSProperties, cx} from "@linaria/core";
|
|
2
|
+
import {space, themeVars} from "./design-system";
|
|
3
|
+
import {useMemo} from "react";
|
|
4
|
+
|
|
5
|
+
const dotColorVar = "--fibery-dot-color";
|
|
6
|
+
|
|
7
|
+
const dotCss = css`
|
|
8
|
+
background-color: var(${dotColorVar});
|
|
9
|
+
border-radius: 50%;
|
|
10
|
+
|
|
11
|
+
&[data-size="small"] {
|
|
12
|
+
width: ${space.s4}px;
|
|
13
|
+
height: ${space.s4}px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&[data-size="medium"] {
|
|
17
|
+
width: ${space.s6}px;
|
|
18
|
+
height: ${space.s6}px;
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
type Props = {
|
|
23
|
+
className?: string;
|
|
24
|
+
color?: string;
|
|
25
|
+
size?: "small" | "medium";
|
|
26
|
+
} & React.ComponentProps<"div">;
|
|
27
|
+
|
|
28
|
+
export const Dot = ({className, color = themeVars.active, size = "small", style, ...props}: Props) => {
|
|
29
|
+
const colors: CSSProperties = useMemo(() => {
|
|
30
|
+
return {
|
|
31
|
+
[dotColorVar]: color,
|
|
32
|
+
};
|
|
33
|
+
}, [color]);
|
|
34
|
+
|
|
35
|
+
return <div className={cx(className, dotCss)} style={{...colors, ...style}} data-size={size} {...props} />;
|
|
36
|
+
};
|