@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
package/dist/tabs.js CHANGED
@@ -1,213 +1,126 @@
1
1
  "use client";
2
- import * as RadixTabs from '@radix-ui/react-tabs';
2
+ import { Tabs, useTabsContext, Text } from '@hanzo/gui';
3
3
  import * as React from 'react';
4
- import { clsx } from 'clsx';
5
- import { twMerge } from 'tailwind-merge';
4
+ import { Children, createElement } from 'react';
6
5
  import { jsx } from 'react/jsx-runtime';
7
6
 
8
7
  // src/tabs.tsx
9
- function cn(...inputs) {
10
- return twMerge(clsx(inputs));
11
- }
12
- var ROOT_SIZE_CLASSES = {
13
- sm: "[--tabs-height:2rem] [--tabs-content-padding:1.5rem]",
14
- md: "[--tabs-height:2.5rem] [--tabs-content-padding:1.5rem]",
15
- free: ""
8
+ var ink = (children, Wrap = Text, props = {}) => {
9
+ let hasText = false;
10
+ Children.forEach(children, (child) => {
11
+ if (typeof child === "string" || typeof child === "number") hasText = true;
12
+ });
13
+ if (!hasText) return children;
14
+ return Children.map(children, (child) => typeof child === "string" || typeof child === "number" ? createElement(Wrap, props, child) : child);
16
15
  };
17
- var TabsRoot = React.forwardRef(
18
- function TabsRoot2(props, ref) {
19
- const {
20
- variant = "solid",
21
- size = "md",
22
- fitted,
23
- lazyMount: _lazyMount,
24
- unmountOnExit: _unmountOnExit,
25
- onValueChange,
26
- className,
27
- ...rest
28
- } = props;
29
- const handleValueChange = React.useCallback(
30
- (value) => {
31
- if (!onValueChange) return;
32
- onValueChange({ value });
33
- },
34
- [onValueChange]
35
- );
36
- return /* @__PURE__ */ jsx(
37
- RadixTabs.Root,
38
- {
39
- ref,
40
- "data-variant": variant,
41
- "data-size": size,
42
- "data-fitted": fitted ? "" : void 0,
43
- className: cn(
44
- "relative",
45
- ROOT_SIZE_CLASSES[size],
46
- className
47
- ),
48
- onValueChange: onValueChange ? handleValueChange : void 0,
49
- ...rest
50
- }
51
- );
52
- }
53
- );
54
- var TabsList = React.forwardRef(
55
- function TabsList2(props, ref) {
56
- const {
57
- className,
58
- // Strip Chakra style props
59
- flexWrap: _flexWrap,
60
- alignItems: _alignItems,
61
- whiteSpace: _whiteSpace,
62
- bgColor: _bgColor,
63
- marginBottom: _marginBottom,
64
- mx: _mx,
65
- px: _px,
66
- w: _w,
67
- overflowX: _overflowX,
68
- overscrollBehaviorX: _overscrollBehaviorX,
69
- css: _css,
70
- position: _position,
71
- boxShadow: _boxShadow,
72
- top: _top,
73
- zIndex: _zIndex,
74
- style: styleProp,
75
- asChild,
76
- loop,
77
- ...rest
78
- } = props;
79
- return /* @__PURE__ */ jsx(
80
- RadixTabs.List,
81
- {
82
- ref,
83
- asChild,
84
- loop,
85
- className: cn(
86
- "inline-flex w-full relative isolate flex-row",
87
- "min-h-[var(--tabs-height,2.5rem)]",
88
- className
89
- ),
90
- style: styleProp,
91
- ...rest
92
- }
93
- );
94
- }
95
- );
96
- var TRIGGER_BASE = "outline-none min-w-[var(--tabs-height,2.5rem)] h-[var(--tabs-height,2.5rem)] flex items-center relative cursor-pointer gap-2 focus-visible:z-[1] focus-visible:outline-2 focus-visible:outline-offset-0 disabled:cursor-not-allowed disabled:opacity-50";
97
- var TRIGGER_SIZE_CLASSES = {
98
- sm: "py-1 px-3 text-sm",
99
- md: "py-2 px-4 text-base",
100
- free: ""
16
+ var Shape = React.createContext({
17
+ variant: "solid",
18
+ size: "md",
19
+ fitted: false
20
+ });
21
+ var SIZE = {
22
+ sm: { height: 32, minWidth: 32, paddingVertical: 4, paddingHorizontal: 12, fontSize: 14 },
23
+ md: { height: 40, minWidth: 40, paddingVertical: 8, paddingHorizontal: 16, fontSize: 16 },
24
+ free: {}
101
25
  };
102
- var TRIGGER_VARIANT_CLASSES = {
103
- solid: "font-semibold gap-1 rounded-md bg-transparent text-tabs-solid-fg data-[state=active]:bg-selected-control-bg data-[state=active]:text-selected-control-text data-[state=active]:hover:text-selected-control-text hover:text-hover",
104
- secondary: "font-medium bg-transparent text-tabs-secondary-fg border-2 border-solid border-tabs-secondary-border rounded-md data-[state=active]:bg-selected-control-bg data-[state=active]:text-selected-control-text data-[state=active]:border-transparent data-[state=active]:hover:border-transparent hover:text-hover hover:border-hover",
105
- segmented: "bg-transparent text-text-primary border-2 border-solid border-selected-control-bg hover:text-hover data-[state=active]:text-selected-control-text data-[state=active]:bg-selected-control-bg data-[state=active]:border-selected-control-bg data-[state=active]:hover:text-selected-control-text",
106
- unstyled: ""
26
+ var SELECTED_BG = "var(--color-selected-control-bg)";
27
+ var SELECTED_FG = "var(--color-selected-control-text)";
28
+ var VARIANT = {
29
+ solid: {
30
+ rest: {
31
+ fontWeight: "600",
32
+ borderRadius: 6,
33
+ color: "var(--color-tabs-solid-fg)",
34
+ hoverStyle: { color: "var(--color-hover)" }
35
+ },
36
+ active: { backgroundColor: SELECTED_BG, color: SELECTED_FG }
37
+ },
38
+ secondary: {
39
+ rest: {
40
+ fontWeight: "500",
41
+ borderRadius: 6,
42
+ borderWidth: 2,
43
+ borderColor: "var(--color-tabs-secondary-border)",
44
+ color: "var(--color-tabs-secondary-fg)",
45
+ hoverStyle: { color: "var(--color-hover)", borderColor: "var(--color-hover)" }
46
+ },
47
+ active: { backgroundColor: SELECTED_BG, color: SELECTED_FG, borderColor: "transparent" }
48
+ },
49
+ segmented: {
50
+ rest: {
51
+ borderWidth: 2,
52
+ borderColor: SELECTED_BG,
53
+ color: "var(--color-text-primary)",
54
+ hoverStyle: { color: "var(--color-hover)" }
55
+ },
56
+ active: { backgroundColor: SELECTED_BG, borderColor: SELECTED_BG, color: SELECTED_FG }
57
+ },
58
+ unstyled: { rest: {}, active: {} }
107
59
  };
108
- var TabsTrigger = React.forwardRef(
109
- function TabsTrigger2(props, ref) {
110
- const {
111
- className,
112
- // Strip Chakra style props
113
- scrollSnapAlign: _scrollSnapAlign,
114
- flexShrink: _flexShrink,
115
- bgColor: _bgColor,
116
- w: _w,
117
- py: _py,
118
- borderRadius: _borderRadius,
119
- fontWeight: _fontWeight,
120
- color: _color,
121
- _hover,
122
- position: _position,
123
- top: _top,
124
- left: _left,
125
- visibility: _visibility,
60
+ var LIST_HEIGHT = { sm: 32, md: 40, free: void 0 };
61
+ var TabsRoot = ({
62
+ variant = "solid",
63
+ size = "md",
64
+ fitted = false,
65
+ onValueChange,
66
+ ...rest
67
+ }) => {
68
+ const shape = React.useMemo(() => ({ variant, size, fitted }), [variant, size, fitted]);
69
+ return /* @__PURE__ */ jsx(Shape.Provider, { value: shape, children: /* @__PURE__ */ jsx(
70
+ Tabs,
71
+ {
72
+ unstyled: true,
73
+ position: "relative",
74
+ orientation: "horizontal",
75
+ onValueChange: onValueChange ? (value) => onValueChange({ value }) : void 0,
126
76
  ...rest
127
- } = props;
128
- const internalRef = React.useRef(null);
129
- const mergedRef = useMergedRef(ref, internalRef);
130
- const { variant, size, fitted } = useTabsContext(internalRef);
131
- return /* @__PURE__ */ jsx(
132
- RadixTabs.Trigger,
133
- {
134
- ref: mergedRef,
135
- className: cn(
136
- "group",
137
- TRIGGER_BASE,
138
- TRIGGER_SIZE_CLASSES[size],
139
- TRIGGER_VARIANT_CLASSES[variant],
140
- fitted && "flex-1 text-center justify-center",
141
- className
142
- ),
143
- ...rest
144
- }
145
- );
146
- }
147
- );
148
- var TabsContent = React.forwardRef(
149
- function TabsContent2(props, ref) {
150
- const { className, padding: _padding, ...rest } = props;
151
- return /* @__PURE__ */ jsx(
152
- RadixTabs.Content,
153
- {
154
- ref,
155
- className: cn(
156
- "w-full pt-[var(--tabs-content-padding,1.5rem)]",
157
- "focus-visible:outline-2 focus-visible:outline-offset-[-2px]",
158
- className
159
- ),
160
- ...rest
161
- }
162
- );
163
- }
164
- );
165
- var COUNTER_OVERLOAD = 50;
166
- var TabsCounter = ({ count }) => {
167
- if (count === void 0 || count === null) {
168
- return null;
169
- }
77
+ }
78
+ ) });
79
+ };
80
+ var TabsList = (props) => {
81
+ const { size } = React.useContext(Shape);
170
82
  return /* @__PURE__ */ jsx(
171
- "span",
83
+ Tabs.List,
172
84
  {
173
- className: cn(
174
- "group-hover:text-inherit",
175
- count > 0 ? "text-text-secondary" : "text-[rgba(16,17,18,0.24)] dark:text-[rgba(255,255,255,0.24)]"
176
- ),
177
- children: count > COUNTER_OVERLOAD ? `${COUNTER_OVERLOAD}+` : count
85
+ unstyled: true,
86
+ width: "100%",
87
+ position: "relative",
88
+ flexDirection: "row",
89
+ backgroundColor: "transparent",
90
+ minHeight: LIST_HEIGHT[size],
91
+ ...props
178
92
  }
179
93
  );
180
94
  };
181
- function useTabsContext(triggerRef) {
182
- const [ctx, setCtx] = React.useState({ variant: "solid", size: "md", fitted: false });
183
- React.useEffect(() => {
184
- const el = triggerRef.current;
185
- if (!el) return;
186
- const root = el.closest("[data-variant]");
187
- if (!root) return;
188
- setCtx({
189
- variant: root.getAttribute("data-variant") ?? "solid",
190
- size: root.getAttribute("data-size") ?? "md",
191
- fitted: root.hasAttribute("data-fitted")
192
- });
193
- }, [triggerRef]);
194
- return ctx;
195
- }
196
- function useMergedRef(...refs) {
197
- return React.useCallback(
198
- (instance) => {
199
- for (const ref of refs) {
200
- if (!ref) continue;
201
- if (typeof ref === "function") {
202
- ref(instance);
203
- } else {
204
- ref.current = instance;
205
- }
206
- }
207
- },
208
- // eslint-disable-next-line react-hooks/exhaustive-deps
209
- refs
95
+ var TabsTrigger = ({ children, ...props }) => {
96
+ const { variant, size, fitted } = React.useContext(Shape);
97
+ const { rest, active } = VARIANT[variant];
98
+ const selected = useTabsContext().value === props.value;
99
+ return /* @__PURE__ */ jsx(
100
+ Tabs.Tab,
101
+ {
102
+ unstyled: true,
103
+ flexDirection: "row",
104
+ alignItems: "center",
105
+ justifyContent: "center",
106
+ position: "relative",
107
+ cursor: "pointer",
108
+ gap: 8,
109
+ borderWidth: 0,
110
+ ...SIZE[size],
111
+ ...rest,
112
+ ...selected ? active : null,
113
+ ...fitted ? { flex: 1 } : null,
114
+ ...props,
115
+ children: ink(children, void 0, { fontSize: "inherit", color: "inherit", fontWeight: "inherit" })
116
+ }
210
117
  );
211
- }
118
+ };
119
+ var TabsContent = ({ children, ...props }) => /* @__PURE__ */ jsx(Tabs.Content, { unstyled: true, width: "100%", paddingTop: 24, backgroundColor: "transparent", ...props, children: ink(children) });
120
+ var COUNTER_OVERLOAD = 50;
121
+ var TabsCounter = ({ count }) => {
122
+ if (count === void 0 || count === null) return null;
123
+ return /* @__PURE__ */ jsx(Text, { color: count > 0 ? "var(--color-text-secondary)" : "var(--color-text-disabled)", children: count > COUNTER_OVERLOAD ? `${COUNTER_OVERLOAD}+` : count });
124
+ };
212
125
 
213
126
  export { TabsContent, TabsCounter, TabsList, TabsRoot, TabsTrigger };
package/dist/tag.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 React4 = 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
  var usehooks = require('@uidotdev/usehooks');
10
10
 
11
11
  function _interopNamespace(e) {
@@ -29,9 +29,6 @@ function _interopNamespace(e) {
29
29
  var React4__namespace = /*#__PURE__*/_interopNamespace(React4);
30
30
 
31
31
  // src/tag.tsx
32
- function cn(...inputs) {
33
- return tailwindMerge.twMerge(clsx.clsx(inputs));
34
- }
35
32
  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";
36
33
  var CloseButtonFrame = gui.styled(gui.View, {
37
34
  name: "LuxCloseButton",
@@ -62,23 +59,19 @@ var CloseButtonFrame = gui.styled(gui.View, {
62
59
  }
63
60
  }
64
61
  });
65
- var CLOSE_BUTTON_CLASSES = [
66
- "text-[var(--closeButton-fg,currentColor)]",
67
- "hover:text-[var(--hover-color,currentColor)]",
68
- "disabled:opacity-40"
69
- ].join(" ");
70
62
  var CloseButton = React4__namespace.forwardRef(function CloseButton2(props, ref) {
71
63
  const { variant: _variant, size: _size, className, children, ...rest } = props;
72
64
  return /* @__PURE__ */ jsxRuntime.jsx(
73
65
  CloseButtonFrame,
74
66
  {
75
67
  ref,
76
- className: [CLOSE_BUTTON_CLASSES, className].filter(Boolean).join(" "),
68
+ className,
77
69
  ...rest,
78
70
  children: children ?? /* @__PURE__ */ jsxRuntime.jsx(
79
71
  "svg",
80
72
  {
81
- className: "size-5",
73
+ width: 20,
74
+ height: 20,
82
75
  viewBox: "0 0 20 20",
83
76
  fill: "none",
84
77
  "aria-hidden": "true",
@@ -94,6 +87,9 @@ var CloseButton = React4__namespace.forwardRef(function CloseButton2(props, ref)
94
87
  }
95
88
  );
96
89
  });
90
+ function cn(...inputs) {
91
+ return tailwindMerge.twMerge(clsx.clsx(inputs));
92
+ }
97
93
  var SHIM_PROPS = [
98
94
  "w",
99
95
  "h",
@@ -277,6 +273,14 @@ React4__namespace.forwardRef(
277
273
  )) });
278
274
  }
279
275
  );
276
+ var ink = (children, Wrap = gui.Text, props = {}) => {
277
+ let hasText = false;
278
+ React4.Children.forEach(children, (child) => {
279
+ if (typeof child === "string" || typeof child === "number") hasText = true;
280
+ });
281
+ if (!hasText) return children;
282
+ return React4.Children.map(children, (child) => typeof child === "string" || typeof child === "number" ? React4.createElement(Wrap, props, child) : child);
283
+ };
280
284
  var TOUCH_PX = 1024;
281
285
  function useBelow(px) {
282
286
  const [below, setBelow] = React4__namespace.useState(false);
@@ -381,14 +385,21 @@ var Tooltip = React4__namespace.forwardRef(
381
385
  {
382
386
  ref,
383
387
  unstyled: true,
384
- className: cn(
385
- "z-[9999] overflow-hidden rounded-lg px-3 py-2 text-sm",
386
- "animate-in fade-in-0 zoom-in-95",
387
- isPopover && "bg-[var(--color-popover-bg)] text-[var(--color-text-primary)]",
388
- isPopover && "shadow-[var(--shadow-popover)] border border-[var(--color-border-divider)] max-w-sm",
389
- !isPopover && "bg-[var(--color-tooltip-bg)] text-[var(--color-tooltip-fg)] max-w-xs",
390
- contentProps?.className
391
- ),
388
+ zIndex: 9999,
389
+ overflow: "hidden",
390
+ borderRadius: 8,
391
+ paddingHorizontal: 12,
392
+ paddingVertical: 8,
393
+ maxWidth: isPopover ? 384 : 320,
394
+ backgroundColor: isPopover ? "var(--color-popover-bg)" : "var(--color-tooltip-bg)",
395
+ transition: "quick",
396
+ enterStyle: { opacity: 0, scale: 0.95 },
397
+ exitStyle: { opacity: 0, scale: 0.95 },
398
+ ...isPopover ? {
399
+ borderWidth: 1,
400
+ borderColor: "var(--color-border-divider)",
401
+ shadowColor: "var(--shadow-popover)"
402
+ } : {},
392
403
  onClick: interactive ? handleContentClick : void 0,
393
404
  ...selected ? { "data-selected": true } : {},
394
405
  ...contentProps,
@@ -397,12 +408,13 @@ var Tooltip = React4__namespace.forwardRef(
397
408
  gui.Tooltip.Arrow,
398
409
  {
399
410
  unstyled: true,
400
- className: cn(
401
- isPopover ? "fill-[var(--color-popover-bg)]" : "fill-[var(--color-tooltip-bg)]"
402
- )
411
+ backgroundColor: isPopover ? "var(--color-popover-bg)" : "var(--color-tooltip-bg)"
403
412
  }
404
413
  ),
405
- content
414
+ ink(content, void 0, {
415
+ fontSize: 14,
416
+ color: isPopover ? "var(--color-text-primary)" : "var(--color-tooltip-fg)"
417
+ })
406
418
  ]
407
419
  }
408
420
  )
@@ -415,25 +427,24 @@ var nbsp = String.fromCharCode(160);
415
427
  function TruncatedTextTooltip({ label, children }) {
416
428
  return /* @__PURE__ */ jsxRuntime.jsx(Tooltip, { content: label, positioning: { placement: "top" }, children });
417
429
  }
418
- var TAG_BASE = "inline-flex items-center align-top max-w-full select-text rounded-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-500";
419
- var TAG_VARIANT_CLASSES = {
420
- subtle: "bg-[var(--color-tag-subtle-bg)] text-[var(--color-tag-subtle-fg)]",
421
- clickable: "cursor-pointer bg-[var(--color-tag-clickable-bg)] text-[var(--color-tag-clickable-fg)] hover:opacity-76",
422
- filter: "bg-[var(--color-tag-filter-bg)]",
423
- select: "cursor-pointer bg-[var(--color-tag-select-bg)] text-[var(--color-tag-select-fg)] hover:text-[var(--color-hover)] hover:opacity-76"
430
+ var TAG_VARIANT = {
431
+ subtle: { backgroundColor: "var(--color-tag-subtle-bg)" },
432
+ clickable: { backgroundColor: "var(--color-tag-clickable-bg)", cursor: "pointer", hoverStyle: { opacity: 0.76 } },
433
+ filter: { backgroundColor: "var(--color-tag-filter-bg)" },
434
+ select: { backgroundColor: "var(--color-tag-select-bg)", cursor: "pointer", hoverStyle: { opacity: 0.76 } }
435
+ };
436
+ var TAG_VARIANT_FG = {
437
+ subtle: "var(--color-tag-subtle-fg)",
438
+ clickable: "var(--color-tag-clickable-fg)",
439
+ filter: void 0,
440
+ select: "var(--color-tag-select-fg)"
424
441
  };
425
- var TAG_SIZE_CLASSES = {
426
- sm: "px-1 py-0.5 min-h-5 gap-1 text-xs",
427
- md: "px-1 py-0.5 min-h-6 gap-1 text-sm",
428
- lg: "px-1.5 py-1.5 min-h-8 min-w-8 gap-1 text-sm"
442
+ var TAG_SIZE = {
443
+ sm: { paddingHorizontal: 4, paddingVertical: 2, minHeight: 20, gap: 4 },
444
+ md: { paddingHorizontal: 4, paddingVertical: 2, minHeight: 24, gap: 4 },
445
+ lg: { paddingHorizontal: 6, paddingVertical: 6, minHeight: 32, minWidth: 32, gap: 4 }
429
446
  };
430
- var TAG_SELECTED_CLASSES = [
431
- "bg-[var(--color-tag-select-selected-bg)]",
432
- "text-[var(--color-tag-select-selected-fg)]",
433
- "hover:text-[var(--color-tag-select-selected-fg)]",
434
- "hover:opacity-76"
435
- ].join(" ");
436
- var TAG_DISABLED_CLASSES = "opacity-40 pointer-events-none cursor-not-allowed";
447
+ var TAG_SIZE_FONT = { sm: 12, md: 14, lg: 14 };
437
448
  var Tag = React4__namespace.forwardRef(
438
449
  function Tag2(props, ref) {
439
450
  const {
@@ -453,46 +464,78 @@ var Tag = React4__namespace.forwardRef(
453
464
  className,
454
465
  ...rest
455
466
  } = props;
456
- const labelElement = label ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-[var(--color-text-secondary)]", children: [
467
+ const resolvedVariant = variant ?? "subtle";
468
+ const resolvedSize = size ?? "md";
469
+ const isSelected = Boolean(selected) && !loading;
470
+ const backgroundColor = isSelected ? "var(--color-tag-select-selected-bg)" : TAG_VARIANT[resolvedVariant].backgroundColor;
471
+ const color = isSelected ? "var(--color-tag-select-selected-fg)" : TAG_VARIANT_FG[resolvedVariant];
472
+ const hoverStyle = isSelected ? { opacity: 0.76 } : TAG_VARIANT[resolvedVariant].hoverStyle;
473
+ const textHoverColor = !isSelected && resolvedVariant === "select" ? "var(--color-hover)" : void 0;
474
+ const labelElement = label ? /* @__PURE__ */ jsxRuntime.jsxs(gui.Text, { fontSize: TAG_SIZE_FONT[resolvedSize], fontWeight: "500", color: "var(--color-text-secondary)", children: [
457
475
  label,
458
476
  ":",
459
477
  nbsp
460
478
  ] }) : null;
461
- const labelSpan = /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "line-clamp-1 whitespace-nowrap text-ellipsis font-medium inline", children: [
462
- labelElement,
463
- children
464
- ] });
479
+ const labelSpan = /* @__PURE__ */ jsxRuntime.jsxs(
480
+ gui.Text,
481
+ {
482
+ overflow: "hidden",
483
+ textOverflow: "ellipsis",
484
+ whiteSpace: "nowrap",
485
+ fontWeight: "500",
486
+ fontSize: TAG_SIZE_FONT[resolvedSize],
487
+ color,
488
+ hoverStyle: textHoverColor ? { color: textHoverColor } : void 0,
489
+ children: [
490
+ labelElement,
491
+ children
492
+ ]
493
+ }
494
+ );
465
495
  const contentElement = truncated ? /* @__PURE__ */ jsxRuntime.jsx(TruncatedTextTooltip, { label: children, children: labelSpan }) : labelSpan;
466
496
  return /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { loading, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
467
- "span",
497
+ gui.XStack,
468
498
  {
469
499
  ref,
470
- className: cn(
471
- TAG_BASE,
472
- TAG_VARIANT_CLASSES[variant ?? "subtle"],
473
- TAG_SIZE_CLASSES[size ?? "md"],
474
- selected && !loading && TAG_SELECTED_CLASSES,
475
- disabled && TAG_DISABLED_CLASSES,
476
- className
477
- ),
478
- ...selected && !loading && { "data-selected": true },
500
+ render: /* @__PURE__ */ jsxRuntime.jsx("span", {}),
501
+ display: "inline-flex",
502
+ alignItems: "center",
503
+ verticalAlign: "top",
504
+ maxWidth: "100%",
505
+ userSelect: "text",
506
+ ...TAG_SIZE[resolvedSize],
507
+ backgroundColor,
508
+ hoverStyle,
509
+ focusVisibleStyle: {
510
+ outlineWidth: 2,
511
+ outlineOffset: 2,
512
+ outlineColor: "var(--color-gray-500)",
513
+ outlineStyle: "solid"
514
+ },
515
+ cursor: disabled ? "not-allowed" : TAG_VARIANT[resolvedVariant].cursor,
516
+ ...disabled ? { opacity: 0.4, pointerEvents: "none" } : {},
517
+ ...isSelected && { "data-selected": true },
479
518
  ...disabled && { "data-disabled": true },
519
+ className,
480
520
  ...rest,
481
521
  children: [
482
- startElement && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 inline-flex items-center justify-center empty:hidden", children: startElement }),
522
+ startElement && /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { flexShrink: 0, alignItems: "center", justifyContent: "center", children: startElement }),
483
523
  contentElement,
484
- endElement && /* @__PURE__ */ jsxRuntime.jsx(
485
- "span",
486
- {
487
- ...endElementProps,
488
- className: cn(
489
- "shrink-0 inline-flex items-center justify-center",
490
- endElementProps?.className
491
- ),
492
- children: endElement
493
- }
494
- ),
495
- closable && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 inline-flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { onClick: onClose }) })
524
+ endElement && (() => {
525
+ const { className: endClassName, ...endElementRest } = endElementProps ?? {};
526
+ return /* @__PURE__ */ jsxRuntime.jsx(
527
+ gui.XStack,
528
+ {
529
+ ...endElementRest,
530
+ flexShrink: 0,
531
+ alignItems: "center",
532
+ justifyContent: "center",
533
+ className: endClassName,
534
+ children: endElement
535
+ }
536
+ );
537
+ })(),
538
+ closable && /* @__PURE__ */ jsxRuntime.jsx(gui.XStack, { flexShrink: 0, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { onClick: onClose }) })
496
539
  ]
497
540
  }
498
541
  ) });