@a2v2ai/uikit 0.0.1
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/Alert/Alert.d.ts +11 -0
- package/Alert/Alert.js +64 -0
- package/AlertDialog/AlertDialog.d.ts +35 -0
- package/AlertDialog/AlertDialog.js +121 -0
- package/Avatar/Avatar.d.ts +12 -0
- package/Avatar/Avatar.js +64 -0
- package/Badge/Badge.d.ts +9 -0
- package/Badge/Badge.js +26 -0
- package/Breadcrumb/Breadcrumb.d.ts +19 -0
- package/Breadcrumb/Breadcrumb.js +65 -0
- package/Button/Button.d.ts +14 -0
- package/Button/Button.js +75 -0
- package/Calendar/Calendar.d.ts +16 -0
- package/Calendar/Calendar.js +113 -0
- package/Card/Card.d.ts +14 -0
- package/Card/Card.js +70 -0
- package/ChatBubble/ChatBubble.d.ts +29 -0
- package/ChatBubble/ChatBubble.js +133 -0
- package/Checkbox/Checkbox.d.ts +10 -0
- package/Checkbox/Checkbox.js +57 -0
- package/Dialog/Dialog.d.ts +35 -0
- package/Dialog/Dialog.js +130 -0
- package/Drawer/Drawer.d.ts +31 -0
- package/Drawer/Drawer.js +69 -0
- package/DropdownMenu/DropdownMenu.d.ts +27 -0
- package/DropdownMenu/DropdownMenu.js +85 -0
- package/ErrorMessage/ErrorMessage.d.ts +27 -0
- package/ErrorMessage/ErrorMessage.js +15 -0
- package/Flex/Flex.d.ts +23 -0
- package/Flex/Flex.js +101 -0
- package/IconButton/IconButton.d.ts +17 -0
- package/IconButton/IconButton.js +85 -0
- package/Input/Input.d.ts +16 -0
- package/Input/Input.js +75 -0
- package/InputOTP/InputOTP.d.ts +18 -0
- package/InputOTP/InputOTP.js +85 -0
- package/Label/Label.d.ts +10 -0
- package/Label/Label.js +57 -0
- package/Loader/Loader.d.ts +18 -0
- package/Loader/Loader.js +67 -0
- package/Popover/Popover.d.ts +7 -0
- package/Popover/Popover.js +49 -0
- package/Progress/Progress.d.ts +13 -0
- package/Progress/Progress.js +71 -0
- package/README.md +183 -0
- package/RadioGroup/RadioGroup.d.ts +11 -0
- package/RadioGroup/RadioGroup.js +64 -0
- package/ScrollArea/ScrollArea.d.ts +5 -0
- package/ScrollArea/ScrollArea.js +48 -0
- package/Select/Select.d.ts +19 -0
- package/Select/Select.js +85 -0
- package/Separator/Separator.d.ts +4 -0
- package/Separator/Separator.js +43 -0
- package/Skeleton/Skeleton.d.ts +4 -0
- package/Skeleton/Skeleton.js +8 -0
- package/Spinner/Spinner.d.ts +15 -0
- package/Spinner/Spinner.js +68 -0
- package/Switch/Switch.d.ts +10 -0
- package/Switch/Switch.js +67 -0
- package/Tabs/Tabs.d.ts +13 -0
- package/Tabs/Tabs.js +64 -0
- package/Textarea/Textarea.d.ts +10 -0
- package/Textarea/Textarea.js +64 -0
- package/Toast/Toast.d.ts +10 -0
- package/Toast/Toast.js +29 -0
- package/Tooltip/Tooltip.d.ts +15 -0
- package/Tooltip/Tooltip.js +68 -0
- package/Typography/Typography.d.ts +15 -0
- package/Typography/Typography.js +125 -0
- package/helpers.d.ts +4 -0
- package/helpers.js +13 -0
- package/icons.d.ts +1 -0
- package/icons.js +18 -0
- package/index.css +127 -0
- package/index.d.ts +35 -0
- package/index.js +183 -0
- package/lib/utils.d.ts +3 -0
- package/lib/utils.js +18 -0
- package/package.json +29 -0
package/Drawer/Drawer.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.drawerOverlayVariants = exports.drawerContentVariants = void 0;
|
|
4
|
+
exports.Drawer = Drawer;
|
|
5
|
+
exports.DrawerPortal = DrawerPortal;
|
|
6
|
+
exports.DrawerOverlay = DrawerOverlay;
|
|
7
|
+
exports.DrawerTrigger = DrawerTrigger;
|
|
8
|
+
exports.DrawerClose = DrawerClose;
|
|
9
|
+
exports.DrawerContent = DrawerContent;
|
|
10
|
+
exports.DrawerHeader = DrawerHeader;
|
|
11
|
+
exports.DrawerFooter = DrawerFooter;
|
|
12
|
+
exports.DrawerBody = DrawerBody;
|
|
13
|
+
exports.DrawerTitle = DrawerTitle;
|
|
14
|
+
exports.DrawerDescription = DrawerDescription;
|
|
15
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
const vaul_1 = require("vaul");
|
|
17
|
+
const class_variance_authority_1 = require("class-variance-authority");
|
|
18
|
+
const Loader_1 = require("../Loader/Loader");
|
|
19
|
+
const utils_1 = require("../lib/utils");
|
|
20
|
+
const drawerContentVariants = (0, class_variance_authority_1.cva)("group/drawer-content fixed z-50 flex h-auto flex-col bg-white", {
|
|
21
|
+
variants: {
|
|
22
|
+
direction: {
|
|
23
|
+
bottom: "inset-x-0 bottom-0 mt-24 max-h-[80vh] rounded-t-[10px]",
|
|
24
|
+
top: "inset-x-0 top-0 mb-24 max-h-[80vh] rounded-b-[10px]",
|
|
25
|
+
left: "inset-y-0 left-0 w-3/4 sm:max-w-sm rounded-r-[10px]",
|
|
26
|
+
right: "inset-y-0 right-0 w-3/4 sm:max-w-sm rounded-l-[10px]",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: {
|
|
30
|
+
direction: "bottom",
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
exports.drawerContentVariants = drawerContentVariants;
|
|
34
|
+
const drawerOverlayVariants = (0, class_variance_authority_1.cva)("fixed inset-0 z-50 bg-black/60 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0");
|
|
35
|
+
exports.drawerOverlayVariants = drawerOverlayVariants;
|
|
36
|
+
function Drawer({ direction = "bottom", dismissible = true, ...props }) {
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)(vaul_1.Drawer.Root, { direction: direction, dismissible: dismissible, ...props }));
|
|
38
|
+
}
|
|
39
|
+
function DrawerTrigger({ ...props }) {
|
|
40
|
+
return (0, jsx_runtime_1.jsx)(vaul_1.Drawer.Trigger, { ...props });
|
|
41
|
+
}
|
|
42
|
+
function DrawerPortal({ ...props }) {
|
|
43
|
+
return (0, jsx_runtime_1.jsx)(vaul_1.Drawer.Portal, { ...props });
|
|
44
|
+
}
|
|
45
|
+
function DrawerClose({ ...props }) {
|
|
46
|
+
return (0, jsx_runtime_1.jsx)(vaul_1.Drawer.Close, { ...props });
|
|
47
|
+
}
|
|
48
|
+
function DrawerOverlay({ className, ...props }) {
|
|
49
|
+
return ((0, jsx_runtime_1.jsx)(vaul_1.Drawer.Overlay, { className: (0, utils_1.cn)(drawerOverlayVariants(), className), ...props }));
|
|
50
|
+
}
|
|
51
|
+
function DrawerContent({ className, children, direction = "bottom", showHandle = true, loading = false, ...props }) {
|
|
52
|
+
const isVertical = direction === "bottom" || direction === "top";
|
|
53
|
+
return ((0, jsx_runtime_1.jsxs)(DrawerPortal, { children: [(0, jsx_runtime_1.jsx)(DrawerOverlay, {}), (0, jsx_runtime_1.jsxs)(vaul_1.Drawer.Content, { className: (0, utils_1.cn)(drawerContentVariants({ direction }), "shadow-lg", className), ...props, children: [showHandle && isVertical && ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("mx-auto shrink-0 rounded-full bg-neutral-200", direction === "bottom" ? "mt-2 mb-4" : "mb-2 mt-4", "h-[3px] w-[50px]") })), loading ? ((0, jsx_runtime_1.jsx)("div", { className: "flex flex-1 items-center justify-center p-8", children: (0, jsx_runtime_1.jsx)(Loader_1.Loader, { size: "large", color: "grey" }) })) : (children)] })] }));
|
|
54
|
+
}
|
|
55
|
+
function DrawerHeader({ className, ...props }) {
|
|
56
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("flex flex-col gap-1.5 p-4 text-center sm:text-left", className), ...props }));
|
|
57
|
+
}
|
|
58
|
+
function DrawerFooter({ className, ...props }) {
|
|
59
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("mt-auto flex flex-col gap-2 p-4", className), ...props }));
|
|
60
|
+
}
|
|
61
|
+
function DrawerBody({ className, ...props }) {
|
|
62
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: (0, utils_1.cn)("flex-1 overflow-auto p-4", className), ...props }));
|
|
63
|
+
}
|
|
64
|
+
function DrawerTitle({ className, ...props }) {
|
|
65
|
+
return ((0, jsx_runtime_1.jsx)(vaul_1.Drawer.Title, { className: (0, utils_1.cn)("text-lg font-semibold text-neutral-900", className), ...props }));
|
|
66
|
+
}
|
|
67
|
+
function DrawerDescription({ className, ...props }) {
|
|
68
|
+
return ((0, jsx_runtime_1.jsx)(vaul_1.Drawer.Description, { className: (0, utils_1.cn)("text-sm text-neutral-500", className), ...props }));
|
|
69
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
3
|
+
declare const DropdownMenu: React.FC<DropdownMenuPrimitive.DropdownMenuProps>;
|
|
4
|
+
declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
declare const DropdownMenuGroup: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
declare const DropdownMenuPortal: React.FC<DropdownMenuPrimitive.DropdownMenuPortalProps>;
|
|
7
|
+
declare const DropdownMenuSub: React.FC<DropdownMenuPrimitive.DropdownMenuSubProps>;
|
|
8
|
+
declare const DropdownMenuRadioGroup: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
declare const DropdownMenuSubTrigger: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSubTriggerProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
10
|
+
inset?: boolean;
|
|
11
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
declare const DropdownMenuSubContent: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSubContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
declare const DropdownMenuContent: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
declare const DropdownMenuItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
15
|
+
inset?: boolean;
|
|
16
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
+
declare const DropdownMenuCheckboxItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
18
|
+
declare const DropdownMenuRadioItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuRadioItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
declare const DropdownMenuLabel: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
20
|
+
inset?: boolean;
|
|
21
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
22
|
+
declare const DropdownMenuSeparator: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
23
|
+
declare const DropdownMenuShortcut: {
|
|
24
|
+
({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
displayName: string;
|
|
26
|
+
};
|
|
27
|
+
export { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuGroup, DropdownMenuPortal, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuRadioGroup, };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.DropdownMenuRadioGroup = exports.DropdownMenuSubTrigger = exports.DropdownMenuSubContent = exports.DropdownMenuSub = exports.DropdownMenuPortal = exports.DropdownMenuGroup = exports.DropdownMenuShortcut = exports.DropdownMenuSeparator = exports.DropdownMenuLabel = exports.DropdownMenuRadioItem = exports.DropdownMenuCheckboxItem = exports.DropdownMenuItem = exports.DropdownMenuContent = exports.DropdownMenuTrigger = exports.DropdownMenu = void 0;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const React = __importStar(require("react"));
|
|
39
|
+
const DropdownMenuPrimitive = __importStar(require("@radix-ui/react-dropdown-menu"));
|
|
40
|
+
const lucide_react_1 = require("lucide-react");
|
|
41
|
+
const utils_1 = require("../lib/utils");
|
|
42
|
+
const DropdownMenu = DropdownMenuPrimitive.Root;
|
|
43
|
+
exports.DropdownMenu = DropdownMenu;
|
|
44
|
+
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
45
|
+
exports.DropdownMenuTrigger = DropdownMenuTrigger;
|
|
46
|
+
const DropdownMenuGroup = DropdownMenuPrimitive.Group;
|
|
47
|
+
exports.DropdownMenuGroup = DropdownMenuGroup;
|
|
48
|
+
const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
|
|
49
|
+
exports.DropdownMenuPortal = DropdownMenuPortal;
|
|
50
|
+
const DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
51
|
+
exports.DropdownMenuSub = DropdownMenuSub;
|
|
52
|
+
const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
53
|
+
exports.DropdownMenuRadioGroup = DropdownMenuRadioGroup;
|
|
54
|
+
const DropdownMenuSubTrigger = React.forwardRef(({ className, inset, children, ...props }, ref) => ((0, jsx_runtime_1.jsxs)(DropdownMenuPrimitive.SubTrigger, { ref: ref, className: (0, utils_1.cn)("flex cursor-default select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none focus:bg-grey-100 data-[state=open]:bg-grey-100 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", inset && "pl-8", className), ...props, children: [children, (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, { className: "ml-auto" })] })));
|
|
55
|
+
exports.DropdownMenuSubTrigger = DropdownMenuSubTrigger;
|
|
56
|
+
DropdownMenuSubTrigger.displayName =
|
|
57
|
+
DropdownMenuPrimitive.SubTrigger.displayName;
|
|
58
|
+
const DropdownMenuSubContent = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.SubContent, { ref: ref, className: (0, utils_1.cn)("z-50 min-w-[8rem] overflow-hidden rounded-lg border border-grey-200 bg-white p-1 text-main-950 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className), ...props })));
|
|
59
|
+
exports.DropdownMenuSubContent = DropdownMenuSubContent;
|
|
60
|
+
DropdownMenuSubContent.displayName =
|
|
61
|
+
DropdownMenuPrimitive.SubContent.displayName;
|
|
62
|
+
const DropdownMenuContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => ((0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.Portal, { children: (0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.Content, { ref: ref, sideOffset: sideOffset, className: (0, utils_1.cn)("z-50 min-w-[8rem] overflow-hidden rounded-lg border border-grey-200 bg-white p-1 text-main-950 shadow-md", "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className), ...props }) })));
|
|
63
|
+
exports.DropdownMenuContent = DropdownMenuContent;
|
|
64
|
+
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
65
|
+
const DropdownMenuItem = React.forwardRef(({ className, inset, ...props }, ref) => ((0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.Item, { ref: ref, className: (0, utils_1.cn)("relative flex cursor-default select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none transition-colors focus:bg-grey-100 focus:text-main-950 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0", inset && "pl-8", className), ...props })));
|
|
66
|
+
exports.DropdownMenuItem = DropdownMenuItem;
|
|
67
|
+
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
68
|
+
const DropdownMenuCheckboxItem = React.forwardRef(({ className, children, checked, ...props }, ref) => ((0, jsx_runtime_1.jsxs)(DropdownMenuPrimitive.CheckboxItem, { ref: ref, className: (0, utils_1.cn)("relative flex cursor-default select-none items-center rounded-md py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-grey-100 focus:text-main-950 data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className), checked: checked, ...props, children: [(0, jsx_runtime_1.jsx)("span", { className: "absolute left-2 flex size-3.5 items-center justify-center", children: (0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.ItemIndicator, { children: (0, jsx_runtime_1.jsx)(lucide_react_1.Check, { className: "size-4" }) }) }), children] })));
|
|
69
|
+
exports.DropdownMenuCheckboxItem = DropdownMenuCheckboxItem;
|
|
70
|
+
DropdownMenuCheckboxItem.displayName =
|
|
71
|
+
DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
72
|
+
const DropdownMenuRadioItem = React.forwardRef(({ className, children, ...props }, ref) => ((0, jsx_runtime_1.jsxs)(DropdownMenuPrimitive.RadioItem, { ref: ref, className: (0, utils_1.cn)("relative flex cursor-default select-none items-center rounded-md py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-grey-100 focus:text-main-950 data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className), ...props, children: [(0, jsx_runtime_1.jsx)("span", { className: "absolute left-2 flex size-3.5 items-center justify-center", children: (0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.ItemIndicator, { children: (0, jsx_runtime_1.jsx)(lucide_react_1.Circle, { className: "size-2 fill-current" }) }) }), children] })));
|
|
73
|
+
exports.DropdownMenuRadioItem = DropdownMenuRadioItem;
|
|
74
|
+
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
75
|
+
const DropdownMenuLabel = React.forwardRef(({ className, inset, ...props }, ref) => ((0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.Label, { ref: ref, className: (0, utils_1.cn)("px-2 py-1.5 text-sm font-semibold text-main-950", inset && "pl-8", className), ...props })));
|
|
76
|
+
exports.DropdownMenuLabel = DropdownMenuLabel;
|
|
77
|
+
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
78
|
+
const DropdownMenuSeparator = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.Separator, { ref: ref, className: (0, utils_1.cn)("-mx-1 my-1 h-px bg-grey-100", className), ...props })));
|
|
79
|
+
exports.DropdownMenuSeparator = DropdownMenuSeparator;
|
|
80
|
+
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
81
|
+
const DropdownMenuShortcut = ({ className, ...props }) => {
|
|
82
|
+
return ((0, jsx_runtime_1.jsx)("span", { className: (0, utils_1.cn)("ml-auto text-xs tracking-widest text-grey-400", className), ...props }));
|
|
83
|
+
};
|
|
84
|
+
exports.DropdownMenuShortcut = DropdownMenuShortcut;
|
|
85
|
+
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type TypographyColor } from "../Typography/Typography";
|
|
3
|
+
export interface ErrorMessageProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, "color"> {
|
|
4
|
+
/**
|
|
5
|
+
* The field name to check for errors
|
|
6
|
+
*/
|
|
7
|
+
name: string;
|
|
8
|
+
/**
|
|
9
|
+
* Object containing error messages keyed by field name
|
|
10
|
+
*/
|
|
11
|
+
errors: Record<string, string | undefined>;
|
|
12
|
+
/**
|
|
13
|
+
* Optional object containing touched state keyed by field name
|
|
14
|
+
* If provided, error is only shown when field is touched
|
|
15
|
+
*/
|
|
16
|
+
touched?: Record<string, boolean | undefined>;
|
|
17
|
+
/**
|
|
18
|
+
* Color variant for the error message
|
|
19
|
+
* @default "error-600"
|
|
20
|
+
*/
|
|
21
|
+
color?: TypographyColor;
|
|
22
|
+
}
|
|
23
|
+
declare function ErrorMessage({ name, errors, touched, className, color, ...props }: ErrorMessageProps): import("react/jsx-runtime").JSX.Element | null;
|
|
24
|
+
declare namespace ErrorMessage {
|
|
25
|
+
var displayName: string;
|
|
26
|
+
}
|
|
27
|
+
export { ErrorMessage };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ErrorMessage = ErrorMessage;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const Typography_1 = require("../Typography/Typography");
|
|
6
|
+
const utils_1 = require("../lib/utils");
|
|
7
|
+
function ErrorMessage({ name, errors, touched, className, color = "error-600", ...props }) {
|
|
8
|
+
const hasError = errors && typeof errors[name] === "string";
|
|
9
|
+
const shouldShow = touched ? hasError && touched[name] : hasError;
|
|
10
|
+
if (!shouldShow) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)(Typography_1.Typography, { variant: "caption", color: color, className: (0, utils_1.cn)("mt-1", className), ...props, children: errors[name] }));
|
|
14
|
+
}
|
|
15
|
+
ErrorMessage.displayName = "ErrorMessage";
|
package/Flex/Flex.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const flexVariants: (props?: ({
|
|
4
|
+
direction?: "row" | "column" | "row-reverse" | "column-reverse" | null | undefined;
|
|
5
|
+
align?: "center" | "start" | "end" | "stretch" | "baseline" | null | undefined;
|
|
6
|
+
justify?: "center" | "start" | "end" | "between" | "around" | "evenly" | null | undefined;
|
|
7
|
+
wrap?: "wrap" | "nowrap" | "wrap-reverse" | null | undefined;
|
|
8
|
+
gap?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 16 | 20 | 24 | 32 | 40 | 48 | null | undefined;
|
|
9
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
10
|
+
type FlexProps = React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof flexVariants> & {
|
|
11
|
+
as?: React.ElementType;
|
|
12
|
+
};
|
|
13
|
+
declare const Flex: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
14
|
+
direction?: "row" | "column" | "row-reverse" | "column-reverse" | null | undefined;
|
|
15
|
+
align?: "center" | "start" | "end" | "stretch" | "baseline" | null | undefined;
|
|
16
|
+
justify?: "center" | "start" | "end" | "between" | "around" | "evenly" | null | undefined;
|
|
17
|
+
wrap?: "wrap" | "nowrap" | "wrap-reverse" | null | undefined;
|
|
18
|
+
gap?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 16 | 20 | 24 | 32 | 40 | 48 | null | undefined;
|
|
19
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string> & {
|
|
20
|
+
as?: React.ElementType;
|
|
21
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
22
|
+
export { Flex, flexVariants };
|
|
23
|
+
export type { FlexProps };
|
package/Flex/Flex.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.flexVariants = exports.Flex = void 0;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const React = __importStar(require("react"));
|
|
39
|
+
const class_variance_authority_1 = require("class-variance-authority");
|
|
40
|
+
const utils_1 = require("../lib/utils");
|
|
41
|
+
const flexVariants = (0, class_variance_authority_1.cva)("flex", {
|
|
42
|
+
variants: {
|
|
43
|
+
direction: {
|
|
44
|
+
row: "flex-row",
|
|
45
|
+
column: "flex-col",
|
|
46
|
+
"row-reverse": "flex-row-reverse",
|
|
47
|
+
"column-reverse": "flex-col-reverse",
|
|
48
|
+
},
|
|
49
|
+
align: {
|
|
50
|
+
start: "items-start",
|
|
51
|
+
center: "items-center",
|
|
52
|
+
end: "items-end",
|
|
53
|
+
stretch: "items-stretch",
|
|
54
|
+
baseline: "items-baseline",
|
|
55
|
+
},
|
|
56
|
+
justify: {
|
|
57
|
+
start: "justify-start",
|
|
58
|
+
center: "justify-center",
|
|
59
|
+
end: "justify-end",
|
|
60
|
+
between: "justify-between",
|
|
61
|
+
around: "justify-around",
|
|
62
|
+
evenly: "justify-evenly",
|
|
63
|
+
},
|
|
64
|
+
wrap: {
|
|
65
|
+
nowrap: "flex-nowrap",
|
|
66
|
+
wrap: "flex-wrap",
|
|
67
|
+
"wrap-reverse": "flex-wrap-reverse",
|
|
68
|
+
},
|
|
69
|
+
gap: {
|
|
70
|
+
0: "gap-0",
|
|
71
|
+
1: "gap-1",
|
|
72
|
+
2: "gap-2",
|
|
73
|
+
3: "gap-3",
|
|
74
|
+
4: "gap-4",
|
|
75
|
+
5: "gap-5",
|
|
76
|
+
6: "gap-6",
|
|
77
|
+
8: "gap-8",
|
|
78
|
+
10: "gap-10",
|
|
79
|
+
12: "gap-12",
|
|
80
|
+
16: "gap-16",
|
|
81
|
+
20: "gap-20",
|
|
82
|
+
24: "gap-24",
|
|
83
|
+
32: "gap-32",
|
|
84
|
+
40: "gap-40",
|
|
85
|
+
48: "gap-48",
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
defaultVariants: {
|
|
89
|
+
direction: "row",
|
|
90
|
+
align: "stretch",
|
|
91
|
+
justify: "start",
|
|
92
|
+
wrap: "nowrap",
|
|
93
|
+
gap: 0,
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
exports.flexVariants = flexVariants;
|
|
97
|
+
const Flex = React.forwardRef(({ className, direction, align, justify, wrap, gap, as: Component = "div", ...props }, ref) => {
|
|
98
|
+
return ((0, jsx_runtime_1.jsx)(Component, { ref: ref, className: (0, utils_1.cn)(flexVariants({ direction, align, justify, wrap, gap, className })), ...props }));
|
|
99
|
+
});
|
|
100
|
+
exports.Flex = Flex;
|
|
101
|
+
Flex.displayName = "Flex";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const iconButtonVariants: (props?: ({
|
|
4
|
+
variant?: "secondary" | "outline" | "primary" | "ghost" | null | undefined;
|
|
5
|
+
size?: "small" | "regular" | "large" | "mini" | null | undefined;
|
|
6
|
+
roundness?: "default" | "round" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
8
|
+
export interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof iconButtonVariants> {
|
|
9
|
+
/** Use the Slot component to render a different element */
|
|
10
|
+
asChild?: boolean;
|
|
11
|
+
/** The icon to render inside the button */
|
|
12
|
+
icon?: React.ReactNode;
|
|
13
|
+
/** Accessible label for screen readers */
|
|
14
|
+
"aria-label": string;
|
|
15
|
+
}
|
|
16
|
+
declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
17
|
+
export { IconButton, iconButtonVariants };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.iconButtonVariants = exports.IconButton = void 0;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const React = __importStar(require("react"));
|
|
39
|
+
const react_slot_1 = require("@radix-ui/react-slot");
|
|
40
|
+
const class_variance_authority_1 = require("class-variance-authority");
|
|
41
|
+
const utils_1 = require("../lib/utils");
|
|
42
|
+
const iconButtonVariants = (0, class_variance_authority_1.cva)("inline-flex items-center justify-center shrink-0 cursor-pointer transition-colors focus-visible:outline-none focus-visible:shadow-[0_0_0_3px_#d4d4d4] disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed [&_svg]:pointer-events-none [&_svg]:shrink-0", {
|
|
43
|
+
variants: {
|
|
44
|
+
variant: {
|
|
45
|
+
primary: "bg-main-950 text-main-50 hover:bg-main-800",
|
|
46
|
+
secondary: "bg-main-100 text-main-950 hover:bg-main-200",
|
|
47
|
+
outline: "border border-main-300 bg-transparent text-main-950 hover:bg-main-100",
|
|
48
|
+
ghost: "bg-transparent text-main-600 hover:bg-main-100 hover:text-main-950",
|
|
49
|
+
},
|
|
50
|
+
size: {
|
|
51
|
+
mini: "size-6 [&_svg]:size-3",
|
|
52
|
+
small: "size-8 [&_svg]:size-4",
|
|
53
|
+
regular: "size-9 [&_svg]:size-4",
|
|
54
|
+
large: "size-10 [&_svg]:size-5",
|
|
55
|
+
},
|
|
56
|
+
roundness: {
|
|
57
|
+
default: "rounded-lg",
|
|
58
|
+
round: "rounded-full",
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
compoundVariants: [
|
|
62
|
+
{
|
|
63
|
+
size: "mini",
|
|
64
|
+
roundness: "default",
|
|
65
|
+
className: "rounded-md",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
size: "small",
|
|
69
|
+
roundness: "default",
|
|
70
|
+
className: "rounded-md",
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
defaultVariants: {
|
|
74
|
+
variant: "primary",
|
|
75
|
+
size: "regular",
|
|
76
|
+
roundness: "default",
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
exports.iconButtonVariants = iconButtonVariants;
|
|
80
|
+
const IconButton = React.forwardRef(({ className, variant, size, roundness, asChild = false, icon, children, ...props }, ref) => {
|
|
81
|
+
const Comp = asChild ? react_slot_1.Slot : "button";
|
|
82
|
+
return ((0, jsx_runtime_1.jsx)(Comp, { className: (0, utils_1.cn)(iconButtonVariants({ variant, size, roundness, className })), ref: ref, ...props, children: icon || children }));
|
|
83
|
+
});
|
|
84
|
+
exports.IconButton = IconButton;
|
|
85
|
+
IconButton.displayName = "IconButton";
|
package/Input/Input.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const inputVariants: (props?: ({
|
|
4
|
+
size?: "small" | "regular" | "large" | "mini" | null | undefined;
|
|
5
|
+
roundness?: "default" | "round" | null | undefined;
|
|
6
|
+
variant?: "default" | "error" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
8
|
+
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size">, VariantProps<typeof inputVariants> {
|
|
9
|
+
leftIcon?: React.ReactNode;
|
|
10
|
+
rightIcon?: React.ReactNode;
|
|
11
|
+
leftAddon?: React.ReactNode;
|
|
12
|
+
rightAddon?: React.ReactNode;
|
|
13
|
+
rightElement?: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
16
|
+
export { Input, inputVariants };
|
package/Input/Input.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.inputVariants = exports.Input = void 0;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const React = __importStar(require("react"));
|
|
39
|
+
const class_variance_authority_1 = require("class-variance-authority");
|
|
40
|
+
const utils_1 = require("../lib/utils");
|
|
41
|
+
const inputVariants = (0, class_variance_authority_1.cva)("flex w-full bg-white border font-normal font-sans transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-grey-400 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:bg-grey-50", {
|
|
42
|
+
variants: {
|
|
43
|
+
size: {
|
|
44
|
+
mini: "h-6 px-3 text-xs rounded-md",
|
|
45
|
+
small: "h-8 px-3 text-sm rounded-md",
|
|
46
|
+
regular: "h-9 px-3 text-sm rounded-lg",
|
|
47
|
+
large: "h-10 px-3 text-base rounded-lg",
|
|
48
|
+
},
|
|
49
|
+
roundness: {
|
|
50
|
+
default: "",
|
|
51
|
+
round: "!rounded-full",
|
|
52
|
+
},
|
|
53
|
+
variant: {
|
|
54
|
+
default: "border-grey-300 focus-visible:border-grey-300 focus-visible:ring-[3px] focus-visible:ring-grey-300/50",
|
|
55
|
+
error: "border-error-500 focus-visible:border-error-500 focus-visible:ring-[3px] focus-visible:ring-error-200",
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
defaultVariants: {
|
|
59
|
+
size: "regular",
|
|
60
|
+
roundness: "default",
|
|
61
|
+
variant: "default",
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
exports.inputVariants = inputVariants;
|
|
65
|
+
const Input = React.forwardRef(({ className, type = "text", size, roundness, variant, leftIcon, rightIcon, leftAddon, rightAddon, rightElement, ...props }, ref) => {
|
|
66
|
+
const hasAddons = leftIcon || rightIcon || leftAddon || rightAddon || rightElement;
|
|
67
|
+
if (hasAddons) {
|
|
68
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, utils_1.cn)("flex items-center gap-2 bg-white border font-sans transition-colors", "focus-within:ring-[3px]", variant === "error"
|
|
69
|
+
? "border-error-500 focus-within:border-error-500 focus-within:ring-error-200"
|
|
70
|
+
: "border-grey-300 focus-within:border-grey-300 focus-within:ring-grey-300/50", size === "mini" && "h-6 pl-3 pr-0.5 text-xs rounded-md", size === "small" && "h-8 pl-3 pr-0.5 text-sm rounded-md", size === "regular" && "h-9 pl-3 pr-0.5 text-sm rounded-lg", size === "large" && "h-10 pl-3 pr-0.5 text-base rounded-lg", !size && "h-9 pl-3 pr-0.5 text-sm rounded-lg", !rightElement && "pr-3", roundness === "round" && "!rounded-full", props.disabled && "opacity-50 cursor-not-allowed bg-grey-50", className), children: [leftIcon && ((0, jsx_runtime_1.jsx)("span", { className: "shrink-0 text-grey-500 [&_svg]:size-4", children: leftIcon })), leftAddon && ((0, jsx_runtime_1.jsx)("span", { className: "shrink-0 text-grey-500", children: leftAddon })), (0, jsx_runtime_1.jsx)("input", { type: type, className: (0, utils_1.cn)("flex-1 min-w-0 bg-transparent border-0 outline-none placeholder:text-grey-400", "disabled:cursor-not-allowed"), ref: ref, ...props }), rightAddon && ((0, jsx_runtime_1.jsx)("span", { className: "shrink-0 text-grey-500", children: rightAddon })), rightIcon && ((0, jsx_runtime_1.jsx)("span", { className: "shrink-0 text-grey-500 [&_svg]:size-4", children: rightIcon })), rightElement && ((0, jsx_runtime_1.jsx)("span", { className: "shrink-0", children: rightElement }))] }));
|
|
71
|
+
}
|
|
72
|
+
return ((0, jsx_runtime_1.jsx)("input", { type: type, className: (0, utils_1.cn)(inputVariants({ size, roundness, variant, className })), ref: ref, ...props }));
|
|
73
|
+
});
|
|
74
|
+
exports.Input = Input;
|
|
75
|
+
Input.displayName = "Input";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { OTPInput } from "input-otp";
|
|
3
|
+
import { type VariantProps } from "class-variance-authority";
|
|
4
|
+
declare const inputOTPVariants: (props?: ({} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
5
|
+
export interface InputOTPProps extends Omit<React.ComponentPropsWithoutRef<typeof OTPInput>, "render"> {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
declare const InputOTP: React.ForwardRefExoticComponent<InputOTPProps & React.RefAttributes<HTMLInputElement>>;
|
|
9
|
+
declare const InputOTPGroup: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
declare const inputOTPSlotVariants: (props?: ({
|
|
11
|
+
slotSize?: "default" | "sm" | "lg" | null | undefined;
|
|
12
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
13
|
+
export interface InputOTPSlotProps extends React.ComponentPropsWithoutRef<"div">, VariantProps<typeof inputOTPSlotVariants> {
|
|
14
|
+
index: number;
|
|
15
|
+
}
|
|
16
|
+
declare const InputOTPSlot: React.ForwardRefExoticComponent<InputOTPSlotProps & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
+
declare const InputOTPSeparator: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
18
|
+
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator, inputOTPVariants, inputOTPSlotVariants, };
|