@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/badge.cjs CHANGED
@@ -1,12 +1,11 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var classVarianceAuthority = require('class-variance-authority');
5
4
  var React2 = require('react');
6
5
  var clsx = require('clsx');
7
6
  var tailwindMerge = require('tailwind-merge');
8
7
  var jsxRuntime = require('react/jsx-runtime');
9
- var RadixTooltip = require('@radix-ui/react-tooltip');
8
+ var tooltip = require('@hanzogui/tooltip');
10
9
  var usehooks = require('@uidotdev/usehooks');
11
10
 
12
11
  function _interopNamespace(e) {
@@ -28,278 +27,142 @@ function _interopNamespace(e) {
28
27
  }
29
28
 
30
29
  var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
31
- var RadixTooltip__namespace = /*#__PURE__*/_interopNamespace(RadixTooltip);
32
30
 
33
31
  // src/badge.tsx
34
32
  function cn(...inputs) {
35
33
  return tailwindMerge.twMerge(clsx.clsx(inputs));
36
34
  }
37
- var SPACING_SCALE = 4;
38
- function toStylePx(value) {
39
- if (value === void 0) return void 0;
40
- if (typeof value === "string") return value;
41
- return `${value * SPACING_SCALE}px`;
35
+ var SHIM_PROPS = [
36
+ "w",
37
+ "h",
38
+ "minW",
39
+ "maxW",
40
+ "display",
41
+ "flexGrow",
42
+ "flexShrink",
43
+ "flexBasis",
44
+ "fontWeight",
45
+ "textStyle",
46
+ "borderRadius",
47
+ "alignSelf",
48
+ "alignItems",
49
+ "justifyContent",
50
+ "color",
51
+ "mt",
52
+ "mb",
53
+ "ml",
54
+ "mr",
55
+ "height",
56
+ "overflow",
57
+ "whiteSpace",
58
+ "textOverflow",
59
+ "textTransform",
60
+ "gap",
61
+ "gridTemplateColumns",
62
+ "minWidth",
63
+ "boxSize",
64
+ "py",
65
+ "px",
66
+ "p",
67
+ "hideBelow",
68
+ "fontSize",
69
+ "flexWrap",
70
+ "wordBreak",
71
+ "lineHeight",
72
+ "marginRight",
73
+ "position",
74
+ "background"
75
+ ];
76
+ var S = 4;
77
+ function dim(v) {
78
+ if (v == null) return void 0;
79
+ if (typeof v === "number") return `${v * S}px`;
80
+ if (typeof v === "string") return v;
81
+ if (typeof v === "object") {
82
+ const o = v;
83
+ return o.base ?? o.lg ?? o.xl ?? Object.values(o)[0];
84
+ }
85
+ return void 0;
42
86
  }
43
- function extractSkeletonStyleProps(props) {
44
- const style = {};
45
- const rest = {};
46
- function resolveDimension(value) {
47
- if (value === void 0 || value === null) return void 0;
48
- if (typeof value === "number") return `${value * SPACING_SCALE}px`;
49
- if (typeof value === "string") return value;
50
- if (typeof value === "object") {
51
- const obj = value;
52
- return obj.base ?? obj.lg ?? obj.xl ?? Object.values(obj)[0];
53
- }
54
- return void 0;
87
+ function sp(v) {
88
+ if (v === void 0) return void 0;
89
+ return typeof v === "number" ? `${v * S}px` : v;
90
+ }
91
+ function shimToStyle(props) {
92
+ const s = {};
93
+ if (props.w !== void 0) s.width = dim(props.w);
94
+ if (props.h !== void 0) s.height = dim(props.h);
95
+ if (props.minW !== void 0) s.minWidth = dim(props.minW);
96
+ if (props.maxW !== void 0) s.maxWidth = dim(props.maxW);
97
+ if (props.display !== void 0) s.display = props.display;
98
+ if (props.flexGrow !== void 0) s.flexGrow = props.flexGrow;
99
+ if (props.flexShrink !== void 0) s.flexShrink = props.flexShrink;
100
+ if (props.flexBasis !== void 0) s.flexBasis = props.flexBasis;
101
+ if (props.fontWeight !== void 0) s.fontWeight = props.fontWeight;
102
+ if (props.borderRadius !== void 0) s.borderRadius = props.borderRadius;
103
+ if (props.alignSelf !== void 0) s.alignSelf = props.alignSelf;
104
+ if (props.alignItems !== void 0) s.alignItems = props.alignItems;
105
+ if (props.justifyContent !== void 0) s.justifyContent = props.justifyContent;
106
+ if (props.color !== void 0) s.color = props.color;
107
+ if (props.mt !== void 0) s.marginTop = sp(props.mt);
108
+ if (props.mb !== void 0) s.marginBottom = sp(props.mb);
109
+ if (props.ml !== void 0) s.marginLeft = sp(props.ml);
110
+ if (props.mr !== void 0) s.marginRight = sp(props.mr);
111
+ if (props.height !== void 0) s.height = props.height;
112
+ if (props.overflow !== void 0) s.overflow = props.overflow;
113
+ if (props.whiteSpace !== void 0) s.whiteSpace = props.whiteSpace;
114
+ if (props.textOverflow !== void 0) s.textOverflow = props.textOverflow;
115
+ if (props.textTransform !== void 0) s.textTransform = props.textTransform;
116
+ if (props.gap !== void 0) s.gap = sp(props.gap);
117
+ if (props.gridTemplateColumns !== void 0) s.gridTemplateColumns = props.gridTemplateColumns;
118
+ if (props.minWidth !== void 0) s.minWidth = props.minWidth;
119
+ if (props.boxSize !== void 0) {
120
+ const v = typeof props.boxSize === "number" ? `${props.boxSize * S}px` : props.boxSize;
121
+ s.width = v;
122
+ s.height = v;
55
123
  }
56
- for (const [key, value] of Object.entries(props)) {
57
- if (value === void 0) continue;
58
- switch (key) {
59
- case "w": {
60
- const v = resolveDimension(value);
61
- if (v) style.width = v;
62
- break;
63
- }
64
- case "h": {
65
- const v = resolveDimension(value);
66
- if (v) style.height = v;
67
- break;
68
- }
69
- case "minW": {
70
- const v = resolveDimension(value);
71
- if (v) style.minWidth = v;
72
- break;
73
- }
74
- case "maxW": {
75
- const v = resolveDimension(value);
76
- if (v) style.maxWidth = v;
77
- break;
78
- }
79
- case "height":
80
- style.height = value;
81
- break;
82
- case "display":
83
- style.display = value;
84
- break;
85
- case "flexGrow":
86
- style.flexGrow = value;
87
- break;
88
- case "flexShrink":
89
- style.flexShrink = value;
90
- break;
91
- case "flexBasis":
92
- style.flexBasis = value;
93
- break;
94
- case "fontWeight":
95
- style.fontWeight = value;
96
- break;
97
- case "borderRadius":
98
- style.borderRadius = value;
99
- break;
100
- case "alignSelf":
101
- style.alignSelf = value;
102
- break;
103
- case "alignItems":
104
- style.alignItems = value;
105
- break;
106
- case "justifyContent":
107
- style.justifyContent = value;
108
- break;
109
- case "color":
110
- style.color = value;
111
- break;
112
- case "mt":
113
- style.marginTop = toStylePx(value);
114
- break;
115
- case "mb":
116
- style.marginBottom = toStylePx(value);
117
- break;
118
- case "ml":
119
- style.marginLeft = toStylePx(value);
120
- break;
121
- case "mr":
122
- style.marginRight = toStylePx(value);
123
- break;
124
- case "overflow":
125
- style.overflow = value;
126
- break;
127
- case "whiteSpace":
128
- style.whiteSpace = value;
129
- break;
130
- case "textOverflow":
131
- style.textOverflow = value;
132
- break;
133
- case "textTransform":
134
- style.textTransform = value;
135
- break;
136
- case "gap":
137
- style.gap = typeof value === "number" ? `${value * SPACING_SCALE}px` : value;
138
- break;
139
- case "gridTemplateColumns":
140
- style.gridTemplateColumns = value;
141
- break;
142
- case "minWidth":
143
- style.minWidth = value;
144
- break;
145
- case "boxSize": {
146
- const s = typeof value === "number" ? `${value * SPACING_SCALE}px` : value;
147
- style.width = s;
148
- style.height = s;
149
- break;
150
- }
151
- case "py": {
152
- const v = toStylePx(value);
153
- style.paddingTop = v;
154
- style.paddingBottom = v;
155
- break;
156
- }
157
- case "px": {
158
- const v = toStylePx(value);
159
- style.paddingLeft = v;
160
- style.paddingRight = v;
161
- break;
162
- }
163
- case "p": {
164
- const v = toStylePx(value);
165
- style.padding = v;
166
- break;
167
- }
168
- case "hideBelow":
169
- break;
170
- // handled via className
171
- case "textStyle":
172
- break;
173
- // drop textStyle, not directly applicable
174
- case "fontSize":
175
- style.fontSize = value;
176
- break;
177
- case "flexWrap":
178
- style.flexWrap = value;
179
- break;
180
- case "wordBreak":
181
- style.wordBreak = value;
182
- break;
183
- case "lineHeight":
184
- style.lineHeight = value;
185
- break;
186
- case "marginRight":
187
- style.marginRight = value;
188
- break;
189
- case "position":
190
- style.position = value;
191
- break;
192
- case "background":
193
- style.background = value;
194
- break;
195
- default:
196
- rest[key] = value;
197
- break;
198
- }
124
+ if (props.py !== void 0) {
125
+ const v = sp(props.py);
126
+ s.paddingTop = v;
127
+ s.paddingBottom = v;
128
+ }
129
+ if (props.px !== void 0) {
130
+ const v = sp(props.px);
131
+ s.paddingLeft = v;
132
+ s.paddingRight = v;
199
133
  }
200
- return { style, rest };
134
+ if (props.p !== void 0) s.padding = sp(props.p);
135
+ if (props.fontSize !== void 0) s.fontSize = props.fontSize;
136
+ if (props.flexWrap !== void 0) s.flexWrap = props.flexWrap;
137
+ if (props.wordBreak !== void 0) s.wordBreak = props.wordBreak;
138
+ if (props.lineHeight !== void 0) s.lineHeight = props.lineHeight;
139
+ if (props.marginRight !== void 0) s.marginRight = props.marginRight;
140
+ if (props.position !== void 0) s.position = props.position;
141
+ if (props.background !== void 0) s.background = props.background;
142
+ return s;
143
+ }
144
+ function stripShims(props) {
145
+ const out = { ...props };
146
+ for (const k of SHIM_PROPS) delete out[k];
147
+ return out;
201
148
  }
149
+ var SKELETON_CLASSES = [
150
+ "animate-skeleton-shimmer rounded-sm",
151
+ "bg-[linear-gradient(90deg,var(--color-skeleton-start)_0%,var(--color-skeleton-end)_50%,var(--color-skeleton-start)_100%)]",
152
+ "bg-[length:200%_100%]"
153
+ ].join(" ");
154
+ var HIDE_BELOW_MAP = { lg: "lg:hidden", md: "md:hidden", sm: "sm:hidden" };
202
155
  var Skeleton = React2__namespace.forwardRef(
203
156
  function Skeleton2(props, ref) {
204
- const {
205
- loading = false,
206
- asChild,
207
- className,
208
- children,
209
- style: styleProp,
210
- // Destructure style-prop shims so they don't leak into DOM
211
- w: _w,
212
- h: _h,
213
- minW: _minW,
214
- maxW: _maxW,
215
- display: _display,
216
- flexGrow: _flexGrow,
217
- flexShrink: _flexShrink,
218
- flexBasis: _flexBasis,
219
- fontWeight: _fontWeight,
220
- textStyle: _textStyle,
221
- borderRadius: _borderRadius,
222
- alignSelf: _alignSelf,
223
- alignItems: _alignItems,
224
- justifyContent: _justifyContent,
225
- color: _color,
226
- mt: _mt,
227
- mb: _mb,
228
- ml: _ml,
229
- mr: _mr,
230
- height: _height,
231
- overflow: _overflow,
232
- whiteSpace: _whiteSpace,
233
- textOverflow: _textOverflow,
234
- textTransform: _textTransform,
235
- gap: _gap,
236
- gridTemplateColumns: _gridTemplateColumns,
237
- minWidth: _minWidth,
238
- boxSize: _boxSize,
239
- py: _py,
240
- px: _px,
241
- p: _p,
242
- hideBelow: _hideBelow,
243
- fontSize: _fontSize,
244
- flexWrap: _flexWrap,
245
- wordBreak: _wordBreak,
246
- lineHeight: _lineHeight,
247
- marginRight: _marginRight,
248
- position: _position,
249
- background: _background,
250
- as: Component = "div",
251
- ...htmlRest
252
- } = props;
253
- const { style: shimStyle } = extractSkeletonStyleProps({
254
- w: _w,
255
- h: _h,
256
- minW: _minW,
257
- maxW: _maxW,
258
- display: _display,
259
- flexGrow: _flexGrow,
260
- flexShrink: _flexShrink,
261
- flexBasis: _flexBasis,
262
- fontWeight: _fontWeight,
263
- textStyle: _textStyle,
264
- borderRadius: _borderRadius,
265
- alignSelf: _alignSelf,
266
- alignItems: _alignItems,
267
- justifyContent: _justifyContent,
268
- color: _color,
269
- mt: _mt,
270
- mb: _mb,
271
- ml: _ml,
272
- mr: _mr,
273
- height: _height,
274
- overflow: _overflow,
275
- whiteSpace: _whiteSpace,
276
- textOverflow: _textOverflow,
277
- textTransform: _textTransform,
278
- gap: _gap,
279
- gridTemplateColumns: _gridTemplateColumns,
280
- minWidth: _minWidth,
281
- boxSize: _boxSize,
282
- py: _py,
283
- px: _px,
284
- p: _p,
285
- hideBelow: _hideBelow,
286
- fontSize: _fontSize,
287
- flexWrap: _flexWrap,
288
- wordBreak: _wordBreak,
289
- lineHeight: _lineHeight,
290
- marginRight: _marginRight,
291
- position: _position,
292
- background: _background
293
- });
157
+ const { loading = false, asChild, className, children, style: styleProp, as: Component = "div", ...allRest } = props;
158
+ const shimStyle = shimToStyle(props);
294
159
  const mergedStyle = Object.keys(shimStyle).length > 0 || styleProp ? { ...shimStyle, ...styleProp } : void 0;
295
- const HIDE_BELOW_MAP = { lg: "lg:hidden", md: "md:hidden", sm: "sm:hidden" };
296
- const hideBelowClass = _hideBelow ? HIDE_BELOW_MAP[_hideBelow] : void 0;
297
- const finalClassName = hideBelowClass ? cn(className, hideBelowClass) : className;
160
+ const hideBelowClass = props.hideBelow ? HIDE_BELOW_MAP[props.hideBelow] : void 0;
161
+ const cls = hideBelowClass ? cn(className, hideBelowClass) : className;
162
+ const htmlRest = stripShims(allRest);
298
163
  if (!loading) {
299
- if (asChild && React2__namespace.isValidElement(children)) {
300
- return children;
301
- }
302
- return /* @__PURE__ */ jsxRuntime.jsx(Component, { ref, className: finalClassName, style: mergedStyle, ...htmlRest, children });
164
+ if (asChild && React2__namespace.isValidElement(children)) return children;
165
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, { ref, className: cls, style: mergedStyle, ...htmlRest, children });
303
166
  }
304
167
  if (asChild && React2__namespace.isValidElement(children)) {
305
168
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -307,13 +170,7 @@ var Skeleton = React2__namespace.forwardRef(
307
170
  {
308
171
  ref,
309
172
  "data-loading": true,
310
- className: cn(
311
- "animate-skeleton-shimmer rounded-sm",
312
- "bg-[linear-gradient(90deg,var(--color-skeleton-start)_0%,var(--color-skeleton-end)_50%,var(--color-skeleton-start)_100%)]",
313
- "bg-[length:200%_100%]",
314
- "text-transparent [&_*]:invisible",
315
- finalClassName
316
- ),
173
+ className: cn(SKELETON_CLASSES, "text-transparent [&_*]:invisible", cls),
317
174
  style: mergedStyle,
318
175
  ...htmlRest,
319
176
  children
@@ -325,13 +182,7 @@ var Skeleton = React2__namespace.forwardRef(
325
182
  {
326
183
  ref,
327
184
  "data-loading": true,
328
- className: cn(
329
- "animate-skeleton-shimmer rounded-sm",
330
- "bg-[linear-gradient(90deg,var(--color-skeleton-start)_0%,var(--color-skeleton-end)_50%,var(--color-skeleton-start)_100%)]",
331
- "bg-[length:200%_100%]",
332
- children ? "text-transparent [&_*]:invisible" : "min-h-5",
333
- finalClassName
334
- ),
185
+ className: cn(SKELETON_CLASSES, children ? "text-transparent [&_*]:invisible" : "min-h-5", cls),
335
186
  style: mergedStyle,
336
187
  ...htmlRest,
337
188
  children
@@ -383,6 +234,10 @@ function useIsMobile() {
383
234
  }, []);
384
235
  return isMobile;
385
236
  }
237
+ function mapPlacement(p) {
238
+ if (!p) return void 0;
239
+ return p;
240
+ }
386
241
  var Tooltip = React2__namespace.forwardRef(
387
242
  function Tooltip2(props, ref) {
388
243
  const {
@@ -393,10 +248,8 @@ var Tooltip = React2__namespace.forwardRef(
393
248
  children,
394
249
  disabled,
395
250
  disableOnMobile,
396
- portalled = true,
397
251
  content,
398
252
  contentProps,
399
- portalRef,
400
253
  defaultOpen = false,
401
254
  triggerProps,
402
255
  closeDelay = 100,
@@ -444,36 +297,34 @@ var Tooltip = React2__namespace.forwardRef(
444
297
  if (disabled || disableOnMobile && isMobile) return children;
445
298
  const defaultShowArrow = variant === "popover" ? false : true;
446
299
  const showArrow = showArrowProp !== void 0 ? showArrowProp : defaultShowArrow;
447
- const placement = positioning?.placement ?? "top";
448
- const side = placement.split("-")[0];
449
- const align = placement.includes("-") ? placement.split("-")[1] : void 0;
450
- const sideOffset = positioning?.offset?.mainAxis ?? 4;
451
300
  const isPopover = variant === "popover";
452
- return /* @__PURE__ */ jsxRuntime.jsx(RadixTooltip__namespace.Provider, { delayDuration: openDelay, skipDelayDuration: 0, children: /* @__PURE__ */ jsxRuntime.jsxs(
453
- RadixTooltip__namespace.Root,
301
+ const placement = mapPlacement(positioning?.placement) ?? "top";
302
+ const offset = positioning?.offset?.mainAxis ?? 4;
303
+ return /* @__PURE__ */ jsxRuntime.jsx(tooltip.TooltipGroup, { delay: openDelay, children: /* @__PURE__ */ jsxRuntime.jsxs(
304
+ tooltip.Tooltip,
454
305
  {
455
306
  open,
456
307
  onOpenChange: handleOpenChange,
457
- delayDuration: openDelay,
308
+ delay: { open: openDelay, close: closeDelay },
309
+ placement,
310
+ offset,
311
+ unstyled: true,
458
312
  children: [
459
313
  /* @__PURE__ */ jsxRuntime.jsx(
460
- RadixTooltip__namespace.Trigger,
314
+ tooltip.Tooltip.Trigger,
461
315
  {
462
316
  ref: open ? triggerRef : void 0,
463
317
  asChild: true,
464
- onClick: isMobile ? handleTriggerClick : void 0,
318
+ ...isMobile ? { onPress: handleTriggerClick } : {},
465
319
  ...triggerProps,
466
320
  children
467
321
  }
468
322
  ),
469
- /* @__PURE__ */ jsxRuntime.jsx(RadixTooltip__namespace.Portal, { container: portalled ? portalRef?.current ?? void 0 : void 0, children: /* @__PURE__ */ jsxRuntime.jsxs(
470
- RadixTooltip__namespace.Content,
323
+ /* @__PURE__ */ jsxRuntime.jsxs(
324
+ tooltip.Tooltip.Content,
471
325
  {
472
326
  ref,
473
- side,
474
- align,
475
- sideOffset,
476
- onClick: interactive ? handleContentClick : void 0,
327
+ unstyled: true,
477
328
  className: cn(
478
329
  "z-[9999] overflow-hidden rounded-lg px-3 py-2 text-sm",
479
330
  "animate-in fade-in-0 zoom-in-95",
@@ -482,12 +333,14 @@ var Tooltip = React2__namespace.forwardRef(
482
333
  !isPopover && "bg-[var(--color-tooltip-bg)] text-[var(--color-tooltip-fg)] max-w-xs",
483
334
  contentProps?.className
484
335
  ),
336
+ onClick: interactive ? handleContentClick : void 0,
485
337
  ...selected ? { "data-selected": true } : {},
486
338
  ...contentProps,
487
339
  children: [
488
340
  showArrow && /* @__PURE__ */ jsxRuntime.jsx(
489
- RadixTooltip__namespace.Arrow,
341
+ tooltip.Tooltip.Arrow,
490
342
  {
343
+ unstyled: true,
491
344
  className: cn(
492
345
  isPopover ? "fill-[var(--color-popover-bg)]" : "fill-[var(--color-tooltip-bg)]"
493
346
  )
@@ -496,7 +349,7 @@ var Tooltip = React2__namespace.forwardRef(
496
349
  content
497
350
  ]
498
351
  }
499
- ) })
352
+ )
500
353
  ]
501
354
  }
502
355
  ) });
@@ -505,26 +358,12 @@ var Tooltip = React2__namespace.forwardRef(
505
358
  function TruncatedTextTooltip({ label, children }) {
506
359
  return /* @__PURE__ */ jsxRuntime.jsx(Tooltip, { content: label, positioning: { placement: "top" }, children });
507
360
  }
508
- var badgeVariants = classVarianceAuthority.cva(
509
- "inline-flex items-center rounded-sm gap-1 font-medium w-fit max-w-full whitespace-nowrap select-text",
510
- {
511
- variants: {
512
- variant: {
513
- subtle: "",
514
- solid: ""
515
- },
516
- size: {
517
- sm: "text-xs p-1 h-[18px] min-h-[18px]",
518
- md: "text-sm px-1 py-0.5 min-h-6",
519
- lg: "text-sm px-2 py-1 min-h-7 font-semibold"
520
- }
521
- },
522
- defaultVariants: {
523
- variant: "subtle",
524
- size: "md"
525
- }
526
- }
527
- );
361
+ var BASE_CLASSES = "inline-flex items-center rounded-sm gap-1 font-medium w-fit max-w-full whitespace-nowrap select-text";
362
+ var SIZE_CLASSES = {
363
+ sm: "text-xs p-1 h-[18px] min-h-[18px]",
364
+ md: "text-sm px-1 py-0.5 min-h-6",
365
+ lg: "text-sm px-2 py-1 min-h-7 font-semibold"
366
+ };
528
367
  var COLOR_PALETTE_CLASSES = {
529
368
  gray: "bg-badge-gray-bg text-badge-gray-fg",
530
369
  green: "bg-badge-green-bg text-badge-green-fg",
@@ -549,6 +388,7 @@ var COLOR_PALETTE_CLASSES = {
549
388
  bright_purple: "bg-badge-bright-purple-bg text-badge-bright-purple-fg",
550
389
  bright_pink: "bg-badge-bright-pink-bg text-badge-bright-pink-fg"
551
390
  };
391
+ var S2 = 4;
552
392
  var Badge = React2__namespace.default.forwardRef(
553
393
  function Badge2(props, ref) {
554
394
  const {
@@ -557,8 +397,8 @@ var Badge = React2__namespace.default.forwardRef(
557
397
  children,
558
398
  truncated = false,
559
399
  endElement,
560
- variant,
561
- size,
400
+ variant: _variant,
401
+ size = "md",
562
402
  colorPalette = "gray",
563
403
  className,
564
404
  flexShrink: _flexShrink,
@@ -570,16 +410,16 @@ var Badge = React2__namespace.default.forwardRef(
570
410
  } = props;
571
411
  const shimStyle = { ...styleProp };
572
412
  if (_flexShrink !== void 0) shimStyle.flexShrink = _flexShrink;
573
- if (_gap !== void 0) shimStyle.gap = typeof _gap === "number" ? `${_gap * 4}px` : _gap;
413
+ if (_gap !== void 0) shimStyle.gap = typeof _gap === "number" ? `${_gap * S2}px` : _gap;
574
414
  if (_ml !== void 0) {
575
415
  if (typeof _ml === "object") {
576
416
  const obj = _ml;
577
- shimStyle.marginLeft = `${(obj.base ?? obj.lg ?? 0) * 4}px`;
417
+ shimStyle.marginLeft = `${(obj.base ?? obj.lg ?? 0) * S2}px`;
578
418
  } else {
579
- shimStyle.marginLeft = typeof _ml === "number" ? `${_ml * 4}px` : _ml;
419
+ shimStyle.marginLeft = typeof _ml === "number" ? `${_ml * S2}px` : _ml;
580
420
  }
581
421
  }
582
- if (_mr !== void 0) shimStyle.marginRight = typeof _mr === "number" ? `${_mr * 4}px` : _mr;
422
+ if (_mr !== void 0) shimStyle.marginRight = typeof _mr === "number" ? `${_mr * S2}px` : _mr;
583
423
  const badgeStyle = Object.keys(shimStyle).length > 0 ? shimStyle : void 0;
584
424
  const child = children ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "overflow-hidden text-ellipsis", children }) : null;
585
425
  const childrenElement = truncated ? /* @__PURE__ */ jsxRuntime.jsx(TruncatedTextTooltip, { label: children, children: child }) : child;
@@ -588,7 +428,8 @@ var Badge = React2__namespace.default.forwardRef(
588
428
  {
589
429
  ref,
590
430
  className: cn(
591
- badgeVariants({ variant, size }),
431
+ BASE_CLASSES,
432
+ SIZE_CLASSES[size],
592
433
  COLOR_PALETTE_CLASSES[colorPalette],
593
434
  className
594
435
  ),
package/dist/badge.d.cts CHANGED
@@ -1,18 +1,14 @@
1
- import * as class_variance_authority_types from 'class-variance-authority/types';
2
- import { VariantProps } from 'class-variance-authority';
3
1
  import React__default from 'react';
4
2
 
5
3
  type ColorPalette = 'gray' | 'green' | 'red' | 'purple' | 'orange' | 'blue' | 'yellow' | 'teal' | 'cyan' | 'pink' | 'purple_alt' | 'blue_alt' | 'bright_gray' | 'bright_green' | 'bright_red' | 'bright_blue' | 'bright_yellow' | 'bright_teal' | 'bright_cyan' | 'bright_orange' | 'bright_purple' | 'bright_pink';
6
- declare const badgeVariants: (props?: ({
7
- variant?: "solid" | "subtle" | null | undefined;
8
- size?: "sm" | "md" | "lg" | null | undefined;
9
- } & class_variance_authority_types.ClassProp) | undefined) => string;
10
- interface BadgeProps extends Omit<React__default.HTMLAttributes<HTMLSpanElement>, 'color'>, VariantProps<typeof badgeVariants> {
4
+ interface BadgeProps extends Omit<React__default.HTMLAttributes<HTMLSpanElement>, 'color'> {
11
5
  readonly loading?: boolean;
12
6
  readonly startElement?: React__default.ReactNode;
13
7
  readonly endElement?: React__default.ReactNode;
14
8
  readonly truncated?: boolean;
15
9
  readonly colorPalette?: ColorPalette;
10
+ readonly variant?: 'subtle' | 'solid';
11
+ readonly size?: 'sm' | 'md' | 'lg';
16
12
  readonly flexShrink?: number;
17
13
  readonly gap?: number | string;
18
14
  readonly ml?: number | string | Record<string, number>;
package/dist/badge.d.ts CHANGED
@@ -1,18 +1,14 @@
1
- import * as class_variance_authority_types from 'class-variance-authority/types';
2
- import { VariantProps } from 'class-variance-authority';
3
1
  import React__default from 'react';
4
2
 
5
3
  type ColorPalette = 'gray' | 'green' | 'red' | 'purple' | 'orange' | 'blue' | 'yellow' | 'teal' | 'cyan' | 'pink' | 'purple_alt' | 'blue_alt' | 'bright_gray' | 'bright_green' | 'bright_red' | 'bright_blue' | 'bright_yellow' | 'bright_teal' | 'bright_cyan' | 'bright_orange' | 'bright_purple' | 'bright_pink';
6
- declare const badgeVariants: (props?: ({
7
- variant?: "solid" | "subtle" | null | undefined;
8
- size?: "sm" | "md" | "lg" | null | undefined;
9
- } & class_variance_authority_types.ClassProp) | undefined) => string;
10
- interface BadgeProps extends Omit<React__default.HTMLAttributes<HTMLSpanElement>, 'color'>, VariantProps<typeof badgeVariants> {
4
+ interface BadgeProps extends Omit<React__default.HTMLAttributes<HTMLSpanElement>, 'color'> {
11
5
  readonly loading?: boolean;
12
6
  readonly startElement?: React__default.ReactNode;
13
7
  readonly endElement?: React__default.ReactNode;
14
8
  readonly truncated?: boolean;
15
9
  readonly colorPalette?: ColorPalette;
10
+ readonly variant?: 'subtle' | 'solid';
11
+ readonly size?: 'sm' | 'md' | 'lg';
16
12
  readonly flexShrink?: number;
17
13
  readonly gap?: number | string;
18
14
  readonly ml?: number | string | Record<string, number>;