@fibery/ui-kit 1.18.0 → 1.20.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 +9 -7
- package/src/a11y-color.ts +9 -6
- package/src/antd/styles.ts +6 -6
- package/src/back-button.tsx +1 -1
- package/src/{Button → button}/button.tsx +5 -5
- package/src/button.tsx +1 -1
- package/src/design-system.ts +83 -34
- package/src/emoji-picker/emoji-picker-content-with-color.tsx +4 -4
- package/src/emoji-picker/emoji-picker.tsx +2 -2
- package/src/emoji-picker/icon-emoji-picker.tsx +1 -1
- package/src/emoji-picker/primitives/category.tsx +3 -3
- package/src/emoji-picker/primitives/emoji.tsx +26 -3
- package/src/emoji-picker/primitives/footer.tsx +1 -1
- package/src/emoji-picker/primitives/header.tsx +1 -1
- package/src/emoji-picker/primitives/layout.ts +2 -2
- package/src/emoji-picker/primitives/search.tsx +6 -6
- package/src/emoji-picker/primitives/skin-tone.tsx +1 -1
- package/src/error-alert.tsx +4 -4
- package/src/form-field-loader.tsx +3 -3
- package/src/icons/Icon.tsx +2 -2
- package/src/icons/ast/AlertTriangle.ts +8 -0
- package/src/icons/ast/BellRinging.ts +1 -1
- package/src/icons/ast/Clock.ts +8 -0
- package/src/icons/ast/ClockAlarm.ts +8 -0
- package/src/icons/ast/Copy.ts +1 -1
- package/src/icons/ast/DragBlockHandleSingle.ts +8 -0
- package/src/icons/ast/ExtensionComments.ts +1 -1
- package/src/icons/ast/Eye.ts +8 -0
- package/src/icons/ast/Monitor.ts +8 -0
- package/src/icons/ast/NetworkAdd.ts +8 -0
- package/src/icons/ast/RemovePeople.ts +8 -0
- package/src/icons/ast/RicheditorCommentCreate.ts +1 -1
- package/src/icons/ast/RicheditorMarkTextBackgroundColor.ts +8 -0
- package/src/icons/ast/Success.ts +8 -0
- package/src/icons/ast/WarningTriangle.ts +8 -0
- package/src/icons/ast/index.tsx +11 -1
- package/src/icons/react/AlertTriangle.tsx +12 -0
- package/src/icons/react/Clock.tsx +12 -0
- package/src/icons/react/ClockAlarm.tsx +12 -0
- package/src/icons/react/DragBlockHandleSingle.tsx +12 -0
- package/src/icons/react/Eye.tsx +12 -0
- package/src/icons/react/Monitor.tsx +12 -0
- package/src/icons/react/NetworkAdd.tsx +12 -0
- package/src/icons/react/RemovePeople.tsx +12 -0
- package/src/icons/react/RicheditorMarkTextBackgroundColor.tsx +12 -0
- package/src/icons/react/Success.tsx +12 -0
- package/src/icons/react/WarningTriangle.tsx +12 -0
- package/src/icons/react/index.tsx +11 -1
- package/src/loaders.tsx +10 -10
- package/src/loading-sausage.tsx +2 -2
- package/src/media-query-utils.ts +1 -1
- package/src/{Select → select}/custom-select-partials/clear-indicator.tsx +1 -1
- package/src/{Select → select}/custom-select-partials/group-heading.tsx +2 -2
- package/src/{Select → select}/custom-select-partials/menu.tsx +9 -1
- package/src/{Select → select}/custom-select-partials/no-option-message.tsx +1 -1
- package/src/select/custom-select-partials/option.tsx +122 -0
- package/src/{Select → select}/index.tsx +40 -5
- package/src/{Select → select}/select-in-popover.tsx +14 -14
- package/src/{Select → select}/styles.ts +15 -9
- package/src/toast/primitives.tsx +46 -28
- package/src/toast/toast-action.tsx +28 -0
- package/src/toast/toast-provider.tsx +15 -0
- package/src/toast/toast-queue.ts +117 -0
- package/src/toast/toast.tsx +121 -0
- package/src/toast/toaster.tsx +35 -0
- package/src/toast/utils/toastify-item-name.ts +6 -0
- package/src/tooltip.tsx +2 -2
- package/src/Select/custom-select-partials/option.tsx +0 -92
- package/src/icons/ast/RicheditorMarkHighlight.ts +0 -8
- package/src/icons/react/RicheditorMarkHighlight.tsx +0 -12
- package/src/toast/index.tsx +0 -47
- /package/src/{Button → button}/actions-button-compact.tsx +0 -0
- /package/src/{Button → button}/actions-button.tsx +0 -0
- /package/src/{Button → button}/add-button.tsx +0 -0
- /package/src/{Button → button}/back-button.tsx +0 -0
- /package/src/{Button → button}/button-base.tsx +0 -0
- /package/src/{Button → button}/button-group.tsx +0 -0
- /package/src/{Button → button}/icon-button.tsx +0 -0
- /package/src/{Select → select}/custom-select-partials/drop-down-indicator.tsx +0 -0
- /package/src/{Select → select}/select-control-settings-context.tsx +0 -0
- /package/src/{Select → select}/select-loader.tsx +0 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import {makePubSub} from "@fibery/helpers/utils/pub-sub";
|
|
2
|
+
import type {ToastProps} from "./toast";
|
|
3
|
+
|
|
4
|
+
export type AddToastProps = Pick<
|
|
5
|
+
ToastProps,
|
|
6
|
+
"type" | "title" | "subTitle" | "icon" | "action" | "duration" | "open"
|
|
7
|
+
> & {
|
|
8
|
+
id?: string;
|
|
9
|
+
};
|
|
10
|
+
type TypedAddProps = Omit<AddToastProps, "type">;
|
|
11
|
+
|
|
12
|
+
type QueuedToast = AddToastProps & {
|
|
13
|
+
id: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
type ToastQueueOpts = {
|
|
17
|
+
maxActiveToasts?: number;
|
|
18
|
+
onToastAdd?: (params: AddToastProps) => void;
|
|
19
|
+
|
|
20
|
+
/** Overrides toast props.
|
|
21
|
+
* This option is added only to support mapping of billing errors as it was done in toast actions.
|
|
22
|
+
* Ideally this should be removed and billing errors moved to thunk middlewares
|
|
23
|
+
*/
|
|
24
|
+
transformToast?: (params: AddToastProps) => AddToastProps;
|
|
25
|
+
};
|
|
26
|
+
export const makeToastQueue = ({maxActiveToasts = 1, onToastAdd, transformToast}: ToastQueueOpts = {}) => {
|
|
27
|
+
const pubSub = makePubSub();
|
|
28
|
+
let queue: QueuedToast[] = [];
|
|
29
|
+
let activeToasts: QueuedToast[] = [];
|
|
30
|
+
|
|
31
|
+
let count = 0;
|
|
32
|
+
|
|
33
|
+
const makeId = () => {
|
|
34
|
+
return `toast-${count++}`;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const updateActiveToasts = () => {
|
|
38
|
+
const freeSlots = maxActiveToasts - activeToasts.length;
|
|
39
|
+
|
|
40
|
+
const newToasts = queue.slice(0, freeSlots);
|
|
41
|
+
queue = queue.slice(freeSlots);
|
|
42
|
+
|
|
43
|
+
activeToasts = activeToasts.concat(newToasts);
|
|
44
|
+
|
|
45
|
+
pubSub.publish();
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Add toast to queue
|
|
50
|
+
*
|
|
51
|
+
* Pass custom `id` if you don't want toasts to be duplicated.
|
|
52
|
+
* If toast with same id already exists it will be closed to display fresh more relevant one
|
|
53
|
+
*/
|
|
54
|
+
const add = ({id, ...toast}: AddToastProps) => {
|
|
55
|
+
if (activeToasts.length > 0) {
|
|
56
|
+
activeToasts[0].open = false;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const t: QueuedToast = {
|
|
60
|
+
id: id || makeId(),
|
|
61
|
+
...(transformToast ? transformToast(toast) : toast),
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
onToastAdd?.(t);
|
|
65
|
+
|
|
66
|
+
queue.push(t);
|
|
67
|
+
|
|
68
|
+
updateActiveToasts();
|
|
69
|
+
|
|
70
|
+
return t.id;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
add,
|
|
75
|
+
/** Mark active toast as closed. Can be used to play exit animation */
|
|
76
|
+
close(id: string) {
|
|
77
|
+
activeToasts = activeToasts.map((t) => (t.id === id ? {...t, open: false} : t));
|
|
78
|
+
|
|
79
|
+
pubSub.publish();
|
|
80
|
+
},
|
|
81
|
+
/** remove toast from active ones, should be called after exit animation */
|
|
82
|
+
remove(id: string) {
|
|
83
|
+
activeToasts = activeToasts.filter((t) => t.id !== id);
|
|
84
|
+
|
|
85
|
+
updateActiveToasts();
|
|
86
|
+
},
|
|
87
|
+
getActiveToasts() {
|
|
88
|
+
return activeToasts;
|
|
89
|
+
},
|
|
90
|
+
subscribe: pubSub.subscribe,
|
|
91
|
+
unsubscribe: pubSub.unsubscribe,
|
|
92
|
+
|
|
93
|
+
info(t: TypedAddProps) {
|
|
94
|
+
return add(t);
|
|
95
|
+
},
|
|
96
|
+
success(t: TypedAddProps) {
|
|
97
|
+
return add({
|
|
98
|
+
type: "success",
|
|
99
|
+
...t,
|
|
100
|
+
});
|
|
101
|
+
},
|
|
102
|
+
error(t: TypedAddProps) {
|
|
103
|
+
return add({
|
|
104
|
+
type: "error",
|
|
105
|
+
...t,
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
loading(t: TypedAddProps) {
|
|
109
|
+
return add({
|
|
110
|
+
type: "loading",
|
|
111
|
+
...t,
|
|
112
|
+
});
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export type ToastQueue = ReturnType<typeof makeToastQueue>;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import {useCallbackRef} from "@fibery/react/src/use-callback-ref";
|
|
2
|
+
import {useControllableState} from "@fibery/react/src/use-controllable-state";
|
|
3
|
+
import {css} from "@linaria/core";
|
|
4
|
+
import {useEffect, useRef} from "react";
|
|
5
|
+
import {space, themeVars} from "../design-system";
|
|
6
|
+
import Spinner from "../icons/react/Spinner";
|
|
7
|
+
import SuccessIcon from "../icons/react/Success";
|
|
8
|
+
import WarningTriangle from "../icons/react/WarningTriangle";
|
|
9
|
+
import {ToastClose, ToastRoot, ToastSubtitle, ToastTitle} from "./primitives";
|
|
10
|
+
import type {ToastActionElement} from "./toast-action";
|
|
11
|
+
|
|
12
|
+
type ToastType = "info" | "error" | "success" | "loading";
|
|
13
|
+
|
|
14
|
+
export type ToastProps = {
|
|
15
|
+
title: React.ReactNode;
|
|
16
|
+
subTitle?: React.ReactNode;
|
|
17
|
+
icon?: React.ReactNode;
|
|
18
|
+
action?: ToastActionElement;
|
|
19
|
+
duration?: number;
|
|
20
|
+
dismissable?: boolean;
|
|
21
|
+
open?: boolean;
|
|
22
|
+
onOpenChange?: (open: boolean) => void;
|
|
23
|
+
|
|
24
|
+
type?: ToastType;
|
|
25
|
+
|
|
26
|
+
/** It gets called after exit animation */
|
|
27
|
+
onHide?: () => void;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const defaultPropsPerType: Record<ToastType, Partial<ToastProps>> = {
|
|
31
|
+
info: {},
|
|
32
|
+
error: {
|
|
33
|
+
icon: <WarningTriangle color={themeVars.textColor} />,
|
|
34
|
+
duration: 10000,
|
|
35
|
+
dismissable: true,
|
|
36
|
+
},
|
|
37
|
+
loading: {
|
|
38
|
+
icon: <Spinner color={themeVars.textColor} />,
|
|
39
|
+
},
|
|
40
|
+
success: {
|
|
41
|
+
icon: <SuccessIcon color={themeVars.textColor} />,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const rootCss = css`
|
|
46
|
+
box-sizing: border-box;
|
|
47
|
+
min-height: 44px;
|
|
48
|
+
min-width: 320px;
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
gap: ${space.s12}px;
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
const messageCss = css`
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-grow: 1;
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
gap: ${space.s4}px;
|
|
59
|
+
`;
|
|
60
|
+
|
|
61
|
+
const iconCss = css`
|
|
62
|
+
grid-area: icon;
|
|
63
|
+
`;
|
|
64
|
+
|
|
65
|
+
export const Toast: React.FC<ToastProps> = (props) => {
|
|
66
|
+
const defaultProps = defaultPropsPerType[props.type || "info"];
|
|
67
|
+
|
|
68
|
+
const {
|
|
69
|
+
title,
|
|
70
|
+
subTitle,
|
|
71
|
+
icon,
|
|
72
|
+
action,
|
|
73
|
+
duration = 5000,
|
|
74
|
+
dismissable,
|
|
75
|
+
open,
|
|
76
|
+
onOpenChange,
|
|
77
|
+
onHide,
|
|
78
|
+
} = {
|
|
79
|
+
...defaultProps,
|
|
80
|
+
...props,
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const [isOpen, setOpen] = useControllableState({value: open, defaultValue: true, onChange: onOpenChange});
|
|
84
|
+
|
|
85
|
+
const ref = useRef<HTMLLIElement>(null);
|
|
86
|
+
const onHideCb = useCallbackRef(onHide);
|
|
87
|
+
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
const toastEl = ref.current;
|
|
90
|
+
if (!isOpen) {
|
|
91
|
+
const emergencyTimeout = setTimeout(onHideCb, 400); // just in case if animationend doesn't fire for some reasons or toast got closed before render
|
|
92
|
+
|
|
93
|
+
toastEl?.addEventListener("animationend", onHideCb, {
|
|
94
|
+
// https://github.com/radix-ui/primitives/issues/1020
|
|
95
|
+
capture: true,
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
return () => {
|
|
99
|
+
toastEl?.removeEventListener("animationend", onHideCb, {capture: true});
|
|
100
|
+
clearTimeout(emergencyTimeout);
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
104
|
+
return () => {};
|
|
105
|
+
}, [isOpen, onHideCb]);
|
|
106
|
+
|
|
107
|
+
const close = dismissable ? <ToastClose /> : null;
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<ToastRoot ref={ref} open={open} duration={duration} className={rootCss} onOpenChange={setOpen}>
|
|
111
|
+
{icon ? <div className={iconCss}>{icon}</div> : null}
|
|
112
|
+
<div className={messageCss}>
|
|
113
|
+
<ToastTitle>{title}</ToastTitle>
|
|
114
|
+
{subTitle ? <ToastSubtitle>{subTitle}</ToastSubtitle> : null}
|
|
115
|
+
</div>
|
|
116
|
+
|
|
117
|
+
{action}
|
|
118
|
+
{close}
|
|
119
|
+
</ToastRoot>
|
|
120
|
+
);
|
|
121
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {useSyncExternalStore} from "react";
|
|
2
|
+
import {createInlineTheme} from "../create-inline-theme";
|
|
3
|
+
import {colors, getThemeColors} from "../design-system";
|
|
4
|
+
import {ThemeProvider, useThemeMode} from "../theme-provider";
|
|
5
|
+
import {ToastViewport} from "./primitives";
|
|
6
|
+
import {Toast} from "./toast";
|
|
7
|
+
import {useToast} from "./toast-provider";
|
|
8
|
+
|
|
9
|
+
const ToastThemeProvider: React.FC<React.PropsWithChildren> = ({children}) => {
|
|
10
|
+
const themeMode = useThemeMode();
|
|
11
|
+
const theme = getThemeColors(colors.brandColors.blue, themeMode === "dark" ? "light" : "dark");
|
|
12
|
+
const inlineTheme = createInlineTheme(theme, []);
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<ThemeProvider theme={theme}>
|
|
16
|
+
<div style={inlineTheme}>{children}</div>
|
|
17
|
+
</ThemeProvider>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const Toaster: React.FC = () => {
|
|
22
|
+
const toastQueue = useToast();
|
|
23
|
+
|
|
24
|
+
const toasts = useSyncExternalStore(toastQueue.subscribe, toastQueue.getActiveToasts);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<ToastThemeProvider>
|
|
28
|
+
{toasts.map(({id, open, type = "info", ...toastProps}) => (
|
|
29
|
+
<Toast key={`${id}-${type}`} type={type} {...toastProps} open={open} onHide={() => toastQueue.remove(id)} />
|
|
30
|
+
))}
|
|
31
|
+
|
|
32
|
+
<ToastViewport />
|
|
33
|
+
</ToastThemeProvider>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const charLimit = 60;
|
|
2
|
+
|
|
3
|
+
const trimDynamicToastText = (str: string) => (str.length > charLimit ? `${str.slice(0, 60)}...` : str);
|
|
4
|
+
|
|
5
|
+
export const toastifyItemName = ({prefix, name, postfix}: {prefix?: string; name?: string; postfix?: string}) =>
|
|
6
|
+
`${prefix ? `${prefix} ` : ""}"${name ? trimDynamicToastText(name) : "Untitled"}"${postfix ? ` ${postfix}` : ""}`;
|
package/src/tooltip.tsx
CHANGED
|
@@ -27,7 +27,7 @@ const tooltipStyle = css`
|
|
|
27
27
|
min-height: 30px;
|
|
28
28
|
max-width: 300px;
|
|
29
29
|
background-color: ${themeVars.tooltipBgColor};
|
|
30
|
-
padding: ${space.
|
|
30
|
+
padding: ${space.s6}px ${space.s8}px;
|
|
31
31
|
border-radius: ${border.radius6}px;
|
|
32
32
|
box-shadow: ${themeVars.actionMenuShadow};
|
|
33
33
|
|
|
@@ -132,7 +132,7 @@ export const Tooltip = forwardRef<HTMLButtonElement, TooltipProps>(
|
|
|
132
132
|
</>
|
|
133
133
|
),
|
|
134
134
|
side,
|
|
135
|
-
sideOffset = space.
|
|
135
|
+
sideOffset = space.s4,
|
|
136
136
|
align,
|
|
137
137
|
alignOffset,
|
|
138
138
|
instant,
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import {OptionProps} from "react-select";
|
|
2
|
-
import {components} from "react-windowed-select";
|
|
3
|
-
import {GroupBase} from "../index";
|
|
4
|
-
import {css, cx} from "@linaria/core";
|
|
5
|
-
import {border, layout, space, textStyles, themeVars, transition} from "../../design-system";
|
|
6
|
-
import {useMemo} from "react";
|
|
7
|
-
|
|
8
|
-
export const OptionNulledStyles = {
|
|
9
|
-
height: layout.menuItemHeight,
|
|
10
|
-
};
|
|
11
|
-
const OptionWrapperClass = css`
|
|
12
|
-
max-width: 100%;
|
|
13
|
-
flex-basis: 100%;
|
|
14
|
-
display: flex;
|
|
15
|
-
align-items: center;
|
|
16
|
-
align-content: center;
|
|
17
|
-
${{...textStyles.regular}};
|
|
18
|
-
color: ${themeVars.textColor};
|
|
19
|
-
background: ${themeVars.colorBgSelectOptionDefault};
|
|
20
|
-
border-radius: ${border.radius6}px;
|
|
21
|
-
padding: 0 ${space.s}px;
|
|
22
|
-
column-gap: ${space.xs}px;
|
|
23
|
-
transition: background-color ${transition}, color ${transition};
|
|
24
|
-
`;
|
|
25
|
-
const OptionRootClass = css`
|
|
26
|
-
padding: 0 ${space.s}px ${space.xxs}px;
|
|
27
|
-
display: flex;
|
|
28
|
-
align-items: stretch;
|
|
29
|
-
justify-content: stretch;
|
|
30
|
-
cursor: pointer;
|
|
31
|
-
&:hover {
|
|
32
|
-
.${OptionWrapperClass} {
|
|
33
|
-
background: ${themeVars.colorBgSelectOptionDefaultHover};
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
`;
|
|
37
|
-
|
|
38
|
-
const DisabledOptionClass = css`
|
|
39
|
-
cursor: not-allowed;
|
|
40
|
-
.${OptionWrapperClass} {
|
|
41
|
-
> * {
|
|
42
|
-
opacity: ${themeVars.opacitySelectOptionDisabled};
|
|
43
|
-
}
|
|
44
|
-
background: ${themeVars.colorBgSelectOptionDisabled};
|
|
45
|
-
}
|
|
46
|
-
&:hover {
|
|
47
|
-
.${OptionWrapperClass} {
|
|
48
|
-
background: ${themeVars.colorBgSelectOptionDisabled};
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
`;
|
|
52
|
-
const SelectedOptionClass = css`
|
|
53
|
-
cursor: default;
|
|
54
|
-
.${OptionWrapperClass} {
|
|
55
|
-
background: ${themeVars.colorBgSelectOptionSelected};
|
|
56
|
-
}
|
|
57
|
-
&:hover {
|
|
58
|
-
.${OptionWrapperClass} {
|
|
59
|
-
background: ${themeVars.colorBgSelectOptionSelectedHover};
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
&.${DisabledOptionClass} {
|
|
63
|
-
background: ${themeVars.colorBgSelectOptionSelectedDisabled};
|
|
64
|
-
&:hover {
|
|
65
|
-
background: ${themeVars.colorBgSelectOptionSelectedDisabled};
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
`;
|
|
69
|
-
export function Option<Option, IsMulti extends boolean = false, Group extends GroupBase<Option> = GroupBase<Option>>(
|
|
70
|
-
props: OptionProps<Option, IsMulti, Group>
|
|
71
|
-
) {
|
|
72
|
-
const {children, ...rest} = props;
|
|
73
|
-
const {isDisabled, isFocused} = rest;
|
|
74
|
-
const className = useMemo(
|
|
75
|
-
() =>
|
|
76
|
-
cx(
|
|
77
|
-
rest.innerProps.className,
|
|
78
|
-
OptionRootClass,
|
|
79
|
-
isFocused && SelectedOptionClass, //do not use isSelected as flag to determine if item is selected. It is not always true, bug
|
|
80
|
-
isDisabled && DisabledOptionClass
|
|
81
|
-
),
|
|
82
|
-
[rest.innerProps.className, isDisabled, isFocused]
|
|
83
|
-
);
|
|
84
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
85
|
-
const {onMouseMove, onMouseOver, ...truncatedProps} = rest.innerProps;
|
|
86
|
-
const newProps = Object.assign(rest, {innerProps: truncatedProps});
|
|
87
|
-
return (
|
|
88
|
-
<components.Option {...newProps} className={className}>
|
|
89
|
-
<div className={OptionWrapperClass}>{children}</div>
|
|
90
|
-
</components.Option>
|
|
91
|
-
);
|
|
92
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
// This icon file is generated automatically.
|
|
3
|
-
|
|
4
|
-
import { IconDefinition } from '../types';
|
|
5
|
-
|
|
6
|
-
const RicheditorMarkHighlight: IconDefinition = {"icon":{"type":"root","children":[{"type":"element","tagName":"svg","properties":{"viewBox":"0 0 20 20"},"children":[{"type":"element","tagName":"g","properties":{},"children":[{"type":"element","tagName":"path","properties":{"d":"m5.07 16.9.898-.625h2.418c.643 0 1.197-.177 1.66-.607.15-.14.135-.377-.012-.522L5.23 10.438c-.156-.153-.408-.154-.535.023-.34.476-.509 1.087-.509 1.698v2.37l-.89.873c-.382.39-.17.154-.597.624 1.517.595 2.37.874 2.37.874ZM10.653 14.177c.255.25.51.25.764 0l5.997-7.786a1.474 1.474 0 0 0 0-1.746l-1.909-1.87a1.247 1.247 0 0 0-1.781 0l-7.61 6.313c-.255.249-.255.498 0 .748l4.54 4.341Z"},"children":[]}]}],"metadata":""}]},"name":"richeditor-mark-highlight"};
|
|
7
|
-
|
|
8
|
-
export default RicheditorMarkHighlight;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// This icon file is generated automatically.
|
|
2
|
-
|
|
3
|
-
import RicheditorMarkHighlightSvg from '../ast/RicheditorMarkHighlight';
|
|
4
|
-
import { Icon } from '../Icon';
|
|
5
|
-
import { IconBaseProps } from '../types';
|
|
6
|
-
|
|
7
|
-
const RicheditorMarkHighlight = (
|
|
8
|
-
props: IconBaseProps,
|
|
9
|
-
): JSX.Element => <Icon {...props} icon={RicheditorMarkHighlightSvg} />;
|
|
10
|
-
|
|
11
|
-
RicheditorMarkHighlight.displayName = 'RicheditorMarkHighlight';
|
|
12
|
-
export default RicheditorMarkHighlight;
|
package/src/toast/index.tsx
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import {css} from "@linaria/core";
|
|
2
|
-
import {ToastRoot, ToastTitle, ToastSubtitle, ToastClose, ToastAction} from "./primitives";
|
|
3
|
-
import {space} from "../design-system";
|
|
4
|
-
|
|
5
|
-
export {ToastProvider, ToastViewport, ToastAction} from "./primitives";
|
|
6
|
-
|
|
7
|
-
export type ToastProps = {
|
|
8
|
-
title: React.ReactNode;
|
|
9
|
-
subTitle?: React.ReactNode;
|
|
10
|
-
icon?: React.ReactNode;
|
|
11
|
-
action?: React.ReactElement<typeof ToastAction>;
|
|
12
|
-
autoClose?: boolean;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const rootCss = css`
|
|
16
|
-
min-width: 320px;
|
|
17
|
-
display: flex;
|
|
18
|
-
align-items: center;
|
|
19
|
-
gap: ${space.l}px;
|
|
20
|
-
`;
|
|
21
|
-
|
|
22
|
-
const messageCss = css`
|
|
23
|
-
display: flex;
|
|
24
|
-
flex-grow: 1;
|
|
25
|
-
flex-direction: column;
|
|
26
|
-
gap: ${space.xs}px;
|
|
27
|
-
`;
|
|
28
|
-
|
|
29
|
-
const iconCss = css`
|
|
30
|
-
grid-area: icon;
|
|
31
|
-
`;
|
|
32
|
-
export const Toast: React.FC<ToastProps> = ({title, subTitle, icon, action, autoClose = true}) => {
|
|
33
|
-
const close = autoClose ? null : <ToastClose />;
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<ToastRoot duration={autoClose ? 5000 : Infinity} className={rootCss}>
|
|
37
|
-
{icon ? <div className={iconCss}>{icon}</div> : null}
|
|
38
|
-
<div className={messageCss}>
|
|
39
|
-
<ToastTitle>{title}</ToastTitle>
|
|
40
|
-
{subTitle ? <ToastSubtitle>{subTitle}</ToastSubtitle> : null}
|
|
41
|
-
</div>
|
|
42
|
-
|
|
43
|
-
{action}
|
|
44
|
-
{close}
|
|
45
|
-
</ToastRoot>
|
|
46
|
-
);
|
|
47
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|