@luxfi/ui 7.0.0 → 7.2.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 +184 -335
- package/dist/alert.js +184 -335
- 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/bank.d.cts +1 -1
- package/dist/bank.d.ts +1 -1
- 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 +695 -858
- package/dist/index.d.cts +0 -3
- package/dist/index.d.ts +0 -3
- package/dist/index.js +695 -856
- package/dist/input.cjs +25 -36
- package/dist/input.js +25 -36
- 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 +199 -341
- package/dist/tag.js +199 -340
- package/dist/textarea.cjs +25 -36
- package/dist/textarea.js +25 -36
- 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 -8
- package/src/alert.tsx +23 -51
- 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/input.tsx +27 -36
- package/src/popover.tsx +30 -44
- package/src/skeleton.tsx +96 -144
- package/src/tag.tsx +17 -35
- package/src/textarea.tsx +27 -36
- package/src/tooltip.tsx +54 -47
package/dist/collapsible.js
CHANGED
|
@@ -10,272 +10,137 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
10
10
|
function cn(...inputs) {
|
|
11
11
|
return twMerge(clsx(inputs));
|
|
12
12
|
}
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
var SHIM_PROPS = [
|
|
14
|
+
"w",
|
|
15
|
+
"h",
|
|
16
|
+
"minW",
|
|
17
|
+
"maxW",
|
|
18
|
+
"display",
|
|
19
|
+
"flexGrow",
|
|
20
|
+
"flexShrink",
|
|
21
|
+
"flexBasis",
|
|
22
|
+
"fontWeight",
|
|
23
|
+
"textStyle",
|
|
24
|
+
"borderRadius",
|
|
25
|
+
"alignSelf",
|
|
26
|
+
"alignItems",
|
|
27
|
+
"justifyContent",
|
|
28
|
+
"color",
|
|
29
|
+
"mt",
|
|
30
|
+
"mb",
|
|
31
|
+
"ml",
|
|
32
|
+
"mr",
|
|
33
|
+
"height",
|
|
34
|
+
"overflow",
|
|
35
|
+
"whiteSpace",
|
|
36
|
+
"textOverflow",
|
|
37
|
+
"textTransform",
|
|
38
|
+
"gap",
|
|
39
|
+
"gridTemplateColumns",
|
|
40
|
+
"minWidth",
|
|
41
|
+
"boxSize",
|
|
42
|
+
"py",
|
|
43
|
+
"px",
|
|
44
|
+
"p",
|
|
45
|
+
"hideBelow",
|
|
46
|
+
"fontSize",
|
|
47
|
+
"flexWrap",
|
|
48
|
+
"wordBreak",
|
|
49
|
+
"lineHeight",
|
|
50
|
+
"marginRight",
|
|
51
|
+
"position",
|
|
52
|
+
"background"
|
|
53
|
+
];
|
|
54
|
+
var S = 4;
|
|
55
|
+
function dim(v) {
|
|
56
|
+
if (v == null) return void 0;
|
|
57
|
+
if (typeof v === "number") return `${v * S}px`;
|
|
58
|
+
if (typeof v === "string") return v;
|
|
59
|
+
if (typeof v === "object") {
|
|
60
|
+
const o = v;
|
|
61
|
+
return o.base ?? o.lg ?? o.xl ?? Object.values(o)[0];
|
|
62
|
+
}
|
|
63
|
+
return void 0;
|
|
18
64
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
65
|
+
function sp(v) {
|
|
66
|
+
if (v === void 0) return void 0;
|
|
67
|
+
return typeof v === "number" ? `${v * S}px` : v;
|
|
68
|
+
}
|
|
69
|
+
function shimToStyle(props) {
|
|
70
|
+
const s = {};
|
|
71
|
+
if (props.w !== void 0) s.width = dim(props.w);
|
|
72
|
+
if (props.h !== void 0) s.height = dim(props.h);
|
|
73
|
+
if (props.minW !== void 0) s.minWidth = dim(props.minW);
|
|
74
|
+
if (props.maxW !== void 0) s.maxWidth = dim(props.maxW);
|
|
75
|
+
if (props.display !== void 0) s.display = props.display;
|
|
76
|
+
if (props.flexGrow !== void 0) s.flexGrow = props.flexGrow;
|
|
77
|
+
if (props.flexShrink !== void 0) s.flexShrink = props.flexShrink;
|
|
78
|
+
if (props.flexBasis !== void 0) s.flexBasis = props.flexBasis;
|
|
79
|
+
if (props.fontWeight !== void 0) s.fontWeight = props.fontWeight;
|
|
80
|
+
if (props.borderRadius !== void 0) s.borderRadius = props.borderRadius;
|
|
81
|
+
if (props.alignSelf !== void 0) s.alignSelf = props.alignSelf;
|
|
82
|
+
if (props.alignItems !== void 0) s.alignItems = props.alignItems;
|
|
83
|
+
if (props.justifyContent !== void 0) s.justifyContent = props.justifyContent;
|
|
84
|
+
if (props.color !== void 0) s.color = props.color;
|
|
85
|
+
if (props.mt !== void 0) s.marginTop = sp(props.mt);
|
|
86
|
+
if (props.mb !== void 0) s.marginBottom = sp(props.mb);
|
|
87
|
+
if (props.ml !== void 0) s.marginLeft = sp(props.ml);
|
|
88
|
+
if (props.mr !== void 0) s.marginRight = sp(props.mr);
|
|
89
|
+
if (props.height !== void 0) s.height = props.height;
|
|
90
|
+
if (props.overflow !== void 0) s.overflow = props.overflow;
|
|
91
|
+
if (props.whiteSpace !== void 0) s.whiteSpace = props.whiteSpace;
|
|
92
|
+
if (props.textOverflow !== void 0) s.textOverflow = props.textOverflow;
|
|
93
|
+
if (props.textTransform !== void 0) s.textTransform = props.textTransform;
|
|
94
|
+
if (props.gap !== void 0) s.gap = sp(props.gap);
|
|
95
|
+
if (props.gridTemplateColumns !== void 0) s.gridTemplateColumns = props.gridTemplateColumns;
|
|
96
|
+
if (props.minWidth !== void 0) s.minWidth = props.minWidth;
|
|
97
|
+
if (props.boxSize !== void 0) {
|
|
98
|
+
const v = typeof props.boxSize === "number" ? `${props.boxSize * S}px` : props.boxSize;
|
|
99
|
+
s.width = v;
|
|
100
|
+
s.height = v;
|
|
31
101
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const v = resolveDimension(value);
|
|
37
|
-
if (v) style.width = v;
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
case "h": {
|
|
41
|
-
const v = resolveDimension(value);
|
|
42
|
-
if (v) style.height = v;
|
|
43
|
-
break;
|
|
44
|
-
}
|
|
45
|
-
case "minW": {
|
|
46
|
-
const v = resolveDimension(value);
|
|
47
|
-
if (v) style.minWidth = v;
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
case "maxW": {
|
|
51
|
-
const v = resolveDimension(value);
|
|
52
|
-
if (v) style.maxWidth = v;
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
case "height":
|
|
56
|
-
style.height = value;
|
|
57
|
-
break;
|
|
58
|
-
case "display":
|
|
59
|
-
style.display = value;
|
|
60
|
-
break;
|
|
61
|
-
case "flexGrow":
|
|
62
|
-
style.flexGrow = value;
|
|
63
|
-
break;
|
|
64
|
-
case "flexShrink":
|
|
65
|
-
style.flexShrink = value;
|
|
66
|
-
break;
|
|
67
|
-
case "flexBasis":
|
|
68
|
-
style.flexBasis = value;
|
|
69
|
-
break;
|
|
70
|
-
case "fontWeight":
|
|
71
|
-
style.fontWeight = value;
|
|
72
|
-
break;
|
|
73
|
-
case "borderRadius":
|
|
74
|
-
style.borderRadius = value;
|
|
75
|
-
break;
|
|
76
|
-
case "alignSelf":
|
|
77
|
-
style.alignSelf = value;
|
|
78
|
-
break;
|
|
79
|
-
case "alignItems":
|
|
80
|
-
style.alignItems = value;
|
|
81
|
-
break;
|
|
82
|
-
case "justifyContent":
|
|
83
|
-
style.justifyContent = value;
|
|
84
|
-
break;
|
|
85
|
-
case "color":
|
|
86
|
-
style.color = value;
|
|
87
|
-
break;
|
|
88
|
-
case "mt":
|
|
89
|
-
style.marginTop = toStylePx(value);
|
|
90
|
-
break;
|
|
91
|
-
case "mb":
|
|
92
|
-
style.marginBottom = toStylePx(value);
|
|
93
|
-
break;
|
|
94
|
-
case "ml":
|
|
95
|
-
style.marginLeft = toStylePx(value);
|
|
96
|
-
break;
|
|
97
|
-
case "mr":
|
|
98
|
-
style.marginRight = toStylePx(value);
|
|
99
|
-
break;
|
|
100
|
-
case "overflow":
|
|
101
|
-
style.overflow = value;
|
|
102
|
-
break;
|
|
103
|
-
case "whiteSpace":
|
|
104
|
-
style.whiteSpace = value;
|
|
105
|
-
break;
|
|
106
|
-
case "textOverflow":
|
|
107
|
-
style.textOverflow = value;
|
|
108
|
-
break;
|
|
109
|
-
case "textTransform":
|
|
110
|
-
style.textTransform = value;
|
|
111
|
-
break;
|
|
112
|
-
case "gap":
|
|
113
|
-
style.gap = typeof value === "number" ? `${value * SPACING_SCALE}px` : value;
|
|
114
|
-
break;
|
|
115
|
-
case "gridTemplateColumns":
|
|
116
|
-
style.gridTemplateColumns = value;
|
|
117
|
-
break;
|
|
118
|
-
case "minWidth":
|
|
119
|
-
style.minWidth = value;
|
|
120
|
-
break;
|
|
121
|
-
case "boxSize": {
|
|
122
|
-
const s = typeof value === "number" ? `${value * SPACING_SCALE}px` : value;
|
|
123
|
-
style.width = s;
|
|
124
|
-
style.height = s;
|
|
125
|
-
break;
|
|
126
|
-
}
|
|
127
|
-
case "py": {
|
|
128
|
-
const v = toStylePx(value);
|
|
129
|
-
style.paddingTop = v;
|
|
130
|
-
style.paddingBottom = v;
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
133
|
-
case "px": {
|
|
134
|
-
const v = toStylePx(value);
|
|
135
|
-
style.paddingLeft = v;
|
|
136
|
-
style.paddingRight = v;
|
|
137
|
-
break;
|
|
138
|
-
}
|
|
139
|
-
case "p": {
|
|
140
|
-
const v = toStylePx(value);
|
|
141
|
-
style.padding = v;
|
|
142
|
-
break;
|
|
143
|
-
}
|
|
144
|
-
case "hideBelow":
|
|
145
|
-
break;
|
|
146
|
-
// handled via className
|
|
147
|
-
case "textStyle":
|
|
148
|
-
break;
|
|
149
|
-
// drop textStyle, not directly applicable
|
|
150
|
-
case "fontSize":
|
|
151
|
-
style.fontSize = value;
|
|
152
|
-
break;
|
|
153
|
-
case "flexWrap":
|
|
154
|
-
style.flexWrap = value;
|
|
155
|
-
break;
|
|
156
|
-
case "wordBreak":
|
|
157
|
-
style.wordBreak = value;
|
|
158
|
-
break;
|
|
159
|
-
case "lineHeight":
|
|
160
|
-
style.lineHeight = value;
|
|
161
|
-
break;
|
|
162
|
-
case "marginRight":
|
|
163
|
-
style.marginRight = value;
|
|
164
|
-
break;
|
|
165
|
-
case "position":
|
|
166
|
-
style.position = value;
|
|
167
|
-
break;
|
|
168
|
-
case "background":
|
|
169
|
-
style.background = value;
|
|
170
|
-
break;
|
|
171
|
-
default:
|
|
172
|
-
rest[key] = value;
|
|
173
|
-
break;
|
|
174
|
-
}
|
|
102
|
+
if (props.py !== void 0) {
|
|
103
|
+
const v = sp(props.py);
|
|
104
|
+
s.paddingTop = v;
|
|
105
|
+
s.paddingBottom = v;
|
|
175
106
|
}
|
|
176
|
-
|
|
107
|
+
if (props.px !== void 0) {
|
|
108
|
+
const v = sp(props.px);
|
|
109
|
+
s.paddingLeft = v;
|
|
110
|
+
s.paddingRight = v;
|
|
111
|
+
}
|
|
112
|
+
if (props.p !== void 0) s.padding = sp(props.p);
|
|
113
|
+
if (props.fontSize !== void 0) s.fontSize = props.fontSize;
|
|
114
|
+
if (props.flexWrap !== void 0) s.flexWrap = props.flexWrap;
|
|
115
|
+
if (props.wordBreak !== void 0) s.wordBreak = props.wordBreak;
|
|
116
|
+
if (props.lineHeight !== void 0) s.lineHeight = props.lineHeight;
|
|
117
|
+
if (props.marginRight !== void 0) s.marginRight = props.marginRight;
|
|
118
|
+
if (props.position !== void 0) s.position = props.position;
|
|
119
|
+
if (props.background !== void 0) s.background = props.background;
|
|
120
|
+
return s;
|
|
121
|
+
}
|
|
122
|
+
function stripShims(props) {
|
|
123
|
+
const out = { ...props };
|
|
124
|
+
for (const k of SHIM_PROPS) delete out[k];
|
|
125
|
+
return out;
|
|
177
126
|
}
|
|
127
|
+
var SKELETON_CLASSES = [
|
|
128
|
+
"animate-skeleton-shimmer rounded-sm",
|
|
129
|
+
"bg-[linear-gradient(90deg,var(--color-skeleton-start)_0%,var(--color-skeleton-end)_50%,var(--color-skeleton-start)_100%)]",
|
|
130
|
+
"bg-[length:200%_100%]"
|
|
131
|
+
].join(" ");
|
|
132
|
+
var HIDE_BELOW_MAP = { lg: "lg:hidden", md: "md:hidden", sm: "sm:hidden" };
|
|
178
133
|
var Skeleton = React3.forwardRef(
|
|
179
134
|
function Skeleton2(props, ref) {
|
|
180
|
-
const {
|
|
181
|
-
|
|
182
|
-
asChild,
|
|
183
|
-
className,
|
|
184
|
-
children,
|
|
185
|
-
style: styleProp,
|
|
186
|
-
// Destructure style-prop shims so they don't leak into DOM
|
|
187
|
-
w: _w,
|
|
188
|
-
h: _h,
|
|
189
|
-
minW: _minW,
|
|
190
|
-
maxW: _maxW,
|
|
191
|
-
display: _display,
|
|
192
|
-
flexGrow: _flexGrow,
|
|
193
|
-
flexShrink: _flexShrink,
|
|
194
|
-
flexBasis: _flexBasis,
|
|
195
|
-
fontWeight: _fontWeight,
|
|
196
|
-
textStyle: _textStyle,
|
|
197
|
-
borderRadius: _borderRadius,
|
|
198
|
-
alignSelf: _alignSelf,
|
|
199
|
-
alignItems: _alignItems,
|
|
200
|
-
justifyContent: _justifyContent,
|
|
201
|
-
color: _color,
|
|
202
|
-
mt: _mt,
|
|
203
|
-
mb: _mb,
|
|
204
|
-
ml: _ml,
|
|
205
|
-
mr: _mr,
|
|
206
|
-
height: _height,
|
|
207
|
-
overflow: _overflow,
|
|
208
|
-
whiteSpace: _whiteSpace,
|
|
209
|
-
textOverflow: _textOverflow,
|
|
210
|
-
textTransform: _textTransform,
|
|
211
|
-
gap: _gap,
|
|
212
|
-
gridTemplateColumns: _gridTemplateColumns,
|
|
213
|
-
minWidth: _minWidth,
|
|
214
|
-
boxSize: _boxSize,
|
|
215
|
-
py: _py,
|
|
216
|
-
px: _px,
|
|
217
|
-
p: _p,
|
|
218
|
-
hideBelow: _hideBelow,
|
|
219
|
-
fontSize: _fontSize,
|
|
220
|
-
flexWrap: _flexWrap,
|
|
221
|
-
wordBreak: _wordBreak,
|
|
222
|
-
lineHeight: _lineHeight,
|
|
223
|
-
marginRight: _marginRight,
|
|
224
|
-
position: _position,
|
|
225
|
-
background: _background,
|
|
226
|
-
as: Component = "div",
|
|
227
|
-
...htmlRest
|
|
228
|
-
} = props;
|
|
229
|
-
const { style: shimStyle } = extractSkeletonStyleProps({
|
|
230
|
-
w: _w,
|
|
231
|
-
h: _h,
|
|
232
|
-
minW: _minW,
|
|
233
|
-
maxW: _maxW,
|
|
234
|
-
display: _display,
|
|
235
|
-
flexGrow: _flexGrow,
|
|
236
|
-
flexShrink: _flexShrink,
|
|
237
|
-
flexBasis: _flexBasis,
|
|
238
|
-
fontWeight: _fontWeight,
|
|
239
|
-
textStyle: _textStyle,
|
|
240
|
-
borderRadius: _borderRadius,
|
|
241
|
-
alignSelf: _alignSelf,
|
|
242
|
-
alignItems: _alignItems,
|
|
243
|
-
justifyContent: _justifyContent,
|
|
244
|
-
color: _color,
|
|
245
|
-
mt: _mt,
|
|
246
|
-
mb: _mb,
|
|
247
|
-
ml: _ml,
|
|
248
|
-
mr: _mr,
|
|
249
|
-
height: _height,
|
|
250
|
-
overflow: _overflow,
|
|
251
|
-
whiteSpace: _whiteSpace,
|
|
252
|
-
textOverflow: _textOverflow,
|
|
253
|
-
textTransform: _textTransform,
|
|
254
|
-
gap: _gap,
|
|
255
|
-
gridTemplateColumns: _gridTemplateColumns,
|
|
256
|
-
minWidth: _minWidth,
|
|
257
|
-
boxSize: _boxSize,
|
|
258
|
-
py: _py,
|
|
259
|
-
px: _px,
|
|
260
|
-
p: _p,
|
|
261
|
-
hideBelow: _hideBelow,
|
|
262
|
-
fontSize: _fontSize,
|
|
263
|
-
flexWrap: _flexWrap,
|
|
264
|
-
wordBreak: _wordBreak,
|
|
265
|
-
lineHeight: _lineHeight,
|
|
266
|
-
marginRight: _marginRight,
|
|
267
|
-
position: _position,
|
|
268
|
-
background: _background
|
|
269
|
-
});
|
|
135
|
+
const { loading = false, asChild, className, children, style: styleProp, as: Component = "div", ...allRest } = props;
|
|
136
|
+
const shimStyle = shimToStyle(props);
|
|
270
137
|
const mergedStyle = Object.keys(shimStyle).length > 0 || styleProp ? { ...shimStyle, ...styleProp } : void 0;
|
|
271
|
-
const
|
|
272
|
-
const
|
|
273
|
-
const
|
|
138
|
+
const hideBelowClass = props.hideBelow ? HIDE_BELOW_MAP[props.hideBelow] : void 0;
|
|
139
|
+
const cls = hideBelowClass ? cn(className, hideBelowClass) : className;
|
|
140
|
+
const htmlRest = stripShims(allRest);
|
|
274
141
|
if (!loading) {
|
|
275
|
-
if (asChild && React3.isValidElement(children))
|
|
276
|
-
|
|
277
|
-
}
|
|
278
|
-
return /* @__PURE__ */ jsx(Component, { ref, className: finalClassName, style: mergedStyle, ...htmlRest, children });
|
|
142
|
+
if (asChild && React3.isValidElement(children)) return children;
|
|
143
|
+
return /* @__PURE__ */ jsx(Component, { ref, className: cls, style: mergedStyle, ...htmlRest, children });
|
|
279
144
|
}
|
|
280
145
|
if (asChild && React3.isValidElement(children)) {
|
|
281
146
|
return /* @__PURE__ */ jsx(
|
|
@@ -283,13 +148,7 @@ var Skeleton = React3.forwardRef(
|
|
|
283
148
|
{
|
|
284
149
|
ref,
|
|
285
150
|
"data-loading": true,
|
|
286
|
-
className: cn(
|
|
287
|
-
"animate-skeleton-shimmer rounded-sm",
|
|
288
|
-
"bg-[linear-gradient(90deg,var(--color-skeleton-start)_0%,var(--color-skeleton-end)_50%,var(--color-skeleton-start)_100%)]",
|
|
289
|
-
"bg-[length:200%_100%]",
|
|
290
|
-
"text-transparent [&_*]:invisible",
|
|
291
|
-
finalClassName
|
|
292
|
-
),
|
|
151
|
+
className: cn(SKELETON_CLASSES, "text-transparent [&_*]:invisible", cls),
|
|
293
152
|
style: mergedStyle,
|
|
294
153
|
...htmlRest,
|
|
295
154
|
children
|
|
@@ -301,13 +160,7 @@ var Skeleton = React3.forwardRef(
|
|
|
301
160
|
{
|
|
302
161
|
ref,
|
|
303
162
|
"data-loading": true,
|
|
304
|
-
className: cn(
|
|
305
|
-
"animate-skeleton-shimmer rounded-sm",
|
|
306
|
-
"bg-[linear-gradient(90deg,var(--color-skeleton-start)_0%,var(--color-skeleton-end)_50%,var(--color-skeleton-start)_100%)]",
|
|
307
|
-
"bg-[length:200%_100%]",
|
|
308
|
-
children ? "text-transparent [&_*]:invisible" : "min-h-5",
|
|
309
|
-
finalClassName
|
|
310
|
-
),
|
|
163
|
+
className: cn(SKELETON_CLASSES, children ? "text-transparent [&_*]:invisible" : "min-h-5", cls),
|
|
311
164
|
style: mergedStyle,
|
|
312
165
|
...htmlRest,
|
|
313
166
|
children
|
package/dist/dialog.cjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var dialog = require('@hanzogui/dialog');
|
|
5
5
|
var React2 = require('react');
|
|
6
6
|
var clsx = require('clsx');
|
|
7
7
|
var tailwindMerge = require('tailwind-merge');
|
|
8
|
+
var core = require('@hanzogui/core');
|
|
8
9
|
var jsxRuntime = require('react/jsx-runtime');
|
|
9
10
|
|
|
10
11
|
function _interopNamespace(e) {
|
|
@@ -25,7 +26,6 @@ function _interopNamespace(e) {
|
|
|
25
26
|
return Object.freeze(n);
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
var RadixDialog__namespace = /*#__PURE__*/_interopNamespace(RadixDialog);
|
|
29
29
|
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
30
30
|
|
|
31
31
|
// src/dialog.tsx
|
|
@@ -33,24 +33,47 @@ function cn(...inputs) {
|
|
|
33
33
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
34
34
|
}
|
|
35
35
|
var CLOSE_ICON_PATH = "M9.44 8.035a.791.791 0 0 0 1.12 0l3.802-3.803a.791.791 0 0 1 1.119 0l.287.287a.79.79 0 0 1 0 1.119L11.965 9.44a.79.79 0 0 0 0 1.118l3.803 3.803a.791.791 0 0 1 0 1.119l-.287.287a.791.791 0 0 1-1.119 0l-3.803-3.803a.79.79 0 0 0-1.118 0l-3.803 3.803a.79.79 0 0 1-1.119 0l-.287-.287a.791.791 0 0 1 0-1.119l3.803-3.803a.791.791 0 0 0 0-1.118L4.232 5.638a.791.791 0 0 1 0-1.119l.287-.287a.791.791 0 0 1 1.119 0L9.44 8.035Z";
|
|
36
|
+
var CloseButtonFrame = core.styled(core.View, {
|
|
37
|
+
name: "LuxCloseButton",
|
|
38
|
+
render: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", "aria-label": "Close" }),
|
|
39
|
+
role: "button",
|
|
40
|
+
cursor: "pointer",
|
|
41
|
+
display: "inline-flex",
|
|
42
|
+
alignItems: "center",
|
|
43
|
+
justifyContent: "center",
|
|
44
|
+
width: 20,
|
|
45
|
+
height: 20,
|
|
46
|
+
minWidth: 0,
|
|
47
|
+
flexShrink: 1,
|
|
48
|
+
padding: 0,
|
|
49
|
+
borderRadius: 4,
|
|
50
|
+
borderWidth: 0,
|
|
51
|
+
overflow: "hidden",
|
|
52
|
+
backgroundColor: "transparent",
|
|
53
|
+
hoverStyle: {
|
|
54
|
+
backgroundColor: "transparent"
|
|
55
|
+
},
|
|
56
|
+
variants: {
|
|
57
|
+
disabled: {
|
|
58
|
+
true: {
|
|
59
|
+
opacity: 0.4,
|
|
60
|
+
pointerEvents: "none"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
var CLOSE_BUTTON_CLASSES = [
|
|
66
|
+
"text-[var(--closeButton-fg,currentColor)]",
|
|
67
|
+
"hover:text-[var(--hover-color,currentColor)]",
|
|
68
|
+
"disabled:opacity-40"
|
|
69
|
+
].join(" ");
|
|
36
70
|
var CloseButton = React2__namespace.forwardRef(function CloseButton2(props, ref) {
|
|
37
71
|
const { variant: _variant, size: _size, className, children, ...rest } = props;
|
|
38
72
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
39
|
-
|
|
73
|
+
CloseButtonFrame,
|
|
40
74
|
{
|
|
41
|
-
type: "button",
|
|
42
|
-
"aria-label": "Close",
|
|
43
75
|
ref,
|
|
44
|
-
className:
|
|
45
|
-
"inline-flex items-center justify-center",
|
|
46
|
-
"size-5 min-w-0 shrink-0 p-0",
|
|
47
|
-
"rounded-sm border-0 overflow-hidden",
|
|
48
|
-
"bg-transparent text-[var(--closeButton-fg,currentColor)]",
|
|
49
|
-
"hover:bg-transparent hover:text-[var(--hover-color,currentColor)]",
|
|
50
|
-
"disabled:opacity-40",
|
|
51
|
-
"cursor-pointer",
|
|
52
|
-
className
|
|
53
|
-
),
|
|
76
|
+
className: [CLOSE_BUTTON_CLASSES, className].filter(Boolean).join(" "),
|
|
54
77
|
...rest,
|
|
55
78
|
children: children ?? /* @__PURE__ */ jsxRuntime.jsx(
|
|
56
79
|
"svg",
|
|
@@ -83,9 +106,9 @@ function BackToButton({ onClick }) {
|
|
|
83
106
|
}
|
|
84
107
|
);
|
|
85
108
|
}
|
|
86
|
-
var
|
|
87
|
-
function
|
|
88
|
-
return React2__namespace.useContext(
|
|
109
|
+
var DialogSizeContext = React2__namespace.createContext({ size: "md" });
|
|
110
|
+
function useDialogSizeContext() {
|
|
111
|
+
return React2__namespace.useContext(DialogSizeContext);
|
|
89
112
|
}
|
|
90
113
|
var CONTENT_SIZE_MAP = {
|
|
91
114
|
sm: "max-w-[400px]",
|
|
@@ -115,7 +138,7 @@ var DialogRoot = ({
|
|
|
115
138
|
onOpenChange,
|
|
116
139
|
size = "md",
|
|
117
140
|
modal = true
|
|
118
|
-
// motionPreset is intentionally unused
|
|
141
|
+
// motionPreset is intentionally unused -- kept for API compat
|
|
119
142
|
}) => {
|
|
120
143
|
const handleOpenChange = React2__namespace.useCallback(
|
|
121
144
|
(nextOpen) => {
|
|
@@ -124,8 +147,8 @@ var DialogRoot = ({
|
|
|
124
147
|
[onOpenChange]
|
|
125
148
|
);
|
|
126
149
|
const ctx = React2__namespace.useMemo(() => ({ size }), [size]);
|
|
127
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
128
|
-
|
|
150
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DialogSizeContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
151
|
+
dialog.Dialog,
|
|
129
152
|
{
|
|
130
153
|
open,
|
|
131
154
|
defaultOpen,
|
|
@@ -138,8 +161,8 @@ var DialogRoot = ({
|
|
|
138
161
|
var DialogContent = React2__namespace.forwardRef(function DialogContent2(props, ref) {
|
|
139
162
|
const {
|
|
140
163
|
children,
|
|
141
|
-
portalled = true,
|
|
142
|
-
portalRef,
|
|
164
|
+
portalled: _portalled = true,
|
|
165
|
+
portalRef: _portalRef,
|
|
143
166
|
backdrop = true,
|
|
144
167
|
className,
|
|
145
168
|
paddingTop: _paddingTop,
|
|
@@ -150,21 +173,12 @@ var DialogContent = React2__namespace.forwardRef(function DialogContent2(props,
|
|
|
150
173
|
...styleProp,
|
|
151
174
|
..._paddingTop !== void 0 ? { paddingTop: typeof _paddingTop === "number" ? `${_paddingTop * 4}px` : _paddingTop } : {}
|
|
152
175
|
};
|
|
153
|
-
const { size } =
|
|
154
|
-
|
|
155
|
-
if (!portalled) {
|
|
156
|
-
portalProps = { container: void 0 };
|
|
157
|
-
} else if (portalRef) {
|
|
158
|
-
portalProps = { container: portalRef.current };
|
|
159
|
-
} else {
|
|
160
|
-
portalProps = {};
|
|
161
|
-
}
|
|
162
|
-
const Wrapper = portalled ? RadixDialog__namespace.Portal : React2__namespace.Fragment;
|
|
163
|
-
const wrapperProps = portalled ? portalProps : {};
|
|
164
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Wrapper, { ...wrapperProps, children: [
|
|
176
|
+
const { size } = useDialogSizeContext();
|
|
177
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(dialog.Dialog.Portal, { children: [
|
|
165
178
|
backdrop && /* @__PURE__ */ jsxRuntime.jsx(
|
|
166
|
-
|
|
179
|
+
dialog.Dialog.Overlay,
|
|
167
180
|
{
|
|
181
|
+
unstyled: true,
|
|
168
182
|
className: "fixed inset-0 z-[1400] bg-black/80"
|
|
169
183
|
}
|
|
170
184
|
),
|
|
@@ -177,9 +191,10 @@ var DialogContent = React2__namespace.forwardRef(function DialogContent2(props,
|
|
|
177
191
|
"overflow-hidden"
|
|
178
192
|
),
|
|
179
193
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
180
|
-
|
|
194
|
+
dialog.Dialog.Content,
|
|
181
195
|
{
|
|
182
196
|
ref,
|
|
197
|
+
unstyled: true,
|
|
183
198
|
className: cn(
|
|
184
199
|
// Base content styles
|
|
185
200
|
"relative flex flex-col w-full p-6 outline-none text-base",
|
|
@@ -202,7 +217,7 @@ var DialogContent = React2__namespace.forwardRef(function DialogContent2(props,
|
|
|
202
217
|
});
|
|
203
218
|
var DialogCloseTrigger = React2__namespace.forwardRef(function DialogCloseTrigger2(props, ref) {
|
|
204
219
|
const { className, ...rest } = props;
|
|
205
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
220
|
+
return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { ref, className, ...rest, children: props.children }) });
|
|
206
221
|
});
|
|
207
222
|
var DialogHeader = React2__namespace.forwardRef(function DialogHeader2(props, ref) {
|
|
208
223
|
const { startElement: startElementProp, onBackToClick, className, children, ...rest } = props;
|
|
@@ -219,8 +234,9 @@ var DialogHeader = React2__namespace.forwardRef(function DialogHeader2(props, re
|
|
|
219
234
|
children: [
|
|
220
235
|
startElement,
|
|
221
236
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
222
|
-
|
|
237
|
+
dialog.Dialog.Title,
|
|
223
238
|
{
|
|
239
|
+
unstyled: true,
|
|
224
240
|
className: cn(
|
|
225
241
|
"text-base lg:text-lg font-medium",
|
|
226
242
|
"whitespace-nowrap overflow-hidden text-ellipsis"
|
|
@@ -260,11 +276,11 @@ var DialogFooter = React2__namespace.forwardRef(function DialogFooter2({ classNa
|
|
|
260
276
|
}
|
|
261
277
|
);
|
|
262
278
|
});
|
|
263
|
-
var DialogBackdrop =
|
|
264
|
-
var DialogTitle =
|
|
265
|
-
var DialogDescription =
|
|
266
|
-
var DialogTrigger =
|
|
267
|
-
var DialogActionTrigger =
|
|
279
|
+
var DialogBackdrop = dialog.Dialog.Overlay;
|
|
280
|
+
var DialogTitle = dialog.Dialog.Title;
|
|
281
|
+
var DialogDescription = dialog.Dialog.Description;
|
|
282
|
+
var DialogTrigger = dialog.Dialog.Trigger;
|
|
283
|
+
var DialogActionTrigger = dialog.Dialog.Close;
|
|
268
284
|
|
|
269
285
|
exports.DialogActionTrigger = DialogActionTrigger;
|
|
270
286
|
exports.DialogBackdrop = DialogBackdrop;
|
package/dist/dialog.d.cts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as RadixDialog from '@radix-ui/react-dialog';
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
|
|
4
3
|
type DialogSize = 'sm' | 'md' | 'full' | 'cover';
|
|
@@ -21,7 +20,7 @@ interface DialogRootProps {
|
|
|
21
20
|
open: boolean;
|
|
22
21
|
}) => void;
|
|
23
22
|
size?: ResponsiveSize;
|
|
24
|
-
/** Accepted for API compat but not implemented
|
|
23
|
+
/** Accepted for API compat but not implemented -- animations are CSS-only. */
|
|
25
24
|
motionPreset?: string;
|
|
26
25
|
modal?: boolean;
|
|
27
26
|
}
|
|
@@ -50,17 +49,17 @@ declare const DialogBody: React.ForwardRefExoticComponent<DialogBodyProps & Reac
|
|
|
50
49
|
interface DialogFooterProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
51
50
|
}
|
|
52
51
|
declare const DialogFooter: React.ForwardRefExoticComponent<DialogFooterProps & React.RefAttributes<HTMLDivElement>>;
|
|
53
|
-
declare const DialogBackdrop:
|
|
54
|
-
declare const DialogTitle:
|
|
55
|
-
declare const DialogDescription:
|
|
56
|
-
interface DialogTriggerProps extends React.ComponentPropsWithoutRef<
|
|
52
|
+
declare const DialogBackdrop: any;
|
|
53
|
+
declare const DialogTitle: any;
|
|
54
|
+
declare const DialogDescription: any;
|
|
55
|
+
interface DialogTriggerProps extends React.ComponentPropsWithoutRef<'button'> {
|
|
57
56
|
}
|
|
58
|
-
declare const DialogTrigger:
|
|
57
|
+
declare const DialogTrigger: any;
|
|
59
58
|
/**
|
|
60
59
|
* `DialogActionTrigger` renders its child and closes the dialog on click.
|
|
61
60
|
* This mirrors the Chakra `Dialog.ActionTrigger` behavior which wraps
|
|
62
61
|
* children in a close action.
|
|
63
62
|
*/
|
|
64
|
-
declare const DialogActionTrigger:
|
|
63
|
+
declare const DialogActionTrigger: any;
|
|
65
64
|
|
|
66
65
|
export { DialogActionTrigger, DialogBackdrop, DialogBody, type DialogBodyProps, DialogCloseTrigger, type DialogCloseTriggerProps, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, type DialogFooterProps, DialogHeader, type DialogHeaderProps, DialogRoot, type DialogRootProps, DialogTitle, DialogTrigger, type DialogTriggerProps };
|