@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.
Files changed (84) hide show
  1. package/dist/alert.cjs +68 -46
  2. package/dist/alert.js +69 -46
  3. package/dist/avatar.cjs +49 -47
  4. package/dist/avatar.js +52 -49
  5. package/dist/badge.cjs +82 -49
  6. package/dist/badge.js +83 -50
  7. package/dist/checkbox.cjs +42 -75
  8. package/dist/checkbox.js +43 -76
  9. package/dist/chrome.cjs +3 -7
  10. package/dist/chrome.js +3 -7
  11. package/dist/close-button.cjs +3 -7
  12. package/dist/close-button.js +3 -7
  13. package/dist/dialog.cjs +3 -7
  14. package/dist/dialog.js +3 -7
  15. package/dist/drawer.cjs +3 -7
  16. package/dist/drawer.js +3 -7
  17. package/dist/empty-state.cjs +13 -13
  18. package/dist/empty-state.js +13 -13
  19. package/dist/expiration-selector.cjs +58 -63
  20. package/dist/expiration-selector.js +58 -63
  21. package/dist/greeks-display.cjs +48 -39
  22. package/dist/greeks-display.js +48 -39
  23. package/dist/index.cjs +1053 -888
  24. package/dist/index.js +1054 -889
  25. package/dist/input-group.cjs +36 -19
  26. package/dist/input-group.js +37 -19
  27. package/dist/option-chain.cjs +89 -67
  28. package/dist/option-chain.js +89 -67
  29. package/dist/option-position.cjs +88 -85
  30. package/dist/option-position.js +88 -85
  31. package/dist/pin-input.cjs +30 -29
  32. package/dist/pin-input.js +30 -29
  33. package/dist/pnl-diagram.cjs +20 -20
  34. package/dist/pnl-diagram.js +20 -20
  35. package/dist/popover.cjs +3 -7
  36. package/dist/popover.js +3 -7
  37. package/dist/progress-circle.cjs +40 -22
  38. package/dist/progress-circle.d.cts +5 -5
  39. package/dist/progress-circle.d.ts +5 -5
  40. package/dist/progress-circle.js +41 -22
  41. package/dist/progress.cjs +15 -22
  42. package/dist/progress.d.cts +6 -6
  43. package/dist/progress.d.ts +6 -6
  44. package/dist/progress.js +15 -22
  45. package/dist/radio.cjs +35 -68
  46. package/dist/radio.d.cts +18 -18
  47. package/dist/radio.d.ts +18 -18
  48. package/dist/radio.js +36 -69
  49. package/dist/rating.cjs +15 -17
  50. package/dist/rating.js +15 -17
  51. package/dist/slider.cjs +33 -50
  52. package/dist/slider.js +34 -51
  53. package/dist/strategy-builder.cjs +194 -115
  54. package/dist/strategy-builder.js +194 -115
  55. package/dist/switch.cjs +48 -55
  56. package/dist/switch.js +49 -56
  57. package/dist/tag.cjs +115 -69
  58. package/dist/tag.js +116 -69
  59. package/dist/tooltip.cjs +28 -17
  60. package/dist/tooltip.js +30 -18
  61. package/package.json +1 -1
  62. package/src/alert.tsx +78 -45
  63. package/src/avatar.tsx +54 -38
  64. package/src/badge.tsx +65 -44
  65. package/src/checkbox.tsx +70 -89
  66. package/src/close-button.tsx +3 -8
  67. package/src/empty-state.tsx +21 -17
  68. package/src/expiration-selector.tsx +84 -66
  69. package/src/greeks-display.tsx +59 -51
  70. package/src/input-group.tsx +38 -24
  71. package/src/option-chain.tsx +154 -104
  72. package/src/option-position.tsx +143 -114
  73. package/src/pin-input.tsx +37 -29
  74. package/src/pnl-diagram.tsx +36 -28
  75. package/src/progress-circle.tsx +52 -28
  76. package/src/progress.tsx +17 -21
  77. package/src/radio.tsx +56 -76
  78. package/src/rating.tsx +22 -20
  79. package/src/slider.tsx +43 -45
  80. package/src/strategy-builder.tsx +260 -162
  81. package/src/switch.tsx +63 -64
  82. package/src/tag.tsx +89 -51
  83. package/src/tooltip.tsx +21 -13
  84. package/tokens.css +18 -0
@@ -1,12 +1,8 @@
1
1
  "use client";
2
+ import { YStack, XStack, Text, View } from '@hanzo/gui';
2
3
  import * as React from 'react';
3
- import { clsx } from 'clsx';
4
- import { twMerge } from 'tailwind-merge';
5
4
  import { jsxs, jsx } from 'react/jsx-runtime';
6
5
 
7
- function cn(...inputs) {
8
- return twMerge(clsx(inputs));
9
- }
10
6
  function findATM(strikes, spot) {
11
7
  if (strikes.length === 0) return spot;
12
8
  return strikes.reduce(
@@ -115,84 +111,145 @@ var STRATEGY_PRESETS = [
115
111
  ]
116
112
  }
117
113
  ];
114
+ var MONO = "monospace";
115
+ var CONTROL_BOX = {
116
+ backgroundColor: "var(--color-input-bg)",
117
+ borderWidth: 1,
118
+ borderColor: "var(--color-input-border)",
119
+ outlineWidth: 0,
120
+ focusStyle: { borderColor: "var(--color-input-border-focus)" }
121
+ };
122
+ var CONTROL_INK = { color: "var(--color-input-fg)" };
118
123
  function LegRow({ leg, index, strikes, expirations, removable, onChange, onRemove }) {
119
124
  const update = (patch) => {
120
125
  onChange(index, { ...leg, ...patch });
121
126
  };
122
- return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-md bg-zinc-800/50 px-2 py-1.5", children: [
123
- /* @__PURE__ */ jsx("span", { className: "text-[10px] font-mono text-zinc-500 w-4 shrink-0", children: index + 1 }),
124
- /* @__PURE__ */ jsx(
125
- "button",
126
- {
127
- type: "button",
128
- className: cn(
129
- "px-2 py-0.5 rounded text-xs font-semibold transition-colors",
130
- leg.action === "buy" ? "bg-emerald-900/60 text-emerald-400" : "bg-red-900/60 text-red-400"
127
+ return /* @__PURE__ */ jsxs(
128
+ XStack,
129
+ {
130
+ alignItems: "center",
131
+ gap: 8,
132
+ borderRadius: 6,
133
+ backgroundColor: "var(--color-tag-subtle-bg)",
134
+ paddingHorizontal: 8,
135
+ paddingVertical: 6,
136
+ children: [
137
+ /* @__PURE__ */ jsx(Text, { fontSize: 10, style: { fontFamily: MONO }, flexShrink: 0, width: 16, color: "var(--color-text-secondary)", children: index + 1 }),
138
+ /* @__PURE__ */ jsx(
139
+ XStack,
140
+ {
141
+ unstyled: true,
142
+ render: /* @__PURE__ */ jsx("button", { type: "button" }),
143
+ onClick: () => update({ action: leg.action === "buy" ? "sell" : "buy" }),
144
+ paddingHorizontal: 8,
145
+ paddingVertical: 2,
146
+ borderRadius: 4,
147
+ borderWidth: 0,
148
+ cursor: "pointer",
149
+ transition: "quick",
150
+ backgroundColor: leg.action === "buy" ? "color-mix(in srgb, var(--color-status-good) 20%, transparent)" : "color-mix(in srgb, var(--color-status-bad) 20%, transparent)",
151
+ children: /* @__PURE__ */ jsx(Text, { fontSize: 12, fontWeight: "600", color: leg.action === "buy" ? "var(--color-status-good)" : "var(--color-status-bad)", children: leg.action === "buy" ? "BUY" : "SELL" })
152
+ }
131
153
  ),
132
- onClick: () => update({ action: leg.action === "buy" ? "sell" : "buy" }),
133
- children: leg.action === "buy" ? "BUY" : "SELL"
134
- }
135
- ),
136
- /* @__PURE__ */ jsx(
137
- "button",
138
- {
139
- type: "button",
140
- className: cn(
141
- "px-2 py-0.5 rounded text-xs font-medium transition-colors",
142
- // Call vs put is a rank difference, not a hue difference.
143
- leg.type === "call" ? "bg-[var(--secondary)] text-[var(--foreground)]" : "bg-[var(--muted)] text-[var(--muted-foreground)]"
154
+ /* @__PURE__ */ jsx(
155
+ XStack,
156
+ {
157
+ unstyled: true,
158
+ render: /* @__PURE__ */ jsx("button", { type: "button" }),
159
+ onClick: () => update({ type: leg.type === "call" ? "put" : "call" }),
160
+ paddingHorizontal: 8,
161
+ paddingVertical: 2,
162
+ borderRadius: 4,
163
+ borderWidth: 0,
164
+ cursor: "pointer",
165
+ transition: "quick",
166
+ backgroundColor: leg.type === "call" ? "var(--secondary)" : "var(--muted)",
167
+ children: /* @__PURE__ */ jsx(Text, { fontSize: 12, fontWeight: "500", color: leg.type === "call" ? "var(--foreground)" : "var(--muted-foreground)", children: leg.type === "call" ? "CALL" : "PUT" })
168
+ }
144
169
  ),
145
- onClick: () => update({ type: leg.type === "call" ? "put" : "call" }),
146
- children: leg.type === "call" ? "CALL" : "PUT"
147
- }
148
- ),
149
- /* @__PURE__ */ jsx(
150
- "select",
151
- {
152
- value: leg.strike,
153
- onChange: (e) => update({ strike: Number(e.target.value) }),
154
- className: "bg-zinc-900 border border-zinc-700 rounded px-1.5 py-0.5 text-xs font-mono text-zinc-200 outline-none focus:border-zinc-500 min-w-[72px]",
155
- children: strikes.map((s) => /* @__PURE__ */ jsx("option", { value: s, children: s.toFixed(2) }, s))
156
- }
157
- ),
158
- /* @__PURE__ */ jsx(
159
- "select",
160
- {
161
- value: leg.expiration,
162
- onChange: (e) => update({ expiration: e.target.value }),
163
- className: "bg-zinc-900 border border-zinc-700 rounded px-1.5 py-0.5 text-xs text-zinc-200 outline-none focus:border-zinc-500 min-w-[80px]",
164
- children: expirations.map((exp) => /* @__PURE__ */ jsx("option", { value: exp, children: exp }, exp))
165
- }
166
- ),
167
- /* @__PURE__ */ jsx(
168
- "input",
169
- {
170
- type: "number",
171
- min: 1,
172
- max: 999,
173
- value: leg.quantity,
174
- onChange: (e) => update({ quantity: Math.max(1, parseInt(e.target.value, 10) || 1) }),
175
- className: "bg-zinc-900 border border-zinc-700 rounded px-1.5 py-0.5 text-xs font-mono text-zinc-200 outline-none focus:border-zinc-500 w-[48px] text-center"
176
- }
177
- ),
178
- leg.premium !== void 0 && /* @__PURE__ */ jsxs("span", { className: cn(
179
- "font-mono tabular-nums text-xs ml-auto",
180
- leg.premium >= 0 ? "text-emerald-400" : "text-red-400"
181
- ), children: [
182
- leg.premium >= 0 ? "+" : "",
183
- leg.premium.toFixed(2)
184
- ] }),
185
- removable && /* @__PURE__ */ jsx(
186
- "button",
187
- {
188
- type: "button",
189
- onClick: () => onRemove(index),
190
- className: "ml-auto p-0.5 text-zinc-500 hover:text-red-400 transition-colors",
191
- "aria-label": "Remove leg",
192
- children: /* @__PURE__ */ jsx("svg", { className: "h-3.5 w-3.5", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M18 6L6 18M6 6l12 12", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) })
193
- }
194
- )
195
- ] });
170
+ /* @__PURE__ */ jsx(
171
+ View,
172
+ {
173
+ unstyled: true,
174
+ render: /* @__PURE__ */ jsx("select", { value: leg.strike, onChange: (e) => update({ strike: Number(e.target.value) }) }),
175
+ ...CONTROL_BOX,
176
+ borderRadius: 4,
177
+ paddingHorizontal: 6,
178
+ paddingVertical: 2,
179
+ minWidth: 72,
180
+ style: { ...CONTROL_INK, fontFamily: MONO, fontSize: 12 },
181
+ children: strikes.map((s) => /* @__PURE__ */ jsx("option", { value: s, children: s.toFixed(2) }, s))
182
+ }
183
+ ),
184
+ /* @__PURE__ */ jsx(
185
+ View,
186
+ {
187
+ unstyled: true,
188
+ render: /* @__PURE__ */ jsx("select", { value: leg.expiration, onChange: (e) => update({ expiration: e.target.value }) }),
189
+ ...CONTROL_BOX,
190
+ borderRadius: 4,
191
+ paddingHorizontal: 6,
192
+ paddingVertical: 2,
193
+ minWidth: 80,
194
+ style: { ...CONTROL_INK, fontSize: 12 },
195
+ children: expirations.map((exp) => /* @__PURE__ */ jsx("option", { value: exp, children: exp }, exp))
196
+ }
197
+ ),
198
+ /* @__PURE__ */ jsx(
199
+ View,
200
+ {
201
+ unstyled: true,
202
+ render: /* @__PURE__ */ jsx(
203
+ "input",
204
+ {
205
+ type: "number",
206
+ min: 1,
207
+ max: 999,
208
+ value: leg.quantity,
209
+ onChange: (e) => update({ quantity: Math.max(1, parseInt(e.target.value, 10) || 1) })
210
+ }
211
+ ),
212
+ ...CONTROL_BOX,
213
+ borderRadius: 4,
214
+ paddingHorizontal: 6,
215
+ paddingVertical: 2,
216
+ width: 48,
217
+ style: { ...CONTROL_INK, fontFamily: MONO, fontSize: 12, textAlign: "center" }
218
+ }
219
+ ),
220
+ leg.premium !== void 0 && /* @__PURE__ */ jsxs(
221
+ Text,
222
+ {
223
+ fontSize: 12,
224
+ style: { fontFamily: MONO },
225
+ fontVariant: ["tabular-nums"],
226
+ marginLeft: "auto",
227
+ color: leg.premium >= 0 ? "var(--color-status-good)" : "var(--color-status-bad)",
228
+ children: [
229
+ leg.premium >= 0 ? "+" : "",
230
+ leg.premium.toFixed(2)
231
+ ]
232
+ }
233
+ ),
234
+ removable && /* @__PURE__ */ jsx(
235
+ XStack,
236
+ {
237
+ unstyled: true,
238
+ render: /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Remove leg" }),
239
+ onClick: () => onRemove(index),
240
+ marginLeft: "auto",
241
+ padding: 2,
242
+ borderWidth: 0,
243
+ cursor: "pointer",
244
+ transition: "quick",
245
+ style: { color: "var(--color-text-secondary)" },
246
+ hoverStyle: { opacity: 0.7 },
247
+ children: /* @__PURE__ */ jsx("svg", { width: 14, height: 14, viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M18 6L6 18M6 6l12 12", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) })
248
+ }
249
+ )
250
+ ]
251
+ }
252
+ );
196
253
  }
197
254
  var StrategyBuilder = React.forwardRef(
198
255
  function StrategyBuilder2(props, ref) {
@@ -262,37 +319,46 @@ var StrategyBuilder = React.forwardRef(
262
319
  });
263
320
  }, [onSubmit, strategyType, legs, netPremium]);
264
321
  const currentPreset = STRATEGY_PRESETS.find((p) => p.value === strategyType);
322
+ const netColor = netPremium > 0 ? "var(--color-status-good)" : netPremium < 0 ? "var(--color-status-bad)" : "var(--color-text-secondary)";
265
323
  return /* @__PURE__ */ jsxs(
266
- "div",
324
+ YStack,
267
325
  {
268
326
  ref,
269
- className: cn(
270
- "flex flex-col gap-3 rounded-lg border border-zinc-800 bg-zinc-900/50 p-3",
271
- className
272
- ),
327
+ gap: 12,
328
+ borderRadius: 8,
329
+ borderWidth: 1,
330
+ borderColor: "var(--color-border-divider)",
331
+ backgroundColor: "var(--card)",
332
+ padding: 12,
333
+ className,
273
334
  ...rest,
274
335
  children: [
275
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3", children: [
276
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
277
- /* @__PURE__ */ jsx("span", { className: "text-xs font-semibold uppercase tracking-wider text-zinc-500", children: "Strategy" }),
278
- /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-zinc-200", children: underlying })
336
+ /* @__PURE__ */ jsxs(XStack, { alignItems: "center", justifyContent: "space-between", gap: 12, children: [
337
+ /* @__PURE__ */ jsxs(XStack, { alignItems: "center", gap: 8, children: [
338
+ /* @__PURE__ */ jsx(Text, { fontSize: 12, fontWeight: "600", textTransform: "uppercase", letterSpacing: 0.6, color: "var(--color-text-secondary)", children: "Strategy" }),
339
+ /* @__PURE__ */ jsx(Text, { fontSize: 14, fontWeight: "500", color: "var(--color-text-primary)", children: underlying })
279
340
  ] }),
280
- /* @__PURE__ */ jsxs("span", { className: "text-[10px] text-zinc-500", children: [
341
+ /* @__PURE__ */ jsxs(Text, { fontSize: 10, color: "var(--color-text-secondary)", children: [
281
342
  "Spot: ",
282
- /* @__PURE__ */ jsx("span", { className: "font-mono tabular-nums text-zinc-300", children: spotPrice.toFixed(2) })
343
+ /* @__PURE__ */ jsx(Text, { style: { fontFamily: MONO }, fontVariant: ["tabular-nums"], color: "var(--color-text-primary)", children: spotPrice.toFixed(2) })
283
344
  ] })
284
345
  ] }),
285
- /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx(
286
- "select",
346
+ /* @__PURE__ */ jsx(XStack, { alignItems: "center", gap: 8, children: /* @__PURE__ */ jsx(
347
+ View,
287
348
  {
288
- value: strategyType,
289
- onChange: handleStrategyChange,
290
- className: "flex-1 bg-zinc-900 border border-zinc-700 rounded-md px-2.5 py-1.5 text-sm text-zinc-200 outline-none focus:border-zinc-500",
349
+ unstyled: true,
350
+ render: /* @__PURE__ */ jsx("select", { value: strategyType, onChange: handleStrategyChange }),
351
+ flex: 1,
352
+ ...CONTROL_BOX,
353
+ borderRadius: 6,
354
+ paddingHorizontal: 10,
355
+ paddingVertical: 6,
356
+ style: { ...CONTROL_INK, fontSize: 14 },
291
357
  children: STRATEGY_PRESETS.map((preset) => /* @__PURE__ */ jsx("option", { value: preset.value, children: preset.label }, preset.value))
292
358
  }
293
359
  ) }),
294
- currentPreset && /* @__PURE__ */ jsx("p", { className: "text-[11px] text-zinc-500 -mt-1", children: currentPreset.description }),
295
- /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1.5", children: legs.map((leg, i) => /* @__PURE__ */ jsx(
360
+ currentPreset && /* @__PURE__ */ jsx(Text, { fontSize: 11, marginTop: -4, color: "var(--color-text-secondary)", children: currentPreset.description }),
361
+ /* @__PURE__ */ jsx(YStack, { gap: 6, children: legs.map((leg, i) => /* @__PURE__ */ jsx(
296
362
  LegRow,
297
363
  {
298
364
  leg,
@@ -306,40 +372,53 @@ var StrategyBuilder = React.forwardRef(
306
372
  i
307
373
  )) }),
308
374
  strategyType === "custom" && legs.length < 4 && /* @__PURE__ */ jsxs(
309
- "button",
375
+ XStack,
310
376
  {
311
- type: "button",
377
+ unstyled: true,
378
+ render: /* @__PURE__ */ jsx("button", { type: "button" }),
312
379
  onClick: handleAddLeg,
313
- className: "flex items-center justify-center gap-1 rounded-md border border-dashed border-zinc-700 py-1 text-xs text-zinc-500 hover:text-zinc-300 hover:border-zinc-500 transition-colors",
380
+ alignItems: "center",
381
+ justifyContent: "center",
382
+ gap: 4,
383
+ borderRadius: 6,
384
+ borderWidth: 1,
385
+ paddingVertical: 4,
386
+ cursor: "pointer",
387
+ transition: "quick",
388
+ borderColor: "var(--color-border-divider)",
389
+ hoverStyle: { borderColor: "var(--color-hover)" },
390
+ style: { color: "var(--color-text-secondary)", borderStyle: "dashed" },
314
391
  children: [
315
- /* @__PURE__ */ jsx("svg", { className: "h-3 w-3", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M12 5v14M5 12h14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }),
316
- "Add Leg"
392
+ /* @__PURE__ */ jsx("svg", { width: 12, height: 12, viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M12 5v14M5 12h14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }),
393
+ /* @__PURE__ */ jsx(Text, { fontSize: 12, color: "var(--color-text-secondary)", children: "Add Leg" })
317
394
  ]
318
395
  }
319
396
  ),
320
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between pt-1 border-t border-zinc-800", children: [
321
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
322
- /* @__PURE__ */ jsx("span", { className: "text-xs text-zinc-500", children: "Net:" }),
323
- /* @__PURE__ */ jsxs("span", { className: cn(
324
- "font-mono tabular-nums text-sm font-semibold",
325
- netPremium > 0 ? "text-emerald-400" : netPremium < 0 ? "text-red-400" : "text-zinc-400"
326
- ), children: [
397
+ /* @__PURE__ */ jsxs(XStack, { alignItems: "center", justifyContent: "space-between", paddingTop: 4, borderTopWidth: 1, borderColor: "var(--color-border-divider)", children: [
398
+ /* @__PURE__ */ jsxs(XStack, { alignItems: "center", gap: 8, children: [
399
+ /* @__PURE__ */ jsx(Text, { fontSize: 12, color: "var(--color-text-secondary)", children: "Net:" }),
400
+ /* @__PURE__ */ jsxs(Text, { fontSize: 14, fontWeight: "600", style: { fontFamily: MONO }, fontVariant: ["tabular-nums"], color: netColor, children: [
327
401
  netPremium > 0 ? "Credit " : netPremium < 0 ? "Debit " : "",
328
402
  netPremium !== 0 ? `$${Math.abs(netPremium).toFixed(2)}` : "-"
329
403
  ] })
330
404
  ] }),
331
405
  /* @__PURE__ */ jsx(
332
- "button",
406
+ XStack,
333
407
  {
334
- type: "button",
408
+ unstyled: true,
409
+ render: /* @__PURE__ */ jsx("button", { type: "button" }),
335
410
  onClick: handleSubmit,
336
411
  disabled: legs.length === 0,
337
- className: cn(
338
- "px-4 py-1.5 rounded-md text-xs font-semibold transition-colors",
339
- "bg-blue-600 text-white hover:bg-blue-500",
340
- "disabled:opacity-40 disabled:cursor-not-allowed"
341
- ),
342
- children: "Review Order"
412
+ paddingHorizontal: 16,
413
+ paddingVertical: 6,
414
+ borderRadius: 6,
415
+ borderWidth: 0,
416
+ cursor: "pointer",
417
+ transition: "quick",
418
+ backgroundColor: "var(--color-button-solid-bg)",
419
+ hoverStyle: { backgroundColor: "var(--color-hover)" },
420
+ disabledStyle: { opacity: 0.4, cursor: "not-allowed" },
421
+ children: /* @__PURE__ */ jsx(Text, { fontSize: 12, fontWeight: "600", color: "var(--color-button-solid-text)", children: "Review Order" })
343
422
  }
344
423
  )
345
424
  ] })
package/dist/switch.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) {
@@ -28,28 +26,17 @@ function _interopNamespace(e) {
28
26
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
29
27
 
30
28
  // src/switch.tsx
31
- function cn(...inputs) {
32
- return tailwindMerge.twMerge(clsx.clsx(inputs));
33
- }
34
29
  var NOOP = () => {
35
30
  };
36
- var SIZE_CLASSES = {
37
- sm: {
38
- root: "h-4 w-7",
39
- thumb: "h-3 w-3",
40
- label: "text-xs"
41
- },
42
- md: {
43
- root: "h-5 w-9",
44
- thumb: "h-4 w-4",
45
- label: "text-sm"
46
- },
47
- lg: {
48
- root: "h-6 w-11",
49
- thumb: "h-5 w-5",
50
- label: "text-base"
51
- }
31
+ var SIZE = {
32
+ sm: { width: 28, height: 16, thumb: 12, label: 12 },
33
+ md: { width: 36, height: 20, thumb: 16, label: 14 },
34
+ lg: { width: 44, height: 24, thumb: 20, label: 16 }
52
35
  };
36
+ var TRACK_ON = "var(--color-text-primary)";
37
+ var TRACK_OFF = "var(--color-switch-bg)";
38
+ var OUTLINE = "var(--color-gray-500)";
39
+ var WHITE = "var(--color-white)";
53
40
  var SwitchBase = React__namespace.forwardRef(
54
41
  function Switch(props, ref) {
55
42
  const {
@@ -66,7 +53,6 @@ var SwitchBase = React__namespace.forwardRef(
66
53
  disabled = false,
67
54
  size = "md",
68
55
  direction,
69
- className,
70
56
  ...rest
71
57
  } = props;
72
58
  const [internalChecked, setInternalChecked] = React__namespace.useState(defaultChecked ?? false);
@@ -81,18 +67,19 @@ var SwitchBase = React__namespace.forwardRef(
81
67
  },
82
68
  [isControlled, onCheckedChange]
83
69
  );
84
- const sizeClasses = SIZE_CLASSES[size];
70
+ const s = SIZE[size];
85
71
  const isRtl = direction === "rtl";
86
72
  return /* @__PURE__ */ jsxRuntime.jsxs(
87
- "label",
73
+ gui.Label,
88
74
  {
89
75
  ref: rootRef,
90
- className: cn(
91
- "inline-flex items-center cursor-pointer select-none gap-2",
92
- isRtl && "flex-row-reverse",
93
- disabled && "opacity-50 cursor-not-allowed",
94
- className
95
- ),
76
+ unstyled: true,
77
+ flexDirection: isRtl ? "row-reverse" : "row",
78
+ alignItems: "center",
79
+ gap: 8,
80
+ cursor: disabled ? "not-allowed" : "pointer",
81
+ userSelect: "none",
82
+ opacity: disabled ? 0.5 : 1,
96
83
  onChange,
97
84
  "data-disabled": disabled || void 0,
98
85
  ...rest,
@@ -104,38 +91,51 @@ var SwitchBase = React__namespace.forwardRef(
104
91
  checked: checkedState,
105
92
  onCheckedChange: handleCheckedChange,
106
93
  disabled,
107
- className: cn(
108
- "relative inline-flex shrink-0 items-center rounded-full",
109
- "bg-gray-300 dark:bg-gray-600",
110
- "data-[state=checked]:bg-gray-800 dark:bg-white",
111
- "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-500",
112
- "transition-colors duration-200",
113
- sizeClasses.root
114
- ),
94
+ position: "relative",
95
+ flexShrink: 0,
96
+ alignItems: "center",
97
+ width: s.width,
98
+ height: s.height,
99
+ borderRadius: 9999,
100
+ backgroundColor: checkedState ? TRACK_ON : TRACK_OFF,
101
+ transition: "quick",
102
+ focusStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: OUTLINE, outlineOffset: 2 },
115
103
  children: [
116
- trackLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute inset-0 flex items-center justify-center text-[8px] font-bold text-white pointer-events-none", children: checkedState ? trackLabel.on : trackLabel.off }),
104
+ trackLabel && /* @__PURE__ */ jsxRuntime.jsx(
105
+ gui.Text,
106
+ {
107
+ position: "absolute",
108
+ width: "100%",
109
+ textAlign: "center",
110
+ fontSize: 8,
111
+ fontWeight: "700",
112
+ color: WHITE,
113
+ pointerEvents: "none",
114
+ children: checkedState ? trackLabel.on : trackLabel.off
115
+ }
116
+ ),
117
117
  /* @__PURE__ */ jsxRuntime.jsx(
118
118
  gui.Switch.Thumb,
119
119
  {
120
120
  unstyled: true,
121
121
  "data-thumb": true,
122
122
  transition: "quicker",
123
- className: cn(
124
- "block rounded-full bg-white shadow-sm",
125
- sizeClasses.thumb
126
- ),
127
- children: thumbLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex items-center justify-center h-full w-full text-[8px]", children: checkedState ? thumbLabel.on : thumbLabel.off })
123
+ width: s.thumb,
124
+ height: s.thumb,
125
+ borderRadius: 9999,
126
+ backgroundColor: WHITE,
127
+ boxShadow: "0 1px 2px 0 rgba(0,0,0,0.05)",
128
+ children: thumbLabel && /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { width: "100%", height: "100%", textAlign: "center", fontSize: 8, children: checkedState ? thumbLabel.on : thumbLabel.off })
128
129
  }
129
130
  )
130
131
  ]
131
132
  }
132
133
  ),
133
- /* @__PURE__ */ jsxRuntime.jsx(
134
+ /* @__PURE__ */ jsxRuntime.jsx(gui.VisuallyHidden, { children: /* @__PURE__ */ jsxRuntime.jsx(
134
135
  "input",
135
136
  {
136
137
  ref,
137
138
  type: "checkbox",
138
- className: "sr-only",
139
139
  checked: checkedState,
140
140
  disabled,
141
141
  tabIndex: -1,
@@ -143,15 +143,8 @@ var SwitchBase = React__namespace.forwardRef(
143
143
  onChange: NOOP,
144
144
  ...inputProps
145
145
  }
146
- ),
147
- children != null && /* @__PURE__ */ jsxRuntime.jsx(
148
- "span",
149
- {
150
- ...labelProps,
151
- className: cn(sizeClasses.label, labelProps?.className),
152
- children
153
- }
154
- )
146
+ ) }),
147
+ children != null && /* @__PURE__ */ jsxRuntime.jsx(gui.Text, { ...labelProps, fontSize: s.label, children })
155
148
  ]
156
149
  }
157
150
  );