mtxuilib 0.1.338 → 0.1.340

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.
@@ -8,10 +8,12 @@ export declare const iconVariants: (props?: ({
8
8
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
9
9
  export declare const Icons: {
10
10
  X: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
11
+ reload: import("react").ForwardRefExoticComponent<import("@radix-ui/react-icons/dist/types").IconProps & import("react").RefAttributes<SVGSVGElement>>;
11
12
  tasks: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
12
13
  boxes: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
13
14
  add: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
14
15
  plus: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
16
+ save: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
15
17
  messageSquare: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
16
18
  alignCenter: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
17
19
  alignJustify: import("react").ForwardRefExoticComponent<Omit<LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { cva } from "class-variance-authority";
3
- import { AlertTriangle, AlignCenter, AlignJustify, AlignLeft, AlignRight, ArrowLeft, ArrowRight, Baseline, Bell, Bold, Boxes, Bug, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronsUpDown, ClipboardCheck, Code2, Combine, Copy, CreditCard, DownloadCloud, Edit2, ExternalLink, Eye, File, FileCode, FileText, Film, GripVertical, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, HelpCircle, Highlighter, Image, Indent, Italic, Keyboard, Laptop, LayoutDashboard, Link2, Link2Off, List, ListOrdered, Loader2, MailX, Menu, MessageSquare, MessageSquarePlus, Minus, Moon, MoreHorizontal, MoreVertical, Outdent, PaintBucket, Paperclip, PenLine, PenTool, Pilcrow, Pizza, Plus, Quote, RectangleHorizontal, RectangleVertical, RotateCcw, Search, SeparatorHorizontal, Settings, Smile, SquareIcon, Star, Strikethrough, Subscript, SunMedium, Superscript, Table, Terminal, Text, Trash, Underline, Ungroup, User, Verified, WrapText, X, } from "lucide-react";
3
+ import { AlertTriangle, AlignCenter, AlignJustify, AlignLeft, AlignRight, ArrowLeft, ArrowRight, Baseline, Bell, Bold, Boxes, Bug, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronsUpDown, ClipboardCheck, Code2, Combine, Copy, CreditCard, DownloadCloud, Edit2, ExternalLink, Eye, File, FileCode, FileText, Film, GripVertical, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, HelpCircle, Highlighter, Image, Indent, Italic, Keyboard, Laptop, LayoutDashboard, Link2, Link2Off, List, ListOrdered, Loader2, MailX, Menu, MessageSquare, MessageSquarePlus, Minus, Moon, MoreHorizontal, MoreVertical, Outdent, PaintBucket, Paperclip, PenLine, PenTool, Pilcrow, Pizza, Plus, Quote, RectangleHorizontal, RectangleVertical, RotateCcw, Save, Search, SeparatorHorizontal, Settings, Smile, SquareIcon, Star, Strikethrough, Subscript, SunMedium, Superscript, Table, Terminal, Text, Trash, Underline, Ungroup, User, Verified, WrapText, X, } from "lucide-react";
4
+ import { ReloadIcon } from "@radix-ui/react-icons";
4
5
  export const iconVariants = cva("", {
5
6
  variants: {
6
7
  variant: {
@@ -22,10 +23,12 @@ const borderRight = (props) => (_jsx("svg", { viewBox: "0 0 24 24", height: "48"
22
23
  const borderTop = (props) => (_jsx("svg", { viewBox: "0 0 24 24", height: "48", width: "48", focusable: "false", role: "img", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: _jsx("path", { d: "M3 6a1 1 0 0 0 2 0 1 1 0 0 1 1-1h12a1 1 0 0 1 1 1 1 1 0 1 0 2 0 3 3 0 0 0-3-3H6a3 3 0 0 0-3 3zm2 5a1 1 0 1 0-2 0v2a1 1 0 1 0 2 0v-2zm14 0a1 1 0 1 1 2 0v2a1 1 0 1 1-2 0v-2zm-5 9a1 1 0 0 1-1 1h-2a1 1 0 1 1 0-2h2a1 1 0 0 1 1 1zm-8 1a1 1 0 1 0 0-2 1 1 0 0 1-1-1 1 1 0 1 0-2 0 3 3 0 0 0 3 3zm11-1a1 1 0 0 0 1 1 3 3 0 0 0 3-3 1 1 0 1 0-2 0 1 1 0 0 1-1 1 1 1 0 0 0-1 1z" }) }));
23
24
  export const Icons = {
24
25
  X,
26
+ reload: ReloadIcon,
25
27
  tasks: Boxes,
26
28
  boxes: Boxes,
27
29
  add: Plus,
28
30
  plus: Plus,
31
+ save: Save,
29
32
  messageSquare: MessageSquare,
30
33
  alignCenter: AlignCenter,
31
34
  alignJustify: AlignJustify,
@@ -1 +1,5 @@
1
- export declare const MtButton: import("react").ForwardRefExoticComponent<import("../button").ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
1
+ import { type ButtonProps } from "../button";
2
+ interface MtButtonProps extends ButtonProps {
3
+ }
4
+ export declare const MtButton: (props: MtButtonProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -1,2 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
1
2
  import { Button } from "../button";
2
- export const MtButton = Button;
3
+ export const MtButton = (props) => {
4
+ const { children, ...rest } = props;
5
+ return _jsx(Button, { ...rest, children: children });
6
+ };
@@ -0,0 +1,2 @@
1
+ import { type InputProps } from "../../input";
2
+ export declare const TagsInput: (props: InputProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,39 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { useFormContext } from "react-hook-form";
5
+ import { Input } from "../../input";
6
+ export const TagsInput = (props) => {
7
+ const { name, placeholder } = props;
8
+ if (!name)
9
+ throw new Error("require field name @ TagsInput");
10
+ const form = useFormContext();
11
+ const [tags, setTags] = useState([]);
12
+ const [inputValue, setInputValue] = useState("");
13
+ const handleInputChange = (e) => {
14
+ setInputValue(e.target.value);
15
+ };
16
+ const handleInputKeyDown = (e) => {
17
+ if (e.key === "Enter" || e.key === " ") {
18
+ e.preventDefault();
19
+ addTag();
20
+ }
21
+ };
22
+ const addTag = () => {
23
+ const trimmedInput = inputValue.trim();
24
+ if (trimmedInput && !tags.includes(trimmedInput)) {
25
+ const newTags = [...tags, trimmedInput];
26
+ setTags(newTags);
27
+ setInputValue("");
28
+ form.setValue(name, newTags);
29
+ }
30
+ else {
31
+ setInputValue("");
32
+ }
33
+ };
34
+ const removeTag = (indexToRemove) => {
35
+ setTags(tags.filter((_, index) => index !== indexToRemove));
36
+ form.setValue(name, tags.filter((_, index) => index !== indexToRemove));
37
+ };
38
+ return (_jsx("div", { className: "flex flex-col space-y-2", children: _jsxs("div", { className: "flex flex-wrap gap-2 p-2 bg-white border border-gray-300 rounded-md", children: [tags.map((tag, index) => (_jsxs("div", { className: "flex items-center bg-blue-100 text-blue-800 text-sm font-medium px-2 py-1 rounded-full", children: [tag, _jsx("button", { type: "button", onClick: () => removeTag(index), className: "ml-1 text-blue-600 hover:text-blue-800 focus:outline-none", children: "\u00D7" })] }, index))), _jsx(Input, { type: "text", value: inputValue, onChange: handleInputChange, onKeyDown: handleInputKeyDown, onBlur: addTag, placeholder: placeholder || "Type and press Enter or Space to add tags", className: "flex-grow min-w-[120px] border-none focus:ring-0" })] }) }));
39
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mtxuilib",
3
3
  "private": false,
4
- "version": "0.1.338",
4
+ "version": "0.1.340",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -1 +0,0 @@
1
- export { Slot } from "@radix-ui/react-slot";
@@ -1 +0,0 @@
1
- export { Slot } from "@radix-ui/react-slot";