@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.
Files changed (137) hide show
  1. package/dist/accordion.cjs +107 -166
  2. package/dist/accordion.d.cts +18 -51
  3. package/dist/accordion.d.ts +18 -51
  4. package/dist/accordion.js +109 -166
  5. package/dist/alert.cjs +68 -46
  6. package/dist/alert.js +69 -46
  7. package/dist/avatar.cjs +49 -46
  8. package/dist/avatar.js +52 -48
  9. package/dist/badge.cjs +82 -49
  10. package/dist/badge.js +83 -50
  11. package/dist/checkbox.cjs +42 -75
  12. package/dist/checkbox.js +43 -76
  13. package/dist/chrome.cjs +196 -386
  14. package/dist/chrome.js +198 -386
  15. package/dist/close-button.cjs +3 -7
  16. package/dist/close-button.js +3 -7
  17. package/dist/collapsible.cjs +35 -26
  18. package/dist/collapsible.d.cts +2 -1
  19. package/dist/collapsible.d.ts +2 -1
  20. package/dist/collapsible.js +34 -24
  21. package/dist/dialog.cjs +3 -7
  22. package/dist/dialog.d.cts +1 -1
  23. package/dist/dialog.d.ts +1 -1
  24. package/dist/dialog.js +3 -7
  25. package/dist/drawer.cjs +95 -122
  26. package/dist/drawer.d.cts +43 -10
  27. package/dist/drawer.d.ts +43 -10
  28. package/dist/drawer.js +97 -122
  29. package/dist/empty-state.cjs +13 -13
  30. package/dist/empty-state.js +13 -13
  31. package/dist/expiration-selector.cjs +58 -63
  32. package/dist/expiration-selector.js +58 -63
  33. package/dist/field.cjs +60 -109
  34. package/dist/field.d.cts +0 -1
  35. package/dist/field.d.ts +0 -1
  36. package/dist/field.js +61 -109
  37. package/dist/greeks-display.cjs +48 -39
  38. package/dist/greeks-display.js +48 -39
  39. package/dist/heading.cjs +10 -17
  40. package/dist/heading.d.cts +0 -2
  41. package/dist/heading.d.ts +0 -2
  42. package/dist/heading.js +10 -17
  43. package/dist/icon-button.cjs +82 -82
  44. package/dist/icon-button.d.cts +16 -12
  45. package/dist/icon-button.d.ts +16 -12
  46. package/dist/icon-button.js +82 -82
  47. package/dist/index.cjs +1812 -2105
  48. package/dist/index.d.cts +1 -5
  49. package/dist/index.d.ts +1 -5
  50. package/dist/index.js +1814 -2100
  51. package/dist/input-group.cjs +11 -12
  52. package/dist/input-group.js +11 -12
  53. package/dist/input.cjs +27 -27
  54. package/dist/input.d.cts +21 -1
  55. package/dist/input.d.ts +21 -1
  56. package/dist/input.js +25 -28
  57. package/dist/menu.cjs +160 -271
  58. package/dist/menu.d.cts +41 -57
  59. package/dist/menu.d.ts +41 -57
  60. package/dist/menu.js +161 -251
  61. package/dist/option-chain.cjs +89 -67
  62. package/dist/option-chain.js +89 -67
  63. package/dist/option-position.cjs +88 -85
  64. package/dist/option-position.js +88 -85
  65. package/dist/pnl-diagram.cjs +20 -20
  66. package/dist/pnl-diagram.js +20 -20
  67. package/dist/popover.cjs +4 -8
  68. package/dist/popover.js +4 -8
  69. package/dist/progress.cjs +15 -22
  70. package/dist/progress.d.cts +6 -6
  71. package/dist/progress.d.ts +6 -6
  72. package/dist/progress.js +15 -22
  73. package/dist/radio.cjs +35 -67
  74. package/dist/radio.d.cts +18 -18
  75. package/dist/radio.d.ts +18 -18
  76. package/dist/radio.js +36 -68
  77. package/dist/select.cjs +40 -39
  78. package/dist/select.d.cts +35 -4
  79. package/dist/select.d.ts +35 -4
  80. package/dist/select.js +40 -38
  81. package/dist/separator.cjs +8 -33
  82. package/dist/separator.js +8 -33
  83. package/dist/slider.cjs +33 -49
  84. package/dist/slider.js +34 -50
  85. package/dist/switch.cjs +48 -55
  86. package/dist/switch.js +49 -56
  87. package/dist/tabs.cjs +108 -197
  88. package/dist/tabs.d.cts +16 -60
  89. package/dist/tabs.d.ts +16 -60
  90. package/dist/tabs.js +109 -196
  91. package/dist/tag.cjs +112 -69
  92. package/dist/tag.js +113 -69
  93. package/dist/textarea.cjs +56 -27
  94. package/dist/textarea.js +57 -28
  95. package/dist/toaster.cjs +97 -79
  96. package/dist/toaster.d.cts +7 -8
  97. package/dist/toaster.d.ts +7 -8
  98. package/dist/toaster.js +78 -80
  99. package/dist/tooltip.cjs +28 -17
  100. package/dist/tooltip.js +30 -18
  101. package/package.json +2 -16
  102. package/src/accordion.tsx +173 -227
  103. package/src/alert.tsx +78 -45
  104. package/src/avatar.tsx +54 -37
  105. package/src/badge.tsx +65 -44
  106. package/src/checkbox.tsx +70 -89
  107. package/src/close-button.tsx +3 -8
  108. package/src/collapsible.tsx +55 -52
  109. package/src/drawer.tsx +123 -115
  110. package/src/empty-state.tsx +21 -17
  111. package/src/expiration-selector.tsx +84 -66
  112. package/src/field.tsx +68 -124
  113. package/src/greeks-display.tsx +59 -51
  114. package/src/heading.tsx +22 -26
  115. package/src/icon-button.tsx +134 -141
  116. package/src/ink.tsx +37 -0
  117. package/src/input-group.tsx +59 -36
  118. package/src/input.tsx +41 -32
  119. package/src/menu.tsx +224 -397
  120. package/src/option-chain.tsx +154 -104
  121. package/src/option-position.tsx +136 -114
  122. package/src/pin-input.tsx +37 -29
  123. package/src/pnl-diagram.tsx +36 -28
  124. package/src/popover.tsx +1 -1
  125. package/src/progress.tsx +17 -21
  126. package/src/radio.tsx +56 -75
  127. package/src/select.tsx +80 -59
  128. package/src/separator.tsx +13 -34
  129. package/src/slider.tsx +43 -44
  130. package/src/strategy-builder.tsx +245 -156
  131. package/src/switch.tsx +63 -64
  132. package/src/tabs.tsx +166 -296
  133. package/src/tag.tsx +89 -51
  134. package/src/textarea.tsx +19 -29
  135. package/src/toaster.tsx +118 -86
  136. package/src/tooltip.tsx +21 -13
  137. package/tokens.css +79 -0
@@ -31,11 +31,7 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
31
31
  function cn(...inputs) {
32
32
  return tailwindMerge.twMerge(clsx.clsx(inputs));
33
33
  }
34
- function getComponentDisplayName(type) {
35
- if (typeof type === "string") return void 0;
36
- if ("displayName" in type) return type.displayName;
37
- return void 0;
38
- }
34
+ var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React__namespace.useLayoutEffect : React__namespace.useEffect;
39
35
  var InputGroup = React__namespace.forwardRef(
40
36
  function InputGroup2(props, ref) {
41
37
  const {
@@ -81,7 +77,7 @@ var InputGroup = React__namespace.forwardRef(
81
77
  }
82
78
  };
83
79
  }, [calculateInlinePaddings]);
84
- React__namespace.useEffect(() => {
80
+ useIsomorphicLayoutEffect(() => {
85
81
  calculateInlinePaddings();
86
82
  const resizeHandler = esToolkit.debounce(calculateInlinePaddings, 300);
87
83
  const resizeObserver = new ResizeObserver(resizeHandler);
@@ -122,15 +118,18 @@ var InputGroup = React__namespace.forwardRef(
122
118
  }
123
119
  ),
124
120
  React__namespace.Children.map(children, (child) => {
125
- if (getComponentDisplayName(child.type) !== "FieldInput") {
121
+ if (!React__namespace.isValidElement(child)) {
126
122
  return child;
127
123
  }
124
+ const start = startElement ? startOffset ?? inlinePaddings?.start : void 0;
125
+ const end = endElement ? endOffset ?? inlinePaddings?.end : void 0;
126
+ const px = (v) => typeof v === "number" ? `${v}px` : v;
128
127
  return React__namespace.cloneElement(child, {
129
- ...startElement && { ps: startOffset ?? (inlinePaddings?.start ? `${inlinePaddings.start}px` : void 0) },
130
- ...endElement && { pe: endOffset ?? (inlinePaddings?.end ? `${inlinePaddings.end}px` : void 0) },
131
- // hide input value and placeholder for the first render
132
- value: inlinePaddings ? child.props.value : void 0,
133
- placeholder: inlinePaddings ? child.props.placeholder : void 0
128
+ style: {
129
+ ...child.props.style,
130
+ ...start !== void 0 && { paddingInlineStart: px(start) },
131
+ ...end !== void 0 && { paddingInlineEnd: px(end) }
132
+ }
134
133
  });
135
134
  }),
136
135
  endElement && /* @__PURE__ */ jsxRuntime.jsx(
@@ -9,11 +9,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
9
9
  function cn(...inputs) {
10
10
  return twMerge(clsx(inputs));
11
11
  }
12
- function getComponentDisplayName(type) {
13
- if (typeof type === "string") return void 0;
14
- if ("displayName" in type) return type.displayName;
15
- return void 0;
16
- }
12
+ var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
17
13
  var InputGroup = React.forwardRef(
18
14
  function InputGroup2(props, ref) {
19
15
  const {
@@ -59,7 +55,7 @@ var InputGroup = React.forwardRef(
59
55
  }
60
56
  };
61
57
  }, [calculateInlinePaddings]);
62
- React.useEffect(() => {
58
+ useIsomorphicLayoutEffect(() => {
63
59
  calculateInlinePaddings();
64
60
  const resizeHandler = debounce(calculateInlinePaddings, 300);
65
61
  const resizeObserver = new ResizeObserver(resizeHandler);
@@ -100,15 +96,18 @@ var InputGroup = React.forwardRef(
100
96
  }
101
97
  ),
102
98
  React.Children.map(children, (child) => {
103
- if (getComponentDisplayName(child.type) !== "FieldInput") {
99
+ if (!React.isValidElement(child)) {
104
100
  return child;
105
101
  }
102
+ const start = startElement ? startOffset ?? inlinePaddings?.start : void 0;
103
+ const end = endElement ? endOffset ?? inlinePaddings?.end : void 0;
104
+ const px = (v) => typeof v === "number" ? `${v}px` : v;
106
105
  return React.cloneElement(child, {
107
- ...startElement && { ps: startOffset ?? (inlinePaddings?.start ? `${inlinePaddings.start}px` : void 0) },
108
- ...endElement && { pe: endOffset ?? (inlinePaddings?.end ? `${inlinePaddings.end}px` : void 0) },
109
- // hide input value and placeholder for the first render
110
- value: inlinePaddings ? child.props.value : void 0,
111
- placeholder: inlinePaddings ? child.props.placeholder : void 0
106
+ style: {
107
+ ...child.props.style,
108
+ ...start !== void 0 && { paddingInlineStart: px(start) },
109
+ ...end !== void 0 && { paddingInlineEnd: px(end) }
110
+ }
112
111
  });
113
112
  }),
114
113
  endElement && /* @__PURE__ */ jsx(
package/dist/input.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,27 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
12
10
  var React__default = /*#__PURE__*/_interopDefault(React);
13
11
 
14
12
  // src/input.tsx
15
- function cn(...inputs) {
16
- return tailwindMerge.twMerge(clsx.clsx(inputs));
17
- }
18
- var INPUT_BASE = [
19
- "w-full appearance-none outline-none transition-colors",
20
- "bg-[var(--color-input-bg)] text-[var(--color-input-fg)] border-[var(--color-input-border)]",
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 INPUT_SIZE_CLASSES = {
30
- xs: "h-6 px-2 text-xs rounded",
31
- sm: "h-8 px-3 text-sm rounded-md",
32
- md: "h-10 px-4 text-base rounded-md",
33
- lg: "h-12 px-4 text-lg rounded-lg",
34
- "2xl": "h-14 px-4 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 INPUT_VARIANT_CLASSES = {
37
- outline: "border border-solid",
38
- filled: "border-0 bg-[var(--color-input-filled-bg,theme(colors.gray.100))]",
39
- unstyled: "border-0 bg-transparent p-0 h-auto"
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" }
40
34
  };
41
35
  var Input = React__default.default.forwardRef(
42
36
  ({ size = "md", variant = "outline", className, onChange, onChangeText, ...rest }, ref) => {
@@ -52,7 +46,10 @@ var Input = React__default.default.forwardRef(
52
46
  {
53
47
  ref,
54
48
  unstyled: true,
55
- className: cn(INPUT_BASE, INPUT_SIZE_CLASSES[size], INPUT_VARIANT_CLASSES[variant], className),
49
+ className: className ? `lux-control ${className}` : "lux-control",
50
+ ...CONTROL,
51
+ ...SIZE[size],
52
+ ...VARIANT[variant],
56
53
  ...rest,
57
54
  onChange: handleChange
58
55
  }
@@ -61,4 +58,7 @@ var Input = React__default.default.forwardRef(
61
58
  );
62
59
  Input.displayName = "Input";
63
60
 
61
+ exports.CONTROL = CONTROL;
64
62
  exports.Input = Input;
63
+ exports.SIZE = SIZE;
64
+ exports.VARIANT = VARIANT;
package/dist/input.d.cts CHANGED
@@ -12,6 +12,26 @@ interface InputProps extends Omit<React__default.ComponentPropsWithRef<'input'>,
12
12
  */
13
13
  readonly onChangeText?: (text: string) => void;
14
14
  }
15
+ declare const SIZE: Record<InputSize, Record<string, number>>;
16
+ declare const VARIANT: Record<InputVariant, Record<string, unknown>>;
17
+ /** The frame every text control shares. */
18
+ declare const CONTROL: {
19
+ readonly width: "100%";
20
+ readonly outlineWidth: 0;
21
+ readonly backgroundColor: "var(--color-input-bg)";
22
+ readonly color: "var(--color-input-fg)";
23
+ readonly borderColor: "var(--color-input-border)";
24
+ readonly hoverStyle: {
25
+ readonly borderColor: "var(--color-input-border-hover)";
26
+ };
27
+ readonly focusStyle: {
28
+ readonly borderColor: "var(--color-input-border-focus)";
29
+ };
30
+ readonly disabledStyle: {
31
+ readonly opacity: 0.4;
32
+ readonly cursor: "not-allowed";
33
+ };
34
+ };
15
35
  declare const Input: React__default.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React__default.RefAttributes<HTMLInputElement>>;
16
36
 
17
- export { Input, type InputProps };
37
+ export { CONTROL, Input, type InputProps, SIZE, VARIANT };
package/dist/input.d.ts CHANGED
@@ -12,6 +12,26 @@ interface InputProps extends Omit<React__default.ComponentPropsWithRef<'input'>,
12
12
  */
13
13
  readonly onChangeText?: (text: string) => void;
14
14
  }
15
+ declare const SIZE: Record<InputSize, Record<string, number>>;
16
+ declare const VARIANT: Record<InputVariant, Record<string, unknown>>;
17
+ /** The frame every text control shares. */
18
+ declare const CONTROL: {
19
+ readonly width: "100%";
20
+ readonly outlineWidth: 0;
21
+ readonly backgroundColor: "var(--color-input-bg)";
22
+ readonly color: "var(--color-input-fg)";
23
+ readonly borderColor: "var(--color-input-border)";
24
+ readonly hoverStyle: {
25
+ readonly borderColor: "var(--color-input-border-hover)";
26
+ };
27
+ readonly focusStyle: {
28
+ readonly borderColor: "var(--color-input-border-focus)";
29
+ };
30
+ readonly disabledStyle: {
31
+ readonly opacity: 0.4;
32
+ readonly cursor: "not-allowed";
33
+ };
34
+ };
15
35
  declare const Input: React__default.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React__default.RefAttributes<HTMLInputElement>>;
16
36
 
17
- export { Input, type InputProps };
37
+ export { CONTROL, Input, type InputProps, SIZE, VARIANT };
package/dist/input.js CHANGED
@@ -1,36 +1,30 @@
1
1
  "use client";
2
2
  import { Input as Input$1 } 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/input.tsx
9
- function cn(...inputs) {
10
- return twMerge(clsx(inputs));
11
- }
12
- var INPUT_BASE = [
13
- "w-full appearance-none outline-none transition-colors",
14
- "bg-[var(--color-input-bg)] text-[var(--color-input-fg)] border-[var(--color-input-border)]",
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 INPUT_SIZE_CLASSES = {
24
- xs: "h-6 px-2 text-xs rounded",
25
- sm: "h-8 px-3 text-sm rounded-md",
26
- md: "h-10 px-4 text-base rounded-md",
27
- lg: "h-12 px-4 text-lg rounded-lg",
28
- "2xl": "h-14 px-4 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 INPUT_VARIANT_CLASSES = {
31
- outline: "border border-solid",
32
- filled: "border-0 bg-[var(--color-input-filled-bg,theme(colors.gray.100))]",
33
- unstyled: "border-0 bg-transparent p-0 h-auto"
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" }
34
28
  };
35
29
  var Input = React.forwardRef(
36
30
  ({ size = "md", variant = "outline", className, onChange, onChangeText, ...rest }, ref) => {
@@ -46,7 +40,10 @@ var Input = React.forwardRef(
46
40
  {
47
41
  ref,
48
42
  unstyled: true,
49
- className: cn(INPUT_BASE, INPUT_SIZE_CLASSES[size], INPUT_VARIANT_CLASSES[variant], className),
43
+ className: className ? `lux-control ${className}` : "lux-control",
44
+ ...CONTROL,
45
+ ...SIZE[size],
46
+ ...VARIANT[variant],
50
47
  ...rest,
51
48
  onChange: handleChange
52
49
  }
@@ -55,4 +52,4 @@ var Input = React.forwardRef(
55
52
  );
56
53
  Input.displayName = "Input";
57
54
 
58
- export { Input };
55
+ export { CONTROL, Input, SIZE, VARIANT };