@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/tag.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { styled, View, TooltipGroup, Tooltip as Tooltip$1, Text, XStack } from '@hanzo/gui';
|
|
2
3
|
import * as React4 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, TooltipGroup, Tooltip as Tooltip$1 } from '@hanzo/gui';
|
|
6
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
8
|
import { useClickAway } from '@uidotdev/usehooks';
|
|
8
9
|
|
|
9
10
|
// src/tag.tsx
|
|
10
|
-
function cn(...inputs) {
|
|
11
|
-
return twMerge(clsx(inputs));
|
|
12
|
-
}
|
|
13
11
|
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";
|
|
14
12
|
var CloseButtonFrame = styled(View, {
|
|
15
13
|
name: "LuxCloseButton",
|
|
@@ -40,23 +38,19 @@ var CloseButtonFrame = styled(View, {
|
|
|
40
38
|
}
|
|
41
39
|
}
|
|
42
40
|
});
|
|
43
|
-
var CLOSE_BUTTON_CLASSES = [
|
|
44
|
-
"text-[var(--closeButton-fg,currentColor)]",
|
|
45
|
-
"hover:text-[var(--hover-color,currentColor)]",
|
|
46
|
-
"disabled:opacity-40"
|
|
47
|
-
].join(" ");
|
|
48
41
|
var CloseButton = React4.forwardRef(function CloseButton2(props, ref) {
|
|
49
42
|
const { variant: _variant, size: _size, className, children, ...rest } = props;
|
|
50
43
|
return /* @__PURE__ */ jsx(
|
|
51
44
|
CloseButtonFrame,
|
|
52
45
|
{
|
|
53
46
|
ref,
|
|
54
|
-
className
|
|
47
|
+
className,
|
|
55
48
|
...rest,
|
|
56
49
|
children: children ?? /* @__PURE__ */ jsx(
|
|
57
50
|
"svg",
|
|
58
51
|
{
|
|
59
|
-
|
|
52
|
+
width: 20,
|
|
53
|
+
height: 20,
|
|
60
54
|
viewBox: "0 0 20 20",
|
|
61
55
|
fill: "none",
|
|
62
56
|
"aria-hidden": "true",
|
|
@@ -72,6 +66,9 @@ var CloseButton = React4.forwardRef(function CloseButton2(props, ref) {
|
|
|
72
66
|
}
|
|
73
67
|
);
|
|
74
68
|
});
|
|
69
|
+
function cn(...inputs) {
|
|
70
|
+
return twMerge(clsx(inputs));
|
|
71
|
+
}
|
|
75
72
|
var SHIM_PROPS = [
|
|
76
73
|
"w",
|
|
77
74
|
"h",
|
|
@@ -255,6 +252,14 @@ React4.forwardRef(
|
|
|
255
252
|
)) });
|
|
256
253
|
}
|
|
257
254
|
);
|
|
255
|
+
var ink = (children, Wrap = Text, props = {}) => {
|
|
256
|
+
let hasText = false;
|
|
257
|
+
Children.forEach(children, (child) => {
|
|
258
|
+
if (typeof child === "string" || typeof child === "number") hasText = true;
|
|
259
|
+
});
|
|
260
|
+
if (!hasText) return children;
|
|
261
|
+
return Children.map(children, (child) => typeof child === "string" || typeof child === "number" ? createElement(Wrap, props, child) : child);
|
|
262
|
+
};
|
|
258
263
|
var TOUCH_PX = 1024;
|
|
259
264
|
function useBelow(px) {
|
|
260
265
|
const [below, setBelow] = React4.useState(false);
|
|
@@ -359,14 +364,21 @@ var Tooltip = React4.forwardRef(
|
|
|
359
364
|
{
|
|
360
365
|
ref,
|
|
361
366
|
unstyled: true,
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
367
|
+
zIndex: 9999,
|
|
368
|
+
overflow: "hidden",
|
|
369
|
+
borderRadius: 8,
|
|
370
|
+
paddingHorizontal: 12,
|
|
371
|
+
paddingVertical: 8,
|
|
372
|
+
maxWidth: isPopover ? 384 : 320,
|
|
373
|
+
backgroundColor: isPopover ? "var(--color-popover-bg)" : "var(--color-tooltip-bg)",
|
|
374
|
+
transition: "quick",
|
|
375
|
+
enterStyle: { opacity: 0, scale: 0.95 },
|
|
376
|
+
exitStyle: { opacity: 0, scale: 0.95 },
|
|
377
|
+
...isPopover ? {
|
|
378
|
+
borderWidth: 1,
|
|
379
|
+
borderColor: "var(--color-border-divider)",
|
|
380
|
+
shadowColor: "var(--shadow-popover)"
|
|
381
|
+
} : {},
|
|
370
382
|
onClick: interactive ? handleContentClick : void 0,
|
|
371
383
|
...selected ? { "data-selected": true } : {},
|
|
372
384
|
...contentProps,
|
|
@@ -375,12 +387,13 @@ var Tooltip = React4.forwardRef(
|
|
|
375
387
|
Tooltip$1.Arrow,
|
|
376
388
|
{
|
|
377
389
|
unstyled: true,
|
|
378
|
-
|
|
379
|
-
isPopover ? "fill-[var(--color-popover-bg)]" : "fill-[var(--color-tooltip-bg)]"
|
|
380
|
-
)
|
|
390
|
+
backgroundColor: isPopover ? "var(--color-popover-bg)" : "var(--color-tooltip-bg)"
|
|
381
391
|
}
|
|
382
392
|
),
|
|
383
|
-
content
|
|
393
|
+
ink(content, void 0, {
|
|
394
|
+
fontSize: 14,
|
|
395
|
+
color: isPopover ? "var(--color-text-primary)" : "var(--color-tooltip-fg)"
|
|
396
|
+
})
|
|
384
397
|
]
|
|
385
398
|
}
|
|
386
399
|
)
|
|
@@ -393,25 +406,24 @@ var nbsp = String.fromCharCode(160);
|
|
|
393
406
|
function TruncatedTextTooltip({ label, children }) {
|
|
394
407
|
return /* @__PURE__ */ jsx(Tooltip, { content: label, positioning: { placement: "top" }, children });
|
|
395
408
|
}
|
|
396
|
-
var
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
select: "cursor-pointer bg-[var(--color-tag-select-bg)] text-[var(--color-tag-select-fg)] hover:text-[var(--color-hover)] hover:opacity-76"
|
|
409
|
+
var TAG_VARIANT = {
|
|
410
|
+
subtle: { backgroundColor: "var(--color-tag-subtle-bg)" },
|
|
411
|
+
clickable: { backgroundColor: "var(--color-tag-clickable-bg)", cursor: "pointer", hoverStyle: { opacity: 0.76 } },
|
|
412
|
+
filter: { backgroundColor: "var(--color-tag-filter-bg)" },
|
|
413
|
+
select: { backgroundColor: "var(--color-tag-select-bg)", cursor: "pointer", hoverStyle: { opacity: 0.76 } }
|
|
402
414
|
};
|
|
403
|
-
var
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
415
|
+
var TAG_VARIANT_FG = {
|
|
416
|
+
subtle: "var(--color-tag-subtle-fg)",
|
|
417
|
+
clickable: "var(--color-tag-clickable-fg)",
|
|
418
|
+
filter: void 0,
|
|
419
|
+
select: "var(--color-tag-select-fg)"
|
|
407
420
|
};
|
|
408
|
-
var
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
var TAG_DISABLED_CLASSES = "opacity-40 pointer-events-none cursor-not-allowed";
|
|
421
|
+
var TAG_SIZE = {
|
|
422
|
+
sm: { paddingHorizontal: 4, paddingVertical: 2, minHeight: 20, gap: 4 },
|
|
423
|
+
md: { paddingHorizontal: 4, paddingVertical: 2, minHeight: 24, gap: 4 },
|
|
424
|
+
lg: { paddingHorizontal: 6, paddingVertical: 6, minHeight: 32, minWidth: 32, gap: 4 }
|
|
425
|
+
};
|
|
426
|
+
var TAG_SIZE_FONT = { sm: 12, md: 14, lg: 14 };
|
|
415
427
|
var Tag = React4.forwardRef(
|
|
416
428
|
function Tag2(props, ref) {
|
|
417
429
|
const {
|
|
@@ -431,46 +443,78 @@ var Tag = React4.forwardRef(
|
|
|
431
443
|
className,
|
|
432
444
|
...rest
|
|
433
445
|
} = props;
|
|
434
|
-
const
|
|
446
|
+
const resolvedVariant = variant ?? "subtle";
|
|
447
|
+
const resolvedSize = size ?? "md";
|
|
448
|
+
const isSelected = Boolean(selected) && !loading;
|
|
449
|
+
const backgroundColor = isSelected ? "var(--color-tag-select-selected-bg)" : TAG_VARIANT[resolvedVariant].backgroundColor;
|
|
450
|
+
const color = isSelected ? "var(--color-tag-select-selected-fg)" : TAG_VARIANT_FG[resolvedVariant];
|
|
451
|
+
const hoverStyle = isSelected ? { opacity: 0.76 } : TAG_VARIANT[resolvedVariant].hoverStyle;
|
|
452
|
+
const textHoverColor = !isSelected && resolvedVariant === "select" ? "var(--color-hover)" : void 0;
|
|
453
|
+
const labelElement = label ? /* @__PURE__ */ jsxs(Text, { fontSize: TAG_SIZE_FONT[resolvedSize], fontWeight: "500", color: "var(--color-text-secondary)", children: [
|
|
435
454
|
label,
|
|
436
455
|
":",
|
|
437
456
|
nbsp
|
|
438
457
|
] }) : null;
|
|
439
|
-
const labelSpan = /* @__PURE__ */ jsxs(
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
458
|
+
const labelSpan = /* @__PURE__ */ jsxs(
|
|
459
|
+
Text,
|
|
460
|
+
{
|
|
461
|
+
overflow: "hidden",
|
|
462
|
+
textOverflow: "ellipsis",
|
|
463
|
+
whiteSpace: "nowrap",
|
|
464
|
+
fontWeight: "500",
|
|
465
|
+
fontSize: TAG_SIZE_FONT[resolvedSize],
|
|
466
|
+
color,
|
|
467
|
+
hoverStyle: textHoverColor ? { color: textHoverColor } : void 0,
|
|
468
|
+
children: [
|
|
469
|
+
labelElement,
|
|
470
|
+
children
|
|
471
|
+
]
|
|
472
|
+
}
|
|
473
|
+
);
|
|
443
474
|
const contentElement = truncated ? /* @__PURE__ */ jsx(TruncatedTextTooltip, { label: children, children: labelSpan }) : labelSpan;
|
|
444
475
|
return /* @__PURE__ */ jsx(Skeleton, { loading, asChild: true, children: /* @__PURE__ */ jsxs(
|
|
445
|
-
|
|
476
|
+
XStack,
|
|
446
477
|
{
|
|
447
478
|
ref,
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
479
|
+
render: /* @__PURE__ */ jsx("span", {}),
|
|
480
|
+
display: "inline-flex",
|
|
481
|
+
alignItems: "center",
|
|
482
|
+
verticalAlign: "top",
|
|
483
|
+
maxWidth: "100%",
|
|
484
|
+
userSelect: "text",
|
|
485
|
+
...TAG_SIZE[resolvedSize],
|
|
486
|
+
backgroundColor,
|
|
487
|
+
hoverStyle,
|
|
488
|
+
focusVisibleStyle: {
|
|
489
|
+
outlineWidth: 2,
|
|
490
|
+
outlineOffset: 2,
|
|
491
|
+
outlineColor: "var(--color-gray-500)",
|
|
492
|
+
outlineStyle: "solid"
|
|
493
|
+
},
|
|
494
|
+
cursor: disabled ? "not-allowed" : TAG_VARIANT[resolvedVariant].cursor,
|
|
495
|
+
...disabled ? { opacity: 0.4, pointerEvents: "none" } : {},
|
|
496
|
+
...isSelected && { "data-selected": true },
|
|
457
497
|
...disabled && { "data-disabled": true },
|
|
498
|
+
className,
|
|
458
499
|
...rest,
|
|
459
500
|
children: [
|
|
460
|
-
startElement && /* @__PURE__ */ jsx(
|
|
501
|
+
startElement && /* @__PURE__ */ jsx(XStack, { flexShrink: 0, alignItems: "center", justifyContent: "center", children: startElement }),
|
|
461
502
|
contentElement,
|
|
462
|
-
endElement &&
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
503
|
+
endElement && (() => {
|
|
504
|
+
const { className: endClassName, ...endElementRest } = endElementProps ?? {};
|
|
505
|
+
return /* @__PURE__ */ jsx(
|
|
506
|
+
XStack,
|
|
507
|
+
{
|
|
508
|
+
...endElementRest,
|
|
509
|
+
flexShrink: 0,
|
|
510
|
+
alignItems: "center",
|
|
511
|
+
justifyContent: "center",
|
|
512
|
+
className: endClassName,
|
|
513
|
+
children: endElement
|
|
514
|
+
}
|
|
515
|
+
);
|
|
516
|
+
})(),
|
|
517
|
+
closable && /* @__PURE__ */ jsx(XStack, { flexShrink: 0, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsx(CloseButton, { onClick: onClose }) })
|
|
474
518
|
]
|
|
475
519
|
}
|
|
476
520
|
) });
|
package/dist/textarea.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 _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -12,31 +10,59 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
12
10
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
13
11
|
|
|
14
12
|
// src/textarea.tsx
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
"placeholder:text-[var(--color-input-placeholder,theme(colors.gray.400))]",
|
|
22
|
-
"hover:border-[var(--color-input-border-hover,theme(colors.gray.400))]",
|
|
23
|
-
"focus:border-[var(--color-input-border-focus,theme(colors.blue.500))]",
|
|
24
|
-
"focus:placeholder:text-[var(--color-input-placeholder-focus,theme(colors.gray.300))]",
|
|
25
|
-
"disabled:opacity-40 disabled:cursor-not-allowed",
|
|
26
|
-
"read-only:opacity-70",
|
|
27
|
-
"data-[invalid]:border-[var(--color-input-border-invalid,theme(colors.red.500))]"
|
|
28
|
-
].join(" ");
|
|
29
|
-
var TEXTAREA_SIZE_CLASSES = {
|
|
30
|
-
xs: "px-2 py-1 text-xs rounded",
|
|
31
|
-
sm: "px-3 py-2 text-sm rounded-md",
|
|
32
|
-
md: "px-4 py-2 text-base rounded-md",
|
|
33
|
-
lg: "px-4 py-3 text-lg rounded-lg",
|
|
34
|
-
"2xl": "px-4 py-3 text-xl rounded-lg"
|
|
13
|
+
var SIZE = {
|
|
14
|
+
xs: { height: 24, paddingHorizontal: 8, fontSize: 12, borderRadius: 4 },
|
|
15
|
+
sm: { height: 32, paddingHorizontal: 12, fontSize: 14, borderRadius: 6 },
|
|
16
|
+
md: { height: 40, paddingHorizontal: 16, fontSize: 16, borderRadius: 6 },
|
|
17
|
+
lg: { height: 48, paddingHorizontal: 16, fontSize: 18, borderRadius: 8 },
|
|
18
|
+
"2xl": { height: 56, paddingHorizontal: 16, fontSize: 20, borderRadius: 8 }
|
|
35
19
|
};
|
|
36
|
-
var
|
|
37
|
-
outline: "
|
|
38
|
-
filled:
|
|
39
|
-
unstyled:
|
|
20
|
+
var VARIANT = {
|
|
21
|
+
outline: { borderWidth: 1, borderStyle: "solid" },
|
|
22
|
+
filled: { borderWidth: 0, backgroundColor: "var(--color-input-filled-bg)" },
|
|
23
|
+
unstyled: { borderWidth: 0, backgroundColor: "transparent", padding: 0, height: "auto" }
|
|
24
|
+
};
|
|
25
|
+
var CONTROL = {
|
|
26
|
+
width: "100%",
|
|
27
|
+
outlineWidth: 0,
|
|
28
|
+
backgroundColor: "var(--color-input-bg)",
|
|
29
|
+
color: "var(--color-input-fg)",
|
|
30
|
+
borderColor: "var(--color-input-border)",
|
|
31
|
+
hoverStyle: { borderColor: "var(--color-input-border-hover)" },
|
|
32
|
+
focusStyle: { borderColor: "var(--color-input-border-focus)" },
|
|
33
|
+
disabledStyle: { opacity: 0.4, cursor: "not-allowed" }
|
|
34
|
+
};
|
|
35
|
+
var Input = React__default.default.forwardRef(
|
|
36
|
+
({ size = "md", variant = "outline", className, onChange, onChangeText, ...rest }, ref) => {
|
|
37
|
+
const handleChange = React__default.default.useCallback(
|
|
38
|
+
(event) => {
|
|
39
|
+
onChange?.(event);
|
|
40
|
+
onChangeText?.(event.target.value);
|
|
41
|
+
},
|
|
42
|
+
[onChange, onChangeText]
|
|
43
|
+
);
|
|
44
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
45
|
+
gui.Input,
|
|
46
|
+
{
|
|
47
|
+
ref,
|
|
48
|
+
unstyled: true,
|
|
49
|
+
className: className ? `lux-control ${className}` : "lux-control",
|
|
50
|
+
...CONTROL,
|
|
51
|
+
...SIZE[size],
|
|
52
|
+
...VARIANT[variant],
|
|
53
|
+
...rest,
|
|
54
|
+
onChange: handleChange
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
Input.displayName = "Input";
|
|
60
|
+
var SIZE2 = {
|
|
61
|
+
xs: { paddingHorizontal: 8, paddingVertical: 4, fontSize: 12, borderRadius: 4 },
|
|
62
|
+
sm: { paddingHorizontal: 12, paddingVertical: 8, fontSize: 14, borderRadius: 6 },
|
|
63
|
+
md: { paddingHorizontal: 16, paddingVertical: 8, fontSize: 16, borderRadius: 6 },
|
|
64
|
+
lg: { paddingHorizontal: 16, paddingVertical: 12, fontSize: 18, borderRadius: 8 },
|
|
65
|
+
"2xl": { paddingHorizontal: 16, paddingVertical: 12, fontSize: 20, borderRadius: 8 }
|
|
40
66
|
};
|
|
41
67
|
var Textarea = React__default.default.forwardRef(
|
|
42
68
|
({ size = "md", variant = "outline", className, onChange, onChangeText, ...rest }, ref) => {
|
|
@@ -52,7 +78,10 @@ var Textarea = React__default.default.forwardRef(
|
|
|
52
78
|
{
|
|
53
79
|
ref,
|
|
54
80
|
unstyled: true,
|
|
55
|
-
className:
|
|
81
|
+
className: className ? `lux-control ${className}` : "lux-control",
|
|
82
|
+
...CONTROL,
|
|
83
|
+
...SIZE2[size],
|
|
84
|
+
...VARIANT[variant],
|
|
56
85
|
...rest,
|
|
57
86
|
onChange: handleChange
|
|
58
87
|
}
|
package/dist/textarea.js
CHANGED
|
@@ -1,36 +1,62 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { TextArea } from '@hanzo/gui';
|
|
2
|
+
import { Input as Input$1, TextArea } from '@hanzo/gui';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { clsx } from 'clsx';
|
|
5
|
-
import { twMerge } from 'tailwind-merge';
|
|
6
4
|
import { jsx } from 'react/jsx-runtime';
|
|
7
5
|
|
|
8
6
|
// src/textarea.tsx
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
"placeholder:text-[var(--color-input-placeholder,theme(colors.gray.400))]",
|
|
16
|
-
"hover:border-[var(--color-input-border-hover,theme(colors.gray.400))]",
|
|
17
|
-
"focus:border-[var(--color-input-border-focus,theme(colors.blue.500))]",
|
|
18
|
-
"focus:placeholder:text-[var(--color-input-placeholder-focus,theme(colors.gray.300))]",
|
|
19
|
-
"disabled:opacity-40 disabled:cursor-not-allowed",
|
|
20
|
-
"read-only:opacity-70",
|
|
21
|
-
"data-[invalid]:border-[var(--color-input-border-invalid,theme(colors.red.500))]"
|
|
22
|
-
].join(" ");
|
|
23
|
-
var TEXTAREA_SIZE_CLASSES = {
|
|
24
|
-
xs: "px-2 py-1 text-xs rounded",
|
|
25
|
-
sm: "px-3 py-2 text-sm rounded-md",
|
|
26
|
-
md: "px-4 py-2 text-base rounded-md",
|
|
27
|
-
lg: "px-4 py-3 text-lg rounded-lg",
|
|
28
|
-
"2xl": "px-4 py-3 text-xl rounded-lg"
|
|
7
|
+
var SIZE = {
|
|
8
|
+
xs: { height: 24, paddingHorizontal: 8, fontSize: 12, borderRadius: 4 },
|
|
9
|
+
sm: { height: 32, paddingHorizontal: 12, fontSize: 14, borderRadius: 6 },
|
|
10
|
+
md: { height: 40, paddingHorizontal: 16, fontSize: 16, borderRadius: 6 },
|
|
11
|
+
lg: { height: 48, paddingHorizontal: 16, fontSize: 18, borderRadius: 8 },
|
|
12
|
+
"2xl": { height: 56, paddingHorizontal: 16, fontSize: 20, borderRadius: 8 }
|
|
29
13
|
};
|
|
30
|
-
var
|
|
31
|
-
outline: "
|
|
32
|
-
filled:
|
|
33
|
-
unstyled:
|
|
14
|
+
var VARIANT = {
|
|
15
|
+
outline: { borderWidth: 1, borderStyle: "solid" },
|
|
16
|
+
filled: { borderWidth: 0, backgroundColor: "var(--color-input-filled-bg)" },
|
|
17
|
+
unstyled: { borderWidth: 0, backgroundColor: "transparent", padding: 0, height: "auto" }
|
|
18
|
+
};
|
|
19
|
+
var CONTROL = {
|
|
20
|
+
width: "100%",
|
|
21
|
+
outlineWidth: 0,
|
|
22
|
+
backgroundColor: "var(--color-input-bg)",
|
|
23
|
+
color: "var(--color-input-fg)",
|
|
24
|
+
borderColor: "var(--color-input-border)",
|
|
25
|
+
hoverStyle: { borderColor: "var(--color-input-border-hover)" },
|
|
26
|
+
focusStyle: { borderColor: "var(--color-input-border-focus)" },
|
|
27
|
+
disabledStyle: { opacity: 0.4, cursor: "not-allowed" }
|
|
28
|
+
};
|
|
29
|
+
var Input = React.forwardRef(
|
|
30
|
+
({ size = "md", variant = "outline", className, onChange, onChangeText, ...rest }, ref) => {
|
|
31
|
+
const handleChange = React.useCallback(
|
|
32
|
+
(event) => {
|
|
33
|
+
onChange?.(event);
|
|
34
|
+
onChangeText?.(event.target.value);
|
|
35
|
+
},
|
|
36
|
+
[onChange, onChangeText]
|
|
37
|
+
);
|
|
38
|
+
return /* @__PURE__ */ jsx(
|
|
39
|
+
Input$1,
|
|
40
|
+
{
|
|
41
|
+
ref,
|
|
42
|
+
unstyled: true,
|
|
43
|
+
className: className ? `lux-control ${className}` : "lux-control",
|
|
44
|
+
...CONTROL,
|
|
45
|
+
...SIZE[size],
|
|
46
|
+
...VARIANT[variant],
|
|
47
|
+
...rest,
|
|
48
|
+
onChange: handleChange
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
Input.displayName = "Input";
|
|
54
|
+
var SIZE2 = {
|
|
55
|
+
xs: { paddingHorizontal: 8, paddingVertical: 4, fontSize: 12, borderRadius: 4 },
|
|
56
|
+
sm: { paddingHorizontal: 12, paddingVertical: 8, fontSize: 14, borderRadius: 6 },
|
|
57
|
+
md: { paddingHorizontal: 16, paddingVertical: 8, fontSize: 16, borderRadius: 6 },
|
|
58
|
+
lg: { paddingHorizontal: 16, paddingVertical: 12, fontSize: 18, borderRadius: 8 },
|
|
59
|
+
"2xl": { paddingHorizontal: 16, paddingVertical: 12, fontSize: 20, borderRadius: 8 }
|
|
34
60
|
};
|
|
35
61
|
var Textarea = React.forwardRef(
|
|
36
62
|
({ size = "md", variant = "outline", className, onChange, onChangeText, ...rest }, ref) => {
|
|
@@ -46,7 +72,10 @@ var Textarea = React.forwardRef(
|
|
|
46
72
|
{
|
|
47
73
|
ref,
|
|
48
74
|
unstyled: true,
|
|
49
|
-
className:
|
|
75
|
+
className: className ? `lux-control ${className}` : "lux-control",
|
|
76
|
+
...CONTROL,
|
|
77
|
+
...SIZE2[size],
|
|
78
|
+
...VARIANT[variant],
|
|
50
79
|
...rest,
|
|
51
80
|
onChange: handleChange
|
|
52
81
|
}
|