@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.
- package/dist/alert.cjs +162 -285
- package/dist/alert.js +162 -285
- package/dist/badge.cjs +162 -321
- package/dist/badge.d.cts +3 -7
- package/dist/badge.d.ts +3 -7
- package/dist/badge.js +162 -320
- package/dist/button.cjs +373 -484
- package/dist/button.d.cts +10 -7
- package/dist/button.d.ts +10 -7
- package/dist/button.js +373 -484
- package/dist/close-button.cjs +37 -18
- package/dist/close-button.d.cts +1 -1
- package/dist/close-button.d.ts +1 -1
- package/dist/close-button.js +37 -18
- package/dist/collapsible.cjs +125 -272
- package/dist/collapsible.js +125 -272
- package/dist/dialog.cjs +60 -44
- package/dist/dialog.d.cts +7 -8
- package/dist/dialog.d.ts +7 -8
- package/dist/dialog.js +60 -43
- package/dist/drawer.cjs +37 -13
- package/dist/drawer.js +37 -13
- package/dist/heading.cjs +3 -8
- package/dist/heading.js +3 -8
- package/dist/icon-button.cjs +213 -337
- package/dist/icon-button.d.cts +4 -4
- package/dist/icon-button.d.ts +4 -4
- package/dist/icon-button.js +213 -338
- package/dist/image.cjs +125 -272
- package/dist/image.js +125 -272
- package/dist/index.cjs +604 -700
- package/dist/index.d.cts +0 -3
- package/dist/index.d.ts +0 -3
- package/dist/index.js +604 -698
- package/dist/link.cjs +125 -272
- package/dist/link.js +125 -272
- package/dist/popover.cjs +55 -40
- package/dist/popover.js +55 -39
- package/dist/select.cjs +125 -272
- package/dist/select.js +125 -272
- package/dist/skeleton.cjs +125 -272
- package/dist/skeleton.js +125 -272
- package/dist/table.cjs +127 -274
- package/dist/table.js +127 -274
- package/dist/tag.cjs +184 -306
- package/dist/tag.js +184 -305
- package/dist/tooltip.cjs +22 -21
- package/dist/tooltip.d.cts +2 -3
- package/dist/tooltip.d.ts +2 -3
- package/dist/tooltip.js +22 -20
- package/package.json +9 -7
- package/src/badge.tsx +20 -31
- package/src/button.tsx +304 -238
- package/src/close-button.tsx +48 -22
- package/src/dialog.tsx +37 -47
- package/src/heading.tsx +8 -19
- package/src/icon-button.tsx +129 -104
- package/src/popover.tsx +30 -44
- package/src/skeleton.tsx +96 -144
- package/src/tooltip.tsx +54 -47
package/dist/tag.js
CHANGED
|
@@ -3,8 +3,9 @@ import { cva } from 'class-variance-authority';
|
|
|
3
3
|
import * as React3 from 'react';
|
|
4
4
|
import { clsx } from 'clsx';
|
|
5
5
|
import { twMerge } from 'tailwind-merge';
|
|
6
|
+
import { styled, View } from '@hanzogui/core';
|
|
6
7
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
|
-
import
|
|
8
|
+
import { TooltipGroup, Tooltip as Tooltip$1 } from '@hanzogui/tooltip';
|
|
8
9
|
import { useClickAway } from '@uidotdev/usehooks';
|
|
9
10
|
|
|
10
11
|
// src/tag.tsx
|
|
@@ -12,24 +13,47 @@ function cn(...inputs) {
|
|
|
12
13
|
return twMerge(clsx(inputs));
|
|
13
14
|
}
|
|
14
15
|
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";
|
|
16
|
+
var CloseButtonFrame = styled(View, {
|
|
17
|
+
name: "LuxCloseButton",
|
|
18
|
+
render: /* @__PURE__ */ jsx("button", { type: "button", "aria-label": "Close" }),
|
|
19
|
+
role: "button",
|
|
20
|
+
cursor: "pointer",
|
|
21
|
+
display: "inline-flex",
|
|
22
|
+
alignItems: "center",
|
|
23
|
+
justifyContent: "center",
|
|
24
|
+
width: 20,
|
|
25
|
+
height: 20,
|
|
26
|
+
minWidth: 0,
|
|
27
|
+
flexShrink: 1,
|
|
28
|
+
padding: 0,
|
|
29
|
+
borderRadius: 4,
|
|
30
|
+
borderWidth: 0,
|
|
31
|
+
overflow: "hidden",
|
|
32
|
+
backgroundColor: "transparent",
|
|
33
|
+
hoverStyle: {
|
|
34
|
+
backgroundColor: "transparent"
|
|
35
|
+
},
|
|
36
|
+
variants: {
|
|
37
|
+
disabled: {
|
|
38
|
+
true: {
|
|
39
|
+
opacity: 0.4,
|
|
40
|
+
pointerEvents: "none"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
var CLOSE_BUTTON_CLASSES = [
|
|
46
|
+
"text-[var(--closeButton-fg,currentColor)]",
|
|
47
|
+
"hover:text-[var(--hover-color,currentColor)]",
|
|
48
|
+
"disabled:opacity-40"
|
|
49
|
+
].join(" ");
|
|
15
50
|
var CloseButton = React3.forwardRef(function CloseButton2(props, ref) {
|
|
16
51
|
const { variant: _variant, size: _size, className, children, ...rest } = props;
|
|
17
52
|
return /* @__PURE__ */ jsx(
|
|
18
|
-
|
|
53
|
+
CloseButtonFrame,
|
|
19
54
|
{
|
|
20
|
-
type: "button",
|
|
21
|
-
"aria-label": "Close",
|
|
22
55
|
ref,
|
|
23
|
-
className:
|
|
24
|
-
"inline-flex items-center justify-center",
|
|
25
|
-
"size-5 min-w-0 shrink-0 p-0",
|
|
26
|
-
"rounded-sm border-0 overflow-hidden",
|
|
27
|
-
"bg-transparent text-[var(--closeButton-fg,currentColor)]",
|
|
28
|
-
"hover:bg-transparent hover:text-[var(--hover-color,currentColor)]",
|
|
29
|
-
"disabled:opacity-40",
|
|
30
|
-
"cursor-pointer",
|
|
31
|
-
className
|
|
32
|
-
),
|
|
56
|
+
className: [CLOSE_BUTTON_CLASSES, className].filter(Boolean).join(" "),
|
|
33
57
|
...rest,
|
|
34
58
|
children: children ?? /* @__PURE__ */ jsx(
|
|
35
59
|
"svg",
|
|
@@ -50,272 +74,137 @@ var CloseButton = React3.forwardRef(function CloseButton2(props, ref) {
|
|
|
50
74
|
}
|
|
51
75
|
);
|
|
52
76
|
});
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
77
|
+
var SHIM_PROPS = [
|
|
78
|
+
"w",
|
|
79
|
+
"h",
|
|
80
|
+
"minW",
|
|
81
|
+
"maxW",
|
|
82
|
+
"display",
|
|
83
|
+
"flexGrow",
|
|
84
|
+
"flexShrink",
|
|
85
|
+
"flexBasis",
|
|
86
|
+
"fontWeight",
|
|
87
|
+
"textStyle",
|
|
88
|
+
"borderRadius",
|
|
89
|
+
"alignSelf",
|
|
90
|
+
"alignItems",
|
|
91
|
+
"justifyContent",
|
|
92
|
+
"color",
|
|
93
|
+
"mt",
|
|
94
|
+
"mb",
|
|
95
|
+
"ml",
|
|
96
|
+
"mr",
|
|
97
|
+
"height",
|
|
98
|
+
"overflow",
|
|
99
|
+
"whiteSpace",
|
|
100
|
+
"textOverflow",
|
|
101
|
+
"textTransform",
|
|
102
|
+
"gap",
|
|
103
|
+
"gridTemplateColumns",
|
|
104
|
+
"minWidth",
|
|
105
|
+
"boxSize",
|
|
106
|
+
"py",
|
|
107
|
+
"px",
|
|
108
|
+
"p",
|
|
109
|
+
"hideBelow",
|
|
110
|
+
"fontSize",
|
|
111
|
+
"flexWrap",
|
|
112
|
+
"wordBreak",
|
|
113
|
+
"lineHeight",
|
|
114
|
+
"marginRight",
|
|
115
|
+
"position",
|
|
116
|
+
"background"
|
|
117
|
+
];
|
|
118
|
+
var S = 4;
|
|
119
|
+
function dim(v) {
|
|
120
|
+
if (v == null) return void 0;
|
|
121
|
+
if (typeof v === "number") return `${v * S}px`;
|
|
122
|
+
if (typeof v === "string") return v;
|
|
123
|
+
if (typeof v === "object") {
|
|
124
|
+
const o = v;
|
|
125
|
+
return o.base ?? o.lg ?? o.xl ?? Object.values(o)[0];
|
|
126
|
+
}
|
|
127
|
+
return void 0;
|
|
58
128
|
}
|
|
59
|
-
function
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
129
|
+
function sp(v) {
|
|
130
|
+
if (v === void 0) return void 0;
|
|
131
|
+
return typeof v === "number" ? `${v * S}px` : v;
|
|
132
|
+
}
|
|
133
|
+
function shimToStyle(props) {
|
|
134
|
+
const s = {};
|
|
135
|
+
if (props.w !== void 0) s.width = dim(props.w);
|
|
136
|
+
if (props.h !== void 0) s.height = dim(props.h);
|
|
137
|
+
if (props.minW !== void 0) s.minWidth = dim(props.minW);
|
|
138
|
+
if (props.maxW !== void 0) s.maxWidth = dim(props.maxW);
|
|
139
|
+
if (props.display !== void 0) s.display = props.display;
|
|
140
|
+
if (props.flexGrow !== void 0) s.flexGrow = props.flexGrow;
|
|
141
|
+
if (props.flexShrink !== void 0) s.flexShrink = props.flexShrink;
|
|
142
|
+
if (props.flexBasis !== void 0) s.flexBasis = props.flexBasis;
|
|
143
|
+
if (props.fontWeight !== void 0) s.fontWeight = props.fontWeight;
|
|
144
|
+
if (props.borderRadius !== void 0) s.borderRadius = props.borderRadius;
|
|
145
|
+
if (props.alignSelf !== void 0) s.alignSelf = props.alignSelf;
|
|
146
|
+
if (props.alignItems !== void 0) s.alignItems = props.alignItems;
|
|
147
|
+
if (props.justifyContent !== void 0) s.justifyContent = props.justifyContent;
|
|
148
|
+
if (props.color !== void 0) s.color = props.color;
|
|
149
|
+
if (props.mt !== void 0) s.marginTop = sp(props.mt);
|
|
150
|
+
if (props.mb !== void 0) s.marginBottom = sp(props.mb);
|
|
151
|
+
if (props.ml !== void 0) s.marginLeft = sp(props.ml);
|
|
152
|
+
if (props.mr !== void 0) s.marginRight = sp(props.mr);
|
|
153
|
+
if (props.height !== void 0) s.height = props.height;
|
|
154
|
+
if (props.overflow !== void 0) s.overflow = props.overflow;
|
|
155
|
+
if (props.whiteSpace !== void 0) s.whiteSpace = props.whiteSpace;
|
|
156
|
+
if (props.textOverflow !== void 0) s.textOverflow = props.textOverflow;
|
|
157
|
+
if (props.textTransform !== void 0) s.textTransform = props.textTransform;
|
|
158
|
+
if (props.gap !== void 0) s.gap = sp(props.gap);
|
|
159
|
+
if (props.gridTemplateColumns !== void 0) s.gridTemplateColumns = props.gridTemplateColumns;
|
|
160
|
+
if (props.minWidth !== void 0) s.minWidth = props.minWidth;
|
|
161
|
+
if (props.boxSize !== void 0) {
|
|
162
|
+
const v = typeof props.boxSize === "number" ? `${props.boxSize * S}px` : props.boxSize;
|
|
163
|
+
s.width = v;
|
|
164
|
+
s.height = v;
|
|
71
165
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const v = resolveDimension(value);
|
|
82
|
-
if (v) style.height = v;
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
case "minW": {
|
|
86
|
-
const v = resolveDimension(value);
|
|
87
|
-
if (v) style.minWidth = v;
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
case "maxW": {
|
|
91
|
-
const v = resolveDimension(value);
|
|
92
|
-
if (v) style.maxWidth = v;
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
case "height":
|
|
96
|
-
style.height = value;
|
|
97
|
-
break;
|
|
98
|
-
case "display":
|
|
99
|
-
style.display = value;
|
|
100
|
-
break;
|
|
101
|
-
case "flexGrow":
|
|
102
|
-
style.flexGrow = value;
|
|
103
|
-
break;
|
|
104
|
-
case "flexShrink":
|
|
105
|
-
style.flexShrink = value;
|
|
106
|
-
break;
|
|
107
|
-
case "flexBasis":
|
|
108
|
-
style.flexBasis = value;
|
|
109
|
-
break;
|
|
110
|
-
case "fontWeight":
|
|
111
|
-
style.fontWeight = value;
|
|
112
|
-
break;
|
|
113
|
-
case "borderRadius":
|
|
114
|
-
style.borderRadius = value;
|
|
115
|
-
break;
|
|
116
|
-
case "alignSelf":
|
|
117
|
-
style.alignSelf = value;
|
|
118
|
-
break;
|
|
119
|
-
case "alignItems":
|
|
120
|
-
style.alignItems = value;
|
|
121
|
-
break;
|
|
122
|
-
case "justifyContent":
|
|
123
|
-
style.justifyContent = value;
|
|
124
|
-
break;
|
|
125
|
-
case "color":
|
|
126
|
-
style.color = value;
|
|
127
|
-
break;
|
|
128
|
-
case "mt":
|
|
129
|
-
style.marginTop = toStylePx(value);
|
|
130
|
-
break;
|
|
131
|
-
case "mb":
|
|
132
|
-
style.marginBottom = toStylePx(value);
|
|
133
|
-
break;
|
|
134
|
-
case "ml":
|
|
135
|
-
style.marginLeft = toStylePx(value);
|
|
136
|
-
break;
|
|
137
|
-
case "mr":
|
|
138
|
-
style.marginRight = toStylePx(value);
|
|
139
|
-
break;
|
|
140
|
-
case "overflow":
|
|
141
|
-
style.overflow = value;
|
|
142
|
-
break;
|
|
143
|
-
case "whiteSpace":
|
|
144
|
-
style.whiteSpace = value;
|
|
145
|
-
break;
|
|
146
|
-
case "textOverflow":
|
|
147
|
-
style.textOverflow = value;
|
|
148
|
-
break;
|
|
149
|
-
case "textTransform":
|
|
150
|
-
style.textTransform = value;
|
|
151
|
-
break;
|
|
152
|
-
case "gap":
|
|
153
|
-
style.gap = typeof value === "number" ? `${value * SPACING_SCALE}px` : value;
|
|
154
|
-
break;
|
|
155
|
-
case "gridTemplateColumns":
|
|
156
|
-
style.gridTemplateColumns = value;
|
|
157
|
-
break;
|
|
158
|
-
case "minWidth":
|
|
159
|
-
style.minWidth = value;
|
|
160
|
-
break;
|
|
161
|
-
case "boxSize": {
|
|
162
|
-
const s = typeof value === "number" ? `${value * SPACING_SCALE}px` : value;
|
|
163
|
-
style.width = s;
|
|
164
|
-
style.height = s;
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
case "py": {
|
|
168
|
-
const v = toStylePx(value);
|
|
169
|
-
style.paddingTop = v;
|
|
170
|
-
style.paddingBottom = v;
|
|
171
|
-
break;
|
|
172
|
-
}
|
|
173
|
-
case "px": {
|
|
174
|
-
const v = toStylePx(value);
|
|
175
|
-
style.paddingLeft = v;
|
|
176
|
-
style.paddingRight = v;
|
|
177
|
-
break;
|
|
178
|
-
}
|
|
179
|
-
case "p": {
|
|
180
|
-
const v = toStylePx(value);
|
|
181
|
-
style.padding = v;
|
|
182
|
-
break;
|
|
183
|
-
}
|
|
184
|
-
case "hideBelow":
|
|
185
|
-
break;
|
|
186
|
-
// handled via className
|
|
187
|
-
case "textStyle":
|
|
188
|
-
break;
|
|
189
|
-
// drop textStyle, not directly applicable
|
|
190
|
-
case "fontSize":
|
|
191
|
-
style.fontSize = value;
|
|
192
|
-
break;
|
|
193
|
-
case "flexWrap":
|
|
194
|
-
style.flexWrap = value;
|
|
195
|
-
break;
|
|
196
|
-
case "wordBreak":
|
|
197
|
-
style.wordBreak = value;
|
|
198
|
-
break;
|
|
199
|
-
case "lineHeight":
|
|
200
|
-
style.lineHeight = value;
|
|
201
|
-
break;
|
|
202
|
-
case "marginRight":
|
|
203
|
-
style.marginRight = value;
|
|
204
|
-
break;
|
|
205
|
-
case "position":
|
|
206
|
-
style.position = value;
|
|
207
|
-
break;
|
|
208
|
-
case "background":
|
|
209
|
-
style.background = value;
|
|
210
|
-
break;
|
|
211
|
-
default:
|
|
212
|
-
rest[key] = value;
|
|
213
|
-
break;
|
|
214
|
-
}
|
|
166
|
+
if (props.py !== void 0) {
|
|
167
|
+
const v = sp(props.py);
|
|
168
|
+
s.paddingTop = v;
|
|
169
|
+
s.paddingBottom = v;
|
|
170
|
+
}
|
|
171
|
+
if (props.px !== void 0) {
|
|
172
|
+
const v = sp(props.px);
|
|
173
|
+
s.paddingLeft = v;
|
|
174
|
+
s.paddingRight = v;
|
|
215
175
|
}
|
|
216
|
-
|
|
176
|
+
if (props.p !== void 0) s.padding = sp(props.p);
|
|
177
|
+
if (props.fontSize !== void 0) s.fontSize = props.fontSize;
|
|
178
|
+
if (props.flexWrap !== void 0) s.flexWrap = props.flexWrap;
|
|
179
|
+
if (props.wordBreak !== void 0) s.wordBreak = props.wordBreak;
|
|
180
|
+
if (props.lineHeight !== void 0) s.lineHeight = props.lineHeight;
|
|
181
|
+
if (props.marginRight !== void 0) s.marginRight = props.marginRight;
|
|
182
|
+
if (props.position !== void 0) s.position = props.position;
|
|
183
|
+
if (props.background !== void 0) s.background = props.background;
|
|
184
|
+
return s;
|
|
217
185
|
}
|
|
186
|
+
function stripShims(props) {
|
|
187
|
+
const out = { ...props };
|
|
188
|
+
for (const k of SHIM_PROPS) delete out[k];
|
|
189
|
+
return out;
|
|
190
|
+
}
|
|
191
|
+
var SKELETON_CLASSES = [
|
|
192
|
+
"animate-skeleton-shimmer rounded-sm",
|
|
193
|
+
"bg-[linear-gradient(90deg,var(--color-skeleton-start)_0%,var(--color-skeleton-end)_50%,var(--color-skeleton-start)_100%)]",
|
|
194
|
+
"bg-[length:200%_100%]"
|
|
195
|
+
].join(" ");
|
|
196
|
+
var HIDE_BELOW_MAP = { lg: "lg:hidden", md: "md:hidden", sm: "sm:hidden" };
|
|
218
197
|
var Skeleton = React3.forwardRef(
|
|
219
198
|
function Skeleton2(props, ref) {
|
|
220
|
-
const {
|
|
221
|
-
|
|
222
|
-
asChild,
|
|
223
|
-
className,
|
|
224
|
-
children,
|
|
225
|
-
style: styleProp,
|
|
226
|
-
// Destructure style-prop shims so they don't leak into DOM
|
|
227
|
-
w: _w,
|
|
228
|
-
h: _h,
|
|
229
|
-
minW: _minW,
|
|
230
|
-
maxW: _maxW,
|
|
231
|
-
display: _display,
|
|
232
|
-
flexGrow: _flexGrow,
|
|
233
|
-
flexShrink: _flexShrink,
|
|
234
|
-
flexBasis: _flexBasis,
|
|
235
|
-
fontWeight: _fontWeight,
|
|
236
|
-
textStyle: _textStyle,
|
|
237
|
-
borderRadius: _borderRadius,
|
|
238
|
-
alignSelf: _alignSelf,
|
|
239
|
-
alignItems: _alignItems,
|
|
240
|
-
justifyContent: _justifyContent,
|
|
241
|
-
color: _color,
|
|
242
|
-
mt: _mt,
|
|
243
|
-
mb: _mb,
|
|
244
|
-
ml: _ml,
|
|
245
|
-
mr: _mr,
|
|
246
|
-
height: _height,
|
|
247
|
-
overflow: _overflow,
|
|
248
|
-
whiteSpace: _whiteSpace,
|
|
249
|
-
textOverflow: _textOverflow,
|
|
250
|
-
textTransform: _textTransform,
|
|
251
|
-
gap: _gap,
|
|
252
|
-
gridTemplateColumns: _gridTemplateColumns,
|
|
253
|
-
minWidth: _minWidth,
|
|
254
|
-
boxSize: _boxSize,
|
|
255
|
-
py: _py,
|
|
256
|
-
px: _px,
|
|
257
|
-
p: _p,
|
|
258
|
-
hideBelow: _hideBelow,
|
|
259
|
-
fontSize: _fontSize,
|
|
260
|
-
flexWrap: _flexWrap,
|
|
261
|
-
wordBreak: _wordBreak,
|
|
262
|
-
lineHeight: _lineHeight,
|
|
263
|
-
marginRight: _marginRight,
|
|
264
|
-
position: _position,
|
|
265
|
-
background: _background,
|
|
266
|
-
as: Component = "div",
|
|
267
|
-
...htmlRest
|
|
268
|
-
} = props;
|
|
269
|
-
const { style: shimStyle } = extractSkeletonStyleProps({
|
|
270
|
-
w: _w,
|
|
271
|
-
h: _h,
|
|
272
|
-
minW: _minW,
|
|
273
|
-
maxW: _maxW,
|
|
274
|
-
display: _display,
|
|
275
|
-
flexGrow: _flexGrow,
|
|
276
|
-
flexShrink: _flexShrink,
|
|
277
|
-
flexBasis: _flexBasis,
|
|
278
|
-
fontWeight: _fontWeight,
|
|
279
|
-
textStyle: _textStyle,
|
|
280
|
-
borderRadius: _borderRadius,
|
|
281
|
-
alignSelf: _alignSelf,
|
|
282
|
-
alignItems: _alignItems,
|
|
283
|
-
justifyContent: _justifyContent,
|
|
284
|
-
color: _color,
|
|
285
|
-
mt: _mt,
|
|
286
|
-
mb: _mb,
|
|
287
|
-
ml: _ml,
|
|
288
|
-
mr: _mr,
|
|
289
|
-
height: _height,
|
|
290
|
-
overflow: _overflow,
|
|
291
|
-
whiteSpace: _whiteSpace,
|
|
292
|
-
textOverflow: _textOverflow,
|
|
293
|
-
textTransform: _textTransform,
|
|
294
|
-
gap: _gap,
|
|
295
|
-
gridTemplateColumns: _gridTemplateColumns,
|
|
296
|
-
minWidth: _minWidth,
|
|
297
|
-
boxSize: _boxSize,
|
|
298
|
-
py: _py,
|
|
299
|
-
px: _px,
|
|
300
|
-
p: _p,
|
|
301
|
-
hideBelow: _hideBelow,
|
|
302
|
-
fontSize: _fontSize,
|
|
303
|
-
flexWrap: _flexWrap,
|
|
304
|
-
wordBreak: _wordBreak,
|
|
305
|
-
lineHeight: _lineHeight,
|
|
306
|
-
marginRight: _marginRight,
|
|
307
|
-
position: _position,
|
|
308
|
-
background: _background
|
|
309
|
-
});
|
|
199
|
+
const { loading = false, asChild, className, children, style: styleProp, as: Component = "div", ...allRest } = props;
|
|
200
|
+
const shimStyle = shimToStyle(props);
|
|
310
201
|
const mergedStyle = Object.keys(shimStyle).length > 0 || styleProp ? { ...shimStyle, ...styleProp } : void 0;
|
|
311
|
-
const
|
|
312
|
-
const
|
|
313
|
-
const
|
|
202
|
+
const hideBelowClass = props.hideBelow ? HIDE_BELOW_MAP[props.hideBelow] : void 0;
|
|
203
|
+
const cls = hideBelowClass ? cn(className, hideBelowClass) : className;
|
|
204
|
+
const htmlRest = stripShims(allRest);
|
|
314
205
|
if (!loading) {
|
|
315
|
-
if (asChild && React3.isValidElement(children))
|
|
316
|
-
|
|
317
|
-
}
|
|
318
|
-
return /* @__PURE__ */ jsx(Component, { ref, className: finalClassName, style: mergedStyle, ...htmlRest, children });
|
|
206
|
+
if (asChild && React3.isValidElement(children)) return children;
|
|
207
|
+
return /* @__PURE__ */ jsx(Component, { ref, className: cls, style: mergedStyle, ...htmlRest, children });
|
|
319
208
|
}
|
|
320
209
|
if (asChild && React3.isValidElement(children)) {
|
|
321
210
|
return /* @__PURE__ */ jsx(
|
|
@@ -323,13 +212,7 @@ var Skeleton = React3.forwardRef(
|
|
|
323
212
|
{
|
|
324
213
|
ref,
|
|
325
214
|
"data-loading": true,
|
|
326
|
-
className: cn(
|
|
327
|
-
"animate-skeleton-shimmer rounded-sm",
|
|
328
|
-
"bg-[linear-gradient(90deg,var(--color-skeleton-start)_0%,var(--color-skeleton-end)_50%,var(--color-skeleton-start)_100%)]",
|
|
329
|
-
"bg-[length:200%_100%]",
|
|
330
|
-
"text-transparent [&_*]:invisible",
|
|
331
|
-
finalClassName
|
|
332
|
-
),
|
|
215
|
+
className: cn(SKELETON_CLASSES, "text-transparent [&_*]:invisible", cls),
|
|
333
216
|
style: mergedStyle,
|
|
334
217
|
...htmlRest,
|
|
335
218
|
children
|
|
@@ -341,13 +224,7 @@ var Skeleton = React3.forwardRef(
|
|
|
341
224
|
{
|
|
342
225
|
ref,
|
|
343
226
|
"data-loading": true,
|
|
344
|
-
className: cn(
|
|
345
|
-
"animate-skeleton-shimmer rounded-sm",
|
|
346
|
-
"bg-[linear-gradient(90deg,var(--color-skeleton-start)_0%,var(--color-skeleton-end)_50%,var(--color-skeleton-start)_100%)]",
|
|
347
|
-
"bg-[length:200%_100%]",
|
|
348
|
-
children ? "text-transparent [&_*]:invisible" : "min-h-5",
|
|
349
|
-
finalClassName
|
|
350
|
-
),
|
|
227
|
+
className: cn(SKELETON_CLASSES, children ? "text-transparent [&_*]:invisible" : "min-h-5", cls),
|
|
351
228
|
style: mergedStyle,
|
|
352
229
|
...htmlRest,
|
|
353
230
|
children
|
|
@@ -399,6 +276,10 @@ function useIsMobile() {
|
|
|
399
276
|
}, []);
|
|
400
277
|
return isMobile;
|
|
401
278
|
}
|
|
279
|
+
function mapPlacement(p) {
|
|
280
|
+
if (!p) return void 0;
|
|
281
|
+
return p;
|
|
282
|
+
}
|
|
402
283
|
var Tooltip = React3.forwardRef(
|
|
403
284
|
function Tooltip2(props, ref) {
|
|
404
285
|
const {
|
|
@@ -409,10 +290,8 @@ var Tooltip = React3.forwardRef(
|
|
|
409
290
|
children,
|
|
410
291
|
disabled,
|
|
411
292
|
disableOnMobile,
|
|
412
|
-
portalled = true,
|
|
413
293
|
content,
|
|
414
294
|
contentProps,
|
|
415
|
-
portalRef,
|
|
416
295
|
defaultOpen = false,
|
|
417
296
|
triggerProps,
|
|
418
297
|
closeDelay = 100,
|
|
@@ -460,36 +339,34 @@ var Tooltip = React3.forwardRef(
|
|
|
460
339
|
if (disabled || disableOnMobile && isMobile) return children;
|
|
461
340
|
const defaultShowArrow = variant === "popover" ? false : true;
|
|
462
341
|
const showArrow = showArrowProp !== void 0 ? showArrowProp : defaultShowArrow;
|
|
463
|
-
const placement = positioning?.placement ?? "top";
|
|
464
|
-
const side = placement.split("-")[0];
|
|
465
|
-
const align = placement.includes("-") ? placement.split("-")[1] : void 0;
|
|
466
|
-
const sideOffset = positioning?.offset?.mainAxis ?? 4;
|
|
467
342
|
const isPopover = variant === "popover";
|
|
468
|
-
|
|
469
|
-
|
|
343
|
+
const placement = mapPlacement(positioning?.placement) ?? "top";
|
|
344
|
+
const offset = positioning?.offset?.mainAxis ?? 4;
|
|
345
|
+
return /* @__PURE__ */ jsx(TooltipGroup, { delay: openDelay, children: /* @__PURE__ */ jsxs(
|
|
346
|
+
Tooltip$1,
|
|
470
347
|
{
|
|
471
348
|
open,
|
|
472
349
|
onOpenChange: handleOpenChange,
|
|
473
|
-
|
|
350
|
+
delay: { open: openDelay, close: closeDelay },
|
|
351
|
+
placement,
|
|
352
|
+
offset,
|
|
353
|
+
unstyled: true,
|
|
474
354
|
children: [
|
|
475
355
|
/* @__PURE__ */ jsx(
|
|
476
|
-
|
|
356
|
+
Tooltip$1.Trigger,
|
|
477
357
|
{
|
|
478
358
|
ref: open ? triggerRef : void 0,
|
|
479
359
|
asChild: true,
|
|
480
|
-
|
|
360
|
+
...isMobile ? { onPress: handleTriggerClick } : {},
|
|
481
361
|
...triggerProps,
|
|
482
362
|
children
|
|
483
363
|
}
|
|
484
364
|
),
|
|
485
|
-
/* @__PURE__ */
|
|
486
|
-
|
|
365
|
+
/* @__PURE__ */ jsxs(
|
|
366
|
+
Tooltip$1.Content,
|
|
487
367
|
{
|
|
488
368
|
ref,
|
|
489
|
-
|
|
490
|
-
align,
|
|
491
|
-
sideOffset,
|
|
492
|
-
onClick: interactive ? handleContentClick : void 0,
|
|
369
|
+
unstyled: true,
|
|
493
370
|
className: cn(
|
|
494
371
|
"z-[9999] overflow-hidden rounded-lg px-3 py-2 text-sm",
|
|
495
372
|
"animate-in fade-in-0 zoom-in-95",
|
|
@@ -498,12 +375,14 @@ var Tooltip = React3.forwardRef(
|
|
|
498
375
|
!isPopover && "bg-[var(--color-tooltip-bg)] text-[var(--color-tooltip-fg)] max-w-xs",
|
|
499
376
|
contentProps?.className
|
|
500
377
|
),
|
|
378
|
+
onClick: interactive ? handleContentClick : void 0,
|
|
501
379
|
...selected ? { "data-selected": true } : {},
|
|
502
380
|
...contentProps,
|
|
503
381
|
children: [
|
|
504
382
|
showArrow && /* @__PURE__ */ jsx(
|
|
505
|
-
|
|
383
|
+
Tooltip$1.Arrow,
|
|
506
384
|
{
|
|
385
|
+
unstyled: true,
|
|
507
386
|
className: cn(
|
|
508
387
|
isPopover ? "fill-[var(--color-popover-bg)]" : "fill-[var(--color-tooltip-bg)]"
|
|
509
388
|
)
|
|
@@ -512,7 +391,7 @@ var Tooltip = React3.forwardRef(
|
|
|
512
391
|
content
|
|
513
392
|
]
|
|
514
393
|
}
|
|
515
|
-
)
|
|
394
|
+
)
|
|
516
395
|
]
|
|
517
396
|
}
|
|
518
397
|
) });
|