@luxfi/ui 8.2.7 → 8.2.8
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/3d-model-viewer.cjs +25 -421
- package/dist/3d-model-viewer.js +20 -416
- package/dist/accordion.cjs +3 -10
- package/dist/accordion.js +2 -10
- package/dist/advanced-navigation-bar.cjs +5 -401
- package/dist/advanced-navigation-bar.js +5 -401
- package/dist/ai-agents.cjs +45 -890
- package/dist/ai-agents.js +8 -834
- package/dist/ai-assistant.cjs +13 -740
- package/dist/ai-assistant.js +10 -738
- package/dist/ai-chat.cjs +24 -770
- package/dist/ai-chat.js +18 -765
- package/dist/ai-code.cjs +67 -923
- package/dist/ai-code.js +49 -905
- package/dist/ai-playground.cjs +25 -801
- package/dist/ai-playground.js +18 -795
- package/dist/ai-tools.cjs +22 -767
- package/dist/ai-tools.js +15 -761
- package/dist/ai-vision.cjs +41 -993
- package/dist/ai-vision.js +30 -983
- package/dist/ai-voice-settings.cjs +35 -1006
- package/dist/ai-voice-settings.js +32 -1004
- package/dist/ai-voice.cjs +51 -1024
- package/dist/ai-voice.js +9 -963
- package/dist/alert.cjs +11 -129
- package/dist/alert.js +8 -127
- package/dist/announcement.cjs +6 -402
- package/dist/announcement.js +6 -402
- package/dist/app-switcher-navigation-bar.cjs +5 -401
- package/dist/app-switcher-navigation-bar.js +5 -401
- package/dist/apple-cards-carousel.cjs +84 -480
- package/dist/apple-cards-carousel.js +19 -415
- package/dist/auth.cjs +10 -387
- package/dist/auth.js +7 -385
- package/dist/avatar.cjs +2 -9
- package/dist/avatar.js +2 -10
- package/dist/badge.cjs +8 -228
- package/dist/badge.js +5 -210
- package/dist/button.cjs +14 -67
- package/dist/button.js +12 -65
- package/dist/chrome.cjs +29 -493
- package/dist/chrome.js +9 -474
- package/dist/code-block.cjs +16 -664
- package/dist/code-block.js +13 -662
- package/dist/code-compare.cjs +28 -1302
- package/dist/code-compare.js +18 -1293
- package/dist/code-diff.cjs +21 -669
- package/dist/code-diff.js +17 -666
- package/dist/code-editor.cjs +13 -409
- package/dist/code-editor.js +12 -408
- package/dist/code-explorer.cjs +14 -456
- package/dist/code-explorer.js +13 -456
- package/dist/code-preview.cjs +31 -983
- package/dist/code-preview.js +23 -976
- package/dist/code-snippet.cjs +19 -667
- package/dist/code-snippet.js +14 -663
- package/dist/code-terminal.cjs +24 -485
- package/dist/code-terminal.js +19 -481
- package/dist/collapsible.cjs +13 -347
- package/dist/collapsible.js +11 -330
- package/dist/color-picker.cjs +8 -450
- package/dist/color-picker.js +7 -450
- package/dist/combobox.cjs +6 -402
- package/dist/combobox.js +6 -402
- package/dist/communication-navigation-bar.cjs +7 -403
- package/dist/communication-navigation-bar.js +5 -401
- package/dist/dashboard-navigation-bar.cjs +6 -402
- package/dist/dashboard-navigation-bar.js +5 -401
- package/dist/dialog-stack.cjs +5 -401
- package/dist/dialog-stack.js +5 -401
- package/dist/dialog.cjs +13 -70
- package/dist/dialog.js +13 -70
- package/dist/drawer.cjs +23 -99
- package/dist/drawer.js +19 -96
- package/dist/e-commerce-navigation-bar.cjs +7 -403
- package/dist/e-commerce-navigation-bar.js +5 -401
- package/dist/editor.cjs +9 -405
- package/dist/editor.js +6 -402
- package/dist/iam.cjs +2 -123
- package/dist/iam.js +1 -122
- package/dist/icon-button.cjs +2 -56
- package/dist/icon-button.js +1 -55
- package/dist/identity.cjs +28 -242
- package/dist/identity.js +20 -235
- package/dist/image-crop.cjs +10 -406
- package/dist/image-crop.js +7 -403
- package/dist/image.cjs +14 -83
- package/dist/image.js +13 -67
- package/dist/index.cjs +1868 -38770
- package/dist/index.js +174 -38320
- package/dist/input-group.cjs +3 -10
- package/dist/input-group.js +2 -10
- package/dist/item.cjs +2 -27
- package/dist/item.js +1 -22
- package/dist/kanban.cjs +25 -751
- package/dist/kanban.js +15 -742
- package/dist/limelight-nav.cjs +10 -452
- package/dist/limelight-nav.js +9 -452
- package/dist/link.cjs +11 -80
- package/dist/link.js +6 -60
- package/dist/lux.config.cjs +14 -32
- package/dist/lux.config.js +3 -26
- package/dist/menu.cjs +5 -13
- package/dist/menu.js +1 -9
- package/dist/message-dock.cjs +5 -401
- package/dist/message-dock.js +5 -401
- package/dist/mini-calendar.cjs +7 -403
- package/dist/mini-calendar.js +6 -402
- package/dist/music-player.cjs +30 -528
- package/dist/music-player.js +22 -520
- package/dist/next.cjs +8 -89
- package/dist/next.js +3 -86
- package/dist/popover.cjs +17 -74
- package/dist/popover.js +16 -73
- package/dist/progress-circle.cjs +3 -10
- package/dist/progress-circle.js +2 -10
- package/dist/provider.cjs +7 -176
- package/dist/provider.js +4 -174
- package/dist/select.cjs +36 -89
- package/dist/select.js +35 -88
- package/dist/sidebar.cjs +22 -493
- package/dist/sidebar.js +17 -489
- package/dist/site/commerce/ui/context.cjs +9 -214
- package/dist/site/commerce/ui/context.js +6 -215
- package/dist/site/components/analytics.cjs +2 -42
- package/dist/site/components/analytics.js +1 -37
- package/dist/site/components/auth/callback.cjs +2 -8
- package/dist/site/components/auth/callback.js +1 -7
- package/dist/site/components/auth/login-panel.cjs +15 -74
- package/dist/site/components/auth/login-panel.js +12 -73
- package/dist/site/components/auth/login.cjs +2 -6
- package/dist/site/components/auth/login.js +1 -5
- package/dist/site/components/auth/widget.cjs +2 -6
- package/dist/site/components/auth/widget.js +1 -5
- package/dist/site/components/commerce/bag-button.cjs +2 -3
- package/dist/site/components/commerce/bag-button.js +2 -3
- package/dist/site/components/commerce/buy-button.cjs +2 -11
- package/dist/site/components/commerce/buy-button.js +1 -10
- package/dist/site/components/commerce/checkout-button.cjs +2 -3
- package/dist/site/components/commerce/checkout-button.js +2 -3
- package/dist/site/components/commerce/checkout-panel/desktop-cp.cjs +15 -173
- package/dist/site/components/commerce/checkout-panel/desktop-cp.js +14 -174
- package/dist/site/components/commerce/checkout-panel/index.cjs +9 -400
- package/dist/site/components/commerce/checkout-panel/index.js +10 -403
- package/dist/site/components/commerce/checkout-panel/mobile-cp.cjs +15 -236
- package/dist/site/components/commerce/checkout-panel/mobile-cp.js +13 -237
- package/dist/site/components/commerce/desktop-bag-popup.cjs +7 -8
- package/dist/site/components/commerce/desktop-bag-popup.js +3 -8
- package/dist/site/components/commerce/drawer/index.cjs +15 -289
- package/dist/site/components/commerce/drawer/index.js +10 -290
- package/dist/site/components/commerce/drawer/micro.cjs +8 -115
- package/dist/site/components/commerce/drawer/micro.js +4 -115
- package/dist/site/components/commerce/drawer/shell.cjs +2 -10
- package/dist/site/components/commerce/drawer/shell.js +2 -10
- package/dist/site/components/contact-dialog/index.cjs +6 -69
- package/dist/site/components/contact-dialog/index.js +7 -71
- package/dist/site/components/drawer-margin.cjs +2 -10
- package/dist/site/components/drawer-margin.js +2 -10
- package/dist/site/components/footer.cjs +11 -81
- package/dist/site/components/footer.js +8 -80
- package/dist/site/components/header/desktop.cjs +18 -374
- package/dist/site/components/header/desktop.js +12 -355
- package/dist/site/components/header/index.cjs +9 -674
- package/dist/site/components/header/index.js +8 -657
- package/dist/site/components/header/mobile-bag-drawer.cjs +6 -71
- package/dist/site/components/header/mobile-bag-drawer.js +5 -74
- package/dist/site/components/header/mobile-nav-menu-ai.cjs +25 -28
- package/dist/site/components/header/mobile-nav-menu-ai.js +24 -27
- package/dist/site/components/header/mobile-nav-menu-item.cjs +6 -60
- package/dist/site/components/header/mobile-nav-menu-item.js +6 -61
- package/dist/site/components/header/mobile-nav-menu.cjs +7 -110
- package/dist/site/components/header/mobile-nav-menu.js +7 -112
- package/dist/site/components/header/mobile.cjs +48 -330
- package/dist/site/components/header/mobile.js +42 -330
- package/dist/site/components/icons/index.cjs +34 -35
- package/dist/site/components/icons/index.js +5 -33
- package/dist/site/components/index.cjs +118 -1961
- package/dist/site/components/index.js +23 -1951
- package/dist/site/components/mini-chart/index.cjs +7 -90
- package/dist/site/components/mini-chart/index.js +1 -92
- package/dist/site/components/mini-chart/wrapper.cjs +7 -76
- package/dist/site/components/mini-chart/wrapper.js +4 -77
- package/dist/site/components/not-found/index.cjs +9 -819
- package/dist/site/components/not-found/index.js +8 -802
- package/dist/site/components/security/index.cjs +9 -819
- package/dist/site/components/security/index.js +8 -802
- package/dist/site/next/analytics/index.cjs +16 -49
- package/dist/site/next/analytics/index.js +3 -49
- package/dist/site/next/analytics/pixel-analytics.cjs +23 -8
- package/dist/site/next/analytics/pixel-analytics.js +4 -8
- package/dist/site/next/index.cjs +13 -140
- package/dist/site/next/index.js +2 -140
- package/dist/site/root-layout/index.cjs +12 -1435
- package/dist/site/root-layout/index.css +0 -133
- package/dist/site/root-layout/index.js +12 -1416
- package/dist/site/site-def/footer/community.cjs +11 -27
- package/dist/site/site-def/footer/community.js +2 -18
- package/dist/site/site-def/footer/index.cjs +38 -218
- package/dist/site/site-def/footer/index.js +14 -215
- package/dist/site/site-def/index.cjs +28 -620
- package/dist/site/site-def/index.js +3 -624
- package/dist/table.cjs +20 -338
- package/dist/table.js +19 -338
- package/dist/tabs.cjs +3 -10
- package/dist/tabs.js +1 -9
- package/dist/tag.cjs +9 -270
- package/dist/tag.js +6 -268
- package/dist/tags.cjs +6 -314
- package/dist/tags.js +5 -314
- package/dist/textarea.cjs +4 -50
- package/dist/textarea.js +3 -49
- package/dist/tooltip.cjs +15 -34
- package/dist/tooltip.js +13 -33
- package/dist/vite.cjs +3 -82
- package/dist/vite.js +1 -80
- package/package.json +1 -1
- package/dist/index.css +0 -132
- package/dist/site/components/auth/login-panel.css +0 -4
- package/dist/site/components/commerce/bag-button.css +0 -4
- package/dist/site/components/commerce/checkout-button.css +0 -4
- package/dist/site/components/commerce/checkout-panel/desktop-cp.css +0 -132
- package/dist/site/components/commerce/checkout-panel/index.css +0 -132
- package/dist/site/components/commerce/checkout-panel/mobile-cp.css +0 -132
- package/dist/site/components/commerce/desktop-bag-popup.css +0 -4
- package/dist/site/components/commerce/drawer/index.css +0 -132
- package/dist/site/components/commerce/drawer/micro.css +0 -4
- package/dist/site/components/header/desktop.css +0 -4
- package/dist/site/components/header/index.css +0 -132
- package/dist/site/components/header/mobile-bag-drawer.css +0 -4
- package/dist/site/components/header/mobile-nav-menu-ai.css +0 -132
- package/dist/site/components/header/mobile-nav-menu-item.css +0 -132
- package/dist/site/components/header/mobile-nav-menu.css +0 -132
- package/dist/site/components/header/mobile.css +0 -132
- package/dist/site/components/icons/index.css +0 -4
- package/dist/site/components/index.css +0 -132
- package/dist/site/components/not-found/index.css +0 -132
- package/dist/site/components/security/index.css +0 -132
- package/dist/site/site-def/footer/community.css +0 -4
- package/dist/site/site-def/footer/index.css +0 -4
- package/dist/site/site-def/index.css +0 -4
package/dist/tag.cjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var gui = require('@hanzo/gui');
|
|
4
|
-
var
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var closeButton_js = require('./close-button.js');
|
|
6
|
+
var skeleton_js = require('./skeleton.js');
|
|
7
|
+
var tooltip_js = require('./tooltip.js');
|
|
5
8
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var ui = require('@hanzo/ui');
|
|
7
|
-
var usehooks = require('@uidotdev/usehooks');
|
|
8
9
|
|
|
9
10
|
function _interopNamespace(e) {
|
|
10
11
|
if (e && e.__esModule) return e;
|
|
@@ -24,274 +25,12 @@ function _interopNamespace(e) {
|
|
|
24
25
|
return Object.freeze(n);
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
var
|
|
28
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
28
29
|
|
|
29
30
|
// src/tag.tsx
|
|
30
|
-
var CLOSE_ICON_PATH = "M9.44 8.035a.791.791 0 0 0 1.12 0l3.802-3.803a.791.791 0 0 1 1.119 0l.287.287a.79.79 0 0 1 0 1.119L11.965 9.44a.79.79 0 0 0 0 1.118l3.803 3.803a.791.791 0 0 1 0 1.119l-.287.287a.791.791 0 0 1-1.119 0l-3.803-3.803a.79.79 0 0 0-1.118 0l-3.803 3.803a.79.79 0 0 1-1.119 0l-.287-.287a.791.791 0 0 1 0-1.119l3.803-3.803a.791.791 0 0 0 0-1.118L4.232 5.638a.791.791 0 0 1 0-1.119l.287-.287a.791.791 0 0 1 1.119 0L9.44 8.035Z";
|
|
31
|
-
var CloseButtonFrame = gui.styled(gui.View, {
|
|
32
|
-
name: "LuxCloseButton",
|
|
33
|
-
render: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", "aria-label": "Close" }),
|
|
34
|
-
role: "button",
|
|
35
|
-
cursor: "pointer",
|
|
36
|
-
display: "inline-flex",
|
|
37
|
-
alignItems: "center",
|
|
38
|
-
justifyContent: "center",
|
|
39
|
-
width: 20,
|
|
40
|
-
height: 20,
|
|
41
|
-
minWidth: 0,
|
|
42
|
-
flexShrink: 1,
|
|
43
|
-
padding: 0,
|
|
44
|
-
borderRadius: 4,
|
|
45
|
-
borderWidth: 0,
|
|
46
|
-
overflow: "hidden",
|
|
47
|
-
backgroundColor: "transparent",
|
|
48
|
-
hoverStyle: {
|
|
49
|
-
backgroundColor: "transparent"
|
|
50
|
-
},
|
|
51
|
-
variants: {
|
|
52
|
-
disabled: {
|
|
53
|
-
true: {
|
|
54
|
-
opacity: 0.4,
|
|
55
|
-
pointerEvents: "none"
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
var CloseButton = React4__namespace.forwardRef(function CloseButton2(props, ref) {
|
|
61
|
-
const { variant: _variant, size: _size, className, children, ...rest } = props;
|
|
62
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
63
|
-
CloseButtonFrame,
|
|
64
|
-
{
|
|
65
|
-
ref,
|
|
66
|
-
className,
|
|
67
|
-
...rest,
|
|
68
|
-
children: children ?? /* @__PURE__ */ jsxRuntime.jsx(
|
|
69
|
-
"svg",
|
|
70
|
-
{
|
|
71
|
-
width: 20,
|
|
72
|
-
height: 20,
|
|
73
|
-
viewBox: "0 0 20 20",
|
|
74
|
-
fill: "none",
|
|
75
|
-
"aria-hidden": "true",
|
|
76
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
77
|
-
"path",
|
|
78
|
-
{
|
|
79
|
-
d: CLOSE_ICON_PATH,
|
|
80
|
-
fill: "currentColor"
|
|
81
|
-
}
|
|
82
|
-
)
|
|
83
|
-
}
|
|
84
|
-
)
|
|
85
|
-
}
|
|
86
|
-
);
|
|
87
|
-
});
|
|
88
|
-
var SKELETON_CLASSES = "lux-skeleton rounded-sm";
|
|
89
|
-
var Skeleton = React4__namespace.forwardRef(
|
|
90
|
-
function Skeleton2(props, ref) {
|
|
91
|
-
const { loading = true, asChild, className, children, style, ...rest } = props;
|
|
92
|
-
if (!loading) {
|
|
93
|
-
if (asChild && React4__namespace.isValidElement(children)) return children;
|
|
94
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { ref, className, style, ...rest, children });
|
|
95
|
-
}
|
|
96
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
97
|
-
"div",
|
|
98
|
-
{
|
|
99
|
-
ref,
|
|
100
|
-
"data-loading": true,
|
|
101
|
-
...ui.sx(
|
|
102
|
-
SKELETON_CLASSES,
|
|
103
|
-
asChild || children ? "[&_*]:invisible" : "min-h-5",
|
|
104
|
-
className
|
|
105
|
-
),
|
|
106
|
-
style,
|
|
107
|
-
...rest,
|
|
108
|
-
children
|
|
109
|
-
}
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
);
|
|
113
|
-
React4__namespace.forwardRef(
|
|
114
|
-
function SkeletonCircle2(props, ref) {
|
|
115
|
-
const { size = 40, loading = true, className, ...rest } = props;
|
|
116
|
-
const dimension = typeof size === "number" ? `${size}px` : size;
|
|
117
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
118
|
-
Skeleton,
|
|
119
|
-
{
|
|
120
|
-
ref,
|
|
121
|
-
loading,
|
|
122
|
-
...ui.sx("rounded-full shrink-0", className),
|
|
123
|
-
style: { width: dimension, height: dimension, ...rest.style },
|
|
124
|
-
...rest
|
|
125
|
-
}
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
);
|
|
129
|
-
React4__namespace.forwardRef(
|
|
130
|
-
function SkeletonText2(props, ref) {
|
|
131
|
-
const { noOfLines = 3, loading = true, className, ...rest } = props;
|
|
132
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { ref, className: ui.cn("flex w-full flex-col gap-2", className), ...rest, children: Array.from({ length: noOfLines }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
133
|
-
Skeleton,
|
|
134
|
-
{
|
|
135
|
-
loading,
|
|
136
|
-
...ui.sx(ui.cn("h-4", index === noOfLines - 1 && "max-w-[80%]"))
|
|
137
|
-
},
|
|
138
|
-
index
|
|
139
|
-
)) });
|
|
140
|
-
}
|
|
141
|
-
);
|
|
142
|
-
var ink = (children, Wrap = gui.Text, props = {}) => {
|
|
143
|
-
let hasText = false;
|
|
144
|
-
React4.Children.forEach(children, (child) => {
|
|
145
|
-
if (typeof child === "string" || typeof child === "number") hasText = true;
|
|
146
|
-
});
|
|
147
|
-
if (!hasText) return children;
|
|
148
|
-
return React4.Children.map(children, (child) => typeof child === "string" || typeof child === "number" ? React4.createElement(Wrap, props, child) : child);
|
|
149
|
-
};
|
|
150
|
-
var TOUCH_PX = 1024;
|
|
151
|
-
function useBelow(px) {
|
|
152
|
-
const [below, setBelow] = React4__namespace.useState(false);
|
|
153
|
-
React4__namespace.useEffect(() => {
|
|
154
|
-
const mql = window.matchMedia(`(max-width: ${px - 1}px)`);
|
|
155
|
-
const apply = () => setBelow(mql.matches);
|
|
156
|
-
apply();
|
|
157
|
-
mql.addEventListener("change", apply);
|
|
158
|
-
return () => mql.removeEventListener("change", apply);
|
|
159
|
-
}, [px]);
|
|
160
|
-
return below;
|
|
161
|
-
}
|
|
162
|
-
var useIsTouch = () => useBelow(TOUCH_PX);
|
|
163
|
-
function mapPlacement(p) {
|
|
164
|
-
if (!p) return void 0;
|
|
165
|
-
return p;
|
|
166
|
-
}
|
|
167
|
-
var Tooltip = React4__namespace.forwardRef(
|
|
168
|
-
function Tooltip2(props, ref) {
|
|
169
|
-
const {
|
|
170
|
-
showArrow: showArrowProp,
|
|
171
|
-
onOpenChange,
|
|
172
|
-
variant,
|
|
173
|
-
selected,
|
|
174
|
-
children,
|
|
175
|
-
disabled,
|
|
176
|
-
disableOnMobile,
|
|
177
|
-
content,
|
|
178
|
-
contentProps,
|
|
179
|
-
defaultOpen = false,
|
|
180
|
-
triggerProps,
|
|
181
|
-
closeDelay = 100,
|
|
182
|
-
openDelay = 100,
|
|
183
|
-
interactive,
|
|
184
|
-
positioning
|
|
185
|
-
} = props;
|
|
186
|
-
const [open, setOpen] = React4__namespace.useState(defaultOpen);
|
|
187
|
-
const timeoutRef = React4__namespace.useRef(null);
|
|
188
|
-
const isMobile = useIsTouch();
|
|
189
|
-
const handleOpenChange = React4__namespace.useCallback((nextOpen) => {
|
|
190
|
-
setOpen(nextOpen);
|
|
191
|
-
onOpenChange?.({ open: nextOpen });
|
|
192
|
-
}, [onOpenChange]);
|
|
193
|
-
const handleOpenChangeManual = React4__namespace.useCallback((nextOpen) => {
|
|
194
|
-
timeoutRef.current && window.clearTimeout(timeoutRef.current);
|
|
195
|
-
timeoutRef.current = window.setTimeout(() => {
|
|
196
|
-
setOpen(nextOpen);
|
|
197
|
-
onOpenChange?.({ open: nextOpen });
|
|
198
|
-
}, nextOpen ? openDelay : closeDelay);
|
|
199
|
-
}, [closeDelay, openDelay, onOpenChange]);
|
|
200
|
-
const handleClickAway = React4__namespace.useCallback(() => {
|
|
201
|
-
if (open) handleOpenChangeManual(false);
|
|
202
|
-
}, [open, handleOpenChangeManual]);
|
|
203
|
-
const triggerRef = usehooks.useClickAway(handleClickAway);
|
|
204
|
-
const handleTriggerClick = React4__namespace.useCallback(() => {
|
|
205
|
-
handleOpenChangeManual(!open);
|
|
206
|
-
}, [handleOpenChangeManual, open]);
|
|
207
|
-
const handleContentClick = React4__namespace.useCallback((event) => {
|
|
208
|
-
event.stopPropagation();
|
|
209
|
-
if (interactive) {
|
|
210
|
-
const closestLink = event.target?.closest("a");
|
|
211
|
-
if (closestLink) {
|
|
212
|
-
handleOpenChangeManual(false);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}, [interactive, handleOpenChangeManual]);
|
|
216
|
-
React4__namespace.useEffect(() => {
|
|
217
|
-
return () => {
|
|
218
|
-
if (timeoutRef.current) {
|
|
219
|
-
clearTimeout(timeoutRef.current);
|
|
220
|
-
}
|
|
221
|
-
};
|
|
222
|
-
}, []);
|
|
223
|
-
if (disabled || disableOnMobile && isMobile) return children;
|
|
224
|
-
const defaultShowArrow = variant === "popover" ? false : true;
|
|
225
|
-
const showArrow = showArrowProp !== void 0 ? showArrowProp : defaultShowArrow;
|
|
226
|
-
const isPopover = variant === "popover";
|
|
227
|
-
const placement = mapPlacement(positioning?.placement) ?? "top";
|
|
228
|
-
const offset = positioning?.offset?.mainAxis ?? 4;
|
|
229
|
-
return /* @__PURE__ */ jsxRuntime.jsx(gui.TooltipGroup, { delay: openDelay, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
230
|
-
gui.Tooltip,
|
|
231
|
-
{
|
|
232
|
-
open,
|
|
233
|
-
onOpenChange: handleOpenChange,
|
|
234
|
-
delay: { open: openDelay, close: closeDelay },
|
|
235
|
-
placement,
|
|
236
|
-
offset,
|
|
237
|
-
unstyled: true,
|
|
238
|
-
children: [
|
|
239
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
240
|
-
gui.Tooltip.Trigger,
|
|
241
|
-
{
|
|
242
|
-
ref: triggerRef,
|
|
243
|
-
asChild: true,
|
|
244
|
-
...isMobile ? { onClick: handleTriggerClick } : {},
|
|
245
|
-
...triggerProps,
|
|
246
|
-
children
|
|
247
|
-
}
|
|
248
|
-
),
|
|
249
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
250
|
-
gui.Tooltip.Content,
|
|
251
|
-
{
|
|
252
|
-
ref,
|
|
253
|
-
unstyled: true,
|
|
254
|
-
zIndex: 9999,
|
|
255
|
-
overflow: "hidden",
|
|
256
|
-
borderRadius: 8,
|
|
257
|
-
paddingHorizontal: 12,
|
|
258
|
-
paddingVertical: 8,
|
|
259
|
-
maxWidth: isPopover ? 384 : 320,
|
|
260
|
-
backgroundColor: isPopover ? "var(--color-popover-bg)" : "var(--color-tooltip-bg)",
|
|
261
|
-
transition: "quick",
|
|
262
|
-
enterStyle: { opacity: 0, scale: 0.95 },
|
|
263
|
-
exitStyle: { opacity: 0, scale: 0.95 },
|
|
264
|
-
...isPopover ? {
|
|
265
|
-
borderWidth: 1,
|
|
266
|
-
borderColor: "var(--color-border-divider)",
|
|
267
|
-
shadowColor: "var(--shadow-popover)"
|
|
268
|
-
} : {},
|
|
269
|
-
onClick: interactive ? handleContentClick : void 0,
|
|
270
|
-
...selected ? { "data-selected": true } : {},
|
|
271
|
-
...contentProps,
|
|
272
|
-
children: [
|
|
273
|
-
showArrow && /* @__PURE__ */ jsxRuntime.jsx(
|
|
274
|
-
gui.Tooltip.Arrow,
|
|
275
|
-
{
|
|
276
|
-
unstyled: true,
|
|
277
|
-
backgroundColor: isPopover ? "var(--color-popover-bg)" : "var(--color-tooltip-bg)"
|
|
278
|
-
}
|
|
279
|
-
),
|
|
280
|
-
ink(content, void 0, {
|
|
281
|
-
fontSize: 14,
|
|
282
|
-
color: isPopover ? "var(--color-text-primary)" : "var(--color-tooltip-fg)"
|
|
283
|
-
})
|
|
284
|
-
]
|
|
285
|
-
}
|
|
286
|
-
)
|
|
287
|
-
]
|
|
288
|
-
}
|
|
289
|
-
) });
|
|
290
|
-
}
|
|
291
|
-
);
|
|
292
31
|
var nbsp = String.fromCharCode(160);
|
|
293
32
|
function TruncatedTextTooltip({ label, children }) {
|
|
294
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Tooltip, { content: label, positioning: { placement: "top" }, children });
|
|
33
|
+
return /* @__PURE__ */ jsxRuntime.jsx(tooltip_js.Tooltip, { content: label, positioning: { placement: "top" }, children });
|
|
295
34
|
}
|
|
296
35
|
var TAG_VARIANT = {
|
|
297
36
|
subtle: { backgroundColor: "var(--color-tag-subtle-bg)" },
|
|
@@ -311,7 +50,7 @@ var TAG_SIZE = {
|
|
|
311
50
|
lg: { paddingHorizontal: 6, paddingVertical: 6, minHeight: 32, minWidth: 32, gap: 4 }
|
|
312
51
|
};
|
|
313
52
|
var TAG_SIZE_FONT = { sm: 12, md: 14, lg: 14 };
|
|
314
|
-
var Tag =
|
|
53
|
+
var Tag = React__namespace.forwardRef(
|
|
315
54
|
function Tag2(props, ref) {
|
|
316
55
|
const {
|
|
317
56
|
variant,
|
|
@@ -362,7 +101,7 @@ var Tag = React4__namespace.forwardRef(
|
|
|
362
101
|
)
|
|
363
102
|
);
|
|
364
103
|
const contentElement = truncated ? /* @__PURE__ */ jsxRuntime.jsx(TruncatedTextTooltip, { label: children, children: labelSpan }) : labelSpan;
|
|
365
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { loading, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
104
|
+
return /* @__PURE__ */ jsxRuntime.jsx(skeleton_js.Skeleton, { loading, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
366
105
|
gui.XStack,
|
|
367
106
|
{
|
|
368
107
|
ref,
|
|
@@ -404,7 +143,7 @@ var Tag = React4__namespace.forwardRef(
|
|
|
404
143
|
}
|
|
405
144
|
);
|
|
406
145
|
})(),
|
|
407
|
-
closable && /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { flexShrink: 0, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { onClick: onClose }) })
|
|
146
|
+
closable && /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { flexShrink: 0, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(closeButton_js.CloseButton, { onClick: onClose }) })
|
|
408
147
|
]
|
|
409
148
|
}
|
|
410
149
|
) });
|
package/dist/tag.js
CHANGED
|
@@ -1,273 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as
|
|
3
|
-
import {
|
|
1
|
+
import { XStack, Text } from '@hanzo/gui';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { CloseButton } from './close-button.js';
|
|
4
|
+
import { Skeleton } from './skeleton.js';
|
|
5
|
+
import { Tooltip } from './tooltip.js';
|
|
4
6
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
|
-
import { Box, sx, cn } from '@hanzo/ui';
|
|
6
|
-
import { useClickAway } from '@uidotdev/usehooks';
|
|
7
7
|
|
|
8
8
|
// src/tag.tsx
|
|
9
|
-
var CLOSE_ICON_PATH = "M9.44 8.035a.791.791 0 0 0 1.12 0l3.802-3.803a.791.791 0 0 1 1.119 0l.287.287a.79.79 0 0 1 0 1.119L11.965 9.44a.79.79 0 0 0 0 1.118l3.803 3.803a.791.791 0 0 1 0 1.119l-.287.287a.791.791 0 0 1-1.119 0l-3.803-3.803a.79.79 0 0 0-1.118 0l-3.803 3.803a.79.79 0 0 1-1.119 0l-.287-.287a.791.791 0 0 1 0-1.119l3.803-3.803a.791.791 0 0 0 0-1.118L4.232 5.638a.791.791 0 0 1 0-1.119l.287-.287a.791.791 0 0 1 1.119 0L9.44 8.035Z";
|
|
10
|
-
var CloseButtonFrame = styled(View, {
|
|
11
|
-
name: "LuxCloseButton",
|
|
12
|
-
render: /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Close" }),
|
|
13
|
-
role: "button",
|
|
14
|
-
cursor: "pointer",
|
|
15
|
-
display: "inline-flex",
|
|
16
|
-
alignItems: "center",
|
|
17
|
-
justifyContent: "center",
|
|
18
|
-
width: 20,
|
|
19
|
-
height: 20,
|
|
20
|
-
minWidth: 0,
|
|
21
|
-
flexShrink: 1,
|
|
22
|
-
padding: 0,
|
|
23
|
-
borderRadius: 4,
|
|
24
|
-
borderWidth: 0,
|
|
25
|
-
overflow: "hidden",
|
|
26
|
-
backgroundColor: "transparent",
|
|
27
|
-
hoverStyle: {
|
|
28
|
-
backgroundColor: "transparent"
|
|
29
|
-
},
|
|
30
|
-
variants: {
|
|
31
|
-
disabled: {
|
|
32
|
-
true: {
|
|
33
|
-
opacity: 0.4,
|
|
34
|
-
pointerEvents: "none"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
var CloseButton = React4.forwardRef(function CloseButton2(props, ref) {
|
|
40
|
-
const { variant: _variant, size: _size, className, children, ...rest } = props;
|
|
41
|
-
return /* @__PURE__ */ jsx(
|
|
42
|
-
CloseButtonFrame,
|
|
43
|
-
{
|
|
44
|
-
ref,
|
|
45
|
-
className,
|
|
46
|
-
...rest,
|
|
47
|
-
children: children ?? /* @__PURE__ */ jsx(
|
|
48
|
-
"svg",
|
|
49
|
-
{
|
|
50
|
-
width: 20,
|
|
51
|
-
height: 20,
|
|
52
|
-
viewBox: "0 0 20 20",
|
|
53
|
-
fill: "none",
|
|
54
|
-
"aria-hidden": "true",
|
|
55
|
-
children: /* @__PURE__ */ jsx(
|
|
56
|
-
"path",
|
|
57
|
-
{
|
|
58
|
-
d: CLOSE_ICON_PATH,
|
|
59
|
-
fill: "currentColor"
|
|
60
|
-
}
|
|
61
|
-
)
|
|
62
|
-
}
|
|
63
|
-
)
|
|
64
|
-
}
|
|
65
|
-
);
|
|
66
|
-
});
|
|
67
|
-
var SKELETON_CLASSES = "lux-skeleton rounded-sm";
|
|
68
|
-
var Skeleton = React4.forwardRef(
|
|
69
|
-
function Skeleton2(props, ref) {
|
|
70
|
-
const { loading = true, asChild, className, children, style, ...rest } = props;
|
|
71
|
-
if (!loading) {
|
|
72
|
-
if (asChild && React4.isValidElement(children)) return children;
|
|
73
|
-
return /* @__PURE__ */ jsx(Box, { ref, className, style, ...rest, children });
|
|
74
|
-
}
|
|
75
|
-
return /* @__PURE__ */ jsx(
|
|
76
|
-
"div",
|
|
77
|
-
{
|
|
78
|
-
ref,
|
|
79
|
-
"data-loading": true,
|
|
80
|
-
...sx(
|
|
81
|
-
SKELETON_CLASSES,
|
|
82
|
-
asChild || children ? "[&_*]:invisible" : "min-h-5",
|
|
83
|
-
className
|
|
84
|
-
),
|
|
85
|
-
style,
|
|
86
|
-
...rest,
|
|
87
|
-
children
|
|
88
|
-
}
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
);
|
|
92
|
-
React4.forwardRef(
|
|
93
|
-
function SkeletonCircle2(props, ref) {
|
|
94
|
-
const { size = 40, loading = true, className, ...rest } = props;
|
|
95
|
-
const dimension = typeof size === "number" ? `${size}px` : size;
|
|
96
|
-
return /* @__PURE__ */ jsx(
|
|
97
|
-
Skeleton,
|
|
98
|
-
{
|
|
99
|
-
ref,
|
|
100
|
-
loading,
|
|
101
|
-
...sx("rounded-full shrink-0", className),
|
|
102
|
-
style: { width: dimension, height: dimension, ...rest.style },
|
|
103
|
-
...rest
|
|
104
|
-
}
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
);
|
|
108
|
-
React4.forwardRef(
|
|
109
|
-
function SkeletonText2(props, ref) {
|
|
110
|
-
const { noOfLines = 3, loading = true, className, ...rest } = props;
|
|
111
|
-
return /* @__PURE__ */ jsx(Box, { ref, className: cn("flex w-full flex-col gap-2", className), ...rest, children: Array.from({ length: noOfLines }).map((_, index) => /* @__PURE__ */ jsx(
|
|
112
|
-
Skeleton,
|
|
113
|
-
{
|
|
114
|
-
loading,
|
|
115
|
-
...sx(cn("h-4", index === noOfLines - 1 && "max-w-[80%]"))
|
|
116
|
-
},
|
|
117
|
-
index
|
|
118
|
-
)) });
|
|
119
|
-
}
|
|
120
|
-
);
|
|
121
|
-
var ink = (children, Wrap = Text, props = {}) => {
|
|
122
|
-
let hasText = false;
|
|
123
|
-
Children.forEach(children, (child) => {
|
|
124
|
-
if (typeof child === "string" || typeof child === "number") hasText = true;
|
|
125
|
-
});
|
|
126
|
-
if (!hasText) return children;
|
|
127
|
-
return Children.map(children, (child) => typeof child === "string" || typeof child === "number" ? createElement(Wrap, props, child) : child);
|
|
128
|
-
};
|
|
129
|
-
var TOUCH_PX = 1024;
|
|
130
|
-
function useBelow(px) {
|
|
131
|
-
const [below, setBelow] = React4.useState(false);
|
|
132
|
-
React4.useEffect(() => {
|
|
133
|
-
const mql = window.matchMedia(`(max-width: ${px - 1}px)`);
|
|
134
|
-
const apply = () => setBelow(mql.matches);
|
|
135
|
-
apply();
|
|
136
|
-
mql.addEventListener("change", apply);
|
|
137
|
-
return () => mql.removeEventListener("change", apply);
|
|
138
|
-
}, [px]);
|
|
139
|
-
return below;
|
|
140
|
-
}
|
|
141
|
-
var useIsTouch = () => useBelow(TOUCH_PX);
|
|
142
|
-
function mapPlacement(p) {
|
|
143
|
-
if (!p) return void 0;
|
|
144
|
-
return p;
|
|
145
|
-
}
|
|
146
|
-
var Tooltip = React4.forwardRef(
|
|
147
|
-
function Tooltip2(props, ref) {
|
|
148
|
-
const {
|
|
149
|
-
showArrow: showArrowProp,
|
|
150
|
-
onOpenChange,
|
|
151
|
-
variant,
|
|
152
|
-
selected,
|
|
153
|
-
children,
|
|
154
|
-
disabled,
|
|
155
|
-
disableOnMobile,
|
|
156
|
-
content,
|
|
157
|
-
contentProps,
|
|
158
|
-
defaultOpen = false,
|
|
159
|
-
triggerProps,
|
|
160
|
-
closeDelay = 100,
|
|
161
|
-
openDelay = 100,
|
|
162
|
-
interactive,
|
|
163
|
-
positioning
|
|
164
|
-
} = props;
|
|
165
|
-
const [open, setOpen] = React4.useState(defaultOpen);
|
|
166
|
-
const timeoutRef = React4.useRef(null);
|
|
167
|
-
const isMobile = useIsTouch();
|
|
168
|
-
const handleOpenChange = React4.useCallback((nextOpen) => {
|
|
169
|
-
setOpen(nextOpen);
|
|
170
|
-
onOpenChange?.({ open: nextOpen });
|
|
171
|
-
}, [onOpenChange]);
|
|
172
|
-
const handleOpenChangeManual = React4.useCallback((nextOpen) => {
|
|
173
|
-
timeoutRef.current && window.clearTimeout(timeoutRef.current);
|
|
174
|
-
timeoutRef.current = window.setTimeout(() => {
|
|
175
|
-
setOpen(nextOpen);
|
|
176
|
-
onOpenChange?.({ open: nextOpen });
|
|
177
|
-
}, nextOpen ? openDelay : closeDelay);
|
|
178
|
-
}, [closeDelay, openDelay, onOpenChange]);
|
|
179
|
-
const handleClickAway = React4.useCallback(() => {
|
|
180
|
-
if (open) handleOpenChangeManual(false);
|
|
181
|
-
}, [open, handleOpenChangeManual]);
|
|
182
|
-
const triggerRef = useClickAway(handleClickAway);
|
|
183
|
-
const handleTriggerClick = React4.useCallback(() => {
|
|
184
|
-
handleOpenChangeManual(!open);
|
|
185
|
-
}, [handleOpenChangeManual, open]);
|
|
186
|
-
const handleContentClick = React4.useCallback((event) => {
|
|
187
|
-
event.stopPropagation();
|
|
188
|
-
if (interactive) {
|
|
189
|
-
const closestLink = event.target?.closest("a");
|
|
190
|
-
if (closestLink) {
|
|
191
|
-
handleOpenChangeManual(false);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}, [interactive, handleOpenChangeManual]);
|
|
195
|
-
React4.useEffect(() => {
|
|
196
|
-
return () => {
|
|
197
|
-
if (timeoutRef.current) {
|
|
198
|
-
clearTimeout(timeoutRef.current);
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
}, []);
|
|
202
|
-
if (disabled || disableOnMobile && isMobile) return children;
|
|
203
|
-
const defaultShowArrow = variant === "popover" ? false : true;
|
|
204
|
-
const showArrow = showArrowProp !== void 0 ? showArrowProp : defaultShowArrow;
|
|
205
|
-
const isPopover = variant === "popover";
|
|
206
|
-
const placement = mapPlacement(positioning?.placement) ?? "top";
|
|
207
|
-
const offset = positioning?.offset?.mainAxis ?? 4;
|
|
208
|
-
return /* @__PURE__ */ jsx(TooltipGroup, { delay: openDelay, children: /* @__PURE__ */ jsxs(
|
|
209
|
-
Tooltip$1,
|
|
210
|
-
{
|
|
211
|
-
open,
|
|
212
|
-
onOpenChange: handleOpenChange,
|
|
213
|
-
delay: { open: openDelay, close: closeDelay },
|
|
214
|
-
placement,
|
|
215
|
-
offset,
|
|
216
|
-
unstyled: true,
|
|
217
|
-
children: [
|
|
218
|
-
/* @__PURE__ */ jsx(
|
|
219
|
-
Tooltip$1.Trigger,
|
|
220
|
-
{
|
|
221
|
-
ref: triggerRef,
|
|
222
|
-
asChild: true,
|
|
223
|
-
...isMobile ? { onClick: handleTriggerClick } : {},
|
|
224
|
-
...triggerProps,
|
|
225
|
-
children
|
|
226
|
-
}
|
|
227
|
-
),
|
|
228
|
-
/* @__PURE__ */ jsxs(
|
|
229
|
-
Tooltip$1.Content,
|
|
230
|
-
{
|
|
231
|
-
ref,
|
|
232
|
-
unstyled: true,
|
|
233
|
-
zIndex: 9999,
|
|
234
|
-
overflow: "hidden",
|
|
235
|
-
borderRadius: 8,
|
|
236
|
-
paddingHorizontal: 12,
|
|
237
|
-
paddingVertical: 8,
|
|
238
|
-
maxWidth: isPopover ? 384 : 320,
|
|
239
|
-
backgroundColor: isPopover ? "var(--color-popover-bg)" : "var(--color-tooltip-bg)",
|
|
240
|
-
transition: "quick",
|
|
241
|
-
enterStyle: { opacity: 0, scale: 0.95 },
|
|
242
|
-
exitStyle: { opacity: 0, scale: 0.95 },
|
|
243
|
-
...isPopover ? {
|
|
244
|
-
borderWidth: 1,
|
|
245
|
-
borderColor: "var(--color-border-divider)",
|
|
246
|
-
shadowColor: "var(--shadow-popover)"
|
|
247
|
-
} : {},
|
|
248
|
-
onClick: interactive ? handleContentClick : void 0,
|
|
249
|
-
...selected ? { "data-selected": true } : {},
|
|
250
|
-
...contentProps,
|
|
251
|
-
children: [
|
|
252
|
-
showArrow && /* @__PURE__ */ jsx(
|
|
253
|
-
Tooltip$1.Arrow,
|
|
254
|
-
{
|
|
255
|
-
unstyled: true,
|
|
256
|
-
backgroundColor: isPopover ? "var(--color-popover-bg)" : "var(--color-tooltip-bg)"
|
|
257
|
-
}
|
|
258
|
-
),
|
|
259
|
-
ink(content, void 0, {
|
|
260
|
-
fontSize: 14,
|
|
261
|
-
color: isPopover ? "var(--color-text-primary)" : "var(--color-tooltip-fg)"
|
|
262
|
-
})
|
|
263
|
-
]
|
|
264
|
-
}
|
|
265
|
-
)
|
|
266
|
-
]
|
|
267
|
-
}
|
|
268
|
-
) });
|
|
269
|
-
}
|
|
270
|
-
);
|
|
271
9
|
var nbsp = String.fromCharCode(160);
|
|
272
10
|
function TruncatedTextTooltip({ label, children }) {
|
|
273
11
|
return /* @__PURE__ */ jsx(Tooltip, { content: label, positioning: { placement: "top" }, children });
|
|
@@ -290,7 +28,7 @@ var TAG_SIZE = {
|
|
|
290
28
|
lg: { paddingHorizontal: 6, paddingVertical: 6, minHeight: 32, minWidth: 32, gap: 4 }
|
|
291
29
|
};
|
|
292
30
|
var TAG_SIZE_FONT = { sm: 12, md: 14, lg: 14 };
|
|
293
|
-
var Tag =
|
|
31
|
+
var Tag = React.forwardRef(
|
|
294
32
|
function Tag2(props, ref) {
|
|
295
33
|
const {
|
|
296
34
|
variant,
|