ritext 1.0.19 → 1.0.25

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 (133) hide show
  1. package/LICENSE +57 -0
  2. package/README.md +15 -41
  3. package/dist/chunk-EN4BPI7N.mjs +1213 -0
  4. package/dist/chunk-FJQ4FZRS.mjs +98 -0
  5. package/dist/chunk-M4ORWR74.mjs +31 -0
  6. package/dist/chunk-SJFT7WNM.mjs +38 -0
  7. package/dist/chunk-W367UGID.mjs +55 -0
  8. package/dist/{chunk-FWCSY2DS.mjs → chunk-WNQUEZJF.mjs} +22 -1
  9. package/dist/{chunk-D47XME55.mjs → chunk-WXCHG3NQ.mjs} +8 -2
  10. package/dist/chunk-WZKGD3DD.mjs +231 -0
  11. package/dist/extension/backgroundcolor.d.mts +16 -0
  12. package/dist/extension/backgroundcolor.d.ts +16 -0
  13. package/dist/extension/backgroundcolor.js +668 -0
  14. package/dist/extension/backgroundcolor.mjs +107 -0
  15. package/dist/extension/base.d.mts +6 -0
  16. package/dist/extension/base.d.ts +6 -0
  17. package/dist/extension/base.js +65 -0
  18. package/dist/extension/base.mjs +22 -0
  19. package/dist/extension/blockquote.d.mts +10 -0
  20. package/dist/extension/blockquote.d.ts +10 -0
  21. package/dist/extension/blockquote.js +239 -0
  22. package/dist/extension/blockquote.mjs +46 -0
  23. package/dist/extension/bold.d.mts +7 -2
  24. package/dist/extension/bold.d.ts +7 -2
  25. package/dist/extension/bold.js +22 -45
  26. package/dist/extension/bold.mjs +13 -35
  27. package/dist/extension/bulletlist.d.mts +10 -0
  28. package/dist/extension/bulletlist.d.ts +10 -0
  29. package/dist/extension/bulletlist.js +241 -0
  30. package/dist/extension/bulletlist.mjs +46 -0
  31. package/dist/extension/clearformat.d.mts +1 -1
  32. package/dist/extension/clearformat.d.ts +1 -1
  33. package/dist/extension/clearformat.js +11 -6
  34. package/dist/extension/clearformat.mjs +8 -35
  35. package/dist/extension/color.d.mts +17 -0
  36. package/dist/extension/color.d.ts +17 -0
  37. package/dist/extension/color.js +580 -0
  38. package/dist/extension/color.mjs +12 -0
  39. package/dist/extension/emoji.d.mts +15 -0
  40. package/dist/extension/emoji.d.ts +15 -0
  41. package/dist/extension/emoji.js +421 -0
  42. package/dist/extension/emoji.mjs +158 -0
  43. package/dist/extension/font-family.d.mts +8 -11
  44. package/dist/extension/font-family.d.ts +8 -11
  45. package/dist/extension/font-family.js +11 -12
  46. package/dist/extension/font-family.mjs +10 -11
  47. package/dist/extension/font-size.d.mts +8 -11
  48. package/dist/extension/font-size.d.ts +8 -11
  49. package/dist/extension/font-size.js +10 -12
  50. package/dist/extension/font-size.mjs +9 -11
  51. package/dist/extension/heading.d.mts +10 -10
  52. package/dist/extension/heading.d.ts +10 -10
  53. package/dist/extension/heading.js +68 -80
  54. package/dist/extension/heading.mjs +40 -206
  55. package/dist/extension/history.d.mts +4 -2
  56. package/dist/extension/history.d.ts +4 -2
  57. package/dist/extension/history.js +16 -9
  58. package/dist/extension/history.mjs +16 -64
  59. package/dist/extension/horizontalrule.d.mts +10 -0
  60. package/dist/extension/horizontalrule.d.ts +10 -0
  61. package/dist/extension/horizontalrule.js +242 -0
  62. package/dist/extension/horizontalrule.mjs +42 -0
  63. package/dist/extension/image.d.mts +26 -0
  64. package/dist/extension/image.d.ts +26 -0
  65. package/dist/extension/image.js +1611 -0
  66. package/dist/extension/image.mjs +1153 -0
  67. package/dist/extension/indentoutdent.d.mts +21 -0
  68. package/dist/extension/indentoutdent.d.ts +21 -0
  69. package/dist/extension/indentoutdent.js +380 -0
  70. package/dist/extension/indentoutdent.mjs +164 -0
  71. package/dist/extension/italic.d.mts +7 -2
  72. package/dist/extension/italic.d.ts +7 -2
  73. package/dist/extension/italic.js +22 -45
  74. package/dist/extension/italic.mjs +14 -40
  75. package/dist/extension/lineheight.d.mts +15 -0
  76. package/dist/extension/lineheight.d.ts +15 -0
  77. package/dist/extension/lineheight.js +342 -0
  78. package/dist/extension/lineheight.mjs +87 -0
  79. package/dist/extension/link.d.mts +15 -0
  80. package/dist/extension/link.d.ts +15 -0
  81. package/dist/extension/link.js +588 -0
  82. package/dist/extension/link.mjs +278 -0
  83. package/dist/extension/orderedlist.d.mts +10 -0
  84. package/dist/extension/orderedlist.d.ts +10 -0
  85. package/dist/extension/orderedlist.js +241 -0
  86. package/dist/extension/orderedlist.mjs +46 -0
  87. package/dist/extension/strike.d.mts +8 -3
  88. package/dist/extension/strike.d.ts +8 -3
  89. package/dist/extension/strike.js +22 -45
  90. package/dist/extension/strike.mjs +14 -40
  91. package/dist/extension/subandsuperscript.d.mts +7 -10
  92. package/dist/extension/subandsuperscript.d.ts +7 -10
  93. package/dist/extension/subandsuperscript.js +66 -77
  94. package/dist/extension/subandsuperscript.mjs +18 -48
  95. package/dist/extension/subscript.d.mts +4 -2
  96. package/dist/extension/subscript.d.ts +4 -2
  97. package/dist/extension/subscript.js +20 -45
  98. package/dist/extension/subscript.mjs +10 -10
  99. package/dist/extension/superscript.d.mts +4 -2
  100. package/dist/extension/superscript.d.ts +4 -2
  101. package/dist/extension/superscript.js +20 -45
  102. package/dist/extension/superscript.mjs +10 -10
  103. package/dist/extension/table.d.mts +12 -0
  104. package/dist/extension/table.d.ts +12 -0
  105. package/dist/extension/table.js +585 -0
  106. package/dist/extension/table.mjs +324 -0
  107. package/dist/extension/tasklist.d.mts +10 -0
  108. package/dist/extension/tasklist.d.ts +10 -0
  109. package/dist/extension/tasklist.js +246 -0
  110. package/dist/extension/tasklist.mjs +52 -0
  111. package/dist/extension/textalign.d.mts +15 -0
  112. package/dist/extension/textalign.d.ts +15 -0
  113. package/dist/extension/textalign.js +404 -0
  114. package/dist/extension/textalign.mjs +79 -0
  115. package/dist/extension/underline.d.mts +7 -2
  116. package/dist/extension/underline.d.ts +7 -2
  117. package/dist/extension/underline.js +22 -45
  118. package/dist/extension/underline.mjs +14 -39
  119. package/dist/index.css +683 -31
  120. package/dist/index.d.mts +3 -1
  121. package/dist/index.d.ts +3 -1
  122. package/dist/index.js +306 -24
  123. package/dist/index.mjs +141 -13
  124. package/dist/tiptap-ext.type-B3TtT7-J.d.mts +43 -0
  125. package/dist/tiptap-ext.type-B3TtT7-J.d.ts +43 -0
  126. package/package.json +41 -28
  127. package/dist/chunk-2YUUKIIT.mjs +0 -149
  128. package/dist/chunk-7QOFJIQ3.mjs +0 -90
  129. package/dist/chunk-GSHINFPO.mjs +0 -53
  130. package/dist/chunk-LMOTHRGQ.mjs +0 -37
  131. package/dist/chunk-MBF77NHS.mjs +0 -37
  132. package/dist/tiptap-ext.type-DrneAC5G.d.mts +0 -39
  133. package/dist/tiptap-ext.type-DrneAC5G.d.ts +0 -39
@@ -0,0 +1,43 @@
1
+ import { ReactNode, CSSProperties } from 'react';
2
+ import { Placement } from '@floating-ui/react';
3
+ import { Editor } from '@tiptap/react';
4
+
5
+ type ExtButtonBaseOptions = {
6
+ className?: string;
7
+ activeClassName?: string;
8
+ icon?: ReactNode;
9
+ style?: CSSProperties;
10
+ tooltip?: boolean | string;
11
+ tooltipClassName?: string;
12
+ tooltipPlacement?: Placement;
13
+ };
14
+ type ExtDropdownBaseOptions = {
15
+ className?: string;
16
+ showArrow?: boolean;
17
+ content?: ReactNode;
18
+ dropdownClassName?: string;
19
+ itemClassName?: string;
20
+ activeClassName?: string;
21
+ style?: CSSProperties;
22
+ tooltip?: boolean | string;
23
+ tooltipClassName?: string;
24
+ tooltipPlacement?: Placement;
25
+ };
26
+ type ExtButtonComponentArgs<O, Extra extends object = {}> = {
27
+ options: O;
28
+ editor: Editor;
29
+ buttonClassName: string;
30
+ } & Extra;
31
+ type ExtDropdownComponentArgs<O, Extra extends object = {}> = {
32
+ options: O;
33
+ editor: Editor;
34
+ } & Extra;
35
+ type ExtButtonOptions<RootExtra extends object = {}, ComponentExtra extends object = {}, Base extends object = ExtButtonBaseOptions> = Base & RootExtra & {
36
+ component: (args: ExtButtonComponentArgs<Base & RootExtra, ComponentExtra>) => ReactNode;
37
+ };
38
+ type ExtDropdownOptions<RootExtra extends object = {}, ComponentExtra extends object = {}, Base extends object = ExtDropdownBaseOptions> = Base & RootExtra & {
39
+ component: (args: ExtDropdownComponentArgs<Base & RootExtra, ComponentExtra>) => ReactNode;
40
+ };
41
+ type ExtWithoutActiveOptions<RootExtra extends object = {}, ComponentExtra extends object = {}> = ExtButtonOptions<RootExtra, ComponentExtra, Omit<ExtButtonBaseOptions, "activeClassName">>;
42
+
43
+ export type { ExtButtonOptions as E, ExtDropdownOptions as a, ExtWithoutActiveOptions as b };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ritext",
3
- "version": "1.0.19",
3
+ "version": "1.0.25",
4
4
  "description": "Ritext is a modern WYSIWYG rich text editor built with Tailwind CSS, powered by Tiptap. It offers a customizable UI and functional layer that lets you design your own editor controls and toolbars with clean, composable React components—no heavy UI, no extra dependencies beyond Tiptap.",
5
5
  "homepage": "https://ritext.vercel.app/",
6
6
  "main": "dist/index.js",
@@ -25,6 +25,12 @@
25
25
  },
26
26
  "./styles.css": "./dist/index.css"
27
27
  },
28
+ "scripts": {
29
+ "lint": "eslint . --max-warnings 0",
30
+ "check-types": "tsc --noEmit",
31
+ "build": "tsup",
32
+ "dev": "tsup --watch"
33
+ },
28
34
  "author": {
29
35
  "name": "Siam Ahnaf",
30
36
  "email": "mail@siamahnaf.com",
@@ -71,41 +77,48 @@
71
77
  "eslint-plugin-react": "^7.37.5",
72
78
  "eslint-plugin-react-hooks": "^7.0.1",
73
79
  "postcss": "^8.5.6",
74
- "react": "^19.2.3",
75
- "react-dom": "^19.2.3",
80
+ "react": "^19.2.4",
81
+ "react-dom": "^19.2.4",
76
82
  "tailwindcss": "^4.1.18",
77
83
  "tsup": "^8.5.1",
78
84
  "typescript": "^5.9.3",
79
- "typescript-eslint": "^8.50.1"
85
+ "typescript-eslint": "^8.54.0"
80
86
  },
81
87
  "dependencies": {
82
- "@floating-ui/react": "^0.27.16",
83
- "@tiptap/extension-bold": "^3.14.0",
84
- "@tiptap/extension-document": "^3.14.0",
85
- "@tiptap/extension-heading": "^3.14.0",
86
- "@tiptap/extension-italic": "^3.14.0",
87
- "@tiptap/extension-paragraph": "^3.14.0",
88
- "@tiptap/extension-strike": "^3.14.0",
89
- "@tiptap/extension-subscript": "^3.14.0",
90
- "@tiptap/extension-superscript": "^3.14.0",
91
- "@tiptap/extension-text": "^3.14.0",
92
- "@tiptap/extension-text-style": "^3.14.0",
93
- "@tiptap/extension-underline": "^3.14.0",
94
- "@tiptap/extensions": "^3.14.0",
95
- "@tiptap/pm": "^3.14.0",
96
- "@tiptap/react": "^3.14.0",
97
- "@tiptap/starter-kit": "^3.14.0",
98
- "motion": "^12.23.26",
88
+ "@floating-ui/react": "^0.27.17",
89
+ "@siamf/react-color-pick": "^1.5.4",
90
+ "@tiptap/extension-blockquote": "^3.18.0",
91
+ "@tiptap/extension-bold": "^3.18.0",
92
+ "@tiptap/extension-document": "^3.18.0",
93
+ "@tiptap/extension-drag-handle": "^3.18.0",
94
+ "@tiptap/extension-drag-handle-react": "^3.18.0",
95
+ "@tiptap/extension-emoji": "^3.18.0",
96
+ "@tiptap/extension-heading": "^3.18.0",
97
+ "@tiptap/extension-horizontal-rule": "^3.18.0",
98
+ "@tiptap/extension-image": "^3.18.0",
99
+ "@tiptap/extension-italic": "^3.18.0",
100
+ "@tiptap/extension-link": "^3.18.0",
101
+ "@tiptap/extension-list": "^3.18.0",
102
+ "@tiptap/extension-paragraph": "^3.18.0",
103
+ "@tiptap/extension-strike": "^3.18.0",
104
+ "@tiptap/extension-subscript": "^3.18.0",
105
+ "@tiptap/extension-superscript": "^3.18.0",
106
+ "@tiptap/extension-table": "^3.18.0",
107
+ "@tiptap/extension-text": "^3.18.0",
108
+ "@tiptap/extension-text-align": "^3.18.0",
109
+ "@tiptap/extension-text-style": "^3.18.0",
110
+ "@tiptap/extension-underline": "^3.18.0",
111
+ "@tiptap/extensions": "^3.18.0",
112
+ "@tiptap/pm": "^3.18.0",
113
+ "@tiptap/react": "^3.18.0",
114
+ "@tiptap/starter-kit": "^3.18.0",
115
+ "motion": "^12.29.2",
116
+ "prosemirror-view": "1.41.5",
117
+ "react-easy-crop": "^5.5.6",
99
118
  "tailwind-merge": "^3.4.0"
100
119
  },
101
120
  "peerDependencies": {
102
121
  "react": "^19",
103
122
  "react-dom": "^19"
104
- },
105
- "scripts": {
106
- "lint": "eslint . --max-warnings 0",
107
- "check-types": "tsc --noEmit",
108
- "build": "tsup",
109
- "dev": "tsup --watch"
110
123
  }
111
- }
124
+ }
@@ -1,149 +0,0 @@
1
- import {
2
- Tooltip_default
3
- } from "./chunk-7QOFJIQ3.mjs";
4
- import {
5
- useEditor
6
- } from "./chunk-VYDH6BZE.mjs";
7
- import {
8
- __objRest,
9
- __spreadProps,
10
- __spreadValues
11
- } from "./chunk-FWCSY2DS.mjs";
12
-
13
- // src/lib/components/DropdownComponent.tsx
14
- import { useState, Fragment, useId, Children, isValidElement, cloneElement } from "react";
15
- import { twMerge } from "tailwind-merge";
16
- import { useFloating, offset, flip, shift, autoUpdate, useInteractions, useClick, useDismiss, FloatingPortal } from "@floating-ui/react";
17
-
18
- // src/lib/icon/ArrowIcon.tsx
19
- import { jsx } from "react/jsx-runtime";
20
- var ArrowIcon = (_a) => {
21
- var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
22
- return /* @__PURE__ */ jsx(
23
- "svg",
24
- __spreadProps(__spreadValues({
25
- xmlns: "http://www.w3.org/2000/svg",
26
- viewBox: "0 0 48 48",
27
- fill: "none",
28
- stroke: "currentColor",
29
- strokeWidth: 2,
30
- strokeLinecap: "round",
31
- strokeLinejoin: "round",
32
- width: size,
33
- height: size,
34
- className
35
- }, props), {
36
- children: /* @__PURE__ */ jsx("path", { fill: "currentColor", stroke: "currentColor", strokeLinejoin: "round", strokeWidth: "4", d: "M36 19L24 31L12 19z" })
37
- })
38
- );
39
- };
40
- var ArrowIcon_default = ArrowIcon;
41
-
42
- // src/lib/components/DropdownComponent.tsx
43
- import { AnimatePresence, motion } from "motion/react";
44
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
45
- var DropdownComponent = ({ children, className, showArrow = true, content, dropdownClassName, style, tooltip, tooltipClassName, tooltipPlacement, _tooltipContent, _internalContent, _dropdownClassName }) => {
46
- const [open, setOpen] = useState(false);
47
- const { x, y, refs, strategy, context } = useFloating({
48
- open,
49
- onOpenChange: setOpen,
50
- placement: "bottom",
51
- middleware: [offset(4), flip(), shift({ padding: 8 })],
52
- whileElementsMounted: autoUpdate
53
- });
54
- const click = useClick(context);
55
- const dismiss = useDismiss(context);
56
- const { getReferenceProps, getFloatingProps } = useInteractions([click, dismiss]);
57
- const listId = useId();
58
- const tooltipContent = /* @__PURE__ */ jsx2("p", { children: typeof tooltip === "string" ? tooltip : _tooltipContent });
59
- const initialMotion = { opacity: 0, scale: 0.95 };
60
- const animateMotion = { opacity: 1, scale: 1 };
61
- const enhancedChildren = Children.map(children, (child) => {
62
- if (!isValidElement(child)) return child;
63
- if (!("onSelect" in child.props)) return child;
64
- const prevOnSelect = child.props.onSelect;
65
- const combinedOnSelect = () => {
66
- prevOnSelect == null ? void 0 : prevOnSelect();
67
- setOpen(false);
68
- };
69
- return cloneElement(child, { onSelect: combinedOnSelect });
70
- });
71
- const btn = /* @__PURE__ */ jsxs(
72
- "button",
73
- __spreadProps(__spreadValues({}, getReferenceProps({
74
- ref: refs.setReference,
75
- type: "button",
76
- "aria-controls": open ? listId : void 0
77
- })), {
78
- className: twMerge(
79
- "p-1.5 rounded-md hover:bg-gray-100 items-center flex gap-x-0.5",
80
- className
81
- ),
82
- style,
83
- children: [
84
- /* @__PURE__ */ jsx2("span", { children: content != null ? content : _internalContent }),
85
- showArrow && /* @__PURE__ */ jsx2(ArrowIcon_default, { size: 14, className: "text-gray-500 block" })
86
- ]
87
- })
88
- );
89
- return /* @__PURE__ */ jsxs(Fragment, { children: [
90
- tooltip === false ? btn : /* @__PURE__ */ jsx2(
91
- Tooltip_default,
92
- {
93
- content: tooltipContent,
94
- className: tooltipClassName,
95
- placement: tooltipPlacement,
96
- children: btn
97
- }
98
- ),
99
- /* @__PURE__ */ jsx2(FloatingPortal, { children: /* @__PURE__ */ jsx2(AnimatePresence, { children: open && /* @__PURE__ */ jsx2(
100
- motion.div,
101
- __spreadProps(__spreadValues({}, getFloatingProps({
102
- ref: refs.setFloating,
103
- style: {
104
- position: strategy,
105
- top: y != null ? y : 0,
106
- left: x != null ? x : 0
107
- },
108
- role: "listbox",
109
- id: listId
110
- })), {
111
- initial: initialMotion,
112
- animate: animateMotion,
113
- exit: initialMotion,
114
- className: twMerge("bg-white border border-solid border-gray-200 p-2 space-y-1 rounded-lg shadow-sm shadow-gray-200/40 max-h-125 overflow-auto", _dropdownClassName, dropdownClassName),
115
- children: enhancedChildren
116
- })
117
- ) }) })
118
- ] });
119
- };
120
- var DropdownComponent_default = DropdownComponent;
121
-
122
- // src/lib/components/DropdownItemComponent.tsx
123
- import { twMerge as twMerge2 } from "tailwind-merge";
124
- import { useEditorState } from "@tiptap/react";
125
- import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
126
- var DropdownItemComponent = ({ item, onSelect, activeClassName, itemClassName, _itemClassName, showKeyShortcutText = true, spClass }) => {
127
- const { editor } = useEditor();
128
- const editorState = useEditorState({
129
- editor,
130
- selector: ({ editor: editor2 }) => ({ isActive: (editor2 == null ? void 0 : editor2.isActive(item.name, item.ext ? { level: item.ext } : void 0)) || false })
131
- });
132
- return /* @__PURE__ */ jsxs2("div", { className: twMerge2(
133
- "flex items-center gap-x-2.5 transition-all duration-100 cursor-pointer select-none px-2 py-1.5 rounded-md",
134
- _itemClassName,
135
- (editorState == null ? void 0 : editorState.isActive) ? "bg-gray-200/60" : "hover:bg-gray-100",
136
- itemClassName,
137
- (editorState == null ? void 0 : editorState.isActive) ? activeClassName : "hover:bg-gray-100"
138
- ), onClick: onSelect, children: [
139
- item.icon,
140
- /* @__PURE__ */ jsx3("span", { className: twMerge2("flex-1 text-base", spClass), style: item.style, children: item.text }),
141
- showKeyShortcutText && item.keyBind && /* @__PURE__ */ jsx3("span", { className: "ml-6 text-gray-400", children: item.keyBind })
142
- ] });
143
- };
144
- var DropdownItemComponent_default = DropdownItemComponent;
145
-
146
- export {
147
- DropdownComponent_default,
148
- DropdownItemComponent_default
149
- };
@@ -1,90 +0,0 @@
1
- import {
2
- __spreadProps,
3
- __spreadValues
4
- } from "./chunk-FWCSY2DS.mjs";
5
-
6
- // src/lib/components/_com/Tooltip.tsx
7
- import { useState, Fragment, cloneElement, isValidElement, useId } from "react";
8
- import { useFloating, offset, flip, shift, autoUpdate, useInteractions, useHover, useDismiss, FloatingPortal } from "@floating-ui/react";
9
- import { AnimatePresence, motion } from "motion/react";
10
- import { twMerge } from "tailwind-merge";
11
- import { jsx, jsxs } from "react/jsx-runtime";
12
- var Tooltip = ({ placement = "top", children, content, className }) => {
13
- const [open, setOpen] = useState(false);
14
- const { x, y, refs, strategy, context, placement: resolvedPlacement } = useFloating({
15
- open,
16
- onOpenChange: setOpen,
17
- placement,
18
- middleware: [offset(8), flip(), shift({ padding: 8 })],
19
- whileElementsMounted: autoUpdate
20
- });
21
- const hover = useHover(context);
22
- const dismiss = useDismiss(context);
23
- const { getReferenceProps, getFloatingProps } = useInteractions([hover, dismiss]);
24
- const id = useId();
25
- function mergeRefs(...refsToMerge) {
26
- return (node) => {
27
- for (const r of refsToMerge) {
28
- if (!r) continue;
29
- if (typeof r === "function") r(node);
30
- else r.current = node;
31
- }
32
- };
33
- }
34
- const side = resolvedPlacement.split("-")[0];
35
- const enterOffset = 6;
36
- const getInitial = () => {
37
- switch (side) {
38
- case "top":
39
- return { opacity: 0, y: enterOffset };
40
- case "bottom":
41
- return { opacity: 0, y: -enterOffset };
42
- case "left":
43
- return { opacity: 0, x: enterOffset };
44
- case "right":
45
- return { opacity: 0, x: -enterOffset };
46
- default:
47
- return { opacity: 0 };
48
- }
49
- };
50
- const getExit = () => __spreadProps(__spreadValues({}, getInitial()), { opacity: 0 });
51
- return /* @__PURE__ */ jsxs(Fragment, { children: [
52
- isValidElement(children) ? cloneElement(children, __spreadProps(__spreadValues({}, getReferenceProps({
53
- onFocus: () => setOpen(true),
54
- onBlur: () => setOpen(false),
55
- "aria-describedby": open ? id : void 0
56
- /* eslint-disable @typescript-eslint/no-explicit-any */
57
- })), {
58
- /* eslint-disable @typescript-eslint/no-explicit-any */
59
- ref: mergeRefs(children.props.ref, refs.setReference)
60
- })) : children,
61
- /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx(AnimatePresence, { children: open && /* @__PURE__ */ jsx(
62
- motion.div,
63
- __spreadProps(__spreadValues({
64
- ref: refs.setFloating
65
- }, getFloatingProps({
66
- role: "tooltip",
67
- id,
68
- style: {
69
- position: strategy,
70
- top: y != null ? y : 0,
71
- left: x != null ? x : 0,
72
- pointerEvents: "none"
73
- }
74
- })), {
75
- initial: getInitial(),
76
- animate: { opacity: 1, x: 0, y: 0, scale: 1 },
77
- exit: getExit(),
78
- transition: { type: "spring", stiffness: 420, damping: 30, mass: 0.6 },
79
- className: twMerge("bg-white border border-solid border-gray-200/50 py-1 px-3 rounded-lg text-sm shadow-lg shadow-gray-50 text-center", className),
80
- children: content
81
- }),
82
- "tooltip"
83
- ) }) })
84
- ] });
85
- };
86
- var Tooltip_default = Tooltip;
87
-
88
- export {
89
- Tooltip_default
90
- };
@@ -1,53 +0,0 @@
1
- import {
2
- Tooltip_default
3
- } from "./chunk-7QOFJIQ3.mjs";
4
- import {
5
- useEditor
6
- } from "./chunk-VYDH6BZE.mjs";
7
-
8
- // src/lib/components/ButtonComponent.tsx
9
- import { twMerge } from "tailwind-merge";
10
- import { useEditorState } from "@tiptap/react";
11
- import { jsx, jsxs } from "react/jsx-runtime";
12
- var ButtonComponent = ({ className, activeClassName, icon, style, tooltip = true, tooltipClassName, tooltipPlacement, _extName, _internalIcon, _tooltipContent, _onToggle, _interShortcut, _buttonClassName }) => {
13
- const { editor } = useEditor();
14
- const editorState = useEditorState({
15
- editor,
16
- selector: ({ editor: editor2 }) => ({ isActive: (editor2 == null ? void 0 : editor2.isActive(_extName)) || false })
17
- });
18
- const tooltipContent = /* @__PURE__ */ jsxs("p", { children: [
19
- typeof tooltip === "string" ? tooltip : _tooltipContent,
20
- /* @__PURE__ */ jsx("br", {}),
21
- _interShortcut
22
- ] });
23
- const btn = /* @__PURE__ */ jsx(
24
- "button",
25
- {
26
- onClick: _onToggle,
27
- className: twMerge(
28
- "py-1.5 px-2.5 rounded-md",
29
- _buttonClassName,
30
- (editorState == null ? void 0 : editorState.isActive) ? "bg-gray-200/60" : "hover:bg-gray-100",
31
- className,
32
- (editorState == null ? void 0 : editorState.isActive) ? activeClassName : "hover:bg-gray-100"
33
- ),
34
- style,
35
- children: icon != null ? icon : _internalIcon
36
- }
37
- );
38
- if (tooltip === false) return btn;
39
- return /* @__PURE__ */ jsx(
40
- Tooltip_default,
41
- {
42
- content: tooltipContent,
43
- className: tooltipClassName,
44
- placement: tooltipPlacement,
45
- children: btn
46
- }
47
- );
48
- };
49
- var ButtonComponent_default = ButtonComponent;
50
-
51
- export {
52
- ButtonComponent_default
53
- };
@@ -1,37 +0,0 @@
1
- import {
2
- __objRest,
3
- __spreadProps,
4
- __spreadValues
5
- } from "./chunk-FWCSY2DS.mjs";
6
-
7
- // src/lib/icon/SupIcon.tsx
8
- import { jsx, jsxs } from "react/jsx-runtime";
9
- var SupIcon = (_a) => {
10
- var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
11
- return /* @__PURE__ */ jsxs(
12
- "svg",
13
- __spreadProps(__spreadValues({
14
- xmlns: "http://www.w3.org/2000/svg",
15
- viewBox: "0 0 24 24",
16
- fill: "none",
17
- stroke: "currentColor",
18
- strokeWidth: 2,
19
- strokeLinecap: "round",
20
- strokeLinejoin: "round",
21
- width: size,
22
- height: size,
23
- className
24
- }, props), {
25
- children: [
26
- /* @__PURE__ */ jsx("path", { d: "m4 19 8-8" }),
27
- /* @__PURE__ */ jsx("path", { d: "m12 19-8-8" }),
28
- /* @__PURE__ */ jsx("path", { d: "M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06" })
29
- ]
30
- })
31
- );
32
- };
33
- var SupIcon_default = SupIcon;
34
-
35
- export {
36
- SupIcon_default
37
- };
@@ -1,37 +0,0 @@
1
- import {
2
- __objRest,
3
- __spreadProps,
4
- __spreadValues
5
- } from "./chunk-FWCSY2DS.mjs";
6
-
7
- // src/lib/icon/SubIcon.tsx
8
- import { jsx, jsxs } from "react/jsx-runtime";
9
- var SubIcon = (_a) => {
10
- var _b = _a, { size = 17, className } = _b, props = __objRest(_b, ["size", "className"]);
11
- return /* @__PURE__ */ jsxs(
12
- "svg",
13
- __spreadProps(__spreadValues({
14
- xmlns: "http://www.w3.org/2000/svg",
15
- viewBox: "0 0 24 24",
16
- fill: "none",
17
- stroke: "currentColor",
18
- strokeWidth: 2,
19
- strokeLinecap: "round",
20
- strokeLinejoin: "round",
21
- width: size,
22
- height: size,
23
- className
24
- }, props), {
25
- children: [
26
- /* @__PURE__ */ jsx("path", { d: "m4 5 8 8" }),
27
- /* @__PURE__ */ jsx("path", { d: "m12 5-8 8" }),
28
- /* @__PURE__ */ jsx("path", { d: "M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07" })
29
- ]
30
- })
31
- );
32
- };
33
- var SubIcon_default = SubIcon;
34
-
35
- export {
36
- SubIcon_default
37
- };
@@ -1,39 +0,0 @@
1
- import { ReactNode, CSSProperties } from 'react';
2
- import { Placement } from '@floating-ui/react';
3
- import { Editor } from '@tiptap/react';
4
-
5
- type ExtButtonOptions = {
6
- className?: string;
7
- activeClassName?: string;
8
- icon?: ReactNode;
9
- style?: CSSProperties;
10
- tooltip?: boolean | string;
11
- tooltipClassName?: string;
12
- tooltipPlacement?: Placement;
13
- component: (args: {
14
- options: ExtButtonOptions;
15
- editor: Editor;
16
- buttonClassName: string;
17
- }) => ReactNode;
18
- };
19
- type ExtWithoutActiveOptions = Omit<ExtButtonOptions, "activeClassName" | "component"> & {
20
- component: (args: {
21
- options: ExtWithoutActiveOptions;
22
- editor: Editor;
23
- buttonClassName: string;
24
- }) => ReactNode;
25
- };
26
- type ExtDropdownOptions = {
27
- className?: string;
28
- showArrow?: boolean;
29
- content?: ReactNode;
30
- dropdownClassName?: string;
31
- itemClassName?: string;
32
- activeClassName?: string;
33
- style?: CSSProperties;
34
- tooltip?: boolean | string;
35
- tooltipClassName?: string;
36
- tooltipPlacement?: Placement;
37
- };
38
-
39
- export type { ExtButtonOptions as E, ExtDropdownOptions as a, ExtWithoutActiveOptions as b };
@@ -1,39 +0,0 @@
1
- import { ReactNode, CSSProperties } from 'react';
2
- import { Placement } from '@floating-ui/react';
3
- import { Editor } from '@tiptap/react';
4
-
5
- type ExtButtonOptions = {
6
- className?: string;
7
- activeClassName?: string;
8
- icon?: ReactNode;
9
- style?: CSSProperties;
10
- tooltip?: boolean | string;
11
- tooltipClassName?: string;
12
- tooltipPlacement?: Placement;
13
- component: (args: {
14
- options: ExtButtonOptions;
15
- editor: Editor;
16
- buttonClassName: string;
17
- }) => ReactNode;
18
- };
19
- type ExtWithoutActiveOptions = Omit<ExtButtonOptions, "activeClassName" | "component"> & {
20
- component: (args: {
21
- options: ExtWithoutActiveOptions;
22
- editor: Editor;
23
- buttonClassName: string;
24
- }) => ReactNode;
25
- };
26
- type ExtDropdownOptions = {
27
- className?: string;
28
- showArrow?: boolean;
29
- content?: ReactNode;
30
- dropdownClassName?: string;
31
- itemClassName?: string;
32
- activeClassName?: string;
33
- style?: CSSProperties;
34
- tooltip?: boolean | string;
35
- tooltipClassName?: string;
36
- tooltipPlacement?: Placement;
37
- };
38
-
39
- export type { ExtButtonOptions as E, ExtDropdownOptions as a, ExtWithoutActiveOptions as b };