@luxfi/ui 5.5.3 → 5.6.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/accordion.cjs +213 -0
- package/dist/accordion.js +186 -0
- package/dist/alert.cjs +553 -0
- package/dist/alert.js +531 -0
- package/dist/avatar.cjs +149 -0
- package/dist/avatar.js +125 -0
- package/dist/badge.cjs +611 -0
- package/dist/badge.js +589 -0
- package/dist/button.cjs +689 -0
- package/dist/button.js +664 -0
- package/dist/checkbox.cjs +265 -0
- package/dist/checkbox.js +241 -0
- package/dist/close-button.cjs +73 -0
- package/dist/close-button.js +51 -0
- package/dist/collapsible.cjs +702 -0
- package/dist/collapsible.js +679 -0
- package/dist/color-mode.cjs +96 -0
- package/dist/color-mode.js +72 -0
- package/dist/dialog.cjs +279 -0
- package/dist/dialog.js +246 -0
- package/dist/drawer.cjs +207 -0
- package/dist/drawer.js +175 -0
- package/dist/empty-state.cjs +93 -0
- package/dist/empty-state.js +71 -0
- package/dist/field.cjs +183 -0
- package/dist/field.js +160 -0
- package/dist/heading.cjs +46 -0
- package/dist/heading.js +40 -0
- package/dist/icon-button.cjs +491 -0
- package/dist/icon-button.js +470 -0
- package/dist/image.cjs +572 -0
- package/dist/image.js +551 -0
- package/dist/index.cjs +5779 -0
- package/dist/index.js +5619 -0
- package/dist/input-group.cjs +155 -0
- package/dist/input-group.js +133 -0
- package/dist/input.cjs +65 -0
- package/dist/input.js +59 -0
- package/dist/link.cjs +630 -0
- package/dist/link.js +606 -0
- package/dist/menu.cjs +305 -0
- package/dist/menu.js +269 -0
- package/dist/pin-input.cjs +182 -0
- package/dist/pin-input.js +160 -0
- package/dist/popover.cjs +327 -0
- package/dist/popover.js +294 -0
- package/dist/progress-circle.cjs +152 -0
- package/dist/progress-circle.js +128 -0
- package/dist/progress.cjs +117 -0
- package/dist/progress.js +94 -0
- package/dist/provider.cjs +62 -0
- package/dist/provider.js +40 -0
- package/dist/radio.cjs +177 -0
- package/dist/radio.js +153 -0
- package/dist/rating.cjs +80 -0
- package/dist/rating.js +58 -0
- package/dist/select.cjs +791 -0
- package/dist/select.js +757 -0
- package/dist/separator.cjs +57 -0
- package/dist/separator.js +51 -0
- package/dist/skeleton.cjs +370 -0
- package/dist/skeleton.js +346 -0
- package/dist/slider.cjs +138 -0
- package/dist/slider.js +115 -0
- package/dist/switch.cjs +163 -0
- package/dist/switch.js +140 -0
- package/dist/table.cjs +1044 -0
- package/dist/table.js +1013 -0
- package/dist/tabs.cjs +240 -0
- package/dist/tabs.js +213 -0
- package/dist/tag.cjs +651 -0
- package/dist/tag.js +628 -0
- package/dist/textarea.cjs +65 -0
- package/dist/textarea.js +59 -0
- package/dist/toaster.cjs +99 -0
- package/dist/toaster.js +96 -0
- package/dist/tooltip.cjs +171 -0
- package/dist/tooltip.js +148 -0
- package/dist/utils.cjs +11 -0
- package/dist/utils.js +9 -0
- package/package.json +270 -65
- package/src/accordion.tsx +285 -0
- package/src/alert.tsx +221 -0
- package/src/avatar.tsx +174 -0
- package/src/badge.tsx +158 -0
- package/src/button.tsx +411 -0
- package/src/checkbox.tsx +307 -0
- package/src/close-button.tsx +51 -0
- package/src/collapsible.tsx +126 -0
- package/src/color-mode.tsx +125 -0
- package/src/dialog.tsx +356 -0
- package/src/drawer.tsx +186 -0
- package/src/empty-state.tsx +97 -0
- package/src/field.tsx +202 -0
- package/src/heading.tsx +55 -0
- package/src/icon-button.tsx +192 -0
- package/src/image.tsx +280 -0
- package/src/index.ts +192 -0
- package/src/input-group.tsx +159 -0
- package/src/input.tsx +60 -0
- package/src/link.tsx +326 -0
- package/src/menu.tsx +471 -0
- package/src/pin-input.tsx +187 -0
- package/src/popover.tsx +400 -0
- package/src/progress-circle.tsx +180 -0
- package/src/progress.tsx +109 -0
- package/src/provider.tsx +12 -0
- package/src/radio.tsx +175 -0
- package/src/rating.tsx +79 -0
- package/src/select.tsx +696 -0
- package/src/separator.tsx +59 -0
- package/src/skeleton.tsx +302 -0
- package/src/slider.tsx +152 -0
- package/src/switch.tsx +158 -0
- package/src/table.tsx +621 -0
- package/src/tabs.tsx +354 -0
- package/src/tag.tsx +159 -0
- package/src/textarea.tsx +60 -0
- package/src/toaster.tsx +117 -0
- package/src/tokens.css +438 -0
- package/src/tooltip.tsx +184 -0
- package/src/utils/cn.ts +7 -0
- package/src/utils.ts +6 -0
- package/tokens.css +438 -0
- package/commerce/ui/conf.ts +0 -13
- package/commerce/ui/context.tsx +0 -123
- package/commerce/ui/store.ts +0 -295
- package/components/access-code-input.tsx +0 -71
- package/components/analytics.tsx +0 -23
- package/components/auth/auth-listener.tsx +0 -29
- package/components/auth/auth-token/clear-auth-token.tsx +0 -12
- package/components/auth/auth-token/set-auth-token.tsx +0 -16
- package/components/auth/common-auth-domains.ts +0 -17
- package/components/auth/login-panel.tsx +0 -111
- package/components/auth/mobile-login-button.tsx +0 -107
- package/components/auth/signup-panel.tsx +0 -113
- package/components/back-button.tsx +0 -49
- package/components/chat-widget.tsx +0 -85
- package/components/commerce/bag-button.tsx +0 -98
- package/components/commerce/buy-button.tsx +0 -34
- package/components/commerce/checkout-button.tsx +0 -129
- package/components/commerce/checkout-panel/cart-accordian.tsx +0 -66
- package/components/commerce/checkout-panel/checkout-panel-props.ts +0 -10
- package/components/commerce/checkout-panel/desktop-bag-carousel.tsx +0 -36
- package/components/commerce/checkout-panel/desktop-cp.tsx +0 -83
- package/components/commerce/checkout-panel/index.tsx +0 -126
- package/components/commerce/checkout-panel/mobile-cp.tsx +0 -67
- package/components/commerce/checkout-panel/policy-links.tsx +0 -29
- package/components/commerce/checkout-panel/steps-indicator.tsx +0 -39
- package/components/commerce/checkout-panel/thank-you.tsx +0 -18
- package/components/commerce/desktop-bag-popup.tsx +0 -78
- package/components/commerce/drawer/index.tsx +0 -88
- package/components/commerce/drawer/micro.tsx +0 -145
- package/components/commerce/drawer/shell.tsx +0 -85
- package/components/contact-dialog/contact-form.tsx +0 -116
- package/components/contact-dialog/disclaimer.tsx +0 -13
- package/components/contact-dialog/index.tsx +0 -64
- package/components/copyright.tsx +0 -21
- package/components/drawer-margin.tsx +0 -28
- package/components/footer.tsx +0 -78
- package/components/header/desktop-nav-menu.tsx +0 -204
- package/components/header/desktop.tsx +0 -65
- package/components/header/index.tsx +0 -50
- package/components/header/mobile-bag-drawer.tsx +0 -51
- package/components/header/mobile-menu-toggle-button.tsx +0 -35
- package/components/header/mobile-nav-menu-ai.tsx +0 -51
- package/components/header/mobile-nav-menu-item.tsx +0 -47
- package/components/header/mobile-nav-menu.tsx +0 -102
- package/components/header/mobile.tsx +0 -170
- package/components/header/theme-toggle.tsx +0 -26
- package/components/icons/avatar.tsx +0 -11
- package/components/icons/bag-icon.tsx +0 -10
- package/components/icons/index.ts +0 -6
- package/components/icons/left-arrow.tsx +0 -11
- package/components/icons/lux-logo.tsx +0 -10
- package/components/icons/right-arrow.tsx +0 -10
- package/components/icons/social-icon.tsx +0 -35
- package/components/icons/social-svg.css +0 -3
- package/components/index.ts +0 -26
- package/components/logo.tsx +0 -92
- package/components/main.tsx +0 -27
- package/components/mini-chart/index.tsx +0 -8
- package/components/mini-chart/mini-chart-props.ts +0 -44
- package/components/mini-chart/mini-chart.tsx +0 -85
- package/components/mini-chart/wrapper.tsx +0 -23
- package/components/not-found/index.tsx +0 -28
- package/components/not-found/not-found-content.mdx +0 -5
- package/components/tooltip.tsx +0 -31
- package/environment.d.ts +0 -6
- package/next/analytics/fpixel.ts +0 -16
- package/next/analytics/google-analytics.ts +0 -14
- package/next/analytics/index.ts +0 -3
- package/next/analytics/pixel-analytics.tsx +0 -55
- package/next/font/get-app-router-font-classes.ts +0 -17
- package/next/font/load-and-return-lux-next-fonts-on-import.ts +0 -68
- package/next/font/local/Druk-Wide-Bold.ttf +0 -0
- package/next/font/local/Druk-Wide-Medium.ttf +0 -0
- package/next/font/local/InterVariable-Italic.ttf +0 -0
- package/next/font/local/InterVariable-Italic.woff2 +0 -0
- package/next/font/local/InterVariable.ttf +0 -0
- package/next/font/local/InterVariable.woff2 +0 -0
- package/next/font/next-font-desc.ts +0 -28
- package/next/font/pages-router-font-vars.tsx +0 -18
- package/next/head-metadata/from-next/metadata-types.ts +0 -158
- package/next/head-metadata/from-next/opengraph-types.ts +0 -267
- package/next/head-metadata/from-next/twitter-types.ts +0 -92
- package/next/head-metadata/index.tsx +0 -208
- package/next/index.ts +0 -2
- package/next/middleware/determine-device-mw.ts +0 -29
- package/root-layout/WHY_THIS_IS_SEPARATE.txt +0 -2
- package/root-layout/index.tsx +0 -112
- package/site-def/footer/community.tsx +0 -61
- package/site-def/footer/company.ts +0 -37
- package/site-def/footer/ecosystem.ts +0 -37
- package/site-def/footer/index.tsx +0 -26
- package/site-def/footer/legal.ts +0 -28
- package/site-def/footer/network.ts +0 -45
- package/site-def/footer/svg/warpcast-logo.svg +0 -12
- package/site-def/index.ts +0 -4
- package/site-def/main-nav.tsx +0 -460
- package/style/cart-animation.css +0 -29
- package/style/checkout-animation.css +0 -23
- package/style/drawer-handle-overrides.css +0 -160
- package/style/fonts/COPY_TO_PUBLIC_FOR_NON_NEXT.txt +0 -0
- package/style/fonts/Druk-Wide-Bold.ttf +0 -0
- package/style/fonts/Druk-Wide-Medium.ttf +0 -0
- package/style/fonts/InterVariable-Italic.ttf +0 -0
- package/style/fonts/InterVariable-Italic.woff2 +0 -0
- package/style/fonts/InterVariable.ttf +0 -0
- package/style/fonts/InterVariable.woff2 +0 -0
- package/style/lux-colors.css +0 -85
- package/style/lux-fonts.css +0 -30
- package/style/lux-global-non-next.css +0 -52
- package/style/lux-global.css +0 -51
- package/tailwind/fontFamily.tailwind.lux.ts +0 -18
- package/tailwind/index.ts +0 -2
- package/tailwind/lux-tw-fonts.ts +0 -40
- package/tailwind/tailwind.config.lux-preset.ts +0 -10
- package/tsconfig.json +0 -15
- package/types/chatbot-config.ts +0 -7
- package/types/chatbot-suggested-question.ts +0 -7
- package/types/contact-info.ts +0 -11
- package/types/index.ts +0 -4
- package/types/site-def.ts +0 -46
package/dist/textarea.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cva } from 'class-variance-authority';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { clsx } from 'clsx';
|
|
5
|
+
import { twMerge } from 'tailwind-merge';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
// src/textarea.tsx
|
|
9
|
+
function cn(...inputs) {
|
|
10
|
+
return twMerge(clsx(inputs));
|
|
11
|
+
}
|
|
12
|
+
var textareaVariants = cva(
|
|
13
|
+
[
|
|
14
|
+
"w-full appearance-none outline-none transition-colors resize-y",
|
|
15
|
+
"bg-[var(--color-input-bg)] text-[var(--color-input-fg)] border-[var(--color-input-border)]",
|
|
16
|
+
"placeholder:text-[var(--color-input-placeholder,theme(colors.gray.400))]",
|
|
17
|
+
"hover:border-[var(--color-input-border-hover,theme(colors.gray.400))]",
|
|
18
|
+
"focus:border-[var(--color-input-border-focus,theme(colors.blue.500))]",
|
|
19
|
+
"focus:placeholder:text-[var(--color-input-placeholder-focus,theme(colors.gray.300))]",
|
|
20
|
+
"disabled:opacity-40 disabled:cursor-not-allowed",
|
|
21
|
+
"read-only:opacity-70",
|
|
22
|
+
"data-[invalid]:border-[var(--color-input-border-invalid,theme(colors.red.500))]"
|
|
23
|
+
].join(" "),
|
|
24
|
+
{
|
|
25
|
+
variants: {
|
|
26
|
+
size: {
|
|
27
|
+
xs: "px-2 py-1 text-xs rounded",
|
|
28
|
+
sm: "px-3 py-2 text-sm rounded-md",
|
|
29
|
+
md: "px-4 py-2 text-base rounded-md",
|
|
30
|
+
lg: "px-4 py-3 text-lg rounded-lg",
|
|
31
|
+
"2xl": "px-4 py-3 text-xl rounded-lg"
|
|
32
|
+
},
|
|
33
|
+
variant: {
|
|
34
|
+
outline: "border border-solid",
|
|
35
|
+
filled: "border-0 bg-[var(--color-input-filled-bg,theme(colors.gray.100))]",
|
|
36
|
+
unstyled: "border-0 bg-transparent p-0"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
defaultVariants: {
|
|
40
|
+
size: "md",
|
|
41
|
+
variant: "outline"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
var Textarea = React.forwardRef(
|
|
46
|
+
({ size, variant, className, ...rest }, ref) => {
|
|
47
|
+
return /* @__PURE__ */ jsx(
|
|
48
|
+
"textarea",
|
|
49
|
+
{
|
|
50
|
+
ref,
|
|
51
|
+
className: cn(textareaVariants({ size, variant }), className),
|
|
52
|
+
...rest
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
Textarea.displayName = "Textarea";
|
|
58
|
+
|
|
59
|
+
export { Textarea };
|
package/dist/toaster.cjs
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var sonner = require('sonner');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
|
|
7
|
+
var SECOND = 1e3;
|
|
8
|
+
var DURATION = 10 * SECOND;
|
|
9
|
+
function mapOptions(opts) {
|
|
10
|
+
const external = {
|
|
11
|
+
id: opts.id,
|
|
12
|
+
description: opts.description,
|
|
13
|
+
duration: opts.duration
|
|
14
|
+
};
|
|
15
|
+
if (opts.action) {
|
|
16
|
+
external.action = {
|
|
17
|
+
label: opts.action.label,
|
|
18
|
+
onClick: opts.action.onClick
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
if (opts.onStatusChange) {
|
|
22
|
+
const cb = opts.onStatusChange;
|
|
23
|
+
external.onDismiss = () => cb({ status: "unmounted" });
|
|
24
|
+
external.onAutoClose = () => cb({ status: "unmounted" });
|
|
25
|
+
}
|
|
26
|
+
return external;
|
|
27
|
+
}
|
|
28
|
+
function create(opts) {
|
|
29
|
+
const external = mapOptions(opts);
|
|
30
|
+
const title = opts.title ?? "";
|
|
31
|
+
switch (opts.type) {
|
|
32
|
+
case "success":
|
|
33
|
+
return sonner.toast.success(title, external);
|
|
34
|
+
case "error":
|
|
35
|
+
return sonner.toast.error(title, external);
|
|
36
|
+
case "warning":
|
|
37
|
+
return sonner.toast.warning(title, external);
|
|
38
|
+
case "loading":
|
|
39
|
+
return sonner.toast.loading(title, external);
|
|
40
|
+
case "info":
|
|
41
|
+
default:
|
|
42
|
+
return sonner.toast.info(title, external);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function update(id, opts) {
|
|
46
|
+
const title = opts.title ?? "";
|
|
47
|
+
const external = mapOptions({ ...opts, id });
|
|
48
|
+
switch (opts.type) {
|
|
49
|
+
case "success":
|
|
50
|
+
sonner.toast.success(title, external);
|
|
51
|
+
break;
|
|
52
|
+
case "error":
|
|
53
|
+
sonner.toast.error(title, external);
|
|
54
|
+
break;
|
|
55
|
+
case "warning":
|
|
56
|
+
sonner.toast.warning(title, external);
|
|
57
|
+
break;
|
|
58
|
+
case "loading":
|
|
59
|
+
sonner.toast.loading(title, external);
|
|
60
|
+
break;
|
|
61
|
+
case "info":
|
|
62
|
+
default:
|
|
63
|
+
sonner.toast.info(title, external);
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
var toaster = {
|
|
68
|
+
create,
|
|
69
|
+
success: (opts) => create({ ...opts, type: "success" }),
|
|
70
|
+
error: (opts) => create({ ...opts, type: "error" }),
|
|
71
|
+
loading: (opts) => create({ ...opts, type: "loading" }),
|
|
72
|
+
update,
|
|
73
|
+
remove: (id) => sonner.toast.dismiss(id)
|
|
74
|
+
};
|
|
75
|
+
var Toaster = () => {
|
|
76
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
77
|
+
sonner.Toaster,
|
|
78
|
+
{
|
|
79
|
+
position: "top-right",
|
|
80
|
+
richColors: true,
|
|
81
|
+
closeButton: true,
|
|
82
|
+
duration: DURATION,
|
|
83
|
+
offset: { top: 12, right: 12, bottom: 12, left: 12 },
|
|
84
|
+
mobileOffset: { top: 16, right: 16, bottom: 16, left: 16 },
|
|
85
|
+
toastOptions: {
|
|
86
|
+
className: "font-sans",
|
|
87
|
+
style: {
|
|
88
|
+
fontFamily: 'var(--font-sans, "Geist", sans-serif)',
|
|
89
|
+
color: "var(--color-text-primary)",
|
|
90
|
+
backgroundColor: "var(--color-bg-primary)",
|
|
91
|
+
borderColor: "var(--color-border-divider)"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
exports.Toaster = Toaster;
|
|
99
|
+
exports.toaster = toaster;
|
package/dist/toaster.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { toast, Toaster as Toaster$1 } from 'sonner';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
var SECOND = 1e3;
|
|
6
|
+
var DURATION = 10 * SECOND;
|
|
7
|
+
function mapOptions(opts) {
|
|
8
|
+
const external = {
|
|
9
|
+
id: opts.id,
|
|
10
|
+
description: opts.description,
|
|
11
|
+
duration: opts.duration
|
|
12
|
+
};
|
|
13
|
+
if (opts.action) {
|
|
14
|
+
external.action = {
|
|
15
|
+
label: opts.action.label,
|
|
16
|
+
onClick: opts.action.onClick
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
if (opts.onStatusChange) {
|
|
20
|
+
const cb = opts.onStatusChange;
|
|
21
|
+
external.onDismiss = () => cb({ status: "unmounted" });
|
|
22
|
+
external.onAutoClose = () => cb({ status: "unmounted" });
|
|
23
|
+
}
|
|
24
|
+
return external;
|
|
25
|
+
}
|
|
26
|
+
function create(opts) {
|
|
27
|
+
const external = mapOptions(opts);
|
|
28
|
+
const title = opts.title ?? "";
|
|
29
|
+
switch (opts.type) {
|
|
30
|
+
case "success":
|
|
31
|
+
return toast.success(title, external);
|
|
32
|
+
case "error":
|
|
33
|
+
return toast.error(title, external);
|
|
34
|
+
case "warning":
|
|
35
|
+
return toast.warning(title, external);
|
|
36
|
+
case "loading":
|
|
37
|
+
return toast.loading(title, external);
|
|
38
|
+
case "info":
|
|
39
|
+
default:
|
|
40
|
+
return toast.info(title, external);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function update(id, opts) {
|
|
44
|
+
const title = opts.title ?? "";
|
|
45
|
+
const external = mapOptions({ ...opts, id });
|
|
46
|
+
switch (opts.type) {
|
|
47
|
+
case "success":
|
|
48
|
+
toast.success(title, external);
|
|
49
|
+
break;
|
|
50
|
+
case "error":
|
|
51
|
+
toast.error(title, external);
|
|
52
|
+
break;
|
|
53
|
+
case "warning":
|
|
54
|
+
toast.warning(title, external);
|
|
55
|
+
break;
|
|
56
|
+
case "loading":
|
|
57
|
+
toast.loading(title, external);
|
|
58
|
+
break;
|
|
59
|
+
case "info":
|
|
60
|
+
default:
|
|
61
|
+
toast.info(title, external);
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
var toaster = {
|
|
66
|
+
create,
|
|
67
|
+
success: (opts) => create({ ...opts, type: "success" }),
|
|
68
|
+
error: (opts) => create({ ...opts, type: "error" }),
|
|
69
|
+
loading: (opts) => create({ ...opts, type: "loading" }),
|
|
70
|
+
update,
|
|
71
|
+
remove: (id) => toast.dismiss(id)
|
|
72
|
+
};
|
|
73
|
+
var Toaster = () => {
|
|
74
|
+
return /* @__PURE__ */ jsx(
|
|
75
|
+
Toaster$1,
|
|
76
|
+
{
|
|
77
|
+
position: "top-right",
|
|
78
|
+
richColors: true,
|
|
79
|
+
closeButton: true,
|
|
80
|
+
duration: DURATION,
|
|
81
|
+
offset: { top: 12, right: 12, bottom: 12, left: 12 },
|
|
82
|
+
mobileOffset: { top: 16, right: 16, bottom: 16, left: 16 },
|
|
83
|
+
toastOptions: {
|
|
84
|
+
className: "font-sans",
|
|
85
|
+
style: {
|
|
86
|
+
fontFamily: 'var(--font-sans, "Geist", sans-serif)',
|
|
87
|
+
color: "var(--color-text-primary)",
|
|
88
|
+
backgroundColor: "var(--color-bg-primary)",
|
|
89
|
+
borderColor: "var(--color-border-divider)"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export { Toaster, toaster };
|
package/dist/tooltip.cjs
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var RadixTooltip = require('@radix-ui/react-tooltip');
|
|
5
|
+
var usehooks = require('@uidotdev/usehooks');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var clsx = require('clsx');
|
|
8
|
+
var tailwindMerge = require('tailwind-merge');
|
|
9
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
10
|
+
|
|
11
|
+
function _interopNamespace(e) {
|
|
12
|
+
if (e && e.__esModule) return e;
|
|
13
|
+
var n = Object.create(null);
|
|
14
|
+
if (e) {
|
|
15
|
+
Object.keys(e).forEach(function (k) {
|
|
16
|
+
if (k !== 'default') {
|
|
17
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
18
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () { return e[k]; }
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
n.default = e;
|
|
26
|
+
return Object.freeze(n);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
var RadixTooltip__namespace = /*#__PURE__*/_interopNamespace(RadixTooltip);
|
|
30
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
31
|
+
|
|
32
|
+
// src/tooltip.tsx
|
|
33
|
+
function cn(...inputs) {
|
|
34
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
35
|
+
}
|
|
36
|
+
var LG_BREAKPOINT = 1024;
|
|
37
|
+
function useIsMobile() {
|
|
38
|
+
const [isMobile, setIsMobile] = React__namespace.useState(() => {
|
|
39
|
+
if (typeof window === "undefined") return false;
|
|
40
|
+
return window.innerWidth < LG_BREAKPOINT;
|
|
41
|
+
});
|
|
42
|
+
React__namespace.useEffect(() => {
|
|
43
|
+
const mql = window.matchMedia(`(max-width: ${LG_BREAKPOINT - 1}px)`);
|
|
44
|
+
const handler = (e) => setIsMobile(e.matches);
|
|
45
|
+
setIsMobile(mql.matches);
|
|
46
|
+
mql.addEventListener("change", handler);
|
|
47
|
+
return () => mql.removeEventListener("change", handler);
|
|
48
|
+
}, []);
|
|
49
|
+
return isMobile;
|
|
50
|
+
}
|
|
51
|
+
var Tooltip = React__namespace.forwardRef(
|
|
52
|
+
function Tooltip2(props, ref) {
|
|
53
|
+
const {
|
|
54
|
+
showArrow: showArrowProp,
|
|
55
|
+
onOpenChange,
|
|
56
|
+
variant,
|
|
57
|
+
selected,
|
|
58
|
+
children,
|
|
59
|
+
disabled,
|
|
60
|
+
disableOnMobile,
|
|
61
|
+
portalled = true,
|
|
62
|
+
content,
|
|
63
|
+
contentProps,
|
|
64
|
+
portalRef,
|
|
65
|
+
defaultOpen = false,
|
|
66
|
+
triggerProps,
|
|
67
|
+
closeDelay = 100,
|
|
68
|
+
openDelay = 100,
|
|
69
|
+
interactive,
|
|
70
|
+
positioning
|
|
71
|
+
} = props;
|
|
72
|
+
const [open, setOpen] = React__namespace.useState(defaultOpen);
|
|
73
|
+
const timeoutRef = React__namespace.useRef(null);
|
|
74
|
+
const isMobile = useIsMobile();
|
|
75
|
+
const handleOpenChange = React__namespace.useCallback((nextOpen) => {
|
|
76
|
+
setOpen(nextOpen);
|
|
77
|
+
onOpenChange?.({ open: nextOpen });
|
|
78
|
+
}, [onOpenChange]);
|
|
79
|
+
const handleOpenChangeManual = React__namespace.useCallback((nextOpen) => {
|
|
80
|
+
timeoutRef.current && window.clearTimeout(timeoutRef.current);
|
|
81
|
+
timeoutRef.current = window.setTimeout(() => {
|
|
82
|
+
setOpen(nextOpen);
|
|
83
|
+
onOpenChange?.({ open: nextOpen });
|
|
84
|
+
}, nextOpen ? openDelay : closeDelay);
|
|
85
|
+
}, [closeDelay, openDelay, onOpenChange]);
|
|
86
|
+
const handleClickAway = React__namespace.useCallback(() => {
|
|
87
|
+
handleOpenChangeManual(false);
|
|
88
|
+
}, [handleOpenChangeManual]);
|
|
89
|
+
const triggerRef = usehooks.useClickAway(handleClickAway);
|
|
90
|
+
const handleTriggerClick = React__namespace.useCallback(() => {
|
|
91
|
+
handleOpenChangeManual(!open);
|
|
92
|
+
}, [handleOpenChangeManual, open]);
|
|
93
|
+
const handleContentClick = React__namespace.useCallback((event) => {
|
|
94
|
+
event.stopPropagation();
|
|
95
|
+
if (interactive) {
|
|
96
|
+
const closestLink = event.target?.closest("a");
|
|
97
|
+
if (closestLink) {
|
|
98
|
+
handleOpenChangeManual(false);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}, [interactive, handleOpenChangeManual]);
|
|
102
|
+
React__namespace.useEffect(() => {
|
|
103
|
+
return () => {
|
|
104
|
+
if (timeoutRef.current) {
|
|
105
|
+
clearTimeout(timeoutRef.current);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
}, []);
|
|
109
|
+
if (disabled || disableOnMobile && isMobile) return children;
|
|
110
|
+
const defaultShowArrow = variant === "popover" ? false : true;
|
|
111
|
+
const showArrow = showArrowProp !== void 0 ? showArrowProp : defaultShowArrow;
|
|
112
|
+
const placement = positioning?.placement ?? "top";
|
|
113
|
+
const side = placement.split("-")[0];
|
|
114
|
+
const align = placement.includes("-") ? placement.split("-")[1] : void 0;
|
|
115
|
+
const sideOffset = positioning?.offset?.mainAxis ?? 4;
|
|
116
|
+
const isPopover = variant === "popover";
|
|
117
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RadixTooltip__namespace.Provider, { delayDuration: openDelay, skipDelayDuration: 0, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
118
|
+
RadixTooltip__namespace.Root,
|
|
119
|
+
{
|
|
120
|
+
open,
|
|
121
|
+
onOpenChange: handleOpenChange,
|
|
122
|
+
delayDuration: openDelay,
|
|
123
|
+
children: [
|
|
124
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
125
|
+
RadixTooltip__namespace.Trigger,
|
|
126
|
+
{
|
|
127
|
+
ref: open ? triggerRef : void 0,
|
|
128
|
+
asChild: true,
|
|
129
|
+
onClick: isMobile ? handleTriggerClick : void 0,
|
|
130
|
+
...triggerProps,
|
|
131
|
+
children
|
|
132
|
+
}
|
|
133
|
+
),
|
|
134
|
+
/* @__PURE__ */ jsxRuntime.jsx(RadixTooltip__namespace.Portal, { container: portalled ? portalRef?.current ?? void 0 : void 0, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
135
|
+
RadixTooltip__namespace.Content,
|
|
136
|
+
{
|
|
137
|
+
ref,
|
|
138
|
+
side,
|
|
139
|
+
align,
|
|
140
|
+
sideOffset,
|
|
141
|
+
onClick: interactive ? handleContentClick : void 0,
|
|
142
|
+
className: cn(
|
|
143
|
+
"z-[9999] overflow-hidden rounded-lg px-3 py-2 text-sm",
|
|
144
|
+
"animate-in fade-in-0 zoom-in-95",
|
|
145
|
+
isPopover && "bg-[var(--color-popover-bg)] text-[var(--color-text-primary)]",
|
|
146
|
+
isPopover && "shadow-[var(--shadow-popover)] border border-[var(--color-border-divider)] max-w-sm",
|
|
147
|
+
!isPopover && "bg-[var(--color-tooltip-bg)] text-[var(--color-tooltip-fg)] max-w-xs",
|
|
148
|
+
contentProps?.className
|
|
149
|
+
),
|
|
150
|
+
...selected ? { "data-selected": true } : {},
|
|
151
|
+
...contentProps,
|
|
152
|
+
children: [
|
|
153
|
+
showArrow && /* @__PURE__ */ jsxRuntime.jsx(
|
|
154
|
+
RadixTooltip__namespace.Arrow,
|
|
155
|
+
{
|
|
156
|
+
className: cn(
|
|
157
|
+
isPopover ? "fill-[var(--color-popover-bg)]" : "fill-[var(--color-tooltip-bg)]"
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
),
|
|
161
|
+
content
|
|
162
|
+
]
|
|
163
|
+
}
|
|
164
|
+
) })
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
) });
|
|
168
|
+
}
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
exports.Tooltip = Tooltip;
|
package/dist/tooltip.js
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as RadixTooltip from '@radix-ui/react-tooltip';
|
|
3
|
+
import { useClickAway } from '@uidotdev/usehooks';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { clsx } from 'clsx';
|
|
6
|
+
import { twMerge } from 'tailwind-merge';
|
|
7
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
// src/tooltip.tsx
|
|
10
|
+
function cn(...inputs) {
|
|
11
|
+
return twMerge(clsx(inputs));
|
|
12
|
+
}
|
|
13
|
+
var LG_BREAKPOINT = 1024;
|
|
14
|
+
function useIsMobile() {
|
|
15
|
+
const [isMobile, setIsMobile] = React.useState(() => {
|
|
16
|
+
if (typeof window === "undefined") return false;
|
|
17
|
+
return window.innerWidth < LG_BREAKPOINT;
|
|
18
|
+
});
|
|
19
|
+
React.useEffect(() => {
|
|
20
|
+
const mql = window.matchMedia(`(max-width: ${LG_BREAKPOINT - 1}px)`);
|
|
21
|
+
const handler = (e) => setIsMobile(e.matches);
|
|
22
|
+
setIsMobile(mql.matches);
|
|
23
|
+
mql.addEventListener("change", handler);
|
|
24
|
+
return () => mql.removeEventListener("change", handler);
|
|
25
|
+
}, []);
|
|
26
|
+
return isMobile;
|
|
27
|
+
}
|
|
28
|
+
var Tooltip = React.forwardRef(
|
|
29
|
+
function Tooltip2(props, ref) {
|
|
30
|
+
const {
|
|
31
|
+
showArrow: showArrowProp,
|
|
32
|
+
onOpenChange,
|
|
33
|
+
variant,
|
|
34
|
+
selected,
|
|
35
|
+
children,
|
|
36
|
+
disabled,
|
|
37
|
+
disableOnMobile,
|
|
38
|
+
portalled = true,
|
|
39
|
+
content,
|
|
40
|
+
contentProps,
|
|
41
|
+
portalRef,
|
|
42
|
+
defaultOpen = false,
|
|
43
|
+
triggerProps,
|
|
44
|
+
closeDelay = 100,
|
|
45
|
+
openDelay = 100,
|
|
46
|
+
interactive,
|
|
47
|
+
positioning
|
|
48
|
+
} = props;
|
|
49
|
+
const [open, setOpen] = React.useState(defaultOpen);
|
|
50
|
+
const timeoutRef = React.useRef(null);
|
|
51
|
+
const isMobile = useIsMobile();
|
|
52
|
+
const handleOpenChange = React.useCallback((nextOpen) => {
|
|
53
|
+
setOpen(nextOpen);
|
|
54
|
+
onOpenChange?.({ open: nextOpen });
|
|
55
|
+
}, [onOpenChange]);
|
|
56
|
+
const handleOpenChangeManual = React.useCallback((nextOpen) => {
|
|
57
|
+
timeoutRef.current && window.clearTimeout(timeoutRef.current);
|
|
58
|
+
timeoutRef.current = window.setTimeout(() => {
|
|
59
|
+
setOpen(nextOpen);
|
|
60
|
+
onOpenChange?.({ open: nextOpen });
|
|
61
|
+
}, nextOpen ? openDelay : closeDelay);
|
|
62
|
+
}, [closeDelay, openDelay, onOpenChange]);
|
|
63
|
+
const handleClickAway = React.useCallback(() => {
|
|
64
|
+
handleOpenChangeManual(false);
|
|
65
|
+
}, [handleOpenChangeManual]);
|
|
66
|
+
const triggerRef = useClickAway(handleClickAway);
|
|
67
|
+
const handleTriggerClick = React.useCallback(() => {
|
|
68
|
+
handleOpenChangeManual(!open);
|
|
69
|
+
}, [handleOpenChangeManual, open]);
|
|
70
|
+
const handleContentClick = React.useCallback((event) => {
|
|
71
|
+
event.stopPropagation();
|
|
72
|
+
if (interactive) {
|
|
73
|
+
const closestLink = event.target?.closest("a");
|
|
74
|
+
if (closestLink) {
|
|
75
|
+
handleOpenChangeManual(false);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}, [interactive, handleOpenChangeManual]);
|
|
79
|
+
React.useEffect(() => {
|
|
80
|
+
return () => {
|
|
81
|
+
if (timeoutRef.current) {
|
|
82
|
+
clearTimeout(timeoutRef.current);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}, []);
|
|
86
|
+
if (disabled || disableOnMobile && isMobile) return children;
|
|
87
|
+
const defaultShowArrow = variant === "popover" ? false : true;
|
|
88
|
+
const showArrow = showArrowProp !== void 0 ? showArrowProp : defaultShowArrow;
|
|
89
|
+
const placement = positioning?.placement ?? "top";
|
|
90
|
+
const side = placement.split("-")[0];
|
|
91
|
+
const align = placement.includes("-") ? placement.split("-")[1] : void 0;
|
|
92
|
+
const sideOffset = positioning?.offset?.mainAxis ?? 4;
|
|
93
|
+
const isPopover = variant === "popover";
|
|
94
|
+
return /* @__PURE__ */ jsx(RadixTooltip.Provider, { delayDuration: openDelay, skipDelayDuration: 0, children: /* @__PURE__ */ jsxs(
|
|
95
|
+
RadixTooltip.Root,
|
|
96
|
+
{
|
|
97
|
+
open,
|
|
98
|
+
onOpenChange: handleOpenChange,
|
|
99
|
+
delayDuration: openDelay,
|
|
100
|
+
children: [
|
|
101
|
+
/* @__PURE__ */ jsx(
|
|
102
|
+
RadixTooltip.Trigger,
|
|
103
|
+
{
|
|
104
|
+
ref: open ? triggerRef : void 0,
|
|
105
|
+
asChild: true,
|
|
106
|
+
onClick: isMobile ? handleTriggerClick : void 0,
|
|
107
|
+
...triggerProps,
|
|
108
|
+
children
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
/* @__PURE__ */ jsx(RadixTooltip.Portal, { container: portalled ? portalRef?.current ?? void 0 : void 0, children: /* @__PURE__ */ jsxs(
|
|
112
|
+
RadixTooltip.Content,
|
|
113
|
+
{
|
|
114
|
+
ref,
|
|
115
|
+
side,
|
|
116
|
+
align,
|
|
117
|
+
sideOffset,
|
|
118
|
+
onClick: interactive ? handleContentClick : void 0,
|
|
119
|
+
className: cn(
|
|
120
|
+
"z-[9999] overflow-hidden rounded-lg px-3 py-2 text-sm",
|
|
121
|
+
"animate-in fade-in-0 zoom-in-95",
|
|
122
|
+
isPopover && "bg-[var(--color-popover-bg)] text-[var(--color-text-primary)]",
|
|
123
|
+
isPopover && "shadow-[var(--shadow-popover)] border border-[var(--color-border-divider)] max-w-sm",
|
|
124
|
+
!isPopover && "bg-[var(--color-tooltip-bg)] text-[var(--color-tooltip-fg)] max-w-xs",
|
|
125
|
+
contentProps?.className
|
|
126
|
+
),
|
|
127
|
+
...selected ? { "data-selected": true } : {},
|
|
128
|
+
...contentProps,
|
|
129
|
+
children: [
|
|
130
|
+
showArrow && /* @__PURE__ */ jsx(
|
|
131
|
+
RadixTooltip.Arrow,
|
|
132
|
+
{
|
|
133
|
+
className: cn(
|
|
134
|
+
isPopover ? "fill-[var(--color-popover-bg)]" : "fill-[var(--color-tooltip-bg)]"
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
),
|
|
138
|
+
content
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
) })
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
) });
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
export { Tooltip };
|
package/dist/utils.cjs
ADDED