@collabchron/notiq 0.2.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.
Files changed (188) hide show
  1. package/README.md +71 -0
  2. package/components.json +21 -0
  3. package/eslint.config.mjs +16 -0
  4. package/next.config.ts +12 -0
  5. package/package.json +108 -0
  6. package/postcss.config.mjs +5 -0
  7. package/public/file.svg +1 -0
  8. package/public/globe.svg +1 -0
  9. package/public/images/icons/plus.svg +10 -0
  10. package/public/next.svg +1 -0
  11. package/public/vercel.svg +1 -0
  12. package/public/window.svg +1 -0
  13. package/src/app/actions.ts +2 -0
  14. package/src/app/api/ai/route.ts +175 -0
  15. package/src/app/api/edgestore/[...edgestore]/route.ts +28 -0
  16. package/src/app/favicon.ico +0 -0
  17. package/src/app/globals.css +205 -0
  18. package/src/app/layout.tsx +38 -0
  19. package/src/app/page.tsx +12 -0
  20. package/src/components/editor/Core.tsx +220 -0
  21. package/src/components/editor/hooks/instructions-messages.ts +300 -0
  22. package/src/components/editor/hooks/use-mobile.ts +19 -0
  23. package/src/components/editor/hooks/useReport.ts +67 -0
  24. package/src/components/editor/hooks/useResizeObservert.ts +22 -0
  25. package/src/components/editor/index.tsx +39 -0
  26. package/src/components/editor/lexical-on-change.tsx +28 -0
  27. package/src/components/editor/nodes/CollapsibleNode/CollapsibleContainerNode.ts +92 -0
  28. package/src/components/editor/nodes/CollapsibleNode/CollapsibleContentNode.ts +65 -0
  29. package/src/components/editor/nodes/CollapsibleNode/CollapsibleTitleNode.ts +105 -0
  30. package/src/components/editor/nodes/EquationNode/EquationComponent.tsx +143 -0
  31. package/src/components/editor/nodes/EquationNode/EquationNode.tsx +170 -0
  32. package/src/components/editor/nodes/ExcalidrawNode/ExcalidrawComponent.tsx +228 -0
  33. package/src/components/editor/nodes/ExcalidrawNode/ExcalidrawImage.tsx +137 -0
  34. package/src/components/editor/nodes/ExcalidrawNode/ImageResizer.tsx +317 -0
  35. package/src/components/editor/nodes/ExcalidrawNode/index.tsx +204 -0
  36. package/src/components/editor/nodes/FigmaNode/FigmaNode.tsx +134 -0
  37. package/src/components/editor/nodes/Hint/HintComponet.tsx +221 -0
  38. package/src/components/editor/nodes/Hint/index.tsx +190 -0
  39. package/src/components/editor/nodes/ImageNode/index.tsx +328 -0
  40. package/src/components/editor/nodes/InlineImageNode/InlineImageComponent.tsx +383 -0
  41. package/src/components/editor/nodes/InlineImageNode/InlineImageNode.css +94 -0
  42. package/src/components/editor/nodes/InlineImageNode/InlineImageNode.tsx +309 -0
  43. package/src/components/editor/nodes/LayoutNode/LayoutContainerNode.ts +146 -0
  44. package/src/components/editor/nodes/LayoutNode/LayoutItemNode.ts +79 -0
  45. package/src/components/editor/nodes/PollNode/index.tsx +204 -0
  46. package/src/components/editor/nodes/Stepper/index.tsx +260 -0
  47. package/src/components/editor/nodes/TweetNode/index.tsx +214 -0
  48. package/src/components/editor/nodes/index.ts +81 -0
  49. package/src/components/editor/plugins/AutoEmbedPlugin/index.tsx +350 -0
  50. package/src/components/editor/plugins/AutoLinkPlugin/index.tsx +56 -0
  51. package/src/components/editor/plugins/CodeActionMenuPlugin/components/CopyButton.tsx +70 -0
  52. package/src/components/editor/plugins/CodeActionMenuPlugin/components/PrettierButton.tsx +192 -0
  53. package/src/components/editor/plugins/CodeActionMenuPlugin/index.tsx +217 -0
  54. package/src/components/editor/plugins/CodeActionMenuPlugin/utils.ts +26 -0
  55. package/src/components/editor/plugins/CodeHighlightPlugin/index.ts +21 -0
  56. package/src/components/editor/plugins/CollapsiblePlugin/Collapsible.css +76 -0
  57. package/src/components/editor/plugins/CollapsiblePlugin/index.ts +228 -0
  58. package/src/components/editor/plugins/DragDropPastePlugin/index.tsx +44 -0
  59. package/src/components/editor/plugins/DraggableBlockPlugin/index.tsx +52 -0
  60. package/src/components/editor/plugins/EquationsPlugin/index.tsx +85 -0
  61. package/src/components/editor/plugins/ExcalidrawPlugin/index.tsx +98 -0
  62. package/src/components/editor/plugins/FigmaPlugin/index.tsx +42 -0
  63. package/src/components/editor/plugins/FloatingLinkEditorPlugin/index.tsx +445 -0
  64. package/src/components/editor/plugins/FloatingTextFormatToolbarPlugin/index.tsx +275 -0
  65. package/src/components/editor/plugins/ImagesPlugin/index.tsx +222 -0
  66. package/src/components/editor/plugins/InlineImagePlugin/index.tsx +351 -0
  67. package/src/components/editor/plugins/LayoutPlugin/index.tsx +238 -0
  68. package/src/components/editor/plugins/LinkPlugin/index.tsx +36 -0
  69. package/src/components/editor/plugins/LinkWithMetaData/index.tsx +271 -0
  70. package/src/components/editor/plugins/MarkdownShortcutPlugin/index.tsx +11 -0
  71. package/src/components/editor/plugins/MarkdownTransformers/index.tsx +304 -0
  72. package/src/components/editor/plugins/PollPlugin/index.tsx +49 -0
  73. package/src/components/editor/plugins/ShortcutsPlugin/index.tsx +180 -0
  74. package/src/components/editor/plugins/ShortcutsPlugin/shortcuts.ts +253 -0
  75. package/src/components/editor/plugins/SlashCommand/index.tsx +621 -0
  76. package/src/components/editor/plugins/SpeechToTextPlugin/index.ts +127 -0
  77. package/src/components/editor/plugins/TabFocusPlugin/index.ts +58 -0
  78. package/src/components/editor/plugins/TableCellActionMenuPlugin/index.tsx +759 -0
  79. package/src/components/editor/plugins/TableCellResizer/index.tsx +438 -0
  80. package/src/components/editor/plugins/TableHoverActionsPlugin/index.tsx +314 -0
  81. package/src/components/editor/plugins/TablePlugin/index.tsx +99 -0
  82. package/src/components/editor/plugins/ToolbarPlugin/index.tsx +522 -0
  83. package/src/components/editor/plugins/TwitterPlugin/index.ts +35 -0
  84. package/src/components/editor/plugins/YouTubeNode/index.tsx +179 -0
  85. package/src/components/editor/plugins/YouTubePlugin/index.ts +41 -0
  86. package/src/components/editor/themes/editor-theme.ts +113 -0
  87. package/src/components/editor/themes/theme.css +377 -0
  88. package/src/components/editor/utils/ai.ts +291 -0
  89. package/src/components/editor/utils/canUseDOM.ts +12 -0
  90. package/src/components/editor/utils/editorFormatting.ts +282 -0
  91. package/src/components/editor/utils/environment.ts +50 -0
  92. package/src/components/editor/utils/extract-data.ts +166 -0
  93. package/src/components/editor/utils/getAllLexicalChildren.ts +13 -0
  94. package/src/components/editor/utils/getDOMRangeRect.ts +27 -0
  95. package/src/components/editor/utils/getSelectedNode.ts +27 -0
  96. package/src/components/editor/utils/gif.ts +29 -0
  97. package/src/components/editor/utils/invariant.ts +15 -0
  98. package/src/components/editor/utils/setFloatingElemPosition.ts +51 -0
  99. package/src/components/editor/utils/setFloatingElemPositionForLinkEditor.ts +40 -0
  100. package/src/components/editor/utils/setNodePlaceholderFromSelection/getNodePlaceholder.ts +51 -0
  101. package/src/components/editor/utils/setNodePlaceholderFromSelection/setNodePlaceholderFromSelection.ts +15 -0
  102. package/src/components/editor/utils/setNodePlaceholderFromSelection/setPlaceholderOnSelection.ts +114 -0
  103. package/src/components/editor/utils/setNodePlaceholderFromSelection/styles.css +6 -0
  104. package/src/components/editor/utils/url.ts +109 -0
  105. package/src/components/editor/utils/useLayoutEffect.ts +13 -0
  106. package/src/components/providers/QueryProvider.tsx +15 -0
  107. package/src/components/providers/SharedHistoryContext.tsx +28 -0
  108. package/src/components/providers/ToolbarContext.tsx +123 -0
  109. package/src/components/providers/theme-provider.tsx +11 -0
  110. package/src/components/theme/ModeToggle.tsx +40 -0
  111. package/src/components/ui/FileInput.tsx +40 -0
  112. package/src/components/ui/Input.css +32 -0
  113. package/src/components/ui/Select.css +42 -0
  114. package/src/components/ui/Select.tsx +36 -0
  115. package/src/components/ui/TextInput.tsx +48 -0
  116. package/src/components/ui/ai/ai-button.tsx +574 -0
  117. package/src/components/ui/ai/border.tsx +99 -0
  118. package/src/components/ui/ai/placeholder-input-vanish.tsx +282 -0
  119. package/src/components/ui/button.tsx +89 -0
  120. package/src/components/ui/card.tsx +76 -0
  121. package/src/components/ui/checkbox.tsx +30 -0
  122. package/src/components/ui/command.tsx +153 -0
  123. package/src/components/ui/dialog/Dialog.css +25 -0
  124. package/src/components/ui/dialog/Dialog.tsx +34 -0
  125. package/src/components/ui/dialog.tsx +122 -0
  126. package/src/components/ui/drop-downs/background-color.tsx +183 -0
  127. package/src/components/ui/drop-downs/block-format.tsx +159 -0
  128. package/src/components/ui/drop-downs/code.tsx +42 -0
  129. package/src/components/ui/drop-downs/color.tsx +177 -0
  130. package/src/components/ui/drop-downs/font-size.tsx +138 -0
  131. package/src/components/ui/drop-downs/font.tsx +155 -0
  132. package/src/components/ui/drop-downs/index.tsx +122 -0
  133. package/src/components/ui/drop-downs/insert-node.tsx +213 -0
  134. package/src/components/ui/drop-downs/text-align.tsx +123 -0
  135. package/src/components/ui/drop-downs/text-format.tsx +104 -0
  136. package/src/components/ui/dropdown-menu.tsx +201 -0
  137. package/src/components/ui/equation/EquationEditor.css +38 -0
  138. package/src/components/ui/equation/EquationEditor.tsx +56 -0
  139. package/src/components/ui/equation/KatexEquationAlterer.css +41 -0
  140. package/src/components/ui/equation/KatexEquationAlterer.tsx +83 -0
  141. package/src/components/ui/equation/KatexRenderer.tsx +66 -0
  142. package/src/components/ui/excalidraw/ExcalidrawModal.css +64 -0
  143. package/src/components/ui/excalidraw/ExcalidrawModal.tsx +234 -0
  144. package/src/components/ui/excalidraw/Modal.css +62 -0
  145. package/src/components/ui/excalidraw/Modal.tsx +110 -0
  146. package/src/components/ui/hover-card.tsx +29 -0
  147. package/src/components/ui/image/error-image.tsx +17 -0
  148. package/src/components/ui/image/file-upload.tsx +240 -0
  149. package/src/components/ui/image/image-resizer.tsx +297 -0
  150. package/src/components/ui/image/image-toolbar.tsx +264 -0
  151. package/src/components/ui/image/index.tsx +408 -0
  152. package/src/components/ui/image/lazy-image.tsx +68 -0
  153. package/src/components/ui/image/lazy-video.tsx +71 -0
  154. package/src/components/ui/input.tsx +22 -0
  155. package/src/components/ui/models/custom-dialog.tsx +320 -0
  156. package/src/components/ui/models/insert-gif.tsx +90 -0
  157. package/src/components/ui/models/insert-image.tsx +52 -0
  158. package/src/components/ui/models/insert-poll.tsx +29 -0
  159. package/src/components/ui/models/insert-table.tsx +62 -0
  160. package/src/components/ui/models/use-model.tsx +91 -0
  161. package/src/components/ui/poll/poll-component.tsx +304 -0
  162. package/src/components/ui/popover.tsx +33 -0
  163. package/src/components/ui/progress.tsx +28 -0
  164. package/src/components/ui/scroll-area.tsx +48 -0
  165. package/src/components/ui/separator.tsx +31 -0
  166. package/src/components/ui/skeleton.tsx +15 -0
  167. package/src/components/ui/sonner.tsx +31 -0
  168. package/src/components/ui/stepper/step.tsx +179 -0
  169. package/src/components/ui/stepper/stepper.tsx +89 -0
  170. package/src/components/ui/textarea.tsx +22 -0
  171. package/src/components/ui/toggle.tsx +71 -0
  172. package/src/components/ui/tooltip.tsx +32 -0
  173. package/src/components/ui/write/text-format-floting-toolbar.tsx +346 -0
  174. package/src/lib/edgestore.ts +9 -0
  175. package/src/lib/pinecone-client.ts +0 -0
  176. package/src/lib/utils.ts +6 -0
  177. package/src/utils/docSerialization.ts +77 -0
  178. package/src/utils/emoji-list.ts +16615 -0
  179. package/src/utils/getDOMRangeRect.ts +27 -0
  180. package/src/utils/getSelectedNode.ts +27 -0
  181. package/src/utils/getThemeSelector.ts +25 -0
  182. package/src/utils/isMobileWidth.ts +7 -0
  183. package/src/utils/joinClasses.ts +13 -0
  184. package/src/utils/setFloatingElemPosition.ts +74 -0
  185. package/src/utils/setFloatingElemPositionForLinkEditor.ts +46 -0
  186. package/src/utils/swipe.ts +127 -0
  187. package/src/utils/url.ts +38 -0
  188. package/tsconfig.json +27 -0
@@ -0,0 +1,179 @@
1
+ import React, { useCallback, useEffect, useRef, useState } from "react";
2
+ import { LexicalNestedComposer } from "@lexical/react/LexicalNestedComposer";
3
+ import { ContentEditable } from "@lexical/react/LexicalContentEditable";
4
+ import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin";
5
+ import { LexicalErrorBoundary } from "@lexical/react/LexicalErrorBoundary";
6
+ import ImagesPlugin from "../../editor/plugins/ImagesPlugin";
7
+ import { Plus } from "lucide-react";
8
+ import { Reorder } from "framer-motion";
9
+ import { StepType } from "../../editor/nodes/Stepper";
10
+ import { AutoFocusPlugin } from "@lexical/react/LexicalAutoFocusPlugin";
11
+ import { LinkPlugin } from "@lexical/react/LexicalLinkPlugin";
12
+ import { useSharedHistoryContext } from "@/components/providers/SharedHistoryContext";
13
+ import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
14
+ import { nestedNodes } from "../../editor/nodes";
15
+ import { HorizontalRulePlugin } from "@lexical/react/LexicalHorizontalRulePlugin";
16
+ import LexicalAutoLinkPlugin from "../../editor/plugins/AutoLinkPlugin";
17
+ import { LinkWithMetaDataPlugin } from "../../editor/plugins/LinkWithMetaData";
18
+ import { ListPlugin } from "@lexical/react/LexicalListPlugin";
19
+ import { CheckListPlugin } from "@lexical/react/LexicalCheckListPlugin";
20
+ import { TabIndentationPlugin } from "@lexical/react/LexicalTabIndentationPlugin";
21
+ import CodeHighlightPlugin from "../../editor/plugins/CodeHighlightPlugin";
22
+ import { mergeRegister } from "@lexical/utils";
23
+ import {
24
+ COMMAND_PRIORITY_LOW,
25
+ LexicalEditor,
26
+ SELECTION_CHANGE_COMMAND,
27
+ } from "lexical";
28
+ import FloatingTextFormatToolbarPlugin from "../../editor/plugins/FloatingTextFormatToolbarPlugin";
29
+ import SlashCommand from "../../editor/plugins/SlashCommand";
30
+ import CodeActionMenuPlugin from "../../editor/plugins/CodeActionMenuPlugin";
31
+ import FloatingLinkEditorPlugin from "../../editor/plugins/FloatingLinkEditorPlugin";
32
+
33
+ interface Props {
34
+ item: StepType;
35
+ numberd: number;
36
+ insertAt: (index: number) => void;
37
+ remove: (numberd: number) => void;
38
+ updateTitle: (index: number, title: string) => void;
39
+ }
40
+
41
+ export default function Step({
42
+ item,
43
+ numberd,
44
+ insertAt,
45
+ remove,
46
+ updateTitle,
47
+ }: Props) {
48
+
49
+ const titleRef = React.useRef<HTMLDivElement>(null);
50
+ const [isLinkEditMode, setIsLinkEditMode] = React.useState<boolean>(false);
51
+ const [floatingAnchorElem, setFloatingAnchorElem] =
52
+ useState<HTMLDivElement | null>(null);
53
+ const { historyState } = useSharedHistoryContext();
54
+ const activeEditorRef = useRef<LexicalEditor | null>(null);
55
+
56
+ const handleTitleBlur = () => {
57
+ if (titleRef.current) {
58
+ updateTitle(item.id, titleRef.current.textContent!)
59
+ }
60
+ };
61
+
62
+ // fix the delete
63
+ const handleTitleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {
64
+ if (e.key === "Backspace") {
65
+ const currentText = titleRef.current?.textContent || "";
66
+ if (currentText === "") {
67
+ e.preventDefault();
68
+ remove(item.id);
69
+ }
70
+ }
71
+ };
72
+
73
+ const onRef = useCallback((_floatingAnchorElem: HTMLDivElement | null) => {
74
+ setFloatingAnchorElem(_floatingAnchorElem);
75
+ }, []);
76
+
77
+
78
+ useEffect(() => {
79
+ const unregister = mergeRegister(
80
+ item.content.registerCommand(
81
+ SELECTION_CHANGE_COMMAND,
82
+ (_, activeEditor) => {
83
+ activeEditorRef.current = activeEditor;
84
+ return false;
85
+ },
86
+ COMMAND_PRIORITY_LOW
87
+ )
88
+ );
89
+ return () => {
90
+ unregister();
91
+ };
92
+ }, []);
93
+
94
+ return (
95
+ <Reorder.Item
96
+ value={item}
97
+ id={item.id.toString()}
98
+ initial={{ opacity: 0, y: 30 }}
99
+ animate={{ opacity: 1, y: 0, transition: { duration: 0.15 } }}
100
+ exit={{ opacity: 0, y: 20, transition: { duration: 0.3 } }}
101
+ className="relative group my-2 flex w-full flex-row gap-x-6 select-none"
102
+ >
103
+ <div
104
+
105
+ className="h-7 w-7 absolute max-sm:w-5 max-sm:h-5 max-sm:text-xs rounded-full z-50 bg-muted cursor-grab flex items-center justify-center">
106
+ {numberd + 1}
107
+ </div>
108
+
109
+ <div className="flex flex-col ml-10 w-full">
110
+ <div
111
+ contentEditable
112
+ suppressContentEditableWarning
113
+ ref={titleRef}
114
+ onBlur={handleTitleBlur}
115
+ onKeyDown={handleTitleKeyDown}
116
+ className="scroll-m-20 border-none outline-none cursor-text break-words max-sm:text-lg text-2xl font-semibold tracking-tight"
117
+ >
118
+ {item.title}
119
+ </div>
120
+ <LexicalNestedComposer
121
+ initialEditor={item.content}
122
+ initialNodes={[...nestedNodes]}
123
+ >
124
+ <HistoryPlugin externalHistoryState={historyState} />
125
+ <AutoFocusPlugin />
126
+ <LinkPlugin />
127
+ <ImagesPlugin />
128
+ <HorizontalRulePlugin />
129
+ <LexicalAutoLinkPlugin />
130
+ <LinkWithMetaDataPlugin />
131
+ <ListPlugin />
132
+ <CheckListPlugin />
133
+ <LinkWithMetaDataPlugin />
134
+ <TabIndentationPlugin maxIndent={7} />
135
+ <CodeHighlightPlugin />
136
+ <LinkPlugin />
137
+ <RichTextPlugin
138
+ contentEditable={
139
+ <div ref={onRef} className="relative">
140
+ <ContentEditable
141
+ className="h-fit w-full resize-none cursor-text relative outline-none select-text whitespace-pre-wrap break-words"
142
+ aria-placeholder="Write hint caption"
143
+ placeholder={
144
+ <div className="text-base font-medium text-[#999] overflow-hidden absolute top-[2px] left-[2px] text-nowrap inline-block text-ellipsis pointer-events-none">
145
+ Step content
146
+ </div>
147
+ }
148
+ />
149
+ </div>
150
+ }
151
+ ErrorBoundary={LexicalErrorBoundary}
152
+ />
153
+ {floatingAnchorElem && (
154
+ <>
155
+ <FloatingTextFormatToolbarPlugin
156
+ setIsLinkEditMode={setIsLinkEditMode}
157
+ anchorElem={floatingAnchorElem}
158
+ />
159
+ <CodeActionMenuPlugin anchorElem={floatingAnchorElem} />
160
+ <FloatingLinkEditorPlugin
161
+ anchorElem={floatingAnchorElem}
162
+ isLinkEditMode={isLinkEditMode}
163
+ setIsLinkEditMode={setIsLinkEditMode}
164
+ />
165
+ </>
166
+ )}
167
+ {item.content.isEditable() && <SlashCommand />}
168
+ </LexicalNestedComposer>
169
+ </div>
170
+
171
+ <div
172
+ onClick={() => insertAt(numberd + 1)}
173
+ className="absolute max-sm:left-[2px] left-[4px] top-[35px] z-40 max-sm:w-4 max-sm:h-4 w-[20px] h-[20px] flex items-center justify-center ring-1 ring-gray-700 bg-gray-800 rounded-full cursor-pointer transition-opacity opacity-0 duration-500 group-hover:opacity-100"
174
+ >
175
+ <Plus className="size-[12px]" />
176
+ </div>
177
+ </Reorder.Item>
178
+ );
179
+ }
@@ -0,0 +1,89 @@
1
+ import { Reorder, AnimatePresence } from "framer-motion";
2
+ import Step from "./step";
3
+ import { $isStepperNode, initialEditorState, StepsType } from "../../editor/nodes/Stepper";
4
+ import { $getNodeByKey, createEditor, NodeKey } from "lexical";
5
+ import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
6
+
7
+ export default function Stepper({
8
+ steps,
9
+ nodeKey,
10
+ }: {
11
+ steps: StepsType,
12
+ nodeKey: NodeKey,
13
+ }) {
14
+ const [editor] = useLexicalComposerContext();
15
+
16
+
17
+
18
+ function SetSteps(steps:StepsType){
19
+ editor.update(() => {
20
+ const node = $getNodeByKey(nodeKey);
21
+ if ($isStepperNode(node)) {
22
+ node.replaceSteps(steps);
23
+ }
24
+ });
25
+ }
26
+
27
+ const remove = (index: number) => {
28
+ editor.update(() => {
29
+ const node = $getNodeByKey(nodeKey);
30
+ if ($isStepperNode(node)) {
31
+ node.deleteStep(index);
32
+ }
33
+ });
34
+ };
35
+
36
+ function updateTitle(id: number, title: string) {
37
+ editor.update(() => {
38
+ const node = $getNodeByKey(nodeKey);
39
+ if ($isStepperNode(node)) {
40
+ node.updateTitle(id, title);
41
+ }
42
+ });
43
+ }
44
+
45
+ const insertAt = (index: number) => {
46
+ editor.update(() => {
47
+ const node = $getNodeByKey(nodeKey);
48
+ if ($isStepperNode(node)) {
49
+ const newId = Date.now();
50
+ const newEditor = createEditor();
51
+ const parsedEditorState = newEditor.parseEditorState(
52
+ JSON.stringify(initialEditorState)
53
+ );
54
+ newEditor.setEditorState(parsedEditorState);
55
+ const newStep = {
56
+ id: newId,
57
+ title: `New step `,
58
+ content: newEditor,
59
+ };
60
+
61
+ node.insertStepAtIndex(newStep, index);
62
+ }
63
+ });
64
+ };
65
+
66
+
67
+ return (
68
+ <Reorder.Group
69
+ axis="y"
70
+ values={steps}
71
+ onReorder={SetSteps}
72
+ className="h-fit my-2 min-h-[90px] w-full overflow-hidden flex flex-col relative"
73
+ >
74
+ <AnimatePresence initial={false}>
75
+ {steps.map((item, index) => (
76
+ <Step
77
+ updateTitle={updateTitle}
78
+ remove={remove}
79
+ insertAt={insertAt}
80
+ key={item.id}
81
+ numberd={index}
82
+ item={item}
83
+ />
84
+ ))}
85
+ </AnimatePresence>
86
+ <div className="absolute w-0.5 max-sm:left-2 left-[13px] rounded-sm -z-1 bg-input top-4 h-full" />
87
+ </Reorder.Group>
88
+ );
89
+ }
@@ -0,0 +1,22 @@
1
+ import * as React from "react"
2
+
3
+ import { cn } from "@/lib/utils"
4
+
5
+ const Textarea = React.forwardRef<
6
+ HTMLTextAreaElement,
7
+ React.ComponentProps<"textarea">
8
+ >(({ className, ...props }, ref) => {
9
+ return (
10
+ <textarea
11
+ className={cn(
12
+ "flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
13
+ className
14
+ )}
15
+ ref={ref}
16
+ {...props}
17
+ />
18
+ )
19
+ })
20
+ Textarea.displayName = "Textarea"
21
+
22
+ export { Textarea }
@@ -0,0 +1,71 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import * as TogglePrimitive from "@radix-ui/react-toggle";
5
+ import { cva, type VariantProps } from "class-variance-authority";
6
+ import { cn } from "@/lib/utils";
7
+ import {
8
+ Tooltip,
9
+ TooltipContent,
10
+ TooltipProvider,
11
+ TooltipTrigger,
12
+ } from "@/components/ui/tooltip";
13
+
14
+ const toggleVariants = cva(
15
+ "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors hover:bg-zinc-100 hover:text-zinc-500 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-zinc-950 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-zinc-100 data-[state=on]:text-zinc-900 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 dark:hover:bg-zinc-800 dark:hover:text-zinc-400 dark:focus-visible:ring-zinc-300 dark:data-[state=on]:bg-zinc-800 dark:data-[state=on]:text-zinc-50",
16
+ {
17
+ variants: {
18
+ variant: {
19
+ default: "bg-transparent",
20
+ outline:
21
+ "border-none cursor-pointer bg-transparent shadow-sm",
22
+ },
23
+ size: {
24
+ default: "h-9 px-2 min-w-9",
25
+ sm: "h-7 rounded-md px-[6px] ",
26
+ lg: "h-10 px-2.5 min-w-10",
27
+ Toolbar:"h-7 w-7 p-3",
28
+ floting:" h-5 w-5 p-3"
29
+ },
30
+ },
31
+ defaultVariants: {
32
+ variant: "default",
33
+ size: "default",
34
+ },
35
+ }
36
+ );
37
+
38
+ const Toggle = React.forwardRef<
39
+ React.ElementRef<typeof TogglePrimitive.Root>,
40
+ React.ComponentPropsWithoutRef<typeof TogglePrimitive.Root> &
41
+ VariantProps<typeof toggleVariants>
42
+ >(({ className, variant, tip, size, ...props }, ref) =>
43
+ tip ? (
44
+ <TooltipProvider>
45
+ <Tooltip delayDuration={0.2}>
46
+ <TooltipTrigger asChild>
47
+ <div>
48
+ <TogglePrimitive.Root
49
+ ref={ref}
50
+ className={cn(toggleVariants({ variant, size, className }))}
51
+ {...props}
52
+ />
53
+ </div>
54
+ </TooltipTrigger>
55
+ <TooltipContent side={"top"}>
56
+ <span>{tip}</span>
57
+ </TooltipContent>
58
+ </Tooltip>
59
+ </TooltipProvider>
60
+ ) : (
61
+ <TogglePrimitive.Root
62
+ ref={ref}
63
+ className={cn(toggleVariants({ variant, size, className }))}
64
+ {...props}
65
+ />
66
+ )
67
+ );
68
+
69
+ Toggle.displayName = TogglePrimitive.Root.displayName;
70
+
71
+ export { Toggle, toggleVariants };
@@ -0,0 +1,32 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as TooltipPrimitive from "@radix-ui/react-tooltip"
5
+
6
+ import { cn } from "@/lib/utils"
7
+
8
+ const TooltipProvider = TooltipPrimitive.Provider
9
+
10
+ const Tooltip = TooltipPrimitive.Root
11
+
12
+ const TooltipTrigger = TooltipPrimitive.Trigger
13
+
14
+ const TooltipContent = React.forwardRef<
15
+ React.ElementRef<typeof TooltipPrimitive.Content>,
16
+ React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
17
+ >(({ className, sideOffset = 4, ...props }, ref) => (
18
+ <TooltipPrimitive.Portal>
19
+ <TooltipPrimitive.Content
20
+ ref={ref}
21
+ sideOffset={sideOffset}
22
+ className={cn(
23
+ "z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
24
+ className
25
+ )}
26
+ {...props}
27
+ />
28
+ </TooltipPrimitive.Portal>
29
+ ))
30
+ TooltipContent.displayName = TooltipPrimitive.Content.displayName
31
+
32
+ export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }