@luxfi/ui 6.1.3 → 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.
- package/dist/accordion.cjs +213 -0
- package/dist/accordion.d.cts +74 -0
- package/dist/accordion.d.ts +74 -0
- package/dist/accordion.js +186 -0
- package/dist/alert.cjs +430 -0
- package/dist/alert.d.cts +30 -0
- package/dist/alert.d.ts +30 -0
- package/dist/alert.js +408 -0
- package/dist/avatar.cjs +149 -0
- package/dist/avatar.d.cts +25 -0
- package/dist/avatar.d.ts +25 -0
- package/dist/avatar.js +125 -0
- package/dist/badge.cjs +452 -0
- package/dist/badge.d.cts +19 -0
- package/dist/badge.d.ts +19 -0
- package/dist/badge.js +431 -0
- package/dist/bank.cjs +272 -0
- package/dist/bank.d.cts +76 -0
- package/dist/bank.d.ts +76 -0
- package/dist/bank.js +258 -0
- package/dist/button.cjs +578 -0
- package/dist/button.d.cts +55 -0
- package/dist/button.d.ts +55 -0
- package/dist/button.js +553 -0
- package/dist/checkbox.cjs +265 -0
- package/dist/checkbox.d.cts +31 -0
- package/dist/checkbox.d.ts +31 -0
- package/dist/checkbox.js +241 -0
- package/dist/close-button.cjs +92 -0
- package/dist/close-button.d.cts +9 -0
- package/dist/close-button.d.ts +9 -0
- package/dist/close-button.js +70 -0
- package/dist/collapsible.cjs +555 -0
- package/dist/collapsible.d.cts +23 -0
- package/dist/collapsible.d.ts +23 -0
- package/dist/collapsible.js +532 -0
- package/dist/color-mode.cjs +96 -0
- package/dist/color-mode.d.cts +25 -0
- package/dist/color-mode.d.ts +25 -0
- package/dist/color-mode.js +72 -0
- package/dist/dialog.cjs +295 -0
- package/dist/dialog.d.cts +65 -0
- package/dist/dialog.d.ts +65 -0
- package/dist/dialog.js +263 -0
- package/dist/drawer.cjs +231 -0
- package/dist/drawer.d.cts +36 -0
- package/dist/drawer.d.ts +36 -0
- package/dist/drawer.js +199 -0
- package/dist/empty-state.cjs +93 -0
- package/dist/empty-state.d.cts +13 -0
- package/dist/empty-state.d.ts +13 -0
- package/dist/empty-state.js +71 -0
- package/dist/expiration-selector.cjs +138 -0
- package/dist/expiration-selector.d.cts +16 -0
- package/dist/expiration-selector.d.ts +16 -0
- package/dist/expiration-selector.js +116 -0
- package/dist/field.cjs +183 -0
- package/dist/field.d.cts +24 -0
- package/dist/field.d.ts +24 -0
- package/dist/field.js +160 -0
- package/dist/greeks-display.cjs +114 -0
- package/dist/greeks-display.d.cts +14 -0
- package/dist/greeks-display.d.ts +14 -0
- package/dist/greeks-display.js +92 -0
- package/dist/heading.cjs +41 -0
- package/dist/heading.d.cts +10 -0
- package/dist/heading.d.ts +10 -0
- package/dist/heading.js +35 -0
- package/dist/icon-button.cjs +367 -0
- package/dist/icon-button.d.cts +33 -0
- package/dist/icon-button.d.ts +33 -0
- package/dist/icon-button.js +345 -0
- package/dist/image.cjs +425 -0
- package/dist/image.d.cts +57 -0
- package/dist/image.d.ts +57 -0
- package/dist/image.js +404 -0
- package/dist/index.cjs +7220 -0
- package/dist/index.d.cts +55 -0
- package/dist/index.d.ts +55 -0
- package/dist/index.js +7043 -0
- package/dist/input-group.cjs +155 -0
- package/dist/input-group.d.cts +17 -0
- package/dist/input-group.d.ts +17 -0
- package/dist/input-group.js +133 -0
- package/dist/input.cjs +65 -0
- package/dist/input.d.cts +11 -0
- package/dist/input.d.ts +11 -0
- package/dist/input.js +59 -0
- package/dist/link.cjs +483 -0
- package/dist/link.d.cts +37 -0
- package/dist/link.d.ts +37 -0
- package/dist/link.js +459 -0
- package/dist/menu.cjs +305 -0
- package/dist/menu.d.cts +84 -0
- package/dist/menu.d.ts +84 -0
- package/dist/menu.js +269 -0
- package/dist/option-chain.cjs +221 -0
- package/dist/option-chain.d.cts +37 -0
- package/dist/option-chain.d.ts +37 -0
- package/dist/option-chain.js +199 -0
- package/dist/option-position.cjs +164 -0
- package/dist/option-position.d.cts +29 -0
- package/dist/option-position.d.ts +29 -0
- package/dist/option-position.js +142 -0
- package/dist/pin-input.cjs +182 -0
- package/dist/pin-input.d.cts +25 -0
- package/dist/pin-input.d.ts +25 -0
- package/dist/pin-input.js +160 -0
- package/dist/pnl-diagram.cjs +453 -0
- package/dist/pnl-diagram.d.cts +11 -0
- package/dist/pnl-diagram.d.ts +11 -0
- package/dist/pnl-diagram.js +431 -0
- package/dist/popover.cjs +342 -0
- package/dist/popover.d.cts +73 -0
- package/dist/popover.d.ts +73 -0
- package/dist/popover.js +310 -0
- package/dist/progress-circle.cjs +152 -0
- package/dist/progress-circle.d.cts +47 -0
- package/dist/progress-circle.d.ts +47 -0
- package/dist/progress-circle.js +128 -0
- package/dist/progress.cjs +117 -0
- package/dist/progress.d.cts +28 -0
- package/dist/progress.d.ts +28 -0
- package/dist/progress.js +94 -0
- package/dist/provider.cjs +62 -0
- package/dist/provider.d.cts +7 -0
- package/dist/provider.d.ts +7 -0
- package/dist/provider.js +40 -0
- package/dist/radio.cjs +177 -0
- package/dist/radio.d.cts +53 -0
- package/dist/radio.d.ts +53 -0
- package/dist/radio.js +153 -0
- package/dist/rating.cjs +80 -0
- package/dist/rating.d.cts +14 -0
- package/dist/rating.d.ts +14 -0
- package/dist/rating.js +58 -0
- package/dist/select.cjs +644 -0
- package/dist/select.d.cts +130 -0
- package/dist/select.d.ts +130 -0
- package/dist/select.js +610 -0
- package/dist/separator.cjs +57 -0
- package/dist/separator.d.cts +13 -0
- package/dist/separator.d.ts +13 -0
- package/dist/separator.js +51 -0
- package/dist/skeleton.cjs +223 -0
- package/dist/skeleton.d.cts +60 -0
- package/dist/skeleton.d.ts +60 -0
- package/dist/skeleton.js +199 -0
- package/dist/slider.cjs +138 -0
- package/dist/slider.d.cts +24 -0
- package/dist/slider.d.ts +24 -0
- package/dist/slider.js +115 -0
- package/dist/strategy-builder.cjs +373 -0
- package/dist/strategy-builder.d.cts +26 -0
- package/dist/strategy-builder.d.ts +26 -0
- package/dist/strategy-builder.js +351 -0
- package/dist/switch.cjs +163 -0
- package/dist/switch.d.cts +27 -0
- package/dist/switch.d.ts +27 -0
- package/dist/switch.js +140 -0
- package/dist/table.cjs +897 -0
- package/dist/table.d.cts +107 -0
- package/dist/table.d.ts +107 -0
- package/dist/table.js +866 -0
- package/dist/tabs.cjs +240 -0
- package/dist/tabs.d.cts +78 -0
- package/dist/tabs.d.ts +78 -0
- package/dist/tabs.js +213 -0
- package/dist/tag.cjs +529 -0
- package/dist/tag.d.cts +21 -0
- package/dist/tag.d.ts +21 -0
- package/dist/tag.js +507 -0
- package/dist/textarea.cjs +65 -0
- package/dist/textarea.d.cts +11 -0
- package/dist/textarea.d.ts +11 -0
- package/dist/textarea.js +59 -0
- package/dist/toaster.cjs +99 -0
- package/dist/toaster.d.cts +29 -0
- package/dist/toaster.d.ts +29 -0
- package/dist/toaster.js +96 -0
- package/dist/tooltip.cjs +172 -0
- package/dist/tooltip.d.cts +38 -0
- package/dist/tooltip.d.ts +38 -0
- package/dist/tooltip.js +150 -0
- package/dist/utils.cjs +11 -0
- package/dist/utils.d.cts +5 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +9 -0
- package/package.json +284 -89
- package/src/accordion.tsx +285 -0
- package/src/alert.tsx +221 -0
- package/src/avatar.tsx +174 -0
- package/src/badge.tsx +147 -0
- package/src/bank.tsx +325 -0
- package/src/button.tsx +477 -0
- package/src/checkbox.tsx +307 -0
- package/src/close-button.tsx +77 -0
- package/src/collapsible.tsx +126 -0
- package/src/color-mode.tsx +125 -0
- package/src/dialog.tsx +346 -0
- package/src/drawer.tsx +186 -0
- package/src/empty-state.tsx +97 -0
- package/src/expiration-selector.tsx +163 -0
- package/src/field.tsx +202 -0
- package/src/greeks-display.tsx +138 -0
- package/src/heading.tsx +44 -0
- package/src/icon-button.tsx +217 -0
- package/src/image.tsx +280 -0
- package/src/index.ts +267 -138
- package/src/input-group.tsx +159 -0
- package/src/input.tsx +60 -0
- package/src/link.tsx +326 -0
- package/src/menu.tsx +471 -0
- package/src/option-chain.tsx +261 -0
- package/src/option-position.tsx +200 -0
- package/src/pin-input.tsx +187 -0
- package/src/pnl-diagram.tsx +458 -0
- package/src/popover.tsx +386 -0
- package/src/progress-circle.tsx +180 -0
- package/src/progress.tsx +109 -0
- package/src/provider.tsx +12 -0
- package/src/radio.tsx +175 -0
- package/src/rating.tsx +79 -0
- package/src/select.tsx +696 -0
- package/src/separator.tsx +59 -0
- package/src/skeleton.tsx +254 -0
- package/src/slider.tsx +152 -0
- package/src/strategy-builder.tsx +466 -0
- package/src/switch.tsx +158 -0
- package/src/table.tsx +621 -0
- package/src/tabs.tsx +354 -0
- package/src/tag.tsx +159 -0
- package/src/textarea.tsx +60 -0
- package/src/toaster.tsx +117 -0
- package/src/tokens.css +438 -0
- package/src/tooltip.tsx +191 -0
- package/src/utils/cn.ts +7 -0
- package/src/utils.ts +6 -0
- package/tokens.css +438 -0
- package/LICENSE +0 -122
- package/README.md +0 -109
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
interface HeadingProps extends React__default.ComponentPropsWithoutRef<'h1'> {
|
|
4
|
+
level?: '1' | '2' | '3';
|
|
5
|
+
mb?: number | string;
|
|
6
|
+
size?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const Heading: React__default.ForwardRefExoticComponent<HeadingProps & React__default.RefAttributes<HTMLHeadingElement>>;
|
|
9
|
+
|
|
10
|
+
export { Heading, type HeadingProps };
|
package/dist/heading.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { clsx } from 'clsx';
|
|
4
|
+
import { twMerge } from 'tailwind-merge';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
// src/heading.tsx
|
|
8
|
+
function cn(...inputs) {
|
|
9
|
+
return twMerge(clsx(inputs));
|
|
10
|
+
}
|
|
11
|
+
var LEVEL_TAG = { "1": "h1", "2": "h2", "3": "h3" };
|
|
12
|
+
var LEVEL_CLASSES = {
|
|
13
|
+
"1": "text-[18px] leading-[24px] font-medium lg:text-[32px] lg:leading-[40px] lg:tracking-[-0.5px]",
|
|
14
|
+
"2": "text-[16px] leading-[24px] font-medium lg:text-[24px] lg:leading-[32px]",
|
|
15
|
+
"3": "text-[14px] leading-[20px] font-semibold lg:text-[18px] lg:leading-[24px] lg:font-medium"
|
|
16
|
+
};
|
|
17
|
+
var BASE_CLASSES = "font-heading text-heading";
|
|
18
|
+
var Heading = React.forwardRef(
|
|
19
|
+
function Heading2({ level, className, mb, size: _size, style: styleProp, ...rest }, ref) {
|
|
20
|
+
const Tag = level ? LEVEL_TAG[level] : "h2";
|
|
21
|
+
const levelClasses = level ? LEVEL_CLASSES[level] : void 0;
|
|
22
|
+
const mergedStyle = mb !== void 0 ? { ...styleProp, marginBottom: typeof mb === "number" ? `${mb * 4}px` : mb } : styleProp;
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
Tag,
|
|
25
|
+
{
|
|
26
|
+
ref,
|
|
27
|
+
className: cn(BASE_CLASSES, levelClasses, className),
|
|
28
|
+
style: mergedStyle,
|
|
29
|
+
...rest
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export { Heading };
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var core = require('@hanzogui/core');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var clsx = require('clsx');
|
|
7
|
+
var tailwindMerge = require('tailwind-merge');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
|
|
10
|
+
function _interopNamespace(e) {
|
|
11
|
+
if (e && e.__esModule) return e;
|
|
12
|
+
var n = Object.create(null);
|
|
13
|
+
if (e) {
|
|
14
|
+
Object.keys(e).forEach(function (k) {
|
|
15
|
+
if (k !== 'default') {
|
|
16
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return e[k]; }
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
n.default = e;
|
|
25
|
+
return Object.freeze(n);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
29
|
+
|
|
30
|
+
// src/icon-button.tsx
|
|
31
|
+
function cn(...inputs) {
|
|
32
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
33
|
+
}
|
|
34
|
+
var SHIM_PROPS = [
|
|
35
|
+
"w",
|
|
36
|
+
"h",
|
|
37
|
+
"minW",
|
|
38
|
+
"maxW",
|
|
39
|
+
"display",
|
|
40
|
+
"flexGrow",
|
|
41
|
+
"flexShrink",
|
|
42
|
+
"flexBasis",
|
|
43
|
+
"fontWeight",
|
|
44
|
+
"textStyle",
|
|
45
|
+
"borderRadius",
|
|
46
|
+
"alignSelf",
|
|
47
|
+
"alignItems",
|
|
48
|
+
"justifyContent",
|
|
49
|
+
"color",
|
|
50
|
+
"mt",
|
|
51
|
+
"mb",
|
|
52
|
+
"ml",
|
|
53
|
+
"mr",
|
|
54
|
+
"height",
|
|
55
|
+
"overflow",
|
|
56
|
+
"whiteSpace",
|
|
57
|
+
"textOverflow",
|
|
58
|
+
"textTransform",
|
|
59
|
+
"gap",
|
|
60
|
+
"gridTemplateColumns",
|
|
61
|
+
"minWidth",
|
|
62
|
+
"boxSize",
|
|
63
|
+
"py",
|
|
64
|
+
"px",
|
|
65
|
+
"p",
|
|
66
|
+
"hideBelow",
|
|
67
|
+
"fontSize",
|
|
68
|
+
"flexWrap",
|
|
69
|
+
"wordBreak",
|
|
70
|
+
"lineHeight",
|
|
71
|
+
"marginRight",
|
|
72
|
+
"position",
|
|
73
|
+
"background"
|
|
74
|
+
];
|
|
75
|
+
var S = 4;
|
|
76
|
+
function dim(v) {
|
|
77
|
+
if (v == null) return void 0;
|
|
78
|
+
if (typeof v === "number") return `${v * S}px`;
|
|
79
|
+
if (typeof v === "string") return v;
|
|
80
|
+
if (typeof v === "object") {
|
|
81
|
+
const o = v;
|
|
82
|
+
return o.base ?? o.lg ?? o.xl ?? Object.values(o)[0];
|
|
83
|
+
}
|
|
84
|
+
return void 0;
|
|
85
|
+
}
|
|
86
|
+
function sp(v) {
|
|
87
|
+
if (v === void 0) return void 0;
|
|
88
|
+
return typeof v === "number" ? `${v * S}px` : v;
|
|
89
|
+
}
|
|
90
|
+
function shimToStyle(props) {
|
|
91
|
+
const s = {};
|
|
92
|
+
if (props.w !== void 0) s.width = dim(props.w);
|
|
93
|
+
if (props.h !== void 0) s.height = dim(props.h);
|
|
94
|
+
if (props.minW !== void 0) s.minWidth = dim(props.minW);
|
|
95
|
+
if (props.maxW !== void 0) s.maxWidth = dim(props.maxW);
|
|
96
|
+
if (props.display !== void 0) s.display = props.display;
|
|
97
|
+
if (props.flexGrow !== void 0) s.flexGrow = props.flexGrow;
|
|
98
|
+
if (props.flexShrink !== void 0) s.flexShrink = props.flexShrink;
|
|
99
|
+
if (props.flexBasis !== void 0) s.flexBasis = props.flexBasis;
|
|
100
|
+
if (props.fontWeight !== void 0) s.fontWeight = props.fontWeight;
|
|
101
|
+
if (props.borderRadius !== void 0) s.borderRadius = props.borderRadius;
|
|
102
|
+
if (props.alignSelf !== void 0) s.alignSelf = props.alignSelf;
|
|
103
|
+
if (props.alignItems !== void 0) s.alignItems = props.alignItems;
|
|
104
|
+
if (props.justifyContent !== void 0) s.justifyContent = props.justifyContent;
|
|
105
|
+
if (props.color !== void 0) s.color = props.color;
|
|
106
|
+
if (props.mt !== void 0) s.marginTop = sp(props.mt);
|
|
107
|
+
if (props.mb !== void 0) s.marginBottom = sp(props.mb);
|
|
108
|
+
if (props.ml !== void 0) s.marginLeft = sp(props.ml);
|
|
109
|
+
if (props.mr !== void 0) s.marginRight = sp(props.mr);
|
|
110
|
+
if (props.height !== void 0) s.height = props.height;
|
|
111
|
+
if (props.overflow !== void 0) s.overflow = props.overflow;
|
|
112
|
+
if (props.whiteSpace !== void 0) s.whiteSpace = props.whiteSpace;
|
|
113
|
+
if (props.textOverflow !== void 0) s.textOverflow = props.textOverflow;
|
|
114
|
+
if (props.textTransform !== void 0) s.textTransform = props.textTransform;
|
|
115
|
+
if (props.gap !== void 0) s.gap = sp(props.gap);
|
|
116
|
+
if (props.gridTemplateColumns !== void 0) s.gridTemplateColumns = props.gridTemplateColumns;
|
|
117
|
+
if (props.minWidth !== void 0) s.minWidth = props.minWidth;
|
|
118
|
+
if (props.boxSize !== void 0) {
|
|
119
|
+
const v = typeof props.boxSize === "number" ? `${props.boxSize * S}px` : props.boxSize;
|
|
120
|
+
s.width = v;
|
|
121
|
+
s.height = v;
|
|
122
|
+
}
|
|
123
|
+
if (props.py !== void 0) {
|
|
124
|
+
const v = sp(props.py);
|
|
125
|
+
s.paddingTop = v;
|
|
126
|
+
s.paddingBottom = v;
|
|
127
|
+
}
|
|
128
|
+
if (props.px !== void 0) {
|
|
129
|
+
const v = sp(props.px);
|
|
130
|
+
s.paddingLeft = v;
|
|
131
|
+
s.paddingRight = v;
|
|
132
|
+
}
|
|
133
|
+
if (props.p !== void 0) s.padding = sp(props.p);
|
|
134
|
+
if (props.fontSize !== void 0) s.fontSize = props.fontSize;
|
|
135
|
+
if (props.flexWrap !== void 0) s.flexWrap = props.flexWrap;
|
|
136
|
+
if (props.wordBreak !== void 0) s.wordBreak = props.wordBreak;
|
|
137
|
+
if (props.lineHeight !== void 0) s.lineHeight = props.lineHeight;
|
|
138
|
+
if (props.marginRight !== void 0) s.marginRight = props.marginRight;
|
|
139
|
+
if (props.position !== void 0) s.position = props.position;
|
|
140
|
+
if (props.background !== void 0) s.background = props.background;
|
|
141
|
+
return s;
|
|
142
|
+
}
|
|
143
|
+
function stripShims(props) {
|
|
144
|
+
const out = { ...props };
|
|
145
|
+
for (const k of SHIM_PROPS) delete out[k];
|
|
146
|
+
return out;
|
|
147
|
+
}
|
|
148
|
+
var SKELETON_CLASSES = [
|
|
149
|
+
"animate-skeleton-shimmer rounded-sm",
|
|
150
|
+
"bg-[linear-gradient(90deg,var(--color-skeleton-start)_0%,var(--color-skeleton-end)_50%,var(--color-skeleton-start)_100%)]",
|
|
151
|
+
"bg-[length:200%_100%]"
|
|
152
|
+
].join(" ");
|
|
153
|
+
var HIDE_BELOW_MAP = { lg: "lg:hidden", md: "md:hidden", sm: "sm:hidden" };
|
|
154
|
+
var Skeleton = React__namespace.forwardRef(
|
|
155
|
+
function Skeleton2(props, ref) {
|
|
156
|
+
const { loading = false, asChild, className, children, style: styleProp, as: Component = "div", ...allRest } = props;
|
|
157
|
+
const shimStyle = shimToStyle(props);
|
|
158
|
+
const mergedStyle = Object.keys(shimStyle).length > 0 || styleProp ? { ...shimStyle, ...styleProp } : void 0;
|
|
159
|
+
const hideBelowClass = props.hideBelow ? HIDE_BELOW_MAP[props.hideBelow] : void 0;
|
|
160
|
+
const cls = hideBelowClass ? cn(className, hideBelowClass) : className;
|
|
161
|
+
const htmlRest = stripShims(allRest);
|
|
162
|
+
if (!loading) {
|
|
163
|
+
if (asChild && React__namespace.isValidElement(children)) return children;
|
|
164
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ref, className: cls, style: mergedStyle, ...htmlRest, children });
|
|
165
|
+
}
|
|
166
|
+
if (asChild && React__namespace.isValidElement(children)) {
|
|
167
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
168
|
+
Component,
|
|
169
|
+
{
|
|
170
|
+
ref,
|
|
171
|
+
"data-loading": true,
|
|
172
|
+
className: cn(SKELETON_CLASSES, "text-transparent [&_*]:invisible", cls),
|
|
173
|
+
style: mergedStyle,
|
|
174
|
+
...htmlRest,
|
|
175
|
+
children
|
|
176
|
+
}
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
180
|
+
Component,
|
|
181
|
+
{
|
|
182
|
+
ref,
|
|
183
|
+
"data-loading": true,
|
|
184
|
+
className: cn(SKELETON_CLASSES, children ? "text-transparent [&_*]:invisible" : "min-h-5", cls),
|
|
185
|
+
style: mergedStyle,
|
|
186
|
+
...htmlRest,
|
|
187
|
+
children
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
);
|
|
192
|
+
React__namespace.forwardRef(
|
|
193
|
+
function SkeletonCircle2(props, ref) {
|
|
194
|
+
const { size = 40, loading = true, className, ...rest } = props;
|
|
195
|
+
const dimension = typeof size === "number" ? `${size}px` : size;
|
|
196
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
197
|
+
Skeleton,
|
|
198
|
+
{
|
|
199
|
+
ref,
|
|
200
|
+
loading,
|
|
201
|
+
className: cn("rounded-full shrink-0", className),
|
|
202
|
+
style: { width: dimension, height: dimension, ...rest.style },
|
|
203
|
+
...rest
|
|
204
|
+
}
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
);
|
|
208
|
+
React__namespace.forwardRef(
|
|
209
|
+
function SkeletonText2(props, ref) {
|
|
210
|
+
const { noOfLines = 3, loading = true, className, ...rest } = props;
|
|
211
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("flex w-full flex-col gap-2", className), ...rest, children: Array.from({ length: noOfLines }).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
212
|
+
Skeleton,
|
|
213
|
+
{
|
|
214
|
+
loading,
|
|
215
|
+
className: cn("h-4", index === noOfLines - 1 && "max-w-[80%]")
|
|
216
|
+
},
|
|
217
|
+
index
|
|
218
|
+
)) });
|
|
219
|
+
}
|
|
220
|
+
);
|
|
221
|
+
var IconButtonFrame = core.styled(core.View, {
|
|
222
|
+
name: "LuxIconButton",
|
|
223
|
+
render: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button" }),
|
|
224
|
+
role: "button",
|
|
225
|
+
cursor: "pointer",
|
|
226
|
+
display: "inline-flex",
|
|
227
|
+
alignItems: "center",
|
|
228
|
+
justifyContent: "center",
|
|
229
|
+
padding: 0,
|
|
230
|
+
minWidth: "auto",
|
|
231
|
+
flexShrink: 1,
|
|
232
|
+
backgroundColor: "transparent",
|
|
233
|
+
borderWidth: 0,
|
|
234
|
+
variants: {
|
|
235
|
+
size: {
|
|
236
|
+
"2xs": { width: 20, height: 20, borderRadius: 4 },
|
|
237
|
+
"2xs_alt": { width: 20, height: 20, borderRadius: 4 },
|
|
238
|
+
md: { width: 32, height: 32, borderRadius: "var(--radius-base, 8px)" }
|
|
239
|
+
},
|
|
240
|
+
disabled: {
|
|
241
|
+
true: {
|
|
242
|
+
opacity: 0.4,
|
|
243
|
+
cursor: "not-allowed",
|
|
244
|
+
pointerEvents: "none"
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
var VARIANT_CLASSES = {
|
|
250
|
+
plain: "bg-transparent text-inherit border-none hover:bg-transparent",
|
|
251
|
+
icon_secondary: [
|
|
252
|
+
"bg-transparent text-icon-secondary border-none",
|
|
253
|
+
"hover:text-hover",
|
|
254
|
+
"data-[selected]:bg-selected-control-bg data-[selected]:text-selected-control-text",
|
|
255
|
+
"data-[selected]:hover:text-hover",
|
|
256
|
+
"data-[expanded]:text-hover"
|
|
257
|
+
].join(" "),
|
|
258
|
+
icon_background: [
|
|
259
|
+
"bg-[var(--color-button-icon-background-bg)] text-icon-secondary border-none",
|
|
260
|
+
"hover:text-hover",
|
|
261
|
+
"data-[selected]:bg-selected-control-bg data-[selected]:text-selected-control-text",
|
|
262
|
+
"data-[selected]:hover:text-hover",
|
|
263
|
+
"data-[expanded]:text-hover"
|
|
264
|
+
].join(" "),
|
|
265
|
+
link: [
|
|
266
|
+
"bg-transparent text-link-primary border-none font-normal px-0 h-auto",
|
|
267
|
+
"hover:bg-transparent hover:text-link-primary-hover",
|
|
268
|
+
"disabled:text-text-secondary"
|
|
269
|
+
].join(" "),
|
|
270
|
+
dropdown: [
|
|
271
|
+
"border-2 border-solid bg-transparent",
|
|
272
|
+
"text-[var(--color-button-dropdown-fg)] border-[var(--color-button-dropdown-border)]",
|
|
273
|
+
"hover:bg-transparent hover:text-hover hover:border-hover",
|
|
274
|
+
"data-[expanded]:bg-transparent data-[expanded]:text-hover data-[expanded]:border-hover",
|
|
275
|
+
"data-[selected]:bg-selected-control-bg data-[selected]:text-selected-control-text data-[selected]:border-transparent",
|
|
276
|
+
"data-[selected]:hover:text-hover"
|
|
277
|
+
].join(" "),
|
|
278
|
+
pagination: [
|
|
279
|
+
"border-2 border-solid bg-transparent",
|
|
280
|
+
"text-[var(--color-button-pagination-fg)] border-[var(--color-button-pagination-border)]",
|
|
281
|
+
"hover:bg-transparent hover:text-hover hover:border-hover",
|
|
282
|
+
"data-[selected]:bg-selected-control-bg data-[selected]:text-selected-control-text data-[selected]:border-transparent"
|
|
283
|
+
].join(" ")
|
|
284
|
+
};
|
|
285
|
+
var ICON_SIZE_CLASSES = {
|
|
286
|
+
"2xs": "[&_svg]:size-5",
|
|
287
|
+
"2xs_alt": "[&_svg]:size-3",
|
|
288
|
+
md: "[&_svg]:size-5"
|
|
289
|
+
};
|
|
290
|
+
var SP = 4;
|
|
291
|
+
var IconButton = React__namespace.forwardRef(
|
|
292
|
+
function IconButton2(props, ref) {
|
|
293
|
+
const {
|
|
294
|
+
size,
|
|
295
|
+
variant = "plain",
|
|
296
|
+
loading,
|
|
297
|
+
loadingSkeleton = false,
|
|
298
|
+
expanded,
|
|
299
|
+
selected,
|
|
300
|
+
highlighted,
|
|
301
|
+
disabled,
|
|
302
|
+
className,
|
|
303
|
+
children,
|
|
304
|
+
as: _as,
|
|
305
|
+
style: styleProp,
|
|
306
|
+
// Strip Chakra style props
|
|
307
|
+
boxSize: _boxSize,
|
|
308
|
+
color: _color,
|
|
309
|
+
px: _px,
|
|
310
|
+
borderRadius: _borderRadius,
|
|
311
|
+
ml: _ml,
|
|
312
|
+
mr: _mr,
|
|
313
|
+
_hover,
|
|
314
|
+
_expanded,
|
|
315
|
+
...rest
|
|
316
|
+
} = props;
|
|
317
|
+
const shimStyle = { ...styleProp };
|
|
318
|
+
if (_boxSize !== void 0) {
|
|
319
|
+
const bs = typeof _boxSize === "number" ? `${_boxSize * SP}px` : _boxSize;
|
|
320
|
+
shimStyle.width = bs;
|
|
321
|
+
shimStyle.height = bs;
|
|
322
|
+
}
|
|
323
|
+
if (_color) shimStyle.color = _color;
|
|
324
|
+
if (_px !== void 0) {
|
|
325
|
+
const v = typeof _px === "number" ? `${_px * SP}px` : _px;
|
|
326
|
+
shimStyle.paddingLeft = v;
|
|
327
|
+
shimStyle.paddingRight = v;
|
|
328
|
+
}
|
|
329
|
+
if (_borderRadius) shimStyle.borderRadius = _borderRadius;
|
|
330
|
+
if (_ml !== void 0) shimStyle.marginLeft = typeof _ml === "number" ? `${_ml * SP}px` : _ml;
|
|
331
|
+
if (_mr !== void 0) shimStyle.marginRight = typeof _mr === "number" ? `${_mr * SP}px` : _mr;
|
|
332
|
+
const mergedStyle = Object.keys(shimStyle).length > 0 ? shimStyle : void 0;
|
|
333
|
+
const variantClass = VARIANT_CLASSES[variant] ?? VARIANT_CLASSES.plain;
|
|
334
|
+
const iconSizeClass = size ? ICON_SIZE_CLASSES[size] ?? "" : "";
|
|
335
|
+
const combinedClassName = [variantClass, iconSizeClass, className].filter(Boolean).join(" ");
|
|
336
|
+
const button = /* @__PURE__ */ jsxRuntime.jsx(
|
|
337
|
+
IconButtonFrame,
|
|
338
|
+
{
|
|
339
|
+
ref,
|
|
340
|
+
size,
|
|
341
|
+
disabled: !loadingSkeleton && (loading || disabled) || void 0,
|
|
342
|
+
render: _as ? React__namespace.createElement(_as) : void 0,
|
|
343
|
+
className: combinedClassName,
|
|
344
|
+
style: mergedStyle,
|
|
345
|
+
...expanded ? { "data-expanded": true } : {},
|
|
346
|
+
...selected ? { "data-selected": true } : {},
|
|
347
|
+
...highlighted ? { "data-highlighted": true } : {},
|
|
348
|
+
...loadingSkeleton ? { "data-loading-skeleton": true } : {},
|
|
349
|
+
...rest,
|
|
350
|
+
children: loading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
351
|
+
"span",
|
|
352
|
+
{
|
|
353
|
+
className: "inline-block size-5 animate-spin rounded-full border-2 border-current border-b-transparent border-l-transparent",
|
|
354
|
+
role: "status",
|
|
355
|
+
"aria-label": "Loading"
|
|
356
|
+
}
|
|
357
|
+
) : children
|
|
358
|
+
}
|
|
359
|
+
);
|
|
360
|
+
if (loadingSkeleton) {
|
|
361
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { loading: loadingSkeleton, asChild: true, ref, children: button });
|
|
362
|
+
}
|
|
363
|
+
return button;
|
|
364
|
+
}
|
|
365
|
+
);
|
|
366
|
+
|
|
367
|
+
exports.IconButton = IconButton;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type Variant = 'plain' | 'icon_secondary' | 'icon_background' | 'link' | 'dropdown' | 'pagination';
|
|
4
|
+
type Size = '2xs' | '2xs_alt' | 'md';
|
|
5
|
+
interface IconButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'size'> {
|
|
6
|
+
/** Visual variant */
|
|
7
|
+
variant?: Variant;
|
|
8
|
+
/** Icon-button size */
|
|
9
|
+
size?: Size;
|
|
10
|
+
/** Show a loading spinner (disables button) */
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
/** Render a skeleton placeholder instead of the button */
|
|
13
|
+
loadingSkeleton?: boolean;
|
|
14
|
+
/** Maps to data-expanded for popover trigger styling */
|
|
15
|
+
expanded?: boolean;
|
|
16
|
+
/** Maps to data-selected for toggle styling */
|
|
17
|
+
selected?: boolean;
|
|
18
|
+
/** Maps to data-highlighted */
|
|
19
|
+
highlighted?: boolean;
|
|
20
|
+
/** Polymorphic element type (e.g. "div") */
|
|
21
|
+
as?: React.ElementType;
|
|
22
|
+
boxSize?: number | string;
|
|
23
|
+
color?: string;
|
|
24
|
+
px?: string | number;
|
|
25
|
+
borderRadius?: string;
|
|
26
|
+
ml?: number | string;
|
|
27
|
+
mr?: number | string;
|
|
28
|
+
_hover?: Record<string, string>;
|
|
29
|
+
_expanded?: Record<string, string>;
|
|
30
|
+
}
|
|
31
|
+
declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
32
|
+
|
|
33
|
+
export { IconButton, type IconButtonProps };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type Variant = 'plain' | 'icon_secondary' | 'icon_background' | 'link' | 'dropdown' | 'pagination';
|
|
4
|
+
type Size = '2xs' | '2xs_alt' | 'md';
|
|
5
|
+
interface IconButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'size'> {
|
|
6
|
+
/** Visual variant */
|
|
7
|
+
variant?: Variant;
|
|
8
|
+
/** Icon-button size */
|
|
9
|
+
size?: Size;
|
|
10
|
+
/** Show a loading spinner (disables button) */
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
/** Render a skeleton placeholder instead of the button */
|
|
13
|
+
loadingSkeleton?: boolean;
|
|
14
|
+
/** Maps to data-expanded for popover trigger styling */
|
|
15
|
+
expanded?: boolean;
|
|
16
|
+
/** Maps to data-selected for toggle styling */
|
|
17
|
+
selected?: boolean;
|
|
18
|
+
/** Maps to data-highlighted */
|
|
19
|
+
highlighted?: boolean;
|
|
20
|
+
/** Polymorphic element type (e.g. "div") */
|
|
21
|
+
as?: React.ElementType;
|
|
22
|
+
boxSize?: number | string;
|
|
23
|
+
color?: string;
|
|
24
|
+
px?: string | number;
|
|
25
|
+
borderRadius?: string;
|
|
26
|
+
ml?: number | string;
|
|
27
|
+
mr?: number | string;
|
|
28
|
+
_hover?: Record<string, string>;
|
|
29
|
+
_expanded?: Record<string, string>;
|
|
30
|
+
}
|
|
31
|
+
declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
32
|
+
|
|
33
|
+
export { IconButton, type IconButtonProps };
|