notra-editor 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -8
- package/dist/components/blockquote-button/blockquote-button.cjs +91 -0
- package/dist/components/blockquote-button/blockquote-button.cjs.map +1 -0
- package/dist/components/blockquote-button/blockquote-button.d.cts +9 -0
- package/dist/components/blockquote-button/blockquote-button.d.ts +9 -0
- package/dist/components/blockquote-button/blockquote-button.mjs +67 -0
- package/dist/components/blockquote-button/blockquote-button.mjs.map +1 -0
- package/dist/components/code-block-button/code-block-button.cjs +91 -0
- package/dist/components/code-block-button/code-block-button.cjs.map +1 -0
- package/dist/components/code-block-button/code-block-button.d.cts +9 -0
- package/dist/components/code-block-button/code-block-button.d.ts +9 -0
- package/dist/components/code-block-button/code-block-button.mjs +67 -0
- package/dist/components/code-block-button/code-block-button.mjs.map +1 -0
- package/dist/components/code-block-view.cjs +39 -0
- package/dist/components/code-block-view.cjs.map +1 -0
- package/dist/components/code-block-view.d.cts +12 -0
- package/dist/components/code-block-view.d.ts +12 -0
- package/dist/components/code-block-view.mjs +17 -0
- package/dist/components/code-block-view.mjs.map +1 -0
- package/dist/components/copy-button.cjs +49 -0
- package/dist/components/copy-button.cjs.map +1 -0
- package/dist/components/copy-button.d.cts +9 -0
- package/dist/components/copy-button.d.ts +9 -0
- package/dist/components/copy-button.mjs +25 -0
- package/dist/components/copy-button.mjs.map +1 -0
- package/dist/components/heading-dropdown-menu/heading-dropdown-menu.cjs +67 -0
- package/dist/components/heading-dropdown-menu/heading-dropdown-menu.cjs.map +1 -0
- package/dist/components/heading-dropdown-menu/heading-dropdown-menu.d.cts +17 -0
- package/dist/components/heading-dropdown-menu/heading-dropdown-menu.d.ts +17 -0
- package/dist/components/heading-dropdown-menu/heading-dropdown-menu.mjs +51 -0
- package/dist/components/heading-dropdown-menu/heading-dropdown-menu.mjs.map +1 -0
- package/dist/components/heading-dropdown-menu/heading-menu-item.cjs +56 -0
- package/dist/components/heading-dropdown-menu/heading-menu-item.cjs.map +1 -0
- package/dist/components/heading-dropdown-menu/heading-menu-item.d.cts +12 -0
- package/dist/components/heading-dropdown-menu/heading-menu-item.d.ts +12 -0
- package/dist/components/heading-dropdown-menu/heading-menu-item.mjs +32 -0
- package/dist/components/heading-dropdown-menu/heading-menu-item.mjs.map +1 -0
- package/dist/components/heading-dropdown-menu/use-heading.cjs +109 -0
- package/dist/components/heading-dropdown-menu/use-heading.cjs.map +1 -0
- package/dist/components/heading-dropdown-menu/use-heading.d.cts +19 -0
- package/dist/components/heading-dropdown-menu/use-heading.d.ts +19 -0
- package/dist/components/heading-dropdown-menu/use-heading.mjs +83 -0
- package/dist/components/heading-dropdown-menu/use-heading.mjs.map +1 -0
- package/dist/components/image-popover/image-popover.cjs +161 -0
- package/dist/components/image-popover/image-popover.cjs.map +1 -0
- package/dist/components/image-popover/image-popover.d.cts +9 -0
- package/dist/components/image-popover/image-popover.d.ts +9 -0
- package/dist/components/image-popover/image-popover.mjs +137 -0
- package/dist/components/image-popover/image-popover.mjs.map +1 -0
- package/dist/components/image-popover/use-image-popover.cjs +88 -0
- package/dist/components/image-popover/use-image-popover.cjs.map +1 -0
- package/dist/components/image-popover/use-image-popover.d.cts +19 -0
- package/dist/components/image-popover/use-image-popover.d.ts +19 -0
- package/dist/components/image-popover/use-image-popover.mjs +64 -0
- package/dist/components/image-popover/use-image-popover.mjs.map +1 -0
- package/dist/components/link-popover/link-popover.cjs +157 -0
- package/dist/components/link-popover/link-popover.cjs.map +1 -0
- package/dist/components/link-popover/link-popover.d.cts +9 -0
- package/dist/components/link-popover/link-popover.d.ts +9 -0
- package/dist/components/link-popover/link-popover.mjs +138 -0
- package/dist/components/link-popover/link-popover.mjs.map +1 -0
- package/dist/components/link-popover/use-link-popover.cjs +86 -0
- package/dist/components/link-popover/use-link-popover.cjs.map +1 -0
- package/dist/components/link-popover/use-link-popover.d.cts +18 -0
- package/dist/components/link-popover/use-link-popover.d.ts +18 -0
- package/dist/components/link-popover/use-link-popover.mjs +62 -0
- package/dist/components/link-popover/use-link-popover.mjs.map +1 -0
- package/dist/components/list-dropdown-menu/list-dropdown-menu.cjs +73 -0
- package/dist/components/list-dropdown-menu/list-dropdown-menu.cjs.map +1 -0
- package/dist/components/list-dropdown-menu/list-dropdown-menu.d.cts +17 -0
- package/dist/components/list-dropdown-menu/list-dropdown-menu.d.ts +17 -0
- package/dist/components/list-dropdown-menu/list-dropdown-menu.mjs +57 -0
- package/dist/components/list-dropdown-menu/list-dropdown-menu.mjs.map +1 -0
- package/dist/components/list-dropdown-menu/list-menu-item.cjs +56 -0
- package/dist/components/list-dropdown-menu/list-menu-item.cjs.map +1 -0
- package/dist/components/list-dropdown-menu/list-menu-item.d.cts +12 -0
- package/dist/components/list-dropdown-menu/list-menu-item.d.ts +12 -0
- package/dist/components/list-dropdown-menu/list-menu-item.mjs +32 -0
- package/dist/components/list-dropdown-menu/list-menu-item.mjs.map +1 -0
- package/dist/components/list-dropdown-menu/use-list.cjs +111 -0
- package/dist/components/list-dropdown-menu/use-list.cjs.map +1 -0
- package/dist/components/list-dropdown-menu/use-list.d.cts +19 -0
- package/dist/components/list-dropdown-menu/use-list.d.ts +19 -0
- package/dist/components/list-dropdown-menu/use-list.mjs +85 -0
- package/dist/components/list-dropdown-menu/use-list.mjs.map +1 -0
- package/dist/components/mark-button/mark-button.cjs +72 -0
- package/dist/components/mark-button/mark-button.cjs.map +1 -0
- package/dist/components/mark-button/mark-button.d.cts +12 -0
- package/dist/components/mark-button/mark-button.d.ts +12 -0
- package/dist/components/mark-button/mark-button.mjs +48 -0
- package/dist/components/mark-button/mark-button.mjs.map +1 -0
- package/dist/components/mark-button/use-mark.cjs +71 -0
- package/dist/components/mark-button/use-mark.cjs.map +1 -0
- package/dist/components/mark-button/use-mark.d.cts +17 -0
- package/dist/components/mark-button/use-mark.d.ts +17 -0
- package/dist/components/mark-button/use-mark.mjs +47 -0
- package/dist/components/mark-button/use-mark.mjs.map +1 -0
- package/dist/components/toolbar/toolbar.cjs +77 -0
- package/dist/components/toolbar/toolbar.cjs.map +1 -0
- package/dist/components/toolbar/toolbar.d.cts +14 -0
- package/dist/components/toolbar/toolbar.d.ts +14 -0
- package/dist/components/toolbar/toolbar.mjs +51 -0
- package/dist/components/toolbar/toolbar.mjs.map +1 -0
- package/dist/components/ui/button.cjs +82 -0
- package/dist/components/ui/button.cjs.map +1 -0
- package/dist/components/ui/button.d.cts +14 -0
- package/dist/components/ui/button.d.ts +14 -0
- package/dist/components/ui/button.mjs +57 -0
- package/dist/components/ui/button.mjs.map +1 -0
- package/dist/components/ui/dropdown-menu.cjs +290 -0
- package/dist/components/ui/dropdown-menu.cjs.map +1 -0
- package/dist/components/ui/dropdown-menu.d.cts +32 -0
- package/dist/components/ui/dropdown-menu.d.ts +32 -0
- package/dist/components/ui/dropdown-menu.mjs +252 -0
- package/dist/components/ui/dropdown-menu.mjs.map +1 -0
- package/dist/components/ui/input.cjs +44 -0
- package/dist/components/ui/input.cjs.map +1 -0
- package/dist/components/ui/input.d.cts +6 -0
- package/dist/components/ui/input.d.ts +6 -0
- package/dist/components/ui/input.mjs +20 -0
- package/dist/components/ui/input.mjs.map +1 -0
- package/dist/components/ui/popover.cjs +72 -0
- package/dist/components/ui/popover.cjs.map +1 -0
- package/dist/components/ui/popover.d.cts +10 -0
- package/dist/components/ui/popover.d.ts +10 -0
- package/dist/components/ui/popover.mjs +45 -0
- package/dist/components/ui/popover.mjs.map +1 -0
- package/dist/components/ui/separator.cjs +51 -0
- package/dist/components/ui/separator.cjs.map +1 -0
- package/dist/components/ui/separator.d.cts +7 -0
- package/dist/components/ui/separator.d.ts +7 -0
- package/dist/components/ui/separator.mjs +27 -0
- package/dist/components/ui/separator.mjs.map +1 -0
- package/dist/components/ui/spacer.cjs +32 -0
- package/dist/components/ui/spacer.cjs.map +1 -0
- package/dist/components/ui/spacer.d.cts +5 -0
- package/dist/components/ui/spacer.d.ts +5 -0
- package/dist/components/ui/spacer.mjs +8 -0
- package/dist/components/ui/spacer.mjs.map +1 -0
- package/dist/components/undo-redo-button/undo-redo-button.cjs +63 -0
- package/dist/components/undo-redo-button/undo-redo-button.cjs.map +1 -0
- package/dist/components/undo-redo-button/undo-redo-button.d.cts +12 -0
- package/dist/components/undo-redo-button/undo-redo-button.d.ts +12 -0
- package/dist/components/undo-redo-button/undo-redo-button.mjs +39 -0
- package/dist/components/undo-redo-button/undo-redo-button.mjs.map +1 -0
- package/dist/components/undo-redo-button/use-undo-redo.cjs +68 -0
- package/dist/components/undo-redo-button/use-undo-redo.cjs.map +1 -0
- package/dist/components/undo-redo-button/use-undo-redo.d.cts +17 -0
- package/dist/components/undo-redo-button/use-undo-redo.d.ts +17 -0
- package/dist/components/undo-redo-button/use-undo-redo.mjs +44 -0
- package/dist/components/undo-redo-button/use-undo-redo.mjs.map +1 -0
- package/dist/extensions/code-block.cjs +46 -0
- package/dist/extensions/code-block.cjs.map +1 -0
- package/dist/extensions/code-block.d.cts +6 -0
- package/dist/extensions/code-block.d.ts +6 -0
- package/dist/extensions/code-block.mjs +12 -0
- package/dist/extensions/code-block.mjs.map +1 -0
- package/dist/extensions/editor.cjs +55 -0
- package/dist/extensions/editor.cjs.map +1 -0
- package/dist/extensions/editor.d.cts +10 -0
- package/dist/extensions/editor.d.ts +10 -0
- package/dist/extensions/editor.mjs +21 -0
- package/dist/extensions/editor.mjs.map +1 -0
- package/dist/extensions/index.cjs +32 -0
- package/dist/extensions/index.cjs.map +1 -0
- package/dist/extensions/index.d.cts +8 -0
- package/dist/extensions/index.d.ts +8 -0
- package/dist/extensions/index.mjs +7 -0
- package/dist/extensions/index.mjs.map +1 -0
- package/dist/extensions/shared.cjs +66 -0
- package/dist/extensions/shared.cjs.map +1 -0
- package/dist/extensions/shared.d.cts +9 -0
- package/dist/extensions/shared.d.ts +9 -0
- package/dist/extensions/shared.mjs +31 -0
- package/dist/extensions/shared.mjs.map +1 -0
- package/dist/hooks/use-copy-to-clipboard.cjs +50 -0
- package/dist/hooks/use-copy-to-clipboard.cjs.map +1 -0
- package/dist/hooks/use-copy-to-clipboard.d.cts +10 -0
- package/dist/hooks/use-copy-to-clipboard.d.ts +10 -0
- package/dist/hooks/use-copy-to-clipboard.mjs +26 -0
- package/dist/hooks/use-copy-to-clipboard.mjs.map +1 -0
- package/dist/hooks/use-markdown-editor.cjs +80 -0
- package/dist/hooks/use-markdown-editor.cjs.map +1 -0
- package/dist/hooks/use-markdown-editor.d.cts +13 -0
- package/dist/hooks/use-markdown-editor.d.ts +13 -0
- package/dist/hooks/use-markdown-editor.mjs +56 -0
- package/dist/hooks/use-markdown-editor.mjs.map +1 -0
- package/dist/icons/redo-icon.cjs +54 -0
- package/dist/icons/redo-icon.cjs.map +1 -0
- package/dist/icons/redo-icon.d.cts +7 -0
- package/dist/icons/redo-icon.d.ts +7 -0
- package/dist/icons/redo-icon.mjs +30 -0
- package/dist/icons/redo-icon.mjs.map +1 -0
- package/dist/icons/undo-icon.cjs +54 -0
- package/dist/icons/undo-icon.cjs.map +1 -0
- package/dist/icons/undo-icon.d.cts +7 -0
- package/dist/icons/undo-icon.d.ts +7 -0
- package/dist/icons/undo-icon.mjs +30 -0
- package/dist/icons/undo-icon.mjs.map +1 -0
- package/dist/index.cjs +27 -1322
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -105
- package/dist/index.d.ts +23 -105
- package/dist/index.mjs +16 -1301
- package/dist/index.mjs.map +1 -1
- package/dist/lib/utils.cjs +33 -0
- package/dist/lib/utils.cjs.map +1 -0
- package/dist/lib/utils.d.cts +5 -0
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.mjs +9 -0
- package/dist/lib/utils.mjs.map +1 -0
- package/dist/notra-editor.cjs +90 -0
- package/dist/notra-editor.cjs.map +1 -0
- package/dist/notra-editor.d.cts +17 -0
- package/dist/notra-editor.d.ts +17 -0
- package/dist/notra-editor.mjs +70 -0
- package/dist/notra-editor.mjs.map +1 -0
- package/dist/notra-reader.cjs +47 -0
- package/dist/notra-reader.cjs.map +1 -0
- package/dist/notra-reader.d.cts +11 -0
- package/dist/notra-reader.d.ts +11 -0
- package/dist/notra-reader.mjs +23 -0
- package/dist/notra-reader.mjs.map +1 -0
- package/dist/styles/globals.css +32 -0
- package/dist/themes/default/editor.css +2 -0
- package/dist/themes/default/reader.css +2 -0
- package/dist/themes/default/shared.css +18 -0
- package/dist/utils/markdown-to-json.cjs +50 -0
- package/dist/utils/markdown-to-json.cjs.map +1 -0
- package/dist/utils/markdown-to-json.d.cts +7 -0
- package/dist/utils/markdown-to-json.d.ts +7 -0
- package/dist/utils/markdown-to-json.mjs +26 -0
- package/dist/utils/markdown-to-json.mjs.map +1 -0
- package/package.json +3 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var use_mark_exports = {};
|
|
20
|
+
__export(use_mark_exports, {
|
|
21
|
+
useMark: () => useMark
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(use_mark_exports);
|
|
24
|
+
var import_lucide_react = require("lucide-react");
|
|
25
|
+
var import_react = require("react");
|
|
26
|
+
const markLabels = {
|
|
27
|
+
bold: "Bold",
|
|
28
|
+
italic: "Italic",
|
|
29
|
+
strike: "Strikethrough",
|
|
30
|
+
code: "Code"
|
|
31
|
+
};
|
|
32
|
+
const markIcons = {
|
|
33
|
+
bold: import_lucide_react.Bold,
|
|
34
|
+
italic: import_lucide_react.Italic,
|
|
35
|
+
strike: import_lucide_react.Strikethrough,
|
|
36
|
+
code: import_lucide_react.Code
|
|
37
|
+
};
|
|
38
|
+
function useMark({ editor, type }) {
|
|
39
|
+
const [isActive, setIsActive] = (0, import_react.useState)(false);
|
|
40
|
+
const [canToggle, setCanToggle] = (0, import_react.useState)(false);
|
|
41
|
+
(0, import_react.useEffect)(() => {
|
|
42
|
+
if (!editor) return;
|
|
43
|
+
const handleUpdate = () => {
|
|
44
|
+
setIsActive(editor.isActive(type));
|
|
45
|
+
setCanToggle(editor.isEditable && editor.can().toggleMark(type));
|
|
46
|
+
};
|
|
47
|
+
handleUpdate();
|
|
48
|
+
editor.on("selectionUpdate", handleUpdate);
|
|
49
|
+
editor.on("transaction", handleUpdate);
|
|
50
|
+
return () => {
|
|
51
|
+
editor.off("selectionUpdate", handleUpdate);
|
|
52
|
+
editor.off("transaction", handleUpdate);
|
|
53
|
+
};
|
|
54
|
+
}, [editor, type]);
|
|
55
|
+
const handleToggle = (0, import_react.useCallback)(() => {
|
|
56
|
+
if (!editor || !editor.isEditable) return false;
|
|
57
|
+
return editor.chain().focus().toggleMark(type).run();
|
|
58
|
+
}, [editor, type]);
|
|
59
|
+
return {
|
|
60
|
+
isActive,
|
|
61
|
+
canToggle,
|
|
62
|
+
handleToggle,
|
|
63
|
+
label: markLabels[type],
|
|
64
|
+
Icon: markIcons[type]
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
68
|
+
0 && (module.exports = {
|
|
69
|
+
useMark
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=use-mark.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/mark-button/use-mark.ts"],"sourcesContent":["import { Bold, Code, Italic, Strikethrough } from 'lucide-react';\nimport { useCallback, useEffect, useState } from 'react';\n\nimport type { Editor } from '@tiptap/core';\nimport type { LucideIcon } from 'lucide-react';\n\nexport type MarkType = 'bold' | 'italic' | 'strike' | 'code';\n\nexport interface UseMarkConfig {\n\teditor: Editor | null;\n\ttype: MarkType;\n}\n\nconst markLabels: Record<MarkType, string> = {\n\tbold: 'Bold',\n\titalic: 'Italic',\n\tstrike: 'Strikethrough',\n\tcode: 'Code'\n};\n\nconst markIcons: Record<MarkType, LucideIcon> = {\n\tbold: Bold,\n\titalic: Italic,\n\tstrike: Strikethrough,\n\tcode: Code\n};\n\nexport function useMark({ editor, type }: UseMarkConfig) {\n\tconst [isActive, setIsActive] = useState(false);\n\tconst [canToggle, setCanToggle] = useState(false);\n\n\tuseEffect(() => {\n\t\tif (!editor) return;\n\n\t\tconst handleUpdate = () => {\n\t\t\tsetIsActive(editor.isActive(type));\n\t\t\tsetCanToggle(editor.isEditable && editor.can().toggleMark(type));\n\t\t};\n\n\t\thandleUpdate();\n\n\t\teditor.on('selectionUpdate', handleUpdate);\n\t\teditor.on('transaction', handleUpdate);\n\n\t\treturn () => {\n\t\t\teditor.off('selectionUpdate', handleUpdate);\n\t\t\teditor.off('transaction', handleUpdate);\n\t\t};\n\t}, [editor, type]);\n\n\tconst handleToggle = useCallback(() => {\n\t\tif (!editor || !editor.isEditable) return false;\n\n\t\treturn editor.chain().focus().toggleMark(type).run();\n\t}, [editor, type]);\n\n\treturn {\n\t\tisActive,\n\t\tcanToggle,\n\t\thandleToggle,\n\t\tlabel: markLabels[type],\n\t\tIcon: markIcons[type]\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAkD;AAClD,mBAAiD;AAYjD,MAAM,aAAuC;AAAA,EAC5C,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AACP;AAEA,MAAM,YAA0C;AAAA,EAC/C,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AACP;AAEO,SAAS,QAAQ,EAAE,QAAQ,KAAK,GAAkB;AACxD,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAS,KAAK;AAC9C,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS,KAAK;AAEhD,8BAAU,MAAM;AACf,QAAI,CAAC,OAAQ;AAEb,UAAM,eAAe,MAAM;AAC1B,kBAAY,OAAO,SAAS,IAAI,CAAC;AACjC,mBAAa,OAAO,cAAc,OAAO,IAAI,EAAE,WAAW,IAAI,CAAC;AAAA,IAChE;AAEA,iBAAa;AAEb,WAAO,GAAG,mBAAmB,YAAY;AACzC,WAAO,GAAG,eAAe,YAAY;AAErC,WAAO,MAAM;AACZ,aAAO,IAAI,mBAAmB,YAAY;AAC1C,aAAO,IAAI,eAAe,YAAY;AAAA,IACvC;AAAA,EACD,GAAG,CAAC,QAAQ,IAAI,CAAC;AAEjB,QAAM,mBAAe,0BAAY,MAAM;AACtC,QAAI,CAAC,UAAU,CAAC,OAAO,WAAY,QAAO;AAE1C,WAAO,OAAO,MAAM,EAAE,MAAM,EAAE,WAAW,IAAI,EAAE,IAAI;AAAA,EACpD,GAAG,CAAC,QAAQ,IAAI,CAAC;AAEjB,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,WAAW,IAAI;AAAA,IACtB,MAAM,UAAU,IAAI;AAAA,EACrB;AACD;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
import { LucideIcon } from 'lucide-react';
|
|
3
|
+
|
|
4
|
+
type MarkType = 'bold' | 'italic' | 'strike' | 'code';
|
|
5
|
+
interface UseMarkConfig {
|
|
6
|
+
editor: Editor | null;
|
|
7
|
+
type: MarkType;
|
|
8
|
+
}
|
|
9
|
+
declare function useMark({ editor, type }: UseMarkConfig): {
|
|
10
|
+
isActive: boolean;
|
|
11
|
+
canToggle: boolean;
|
|
12
|
+
handleToggle: () => boolean;
|
|
13
|
+
label: string;
|
|
14
|
+
Icon: LucideIcon;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { type MarkType, type UseMarkConfig, useMark };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
import { LucideIcon } from 'lucide-react';
|
|
3
|
+
|
|
4
|
+
type MarkType = 'bold' | 'italic' | 'strike' | 'code';
|
|
5
|
+
interface UseMarkConfig {
|
|
6
|
+
editor: Editor | null;
|
|
7
|
+
type: MarkType;
|
|
8
|
+
}
|
|
9
|
+
declare function useMark({ editor, type }: UseMarkConfig): {
|
|
10
|
+
isActive: boolean;
|
|
11
|
+
canToggle: boolean;
|
|
12
|
+
handleToggle: () => boolean;
|
|
13
|
+
label: string;
|
|
14
|
+
Icon: LucideIcon;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { type MarkType, type UseMarkConfig, useMark };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Bold, Code, Italic, Strikethrough } from "lucide-react";
|
|
2
|
+
import { useCallback, useEffect, useState } from "react";
|
|
3
|
+
const markLabels = {
|
|
4
|
+
bold: "Bold",
|
|
5
|
+
italic: "Italic",
|
|
6
|
+
strike: "Strikethrough",
|
|
7
|
+
code: "Code"
|
|
8
|
+
};
|
|
9
|
+
const markIcons = {
|
|
10
|
+
bold: Bold,
|
|
11
|
+
italic: Italic,
|
|
12
|
+
strike: Strikethrough,
|
|
13
|
+
code: Code
|
|
14
|
+
};
|
|
15
|
+
function useMark({ editor, type }) {
|
|
16
|
+
const [isActive, setIsActive] = useState(false);
|
|
17
|
+
const [canToggle, setCanToggle] = useState(false);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (!editor) return;
|
|
20
|
+
const handleUpdate = () => {
|
|
21
|
+
setIsActive(editor.isActive(type));
|
|
22
|
+
setCanToggle(editor.isEditable && editor.can().toggleMark(type));
|
|
23
|
+
};
|
|
24
|
+
handleUpdate();
|
|
25
|
+
editor.on("selectionUpdate", handleUpdate);
|
|
26
|
+
editor.on("transaction", handleUpdate);
|
|
27
|
+
return () => {
|
|
28
|
+
editor.off("selectionUpdate", handleUpdate);
|
|
29
|
+
editor.off("transaction", handleUpdate);
|
|
30
|
+
};
|
|
31
|
+
}, [editor, type]);
|
|
32
|
+
const handleToggle = useCallback(() => {
|
|
33
|
+
if (!editor || !editor.isEditable) return false;
|
|
34
|
+
return editor.chain().focus().toggleMark(type).run();
|
|
35
|
+
}, [editor, type]);
|
|
36
|
+
return {
|
|
37
|
+
isActive,
|
|
38
|
+
canToggle,
|
|
39
|
+
handleToggle,
|
|
40
|
+
label: markLabels[type],
|
|
41
|
+
Icon: markIcons[type]
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
useMark
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=use-mark.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/mark-button/use-mark.ts"],"sourcesContent":["import { Bold, Code, Italic, Strikethrough } from 'lucide-react';\nimport { useCallback, useEffect, useState } from 'react';\n\nimport type { Editor } from '@tiptap/core';\nimport type { LucideIcon } from 'lucide-react';\n\nexport type MarkType = 'bold' | 'italic' | 'strike' | 'code';\n\nexport interface UseMarkConfig {\n\teditor: Editor | null;\n\ttype: MarkType;\n}\n\nconst markLabels: Record<MarkType, string> = {\n\tbold: 'Bold',\n\titalic: 'Italic',\n\tstrike: 'Strikethrough',\n\tcode: 'Code'\n};\n\nconst markIcons: Record<MarkType, LucideIcon> = {\n\tbold: Bold,\n\titalic: Italic,\n\tstrike: Strikethrough,\n\tcode: Code\n};\n\nexport function useMark({ editor, type }: UseMarkConfig) {\n\tconst [isActive, setIsActive] = useState(false);\n\tconst [canToggle, setCanToggle] = useState(false);\n\n\tuseEffect(() => {\n\t\tif (!editor) return;\n\n\t\tconst handleUpdate = () => {\n\t\t\tsetIsActive(editor.isActive(type));\n\t\t\tsetCanToggle(editor.isEditable && editor.can().toggleMark(type));\n\t\t};\n\n\t\thandleUpdate();\n\n\t\teditor.on('selectionUpdate', handleUpdate);\n\t\teditor.on('transaction', handleUpdate);\n\n\t\treturn () => {\n\t\t\teditor.off('selectionUpdate', handleUpdate);\n\t\t\teditor.off('transaction', handleUpdate);\n\t\t};\n\t}, [editor, type]);\n\n\tconst handleToggle = useCallback(() => {\n\t\tif (!editor || !editor.isEditable) return false;\n\n\t\treturn editor.chain().focus().toggleMark(type).run();\n\t}, [editor, type]);\n\n\treturn {\n\t\tisActive,\n\t\tcanToggle,\n\t\thandleToggle,\n\t\tlabel: markLabels[type],\n\t\tIcon: markIcons[type]\n\t};\n}\n"],"mappings":"AAAA,SAAS,MAAM,MAAM,QAAQ,qBAAqB;AAClD,SAAS,aAAa,WAAW,gBAAgB;AAYjD,MAAM,aAAuC;AAAA,EAC5C,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AACP;AAEA,MAAM,YAA0C;AAAA,EAC/C,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,MAAM;AACP;AAEO,SAAS,QAAQ,EAAE,QAAQ,KAAK,GAAkB;AACxD,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,KAAK;AAC9C,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAEhD,YAAU,MAAM;AACf,QAAI,CAAC,OAAQ;AAEb,UAAM,eAAe,MAAM;AAC1B,kBAAY,OAAO,SAAS,IAAI,CAAC;AACjC,mBAAa,OAAO,cAAc,OAAO,IAAI,EAAE,WAAW,IAAI,CAAC;AAAA,IAChE;AAEA,iBAAa;AAEb,WAAO,GAAG,mBAAmB,YAAY;AACzC,WAAO,GAAG,eAAe,YAAY;AAErC,WAAO,MAAM;AACZ,aAAO,IAAI,mBAAmB,YAAY;AAC1C,aAAO,IAAI,eAAe,YAAY;AAAA,IACvC;AAAA,EACD,GAAG,CAAC,QAAQ,IAAI,CAAC;AAEjB,QAAM,eAAe,YAAY,MAAM;AACtC,QAAI,CAAC,UAAU,CAAC,OAAO,WAAY,QAAO;AAE1C,WAAO,OAAO,MAAM,EAAE,MAAM,EAAE,WAAW,IAAI,EAAE,IAAI;AAAA,EACpD,GAAG,CAAC,QAAQ,IAAI,CAAC;AAEjB,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,WAAW,IAAI;AAAA,IACtB,MAAM,UAAU,IAAI;AAAA,EACrB;AACD;","names":[]}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var toolbar_exports = {};
|
|
20
|
+
__export(toolbar_exports, {
|
|
21
|
+
Toolbar: () => Toolbar,
|
|
22
|
+
ToolbarGroup: () => ToolbarGroup,
|
|
23
|
+
ToolbarSeparator: () => ToolbarSeparator
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(toolbar_exports);
|
|
26
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
27
|
+
var import_react = require("react");
|
|
28
|
+
const Toolbar = (0, import_react.forwardRef)(
|
|
29
|
+
({ children, className, variant = "fixed", ...props }, ref) => {
|
|
30
|
+
const classNames = ["tiptap-toolbar", className].filter(Boolean).join(" ");
|
|
31
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
ref,
|
|
35
|
+
"aria-label": "toolbar",
|
|
36
|
+
className: classNames,
|
|
37
|
+
"data-variant": variant,
|
|
38
|
+
role: "toolbar",
|
|
39
|
+
...props,
|
|
40
|
+
children
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
Toolbar.displayName = "Toolbar";
|
|
46
|
+
function ToolbarGroup({
|
|
47
|
+
children,
|
|
48
|
+
className,
|
|
49
|
+
...props
|
|
50
|
+
}) {
|
|
51
|
+
const classNames = ["tiptap-toolbar-group", className].filter(Boolean).join(" ");
|
|
52
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: classNames, role: "group", ...props, children });
|
|
53
|
+
}
|
|
54
|
+
function ToolbarSeparator({
|
|
55
|
+
orientation = "vertical",
|
|
56
|
+
className,
|
|
57
|
+
...props
|
|
58
|
+
}) {
|
|
59
|
+
const classNames = ["tiptap-separator", className].filter(Boolean).join(" ");
|
|
60
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
"aria-orientation": orientation === "vertical" ? orientation : void 0,
|
|
64
|
+
className: classNames,
|
|
65
|
+
"data-orientation": orientation,
|
|
66
|
+
role: "separator",
|
|
67
|
+
...props
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
72
|
+
0 && (module.exports = {
|
|
73
|
+
Toolbar,
|
|
74
|
+
ToolbarGroup,
|
|
75
|
+
ToolbarSeparator
|
|
76
|
+
});
|
|
77
|
+
//# sourceMappingURL=toolbar.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/toolbar/toolbar.tsx"],"sourcesContent":["import { forwardRef } from 'react';\n\nexport interface ToolbarProps extends React.HTMLAttributes<HTMLDivElement> {\n\tvariant?: 'fixed' | 'floating';\n}\n\nexport const Toolbar = forwardRef<HTMLDivElement, ToolbarProps>(\n\t({ children, className, variant = 'fixed', ...props }, ref) => {\n\t\tconst classNames = ['tiptap-toolbar', className].filter(Boolean).join(' ');\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ref}\n\t\t\t\taria-label=\"toolbar\"\n\t\t\t\tclassName={classNames}\n\t\t\t\tdata-variant={variant}\n\t\t\t\trole=\"toolbar\"\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nToolbar.displayName = 'Toolbar';\n\nexport function ToolbarGroup({\n\tchildren,\n\tclassName,\n\t...props\n}: React.HTMLAttributes<HTMLDivElement>) {\n\tconst classNames = ['tiptap-toolbar-group', className]\n\t\t.filter(Boolean)\n\t\t.join(' ');\n\n\treturn (\n\t\t<div className={classNames} role=\"group\" {...props}>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n\nexport interface ToolbarSeparatorProps extends React.HTMLAttributes<HTMLDivElement> {\n\torientation?: 'horizontal' | 'vertical';\n}\n\nexport function ToolbarSeparator({\n\torientation = 'vertical',\n\tclassName,\n\t...props\n}: ToolbarSeparatorProps) {\n\tconst classNames = ['tiptap-separator', className].filter(Boolean).join(' ');\n\n\treturn (\n\t\t<div\n\t\t\taria-orientation={orientation === 'vertical' ? orientation : undefined}\n\t\t\tclassName={classNames}\n\t\t\tdata-orientation={orientation}\n\t\t\trole=\"separator\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWG;AAXH,mBAA2B;AAMpB,MAAM,cAAU;AAAA,EACtB,CAAC,EAAE,UAAU,WAAW,UAAU,SAAS,GAAG,MAAM,GAAG,QAAQ;AAC9D,UAAM,aAAa,CAAC,kBAAkB,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAEzE,WACC;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA,cAAW;AAAA,QACX,WAAW;AAAA,QACX,gBAAc;AAAA,QACd,MAAK;AAAA,QACJ,GAAG;AAAA,QAEH;AAAA;AAAA,IACF;AAAA,EAEF;AACD;AAEA,QAAQ,cAAc;AAEf,SAAS,aAAa;AAAA,EAC5B;AAAA,EACA;AAAA,EACA,GAAG;AACJ,GAAyC;AACxC,QAAM,aAAa,CAAC,wBAAwB,SAAS,EACnD,OAAO,OAAO,EACd,KAAK,GAAG;AAEV,SACC,4CAAC,SAAI,WAAW,YAAY,MAAK,SAAS,GAAG,OAC3C,UACF;AAEF;AAMO,SAAS,iBAAiB;AAAA,EAChC,cAAc;AAAA,EACd;AAAA,EACA,GAAG;AACJ,GAA0B;AACzB,QAAM,aAAa,CAAC,oBAAoB,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAE3E,SACC;AAAA,IAAC;AAAA;AAAA,MACA,oBAAkB,gBAAgB,aAAa,cAAc;AAAA,MAC7D,WAAW;AAAA,MACX,oBAAkB;AAAA,MAClB,MAAK;AAAA,MACJ,GAAG;AAAA;AAAA,EACL;AAEF;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
|
|
4
|
+
interface ToolbarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
variant?: 'fixed' | 'floating';
|
|
6
|
+
}
|
|
7
|
+
declare const Toolbar: react.ForwardRefExoticComponent<ToolbarProps & react.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
declare function ToolbarGroup({ children, className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
|
|
9
|
+
interface ToolbarSeparatorProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
orientation?: 'horizontal' | 'vertical';
|
|
11
|
+
}
|
|
12
|
+
declare function ToolbarSeparator({ orientation, className, ...props }: ToolbarSeparatorProps): react_jsx_runtime.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { Toolbar, ToolbarGroup, type ToolbarProps, ToolbarSeparator, type ToolbarSeparatorProps };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
|
|
4
|
+
interface ToolbarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
variant?: 'fixed' | 'floating';
|
|
6
|
+
}
|
|
7
|
+
declare const Toolbar: react.ForwardRefExoticComponent<ToolbarProps & react.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
declare function ToolbarGroup({ children, className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
|
|
9
|
+
interface ToolbarSeparatorProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
orientation?: 'horizontal' | 'vertical';
|
|
11
|
+
}
|
|
12
|
+
declare function ToolbarSeparator({ orientation, className, ...props }: ToolbarSeparatorProps): react_jsx_runtime.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { Toolbar, ToolbarGroup, type ToolbarProps, ToolbarSeparator, type ToolbarSeparatorProps };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
const Toolbar = forwardRef(
|
|
4
|
+
({ children, className, variant = "fixed", ...props }, ref) => {
|
|
5
|
+
const classNames = ["tiptap-toolbar", className].filter(Boolean).join(" ");
|
|
6
|
+
return /* @__PURE__ */ jsx(
|
|
7
|
+
"div",
|
|
8
|
+
{
|
|
9
|
+
ref,
|
|
10
|
+
"aria-label": "toolbar",
|
|
11
|
+
className: classNames,
|
|
12
|
+
"data-variant": variant,
|
|
13
|
+
role: "toolbar",
|
|
14
|
+
...props,
|
|
15
|
+
children
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
Toolbar.displayName = "Toolbar";
|
|
21
|
+
function ToolbarGroup({
|
|
22
|
+
children,
|
|
23
|
+
className,
|
|
24
|
+
...props
|
|
25
|
+
}) {
|
|
26
|
+
const classNames = ["tiptap-toolbar-group", className].filter(Boolean).join(" ");
|
|
27
|
+
return /* @__PURE__ */ jsx("div", { className: classNames, role: "group", ...props, children });
|
|
28
|
+
}
|
|
29
|
+
function ToolbarSeparator({
|
|
30
|
+
orientation = "vertical",
|
|
31
|
+
className,
|
|
32
|
+
...props
|
|
33
|
+
}) {
|
|
34
|
+
const classNames = ["tiptap-separator", className].filter(Boolean).join(" ");
|
|
35
|
+
return /* @__PURE__ */ jsx(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
"aria-orientation": orientation === "vertical" ? orientation : void 0,
|
|
39
|
+
className: classNames,
|
|
40
|
+
"data-orientation": orientation,
|
|
41
|
+
role: "separator",
|
|
42
|
+
...props
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
Toolbar,
|
|
48
|
+
ToolbarGroup,
|
|
49
|
+
ToolbarSeparator
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=toolbar.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/toolbar/toolbar.tsx"],"sourcesContent":["import { forwardRef } from 'react';\n\nexport interface ToolbarProps extends React.HTMLAttributes<HTMLDivElement> {\n\tvariant?: 'fixed' | 'floating';\n}\n\nexport const Toolbar = forwardRef<HTMLDivElement, ToolbarProps>(\n\t({ children, className, variant = 'fixed', ...props }, ref) => {\n\t\tconst classNames = ['tiptap-toolbar', className].filter(Boolean).join(' ');\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tref={ref}\n\t\t\t\taria-label=\"toolbar\"\n\t\t\t\tclassName={classNames}\n\t\t\t\tdata-variant={variant}\n\t\t\t\trole=\"toolbar\"\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nToolbar.displayName = 'Toolbar';\n\nexport function ToolbarGroup({\n\tchildren,\n\tclassName,\n\t...props\n}: React.HTMLAttributes<HTMLDivElement>) {\n\tconst classNames = ['tiptap-toolbar-group', className]\n\t\t.filter(Boolean)\n\t\t.join(' ');\n\n\treturn (\n\t\t<div className={classNames} role=\"group\" {...props}>\n\t\t\t{children}\n\t\t</div>\n\t);\n}\n\nexport interface ToolbarSeparatorProps extends React.HTMLAttributes<HTMLDivElement> {\n\torientation?: 'horizontal' | 'vertical';\n}\n\nexport function ToolbarSeparator({\n\torientation = 'vertical',\n\tclassName,\n\t...props\n}: ToolbarSeparatorProps) {\n\tconst classNames = ['tiptap-separator', className].filter(Boolean).join(' ');\n\n\treturn (\n\t\t<div\n\t\t\taria-orientation={orientation === 'vertical' ? orientation : undefined}\n\t\t\tclassName={classNames}\n\t\t\tdata-orientation={orientation}\n\t\t\trole=\"separator\"\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n"],"mappings":"AAWG;AAXH,SAAS,kBAAkB;AAMpB,MAAM,UAAU;AAAA,EACtB,CAAC,EAAE,UAAU,WAAW,UAAU,SAAS,GAAG,MAAM,GAAG,QAAQ;AAC9D,UAAM,aAAa,CAAC,kBAAkB,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAEzE,WACC;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA,cAAW;AAAA,QACX,WAAW;AAAA,QACX,gBAAc;AAAA,QACd,MAAK;AAAA,QACJ,GAAG;AAAA,QAEH;AAAA;AAAA,IACF;AAAA,EAEF;AACD;AAEA,QAAQ,cAAc;AAEf,SAAS,aAAa;AAAA,EAC5B;AAAA,EACA;AAAA,EACA,GAAG;AACJ,GAAyC;AACxC,QAAM,aAAa,CAAC,wBAAwB,SAAS,EACnD,OAAO,OAAO,EACd,KAAK,GAAG;AAEV,SACC,oBAAC,SAAI,WAAW,YAAY,MAAK,SAAS,GAAG,OAC3C,UACF;AAEF;AAMO,SAAS,iBAAiB;AAAA,EAChC,cAAc;AAAA,EACd;AAAA,EACA,GAAG;AACJ,GAA0B;AACzB,QAAM,aAAa,CAAC,oBAAoB,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAE3E,SACC;AAAA,IAAC;AAAA;AAAA,MACA,oBAAkB,gBAAgB,aAAa,cAAc;AAAA,MAC7D,WAAW;AAAA,MACX,oBAAkB;AAAA,MAClB,MAAK;AAAA,MACJ,GAAG;AAAA;AAAA,EACL;AAEF;","names":[]}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var button_exports = {};
|
|
20
|
+
__export(button_exports, {
|
|
21
|
+
Button: () => Button,
|
|
22
|
+
buttonVariants: () => buttonVariants
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(button_exports);
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
27
|
+
var import_radix_ui = require("radix-ui");
|
|
28
|
+
var import_utils = require("../../lib/utils");
|
|
29
|
+
const buttonVariants = (0, import_class_variance_authority.cva)(
|
|
30
|
+
"nt:group/button nt:inline-flex nt:shrink-0 nt:items-center nt:justify-center nt:rounded-lg nt:border nt:border-transparent nt:bg-clip-padding nt:text-sm nt:font-medium nt:whitespace-nowrap nt:transition-all nt:outline-none nt:select-none nt:focus-visible:border-ring nt:focus-visible:ring-3 nt:focus-visible:ring-ring/50 nt:active:not-aria-[haspopup]:translate-y-px nt:disabled:pointer-events-none nt:disabled:opacity-50 nt:aria-invalid:border-destructive nt:aria-invalid:ring-3 nt:aria-invalid:ring-destructive/20 nt:dark:aria-invalid:border-destructive/50 nt:dark:aria-invalid:ring-destructive/40 nt:[&_svg]:pointer-events-none nt:[&_svg]:shrink-0 nt:[&_svg:not([class*=size-])]:size-4",
|
|
31
|
+
{
|
|
32
|
+
variants: {
|
|
33
|
+
variant: {
|
|
34
|
+
default: "nt:bg-primary nt:text-primary-foreground nt:[a]:hover:bg-primary/80",
|
|
35
|
+
outline: "nt:border-border nt:bg-background nt:hover:bg-muted nt:hover:text-foreground nt:aria-expanded:bg-muted nt:aria-expanded:text-foreground nt:dark:border-input nt:dark:bg-input/30 nt:dark:hover:bg-input/50",
|
|
36
|
+
secondary: "nt:bg-secondary nt:text-secondary-foreground nt:hover:bg-secondary/80 nt:aria-expanded:bg-secondary nt:aria-expanded:text-secondary-foreground",
|
|
37
|
+
ghost: "nt:hover:bg-muted nt:hover:text-foreground nt:aria-expanded:bg-muted nt:aria-expanded:text-foreground nt:dark:hover:bg-muted/50",
|
|
38
|
+
destructive: "nt:bg-destructive/10 nt:text-destructive nt:hover:bg-destructive/20 nt:focus-visible:border-destructive/40 nt:focus-visible:ring-destructive/20 nt:dark:bg-destructive/20 nt:dark:hover:bg-destructive/30 nt:dark:focus-visible:ring-destructive/40",
|
|
39
|
+
link: "nt:text-primary nt:underline-offset-4 nt:hover:underline"
|
|
40
|
+
},
|
|
41
|
+
size: {
|
|
42
|
+
default: "nt:h-8 nt:gap-1.5 nt:px-2.5 nt:has-data-[icon=inline-end]:pr-2 nt:has-data-[icon=inline-start]:pl-2",
|
|
43
|
+
xs: "nt:h-6 nt:gap-1 nt:rounded-[min(var(--radius-md),10px)] nt:px-2 nt:text-xs nt:in-data-[slot=button-group]:rounded-lg nt:has-data-[icon=inline-end]:pr-1.5 nt:has-data-[icon=inline-start]:pl-1.5 nt:[&_svg:not([class*=size-])]:size-3",
|
|
44
|
+
sm: "nt:h-7 nt:gap-1 nt:rounded-[min(var(--radius-md),12px)] nt:px-2.5 nt:text-[0.8rem] nt:in-data-[slot=button-group]:rounded-lg nt:has-data-[icon=inline-end]:pr-1.5 nt:has-data-[icon=inline-start]:pl-1.5 nt:[&_svg:not([class*=size-])]:size-3.5",
|
|
45
|
+
lg: "nt:h-9 nt:gap-1.5 nt:px-2.5 nt:has-data-[icon=inline-end]:pr-2 nt:has-data-[icon=inline-start]:pl-2",
|
|
46
|
+
icon: "nt:size-8",
|
|
47
|
+
"icon-xs": "nt:size-6 nt:rounded-[min(var(--radius-md),10px)] nt:in-data-[slot=button-group]:rounded-lg nt:[&_svg:not([class*=size-])]:size-3",
|
|
48
|
+
"icon-sm": "nt:size-7 nt:rounded-[min(var(--radius-md),12px)] nt:in-data-[slot=button-group]:rounded-lg",
|
|
49
|
+
"icon-lg": "nt:size-9"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
defaultVariants: {
|
|
53
|
+
variant: "default",
|
|
54
|
+
size: "default"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
function Button({
|
|
59
|
+
className,
|
|
60
|
+
variant = "default",
|
|
61
|
+
size = "default",
|
|
62
|
+
asChild = false,
|
|
63
|
+
...props
|
|
64
|
+
}) {
|
|
65
|
+
const Comp = asChild ? import_radix_ui.Slot.Root : "button";
|
|
66
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
67
|
+
Comp,
|
|
68
|
+
{
|
|
69
|
+
className: (0, import_utils.cn)(buttonVariants({ variant, size, className })),
|
|
70
|
+
"data-size": size,
|
|
71
|
+
"data-slot": "button",
|
|
72
|
+
"data-variant": variant,
|
|
73
|
+
...props
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
78
|
+
0 && (module.exports = {
|
|
79
|
+
Button,
|
|
80
|
+
buttonVariants
|
|
81
|
+
});
|
|
82
|
+
//# sourceMappingURL=button.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/button.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority';\nimport { Slot } from 'radix-ui';\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\n\nconst buttonVariants = cva(\n\t'nt:group/button nt:inline-flex nt:shrink-0 nt:items-center nt:justify-center nt:rounded-lg nt:border nt:border-transparent nt:bg-clip-padding nt:text-sm nt:font-medium nt:whitespace-nowrap nt:transition-all nt:outline-none nt:select-none nt:focus-visible:border-ring nt:focus-visible:ring-3 nt:focus-visible:ring-ring/50 nt:active:not-aria-[haspopup]:translate-y-px nt:disabled:pointer-events-none nt:disabled:opacity-50 nt:aria-invalid:border-destructive nt:aria-invalid:ring-3 nt:aria-invalid:ring-destructive/20 nt:dark:aria-invalid:border-destructive/50 nt:dark:aria-invalid:ring-destructive/40 nt:[&_svg]:pointer-events-none nt:[&_svg]:shrink-0 nt:[&_svg:not([class*=size-])]:size-4',\n\t{\n\t\tvariants: {\n\t\t\tvariant: {\n\t\t\t\tdefault:\n\t\t\t\t\t'nt:bg-primary nt:text-primary-foreground nt:[a]:hover:bg-primary/80',\n\t\t\t\toutline:\n\t\t\t\t\t'nt:border-border nt:bg-background nt:hover:bg-muted nt:hover:text-foreground nt:aria-expanded:bg-muted nt:aria-expanded:text-foreground nt:dark:border-input nt:dark:bg-input/30 nt:dark:hover:bg-input/50',\n\t\t\t\tsecondary:\n\t\t\t\t\t'nt:bg-secondary nt:text-secondary-foreground nt:hover:bg-secondary/80 nt:aria-expanded:bg-secondary nt:aria-expanded:text-secondary-foreground',\n\t\t\t\tghost:\n\t\t\t\t\t'nt:hover:bg-muted nt:hover:text-foreground nt:aria-expanded:bg-muted nt:aria-expanded:text-foreground nt:dark:hover:bg-muted/50',\n\t\t\t\tdestructive:\n\t\t\t\t\t'nt:bg-destructive/10 nt:text-destructive nt:hover:bg-destructive/20 nt:focus-visible:border-destructive/40 nt:focus-visible:ring-destructive/20 nt:dark:bg-destructive/20 nt:dark:hover:bg-destructive/30 nt:dark:focus-visible:ring-destructive/40',\n\t\t\t\tlink: 'nt:text-primary nt:underline-offset-4 nt:hover:underline'\n\t\t\t},\n\t\t\tsize: {\n\t\t\t\tdefault:\n\t\t\t\t\t'nt:h-8 nt:gap-1.5 nt:px-2.5 nt:has-data-[icon=inline-end]:pr-2 nt:has-data-[icon=inline-start]:pl-2',\n\t\t\t\txs: 'nt:h-6 nt:gap-1 nt:rounded-[min(var(--radius-md),10px)] nt:px-2 nt:text-xs nt:in-data-[slot=button-group]:rounded-lg nt:has-data-[icon=inline-end]:pr-1.5 nt:has-data-[icon=inline-start]:pl-1.5 nt:[&_svg:not([class*=size-])]:size-3',\n\t\t\t\tsm: 'nt:h-7 nt:gap-1 nt:rounded-[min(var(--radius-md),12px)] nt:px-2.5 nt:text-[0.8rem] nt:in-data-[slot=button-group]:rounded-lg nt:has-data-[icon=inline-end]:pr-1.5 nt:has-data-[icon=inline-start]:pl-1.5 nt:[&_svg:not([class*=size-])]:size-3.5',\n\t\t\t\tlg: 'nt:h-9 nt:gap-1.5 nt:px-2.5 nt:has-data-[icon=inline-end]:pr-2 nt:has-data-[icon=inline-start]:pl-2',\n\t\t\t\ticon: 'nt:size-8',\n\t\t\t\t'icon-xs':\n\t\t\t\t\t'nt:size-6 nt:rounded-[min(var(--radius-md),10px)] nt:in-data-[slot=button-group]:rounded-lg nt:[&_svg:not([class*=size-])]:size-3',\n\t\t\t\t'icon-sm':\n\t\t\t\t\t'nt:size-7 nt:rounded-[min(var(--radius-md),12px)] nt:in-data-[slot=button-group]:rounded-lg',\n\t\t\t\t'icon-lg': 'nt:size-9'\n\t\t\t}\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tvariant: 'default',\n\t\t\tsize: 'default'\n\t\t}\n\t}\n);\n\nfunction Button({\n\tclassName,\n\tvariant = 'default',\n\tsize = 'default',\n\tasChild = false,\n\t...props\n}: React.ComponentProps<'button'> &\n\tVariantProps<typeof buttonVariants> & {\n\t\tasChild?: boolean;\n\t}) {\n\tconst Comp = asChild ? Slot.Root : 'button';\n\n\treturn (\n\t\t<Comp\n\t\t\tclassName={cn(buttonVariants({ variant, size, className }))}\n\t\t\tdata-size={size}\n\t\t\tdata-slot=\"button\"\n\t\t\tdata-variant={variant}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Button, buttonVariants };\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyDE;AAzDF,sCAAuC;AACvC,sBAAqB;AAGrB,mBAAmB;AAEnB,MAAM,qBAAiB;AAAA,EACtB;AAAA,EACA;AAAA,IACC,UAAU;AAAA,MACT,SAAS;AAAA,QACR,SACC;AAAA,QACD,SACC;AAAA,QACD,WACC;AAAA,QACD,OACC;AAAA,QACD,aACC;AAAA,QACD,MAAM;AAAA,MACP;AAAA,MACA,MAAM;AAAA,QACL,SACC;AAAA,QACD,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,MAAM;AAAA,QACN,WACC;AAAA,QACD,WACC;AAAA,QACD,WAAW;AAAA,MACZ;AAAA,IACD;AAAA,IACA,iBAAiB;AAAA,MAChB,SAAS;AAAA,MACT,MAAM;AAAA,IACP;AAAA,EACD;AACD;AAEA,SAAS,OAAO;AAAA,EACf;AAAA,EACA,UAAU;AAAA,EACV,OAAO;AAAA,EACP,UAAU;AAAA,EACV,GAAG;AACJ,GAGI;AACH,QAAM,OAAO,UAAU,qBAAK,OAAO;AAEnC,SACC;AAAA,IAAC;AAAA;AAAA,MACA,eAAW,iBAAG,eAAe,EAAE,SAAS,MAAM,UAAU,CAAC,CAAC;AAAA,MAC1D,aAAW;AAAA,MACX,aAAU;AAAA,MACV,gBAAc;AAAA,MACb,GAAG;AAAA;AAAA,EACL;AAEF;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
import * as react from 'react';
|
|
5
|
+
|
|
6
|
+
declare const buttonVariants: (props?: ({
|
|
7
|
+
variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | "link" | null | undefined;
|
|
8
|
+
size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
9
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
|
+
declare function Button({ className, variant, size, asChild, ...props }: react.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
|
11
|
+
asChild?: boolean;
|
|
12
|
+
}): react_jsx_runtime.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
import * as react from 'react';
|
|
5
|
+
|
|
6
|
+
declare const buttonVariants: (props?: ({
|
|
7
|
+
variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | "link" | null | undefined;
|
|
8
|
+
size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
9
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
|
+
declare function Button({ className, variant, size, asChild, ...props }: react.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
|
11
|
+
asChild?: boolean;
|
|
12
|
+
}): react_jsx_runtime.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { Slot } from "radix-ui";
|
|
4
|
+
import { cn } from "../../lib/utils";
|
|
5
|
+
const buttonVariants = cva(
|
|
6
|
+
"nt:group/button nt:inline-flex nt:shrink-0 nt:items-center nt:justify-center nt:rounded-lg nt:border nt:border-transparent nt:bg-clip-padding nt:text-sm nt:font-medium nt:whitespace-nowrap nt:transition-all nt:outline-none nt:select-none nt:focus-visible:border-ring nt:focus-visible:ring-3 nt:focus-visible:ring-ring/50 nt:active:not-aria-[haspopup]:translate-y-px nt:disabled:pointer-events-none nt:disabled:opacity-50 nt:aria-invalid:border-destructive nt:aria-invalid:ring-3 nt:aria-invalid:ring-destructive/20 nt:dark:aria-invalid:border-destructive/50 nt:dark:aria-invalid:ring-destructive/40 nt:[&_svg]:pointer-events-none nt:[&_svg]:shrink-0 nt:[&_svg:not([class*=size-])]:size-4",
|
|
7
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: "nt:bg-primary nt:text-primary-foreground nt:[a]:hover:bg-primary/80",
|
|
11
|
+
outline: "nt:border-border nt:bg-background nt:hover:bg-muted nt:hover:text-foreground nt:aria-expanded:bg-muted nt:aria-expanded:text-foreground nt:dark:border-input nt:dark:bg-input/30 nt:dark:hover:bg-input/50",
|
|
12
|
+
secondary: "nt:bg-secondary nt:text-secondary-foreground nt:hover:bg-secondary/80 nt:aria-expanded:bg-secondary nt:aria-expanded:text-secondary-foreground",
|
|
13
|
+
ghost: "nt:hover:bg-muted nt:hover:text-foreground nt:aria-expanded:bg-muted nt:aria-expanded:text-foreground nt:dark:hover:bg-muted/50",
|
|
14
|
+
destructive: "nt:bg-destructive/10 nt:text-destructive nt:hover:bg-destructive/20 nt:focus-visible:border-destructive/40 nt:focus-visible:ring-destructive/20 nt:dark:bg-destructive/20 nt:dark:hover:bg-destructive/30 nt:dark:focus-visible:ring-destructive/40",
|
|
15
|
+
link: "nt:text-primary nt:underline-offset-4 nt:hover:underline"
|
|
16
|
+
},
|
|
17
|
+
size: {
|
|
18
|
+
default: "nt:h-8 nt:gap-1.5 nt:px-2.5 nt:has-data-[icon=inline-end]:pr-2 nt:has-data-[icon=inline-start]:pl-2",
|
|
19
|
+
xs: "nt:h-6 nt:gap-1 nt:rounded-[min(var(--radius-md),10px)] nt:px-2 nt:text-xs nt:in-data-[slot=button-group]:rounded-lg nt:has-data-[icon=inline-end]:pr-1.5 nt:has-data-[icon=inline-start]:pl-1.5 nt:[&_svg:not([class*=size-])]:size-3",
|
|
20
|
+
sm: "nt:h-7 nt:gap-1 nt:rounded-[min(var(--radius-md),12px)] nt:px-2.5 nt:text-[0.8rem] nt:in-data-[slot=button-group]:rounded-lg nt:has-data-[icon=inline-end]:pr-1.5 nt:has-data-[icon=inline-start]:pl-1.5 nt:[&_svg:not([class*=size-])]:size-3.5",
|
|
21
|
+
lg: "nt:h-9 nt:gap-1.5 nt:px-2.5 nt:has-data-[icon=inline-end]:pr-2 nt:has-data-[icon=inline-start]:pl-2",
|
|
22
|
+
icon: "nt:size-8",
|
|
23
|
+
"icon-xs": "nt:size-6 nt:rounded-[min(var(--radius-md),10px)] nt:in-data-[slot=button-group]:rounded-lg nt:[&_svg:not([class*=size-])]:size-3",
|
|
24
|
+
"icon-sm": "nt:size-7 nt:rounded-[min(var(--radius-md),12px)] nt:in-data-[slot=button-group]:rounded-lg",
|
|
25
|
+
"icon-lg": "nt:size-9"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
defaultVariants: {
|
|
29
|
+
variant: "default",
|
|
30
|
+
size: "default"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
function Button({
|
|
35
|
+
className,
|
|
36
|
+
variant = "default",
|
|
37
|
+
size = "default",
|
|
38
|
+
asChild = false,
|
|
39
|
+
...props
|
|
40
|
+
}) {
|
|
41
|
+
const Comp = asChild ? Slot.Root : "button";
|
|
42
|
+
return /* @__PURE__ */ jsx(
|
|
43
|
+
Comp,
|
|
44
|
+
{
|
|
45
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
46
|
+
"data-size": size,
|
|
47
|
+
"data-slot": "button",
|
|
48
|
+
"data-variant": variant,
|
|
49
|
+
...props
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
Button,
|
|
55
|
+
buttonVariants
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=button.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/button.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority';\nimport { Slot } from 'radix-ui';\nimport * as React from 'react';\n\nimport { cn } from '../../lib/utils';\n\nconst buttonVariants = cva(\n\t'nt:group/button nt:inline-flex nt:shrink-0 nt:items-center nt:justify-center nt:rounded-lg nt:border nt:border-transparent nt:bg-clip-padding nt:text-sm nt:font-medium nt:whitespace-nowrap nt:transition-all nt:outline-none nt:select-none nt:focus-visible:border-ring nt:focus-visible:ring-3 nt:focus-visible:ring-ring/50 nt:active:not-aria-[haspopup]:translate-y-px nt:disabled:pointer-events-none nt:disabled:opacity-50 nt:aria-invalid:border-destructive nt:aria-invalid:ring-3 nt:aria-invalid:ring-destructive/20 nt:dark:aria-invalid:border-destructive/50 nt:dark:aria-invalid:ring-destructive/40 nt:[&_svg]:pointer-events-none nt:[&_svg]:shrink-0 nt:[&_svg:not([class*=size-])]:size-4',\n\t{\n\t\tvariants: {\n\t\t\tvariant: {\n\t\t\t\tdefault:\n\t\t\t\t\t'nt:bg-primary nt:text-primary-foreground nt:[a]:hover:bg-primary/80',\n\t\t\t\toutline:\n\t\t\t\t\t'nt:border-border nt:bg-background nt:hover:bg-muted nt:hover:text-foreground nt:aria-expanded:bg-muted nt:aria-expanded:text-foreground nt:dark:border-input nt:dark:bg-input/30 nt:dark:hover:bg-input/50',\n\t\t\t\tsecondary:\n\t\t\t\t\t'nt:bg-secondary nt:text-secondary-foreground nt:hover:bg-secondary/80 nt:aria-expanded:bg-secondary nt:aria-expanded:text-secondary-foreground',\n\t\t\t\tghost:\n\t\t\t\t\t'nt:hover:bg-muted nt:hover:text-foreground nt:aria-expanded:bg-muted nt:aria-expanded:text-foreground nt:dark:hover:bg-muted/50',\n\t\t\t\tdestructive:\n\t\t\t\t\t'nt:bg-destructive/10 nt:text-destructive nt:hover:bg-destructive/20 nt:focus-visible:border-destructive/40 nt:focus-visible:ring-destructive/20 nt:dark:bg-destructive/20 nt:dark:hover:bg-destructive/30 nt:dark:focus-visible:ring-destructive/40',\n\t\t\t\tlink: 'nt:text-primary nt:underline-offset-4 nt:hover:underline'\n\t\t\t},\n\t\t\tsize: {\n\t\t\t\tdefault:\n\t\t\t\t\t'nt:h-8 nt:gap-1.5 nt:px-2.5 nt:has-data-[icon=inline-end]:pr-2 nt:has-data-[icon=inline-start]:pl-2',\n\t\t\t\txs: 'nt:h-6 nt:gap-1 nt:rounded-[min(var(--radius-md),10px)] nt:px-2 nt:text-xs nt:in-data-[slot=button-group]:rounded-lg nt:has-data-[icon=inline-end]:pr-1.5 nt:has-data-[icon=inline-start]:pl-1.5 nt:[&_svg:not([class*=size-])]:size-3',\n\t\t\t\tsm: 'nt:h-7 nt:gap-1 nt:rounded-[min(var(--radius-md),12px)] nt:px-2.5 nt:text-[0.8rem] nt:in-data-[slot=button-group]:rounded-lg nt:has-data-[icon=inline-end]:pr-1.5 nt:has-data-[icon=inline-start]:pl-1.5 nt:[&_svg:not([class*=size-])]:size-3.5',\n\t\t\t\tlg: 'nt:h-9 nt:gap-1.5 nt:px-2.5 nt:has-data-[icon=inline-end]:pr-2 nt:has-data-[icon=inline-start]:pl-2',\n\t\t\t\ticon: 'nt:size-8',\n\t\t\t\t'icon-xs':\n\t\t\t\t\t'nt:size-6 nt:rounded-[min(var(--radius-md),10px)] nt:in-data-[slot=button-group]:rounded-lg nt:[&_svg:not([class*=size-])]:size-3',\n\t\t\t\t'icon-sm':\n\t\t\t\t\t'nt:size-7 nt:rounded-[min(var(--radius-md),12px)] nt:in-data-[slot=button-group]:rounded-lg',\n\t\t\t\t'icon-lg': 'nt:size-9'\n\t\t\t}\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tvariant: 'default',\n\t\t\tsize: 'default'\n\t\t}\n\t}\n);\n\nfunction Button({\n\tclassName,\n\tvariant = 'default',\n\tsize = 'default',\n\tasChild = false,\n\t...props\n}: React.ComponentProps<'button'> &\n\tVariantProps<typeof buttonVariants> & {\n\t\tasChild?: boolean;\n\t}) {\n\tconst Comp = asChild ? Slot.Root : 'button';\n\n\treturn (\n\t\t<Comp\n\t\t\tclassName={cn(buttonVariants({ variant, size, className }))}\n\t\t\tdata-size={size}\n\t\t\tdata-slot=\"button\"\n\t\t\tdata-variant={variant}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Button, buttonVariants };\n"],"mappings":"AAyDE;AAzDF,SAAS,WAA8B;AACvC,SAAS,YAAY;AAGrB,SAAS,UAAU;AAEnB,MAAM,iBAAiB;AAAA,EACtB;AAAA,EACA;AAAA,IACC,UAAU;AAAA,MACT,SAAS;AAAA,QACR,SACC;AAAA,QACD,SACC;AAAA,QACD,WACC;AAAA,QACD,OACC;AAAA,QACD,aACC;AAAA,QACD,MAAM;AAAA,MACP;AAAA,MACA,MAAM;AAAA,QACL,SACC;AAAA,QACD,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,MAAM;AAAA,QACN,WACC;AAAA,QACD,WACC;AAAA,QACD,WAAW;AAAA,MACZ;AAAA,IACD;AAAA,IACA,iBAAiB;AAAA,MAChB,SAAS;AAAA,MACT,MAAM;AAAA,IACP;AAAA,EACD;AACD;AAEA,SAAS,OAAO;AAAA,EACf;AAAA,EACA,UAAU;AAAA,EACV,OAAO;AAAA,EACP,UAAU;AAAA,EACV,GAAG;AACJ,GAGI;AACH,QAAM,OAAO,UAAU,KAAK,OAAO;AAEnC,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAW,GAAG,eAAe,EAAE,SAAS,MAAM,UAAU,CAAC,CAAC;AAAA,MAC1D,aAAW;AAAA,MACX,aAAU;AAAA,MACV,gBAAc;AAAA,MACb,GAAG;AAAA;AAAA,EACL;AAEF;","names":[]}
|