@namehash/namehash-ui 1.8.1 → 1.10.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/dist/components/legacy/index.cjs +155 -0
- package/dist/components/legacy/index.cjs.map +1 -0
- package/dist/components/legacy/index.css +1603 -0
- package/dist/components/legacy/index.css.map +1 -0
- package/dist/components/legacy/index.d.cts +35 -0
- package/dist/components/legacy/index.d.ts +35 -0
- package/dist/components/legacy/index.js +122 -0
- package/dist/components/legacy/index.js.map +1 -0
- package/dist/index.cjs +16 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +207 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/package.json +10 -5
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/components/legacy/index.ts
|
|
31
|
+
var legacy_exports = {};
|
|
32
|
+
__export(legacy_exports, {
|
|
33
|
+
DEFAULT_MAX_TOOLTIP_WIDTH: () => DEFAULT_MAX_TOOLTIP_WIDTH,
|
|
34
|
+
DEFAULT_TOOLTIP_PLACEMENT: () => DEFAULT_TOOLTIP_PLACEMENT,
|
|
35
|
+
Tooltip: () => Tooltip,
|
|
36
|
+
TooltipPlacement: () => TooltipPlacement,
|
|
37
|
+
legacyButtonVariants: () => legacyButtonVariants,
|
|
38
|
+
legacyLinkVariants: () => legacyLinkVariants
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(legacy_exports);
|
|
41
|
+
|
|
42
|
+
// src/components/legacy/buttonVariants.ts
|
|
43
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
44
|
+
var legacyButtonVariants = (0, import_class_variance_authority.cva)(
|
|
45
|
+
"nhui:relative nhui:transition nhui:text-base nhui:rounded-md nhui:border nhui:font-medium nhui:inline-flex nhui:gap-2 nhui:items-center nhui:whitespace-nowrap nhui:no-underline nhui:disabled:opacity-50",
|
|
46
|
+
{
|
|
47
|
+
variants: {
|
|
48
|
+
variant: {
|
|
49
|
+
primary: "nhui:bg-black nhui:text-white nhui:border-black nhui:hover:bg-[#272727]",
|
|
50
|
+
secondary: "nhui:bg-white nhui:text-black nhui:border-[#DBDBDB] nhui:shadow-[0_1px_2px_0_rgba(0,0,0,0.05)] nhui:hover:bg-gray-50",
|
|
51
|
+
ghost: "nhui:text-black nhui:border-transparent nhui:hover:bg-black/5"
|
|
52
|
+
},
|
|
53
|
+
size: {
|
|
54
|
+
small: "nhui:py-1 nhui:px-2 nhui:text-sm",
|
|
55
|
+
medium: "nhui:py-2 nhui:px-4",
|
|
56
|
+
large: "nhui:py-3 nhui:px-6 nhui:text-lg"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
defaultVariants: {
|
|
60
|
+
variant: "primary",
|
|
61
|
+
size: "medium"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
// src/components/legacy/linkVariants.ts
|
|
67
|
+
var import_class_variance_authority2 = require("class-variance-authority");
|
|
68
|
+
var legacyLinkVariants = (0, import_class_variance_authority2.cva)("nhui:transition nhui:cursor-pointer", {
|
|
69
|
+
variants: {
|
|
70
|
+
variant: {
|
|
71
|
+
primary: "nhui:text-current nhui:underline nhui:decoration-transparent nhui:hover:decoration-current nhui:sm:underline-offset-[4px] nhui:sm:transition-all nhui:sm:duration-200 nhui:sm:hover:underline-offset-[2px]",
|
|
72
|
+
secondary: "nhui:text-gray-500 nhui:hover:text-black",
|
|
73
|
+
underline: "nhui:text-current nhui:underline nhui:decoration-current nhui:underline-offset-[4px] nhui:transition-all nhui:duration-200 nhui:hover:underline-offset-[2px]"
|
|
74
|
+
},
|
|
75
|
+
size: {
|
|
76
|
+
xsmall: "nhui:text-xs",
|
|
77
|
+
small: "nhui:text-sm",
|
|
78
|
+
medium: "nhui:text-base",
|
|
79
|
+
large: "nhui:text-lg"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
defaultVariants: {
|
|
83
|
+
variant: "primary",
|
|
84
|
+
size: "medium"
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// src/components/legacy/Tooltip.tsx
|
|
89
|
+
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
|
|
90
|
+
var React = __toESM(require("react"), 1);
|
|
91
|
+
var import_react = require("react");
|
|
92
|
+
|
|
93
|
+
// src/utils/cn.ts
|
|
94
|
+
var import_clsx = require("clsx");
|
|
95
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
96
|
+
function cn(...inputs) {
|
|
97
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// src/components/legacy/Tooltip.tsx
|
|
101
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
102
|
+
var DEFAULT_MAX_TOOLTIP_WIDTH = 400;
|
|
103
|
+
var TooltipPlacement = {
|
|
104
|
+
Top: "top",
|
|
105
|
+
Right: "right",
|
|
106
|
+
Bottom: "bottom",
|
|
107
|
+
Left: "left"
|
|
108
|
+
};
|
|
109
|
+
var DEFAULT_TOOLTIP_PLACEMENT = TooltipPlacement.Top;
|
|
110
|
+
function Tooltip({
|
|
111
|
+
trigger,
|
|
112
|
+
children,
|
|
113
|
+
placement = DEFAULT_TOOLTIP_PLACEMENT,
|
|
114
|
+
maxTooltipWidth = DEFAULT_MAX_TOOLTIP_WIDTH,
|
|
115
|
+
className,
|
|
116
|
+
withDelay = false,
|
|
117
|
+
sideOffset = 15,
|
|
118
|
+
collisionPadding = 6,
|
|
119
|
+
avoidCollisions = true,
|
|
120
|
+
...props
|
|
121
|
+
}) {
|
|
122
|
+
const triggerNode = React.isValidElement(trigger) && trigger.type !== React.Fragment ? trigger : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: trigger });
|
|
123
|
+
const [open, setOpen] = (0, import_react.useState)(false);
|
|
124
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipPrimitive.Provider, { delayDuration: withDelay ? 300 : 0, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipPrimitive.Root, { open, onOpenChange: setOpen, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: cn("nhui:flex nhui:items-center", className), children: [
|
|
125
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipPrimitive.Trigger, { onClick: () => setOpen(true), asChild: true, children: triggerNode }),
|
|
126
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
127
|
+
TooltipPrimitive.Content,
|
|
128
|
+
{
|
|
129
|
+
side: placement,
|
|
130
|
+
sideOffset,
|
|
131
|
+
collisionPadding,
|
|
132
|
+
avoidCollisions,
|
|
133
|
+
className: cn(
|
|
134
|
+
"nhui:z-50 nhui:rounded-md nhui:bg-black nhui:outline-none",
|
|
135
|
+
"nhui:origin-(--radix-tooltip-content-transform-origin)",
|
|
136
|
+
"nhui:transition-opacity nhui:duration-300",
|
|
137
|
+
"nhui:data-[state=delayed-open]:animate-in nhui:data-[state=closed]:animate-out",
|
|
138
|
+
"nhui:data-[state=closed]:duration-200",
|
|
139
|
+
"nhui:data-[state=closed]:fade-out-0 nhui:data-[state=delayed-open]:fade-in-0",
|
|
140
|
+
"nhui:data-[side=top]:slide-in-from-bottom-1",
|
|
141
|
+
"nhui:data-[side=right]:slide-in-from-left-1",
|
|
142
|
+
"nhui:data-[side=bottom]:slide-in-from-top-1",
|
|
143
|
+
"nhui:data-[side=left]:slide-in-from-right-1"
|
|
144
|
+
),
|
|
145
|
+
style: { maxWidth: maxTooltipWidth },
|
|
146
|
+
...props,
|
|
147
|
+
children: [
|
|
148
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipPrimitive.Arrow, { className: "nhui:z-50 nhui:size-2.5 nhui:translate-y-[calc(-50%_-_2px)] nhui:rotate-45 nhui:rounded-[2px] nhui:bg-black nhui:fill-black" }),
|
|
149
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "nhui:relative nhui:z-10 nhui:h-full nhui:rounded-md nhui:px-4 nhui:py-2 nhui:text-sm nhui:font-medium nhui:text-white", children })
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
) })
|
|
153
|
+
] }) }) });
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/legacy/index.ts","../../../src/components/legacy/buttonVariants.ts","../../../src/components/legacy/linkVariants.ts","../../../src/components/legacy/Tooltip.tsx","../../../src/utils/cn.ts"],"sourcesContent":["import \"../../styles.css\";\n\nexport * from \"./buttonVariants\";\nexport * from \"./linkVariants\";\nexport * from \"./Tooltip\";\n","import { cva } from \"class-variance-authority\";\n\nexport const legacyButtonVariants = cva(\n \"nhui:relative nhui:transition nhui:text-base nhui:rounded-md nhui:border nhui:font-medium nhui:inline-flex nhui:gap-2 nhui:items-center nhui:whitespace-nowrap nhui:no-underline nhui:disabled:opacity-50\",\n {\n variants: {\n variant: {\n primary: \"nhui:bg-black nhui:text-white nhui:border-black nhui:hover:bg-[#272727]\",\n secondary:\n \"nhui:bg-white nhui:text-black nhui:border-[#DBDBDB] nhui:shadow-[0_1px_2px_0_rgba(0,0,0,0.05)] nhui:hover:bg-gray-50\",\n ghost: \"nhui:text-black nhui:border-transparent nhui:hover:bg-black/5\",\n },\n size: {\n small: \"nhui:py-1 nhui:px-2 nhui:text-sm\",\n medium: \"nhui:py-2 nhui:px-4\",\n large: \"nhui:py-3 nhui:px-6 nhui:text-lg\",\n },\n },\n defaultVariants: {\n variant: \"primary\",\n size: \"medium\",\n },\n },\n);\n","import { cva } from \"class-variance-authority\";\n\nexport const legacyLinkVariants = cva(\"nhui:transition nhui:cursor-pointer\", {\n variants: {\n variant: {\n primary:\n \"nhui:text-current nhui:underline nhui:decoration-transparent nhui:hover:decoration-current nhui:sm:underline-offset-[4px] nhui:sm:transition-all nhui:sm:duration-200 nhui:sm:hover:underline-offset-[2px]\",\n secondary: \"nhui:text-gray-500 nhui:hover:text-black\",\n underline:\n \"nhui:text-current nhui:underline nhui:decoration-current nhui:underline-offset-[4px] nhui:transition-all nhui:duration-200 nhui:hover:underline-offset-[2px]\",\n },\n size: {\n xsmall: \"nhui:text-xs\",\n small: \"nhui:text-sm\",\n medium: \"nhui:text-base\",\n large: \"nhui:text-lg\",\n },\n },\n defaultVariants: {\n variant: \"primary\",\n size: \"medium\",\n },\n});\n","import * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\nimport * as React from \"react\";\nimport { useState } from \"react\";\n\nimport { cn } from \"../../utils/cn\";\n\ntype Props = {\n trigger: React.ReactNode;\n children: React.ReactNode;\n placement?: TooltipPlacement;\n maxTooltipWidth?: number;\n className?: string;\n withDelay?: boolean;\n} & Omit<\n React.ComponentProps<typeof TooltipPrimitive.Content>,\n \"children\" | \"side\" | \"style\" | \"className\"\n>;\n\nexport const DEFAULT_MAX_TOOLTIP_WIDTH = 400;\n\nexport const TooltipPlacement = {\n Top: \"top\",\n Right: \"right\",\n Bottom: \"bottom\",\n Left: \"left\",\n} as const;\n\nexport type TooltipPlacement = (typeof TooltipPlacement)[keyof typeof TooltipPlacement];\n\nexport const DEFAULT_TOOLTIP_PLACEMENT = TooltipPlacement.Top;\n\nexport function Tooltip({\n trigger,\n children,\n placement = DEFAULT_TOOLTIP_PLACEMENT,\n maxTooltipWidth = DEFAULT_MAX_TOOLTIP_WIDTH,\n className,\n withDelay = false,\n sideOffset = 15,\n collisionPadding = 6,\n avoidCollisions = true,\n ...props\n}: Props) {\n const triggerNode =\n React.isValidElement(trigger) && trigger.type !== React.Fragment ? (\n trigger\n ) : (\n <span>{trigger}</span>\n );\n const [open, setOpen] = useState(false);\n\n return (\n <TooltipPrimitive.Provider delayDuration={withDelay ? 300 : 0}>\n <TooltipPrimitive.Root open={open} onOpenChange={setOpen}>\n <div className={cn(\"nhui:flex nhui:items-center\", className)}>\n <TooltipPrimitive.Trigger onClick={() => setOpen(true)} asChild>\n {triggerNode}\n </TooltipPrimitive.Trigger>\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n side={placement}\n sideOffset={sideOffset}\n collisionPadding={collisionPadding}\n avoidCollisions={avoidCollisions}\n className={cn(\n \"nhui:z-50 nhui:rounded-md nhui:bg-black nhui:outline-none\",\n \"nhui:origin-(--radix-tooltip-content-transform-origin)\",\n \"nhui:transition-opacity nhui:duration-300\",\n \"nhui:data-[state=delayed-open]:animate-in nhui:data-[state=closed]:animate-out\",\n \"nhui:data-[state=closed]:duration-200\",\n \"nhui:data-[state=closed]:fade-out-0 nhui:data-[state=delayed-open]:fade-in-0\",\n \"nhui:data-[side=top]:slide-in-from-bottom-1\",\n \"nhui:data-[side=right]:slide-in-from-left-1\",\n \"nhui:data-[side=bottom]:slide-in-from-top-1\",\n \"nhui:data-[side=left]:slide-in-from-right-1\",\n )}\n style={{ maxWidth: maxTooltipWidth }}\n {...props}\n >\n <TooltipPrimitive.Arrow className=\"nhui:z-50 nhui:size-2.5 nhui:translate-y-[calc(-50%_-_2px)] nhui:rotate-45 nhui:rounded-[2px] nhui:bg-black nhui:fill-black\" />\n <div className=\"nhui:relative nhui:z-10 nhui:h-full nhui:rounded-md nhui:px-4 nhui:py-2 nhui:text-sm nhui:font-medium nhui:text-white\">\n {children}\n </div>\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n </div>\n </TooltipPrimitive.Root>\n </TooltipPrimitive.Provider>\n );\n}\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,sCAAoB;AAEb,IAAM,2BAAuB;AAAA,EAClC;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,WACE;AAAA,QACF,OAAO;AAAA,MACT;AAAA,MACA,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