@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/checkbox.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Checkbox } from '@hanzo/gui';
|
|
2
|
+
import { View, Label, Checkbox, VisuallyHidden, Text } from '@hanzo/gui';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { clsx } from 'clsx';
|
|
5
|
-
import { twMerge } from 'tailwind-merge';
|
|
6
4
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
5
|
|
|
8
6
|
// src/checkbox.tsx
|
|
9
|
-
function cn(...inputs) {
|
|
10
|
-
return twMerge(clsx(inputs));
|
|
11
|
-
}
|
|
12
7
|
var NOOP = () => {
|
|
13
8
|
};
|
|
14
9
|
var CheckboxGroupContext = React.createContext(null);
|
|
@@ -24,7 +19,6 @@ var CheckboxGroupBase = React.forwardRef(
|
|
|
24
19
|
onValueChange,
|
|
25
20
|
orientation = "vertical",
|
|
26
21
|
name: _name,
|
|
27
|
-
className,
|
|
28
22
|
...rest
|
|
29
23
|
} = props;
|
|
30
24
|
const [uncontrolledValue, setUncontrolledValue] = React.useState(defaultValue ?? []);
|
|
@@ -47,15 +41,13 @@ var CheckboxGroupBase = React.forwardRef(
|
|
|
47
41
|
}, [isControlled, controlledValue]);
|
|
48
42
|
const ctx = React.useMemo(() => ({ value, toggle }), [value, toggle]);
|
|
49
43
|
return /* @__PURE__ */ jsx(CheckboxGroupContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
|
|
50
|
-
|
|
44
|
+
View,
|
|
51
45
|
{
|
|
52
46
|
ref,
|
|
53
47
|
role: "group",
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
className
|
|
58
|
-
),
|
|
48
|
+
display: "flex",
|
|
49
|
+
flexDirection: orientation === "vertical" ? "column" : "row",
|
|
50
|
+
gap: orientation === "vertical" ? 12 : 32,
|
|
59
51
|
...rest,
|
|
60
52
|
children
|
|
61
53
|
}
|
|
@@ -63,46 +55,22 @@ var CheckboxGroupBase = React.forwardRef(
|
|
|
63
55
|
}
|
|
64
56
|
);
|
|
65
57
|
var CheckboxGroup2 = CheckboxGroupBase;
|
|
66
|
-
var
|
|
67
|
-
sm: {
|
|
68
|
-
|
|
69
|
-
control: "h-3.5 w-3.5 rounded-sm",
|
|
70
|
-
label: "text-xs",
|
|
71
|
-
icon: "h-3 w-3"
|
|
72
|
-
},
|
|
73
|
-
md: {
|
|
74
|
-
root: "gap-2",
|
|
75
|
-
control: "h-4 w-4 rounded",
|
|
76
|
-
label: "text-sm",
|
|
77
|
-
icon: "h-3.5 w-3.5"
|
|
78
|
-
}
|
|
58
|
+
var SIZE = {
|
|
59
|
+
sm: { rootGap: 6, control: 14, radius: 2, label: 12, icon: 12 },
|
|
60
|
+
md: { rootGap: 8, control: 16, radius: 4, label: 14, icon: 14 }
|
|
79
61
|
};
|
|
80
|
-
var
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
87
|
-
children: /* @__PURE__ */ jsx(
|
|
88
|
-
"path",
|
|
89
|
-
{
|
|
90
|
-
d: "M10.59 0.59L4 7.17L1.41 4.59L0 6L4 10L12 2L10.59 0.59Z",
|
|
91
|
-
fill: "currentColor"
|
|
92
|
-
}
|
|
93
|
-
)
|
|
94
|
-
}
|
|
95
|
-
);
|
|
96
|
-
var IndeterminateIcon = ({ className }) => /* @__PURE__ */ jsx(
|
|
97
|
-
"svg",
|
|
62
|
+
var INK = "var(--color-text-primary)";
|
|
63
|
+
var ON_INK = "var(--color-bg-body)";
|
|
64
|
+
var RESTING_BORDER = "var(--color-input-border)";
|
|
65
|
+
var OUTLINE = "var(--color-gray-500)";
|
|
66
|
+
var CheckIcon = ({ size, color }) => /* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: "0 0 12 10", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx(
|
|
67
|
+
"path",
|
|
98
68
|
{
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
fill: "none",
|
|
102
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
103
|
-
children: /* @__PURE__ */ jsx("path", { d: "M0 0H12V2H0V0Z", fill: "currentColor" })
|
|
69
|
+
d: "M10.59 0.59L4 7.17L1.41 4.59L0 6L4 10L12 2L10.59 0.59Z",
|
|
70
|
+
fill: color
|
|
104
71
|
}
|
|
105
|
-
);
|
|
72
|
+
) });
|
|
73
|
+
var IndeterminateIcon = ({ size, color }) => /* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: "0 0 12 2", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M0 0H12V2H0V0Z", fill: color }) });
|
|
106
74
|
var CheckboxBase = React.forwardRef(
|
|
107
75
|
function Checkbox$1(props, ref) {
|
|
108
76
|
const {
|
|
@@ -120,7 +88,6 @@ var CheckboxBase = React.forwardRef(
|
|
|
120
88
|
size = "md",
|
|
121
89
|
name,
|
|
122
90
|
required,
|
|
123
|
-
className,
|
|
124
91
|
...rest
|
|
125
92
|
} = props;
|
|
126
93
|
const group = useCheckboxGroupContext();
|
|
@@ -173,18 +140,19 @@ var CheckboxBase = React.forwardRef(
|
|
|
173
140
|
},
|
|
174
141
|
[readOnly, isControlled, isInGroup, group, value, onCheckedChange, onChange]
|
|
175
142
|
);
|
|
176
|
-
const
|
|
143
|
+
const s = SIZE[size];
|
|
144
|
+
const isChecked = checkedState !== false;
|
|
177
145
|
return /* @__PURE__ */ jsxs(
|
|
178
|
-
|
|
146
|
+
Label,
|
|
179
147
|
{
|
|
180
148
|
ref: rootRef,
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
149
|
+
unstyled: true,
|
|
150
|
+
flexDirection: "row",
|
|
151
|
+
alignItems: "center",
|
|
152
|
+
gap: s.rootGap,
|
|
153
|
+
cursor: disabled ? "not-allowed" : readOnly ? "default" : "pointer",
|
|
154
|
+
userSelect: "none",
|
|
155
|
+
opacity: disabled ? 0.5 : 1,
|
|
188
156
|
onChange,
|
|
189
157
|
"data-disabled": disabled || void 0,
|
|
190
158
|
"data-readonly": readOnly || void 0,
|
|
@@ -200,26 +168,25 @@ var CheckboxBase = React.forwardRef(
|
|
|
200
168
|
name,
|
|
201
169
|
value,
|
|
202
170
|
required,
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
children: icon ?? /* @__PURE__ */ jsx(Checkbox.Indicator, {
|
|
171
|
+
flexShrink: 0,
|
|
172
|
+
alignItems: "center",
|
|
173
|
+
justifyContent: "center",
|
|
174
|
+
width: s.control,
|
|
175
|
+
height: s.control,
|
|
176
|
+
borderRadius: s.radius,
|
|
177
|
+
borderWidth: 2,
|
|
178
|
+
borderColor: isChecked ? INK : RESTING_BORDER,
|
|
179
|
+
backgroundColor: isChecked ? INK : "transparent",
|
|
180
|
+
transition: "quicker",
|
|
181
|
+
focusStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: OUTLINE, outlineOffset: 2 },
|
|
182
|
+
children: icon ?? /* @__PURE__ */ jsx(Checkbox.Indicator, { alignItems: "center", justifyContent: "center", width: s.icon, height: s.icon, children: checkedState === "indeterminate" ? /* @__PURE__ */ jsx(IndeterminateIcon, { size: s.icon, color: ON_INK }) : /* @__PURE__ */ jsx(CheckIcon, { size: s.icon, color: ON_INK }) })
|
|
215
183
|
}
|
|
216
184
|
),
|
|
217
|
-
/* @__PURE__ */ jsx(
|
|
185
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx(
|
|
218
186
|
"input",
|
|
219
187
|
{
|
|
220
188
|
ref: setHiddenInputRef,
|
|
221
189
|
type: "checkbox",
|
|
222
|
-
className: "sr-only",
|
|
223
190
|
checked: checkedState === true,
|
|
224
191
|
disabled,
|
|
225
192
|
readOnly,
|
|
@@ -230,8 +197,8 @@ var CheckboxBase = React.forwardRef(
|
|
|
230
197
|
onChange: NOOP,
|
|
231
198
|
...inputProps
|
|
232
199
|
}
|
|
233
|
-
),
|
|
234
|
-
children != null && /* @__PURE__ */ jsx(
|
|
200
|
+
) }),
|
|
201
|
+
children != null && /* @__PURE__ */ jsx(Text, { fontSize: s.label, children })
|
|
235
202
|
]
|
|
236
203
|
}
|
|
237
204
|
);
|