@luxfi/ui 7.4.10 → 7.4.12
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 +107 -166
- package/dist/accordion.d.cts +18 -51
- package/dist/accordion.d.ts +18 -51
- package/dist/accordion.js +109 -166
- package/dist/alert.cjs +68 -46
- package/dist/alert.js +69 -46
- package/dist/avatar.cjs +49 -46
- package/dist/avatar.js +52 -48
- package/dist/badge.cjs +82 -49
- package/dist/badge.js +83 -50
- package/dist/checkbox.cjs +42 -75
- package/dist/checkbox.js +43 -76
- package/dist/chrome.cjs +196 -386
- package/dist/chrome.js +198 -386
- package/dist/close-button.cjs +3 -7
- package/dist/close-button.js +3 -7
- package/dist/collapsible.cjs +35 -26
- package/dist/collapsible.d.cts +2 -1
- package/dist/collapsible.d.ts +2 -1
- package/dist/collapsible.js +34 -24
- package/dist/dialog.cjs +3 -7
- package/dist/dialog.d.cts +1 -1
- package/dist/dialog.d.ts +1 -1
- package/dist/dialog.js +3 -7
- package/dist/drawer.cjs +95 -122
- package/dist/drawer.d.cts +43 -10
- package/dist/drawer.d.ts +43 -10
- package/dist/drawer.js +97 -122
- package/dist/empty-state.cjs +13 -13
- package/dist/empty-state.js +13 -13
- package/dist/expiration-selector.cjs +58 -63
- package/dist/expiration-selector.js +58 -63
- package/dist/field.cjs +60 -109
- package/dist/field.d.cts +0 -1
- package/dist/field.d.ts +0 -1
- package/dist/field.js +61 -109
- package/dist/greeks-display.cjs +48 -39
- package/dist/greeks-display.js +48 -39
- package/dist/heading.cjs +10 -17
- package/dist/heading.d.cts +0 -2
- package/dist/heading.d.ts +0 -2
- package/dist/heading.js +10 -17
- package/dist/icon-button.cjs +82 -82
- package/dist/icon-button.d.cts +16 -12
- package/dist/icon-button.d.ts +16 -12
- package/dist/icon-button.js +82 -82
- package/dist/index.cjs +1812 -2105
- package/dist/index.d.cts +1 -5
- package/dist/index.d.ts +1 -5
- package/dist/index.js +1814 -2100
- package/dist/input-group.cjs +11 -12
- package/dist/input-group.js +11 -12
- package/dist/input.cjs +27 -27
- package/dist/input.d.cts +21 -1
- package/dist/input.d.ts +21 -1
- package/dist/input.js +25 -28
- package/dist/menu.cjs +160 -271
- package/dist/menu.d.cts +41 -57
- package/dist/menu.d.ts +41 -57
- package/dist/menu.js +161 -251
- package/dist/option-chain.cjs +89 -67
- package/dist/option-chain.js +89 -67
- package/dist/option-position.cjs +88 -85
- package/dist/option-position.js +88 -85
- package/dist/pnl-diagram.cjs +20 -20
- package/dist/pnl-diagram.js +20 -20
- package/dist/popover.cjs +4 -8
- package/dist/popover.js +4 -8
- package/dist/progress.cjs +15 -22
- package/dist/progress.d.cts +6 -6
- package/dist/progress.d.ts +6 -6
- package/dist/progress.js +15 -22
- package/dist/radio.cjs +35 -67
- package/dist/radio.d.cts +18 -18
- package/dist/radio.d.ts +18 -18
- package/dist/radio.js +36 -68
- package/dist/select.cjs +40 -39
- package/dist/select.d.cts +35 -4
- package/dist/select.d.ts +35 -4
- package/dist/select.js +40 -38
- package/dist/separator.cjs +8 -33
- package/dist/separator.js +8 -33
- package/dist/slider.cjs +33 -49
- package/dist/slider.js +34 -50
- package/dist/switch.cjs +48 -55
- package/dist/switch.js +49 -56
- package/dist/tabs.cjs +108 -197
- package/dist/tabs.d.cts +16 -60
- package/dist/tabs.d.ts +16 -60
- package/dist/tabs.js +109 -196
- package/dist/tag.cjs +112 -69
- package/dist/tag.js +113 -69
- package/dist/textarea.cjs +56 -27
- package/dist/textarea.js +57 -28
- package/dist/toaster.cjs +97 -79
- package/dist/toaster.d.cts +7 -8
- package/dist/toaster.d.ts +7 -8
- package/dist/toaster.js +78 -80
- package/dist/tooltip.cjs +28 -17
- package/dist/tooltip.js +30 -18
- package/package.json +2 -16
- package/src/accordion.tsx +173 -227
- package/src/alert.tsx +78 -45
- package/src/avatar.tsx +54 -37
- package/src/badge.tsx +65 -44
- package/src/checkbox.tsx +70 -89
- package/src/close-button.tsx +3 -8
- package/src/collapsible.tsx +55 -52
- package/src/drawer.tsx +123 -115
- package/src/empty-state.tsx +21 -17
- package/src/expiration-selector.tsx +84 -66
- package/src/field.tsx +68 -124
- package/src/greeks-display.tsx +59 -51
- package/src/heading.tsx +22 -26
- package/src/icon-button.tsx +134 -141
- package/src/ink.tsx +37 -0
- package/src/input-group.tsx +59 -36
- package/src/input.tsx +41 -32
- package/src/menu.tsx +224 -397
- package/src/option-chain.tsx +154 -104
- package/src/option-position.tsx +136 -114
- package/src/pin-input.tsx +37 -29
- package/src/pnl-diagram.tsx +36 -28
- package/src/popover.tsx +1 -1
- package/src/progress.tsx +17 -21
- package/src/radio.tsx +56 -75
- package/src/select.tsx +80 -59
- package/src/separator.tsx +13 -34
- package/src/slider.tsx +43 -44
- package/src/strategy-builder.tsx +245 -156
- package/src/switch.tsx +63 -64
- package/src/tabs.tsx +166 -296
- package/src/tag.tsx +89 -51
- package/src/textarea.tsx +19 -29
- package/src/toaster.tsx +118 -86
- package/src/tooltip.tsx +21 -13
- package/tokens.css +79 -0
package/dist/toaster.cjs
CHANGED
|
@@ -1,98 +1,116 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var gui = require('@hanzo/gui');
|
|
5
|
+
var React = require('react');
|
|
5
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
7
|
|
|
8
|
+
function _interopNamespace(e) {
|
|
9
|
+
if (e && e.__esModule) return e;
|
|
10
|
+
var n = Object.create(null);
|
|
11
|
+
if (e) {
|
|
12
|
+
Object.keys(e).forEach(function (k) {
|
|
13
|
+
if (k !== 'default') {
|
|
14
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return e[k]; }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
n.default = e;
|
|
23
|
+
return Object.freeze(n);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
27
|
+
|
|
7
28
|
var SECOND = 1e3;
|
|
8
29
|
var DURATION = 10 * SECOND;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
30
|
+
var entries = [];
|
|
31
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
32
|
+
var counter = 0;
|
|
33
|
+
var emit = () => listeners.forEach((l) => l());
|
|
34
|
+
var subscribe = (l) => {
|
|
35
|
+
listeners.add(l);
|
|
36
|
+
return () => {
|
|
37
|
+
listeners.delete(l);
|
|
14
38
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
}
|
|
39
|
+
};
|
|
40
|
+
var snapshot = () => entries;
|
|
41
|
+
var remove = (id) => {
|
|
42
|
+
const found = entries.find((e) => e.id === id);
|
|
43
|
+
entries = entries.filter((e) => e.id !== id);
|
|
44
|
+
emit();
|
|
45
|
+
found?.onStatusChange?.({ status: "unmounted" });
|
|
46
|
+
};
|
|
47
|
+
var create = (opts) => {
|
|
48
|
+
const id = opts.id ?? `toast-${++counter}`;
|
|
49
|
+
const entry = { ...opts, id };
|
|
50
|
+
entries = [...entries.filter((e) => e.id !== id), entry];
|
|
51
|
+
emit();
|
|
52
|
+
return id;
|
|
53
|
+
};
|
|
54
|
+
var update = (id, opts) => {
|
|
55
|
+
entries = entries.map((e) => e.id === id ? { ...e, ...opts, id } : e);
|
|
56
|
+
emit();
|
|
57
|
+
};
|
|
67
58
|
var toaster = {
|
|
68
59
|
create,
|
|
69
60
|
success: (opts) => create({ ...opts, type: "success" }),
|
|
70
61
|
error: (opts) => create({ ...opts, type: "error" }),
|
|
71
62
|
loading: (opts) => create({ ...opts, type: "loading" }),
|
|
72
63
|
update,
|
|
73
|
-
remove
|
|
64
|
+
remove
|
|
74
65
|
};
|
|
75
|
-
var
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
66
|
+
var EDGE = {
|
|
67
|
+
success: "var(--color-status-good)",
|
|
68
|
+
error: "var(--color-status-bad)",
|
|
69
|
+
warning: "var(--color-status-warn)",
|
|
70
|
+
loading: "var(--color-border-divider)",
|
|
71
|
+
info: "var(--color-border-divider)"
|
|
72
|
+
};
|
|
73
|
+
var One = ({ entry }) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
74
|
+
gui.Toast,
|
|
75
|
+
{
|
|
76
|
+
duration: entry.duration ?? DURATION,
|
|
77
|
+
onOpenChange: (open) => {
|
|
78
|
+
if (!open) remove(entry.id);
|
|
79
|
+
},
|
|
80
|
+
unstyled: true,
|
|
81
|
+
flexDirection: "column",
|
|
82
|
+
gap: 4,
|
|
83
|
+
padding: 12,
|
|
84
|
+
borderRadius: 8,
|
|
85
|
+
borderWidth: 1,
|
|
86
|
+
borderColor: EDGE[entry.type ?? "info"],
|
|
87
|
+
backgroundColor: "var(--color-popover-bg)",
|
|
88
|
+
transition: "quick",
|
|
89
|
+
enterStyle: { opacity: 0, y: -8 },
|
|
90
|
+
exitStyle: { opacity: 0, y: -8 },
|
|
91
|
+
children: [
|
|
92
|
+
entry.title ? /* @__PURE__ */ jsxRuntime.jsx(gui.Toast.Title, { unstyled: true, fontSize: 14, fontWeight: "600", color: "var(--color-text-primary)", children: entry.title }) : null,
|
|
93
|
+
entry.description ? /* @__PURE__ */ jsxRuntime.jsx(gui.Toast.Description, { unstyled: true, fontSize: 13, color: "var(--color-text-secondary)", children: entry.description }) : null,
|
|
94
|
+
entry.action ? /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { marginTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(gui.Toast.Action, { altText: entry.action.label, onPress: entry.action.onClick, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
95
|
+
gui.Text,
|
|
96
|
+
{
|
|
97
|
+
cursor: "pointer",
|
|
98
|
+
fontSize: 13,
|
|
99
|
+
fontWeight: "500",
|
|
100
|
+
color: "var(--color-link-primary)",
|
|
101
|
+
children: entry.action.label
|
|
92
102
|
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
103
|
+
) }) }) : null
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
entry.id
|
|
107
|
+
);
|
|
108
|
+
var Toaster = () => {
|
|
109
|
+
const list = React__namespace.useSyncExternalStore(subscribe, snapshot, snapshot);
|
|
110
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(gui.ToastProvider, { children: [
|
|
111
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.YStack, { children: list.map((entry) => /* @__PURE__ */ jsxRuntime.jsx(One, { entry }, entry.id)) }),
|
|
112
|
+
/* @__PURE__ */ jsxRuntime.jsx(gui.ToastViewport, { position: "absolute", top: 12, right: 12 })
|
|
113
|
+
] });
|
|
96
114
|
};
|
|
97
115
|
|
|
98
116
|
exports.Toaster = Toaster;
|
package/dist/toaster.d.cts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
|
|
3
|
+
type ToastType = 'info' | 'warning' | 'success' | 'error' | 'loading';
|
|
3
4
|
interface ToastOptions {
|
|
4
5
|
readonly id?: string | number;
|
|
5
6
|
readonly title?: string;
|
|
6
7
|
readonly description?: string;
|
|
7
|
-
readonly type?:
|
|
8
|
+
readonly type?: ToastType;
|
|
8
9
|
readonly duration?: number;
|
|
9
10
|
readonly action?: {
|
|
10
11
|
readonly label: string;
|
|
@@ -14,16 +15,14 @@ interface ToastOptions {
|
|
|
14
15
|
readonly status: string;
|
|
15
16
|
}) => void;
|
|
16
17
|
}
|
|
17
|
-
declare function create(opts: ToastOptions): string | number;
|
|
18
|
-
declare function update(id: string | number, opts: ToastOptions): void;
|
|
19
18
|
declare const toaster: {
|
|
20
|
-
readonly create:
|
|
19
|
+
readonly create: (opts: ToastOptions) => string | number;
|
|
21
20
|
readonly success: (opts: ToastOptions) => string | number;
|
|
22
21
|
readonly error: (opts: ToastOptions) => string | number;
|
|
23
22
|
readonly loading: (opts: ToastOptions) => string | number;
|
|
24
|
-
readonly update:
|
|
25
|
-
readonly remove: (id: string | number) =>
|
|
23
|
+
readonly update: (id: string | number, opts: ToastOptions) => void;
|
|
24
|
+
readonly remove: (id: string | number) => void;
|
|
26
25
|
};
|
|
27
|
-
declare const Toaster:
|
|
26
|
+
declare const Toaster: React.FC;
|
|
28
27
|
|
|
29
28
|
export { Toaster, toaster };
|
package/dist/toaster.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
|
|
3
|
+
type ToastType = 'info' | 'warning' | 'success' | 'error' | 'loading';
|
|
3
4
|
interface ToastOptions {
|
|
4
5
|
readonly id?: string | number;
|
|
5
6
|
readonly title?: string;
|
|
6
7
|
readonly description?: string;
|
|
7
|
-
readonly type?:
|
|
8
|
+
readonly type?: ToastType;
|
|
8
9
|
readonly duration?: number;
|
|
9
10
|
readonly action?: {
|
|
10
11
|
readonly label: string;
|
|
@@ -14,16 +15,14 @@ interface ToastOptions {
|
|
|
14
15
|
readonly status: string;
|
|
15
16
|
}) => void;
|
|
16
17
|
}
|
|
17
|
-
declare function create(opts: ToastOptions): string | number;
|
|
18
|
-
declare function update(id: string | number, opts: ToastOptions): void;
|
|
19
18
|
declare const toaster: {
|
|
20
|
-
readonly create:
|
|
19
|
+
readonly create: (opts: ToastOptions) => string | number;
|
|
21
20
|
readonly success: (opts: ToastOptions) => string | number;
|
|
22
21
|
readonly error: (opts: ToastOptions) => string | number;
|
|
23
22
|
readonly loading: (opts: ToastOptions) => string | number;
|
|
24
|
-
readonly update:
|
|
25
|
-
readonly remove: (id: string | number) =>
|
|
23
|
+
readonly update: (id: string | number, opts: ToastOptions) => void;
|
|
24
|
+
readonly remove: (id: string | number) => void;
|
|
26
25
|
};
|
|
27
|
-
declare const Toaster:
|
|
26
|
+
declare const Toaster: React.FC;
|
|
28
27
|
|
|
29
28
|
export { Toaster, toaster };
|
package/dist/toaster.js
CHANGED
|
@@ -1,96 +1,94 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { ToastProvider, YStack, ToastViewport, Toast, XStack, Text } from '@hanzo/gui';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
5
|
|
|
5
6
|
var SECOND = 1e3;
|
|
6
7
|
var DURATION = 10 * SECOND;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
var entries = [];
|
|
9
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
10
|
+
var counter = 0;
|
|
11
|
+
var emit = () => listeners.forEach((l) => l());
|
|
12
|
+
var subscribe = (l) => {
|
|
13
|
+
listeners.add(l);
|
|
14
|
+
return () => {
|
|
15
|
+
listeners.delete(l);
|
|
12
16
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
}
|
|
17
|
+
};
|
|
18
|
+
var snapshot = () => entries;
|
|
19
|
+
var remove = (id) => {
|
|
20
|
+
const found = entries.find((e) => e.id === id);
|
|
21
|
+
entries = entries.filter((e) => e.id !== id);
|
|
22
|
+
emit();
|
|
23
|
+
found?.onStatusChange?.({ status: "unmounted" });
|
|
24
|
+
};
|
|
25
|
+
var create = (opts) => {
|
|
26
|
+
const id = opts.id ?? `toast-${++counter}`;
|
|
27
|
+
const entry = { ...opts, id };
|
|
28
|
+
entries = [...entries.filter((e) => e.id !== id), entry];
|
|
29
|
+
emit();
|
|
30
|
+
return id;
|
|
31
|
+
};
|
|
32
|
+
var update = (id, opts) => {
|
|
33
|
+
entries = entries.map((e) => e.id === id ? { ...e, ...opts, id } : e);
|
|
34
|
+
emit();
|
|
35
|
+
};
|
|
65
36
|
var toaster = {
|
|
66
37
|
create,
|
|
67
38
|
success: (opts) => create({ ...opts, type: "success" }),
|
|
68
39
|
error: (opts) => create({ ...opts, type: "error" }),
|
|
69
40
|
loading: (opts) => create({ ...opts, type: "loading" }),
|
|
70
41
|
update,
|
|
71
|
-
remove
|
|
42
|
+
remove
|
|
72
43
|
};
|
|
73
|
-
var
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
44
|
+
var EDGE = {
|
|
45
|
+
success: "var(--color-status-good)",
|
|
46
|
+
error: "var(--color-status-bad)",
|
|
47
|
+
warning: "var(--color-status-warn)",
|
|
48
|
+
loading: "var(--color-border-divider)",
|
|
49
|
+
info: "var(--color-border-divider)"
|
|
50
|
+
};
|
|
51
|
+
var One = ({ entry }) => /* @__PURE__ */ jsxs(
|
|
52
|
+
Toast,
|
|
53
|
+
{
|
|
54
|
+
duration: entry.duration ?? DURATION,
|
|
55
|
+
onOpenChange: (open) => {
|
|
56
|
+
if (!open) remove(entry.id);
|
|
57
|
+
},
|
|
58
|
+
unstyled: true,
|
|
59
|
+
flexDirection: "column",
|
|
60
|
+
gap: 4,
|
|
61
|
+
padding: 12,
|
|
62
|
+
borderRadius: 8,
|
|
63
|
+
borderWidth: 1,
|
|
64
|
+
borderColor: EDGE[entry.type ?? "info"],
|
|
65
|
+
backgroundColor: "var(--color-popover-bg)",
|
|
66
|
+
transition: "quick",
|
|
67
|
+
enterStyle: { opacity: 0, y: -8 },
|
|
68
|
+
exitStyle: { opacity: 0, y: -8 },
|
|
69
|
+
children: [
|
|
70
|
+
entry.title ? /* @__PURE__ */ jsx(Toast.Title, { unstyled: true, fontSize: 14, fontWeight: "600", color: "var(--color-text-primary)", children: entry.title }) : null,
|
|
71
|
+
entry.description ? /* @__PURE__ */ jsx(Toast.Description, { unstyled: true, fontSize: 13, color: "var(--color-text-secondary)", children: entry.description }) : null,
|
|
72
|
+
entry.action ? /* @__PURE__ */ jsx(XStack, { marginTop: 4, children: /* @__PURE__ */ jsx(Toast.Action, { altText: entry.action.label, onPress: entry.action.onClick, children: /* @__PURE__ */ jsx(
|
|
73
|
+
Text,
|
|
74
|
+
{
|
|
75
|
+
cursor: "pointer",
|
|
76
|
+
fontSize: 13,
|
|
77
|
+
fontWeight: "500",
|
|
78
|
+
color: "var(--color-link-primary)",
|
|
79
|
+
children: entry.action.label
|
|
90
80
|
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
81
|
+
) }) }) : null
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
entry.id
|
|
85
|
+
);
|
|
86
|
+
var Toaster = () => {
|
|
87
|
+
const list = React.useSyncExternalStore(subscribe, snapshot, snapshot);
|
|
88
|
+
return /* @__PURE__ */ jsxs(ToastProvider, { children: [
|
|
89
|
+
/* @__PURE__ */ jsx(YStack, { children: list.map((entry) => /* @__PURE__ */ jsx(One, { entry }, entry.id)) }),
|
|
90
|
+
/* @__PURE__ */ jsx(ToastViewport, { position: "absolute", top: 12, right: 12 })
|
|
91
|
+
] });
|
|
94
92
|
};
|
|
95
93
|
|
|
96
94
|
export { Toaster, toaster };
|
package/dist/tooltip.cjs
CHANGED
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
var gui = require('@hanzo/gui');
|
|
5
5
|
var usehooks = require('@uidotdev/usehooks');
|
|
6
6
|
var React2 = require('react');
|
|
7
|
-
var clsx = require('clsx');
|
|
8
|
-
var tailwindMerge = require('tailwind-merge');
|
|
9
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
10
8
|
|
|
11
9
|
function _interopNamespace(e) {
|
|
@@ -29,6 +27,14 @@ function _interopNamespace(e) {
|
|
|
29
27
|
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
30
28
|
|
|
31
29
|
// src/tooltip.tsx
|
|
30
|
+
var ink = (children, Wrap = gui.Text, props = {}) => {
|
|
31
|
+
let hasText = false;
|
|
32
|
+
React2.Children.forEach(children, (child) => {
|
|
33
|
+
if (typeof child === "string" || typeof child === "number") hasText = true;
|
|
34
|
+
});
|
|
35
|
+
if (!hasText) return children;
|
|
36
|
+
return React2.Children.map(children, (child) => typeof child === "string" || typeof child === "number" ? React2.createElement(Wrap, props, child) : child);
|
|
37
|
+
};
|
|
32
38
|
var TOUCH_PX = 1024;
|
|
33
39
|
function useBelow(px) {
|
|
34
40
|
const [below, setBelow] = React2__namespace.useState(false);
|
|
@@ -42,9 +48,6 @@ function useBelow(px) {
|
|
|
42
48
|
return below;
|
|
43
49
|
}
|
|
44
50
|
var useIsTouch = () => useBelow(TOUCH_PX);
|
|
45
|
-
function cn(...inputs) {
|
|
46
|
-
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
47
|
-
}
|
|
48
51
|
function mapPlacement(p) {
|
|
49
52
|
if (!p) return void 0;
|
|
50
53
|
return p;
|
|
@@ -136,14 +139,21 @@ var Tooltip = React2__namespace.forwardRef(
|
|
|
136
139
|
{
|
|
137
140
|
ref,
|
|
138
141
|
unstyled: true,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
142
|
+
zIndex: 9999,
|
|
143
|
+
overflow: "hidden",
|
|
144
|
+
borderRadius: 8,
|
|
145
|
+
paddingHorizontal: 12,
|
|
146
|
+
paddingVertical: 8,
|
|
147
|
+
maxWidth: isPopover ? 384 : 320,
|
|
148
|
+
backgroundColor: isPopover ? "var(--color-popover-bg)" : "var(--color-tooltip-bg)",
|
|
149
|
+
transition: "quick",
|
|
150
|
+
enterStyle: { opacity: 0, scale: 0.95 },
|
|
151
|
+
exitStyle: { opacity: 0, scale: 0.95 },
|
|
152
|
+
...isPopover ? {
|
|
153
|
+
borderWidth: 1,
|
|
154
|
+
borderColor: "var(--color-border-divider)",
|
|
155
|
+
shadowColor: "var(--shadow-popover)"
|
|
156
|
+
} : {},
|
|
147
157
|
onClick: interactive ? handleContentClick : void 0,
|
|
148
158
|
...selected ? { "data-selected": true } : {},
|
|
149
159
|
...contentProps,
|
|
@@ -152,12 +162,13 @@ var Tooltip = React2__namespace.forwardRef(
|
|
|
152
162
|
gui.Tooltip.Arrow,
|
|
153
163
|
{
|
|
154
164
|
unstyled: true,
|
|
155
|
-
|
|
156
|
-
isPopover ? "fill-[var(--color-popover-bg)]" : "fill-[var(--color-tooltip-bg)]"
|
|
157
|
-
)
|
|
165
|
+
backgroundColor: isPopover ? "var(--color-popover-bg)" : "var(--color-tooltip-bg)"
|
|
158
166
|
}
|
|
159
167
|
),
|
|
160
|
-
content
|
|
168
|
+
ink(content, void 0, {
|
|
169
|
+
fontSize: 14,
|
|
170
|
+
color: isPopover ? "var(--color-text-primary)" : "var(--color-tooltip-fg)"
|
|
171
|
+
})
|
|
161
172
|
]
|
|
162
173
|
}
|
|
163
174
|
)
|
package/dist/tooltip.js
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { TooltipGroup, Tooltip as Tooltip$1 } from '@hanzo/gui';
|
|
2
|
+
import { TooltipGroup, Tooltip as Tooltip$1, Text } from '@hanzo/gui';
|
|
3
3
|
import { useClickAway } from '@uidotdev/usehooks';
|
|
4
4
|
import * as React2 from 'react';
|
|
5
|
-
import {
|
|
6
|
-
import { twMerge } from 'tailwind-merge';
|
|
5
|
+
import { Children, createElement } from 'react';
|
|
7
6
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
8
7
|
|
|
9
8
|
// src/tooltip.tsx
|
|
9
|
+
var ink = (children, Wrap = Text, props = {}) => {
|
|
10
|
+
let hasText = false;
|
|
11
|
+
Children.forEach(children, (child) => {
|
|
12
|
+
if (typeof child === "string" || typeof child === "number") hasText = true;
|
|
13
|
+
});
|
|
14
|
+
if (!hasText) return children;
|
|
15
|
+
return Children.map(children, (child) => typeof child === "string" || typeof child === "number" ? createElement(Wrap, props, child) : child);
|
|
16
|
+
};
|
|
10
17
|
var TOUCH_PX = 1024;
|
|
11
18
|
function useBelow(px) {
|
|
12
19
|
const [below, setBelow] = React2.useState(false);
|
|
@@ -20,9 +27,6 @@ function useBelow(px) {
|
|
|
20
27
|
return below;
|
|
21
28
|
}
|
|
22
29
|
var useIsTouch = () => useBelow(TOUCH_PX);
|
|
23
|
-
function cn(...inputs) {
|
|
24
|
-
return twMerge(clsx(inputs));
|
|
25
|
-
}
|
|
26
30
|
function mapPlacement(p) {
|
|
27
31
|
if (!p) return void 0;
|
|
28
32
|
return p;
|
|
@@ -114,14 +118,21 @@ var Tooltip = React2.forwardRef(
|
|
|
114
118
|
{
|
|
115
119
|
ref,
|
|
116
120
|
unstyled: true,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
zIndex: 9999,
|
|
122
|
+
overflow: "hidden",
|
|
123
|
+
borderRadius: 8,
|
|
124
|
+
paddingHorizontal: 12,
|
|
125
|
+
paddingVertical: 8,
|
|
126
|
+
maxWidth: isPopover ? 384 : 320,
|
|
127
|
+
backgroundColor: isPopover ? "var(--color-popover-bg)" : "var(--color-tooltip-bg)",
|
|
128
|
+
transition: "quick",
|
|
129
|
+
enterStyle: { opacity: 0, scale: 0.95 },
|
|
130
|
+
exitStyle: { opacity: 0, scale: 0.95 },
|
|
131
|
+
...isPopover ? {
|
|
132
|
+
borderWidth: 1,
|
|
133
|
+
borderColor: "var(--color-border-divider)",
|
|
134
|
+
shadowColor: "var(--shadow-popover)"
|
|
135
|
+
} : {},
|
|
125
136
|
onClick: interactive ? handleContentClick : void 0,
|
|
126
137
|
...selected ? { "data-selected": true } : {},
|
|
127
138
|
...contentProps,
|
|
@@ -130,12 +141,13 @@ var Tooltip = React2.forwardRef(
|
|
|
130
141
|
Tooltip$1.Arrow,
|
|
131
142
|
{
|
|
132
143
|
unstyled: true,
|
|
133
|
-
|
|
134
|
-
isPopover ? "fill-[var(--color-popover-bg)]" : "fill-[var(--color-tooltip-bg)]"
|
|
135
|
-
)
|
|
144
|
+
backgroundColor: isPopover ? "var(--color-popover-bg)" : "var(--color-tooltip-bg)"
|
|
136
145
|
}
|
|
137
146
|
),
|
|
138
|
-
content
|
|
147
|
+
ink(content, void 0, {
|
|
148
|
+
fontSize: 14,
|
|
149
|
+
color: isPopover ? "var(--color-text-primary)" : "var(--color-tooltip-fg)"
|
|
150
|
+
})
|
|
139
151
|
]
|
|
140
152
|
}
|
|
141
153
|
)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luxfi/ui",
|
|
3
|
-
"version": "7.4.
|
|
4
|
-
"description": "Cross-platform
|
|
3
|
+
"version": "7.4.12",
|
|
4
|
+
"description": "Cross-platform UI components on @hanzo/gui. Native mobile + web.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": {
|
|
@@ -305,24 +305,10 @@
|
|
|
305
305
|
"test": "playwright test"
|
|
306
306
|
},
|
|
307
307
|
"dependencies": {
|
|
308
|
-
"@radix-ui/react-accordion": "^1.2.12",
|
|
309
|
-
"@radix-ui/react-avatar": "^1.1.10",
|
|
310
|
-
"@radix-ui/react-checkbox": "^1.3.3",
|
|
311
|
-
"@radix-ui/react-collapsible": "^1.1.12",
|
|
312
|
-
"@radix-ui/react-dialog": "^1.1.15",
|
|
313
|
-
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
314
|
-
"@radix-ui/react-label": "^2.1.7",
|
|
315
|
-
"@radix-ui/react-progress": "^1.1.7",
|
|
316
|
-
"@radix-ui/react-radio-group": "^1.3.8",
|
|
317
|
-
"@radix-ui/react-select": "^2.2.6",
|
|
318
|
-
"@radix-ui/react-slider": "^1.3.6",
|
|
319
|
-
"@radix-ui/react-switch": "^1.2.6",
|
|
320
|
-
"@radix-ui/react-tabs": "^1.1.13",
|
|
321
308
|
"@uidotdev/usehooks": "^2.4.1",
|
|
322
309
|
"clsx": "^2.1.1",
|
|
323
310
|
"es-toolkit": "^1.31.0",
|
|
324
311
|
"lucide-react": "^1.27.0",
|
|
325
|
-
"sonner": "^2.0.0",
|
|
326
312
|
"tailwind-merge": "^3.0.0"
|
|
327
313
|
},
|
|
328
314
|
"peerDependencies": {
|