@jsb188/react 1.0.4 → 1.1.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/package.json +3 -6
- package/states/appContext.ts +2 -0
- package/states/index.ts +1 -0
- package/states/modal.ts +1 -2
- package/states/popOver.ts +14 -82
- package/types/PopOver.d.ts +132 -0
- package/utils/hooks.ts +2 -26
- package/icons/Icon.tsx +0 -207
- package/icons/IconSVGs.tsx +0 -1486
- package/types/dom.d.ts +0 -7
- package/utils/dom.ts +0 -303
- package/utils/priorityTimeout.ts +0 -57
package/package.json
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsb188/react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Contains react (and DOM) related utils and hooks.",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "jsb188",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"exports": {
|
|
9
9
|
"./states": "./states/index.ts",
|
|
10
|
-
"./dom": "./utils/dom.ts",
|
|
11
10
|
"./hooks": "./utils/hooks.ts",
|
|
12
|
-
"./
|
|
13
|
-
"./priorityTimeout": "./utils/priorityTimeout.ts",
|
|
14
|
-
"./types/dom": "./types/dom.d.ts"
|
|
11
|
+
"./types/PopOver.d": "./types/PopOver.d.ts"
|
|
15
12
|
},
|
|
16
13
|
"peerDependencies": {
|
|
17
|
-
"@jsb188/app": "
|
|
14
|
+
"@jsb188/app": "1.1.1",
|
|
18
15
|
"jotai": "^2.12.1",
|
|
19
16
|
"react": "^18.2.0"
|
|
20
17
|
},
|
package/states/index.ts
CHANGED
package/states/modal.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import i18n from '@jsb188/app/i18n';
|
|
2
|
-
import type { ServerErrorObj } from '@jsb188/app/types/app';
|
|
2
|
+
import type { ServerErrorObj } from '@jsb188/app/types/app.d';
|
|
3
3
|
import { atom, useAtom, useSetAtom } from 'jotai';
|
|
4
4
|
import { useCallback } from 'react';
|
|
5
5
|
|
|
@@ -143,7 +143,6 @@ class ModalPopUp extends ModalScreen {
|
|
|
143
143
|
readonly name: string = 'modal_popup_state';
|
|
144
144
|
|
|
145
145
|
open(data: ModalRequestParams | null, error?: ServerErrorObj): ModalProps | null {
|
|
146
|
-
|
|
147
146
|
if (data) {
|
|
148
147
|
const { preset, name, props } = data;
|
|
149
148
|
const values = this.defaultValues?.[name ?? ''];
|
package/states/popOver.ts
CHANGED
|
@@ -1,94 +1,27 @@
|
|
|
1
1
|
import { atom, useAtom, useAtomValue, useSetAtom } from 'jotai';
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
|
+
import {
|
|
4
|
+
ClosePopOverFn,
|
|
5
|
+
CloseTooltipFn,
|
|
6
|
+
OpenPopOverFn,
|
|
7
|
+
OpenTooltipFn,
|
|
8
|
+
PopOverHookProps,
|
|
9
|
+
PopOverProps,
|
|
10
|
+
TooltipHookProps,
|
|
11
|
+
TooltipProps,
|
|
12
|
+
UpdatePopOverFn,
|
|
13
|
+
UpdateTooltipFn
|
|
14
|
+
} from '@jsb188/react/types/PopOver.d';
|
|
3
15
|
|
|
4
16
|
/**
|
|
5
17
|
* Type; Pop overs
|
|
6
18
|
*/
|
|
7
19
|
|
|
8
|
-
export enum PopOverNames {
|
|
9
|
-
popover = 'popover',
|
|
10
|
-
options = 'options',
|
|
11
|
-
chat_options = 'chat_options',
|
|
12
|
-
mini_profile = 'mini_profile',
|
|
13
|
-
notification = 'notification',
|
|
14
|
-
persona_picker = 'persona_picker',
|
|
15
|
-
image_popover = 'image_popover'
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export type POPosition = 'top' | 'left' | 'right' | 'bottom';
|
|
19
|
-
|
|
20
|
-
export interface ClientRectValues {
|
|
21
|
-
width: number;
|
|
22
|
-
height: number;
|
|
23
|
-
left: number;
|
|
24
|
-
right: number;
|
|
25
|
-
top: number;
|
|
26
|
-
bottom: number;
|
|
27
|
-
x: number;
|
|
28
|
-
y: number;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
interface FixedElementProps {
|
|
32
|
-
id: string; // This ensures that the popover doesn't reset from within the same mouse pointer element
|
|
33
|
-
className: string;
|
|
34
|
-
position: POPosition;
|
|
35
|
-
variables: Record<string, any>;
|
|
36
|
-
popOverWidth: number;
|
|
37
|
-
popOverHeight: number;
|
|
38
|
-
rect?: ClientRectValues;
|
|
39
|
-
offsetX: number;
|
|
40
|
-
offsetY: number;
|
|
41
|
-
leftEdgeThreshold: number;
|
|
42
|
-
rightEdgeThreshold: number;
|
|
43
|
-
leftEdgePosition: number;
|
|
44
|
-
rightEdgePosition: number;
|
|
45
|
-
hover: boolean;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
20
|
interface UpdateStateParams {
|
|
49
|
-
name:
|
|
21
|
+
name: string;
|
|
50
22
|
variables: Record<string, any>;
|
|
51
23
|
}
|
|
52
24
|
|
|
53
|
-
export interface PopOverProps extends Partial<FixedElementProps> {
|
|
54
|
-
name: PopOverNames; // Used to be "__type"
|
|
55
|
-
doNotTrackHover?: boolean;
|
|
56
|
-
children?: any; // ????????
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export interface TooltipProps extends Partial<FixedElementProps> {
|
|
60
|
-
title?: string;
|
|
61
|
-
message?: string;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export type OpenPopOverFn = (data: PopOverProps) => void;
|
|
65
|
-
export type ClosePopOverFn = (dismissIfName?: PopOverNames) => void;
|
|
66
|
-
export type UpdatePopOverFn = (data: UpdateStateParams) => void;
|
|
67
|
-
|
|
68
|
-
export interface PopOverHandlerProps {
|
|
69
|
-
openPopOver: OpenPopOverFn;
|
|
70
|
-
closePopOver: ClosePopOverFn;
|
|
71
|
-
updatePopOver: UpdatePopOverFn;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export interface PopOverHookProps extends PopOverHandlerProps {
|
|
75
|
-
popOver: PopOverProps | null;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export type OpenTooltipFn = (data: TooltipProps) => void;
|
|
79
|
-
export type CloseTooltipFn = (removeId: string) => void;
|
|
80
|
-
export type UpdateTooltipFn = (data: TooltipProps) => void;
|
|
81
|
-
|
|
82
|
-
export interface TooltipHandlerProps {
|
|
83
|
-
openTooltip: OpenTooltipFn;
|
|
84
|
-
closeTooltip: CloseTooltipFn;
|
|
85
|
-
updateTooltip: UpdateTooltipFn;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export interface TooltipHookProps extends TooltipHandlerProps {
|
|
89
|
-
tooltip: TooltipProps | null;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
25
|
/**
|
|
93
26
|
* Pop over class
|
|
94
27
|
*/
|
|
@@ -189,7 +122,7 @@ function composeClosePopOverFn(
|
|
|
189
122
|
setPopOverIsHover: (update: boolean | ((prev: boolean) => boolean)) => void,
|
|
190
123
|
popOver: PopOverProps | null
|
|
191
124
|
): ClosePopOverFn {
|
|
192
|
-
return (dismissIfName?:
|
|
125
|
+
return (dismissIfName?: string) => {
|
|
193
126
|
if (!popOver || (typeof dismissIfName === 'string' && popOver.name !== dismissIfName)) {
|
|
194
127
|
return;
|
|
195
128
|
}
|
|
@@ -200,7 +133,6 @@ function composeClosePopOverFn(
|
|
|
200
133
|
|
|
201
134
|
function composeUpdatePopOverFn( setPopOver: (value: PopOverProps | null) => void): UpdatePopOverFn {
|
|
202
135
|
return (data: UpdateStateParams) => {
|
|
203
|
-
// @ts-expect-error - I couldn't get rid of this type error
|
|
204
136
|
setPopOver((prev: PopOverProps | null) => {
|
|
205
137
|
const nextPopOverState = popOverClass.update(data, prev);
|
|
206
138
|
if (nextPopOverState) {
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* Utility types
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface ClientRectValues {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
left: number;
|
|
10
|
+
right: number;
|
|
11
|
+
top: number;
|
|
12
|
+
bottom: number;
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Pop over interfaces
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
export interface POOItemObj {
|
|
22
|
+
__type?: 'NORMAL' | 'BREAK' | null;
|
|
23
|
+
value: string | null;
|
|
24
|
+
text: string;
|
|
25
|
+
className?: string;
|
|
26
|
+
displayName?: string;
|
|
27
|
+
photoUri?: string | null;
|
|
28
|
+
href?: string;
|
|
29
|
+
to?: string;
|
|
30
|
+
LinkComponent?: any;
|
|
31
|
+
allowDisabledOnClick?: boolean;
|
|
32
|
+
iconName?: string;
|
|
33
|
+
rightIconName?: string;
|
|
34
|
+
hidden?: boolean;
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface OptionsPOIface {
|
|
39
|
+
name: 'options';
|
|
40
|
+
variables: {
|
|
41
|
+
notReady?: boolean;
|
|
42
|
+
fontSizeClassName?: string;
|
|
43
|
+
backgroundClassName?: string;
|
|
44
|
+
className?: string;
|
|
45
|
+
savingValue?: string;
|
|
46
|
+
iconName?: string;
|
|
47
|
+
title?: string;
|
|
48
|
+
description?: string;
|
|
49
|
+
displayName?: string;
|
|
50
|
+
photoUri?: string | null;
|
|
51
|
+
selectedValue?: string | null;
|
|
52
|
+
options: POOItemObj[];
|
|
53
|
+
onClickItem: (value: string | null) => void;
|
|
54
|
+
LinkComponent?: any;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface ImagePOIface {
|
|
59
|
+
name: 'image_popover'
|
|
60
|
+
variables: {
|
|
61
|
+
imageUri: string;
|
|
62
|
+
alt?: string;
|
|
63
|
+
rect: any;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type PopOverIface = OptionsPOIface | ImagePOIface;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Pop overs
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
export type POPosition = 'top' | 'left' | 'right' | 'bottom';
|
|
74
|
+
|
|
75
|
+
interface FixedElementProps {
|
|
76
|
+
id: string; // This ensures that the popover doesn't reset from within the same mouse pointer element
|
|
77
|
+
className: string;
|
|
78
|
+
position: POPosition;
|
|
79
|
+
variables: any;
|
|
80
|
+
popOverWidth: number;
|
|
81
|
+
popOverHeight: number;
|
|
82
|
+
rect?: ClientRectValues;
|
|
83
|
+
offsetX: number;
|
|
84
|
+
offsetY: number;
|
|
85
|
+
leftEdgeThreshold: number;
|
|
86
|
+
rightEdgeThreshold: number;
|
|
87
|
+
leftEdgePosition: number;
|
|
88
|
+
rightEdgePosition: number;
|
|
89
|
+
hover: boolean;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface PopOverProps extends Partial<FixedElementProps> {
|
|
93
|
+
name: string; // Used to be "__type"
|
|
94
|
+
doNotTrackHover?: boolean;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export type OpenPopOverFn = (data: PopOverProps) => void;
|
|
98
|
+
export type ClosePopOverFn = (dismissIfName?: string) => void;
|
|
99
|
+
export type UpdatePopOverFn = (data: UpdateStateParams) => void;
|
|
100
|
+
|
|
101
|
+
export interface PopOverHandlerProps {
|
|
102
|
+
openPopOver: OpenPopOverFn;
|
|
103
|
+
closePopOver: ClosePopOverFn;
|
|
104
|
+
updatePopOver: UpdatePopOverFn;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface PopOverHookProps extends PopOverHandlerProps {
|
|
108
|
+
popOver: PopOverProps | null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Tooltips
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
export interface TooltipProps extends Partial<FixedElementProps> {
|
|
116
|
+
title?: string;
|
|
117
|
+
message?: string;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export type OpenTooltipFn = (data: TooltipProps) => void;
|
|
121
|
+
export type CloseTooltipFn = (removeId: string) => void;
|
|
122
|
+
export type UpdateTooltipFn = (data: TooltipProps) => void;
|
|
123
|
+
|
|
124
|
+
export interface TooltipHandlerProps {
|
|
125
|
+
openTooltip: OpenTooltipFn;
|
|
126
|
+
closeTooltip: CloseTooltipFn;
|
|
127
|
+
updateTooltip: UpdateTooltipFn;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export interface TooltipHookProps extends TooltipHandlerProps {
|
|
131
|
+
tooltip: TooltipProps | null;
|
|
132
|
+
}
|
package/utils/hooks.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
-
import { isAppHidden, setTimeoutPriority } from './priorityTimeout';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* Check if database document needs an update, insert, or do nothing based on the user API arguments
|
|
@@ -139,7 +138,7 @@ export function useWatchChange(
|
|
|
139
138
|
* Check props diff (logging for dev)
|
|
140
139
|
*/
|
|
141
140
|
|
|
142
|
-
export function checkPropsDiff(pp, np) {
|
|
141
|
+
export function checkPropsDiff(pp: any, np: any) {
|
|
143
142
|
let isSame = true;
|
|
144
143
|
for (const k in pp) {
|
|
145
144
|
if (Object.prototype.hasOwnProperty.call(pp, k) && pp[k] !== np[k]) {
|
|
@@ -163,6 +162,7 @@ export function checkPropsDiff(pp, np) {
|
|
|
163
162
|
}
|
|
164
163
|
|
|
165
164
|
if (globalThis && globalThis.location?.origin?.indexOf('localhost') >= 0) {
|
|
165
|
+
// @ts-ignore - Dev only shim
|
|
166
166
|
globalThis.checkPropsDiff = checkPropsDiff;
|
|
167
167
|
}
|
|
168
168
|
|
|
@@ -291,27 +291,3 @@ export function useVisible(
|
|
|
291
291
|
|
|
292
292
|
return [visible, setVisible];
|
|
293
293
|
}
|
|
294
|
-
|
|
295
|
-
/**
|
|
296
|
-
* Create an infinite loop timer
|
|
297
|
-
*/
|
|
298
|
-
|
|
299
|
-
export function useTimer(
|
|
300
|
-
refreshInterval: number = 60000
|
|
301
|
-
): null | number {
|
|
302
|
-
|
|
303
|
-
const [timestamp, setTimestamp] = useState<null | number>(null);
|
|
304
|
-
const appIsHidden = isAppHidden();
|
|
305
|
-
|
|
306
|
-
useEffect(() => {
|
|
307
|
-
const timeout = setTimeoutPriority(() => {
|
|
308
|
-
setTimestamp(Date.now());
|
|
309
|
-
}, refreshInterval);
|
|
310
|
-
|
|
311
|
-
return () => {
|
|
312
|
-
clearTimeout(timeout);
|
|
313
|
-
};
|
|
314
|
-
}, [appIsHidden, timestamp]);
|
|
315
|
-
|
|
316
|
-
return timestamp;
|
|
317
|
-
}
|
package/icons/Icon.tsx
DELETED
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import { memo } from 'react';
|
|
2
|
-
import type { ReactSpanElement } from '../types/dom';
|
|
3
|
-
import * as IconSVGs from './IconSVGs';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Convert cameCalsed string to dash-separated
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
function camelCaseToDash(str: string) {
|
|
10
|
-
if (/^[A-Z0-9]+$/.test(str)) {
|
|
11
|
-
return str.toLowerCase();
|
|
12
|
-
}
|
|
13
|
-
return str.replace(/[A-Z0-9]/g, (m, i) => {
|
|
14
|
-
return `${i ? '-' : ''}${m.toLowerCase()}`;
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Combine list of class names
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
export function cn(...classNames: (string | boolean | undefined | null)[]) {
|
|
23
|
-
return classNames.filter(Boolean).join(' ');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Icon map
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
const ICON_MAP = Object.entries(IconSVGs).reduce((acc, [key, IconComponent]) => {
|
|
31
|
-
acc[camelCaseToDash(key)] = IconComponent;
|
|
32
|
-
return acc;
|
|
33
|
-
}, {} as Record<string, React.ReactNode>);
|
|
34
|
-
|
|
35
|
-
// Full icon map: https://tablericons.com/
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Types
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
interface IconProps {
|
|
42
|
-
name: string;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
interface SpecialIconProps extends IconProps {
|
|
46
|
-
name: string;
|
|
47
|
-
cornerIconName?: string;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
interface AIFaceProps extends ReactSpanElement {
|
|
51
|
-
size: 'tiny' | 'small' | 'default' | 'medium' | 'large';
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Commonly used icon names
|
|
56
|
-
*/
|
|
57
|
-
|
|
58
|
-
export const COMMON_ICON_NAMES = {
|
|
59
|
-
ai_magic: 'sparkles',
|
|
60
|
-
broken_file: 'file-broken',
|
|
61
|
-
call: 'phone-call',
|
|
62
|
-
chat: 'messages',
|
|
63
|
-
click: 'click',
|
|
64
|
-
close: 'x',
|
|
65
|
-
close_small: 'x-filled',
|
|
66
|
-
co: 'crown',
|
|
67
|
-
colors: 'color-swatch',
|
|
68
|
-
copied: 'copy-check',
|
|
69
|
-
description: 'notes',
|
|
70
|
-
delete: 'trash-x',
|
|
71
|
-
delete_filled: 'trash-x-filled',
|
|
72
|
-
edit: 'edit-circle',
|
|
73
|
-
empty: 'square-forbid-2',
|
|
74
|
-
favorites: 'stars',
|
|
75
|
-
friends_list: 'address-book',
|
|
76
|
-
group: 'users-group',
|
|
77
|
-
image: 'photo',
|
|
78
|
-
images: 'library-photo',
|
|
79
|
-
live: 'broadcast',
|
|
80
|
-
mobile: 'device-mobile',
|
|
81
|
-
moderator: 'gavel',
|
|
82
|
-
not_pinned: 'pinned-off',
|
|
83
|
-
owner: 'crown',
|
|
84
|
-
personas: 'masks-theater',
|
|
85
|
-
pinned: 'pinned',
|
|
86
|
-
plus: 'plus',
|
|
87
|
-
plus_circle: 'circle-plus-filled',
|
|
88
|
-
read: 'checklist',
|
|
89
|
-
report: 'exclamation-circle',
|
|
90
|
-
smile: 'confetti',
|
|
91
|
-
settings: 'settings',
|
|
92
|
-
snooze: 'zzz',
|
|
93
|
-
sticker: 'sticker',
|
|
94
|
-
theme: 'photo-hexagon',
|
|
95
|
-
timeout: 'clock-cancel',
|
|
96
|
-
timeout_unban: 'clock-check',
|
|
97
|
-
unread: 'mailbox',
|
|
98
|
-
user: 'user',
|
|
99
|
-
user_scan: 'user-scan',
|
|
100
|
-
user_blocked: 'user-x',
|
|
101
|
-
user_deleted: 'user-off',
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Simple icon with a very basic fix
|
|
106
|
-
*/
|
|
107
|
-
|
|
108
|
-
export const Icon = memo((p: IconProps) => {
|
|
109
|
-
const { name: iconName } = p;
|
|
110
|
-
const IconComponent = ICON_MAP[iconName];
|
|
111
|
-
|
|
112
|
-
if (!IconComponent) {
|
|
113
|
-
console.warn('Icon: Unknown icon name:', iconName);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return IconComponent || null;
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
Icon.displayName = 'Icon';
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Special icons that aren't included in FA
|
|
123
|
-
*/
|
|
124
|
-
|
|
125
|
-
export const SpecialIcon = memo((p: SpecialIconProps) => {
|
|
126
|
-
const { name } = p;
|
|
127
|
-
const className = 'ic_special';
|
|
128
|
-
|
|
129
|
-
switch (name) {
|
|
130
|
-
case 'google':
|
|
131
|
-
return (
|
|
132
|
-
<img
|
|
133
|
-
alt='Google logo'
|
|
134
|
-
src='/img/google-icon.png'
|
|
135
|
-
className={className}
|
|
136
|
-
/>
|
|
137
|
-
);
|
|
138
|
-
default:
|
|
139
|
-
console.warn('SpecialIcon: Unknown icon name:', name);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
return null;
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
SpecialIcon.displayName = 'SpecialIcon';
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Icon with plus at corner
|
|
149
|
-
*/
|
|
150
|
-
|
|
151
|
-
export const IconWithPlus = memo((p: SpecialIconProps) => {
|
|
152
|
-
const { name, cornerIconName } = p;
|
|
153
|
-
|
|
154
|
-
return (
|
|
155
|
-
<>
|
|
156
|
-
<Icon name={name} />
|
|
157
|
-
<span className='abs_corner_1 ic_df ft_t'>
|
|
158
|
-
<Icon name={cornerIconName || 'circle-plus'} />
|
|
159
|
-
</span>
|
|
160
|
-
</>
|
|
161
|
-
);
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
IconWithPlus.displayName = 'IconWithPlus';
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* AI (brand) icon
|
|
168
|
-
*/
|
|
169
|
-
|
|
170
|
-
export const AIFace = memo((p: AIFaceProps) => {
|
|
171
|
-
const { size, className } = p;
|
|
172
|
-
|
|
173
|
-
let sizeClassName;
|
|
174
|
-
switch (size) {
|
|
175
|
-
case 'tiny':
|
|
176
|
-
sizeClassName = 'av_xs ic_df bd_s';
|
|
177
|
-
break;
|
|
178
|
-
case 'small':
|
|
179
|
-
sizeClassName = 'av_sm ic_l bd_d';
|
|
180
|
-
break;
|
|
181
|
-
case 'default':
|
|
182
|
-
case 'medium':
|
|
183
|
-
case 'large':
|
|
184
|
-
default:
|
|
185
|
-
console.warn(`<AIFace /> size "${size}" is not implemented yet.`);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
return (
|
|
190
|
-
<span
|
|
191
|
-
className={cn(
|
|
192
|
-
'ai_face bg v_center r av',
|
|
193
|
-
sizeClassName,
|
|
194
|
-
// 'bg_primary',
|
|
195
|
-
className
|
|
196
|
-
)}
|
|
197
|
-
>
|
|
198
|
-
<svg className='icon' viewBox="0 0 100 100" fill='currentColor'>
|
|
199
|
-
<path d="M77.44,65.61c-4.07-7.98-12.79-12.11-20.74-9.83-1.01.29-4.51,1.77-5.39,2.76-1.13,1.27-1.44,3.22-.75,4.75.64,1.41,1.96,2.21,3.52,2.15,1.52.01,3.75.04,4.72.06,5.75.11,6.8.65,11.46,4.39.35.28.9.82,1.43,1.35,1.22,1.2,2.49,2.44,3.37,2.77.33.12.66.19.96.19.43,0,.82-.12,1.17-.36,1.1-.76,1.33-2.41,1.33-3.66,0-1.77-.67-3.75-1.09-4.58Z"/>
|
|
200
|
-
<path d="M31.22,39.18h0c-5.16.52-7.43,5.17-6.99,9.49.38,3.78,2.97,7.61,7.79,7.61.3,0,.62-.02.94-.05,2.79-.27,4.96-1.83,6.11-4.39,1.38-3.04,1.01-7.02-.89-9.66-1.6-2.23-4.07-3.29-6.96-3Z"/>
|
|
201
|
-
<path d="M67.2,46.47c.73,0,1.48-.1,2.26-.3,4.74-1.24,6.47-5.94,5.74-9.96-.69-3.78-3.61-7.36-8.57-6.83-3.03.32-5.29,2.03-6.36,4.82-1.27,3.3-.58,7.38,1.68,9.92,1.38,1.55,3.2,2.35,5.26,2.35Z"/>
|
|
202
|
-
</svg>
|
|
203
|
-
</span>
|
|
204
|
-
);
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
AIFace.displayName = 'AIFace';
|