@docyrus/ui-pro-ai-assistant 0.0.2 → 0.0.3
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 +2 -3
- package/src/components/assistant-animations.tsx +0 -29
- package/src/components/assistant-dialogs.tsx +0 -235
- package/src/components/code-view.tsx +0 -278
- package/src/components/create-agent-task.tsx +0 -104
- package/src/components/create-new-work-version.tsx +0 -30
- package/src/components/extract-web.tsx +0 -160
- package/src/components/forward-to-agent.tsx +0 -90
- package/src/components/generate-chart.tsx +0 -101
- package/src/components/generative-action-button.tsx +0 -122
- package/src/components/generative-tool.tsx +0 -685
- package/src/components/generative-ui-object.tsx +0 -210
- package/src/components/input-area.tsx +0 -1209
- package/src/components/json-schema-layout.tsx +0 -326
- package/src/components/list-item-card.tsx +0 -92
- package/src/components/mermaid-diagram.tsx +0 -192
- package/src/components/preview-image.tsx +0 -47
- package/src/components/request-approval.tsx +0 -48
- package/src/components/request-user-input.tsx +0 -270
- package/src/components/search-web.tsx +0 -319
- package/src/components/sheet-command.tsx +0 -88
- package/src/components/shell-canvas.tsx +0 -122
- package/src/components/show-advanced-data-table.tsx +0 -352
- package/src/components/show-generated-content-options.tsx +0 -93
- package/src/components/show-people-cards.tsx +0 -180
- package/src/components/subagent-tool.tsx +0 -180
- package/src/components/text-editor-tool.tsx +0 -328
- package/src/components/work-canvas.tsx +0 -88
- package/src/components/work-card.tsx +0 -42
- package/src/declarations.d.ts +0 -1
- package/src/docy-assistant.tsx +0 -1962
- package/src/hooks/index.ts +0 -7
- package/src/hooks/use-assistant-api.ts +0 -507
- package/src/hooks/use-deployment-data.ts +0 -162
- package/src/hooks/use-project-state.ts +0 -347
- package/src/hooks/use-session-state.ts +0 -207
- package/src/hooks/use-speech-recognition.ts +0 -137
- package/src/hooks/use-ui-state.ts +0 -185
- package/src/hooks/use-works-state.ts +0 -146
- package/src/i18n/context.tsx +0 -253
- package/src/i18n/index.ts +0 -19
- package/src/i18n/locales/de.json +0 -198
- package/src/i18n/locales/el.json +0 -198
- package/src/i18n/locales/en.json +0 -226
- package/src/i18n/locales/es.json +0 -198
- package/src/i18n/locales/fr.json +0 -198
- package/src/i18n/locales/it.json +0 -198
- package/src/i18n/locales/pt.json +0 -198
- package/src/i18n/locales/sl.json +0 -198
- package/src/i18n/locales/tr.json +0 -211
- package/src/i18n/types.ts +0 -23
- package/src/i18n/use-translation.ts +0 -17
- package/src/index.ts +0 -18
- package/src/internal/plate-editor/editor/auth-context.ts +0 -11
- package/src/internal/plate-editor/editor/editor-base-kit.tsx +0 -39
- package/src/internal/plate-editor/editor/editor-kit.tsx +0 -89
- package/src/internal/plate-editor/editor/plate-editor.tsx +0 -75
- package/src/internal/plate-editor/editor/plate-types.ts +0 -126
- package/src/internal/plate-editor/editor/plugins/ai-kit.tsx +0 -172
- package/src/internal/plate-editor/editor/plugins/autoformat-kit.tsx +0 -211
- package/src/internal/plate-editor/editor/plugins/basic-blocks-base-kit.tsx +0 -26
- package/src/internal/plate-editor/editor/plugins/basic-blocks-kit.tsx +0 -51
- package/src/internal/plate-editor/editor/plugins/basic-marks-base-kit.tsx +0 -24
- package/src/internal/plate-editor/editor/plugins/basic-marks-kit.tsx +0 -38
- package/src/internal/plate-editor/editor/plugins/basic-nodes-kit.tsx +0 -6
- package/src/internal/plate-editor/editor/plugins/block-menu-kit.tsx +0 -14
- package/src/internal/plate-editor/editor/plugins/block-placeholder-kit.tsx +0 -17
- package/src/internal/plate-editor/editor/plugins/block-selection-kit.tsx +0 -31
- package/src/internal/plate-editor/editor/plugins/callout-base-kit.tsx +0 -5
- package/src/internal/plate-editor/editor/plugins/callout-kit.tsx +0 -7
- package/src/internal/plate-editor/editor/plugins/code-block-base-kit.tsx +0 -23
- package/src/internal/plate-editor/editor/plugins/code-block-kit.tsx +0 -26
- package/src/internal/plate-editor/editor/plugins/column-base-kit.tsx +0 -8
- package/src/internal/plate-editor/editor/plugins/column-kit.tsx +0 -7
- package/src/internal/plate-editor/editor/plugins/comment-base-kit.tsx +0 -5
- package/src/internal/plate-editor/editor/plugins/comment-kit.tsx +0 -174
- package/src/internal/plate-editor/editor/plugins/copilot-kit.tsx +0 -68
- package/src/internal/plate-editor/editor/plugins/cursor-overlay-kit.tsx +0 -13
- package/src/internal/plate-editor/editor/plugins/date-base-kit.tsx +0 -5
- package/src/internal/plate-editor/editor/plugins/date-kit.tsx +0 -7
- package/src/internal/plate-editor/editor/plugins/discussion-kit.tsx +0 -36
- package/src/internal/plate-editor/editor/plugins/dnd-kit.tsx +0 -27
- package/src/internal/plate-editor/editor/plugins/docx-export-kit.tsx +0 -43
- package/src/internal/plate-editor/editor/plugins/docx-kit.tsx +0 -6
- package/src/internal/plate-editor/editor/plugins/emoji-kit.tsx +0 -15
- package/src/internal/plate-editor/editor/plugins/exit-break-kit.tsx +0 -12
- package/src/internal/plate-editor/editor/plugins/floating-toolbar-kit.tsx +0 -19
- package/src/internal/plate-editor/editor/plugins/font-base-kit.tsx +0 -36
- package/src/internal/plate-editor/editor/plugins/font-kit.tsx +0 -47
- package/src/internal/plate-editor/editor/plugins/indent-base-kit.tsx +0 -19
- package/src/internal/plate-editor/editor/plugins/indent-kit.tsx +0 -22
- package/src/internal/plate-editor/editor/plugins/link-base-kit.tsx +0 -5
- package/src/internal/plate-editor/editor/plugins/link-kit.tsx +0 -35
- package/src/internal/plate-editor/editor/plugins/list-base-kit.tsx +0 -24
- package/src/internal/plate-editor/editor/plugins/list-kit.tsx +0 -27
- package/src/internal/plate-editor/editor/plugins/markdown-kit.tsx +0 -18
- package/src/internal/plate-editor/editor/plugins/math-base-kit.tsx +0 -8
- package/src/internal/plate-editor/editor/plugins/math-kit.tsx +0 -10
- package/src/internal/plate-editor/editor/plugins/media-base-kit.tsx +0 -37
- package/src/internal/plate-editor/editor/plugins/media-kit.tsx +0 -53
- package/src/internal/plate-editor/editor/plugins/mention-base-kit.tsx +0 -5
- package/src/internal/plate-editor/editor/plugins/mention-kit.tsx +0 -36
- package/src/internal/plate-editor/editor/plugins/slash-kit.tsx +0 -17
- package/src/internal/plate-editor/editor/plugins/suggestion-base-kit.tsx +0 -5
- package/src/internal/plate-editor/editor/plugins/suggestion-kit.tsx +0 -95
- package/src/internal/plate-editor/editor/plugins/table-base-kit.tsx +0 -20
- package/src/internal/plate-editor/editor/plugins/table-kit.tsx +0 -22
- package/src/internal/plate-editor/editor/plugins/toc-base-kit.tsx +0 -5
- package/src/internal/plate-editor/editor/plugins/toc-kit.tsx +0 -14
- package/src/internal/plate-editor/editor/plugins/toggle-base-kit.tsx +0 -5
- package/src/internal/plate-editor/editor/plugins/toggle-kit.tsx +0 -9
- package/src/internal/plate-editor/editor/transforms.ts +0 -165
- package/src/internal/plate-editor/editor/use-chat.ts +0 -152
- package/src/internal/plate-editor/hooks/index.ts +0 -3
- package/src/internal/plate-editor/hooks/use-copy-to-clipboard.ts +0 -31
- package/src/internal/plate-editor/hooks/use-is-touch-device.ts +0 -26
- package/src/internal/plate-editor/hooks/use-lock-scroll.ts +0 -21
- package/src/internal/plate-editor/hooks/use-media-query.ts +0 -44
- package/src/internal/plate-editor/hooks/use-mounted.ts +0 -18
- package/src/internal/plate-editor/hooks/use-on-click-outside.ts +0 -114
- package/src/internal/plate-editor/hooks/use-upload-file.ts +0 -81
- package/src/internal/plate-editor/i18n/context.tsx +0 -58
- package/src/internal/plate-editor/i18n/index.ts +0 -3
- package/src/internal/plate-editor/i18n/locales/de.json +0 -57
- package/src/internal/plate-editor/i18n/locales/el.json +0 -57
- package/src/internal/plate-editor/i18n/locales/en.json +0 -57
- package/src/internal/plate-editor/i18n/locales/es.json +0 -57
- package/src/internal/plate-editor/i18n/locales/fr.json +0 -57
- package/src/internal/plate-editor/i18n/locales/it.json +0 -57
- package/src/internal/plate-editor/i18n/locales/pt.json +0 -57
- package/src/internal/plate-editor/i18n/locales/sl.json +0 -57
- package/src/internal/plate-editor/i18n/locales/tr.json +0 -57
- package/src/internal/plate-editor/i18n/types.ts +0 -59
- package/src/internal/plate-editor/i18n/use-translation.ts +0 -22
- package/src/internal/plate-editor/index.ts +0 -39
- package/src/internal/plate-editor/lib/ai-output-converter.ts +0 -153
- package/src/internal/plate-editor/lib/download-file.ts +0 -17
- package/src/internal/plate-editor/plate-ui/ai-chat-editor.tsx +0 -24
- package/src/internal/plate-editor/plate-ui/ai-menu.tsx +0 -828
- package/src/internal/plate-editor/plate-ui/ai-node.tsx +0 -41
- package/src/internal/plate-editor/plate-ui/ai-toolbar-button.tsx +0 -25
- package/src/internal/plate-editor/plate-ui/alert-dialog.tsx +0 -145
- package/src/internal/plate-editor/plate-ui/align-toolbar-button.tsx +0 -88
- package/src/internal/plate-editor/plate-ui/avatar.tsx +0 -3
- package/src/internal/plate-editor/plate-ui/block-context-menu.tsx +0 -104
- package/src/internal/plate-editor/plate-ui/block-discussion.tsx +0 -364
- package/src/internal/plate-editor/plate-ui/block-draggable.tsx +0 -557
- package/src/internal/plate-editor/plate-ui/block-list-static.tsx +0 -77
- package/src/internal/plate-editor/plate-ui/block-list.tsx +0 -85
- package/src/internal/plate-editor/plate-ui/block-menu.tsx +0 -555
- package/src/internal/plate-editor/plate-ui/block-selection.tsx +0 -47
- package/src/internal/plate-editor/plate-ui/block-suggestion.tsx +0 -469
- package/src/internal/plate-editor/plate-ui/blockquote-node-static.tsx +0 -10
- package/src/internal/plate-editor/plate-ui/blockquote-node.tsx +0 -11
- package/src/internal/plate-editor/plate-ui/button.tsx +0 -201
- package/src/internal/plate-editor/plate-ui/calendar.tsx +0 -3
- package/src/internal/plate-editor/plate-ui/callout-node-static.tsx +0 -76
- package/src/internal/plate-editor/plate-ui/callout-node.tsx +0 -54
- package/src/internal/plate-editor/plate-ui/caption.tsx +0 -47
- package/src/internal/plate-editor/plate-ui/checkbox.tsx +0 -3
- package/src/internal/plate-editor/plate-ui/code-block-node-static.tsx +0 -172
- package/src/internal/plate-editor/plate-ui/code-block-node.tsx +0 -226
- package/src/internal/plate-editor/plate-ui/code-node-static.tsx +0 -11
- package/src/internal/plate-editor/plate-ui/code-node.tsx +0 -12
- package/src/internal/plate-editor/plate-ui/column-node-static.tsx +0 -65
- package/src/internal/plate-editor/plate-ui/column-node.tsx +0 -24
- package/src/internal/plate-editor/plate-ui/command.tsx +0 -202
- package/src/internal/plate-editor/plate-ui/comment-node-static.tsx +0 -12
- package/src/internal/plate-editor/plate-ui/comment-node.tsx +0 -45
- package/src/internal/plate-editor/plate-ui/comment-toolbar-button.tsx +0 -24
- package/src/internal/plate-editor/plate-ui/comment.tsx +0 -619
- package/src/internal/plate-editor/plate-ui/cursor-overlay.tsx +0 -85
- package/src/internal/plate-editor/plate-ui/date-node-static.tsx +0 -43
- package/src/internal/plate-editor/plate-ui/date-node.tsx +0 -54
- package/src/internal/plate-editor/plate-ui/dialog.tsx +0 -445
- package/src/internal/plate-editor/plate-ui/dropdown-menu.tsx +0 -264
- package/src/internal/plate-editor/plate-ui/editor-static.tsx +0 -40
- package/src/internal/plate-editor/plate-ui/editor.tsx +0 -146
- package/src/internal/plate-editor/plate-ui/emoji-node.tsx +0 -48
- package/src/internal/plate-editor/plate-ui/emoji-toolbar-button.tsx +0 -626
- package/src/internal/plate-editor/plate-ui/equation-node-static.tsx +0 -155
- package/src/internal/plate-editor/plate-ui/equation-node.tsx +0 -226
- package/src/internal/plate-editor/plate-ui/equation-toolbar-button.tsx +0 -26
- package/src/internal/plate-editor/plate-ui/export-toolbar-button.tsx +0 -206
- package/src/internal/plate-editor/plate-ui/fixed-toolbar-buttons.tsx +0 -157
- package/src/internal/plate-editor/plate-ui/fixed-toolbar.tsx +0 -25
- package/src/internal/plate-editor/plate-ui/floating-discussion.tsx +0 -1129
- package/src/internal/plate-editor/plate-ui/floating-toolbar-buttons.tsx +0 -129
- package/src/internal/plate-editor/plate-ui/floating-toolbar.tsx +0 -97
- package/src/internal/plate-editor/plate-ui/font-color-toolbar-button.tsx +0 -209
- package/src/internal/plate-editor/plate-ui/font-size-toolbar-button.tsx +0 -152
- package/src/internal/plate-editor/plate-ui/ghost-text.tsx +0 -20
- package/src/internal/plate-editor/plate-ui/heading-node-static.tsx +0 -52
- package/src/internal/plate-editor/plate-ui/heading-node.tsx +0 -56
- package/src/internal/plate-editor/plate-ui/highlight-node-static.tsx +0 -9
- package/src/internal/plate-editor/plate-ui/highlight-node.tsx +0 -11
- package/src/internal/plate-editor/plate-ui/history-toolbar-button.tsx +0 -50
- package/src/internal/plate-editor/plate-ui/hover-card.tsx +0 -7
- package/src/internal/plate-editor/plate-ui/hr-node-static.tsx +0 -18
- package/src/internal/plate-editor/plate-ui/hr-node.tsx +0 -28
- package/src/internal/plate-editor/plate-ui/import-toolbar-button.tsx +0 -122
- package/src/internal/plate-editor/plate-ui/indent-toolbar-button.tsx +0 -32
- package/src/internal/plate-editor/plate-ui/inline-combobox.tsx +0 -409
- package/src/internal/plate-editor/plate-ui/input.tsx +0 -37
- package/src/internal/plate-editor/plate-ui/insert-toolbar-button.tsx +0 -258
- package/src/internal/plate-editor/plate-ui/label.tsx +0 -1
- package/src/internal/plate-editor/plate-ui/line-height-toolbar-button.tsx +0 -69
- package/src/internal/plate-editor/plate-ui/link-node-static.tsx +0 -15
- package/src/internal/plate-editor/plate-ui/link-node.tsx +0 -33
- package/src/internal/plate-editor/plate-ui/link-toolbar-button.tsx +0 -28
- package/src/internal/plate-editor/plate-ui/link-toolbar.tsx +0 -147
- package/src/internal/plate-editor/plate-ui/list-toolbar-button.tsx +0 -177
- package/src/internal/plate-editor/plate-ui/mark-toolbar-button.tsx +0 -34
- package/src/internal/plate-editor/plate-ui/media-audio-node-static.tsx +0 -21
- package/src/internal/plate-editor/plate-ui/media-audio-node.tsx +0 -32
- package/src/internal/plate-editor/plate-ui/media-embed-node.tsx +0 -103
- package/src/internal/plate-editor/plate-ui/media-file-node-static.tsx +0 -30
- package/src/internal/plate-editor/plate-ui/media-file-node.tsx +0 -52
- package/src/internal/plate-editor/plate-ui/media-image-node-static.tsx +0 -37
- package/src/internal/plate-editor/plate-ui/media-image-node.tsx +0 -183
- package/src/internal/plate-editor/plate-ui/media-placeholder-node.tsx +0 -441
- package/src/internal/plate-editor/plate-ui/media-preview-dialog.tsx +0 -127
- package/src/internal/plate-editor/plate-ui/media-toolbar-button.tsx +0 -227
- package/src/internal/plate-editor/plate-ui/media-toolbar.tsx +0 -214
- package/src/internal/plate-editor/plate-ui/media-upload-toast.tsx +0 -73
- package/src/internal/plate-editor/plate-ui/media-video-node-static.tsx +0 -35
- package/src/internal/plate-editor/plate-ui/media-video-node.tsx +0 -119
- package/src/internal/plate-editor/plate-ui/mention-node-static.tsx +0 -46
- package/src/internal/plate-editor/plate-ui/mention-node.tsx +0 -79
- package/src/internal/plate-editor/plate-ui/menu.tsx +0 -539
- package/src/internal/plate-editor/plate-ui/mode-toolbar-button.tsx +0 -124
- package/src/internal/plate-editor/plate-ui/more-toolbar-button.tsx +0 -34
- package/src/internal/plate-editor/plate-ui/paragraph-node-static.tsx +0 -15
- package/src/internal/plate-editor/plate-ui/paragraph-node.tsx +0 -16
- package/src/internal/plate-editor/plate-ui/popover.tsx +0 -75
- package/src/internal/plate-editor/plate-ui/progress.tsx +0 -1
- package/src/internal/plate-editor/plate-ui/remote-cursor-overlay.tsx +0 -79
- package/src/internal/plate-editor/plate-ui/resize-handle.tsx +0 -86
- package/src/internal/plate-editor/plate-ui/separator.tsx +0 -41
- package/src/internal/plate-editor/plate-ui/slash-node.tsx +0 -433
- package/src/internal/plate-editor/plate-ui/spinner.tsx +0 -1
- package/src/internal/plate-editor/plate-ui/suggestion-node-static.tsx +0 -35
- package/src/internal/plate-editor/plate-ui/suggestion-node.tsx +0 -166
- package/src/internal/plate-editor/plate-ui/suggestion-toolbar-button.tsx +0 -24
- package/src/internal/plate-editor/plate-ui/table-node-static.tsx +0 -84
- package/src/internal/plate-editor/plate-ui/table-node.tsx +0 -283
- package/src/internal/plate-editor/plate-ui/table-toolbar-button.tsx +0 -252
- package/src/internal/plate-editor/plate-ui/tabs.tsx +0 -3
- package/src/internal/plate-editor/plate-ui/textarea.tsx +0 -57
- package/src/internal/plate-editor/plate-ui/toc-node-static.tsx +0 -142
- package/src/internal/plate-editor/plate-ui/toc-node.tsx +0 -57
- package/src/internal/plate-editor/plate-ui/toc-sidebar.tsx +0 -48
- package/src/internal/plate-editor/plate-ui/toggle-node-static.tsx +0 -18
- package/src/internal/plate-editor/plate-ui/toggle-node.tsx +0 -33
- package/src/internal/plate-editor/plate-ui/toggle-toolbar-button.tsx +0 -24
- package/src/internal/plate-editor/plate-ui/toggle.tsx +0 -3
- package/src/internal/plate-editor/plate-ui/toolbar.tsx +0 -378
- package/src/internal/plate-editor/plate-ui/tooltip.tsx +0 -148
- package/src/internal/plate-editor/plate-ui/turn-into-toolbar-button.tsx +0 -175
- package/src/internal/plate-editor/types/index.ts +0 -22
- package/src/internal/plate-editor/vite.ts +0 -284
- package/src/internal/sheets/components/univer-sheets.tsx +0 -1104
- package/src/internal/sheets/i18n/context.tsx +0 -183
- package/src/internal/sheets/i18n/index.ts +0 -19
- package/src/internal/sheets/i18n/locales/de.json +0 -21
- package/src/internal/sheets/i18n/locales/el.json +0 -21
- package/src/internal/sheets/i18n/locales/en.json +0 -21
- package/src/internal/sheets/i18n/locales/es.json +0 -21
- package/src/internal/sheets/i18n/locales/fr.json +0 -21
- package/src/internal/sheets/i18n/locales/it.json +0 -21
- package/src/internal/sheets/i18n/locales/pt.json +0 -21
- package/src/internal/sheets/i18n/locales/sl.json +0 -21
- package/src/internal/sheets/i18n/locales/tr.json +0 -21
- package/src/internal/sheets/i18n/types.ts +0 -23
- package/src/internal/sheets/i18n/use-translation.ts +0 -17
- package/src/internal/sheets/index.ts +0 -14
- package/src/internal/sheets/types/css.d.ts +0 -11
- package/src/internal/sheets/types/index.ts +0 -260
- package/src/internal/sheets/xlsx.ts +0 -1169
- package/src/lib/api-client.ts +0 -77
- package/src/lib/assistant-api-actions.ts +0 -549
- package/src/lib/assistant-config.tsx +0 -75
- package/src/lib/class-utils.ts +0 -40
- package/src/lib/index.ts +0 -7
- package/src/lib/message-utils.ts +0 -131
- package/src/tools/tools-schema.json +0 -512
- package/src/types/index.ts +0 -235
- package/src/views/assistant-view.tsx +0 -1137
- package/src/views/canvas-app.tsx +0 -839
- package/src/views/canvas-code.tsx +0 -93
- package/src/views/canvas-deep-research.tsx +0 -44
- package/src/views/canvas-image.tsx +0 -25
- package/src/views/canvas-record-view.tsx +0 -285
- package/src/views/canvas-spreadsheet.tsx +0 -125
- package/src/views/canvas-text.tsx +0 -52
- package/src/views/canvas.tsx +0 -274
- package/src/views/chat-panel.tsx +0 -149
- package/src/views/index.ts +0 -20
- package/src/views/memories-panel.tsx +0 -365
- package/src/views/message-list.tsx +0 -370
- package/src/views/project-detail.tsx +0 -257
- package/src/views/projects-panel.tsx +0 -131
- package/src/views/sessions-list.tsx +0 -98
- package/src/views/sidebar-content.tsx +0 -256
- package/src/views/work-detail.tsx +0 -98
- package/src/vite.ts +0 -64
- package/src/worker.ts +0 -203
|
@@ -1,626 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
memo, useCallback, type ComponentPropsWithoutRef, type ReactElement, type ReactNode
|
|
5
|
-
} from 'react';
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
type IEmojiFloatingLibrary,
|
|
9
|
-
type UseEmojiPickerType, useEmojiDropdownMenuState
|
|
10
|
-
} from '@platejs/emoji/react';
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
type Emoji,
|
|
14
|
-
type EmojiCategoryList,
|
|
15
|
-
type EmojiIconList,
|
|
16
|
-
EmojiSettings,
|
|
17
|
-
type GridRow
|
|
18
|
-
} from '@platejs/emoji';
|
|
19
|
-
|
|
20
|
-
import {
|
|
21
|
-
AppleIcon,
|
|
22
|
-
ClockIcon,
|
|
23
|
-
CompassIcon,
|
|
24
|
-
DeleteIcon,
|
|
25
|
-
FlagIcon,
|
|
26
|
-
LeafIcon,
|
|
27
|
-
LightbulbIcon,
|
|
28
|
-
MusicIcon,
|
|
29
|
-
SearchIcon,
|
|
30
|
-
SmileIcon,
|
|
31
|
-
StarIcon,
|
|
32
|
-
XIcon
|
|
33
|
-
} from 'lucide-react';
|
|
34
|
-
import { Popover } from 'radix-ui';
|
|
35
|
-
|
|
36
|
-
import { cn } from '@docyrus/ui-pro-shared/lib/utils';
|
|
37
|
-
|
|
38
|
-
import { Button } from './button';
|
|
39
|
-
import { ToolbarButton } from './toolbar';
|
|
40
|
-
|
|
41
|
-
export function EmojiPopover({
|
|
42
|
-
children,
|
|
43
|
-
control,
|
|
44
|
-
isOpen,
|
|
45
|
-
setIsOpen
|
|
46
|
-
}: {
|
|
47
|
-
children: ReactNode;
|
|
48
|
-
control: ReactNode;
|
|
49
|
-
isOpen: boolean;
|
|
50
|
-
setIsOpen: (open: boolean) => void;
|
|
51
|
-
}) {
|
|
52
|
-
return (
|
|
53
|
-
<Popover.Root onOpenChange={setIsOpen} open={isOpen}>
|
|
54
|
-
<Popover.Trigger asChild>{control}</Popover.Trigger>
|
|
55
|
-
|
|
56
|
-
<Popover.Portal>
|
|
57
|
-
<Popover.Content className="z-100">{children}</Popover.Content>
|
|
58
|
-
</Popover.Portal>
|
|
59
|
-
</Popover.Root>
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export function EmojiPicker({
|
|
64
|
-
clearSearch,
|
|
65
|
-
emoji,
|
|
66
|
-
emojiLibrary,
|
|
67
|
-
focusedCategory,
|
|
68
|
-
hasFound,
|
|
69
|
-
i18n,
|
|
70
|
-
icons = {
|
|
71
|
-
categories: emojiCategoryIcons,
|
|
72
|
-
search: emojiSearchIcons
|
|
73
|
-
},
|
|
74
|
-
isSearching,
|
|
75
|
-
refs,
|
|
76
|
-
searchResult,
|
|
77
|
-
searchValue,
|
|
78
|
-
setSearch,
|
|
79
|
-
settings = EmojiSettings,
|
|
80
|
-
visibleCategories,
|
|
81
|
-
handleCategoryClick,
|
|
82
|
-
onMouseOver,
|
|
83
|
-
onSelectEmoji
|
|
84
|
-
}: Omit<UseEmojiPickerType, 'icons'> & {
|
|
85
|
-
icons?: EmojiIconList<ReactElement>;
|
|
86
|
-
}) {
|
|
87
|
-
return (
|
|
88
|
-
<div
|
|
89
|
-
className={cn(
|
|
90
|
-
'flex flex-col rounded-xl bg-popover text-popover-foreground',
|
|
91
|
-
'h-[23rem] w-80 border shadow-md'
|
|
92
|
-
)}>
|
|
93
|
-
<EmojiPickerNavigation
|
|
94
|
-
emojiLibrary={emojiLibrary}
|
|
95
|
-
focusedCategory={focusedCategory}
|
|
96
|
-
i18n={i18n}
|
|
97
|
-
icons={icons}
|
|
98
|
-
onClick={handleCategoryClick} />
|
|
99
|
-
<EmojiPickerSearchBar
|
|
100
|
-
i18n={i18n}
|
|
101
|
-
searchValue={searchValue}
|
|
102
|
-
setSearch={setSearch}>
|
|
103
|
-
<EmojiPickerSearchAndClear
|
|
104
|
-
clearSearch={clearSearch}
|
|
105
|
-
i18n={i18n}
|
|
106
|
-
searchValue={searchValue} />
|
|
107
|
-
</EmojiPickerSearchBar>
|
|
108
|
-
<EmojiPickerContent
|
|
109
|
-
emojiLibrary={emojiLibrary}
|
|
110
|
-
i18n={i18n}
|
|
111
|
-
isSearching={isSearching}
|
|
112
|
-
onMouseOver={onMouseOver}
|
|
113
|
-
onSelectEmoji={onSelectEmoji}
|
|
114
|
-
refs={refs}
|
|
115
|
-
searchResult={searchResult}
|
|
116
|
-
settings={settings}
|
|
117
|
-
visibleCategories={visibleCategories} />
|
|
118
|
-
<EmojiPickerPreview
|
|
119
|
-
emoji={emoji}
|
|
120
|
-
hasFound={hasFound}
|
|
121
|
-
i18n={i18n}
|
|
122
|
-
isSearching={isSearching} />
|
|
123
|
-
</div>
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
const EmojiButton = memo(
|
|
128
|
-
({
|
|
129
|
-
emoji,
|
|
130
|
-
index,
|
|
131
|
-
onMouseOver,
|
|
132
|
-
onSelect
|
|
133
|
-
}: {
|
|
134
|
-
emoji: Emoji;
|
|
135
|
-
index: number;
|
|
136
|
-
onMouseOver: (emoji?: Emoji) => void;
|
|
137
|
-
onSelect: (emoji: Emoji) => void;
|
|
138
|
-
}) => (
|
|
139
|
-
<button
|
|
140
|
-
aria-label={emoji.skins[0].native}
|
|
141
|
-
className="group relative flex size-9 cursor-pointer items-center justify-center border-none bg-transparent text-2xl leading-none"
|
|
142
|
-
data-index={index}
|
|
143
|
-
onClick={() => onSelect(emoji)}
|
|
144
|
-
onMouseEnter={() => onMouseOver(emoji)}
|
|
145
|
-
onMouseLeave={() => onMouseOver()}
|
|
146
|
-
tabIndex={-1}
|
|
147
|
-
type="button">
|
|
148
|
-
<div
|
|
149
|
-
aria-hidden="true"
|
|
150
|
-
className="absolute inset-0 rounded-full opacity-0 group-hover:opacity-100" />
|
|
151
|
-
<span
|
|
152
|
-
className="relative"
|
|
153
|
-
data-emoji-set="native"
|
|
154
|
-
style={{
|
|
155
|
-
fontFamily:
|
|
156
|
-
'"Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Noto Color Emoji", "Segoe UI Symbol", "Android Emoji", EmojiSymbols'
|
|
157
|
-
}}>
|
|
158
|
-
{emoji.skins[0].native}
|
|
159
|
-
</span>
|
|
160
|
-
</button>
|
|
161
|
-
)
|
|
162
|
-
);
|
|
163
|
-
|
|
164
|
-
const RowOfButtons = memo(
|
|
165
|
-
({
|
|
166
|
-
emojiLibrary,
|
|
167
|
-
row,
|
|
168
|
-
onMouseOver,
|
|
169
|
-
onSelectEmoji
|
|
170
|
-
}: {
|
|
171
|
-
row: GridRow;
|
|
172
|
-
} & Pick<
|
|
173
|
-
UseEmojiPickerType,
|
|
174
|
-
'emojiLibrary' | 'onMouseOver' | 'onSelectEmoji'
|
|
175
|
-
>) => (
|
|
176
|
-
<div className="flex" data-index={row.id} key={row.id}>
|
|
177
|
-
{row.elements.map((emojiId, index) => (
|
|
178
|
-
<EmojiButton
|
|
179
|
-
emoji={emojiLibrary.getEmoji(emojiId)}
|
|
180
|
-
index={index}
|
|
181
|
-
key={emojiId}
|
|
182
|
-
onMouseOver={onMouseOver}
|
|
183
|
-
onSelect={onSelectEmoji} />
|
|
184
|
-
))}
|
|
185
|
-
</div>
|
|
186
|
-
)
|
|
187
|
-
);
|
|
188
|
-
|
|
189
|
-
function EmojiSearchList({
|
|
190
|
-
emojiLibrary,
|
|
191
|
-
getRowWidth,
|
|
192
|
-
i18nSearchResult,
|
|
193
|
-
searchResult,
|
|
194
|
-
onSelectEmoji,
|
|
195
|
-
onMouseOver
|
|
196
|
-
}: {
|
|
197
|
-
emojiLibrary: UseEmojiPickerType['emojiLibrary'];
|
|
198
|
-
getRowWidth: number;
|
|
199
|
-
i18nSearchResult: string;
|
|
200
|
-
searchResult: UseEmojiPickerType['searchResult'];
|
|
201
|
-
onSelectEmoji: UseEmojiPickerType['onSelectEmoji'];
|
|
202
|
-
onMouseOver: UseEmojiPickerType['onMouseOver'];
|
|
203
|
-
}) {
|
|
204
|
-
return (
|
|
205
|
-
<div data-id="search" style={{ width: getRowWidth }}>
|
|
206
|
-
<div className="-top-px sticky z-1 bg-popover/90 p-1 py-2 font-semibold text-card-foreground text-sm backdrop-blur-xs">
|
|
207
|
-
{i18nSearchResult}
|
|
208
|
-
</div>
|
|
209
|
-
<div className="relative flex flex-wrap">
|
|
210
|
-
{searchResult.map((emoji: Emoji, index: number) => (
|
|
211
|
-
<EmojiButton
|
|
212
|
-
emoji={emojiLibrary.getEmoji(emoji.id)}
|
|
213
|
-
index={index}
|
|
214
|
-
key={emoji.id}
|
|
215
|
-
onMouseOver={onMouseOver}
|
|
216
|
-
onSelect={onSelectEmoji} />
|
|
217
|
-
))}
|
|
218
|
-
</div>
|
|
219
|
-
</div>
|
|
220
|
-
);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
function EmojiPickerContent({
|
|
224
|
-
emojiLibrary,
|
|
225
|
-
i18n,
|
|
226
|
-
isSearching = false,
|
|
227
|
-
refs,
|
|
228
|
-
searchResult,
|
|
229
|
-
settings = EmojiSettings,
|
|
230
|
-
visibleCategories,
|
|
231
|
-
onMouseOver,
|
|
232
|
-
onSelectEmoji
|
|
233
|
-
}: Pick<
|
|
234
|
-
UseEmojiPickerType,
|
|
235
|
-
| 'emojiLibrary'
|
|
236
|
-
| 'i18n'
|
|
237
|
-
| 'isSearching'
|
|
238
|
-
| 'onMouseOver'
|
|
239
|
-
| 'onSelectEmoji'
|
|
240
|
-
| 'refs'
|
|
241
|
-
| 'searchResult'
|
|
242
|
-
| 'settings'
|
|
243
|
-
| 'visibleCategories'
|
|
244
|
-
>) {
|
|
245
|
-
const getRowWidth = settings.perLine.value * settings.buttonSize.value;
|
|
246
|
-
|
|
247
|
-
const isCategoryVisible = useCallback(
|
|
248
|
-
(categoryId: any) => visibleCategories.has(categoryId) ? visibleCategories.get(categoryId) : false,
|
|
249
|
-
[visibleCategories]
|
|
250
|
-
);
|
|
251
|
-
|
|
252
|
-
const EmojiList = useCallback(
|
|
253
|
-
() => emojiLibrary
|
|
254
|
-
.getGrid()
|
|
255
|
-
.sections()
|
|
256
|
-
.map(({ id: categoryId }) => {
|
|
257
|
-
const section = emojiLibrary.getGrid().section(categoryId);
|
|
258
|
-
const { buttonSize } = settings;
|
|
259
|
-
|
|
260
|
-
return (
|
|
261
|
-
<div
|
|
262
|
-
data-id={categoryId}
|
|
263
|
-
key={categoryId}
|
|
264
|
-
ref={section.root}
|
|
265
|
-
style={{ width: getRowWidth }}>
|
|
266
|
-
<div className="-top-px sticky z-1 bg-popover/90 p-1 py-2 font-semibold text-sm backdrop-blur-xs">
|
|
267
|
-
{i18n.categories[categoryId]}
|
|
268
|
-
</div>
|
|
269
|
-
<div
|
|
270
|
-
className="relative flex flex-wrap"
|
|
271
|
-
style={{ height: section.getRows().length * buttonSize.value }}>
|
|
272
|
-
{isCategoryVisible(categoryId)
|
|
273
|
-
&& section
|
|
274
|
-
.getRows()
|
|
275
|
-
.map((row: GridRow) => (
|
|
276
|
-
<RowOfButtons
|
|
277
|
-
emojiLibrary={emojiLibrary}
|
|
278
|
-
key={row.id}
|
|
279
|
-
onMouseOver={onMouseOver}
|
|
280
|
-
onSelectEmoji={onSelectEmoji}
|
|
281
|
-
row={row} />
|
|
282
|
-
))}
|
|
283
|
-
</div>
|
|
284
|
-
</div>
|
|
285
|
-
);
|
|
286
|
-
}),
|
|
287
|
-
[
|
|
288
|
-
emojiLibrary,
|
|
289
|
-
getRowWidth,
|
|
290
|
-
i18n.categories,
|
|
291
|
-
isCategoryVisible,
|
|
292
|
-
onSelectEmoji,
|
|
293
|
-
onMouseOver,
|
|
294
|
-
settings
|
|
295
|
-
]
|
|
296
|
-
);
|
|
297
|
-
|
|
298
|
-
return (
|
|
299
|
-
<div
|
|
300
|
-
className={cn(
|
|
301
|
-
'h-full min-h-[50%] overflow-y-auto overflow-x-hidden px-2',
|
|
302
|
-
'[&::-webkit-scrollbar]:w-4',
|
|
303
|
-
'[&::-webkit-scrollbar-button]:hidden [&::-webkit-scrollbar-button]:size-0',
|
|
304
|
-
':hover:[&::-webkit-scrollbar-thumb]:bg-[#f3f4f6]',
|
|
305
|
-
'[&::-webkit-scrollbar-thumb]:min-h-[65px] [&::-webkit-scrollbar-thumb]:rounded-2xl [&::-webkit-scrollbar-thumb]:border-4 [&::-webkit-scrollbar-thumb]:border-white',
|
|
306
|
-
'[&::-webkit-scrollbar-track]:border-0'
|
|
307
|
-
)}
|
|
308
|
-
data-id="scroll"
|
|
309
|
-
ref={refs.current.contentRoot}>
|
|
310
|
-
<div className="h-full" ref={refs.current.content}>
|
|
311
|
-
{isSearching ? (
|
|
312
|
-
<EmojiSearchList
|
|
313
|
-
emojiLibrary={emojiLibrary}
|
|
314
|
-
getRowWidth={getRowWidth}
|
|
315
|
-
i18nSearchResult={i18n.searchResult}
|
|
316
|
-
onMouseOver={onMouseOver}
|
|
317
|
-
onSelectEmoji={onSelectEmoji}
|
|
318
|
-
searchResult={searchResult} />
|
|
319
|
-
) : EmojiList()}
|
|
320
|
-
</div>
|
|
321
|
-
</div>
|
|
322
|
-
);
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
function EmojiPickerSearchBar({
|
|
326
|
-
children,
|
|
327
|
-
i18n,
|
|
328
|
-
searchValue,
|
|
329
|
-
setSearch
|
|
330
|
-
}: {
|
|
331
|
-
children: ReactNode;
|
|
332
|
-
} & Pick<UseEmojiPickerType, 'i18n' | 'searchValue' | 'setSearch'>) {
|
|
333
|
-
return (
|
|
334
|
-
<div className="flex items-center px-2">
|
|
335
|
-
<div className="relative flex grow items-center">
|
|
336
|
-
<input
|
|
337
|
-
aria-label="Search"
|
|
338
|
-
autoComplete="off"
|
|
339
|
-
className="block w-full appearance-none rounded-full border-0 bg-muted px-10 py-2 text-sm outline-hidden placeholder:text-muted-foreground focus-visible:outline-hidden"
|
|
340
|
-
onChange={event => setSearch(event.target.value)}
|
|
341
|
-
placeholder={i18n.search}
|
|
342
|
-
type="text"
|
|
343
|
-
value={searchValue} />
|
|
344
|
-
{children}
|
|
345
|
-
</div>
|
|
346
|
-
</div>
|
|
347
|
-
);
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
function EmojiPickerSearchAndClear({
|
|
351
|
-
clearSearch,
|
|
352
|
-
i18n,
|
|
353
|
-
searchValue
|
|
354
|
-
}: Pick<UseEmojiPickerType, 'clearSearch' | 'i18n' | 'searchValue'>) {
|
|
355
|
-
return (
|
|
356
|
-
<div className="flex items-center">
|
|
357
|
-
<div
|
|
358
|
-
className={cn(
|
|
359
|
-
'-translate-y-1/2 absolute top-1/2 left-3 z-10 flex size-5 items-center justify-center'
|
|
360
|
-
)}>
|
|
361
|
-
<SearchIcon className="size-4" />
|
|
362
|
-
</div>
|
|
363
|
-
{searchValue && (
|
|
364
|
-
<Button
|
|
365
|
-
aria-label="Clear"
|
|
366
|
-
className={cn(
|
|
367
|
-
'-translate-y-1/2 absolute top-1/2 right-1 flex size-8 cursor-pointer items-center justify-center border-none bg-transparent'
|
|
368
|
-
)}
|
|
369
|
-
onClick={clearSearch}
|
|
370
|
-
size="icon"
|
|
371
|
-
title={i18n.clear}
|
|
372
|
-
type="button"
|
|
373
|
-
variant="ghost">
|
|
374
|
-
<DeleteIcon className="size-4" />
|
|
375
|
-
</Button>
|
|
376
|
-
)}
|
|
377
|
-
</div>
|
|
378
|
-
);
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
function EmojiPreview({ emoji }: Pick<UseEmojiPickerType, 'emoji'>) {
|
|
382
|
-
return (
|
|
383
|
-
<div className="flex h-20 items-center border-muted border-t p-2">
|
|
384
|
-
<div
|
|
385
|
-
className="flex items-center justify-center text-2xl"
|
|
386
|
-
style={{
|
|
387
|
-
fontFamily:
|
|
388
|
-
'"Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Noto Color Emoji", "Segoe UI Symbol", "Android Emoji", EmojiSymbols'
|
|
389
|
-
}}>
|
|
390
|
-
{emoji?.skins[0].native}
|
|
391
|
-
</div>
|
|
392
|
-
<div className="overflow-hidden pl-2">
|
|
393
|
-
<div className="truncate text-sm">{emoji?.name}</div>
|
|
394
|
-
<div className="truncate text-xs">{`:${emoji?.id}:`}</div>
|
|
395
|
-
</div>
|
|
396
|
-
</div>
|
|
397
|
-
);
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
function NoEmoji({ i18n }: Pick<UseEmojiPickerType, 'i18n'>) {
|
|
401
|
-
return (
|
|
402
|
-
<div className="flex h-20 items-center border-muted border-t p-2">
|
|
403
|
-
<div className="flex items-center justify-center text-2xl">😢</div>
|
|
404
|
-
<div className="overflow-hidden pl-2">
|
|
405
|
-
<div className="truncate font-semibold text-primary text-sm">
|
|
406
|
-
{i18n.searchNoResultsTitle}
|
|
407
|
-
</div>
|
|
408
|
-
<div className="truncate text-xs">{i18n.searchNoResultsSubtitle}</div>
|
|
409
|
-
</div>
|
|
410
|
-
</div>
|
|
411
|
-
);
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
function PickAnEmoji({ i18n }: Pick<UseEmojiPickerType, 'i18n'>) {
|
|
415
|
-
return (
|
|
416
|
-
<div className="flex h-20 items-center border-muted border-t p-2">
|
|
417
|
-
<div className="flex items-center justify-center text-2xl">☝️</div>
|
|
418
|
-
<div className="overflow-hidden pl-2">
|
|
419
|
-
<div className="truncate font-semibold text-sm">{i18n.pick}</div>
|
|
420
|
-
</div>
|
|
421
|
-
</div>
|
|
422
|
-
);
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
function EmojiPickerPreview({
|
|
426
|
-
emoji,
|
|
427
|
-
hasFound = true,
|
|
428
|
-
i18n,
|
|
429
|
-
isSearching = false,
|
|
430
|
-
...props
|
|
431
|
-
}: Pick<UseEmojiPickerType, 'emoji' | 'hasFound' | 'i18n' | 'isSearching'>) {
|
|
432
|
-
const showPickEmoji = !emoji && !(isSearching && !hasFound);
|
|
433
|
-
const showNoEmoji = isSearching && !hasFound;
|
|
434
|
-
const showPreview = emoji;
|
|
435
|
-
|
|
436
|
-
return (
|
|
437
|
-
<>
|
|
438
|
-
{showPreview && <EmojiPreview emoji={emoji} {...props} />}
|
|
439
|
-
{showPickEmoji && <PickAnEmoji i18n={i18n} {...props} />}
|
|
440
|
-
{showNoEmoji && <NoEmoji i18n={i18n} {...props} />}
|
|
441
|
-
</>
|
|
442
|
-
);
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
const getBarProperty = (
|
|
446
|
-
emojiLibrary: IEmojiFloatingLibrary,
|
|
447
|
-
focusedCategory?: EmojiCategoryList
|
|
448
|
-
) => {
|
|
449
|
-
let width = 0;
|
|
450
|
-
let position = 0;
|
|
451
|
-
|
|
452
|
-
if (focusedCategory) {
|
|
453
|
-
width = 100 / emojiLibrary.getGrid().size;
|
|
454
|
-
position = focusedCategory ? emojiLibrary.indexOf(focusedCategory) * 100 : 0;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
return { position, width };
|
|
458
|
-
};
|
|
459
|
-
|
|
460
|
-
function EmojiPickerNavigation({
|
|
461
|
-
emojiLibrary,
|
|
462
|
-
focusedCategory,
|
|
463
|
-
i18n,
|
|
464
|
-
icons,
|
|
465
|
-
onClick
|
|
466
|
-
}: {
|
|
467
|
-
onClick: (id: EmojiCategoryList) => void;
|
|
468
|
-
} & Pick<
|
|
469
|
-
UseEmojiPickerType,
|
|
470
|
-
'emojiLibrary' | 'focusedCategory' | 'i18n' | 'icons'
|
|
471
|
-
>) {
|
|
472
|
-
const { position, width } = getBarProperty(emojiLibrary, focusedCategory);
|
|
473
|
-
|
|
474
|
-
return (
|
|
475
|
-
<nav
|
|
476
|
-
className="mb-2.5 border-0 border-b border-b-border border-solid p-3"
|
|
477
|
-
id="emoji-nav">
|
|
478
|
-
<div className="relative flex items-center">
|
|
479
|
-
{emojiLibrary
|
|
480
|
-
.getGrid()
|
|
481
|
-
.sections()
|
|
482
|
-
.map(({ id }) => (
|
|
483
|
-
<Button
|
|
484
|
-
aria-label={i18n.categories[id]}
|
|
485
|
-
className={cn(
|
|
486
|
-
'size-6 grow fill-current text-muted-foreground hover:bg-transparent hover:text-foreground',
|
|
487
|
-
id === focusedCategory
|
|
488
|
-
&& 'pointer-events-none fill-current text-primary'
|
|
489
|
-
)}
|
|
490
|
-
key={id}
|
|
491
|
-
onClick={() => onClick(id)}
|
|
492
|
-
size="icon"
|
|
493
|
-
title={i18n.categories[id]}
|
|
494
|
-
type="button"
|
|
495
|
-
variant="ghost">
|
|
496
|
-
<span className="size-5">{icons.categories[id].outline}</span>
|
|
497
|
-
</Button>
|
|
498
|
-
))}
|
|
499
|
-
<div
|
|
500
|
-
className="-bottom-3 absolute left-0 h-0.5 w-full rounded-t-lg bg-primary opacity-100 transition-transform duration-200"
|
|
501
|
-
style={{
|
|
502
|
-
transform: `translateX(${position}%)`,
|
|
503
|
-
visibility: `${focusedCategory ? 'visible' : 'hidden'}`,
|
|
504
|
-
width: `${width}%`
|
|
505
|
-
}} />
|
|
506
|
-
</div>
|
|
507
|
-
</nav>
|
|
508
|
-
);
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
export const emojiCategoryIcons: Record<
|
|
512
|
-
EmojiCategoryList,
|
|
513
|
-
{ outline: ReactElement; solid: ReactElement }
|
|
514
|
-
> = {
|
|
515
|
-
activity: {
|
|
516
|
-
outline: (
|
|
517
|
-
<svg
|
|
518
|
-
className="size-full"
|
|
519
|
-
fill="none"
|
|
520
|
-
stroke="currentColor"
|
|
521
|
-
strokeLinecap="round"
|
|
522
|
-
strokeLinejoin="round"
|
|
523
|
-
strokeWidth="2"
|
|
524
|
-
viewBox="0 0 24 24"
|
|
525
|
-
xmlns="http://www.w3.org/2000/svg">
|
|
526
|
-
<circle cx="12" cy="12" r="10" />
|
|
527
|
-
<path d="M2.1 13.4A10.1 10.1 0 0 0 13.4 2.1" />
|
|
528
|
-
<path d="m5 4.9 14 14.2" />
|
|
529
|
-
<path d="M21.9 10.6a10.1 10.1 0 0 0-11.3 11.3" />
|
|
530
|
-
</svg>
|
|
531
|
-
),
|
|
532
|
-
solid: (
|
|
533
|
-
<svg
|
|
534
|
-
className="size-full"
|
|
535
|
-
fill="none"
|
|
536
|
-
stroke="currentColor"
|
|
537
|
-
strokeLinecap="round"
|
|
538
|
-
strokeLinejoin="round"
|
|
539
|
-
strokeWidth="2"
|
|
540
|
-
viewBox="0 0 24 24"
|
|
541
|
-
xmlns="http://www.w3.org/2000/svg">
|
|
542
|
-
<circle cx="12" cy="12" r="10" />
|
|
543
|
-
<path d="M2.1 13.4A10.1 10.1 0 0 0 13.4 2.1" />
|
|
544
|
-
<path d="m5 4.9 14 14.2" />
|
|
545
|
-
<path d="M21.9 10.6a10.1 10.1 0 0 0-11.3 11.3" />
|
|
546
|
-
</svg>
|
|
547
|
-
)
|
|
548
|
-
},
|
|
549
|
-
|
|
550
|
-
custom: {
|
|
551
|
-
outline: <StarIcon className="size-full" />,
|
|
552
|
-
solid: <StarIcon className="size-full" />
|
|
553
|
-
},
|
|
554
|
-
|
|
555
|
-
flags: {
|
|
556
|
-
outline: <FlagIcon className="size-full" />,
|
|
557
|
-
solid: <FlagIcon className="size-full" />
|
|
558
|
-
},
|
|
559
|
-
|
|
560
|
-
foods: {
|
|
561
|
-
outline: <AppleIcon className="size-full" />,
|
|
562
|
-
solid: <AppleIcon className="size-full" />
|
|
563
|
-
},
|
|
564
|
-
|
|
565
|
-
frequent: {
|
|
566
|
-
outline: <ClockIcon className="size-full" />,
|
|
567
|
-
solid: <ClockIcon className="size-full" />
|
|
568
|
-
},
|
|
569
|
-
|
|
570
|
-
nature: {
|
|
571
|
-
outline: <LeafIcon className="size-full" />,
|
|
572
|
-
solid: <LeafIcon className="size-full" />
|
|
573
|
-
},
|
|
574
|
-
|
|
575
|
-
objects: {
|
|
576
|
-
outline: <LightbulbIcon className="size-full" />,
|
|
577
|
-
solid: <LightbulbIcon className="size-full" />
|
|
578
|
-
},
|
|
579
|
-
|
|
580
|
-
people: {
|
|
581
|
-
outline: <SmileIcon className="size-full" />,
|
|
582
|
-
solid: <SmileIcon className="size-full" />
|
|
583
|
-
},
|
|
584
|
-
|
|
585
|
-
places: {
|
|
586
|
-
outline: <CompassIcon className="size-full" />,
|
|
587
|
-
solid: <CompassIcon className="size-full" />
|
|
588
|
-
},
|
|
589
|
-
|
|
590
|
-
symbols: {
|
|
591
|
-
outline: <MusicIcon className="size-full" />,
|
|
592
|
-
solid: <MusicIcon className="size-full" />
|
|
593
|
-
}
|
|
594
|
-
};
|
|
595
|
-
|
|
596
|
-
const emojiSearchIcons = {
|
|
597
|
-
delete: <XIcon className="size-4 text-current" />,
|
|
598
|
-
loupe: <SearchIcon className="size-4 text-current" />
|
|
599
|
-
};
|
|
600
|
-
|
|
601
|
-
export function EmojiToolbarButton({
|
|
602
|
-
options,
|
|
603
|
-
...props
|
|
604
|
-
}: {
|
|
605
|
-
options?: any;
|
|
606
|
-
} & ComponentPropsWithoutRef<typeof ToolbarButton>) {
|
|
607
|
-
const { emojiPickerState, isOpen, setIsOpen }
|
|
608
|
-
= useEmojiDropdownMenuState(options);
|
|
609
|
-
|
|
610
|
-
return (
|
|
611
|
-
<EmojiPopover
|
|
612
|
-
control={
|
|
613
|
-
<ToolbarButton pressed={isOpen} tooltip="Emoji" isDropdown {...props}>
|
|
614
|
-
<SmileIcon />
|
|
615
|
-
</ToolbarButton>
|
|
616
|
-
}
|
|
617
|
-
isOpen={isOpen}
|
|
618
|
-
setIsOpen={setIsOpen}>
|
|
619
|
-
<EmojiPicker
|
|
620
|
-
{...emojiPickerState}
|
|
621
|
-
isOpen={isOpen}
|
|
622
|
-
setIsOpen={setIsOpen}
|
|
623
|
-
settings={options?.settings} />
|
|
624
|
-
</EmojiPopover>
|
|
625
|
-
);
|
|
626
|
-
}
|