@luxfi/ui 7.4.11 → 7.4.13
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/alert.cjs +68 -46
- package/dist/alert.js +69 -46
- package/dist/avatar.cjs +49 -47
- package/dist/avatar.js +52 -49
- 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 +3 -7
- package/dist/chrome.js +3 -7
- package/dist/close-button.cjs +3 -7
- package/dist/close-button.js +3 -7
- package/dist/dialog.cjs +3 -7
- package/dist/dialog.js +3 -7
- package/dist/drawer.cjs +3 -7
- package/dist/drawer.js +3 -7
- 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/greeks-display.cjs +48 -39
- package/dist/greeks-display.js +48 -39
- package/dist/index.cjs +1053 -888
- package/dist/index.js +1054 -889
- package/dist/input-group.cjs +36 -19
- package/dist/input-group.js +37 -19
- 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/pin-input.cjs +30 -29
- package/dist/pin-input.js +30 -29
- package/dist/pnl-diagram.cjs +20 -20
- package/dist/pnl-diagram.js +20 -20
- package/dist/popover.cjs +3 -7
- package/dist/popover.js +3 -7
- package/dist/progress-circle.cjs +40 -22
- package/dist/progress-circle.d.cts +5 -5
- package/dist/progress-circle.d.ts +5 -5
- package/dist/progress-circle.js +41 -22
- 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 -68
- package/dist/radio.d.cts +18 -18
- package/dist/radio.d.ts +18 -18
- package/dist/radio.js +36 -69
- package/dist/rating.cjs +15 -17
- package/dist/rating.js +15 -17
- package/dist/slider.cjs +33 -50
- package/dist/slider.js +34 -51
- package/dist/strategy-builder.cjs +194 -115
- package/dist/strategy-builder.js +194 -115
- package/dist/switch.cjs +48 -55
- package/dist/switch.js +49 -56
- package/dist/tag.cjs +115 -69
- package/dist/tag.js +116 -69
- package/dist/tooltip.cjs +28 -17
- package/dist/tooltip.js +30 -18
- package/package.json +1 -1
- package/src/alert.tsx +78 -45
- package/src/avatar.tsx +54 -38
- package/src/badge.tsx +65 -44
- package/src/checkbox.tsx +70 -89
- package/src/close-button.tsx +3 -8
- package/src/empty-state.tsx +21 -17
- package/src/expiration-selector.tsx +84 -66
- package/src/greeks-display.tsx +59 -51
- package/src/input-group.tsx +38 -24
- package/src/option-chain.tsx +154 -104
- package/src/option-position.tsx +143 -114
- package/src/pin-input.tsx +37 -29
- package/src/pnl-diagram.tsx +36 -28
- package/src/progress-circle.tsx +52 -28
- package/src/progress.tsx +17 -21
- package/src/radio.tsx +56 -76
- package/src/rating.tsx +22 -20
- package/src/slider.tsx +43 -45
- package/src/strategy-builder.tsx +260 -162
- package/src/switch.tsx +63 -64
- package/src/tag.tsx +89 -51
- package/src/tooltip.tsx +21 -13
- package/tokens.css +18 -0
package/dist/alert.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
var gui = require('@hanzo/gui');
|
|
4
5
|
var React2 = require('react');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
7
|
var clsx = require('clsx');
|
|
6
8
|
var tailwindMerge = require('tailwind-merge');
|
|
7
|
-
var gui = require('@hanzo/gui');
|
|
8
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
9
9
|
|
|
10
10
|
function _interopNamespace(e) {
|
|
11
11
|
if (e && e.__esModule) return e;
|
|
@@ -28,9 +28,6 @@ function _interopNamespace(e) {
|
|
|
28
28
|
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
29
29
|
|
|
30
30
|
// src/alert.tsx
|
|
31
|
-
function cn(...inputs) {
|
|
32
|
-
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
33
|
-
}
|
|
34
31
|
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";
|
|
35
32
|
var CloseButtonFrame = gui.styled(gui.View, {
|
|
36
33
|
name: "LuxCloseButton",
|
|
@@ -61,23 +58,19 @@ var CloseButtonFrame = gui.styled(gui.View, {
|
|
|
61
58
|
}
|
|
62
59
|
}
|
|
63
60
|
});
|
|
64
|
-
var CLOSE_BUTTON_CLASSES = [
|
|
65
|
-
"text-[var(--closeButton-fg,currentColor)]",
|
|
66
|
-
"hover:text-[var(--hover-color,currentColor)]",
|
|
67
|
-
"disabled:opacity-40"
|
|
68
|
-
].join(" ");
|
|
69
61
|
var CloseButton = React2__namespace.forwardRef(function CloseButton2(props, ref) {
|
|
70
62
|
const { variant: _variant, size: _size, className, children, ...rest } = props;
|
|
71
63
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
72
64
|
CloseButtonFrame,
|
|
73
65
|
{
|
|
74
66
|
ref,
|
|
75
|
-
className
|
|
67
|
+
className,
|
|
76
68
|
...rest,
|
|
77
69
|
children: children ?? /* @__PURE__ */ jsxRuntime.jsx(
|
|
78
70
|
"svg",
|
|
79
71
|
{
|
|
80
|
-
|
|
72
|
+
width: 20,
|
|
73
|
+
height: 20,
|
|
81
74
|
viewBox: "0 0 20 20",
|
|
82
75
|
fill: "none",
|
|
83
76
|
"aria-hidden": "true",
|
|
@@ -93,6 +86,17 @@ var CloseButton = React2__namespace.forwardRef(function CloseButton2(props, ref)
|
|
|
93
86
|
}
|
|
94
87
|
);
|
|
95
88
|
});
|
|
89
|
+
var ink = (children, Wrap = gui.Text, props = {}) => {
|
|
90
|
+
let hasText = false;
|
|
91
|
+
React2.Children.forEach(children, (child) => {
|
|
92
|
+
if (typeof child === "string" || typeof child === "number") hasText = true;
|
|
93
|
+
});
|
|
94
|
+
if (!hasText) return children;
|
|
95
|
+
return React2.Children.map(children, (child) => typeof child === "string" || typeof child === "number" ? React2.createElement(Wrap, props, child) : child);
|
|
96
|
+
};
|
|
97
|
+
function cn(...inputs) {
|
|
98
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
99
|
+
}
|
|
96
100
|
var SHIM_PROPS = [
|
|
97
101
|
"w",
|
|
98
102
|
"h",
|
|
@@ -276,22 +280,30 @@ React2__namespace.forwardRef(
|
|
|
276
280
|
)) });
|
|
277
281
|
}
|
|
278
282
|
);
|
|
279
|
-
var IndicatorIcon = (
|
|
280
|
-
var ALERT_BASE =
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
283
|
+
var IndicatorIcon = () => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: 20, height: 20, viewBox: "0 0 20 20", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntime.jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zm.75-11.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zM9.25 10a.75.75 0 011.5 0v3a.75.75 0 01-1.5 0v-3z" }) });
|
|
284
|
+
var ALERT_BASE = {
|
|
285
|
+
width: "100%",
|
|
286
|
+
position: "relative",
|
|
287
|
+
alignItems: "flex-start",
|
|
288
|
+
borderRadius: 4,
|
|
289
|
+
gap: 8,
|
|
290
|
+
paddingVertical: 8
|
|
291
|
+
};
|
|
292
|
+
var ALERT_FG = "var(--color-alert-fg)";
|
|
293
|
+
var STATUS_BG = {
|
|
294
|
+
info: "var(--color-alert-bg-info)",
|
|
295
|
+
warning: "var(--color-alert-bg-warning)",
|
|
296
|
+
warning_table: "var(--color-alert-bg-warning-table)",
|
|
297
|
+
success: "var(--color-alert-bg-success)",
|
|
298
|
+
error: "var(--color-alert-bg-error)"
|
|
287
299
|
};
|
|
288
|
-
var
|
|
289
|
-
sm:
|
|
290
|
-
md:
|
|
300
|
+
var SIZE = {
|
|
301
|
+
sm: { paddingHorizontal: 8, fontSize: 12 },
|
|
302
|
+
md: { paddingHorizontal: 12, fontSize: 16 }
|
|
291
303
|
};
|
|
292
|
-
var
|
|
293
|
-
sm:
|
|
294
|
-
md:
|
|
304
|
+
var INDICATOR_SIZE = {
|
|
305
|
+
sm: { marginVertical: 0 },
|
|
306
|
+
md: { marginVertical: 2 }
|
|
295
307
|
};
|
|
296
308
|
var Alert = React2__namespace.forwardRef(
|
|
297
309
|
function Alert2(props, ref) {
|
|
@@ -320,7 +332,8 @@ var Alert = React2__namespace.forwardRef(
|
|
|
320
332
|
const alertStyle = Object.keys(shimStyle).length > 0 ? shimStyle : void 0;
|
|
321
333
|
const [isOpen, setIsOpen] = React2__namespace.useState(true);
|
|
322
334
|
const resolvedSize = size ?? "md";
|
|
323
|
-
const
|
|
335
|
+
const fontSize = SIZE[resolvedSize].fontSize;
|
|
336
|
+
const defaultIcon = /* @__PURE__ */ jsxRuntime.jsx(IndicatorIcon, {});
|
|
324
337
|
const iconElement = (() => {
|
|
325
338
|
if (startElement !== void 0) {
|
|
326
339
|
return startElement;
|
|
@@ -328,10 +341,20 @@ var Alert = React2__namespace.forwardRef(
|
|
|
328
341
|
if (!showIcon && icon === void 0) {
|
|
329
342
|
return null;
|
|
330
343
|
}
|
|
331
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
344
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
345
|
+
gui.XStack,
|
|
346
|
+
{
|
|
347
|
+
alignItems: "center",
|
|
348
|
+
justifyContent: "center",
|
|
349
|
+
flexShrink: 0,
|
|
350
|
+
width: 20,
|
|
351
|
+
height: 20,
|
|
352
|
+
...INDICATOR_SIZE[resolvedSize],
|
|
353
|
+
className: "lux-icon",
|
|
354
|
+
style: { color: ALERT_FG },
|
|
355
|
+
children: icon || defaultIcon
|
|
356
|
+
}
|
|
357
|
+
);
|
|
335
358
|
})();
|
|
336
359
|
const handleClose = React2__namespace.useCallback(() => {
|
|
337
360
|
setIsOpen(false);
|
|
@@ -360,35 +383,34 @@ var Alert = React2__namespace.forwardRef(
|
|
|
360
383
|
...descRowGap !== void 0 ? { rowGap: typeof descRowGap === "number" ? `${descRowGap * 4}px` : descRowGap } : {},
|
|
361
384
|
...descColumnGap !== void 0 ? { columnGap: typeof descColumnGap === "number" ? `${descColumnGap * 4}px` : descColumnGap } : {}
|
|
362
385
|
};
|
|
386
|
+
const ContentFrame = inline ? gui.XStack : gui.YStack;
|
|
363
387
|
return /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { loading, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
364
|
-
|
|
388
|
+
gui.XStack,
|
|
365
389
|
{
|
|
366
390
|
ref,
|
|
367
|
-
|
|
391
|
+
...ALERT_BASE,
|
|
392
|
+
paddingHorizontal: SIZE[resolvedSize].paddingHorizontal,
|
|
393
|
+
backgroundColor: STATUS_BG[status],
|
|
394
|
+
className,
|
|
368
395
|
style: alertStyle,
|
|
369
396
|
...alertRest,
|
|
370
397
|
children: [
|
|
371
398
|
iconElement,
|
|
372
|
-
children ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
373
|
-
title && /* @__PURE__ */ jsxRuntime.jsx(
|
|
399
|
+
children ? /* @__PURE__ */ jsxRuntime.jsxs(ContentFrame, { flex: 1, alignItems: inline ? "center" : void 0, children: [
|
|
400
|
+
title && /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { fontWeight: "600", fontSize, color: ALERT_FG, children: title }),
|
|
374
401
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
375
|
-
|
|
402
|
+
gui.XStack,
|
|
376
403
|
{
|
|
377
|
-
|
|
404
|
+
flexWrap: "wrap",
|
|
405
|
+
className: descClassName,
|
|
378
406
|
style: Object.keys(descStyle).length > 0 ? descStyle : void 0,
|
|
379
407
|
...descRest,
|
|
380
|
-
children
|
|
408
|
+
children: ink(children, void 0, { fontSize, color: ALERT_FG })
|
|
381
409
|
}
|
|
382
410
|
)
|
|
383
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
411
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { flex: 1, fontWeight: "600", fontSize, color: ALERT_FG, children: title }),
|
|
384
412
|
endElement,
|
|
385
|
-
closable && /* @__PURE__ */ jsxRuntime.jsx(
|
|
386
|
-
CloseButton,
|
|
387
|
-
{
|
|
388
|
-
className: "relative self-start",
|
|
389
|
-
onClick: handleClose
|
|
390
|
-
}
|
|
391
|
-
)
|
|
413
|
+
closable && /* @__PURE__ */ jsxRuntime.jsx(gui.View, { position: "relative", alignSelf: "flex-start", children: /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { onClick: handleClose }) })
|
|
392
414
|
]
|
|
393
415
|
}
|
|
394
416
|
) });
|
package/dist/alert.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { styled, View, XStack, YStack, Text } from '@hanzo/gui';
|
|
2
3
|
import * as React2 from 'react';
|
|
4
|
+
import { Children, createElement } from 'react';
|
|
5
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
6
|
import { clsx } from 'clsx';
|
|
4
7
|
import { twMerge } from 'tailwind-merge';
|
|
5
|
-
import { styled, View } from '@hanzo/gui';
|
|
6
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
8
|
|
|
8
9
|
// src/alert.tsx
|
|
9
|
-
function cn(...inputs) {
|
|
10
|
-
return twMerge(clsx(inputs));
|
|
11
|
-
}
|
|
12
10
|
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";
|
|
13
11
|
var CloseButtonFrame = styled(View, {
|
|
14
12
|
name: "LuxCloseButton",
|
|
@@ -39,23 +37,19 @@ var CloseButtonFrame = styled(View, {
|
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
39
|
});
|
|
42
|
-
var CLOSE_BUTTON_CLASSES = [
|
|
43
|
-
"text-[var(--closeButton-fg,currentColor)]",
|
|
44
|
-
"hover:text-[var(--hover-color,currentColor)]",
|
|
45
|
-
"disabled:opacity-40"
|
|
46
|
-
].join(" ");
|
|
47
40
|
var CloseButton = React2.forwardRef(function CloseButton2(props, ref) {
|
|
48
41
|
const { variant: _variant, size: _size, className, children, ...rest } = props;
|
|
49
42
|
return /* @__PURE__ */ jsx(
|
|
50
43
|
CloseButtonFrame,
|
|
51
44
|
{
|
|
52
45
|
ref,
|
|
53
|
-
className
|
|
46
|
+
className,
|
|
54
47
|
...rest,
|
|
55
48
|
children: children ?? /* @__PURE__ */ jsx(
|
|
56
49
|
"svg",
|
|
57
50
|
{
|
|
58
|
-
|
|
51
|
+
width: 20,
|
|
52
|
+
height: 20,
|
|
59
53
|
viewBox: "0 0 20 20",
|
|
60
54
|
fill: "none",
|
|
61
55
|
"aria-hidden": "true",
|
|
@@ -71,6 +65,17 @@ var CloseButton = React2.forwardRef(function CloseButton2(props, ref) {
|
|
|
71
65
|
}
|
|
72
66
|
);
|
|
73
67
|
});
|
|
68
|
+
var ink = (children, Wrap = Text, props = {}) => {
|
|
69
|
+
let hasText = false;
|
|
70
|
+
Children.forEach(children, (child) => {
|
|
71
|
+
if (typeof child === "string" || typeof child === "number") hasText = true;
|
|
72
|
+
});
|
|
73
|
+
if (!hasText) return children;
|
|
74
|
+
return Children.map(children, (child) => typeof child === "string" || typeof child === "number" ? createElement(Wrap, props, child) : child);
|
|
75
|
+
};
|
|
76
|
+
function cn(...inputs) {
|
|
77
|
+
return twMerge(clsx(inputs));
|
|
78
|
+
}
|
|
74
79
|
var SHIM_PROPS = [
|
|
75
80
|
"w",
|
|
76
81
|
"h",
|
|
@@ -254,22 +259,30 @@ React2.forwardRef(
|
|
|
254
259
|
)) });
|
|
255
260
|
}
|
|
256
261
|
);
|
|
257
|
-
var IndicatorIcon = (
|
|
258
|
-
var ALERT_BASE =
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
262
|
+
var IndicatorIcon = () => /* @__PURE__ */ jsx("svg", { width: 20, height: 20, viewBox: "0 0 20 20", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zm.75-11.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zM9.25 10a.75.75 0 011.5 0v3a.75.75 0 01-1.5 0v-3z" }) });
|
|
263
|
+
var ALERT_BASE = {
|
|
264
|
+
width: "100%",
|
|
265
|
+
position: "relative",
|
|
266
|
+
alignItems: "flex-start",
|
|
267
|
+
borderRadius: 4,
|
|
268
|
+
gap: 8,
|
|
269
|
+
paddingVertical: 8
|
|
270
|
+
};
|
|
271
|
+
var ALERT_FG = "var(--color-alert-fg)";
|
|
272
|
+
var STATUS_BG = {
|
|
273
|
+
info: "var(--color-alert-bg-info)",
|
|
274
|
+
warning: "var(--color-alert-bg-warning)",
|
|
275
|
+
warning_table: "var(--color-alert-bg-warning-table)",
|
|
276
|
+
success: "var(--color-alert-bg-success)",
|
|
277
|
+
error: "var(--color-alert-bg-error)"
|
|
265
278
|
};
|
|
266
|
-
var
|
|
267
|
-
sm:
|
|
268
|
-
md:
|
|
279
|
+
var SIZE = {
|
|
280
|
+
sm: { paddingHorizontal: 8, fontSize: 12 },
|
|
281
|
+
md: { paddingHorizontal: 12, fontSize: 16 }
|
|
269
282
|
};
|
|
270
|
-
var
|
|
271
|
-
sm:
|
|
272
|
-
md:
|
|
283
|
+
var INDICATOR_SIZE = {
|
|
284
|
+
sm: { marginVertical: 0 },
|
|
285
|
+
md: { marginVertical: 2 }
|
|
273
286
|
};
|
|
274
287
|
var Alert = React2.forwardRef(
|
|
275
288
|
function Alert2(props, ref) {
|
|
@@ -298,7 +311,8 @@ var Alert = React2.forwardRef(
|
|
|
298
311
|
const alertStyle = Object.keys(shimStyle).length > 0 ? shimStyle : void 0;
|
|
299
312
|
const [isOpen, setIsOpen] = React2.useState(true);
|
|
300
313
|
const resolvedSize = size ?? "md";
|
|
301
|
-
const
|
|
314
|
+
const fontSize = SIZE[resolvedSize].fontSize;
|
|
315
|
+
const defaultIcon = /* @__PURE__ */ jsx(IndicatorIcon, {});
|
|
302
316
|
const iconElement = (() => {
|
|
303
317
|
if (startElement !== void 0) {
|
|
304
318
|
return startElement;
|
|
@@ -306,10 +320,20 @@ var Alert = React2.forwardRef(
|
|
|
306
320
|
if (!showIcon && icon === void 0) {
|
|
307
321
|
return null;
|
|
308
322
|
}
|
|
309
|
-
return /* @__PURE__ */ jsx(
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
323
|
+
return /* @__PURE__ */ jsx(
|
|
324
|
+
XStack,
|
|
325
|
+
{
|
|
326
|
+
alignItems: "center",
|
|
327
|
+
justifyContent: "center",
|
|
328
|
+
flexShrink: 0,
|
|
329
|
+
width: 20,
|
|
330
|
+
height: 20,
|
|
331
|
+
...INDICATOR_SIZE[resolvedSize],
|
|
332
|
+
className: "lux-icon",
|
|
333
|
+
style: { color: ALERT_FG },
|
|
334
|
+
children: icon || defaultIcon
|
|
335
|
+
}
|
|
336
|
+
);
|
|
313
337
|
})();
|
|
314
338
|
const handleClose = React2.useCallback(() => {
|
|
315
339
|
setIsOpen(false);
|
|
@@ -338,35 +362,34 @@ var Alert = React2.forwardRef(
|
|
|
338
362
|
...descRowGap !== void 0 ? { rowGap: typeof descRowGap === "number" ? `${descRowGap * 4}px` : descRowGap } : {},
|
|
339
363
|
...descColumnGap !== void 0 ? { columnGap: typeof descColumnGap === "number" ? `${descColumnGap * 4}px` : descColumnGap } : {}
|
|
340
364
|
};
|
|
365
|
+
const ContentFrame = inline ? XStack : YStack;
|
|
341
366
|
return /* @__PURE__ */ jsx(Skeleton, { loading, children: /* @__PURE__ */ jsxs(
|
|
342
|
-
|
|
367
|
+
XStack,
|
|
343
368
|
{
|
|
344
369
|
ref,
|
|
345
|
-
|
|
370
|
+
...ALERT_BASE,
|
|
371
|
+
paddingHorizontal: SIZE[resolvedSize].paddingHorizontal,
|
|
372
|
+
backgroundColor: STATUS_BG[status],
|
|
373
|
+
className,
|
|
346
374
|
style: alertStyle,
|
|
347
375
|
...alertRest,
|
|
348
376
|
children: [
|
|
349
377
|
iconElement,
|
|
350
|
-
children ? /* @__PURE__ */ jsxs(
|
|
351
|
-
title && /* @__PURE__ */ jsx(
|
|
378
|
+
children ? /* @__PURE__ */ jsxs(ContentFrame, { flex: 1, alignItems: inline ? "center" : void 0, children: [
|
|
379
|
+
title && /* @__PURE__ */ jsx(Text, { fontWeight: "600", fontSize, color: ALERT_FG, children: title }),
|
|
352
380
|
/* @__PURE__ */ jsx(
|
|
353
|
-
|
|
381
|
+
XStack,
|
|
354
382
|
{
|
|
355
|
-
|
|
383
|
+
flexWrap: "wrap",
|
|
384
|
+
className: descClassName,
|
|
356
385
|
style: Object.keys(descStyle).length > 0 ? descStyle : void 0,
|
|
357
386
|
...descRest,
|
|
358
|
-
children
|
|
387
|
+
children: ink(children, void 0, { fontSize, color: ALERT_FG })
|
|
359
388
|
}
|
|
360
389
|
)
|
|
361
|
-
] }) : /* @__PURE__ */ jsx(
|
|
390
|
+
] }) : /* @__PURE__ */ jsx(Text, { flex: 1, fontWeight: "600", fontSize, color: ALERT_FG, children: title }),
|
|
362
391
|
endElement,
|
|
363
|
-
closable && /* @__PURE__ */ jsx(
|
|
364
|
-
CloseButton,
|
|
365
|
-
{
|
|
366
|
-
className: "relative self-start",
|
|
367
|
-
onClick: handleClose
|
|
368
|
-
}
|
|
369
|
-
)
|
|
392
|
+
closable && /* @__PURE__ */ jsx(View, { position: "relative", alignSelf: "flex-start", children: /* @__PURE__ */ jsx(CloseButton, { onClick: handleClose }) })
|
|
370
393
|
]
|
|
371
394
|
}
|
|
372
395
|
) });
|
package/dist/avatar.cjs
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
var gui = require('@hanzo/gui');
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var clsx = require('clsx');
|
|
7
|
-
var tailwindMerge = require('tailwind-merge');
|
|
8
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
9
7
|
|
|
10
8
|
function _interopNamespace(e) {
|
|
@@ -27,21 +25,32 @@ function _interopNamespace(e) {
|
|
|
27
25
|
|
|
28
26
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
var ink = (children, Wrap = gui.Text, props = {}) => {
|
|
29
|
+
let hasText = false;
|
|
30
|
+
React.Children.forEach(children, (child) => {
|
|
31
|
+
if (typeof child === "string" || typeof child === "number") hasText = true;
|
|
32
|
+
});
|
|
33
|
+
if (!hasText) return children;
|
|
34
|
+
return React.Children.map(children, (child) => typeof child === "string" || typeof child === "number" ? React.createElement(Wrap, props, child) : child);
|
|
35
|
+
};
|
|
36
|
+
var SIZE = {
|
|
37
|
+
xs: { width: 24, height: 24, fontSize: 10 },
|
|
38
|
+
sm: { width: 32, height: 32, fontSize: 12 },
|
|
39
|
+
md: { width: 40, height: 40, fontSize: 14 },
|
|
40
|
+
lg: { width: 48, height: 48, fontSize: 16 },
|
|
41
|
+
xl: { width: 64, height: 64, fontSize: 18 },
|
|
42
|
+
"2xl": { width: 80, height: 80, fontSize: 20 }
|
|
40
43
|
};
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
var RING = "var(--color-bg-body)";
|
|
45
|
+
var VARIANT = {
|
|
46
|
+
solid: { backgroundColor: "var(--color-gray-500)", color: "var(--color-white)" },
|
|
47
|
+
subtle: { backgroundColor: "var(--color-badge-gray-bg)", color: "var(--color-badge-gray-fg)" },
|
|
48
|
+
outline: {
|
|
49
|
+
borderWidth: 2,
|
|
50
|
+
borderColor: "var(--color-input-border)",
|
|
51
|
+
backgroundColor: "transparent",
|
|
52
|
+
color: "var(--color-text-secondary)"
|
|
53
|
+
}
|
|
45
54
|
};
|
|
46
55
|
var DEFAULT_SIZE = "md";
|
|
47
56
|
var DEFAULT_VARIANT = "subtle";
|
|
@@ -60,7 +69,6 @@ var Avatar = React__namespace.forwardRef(
|
|
|
60
69
|
icon,
|
|
61
70
|
fallback,
|
|
62
71
|
children,
|
|
63
|
-
className,
|
|
64
72
|
size: sizeProp,
|
|
65
73
|
variant: variantProp,
|
|
66
74
|
borderless,
|
|
@@ -73,21 +81,26 @@ var Avatar = React__namespace.forwardRef(
|
|
|
73
81
|
gui.Avatar,
|
|
74
82
|
{
|
|
75
83
|
ref,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
+
position: "relative",
|
|
85
|
+
display: "inline-flex",
|
|
86
|
+
flexShrink: 0,
|
|
87
|
+
alignItems: "center",
|
|
88
|
+
justifyContent: "center",
|
|
89
|
+
overflow: "hidden",
|
|
90
|
+
borderRadius: 9999,
|
|
91
|
+
...SIZE[size],
|
|
92
|
+
...VARIANT[variant],
|
|
93
|
+
boxShadow: isBorderless ? void 0 : `0 0 0 2px ${RING}`,
|
|
84
94
|
...rest,
|
|
85
95
|
children: [
|
|
86
96
|
/* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { name, icon, children: fallback }),
|
|
87
97
|
src != null && /* @__PURE__ */ jsxRuntime.jsx(
|
|
88
98
|
gui.Avatar.Image,
|
|
89
99
|
{
|
|
90
|
-
|
|
100
|
+
width: "100%",
|
|
101
|
+
height: "100%",
|
|
102
|
+
borderRadius: 9999,
|
|
103
|
+
objectFit: "cover",
|
|
91
104
|
src,
|
|
92
105
|
srcSet,
|
|
93
106
|
loading,
|
|
@@ -102,22 +115,18 @@ var Avatar = React__namespace.forwardRef(
|
|
|
102
115
|
);
|
|
103
116
|
var AvatarFallback = React__namespace.forwardRef(
|
|
104
117
|
function AvatarFallback2(props, ref) {
|
|
105
|
-
const { name, icon, children,
|
|
106
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
118
|
+
const { name, icon, children, ...rest } = props;
|
|
119
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
107
120
|
gui.Avatar.Fallback,
|
|
108
121
|
{
|
|
109
122
|
ref,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
123
|
+
display: "flex",
|
|
124
|
+
width: "100%",
|
|
125
|
+
height: "100%",
|
|
126
|
+
alignItems: "center",
|
|
127
|
+
justifyContent: "center",
|
|
115
128
|
...rest,
|
|
116
|
-
children:
|
|
117
|
-
children,
|
|
118
|
-
name != null && children == null && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: getInitials(name) }),
|
|
119
|
-
name == null && children == null && icon
|
|
120
|
-
]
|
|
129
|
+
children: ink(children ?? (name != null ? getInitials(name) : icon), void 0, { fontWeight: "500" })
|
|
121
130
|
}
|
|
122
131
|
);
|
|
123
132
|
}
|
|
@@ -130,19 +139,12 @@ function getInitials(name) {
|
|
|
130
139
|
}
|
|
131
140
|
var AvatarGroup = React__namespace.forwardRef(
|
|
132
141
|
function AvatarGroup2(props, ref) {
|
|
133
|
-
const { size, variant, borderless,
|
|
142
|
+
const { size, variant, borderless, children, ...rest } = props;
|
|
134
143
|
const contextValue = React__namespace.useMemo(
|
|
135
144
|
() => ({ size, variant, borderless }),
|
|
136
145
|
[size, variant, borderless]
|
|
137
146
|
);
|
|
138
|
-
return /* @__PURE__ */ jsxRuntime.jsx(AvatarGroupContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
139
|
-
"div",
|
|
140
|
-
{
|
|
141
|
-
ref,
|
|
142
|
-
className: cn("flex -space-x-3", className),
|
|
143
|
-
...rest
|
|
144
|
-
}
|
|
145
|
-
) });
|
|
147
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AvatarGroupContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { ref, ...rest, children: React__namespace.Children.map(children, (child, index) => index === 0 || !React__namespace.isValidElement(child) ? child : React__namespace.cloneElement(child, { marginLeft: -12 })) }) });
|
|
146
148
|
}
|
|
147
149
|
);
|
|
148
150
|
|