@luxfi/ui 7.0.0 → 7.1.0

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 (60) hide show
  1. package/dist/alert.cjs +162 -285
  2. package/dist/alert.js +162 -285
  3. package/dist/badge.cjs +162 -321
  4. package/dist/badge.d.cts +3 -7
  5. package/dist/badge.d.ts +3 -7
  6. package/dist/badge.js +162 -320
  7. package/dist/button.cjs +373 -484
  8. package/dist/button.d.cts +10 -7
  9. package/dist/button.d.ts +10 -7
  10. package/dist/button.js +373 -484
  11. package/dist/close-button.cjs +37 -18
  12. package/dist/close-button.d.cts +1 -1
  13. package/dist/close-button.d.ts +1 -1
  14. package/dist/close-button.js +37 -18
  15. package/dist/collapsible.cjs +125 -272
  16. package/dist/collapsible.js +125 -272
  17. package/dist/dialog.cjs +60 -44
  18. package/dist/dialog.d.cts +7 -8
  19. package/dist/dialog.d.ts +7 -8
  20. package/dist/dialog.js +60 -43
  21. package/dist/drawer.cjs +37 -13
  22. package/dist/drawer.js +37 -13
  23. package/dist/heading.cjs +3 -8
  24. package/dist/heading.js +3 -8
  25. package/dist/icon-button.cjs +213 -337
  26. package/dist/icon-button.d.cts +4 -4
  27. package/dist/icon-button.d.ts +4 -4
  28. package/dist/icon-button.js +213 -338
  29. package/dist/image.cjs +125 -272
  30. package/dist/image.js +125 -272
  31. package/dist/index.cjs +604 -700
  32. package/dist/index.d.cts +0 -3
  33. package/dist/index.d.ts +0 -3
  34. package/dist/index.js +604 -698
  35. package/dist/link.cjs +125 -272
  36. package/dist/link.js +125 -272
  37. package/dist/popover.cjs +55 -40
  38. package/dist/popover.js +55 -39
  39. package/dist/select.cjs +125 -272
  40. package/dist/select.js +125 -272
  41. package/dist/skeleton.cjs +125 -272
  42. package/dist/skeleton.js +125 -272
  43. package/dist/table.cjs +127 -274
  44. package/dist/table.js +127 -274
  45. package/dist/tag.cjs +184 -306
  46. package/dist/tag.js +184 -305
  47. package/dist/tooltip.cjs +22 -21
  48. package/dist/tooltip.d.cts +2 -3
  49. package/dist/tooltip.d.ts +2 -3
  50. package/dist/tooltip.js +22 -20
  51. package/package.json +9 -7
  52. package/src/badge.tsx +20 -31
  53. package/src/button.tsx +304 -238
  54. package/src/close-button.tsx +48 -22
  55. package/src/dialog.tsx +37 -47
  56. package/src/heading.tsx +8 -19
  57. package/src/icon-button.tsx +129 -104
  58. package/src/popover.tsx +30 -44
  59. package/src/skeleton.tsx +96 -144
  60. package/src/tooltip.tsx +54 -47
package/dist/tooltip.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var RadixTooltip = require('@radix-ui/react-tooltip');
4
+ var tooltip = require('@hanzogui/tooltip');
5
5
  var usehooks = require('@uidotdev/usehooks');
6
6
  var React = require('react');
7
7
  var clsx = require('clsx');
@@ -26,7 +26,6 @@ function _interopNamespace(e) {
26
26
  return Object.freeze(n);
27
27
  }
28
28
 
29
- var RadixTooltip__namespace = /*#__PURE__*/_interopNamespace(RadixTooltip);
30
29
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
31
30
 
32
31
  // src/tooltip.tsx
@@ -48,6 +47,10 @@ function useIsMobile() {
48
47
  }, []);
49
48
  return isMobile;
50
49
  }
50
+ function mapPlacement(p) {
51
+ if (!p) return void 0;
52
+ return p;
53
+ }
51
54
  var Tooltip = React__namespace.forwardRef(
52
55
  function Tooltip2(props, ref) {
53
56
  const {
@@ -58,10 +61,8 @@ var Tooltip = React__namespace.forwardRef(
58
61
  children,
59
62
  disabled,
60
63
  disableOnMobile,
61
- portalled = true,
62
64
  content,
63
65
  contentProps,
64
- portalRef,
65
66
  defaultOpen = false,
66
67
  triggerProps,
67
68
  closeDelay = 100,
@@ -109,36 +110,34 @@ var Tooltip = React__namespace.forwardRef(
109
110
  if (disabled || disableOnMobile && isMobile) return children;
110
111
  const defaultShowArrow = variant === "popover" ? false : true;
111
112
  const showArrow = showArrowProp !== void 0 ? showArrowProp : defaultShowArrow;
112
- const placement = positioning?.placement ?? "top";
113
- const side = placement.split("-")[0];
114
- const align = placement.includes("-") ? placement.split("-")[1] : void 0;
115
- const sideOffset = positioning?.offset?.mainAxis ?? 4;
116
113
  const isPopover = variant === "popover";
117
- return /* @__PURE__ */ jsxRuntime.jsx(RadixTooltip__namespace.Provider, { delayDuration: openDelay, skipDelayDuration: 0, children: /* @__PURE__ */ jsxRuntime.jsxs(
118
- RadixTooltip__namespace.Root,
114
+ const placement = mapPlacement(positioning?.placement) ?? "top";
115
+ const offset = positioning?.offset?.mainAxis ?? 4;
116
+ return /* @__PURE__ */ jsxRuntime.jsx(tooltip.TooltipGroup, { delay: openDelay, children: /* @__PURE__ */ jsxRuntime.jsxs(
117
+ tooltip.Tooltip,
119
118
  {
120
119
  open,
121
120
  onOpenChange: handleOpenChange,
122
- delayDuration: openDelay,
121
+ delay: { open: openDelay, close: closeDelay },
122
+ placement,
123
+ offset,
124
+ unstyled: true,
123
125
  children: [
124
126
  /* @__PURE__ */ jsxRuntime.jsx(
125
- RadixTooltip__namespace.Trigger,
127
+ tooltip.Tooltip.Trigger,
126
128
  {
127
129
  ref: open ? triggerRef : void 0,
128
130
  asChild: true,
129
- onClick: isMobile ? handleTriggerClick : void 0,
131
+ ...isMobile ? { onPress: handleTriggerClick } : {},
130
132
  ...triggerProps,
131
133
  children
132
134
  }
133
135
  ),
134
- /* @__PURE__ */ jsxRuntime.jsx(RadixTooltip__namespace.Portal, { container: portalled ? portalRef?.current ?? void 0 : void 0, children: /* @__PURE__ */ jsxRuntime.jsxs(
135
- RadixTooltip__namespace.Content,
136
+ /* @__PURE__ */ jsxRuntime.jsxs(
137
+ tooltip.Tooltip.Content,
136
138
  {
137
139
  ref,
138
- side,
139
- align,
140
- sideOffset,
141
- onClick: interactive ? handleContentClick : void 0,
140
+ unstyled: true,
142
141
  className: cn(
143
142
  "z-[9999] overflow-hidden rounded-lg px-3 py-2 text-sm",
144
143
  "animate-in fade-in-0 zoom-in-95",
@@ -147,12 +146,14 @@ var Tooltip = React__namespace.forwardRef(
147
146
  !isPopover && "bg-[var(--color-tooltip-bg)] text-[var(--color-tooltip-fg)] max-w-xs",
148
147
  contentProps?.className
149
148
  ),
149
+ onClick: interactive ? handleContentClick : void 0,
150
150
  ...selected ? { "data-selected": true } : {},
151
151
  ...contentProps,
152
152
  children: [
153
153
  showArrow && /* @__PURE__ */ jsxRuntime.jsx(
154
- RadixTooltip__namespace.Arrow,
154
+ tooltip.Tooltip.Arrow,
155
155
  {
156
+ unstyled: true,
156
157
  className: cn(
157
158
  isPopover ? "fill-[var(--color-popover-bg)]" : "fill-[var(--color-tooltip-bg)]"
158
159
  )
@@ -161,7 +162,7 @@ var Tooltip = React__namespace.forwardRef(
161
162
  content
162
163
  ]
163
164
  }
164
- ) })
165
+ )
165
166
  ]
166
167
  }
167
168
  ) });
@@ -1,4 +1,3 @@
1
- import * as RadixTooltip from '@radix-ui/react-tooltip';
2
1
  import * as React from 'react';
3
2
 
4
3
  interface TooltipProps {
@@ -7,8 +6,8 @@ interface TooltipProps {
7
6
  portalled?: boolean;
8
7
  portalRef?: React.RefObject<HTMLElement>;
9
8
  content: React.ReactNode;
10
- contentProps?: React.ComponentPropsWithoutRef<typeof RadixTooltip.Content>;
11
- triggerProps?: React.ComponentPropsWithoutRef<typeof RadixTooltip.Trigger>;
9
+ contentProps?: React.HTMLAttributes<HTMLDivElement>;
10
+ triggerProps?: React.HTMLAttributes<HTMLButtonElement>;
12
11
  disabled?: boolean;
13
12
  disableOnMobile?: boolean;
14
13
  children?: React.ReactNode;
package/dist/tooltip.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import * as RadixTooltip from '@radix-ui/react-tooltip';
2
1
  import * as React from 'react';
3
2
 
4
3
  interface TooltipProps {
@@ -7,8 +6,8 @@ interface TooltipProps {
7
6
  portalled?: boolean;
8
7
  portalRef?: React.RefObject<HTMLElement>;
9
8
  content: React.ReactNode;
10
- contentProps?: React.ComponentPropsWithoutRef<typeof RadixTooltip.Content>;
11
- triggerProps?: React.ComponentPropsWithoutRef<typeof RadixTooltip.Trigger>;
9
+ contentProps?: React.HTMLAttributes<HTMLDivElement>;
10
+ triggerProps?: React.HTMLAttributes<HTMLButtonElement>;
12
11
  disabled?: boolean;
13
12
  disableOnMobile?: boolean;
14
13
  children?: React.ReactNode;
package/dist/tooltip.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import * as RadixTooltip from '@radix-ui/react-tooltip';
2
+ import { TooltipGroup, Tooltip as Tooltip$1 } from '@hanzogui/tooltip';
3
3
  import { useClickAway } from '@uidotdev/usehooks';
4
4
  import * as React from 'react';
5
5
  import { clsx } from 'clsx';
@@ -25,6 +25,10 @@ function useIsMobile() {
25
25
  }, []);
26
26
  return isMobile;
27
27
  }
28
+ function mapPlacement(p) {
29
+ if (!p) return void 0;
30
+ return p;
31
+ }
28
32
  var Tooltip = React.forwardRef(
29
33
  function Tooltip2(props, ref) {
30
34
  const {
@@ -35,10 +39,8 @@ var Tooltip = React.forwardRef(
35
39
  children,
36
40
  disabled,
37
41
  disableOnMobile,
38
- portalled = true,
39
42
  content,
40
43
  contentProps,
41
- portalRef,
42
44
  defaultOpen = false,
43
45
  triggerProps,
44
46
  closeDelay = 100,
@@ -86,36 +88,34 @@ var Tooltip = React.forwardRef(
86
88
  if (disabled || disableOnMobile && isMobile) return children;
87
89
  const defaultShowArrow = variant === "popover" ? false : true;
88
90
  const showArrow = showArrowProp !== void 0 ? showArrowProp : defaultShowArrow;
89
- const placement = positioning?.placement ?? "top";
90
- const side = placement.split("-")[0];
91
- const align = placement.includes("-") ? placement.split("-")[1] : void 0;
92
- const sideOffset = positioning?.offset?.mainAxis ?? 4;
93
91
  const isPopover = variant === "popover";
94
- return /* @__PURE__ */ jsx(RadixTooltip.Provider, { delayDuration: openDelay, skipDelayDuration: 0, children: /* @__PURE__ */ jsxs(
95
- RadixTooltip.Root,
92
+ const placement = mapPlacement(positioning?.placement) ?? "top";
93
+ const offset = positioning?.offset?.mainAxis ?? 4;
94
+ return /* @__PURE__ */ jsx(TooltipGroup, { delay: openDelay, children: /* @__PURE__ */ jsxs(
95
+ Tooltip$1,
96
96
  {
97
97
  open,
98
98
  onOpenChange: handleOpenChange,
99
- delayDuration: openDelay,
99
+ delay: { open: openDelay, close: closeDelay },
100
+ placement,
101
+ offset,
102
+ unstyled: true,
100
103
  children: [
101
104
  /* @__PURE__ */ jsx(
102
- RadixTooltip.Trigger,
105
+ Tooltip$1.Trigger,
103
106
  {
104
107
  ref: open ? triggerRef : void 0,
105
108
  asChild: true,
106
- onClick: isMobile ? handleTriggerClick : void 0,
109
+ ...isMobile ? { onPress: handleTriggerClick } : {},
107
110
  ...triggerProps,
108
111
  children
109
112
  }
110
113
  ),
111
- /* @__PURE__ */ jsx(RadixTooltip.Portal, { container: portalled ? portalRef?.current ?? void 0 : void 0, children: /* @__PURE__ */ jsxs(
112
- RadixTooltip.Content,
114
+ /* @__PURE__ */ jsxs(
115
+ Tooltip$1.Content,
113
116
  {
114
117
  ref,
115
- side,
116
- align,
117
- sideOffset,
118
- onClick: interactive ? handleContentClick : void 0,
118
+ unstyled: true,
119
119
  className: cn(
120
120
  "z-[9999] overflow-hidden rounded-lg px-3 py-2 text-sm",
121
121
  "animate-in fade-in-0 zoom-in-95",
@@ -124,12 +124,14 @@ var Tooltip = React.forwardRef(
124
124
  !isPopover && "bg-[var(--color-tooltip-bg)] text-[var(--color-tooltip-fg)] max-w-xs",
125
125
  contentProps?.className
126
126
  ),
127
+ onClick: interactive ? handleContentClick : void 0,
127
128
  ...selected ? { "data-selected": true } : {},
128
129
  ...contentProps,
129
130
  children: [
130
131
  showArrow && /* @__PURE__ */ jsx(
131
- RadixTooltip.Arrow,
132
+ Tooltip$1.Arrow,
132
133
  {
134
+ unstyled: true,
133
135
  className: cn(
134
136
  isPopover ? "fill-[var(--color-popover-bg)]" : "fill-[var(--color-tooltip-bg)]"
135
137
  )
@@ -138,7 +140,7 @@ var Tooltip = React.forwardRef(
138
140
  content
139
141
  ]
140
142
  }
141
- ) })
143
+ )
142
144
  ]
143
145
  }
144
146
  ) });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luxfi/ui",
3
- "version": "7.0.0",
3
+ "version": "7.1.0",
4
4
  "description": "Radix + Tailwind UI primitives for Lux apps. Drop-in replacements for Chakra compound components.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -254,6 +254,11 @@
254
254
  "dev": "tsup --watch"
255
255
  },
256
256
  "dependencies": {
257
+ "@hanzogui/core": "^3.0.6",
258
+ "@hanzogui/dialog": "^3.0.2",
259
+ "@hanzogui/popover": "^3.0.2",
260
+ "@hanzogui/text": "^3.0.2",
261
+ "@hanzogui/tooltip": "^3.0.2",
257
262
  "@radix-ui/react-accordion": "^1.2.12",
258
263
  "@radix-ui/react-avatar": "^1.1.10",
259
264
  "@radix-ui/react-checkbox": "^1.3.3",
@@ -261,15 +266,12 @@
261
266
  "@radix-ui/react-dialog": "^1.1.15",
262
267
  "@radix-ui/react-dropdown-menu": "^2.1.16",
263
268
  "@radix-ui/react-label": "^2.1.7",
264
- "@radix-ui/react-popover": "^1.1.15",
265
269
  "@radix-ui/react-progress": "^1.1.7",
266
270
  "@radix-ui/react-radio-group": "^1.3.8",
267
271
  "@radix-ui/react-select": "^2.2.6",
268
272
  "@radix-ui/react-slider": "^1.3.6",
269
- "@radix-ui/react-slot": "^1.2.3",
270
273
  "@radix-ui/react-switch": "^1.2.6",
271
274
  "@radix-ui/react-tabs": "^1.1.13",
272
- "@radix-ui/react-tooltip": "^1.2.8",
273
275
  "@uidotdev/usehooks": "^2.4.1",
274
276
  "class-variance-authority": "^0.7.1",
275
277
  "clsx": "^2.1.1",
@@ -279,15 +281,15 @@
279
281
  "tailwind-merge": "^3.0.0"
280
282
  },
281
283
  "peerDependencies": {
282
- "@hanzogui/core": "^3.0.2",
284
+ "@hanzogui/core": "^3.0.6",
283
285
  "react": "^18.0.0 || ^19.0.0",
284
286
  "react-dom": "^18.0.0 || ^19.0.0"
285
287
  },
286
288
  "devDependencies": {
287
- "@hanzogui/core": "^3.0.2",
289
+ "@hanzogui/core": "^3.0.6",
288
290
  "@types/react": "^19.0.0",
289
291
  "@types/react-dom": "^19.0.0",
290
292
  "tsup": "^8.5.0",
291
293
  "typescript": "^5.9.3"
292
294
  }
293
- }
295
+ }
package/src/badge.tsx CHANGED
@@ -1,5 +1,3 @@
1
- import { cva } from 'class-variance-authority';
2
- import type { VariantProps } from 'class-variance-authority';
3
1
  import React from 'react';
4
2
 
5
3
  import { cn } from './utils';
@@ -23,26 +21,13 @@ type ColorPalette =
23
21
  'bright_yellow' | 'bright_teal' | 'bright_cyan' | 'bright_orange' |
24
22
  'bright_purple' | 'bright_pink';
25
23
 
26
- const badgeVariants = cva(
27
- 'inline-flex items-center rounded-sm gap-1 font-medium w-fit max-w-full whitespace-nowrap select-text',
28
- {
29
- variants: {
30
- variant: {
31
- subtle: '',
32
- solid: '',
33
- },
34
- size: {
35
- sm: 'text-xs p-1 h-[18px] min-h-[18px]',
36
- md: 'text-sm px-1 py-0.5 min-h-6',
37
- lg: 'text-sm px-2 py-1 min-h-7 font-semibold',
38
- },
39
- },
40
- defaultVariants: {
41
- variant: 'subtle',
42
- size: 'md',
43
- },
44
- },
45
- );
24
+ const BASE_CLASSES = 'inline-flex items-center rounded-sm gap-1 font-medium w-fit max-w-full whitespace-nowrap select-text';
25
+
26
+ const SIZE_CLASSES = {
27
+ sm: 'text-xs p-1 h-[18px] min-h-[18px]',
28
+ md: 'text-sm px-1 py-0.5 min-h-6',
29
+ lg: 'text-sm px-2 py-1 min-h-7 font-semibold',
30
+ } as const;
46
31
 
47
32
  const COLOR_PALETTE_CLASSES: Record<ColorPalette, string> = {
48
33
  gray: 'bg-badge-gray-bg text-badge-gray-fg',
@@ -70,13 +55,14 @@ const COLOR_PALETTE_CLASSES: Record<ColorPalette, string> = {
70
55
  };
71
56
 
72
57
  export interface BadgeProps
73
- extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'color'>,
74
- VariantProps<typeof badgeVariants> {
58
+ extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'color'> {
75
59
  readonly loading?: boolean;
76
60
  readonly startElement?: React.ReactNode;
77
61
  readonly endElement?: React.ReactNode;
78
62
  readonly truncated?: boolean;
79
63
  readonly colorPalette?: ColorPalette;
64
+ readonly variant?: 'subtle' | 'solid';
65
+ readonly size?: 'sm' | 'md' | 'lg';
80
66
  // Legacy Chakra style-prop shims
81
67
  readonly flexShrink?: number;
82
68
  readonly gap?: number | string;
@@ -84,6 +70,8 @@ export interface BadgeProps
84
70
  readonly mr?: number | string;
85
71
  }
86
72
 
73
+ const S = 4; // Chakra spacing scale
74
+
87
75
  export const Badge = React.forwardRef<HTMLDivElement, BadgeProps>(
88
76
  function Badge(props, ref) {
89
77
  const {
@@ -92,8 +80,8 @@ export const Badge = React.forwardRef<HTMLDivElement, BadgeProps>(
92
80
  children,
93
81
  truncated = false,
94
82
  endElement,
95
- variant,
96
- size,
83
+ variant: _variant,
84
+ size = 'md',
97
85
  colorPalette = 'gray',
98
86
  className,
99
87
  flexShrink: _flexShrink,
@@ -106,16 +94,16 @@ export const Badge = React.forwardRef<HTMLDivElement, BadgeProps>(
106
94
 
107
95
  const shimStyle: React.CSSProperties = { ...styleProp };
108
96
  if (_flexShrink !== undefined) shimStyle.flexShrink = _flexShrink;
109
- if (_gap !== undefined) shimStyle.gap = typeof _gap === 'number' ? `${ _gap * 4 }px` : _gap;
97
+ if (_gap !== undefined) shimStyle.gap = typeof _gap === 'number' ? `${ _gap * S }px` : _gap;
110
98
  if (_ml !== undefined) {
111
99
  if (typeof _ml === 'object') {
112
100
  const obj = _ml as Record<string, number>;
113
- shimStyle.marginLeft = `${ (obj.base ?? obj.lg ?? 0) * 4 }px`;
101
+ shimStyle.marginLeft = `${ (obj.base ?? obj.lg ?? 0) * S }px`;
114
102
  } else {
115
- shimStyle.marginLeft = typeof _ml === 'number' ? `${ _ml * 4 }px` : _ml;
103
+ shimStyle.marginLeft = typeof _ml === 'number' ? `${ _ml * S }px` : _ml;
116
104
  }
117
105
  }
118
- if (_mr !== undefined) shimStyle.marginRight = typeof _mr === 'number' ? `${ _mr * 4 }px` : _mr;
106
+ if (_mr !== undefined) shimStyle.marginRight = typeof _mr === 'number' ? `${ _mr * S }px` : _mr;
119
107
  const badgeStyle = Object.keys(shimStyle).length > 0 ? shimStyle : undefined;
120
108
 
121
109
  const child = children ? (
@@ -132,7 +120,8 @@ export const Badge = React.forwardRef<HTMLDivElement, BadgeProps>(
132
120
  <span
133
121
  ref={ ref as React.Ref<HTMLSpanElement> }
134
122
  className={ cn(
135
- badgeVariants({ variant, size }),
123
+ BASE_CLASSES,
124
+ SIZE_CLASSES[size],
136
125
  COLOR_PALETTE_CLASSES[colorPalette],
137
126
  className,
138
127
  ) }