@versini/ui-truncate 4.0.5 → 4.0.7
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/components/Truncate/Truncate.js +227 -209
- package/dist/index.js +3 -3
- package/package.json +4 -4
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { jsx as g, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
const
|
|
1
|
+
import { jsx as g, jsxs as q } from "react/jsx-runtime";
|
|
2
|
+
import I, { useRef as w, useLayoutEffect as D, useEffect as A, useState as G, useMemo as P, useCallback as ae } from "react";
|
|
3
|
+
import n from "clsx";
|
|
4
|
+
const F = "av-button", R = "icon", S = "button", j = "link", ie = ({
|
|
5
5
|
type: e,
|
|
6
6
|
size: t,
|
|
7
7
|
labelRight: r,
|
|
8
8
|
labelLeft: a,
|
|
9
|
-
align:
|
|
9
|
+
align: o,
|
|
10
10
|
animated: i
|
|
11
11
|
}) => {
|
|
12
|
-
const
|
|
12
|
+
const l = "max-h-8 py-0 px-2", d = "max-h-9 h-8 px-3", s = "max-h-12 py-2 px-4";
|
|
13
13
|
switch (e) {
|
|
14
|
-
case
|
|
15
|
-
case
|
|
16
|
-
return
|
|
17
|
-
[
|
|
18
|
-
[
|
|
14
|
+
case S:
|
|
15
|
+
case j:
|
|
16
|
+
return n({
|
|
17
|
+
[l]: t === "small",
|
|
18
|
+
[d]: t === "medium",
|
|
19
19
|
[s]: t === "large"
|
|
20
20
|
});
|
|
21
|
-
case
|
|
22
|
-
return
|
|
23
|
-
"justify-center":
|
|
24
|
-
"justify-start":
|
|
25
|
-
"justify-end":
|
|
21
|
+
case R:
|
|
22
|
+
return n("flex items-center", {
|
|
23
|
+
"justify-center": o === "center",
|
|
24
|
+
"justify-start": o === "left",
|
|
25
|
+
"justify-end": o === "right",
|
|
26
26
|
"h-6 w-6 p-0": t === "small" && !i && !(r || a),
|
|
27
27
|
"h-6 px-2": t === "small" && !i && (r || a),
|
|
28
28
|
"h-8 w-8 p-1": t === "medium" && !i && !(r || a),
|
|
@@ -37,30 +37,30 @@ const O = "av-button", T = "icon", M = "button", z = "link", ee = ({
|
|
|
37
37
|
"h-12": t === "large" && i && (r || a)
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
},
|
|
40
|
+
}, ne = ({
|
|
41
41
|
type: e,
|
|
42
42
|
size: t,
|
|
43
43
|
labelRight: r,
|
|
44
44
|
labelLeft: a
|
|
45
45
|
}) => {
|
|
46
|
-
const
|
|
46
|
+
const o = "text-sm font-medium", i = "text-base font-medium", l = "text-lg font-medium";
|
|
47
47
|
switch (e) {
|
|
48
|
-
case
|
|
49
|
-
case
|
|
50
|
-
return
|
|
51
|
-
"text-center": e ===
|
|
52
|
-
[
|
|
48
|
+
case S:
|
|
49
|
+
case j:
|
|
50
|
+
return n({
|
|
51
|
+
"text-center": e === j,
|
|
52
|
+
[o]: t === "small",
|
|
53
53
|
[i]: t === "medium",
|
|
54
|
-
[
|
|
54
|
+
[l]: t === "large"
|
|
55
55
|
});
|
|
56
|
-
case
|
|
57
|
-
return
|
|
58
|
-
[
|
|
56
|
+
case R:
|
|
57
|
+
return n({
|
|
58
|
+
[o]: t === "small" && (r || a),
|
|
59
59
|
[i]: t === "medium" && (r || a),
|
|
60
|
-
[
|
|
60
|
+
[l]: t === "large" && (r || a)
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
},
|
|
63
|
+
}, oe = ({
|
|
64
64
|
mode: e,
|
|
65
65
|
noBackground: t,
|
|
66
66
|
truncate: r,
|
|
@@ -69,7 +69,7 @@ const O = "av-button", T = "icon", M = "button", z = "link", ee = ({
|
|
|
69
69
|
if (t)
|
|
70
70
|
return "not-prose";
|
|
71
71
|
if (a === "primary")
|
|
72
|
-
return
|
|
72
|
+
return n("not-prose", {
|
|
73
73
|
truncate: r,
|
|
74
74
|
"text-copy-light": e === "dark" || e === "system",
|
|
75
75
|
"text-copy-lighter": e === "light" || e === "alt-system",
|
|
@@ -77,7 +77,7 @@ const O = "av-button", T = "icon", M = "button", z = "link", ee = ({
|
|
|
77
77
|
"dark:text-copy-light": e === "alt-system"
|
|
78
78
|
});
|
|
79
79
|
if (a === "secondary")
|
|
80
|
-
return
|
|
80
|
+
return n("not-prose", {
|
|
81
81
|
truncate: r,
|
|
82
82
|
"text-copy-light": e === "light" || e === "system",
|
|
83
83
|
"text-copy-lighter": e === "dark" || e === "alt-system",
|
|
@@ -85,7 +85,7 @@ const O = "av-button", T = "icon", M = "button", z = "link", ee = ({
|
|
|
85
85
|
"dark:text-copy-light": e === "system"
|
|
86
86
|
});
|
|
87
87
|
if (a === "danger")
|
|
88
|
-
return
|
|
88
|
+
return n("not-prose", {
|
|
89
89
|
truncate: r,
|
|
90
90
|
"text-copy-light": e === "dark" || e === "system",
|
|
91
91
|
"text-copy-lighter": e === "light" || e === "alt-system",
|
|
@@ -93,31 +93,31 @@ const O = "av-button", T = "icon", M = "button", z = "link", ee = ({
|
|
|
93
93
|
"dark:text-copy-light": e === "alt-system"
|
|
94
94
|
});
|
|
95
95
|
if (a === "selected")
|
|
96
|
-
return
|
|
96
|
+
return n("not-prose text-copy-lighter", {
|
|
97
97
|
truncate: r
|
|
98
98
|
});
|
|
99
|
-
},
|
|
99
|
+
}, le = ({
|
|
100
100
|
mode: e,
|
|
101
101
|
noBackground: t,
|
|
102
102
|
variant: r
|
|
103
103
|
}) => {
|
|
104
104
|
if (!t) {
|
|
105
105
|
if (r === "primary")
|
|
106
|
-
return
|
|
106
|
+
return n({
|
|
107
107
|
"bg-action-dark": e === "dark",
|
|
108
108
|
"bg-action-light": e === "light",
|
|
109
109
|
"bg-action-dark dark:bg-action-light": e === "system",
|
|
110
110
|
"bg-action-light dark:bg-action-dark": e === "alt-system"
|
|
111
111
|
});
|
|
112
112
|
if (r === "secondary")
|
|
113
|
-
return
|
|
113
|
+
return n({
|
|
114
114
|
"bg-action-dark": e === "light",
|
|
115
115
|
"bg-action-light": e === "dark",
|
|
116
116
|
"bg-action-dark dark:bg-action-light": e === "alt-system",
|
|
117
117
|
"bg-action-light dark:bg-action-dark": e === "system"
|
|
118
118
|
});
|
|
119
119
|
if (r === "danger")
|
|
120
|
-
return
|
|
120
|
+
return n({
|
|
121
121
|
"bg-action-danger-dark": e === "dark",
|
|
122
122
|
"bg-action-danger-light": e === "light",
|
|
123
123
|
"bg-action-danger-dark dark:bg-action-danger-light": e === "system",
|
|
@@ -126,13 +126,13 @@ const O = "av-button", T = "icon", M = "button", z = "link", ee = ({
|
|
|
126
126
|
if (r === "selected")
|
|
127
127
|
return "bg-action-selected-dark";
|
|
128
128
|
}
|
|
129
|
-
},
|
|
129
|
+
}, ce = ({
|
|
130
130
|
radius: e
|
|
131
|
-
}) =>
|
|
131
|
+
}) => n({
|
|
132
132
|
"rounded-full": e === "large",
|
|
133
133
|
"rounded-md": e === "medium",
|
|
134
134
|
"rounded-xs": e === "small"
|
|
135
|
-
}),
|
|
135
|
+
}), de = ({
|
|
136
136
|
mode: e,
|
|
137
137
|
disabled: t,
|
|
138
138
|
variant: r
|
|
@@ -140,21 +140,21 @@ const O = "av-button", T = "icon", M = "button", z = "link", ee = ({
|
|
|
140
140
|
if (t)
|
|
141
141
|
return "";
|
|
142
142
|
if (r === "primary")
|
|
143
|
-
return
|
|
143
|
+
return n("hover:text-copy-light-hover", {
|
|
144
144
|
"hover:bg-action-dark-hover": e === "dark",
|
|
145
145
|
"hover:bg-action-light-hover": e === "light",
|
|
146
146
|
"hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "system",
|
|
147
147
|
"hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "alt-system"
|
|
148
148
|
});
|
|
149
149
|
if (r === "secondary")
|
|
150
|
-
return
|
|
150
|
+
return n("hover:text-copy-light-hover", {
|
|
151
151
|
"hover:bg-action-dark-hover": e === "light",
|
|
152
152
|
"hover:bg-action-light-hover": e === "dark",
|
|
153
153
|
"hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "alt-system",
|
|
154
154
|
"hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "system"
|
|
155
155
|
});
|
|
156
156
|
if (r === "danger")
|
|
157
|
-
return
|
|
157
|
+
return n("hover:text-copy-light-hover", {
|
|
158
158
|
"hover:bg-action-danger-dark-hover": e === "dark",
|
|
159
159
|
"hover:bg-action-danger-light-hover": e === "light",
|
|
160
160
|
"hover:bg-action-danger-dark-hover dark:hover:bg-action-danger-light-hover": e === "system",
|
|
@@ -162,7 +162,7 @@ const O = "av-button", T = "icon", M = "button", z = "link", ee = ({
|
|
|
162
162
|
});
|
|
163
163
|
if (r === "selected")
|
|
164
164
|
return "hover:text-copy-light-hover hover:bg-action-selected-dark-hover";
|
|
165
|
-
},
|
|
165
|
+
}, se = ({
|
|
166
166
|
mode: e,
|
|
167
167
|
disabled: t,
|
|
168
168
|
variant: r
|
|
@@ -170,21 +170,21 @@ const O = "av-button", T = "icon", M = "button", z = "link", ee = ({
|
|
|
170
170
|
if (t)
|
|
171
171
|
return "";
|
|
172
172
|
if (r === "primary")
|
|
173
|
-
return
|
|
173
|
+
return n("active:text-copy-light-active", {
|
|
174
174
|
"active:bg-action-dark-active": e === "dark",
|
|
175
175
|
"active:bg-action-light-active": e === "light",
|
|
176
176
|
"active:bg-action-dark-active dark:active:bg-action-light-active": e === "system",
|
|
177
177
|
"active:bg-action-light-active dark:active:bg-action-dark-active": e === "alt-system"
|
|
178
178
|
});
|
|
179
179
|
if (r === "secondary")
|
|
180
|
-
return
|
|
180
|
+
return n("active:text-copy-light-active", {
|
|
181
181
|
"active:bg-action-dark-active": e === "light",
|
|
182
182
|
"active:bg-action-light-active": e === "dark",
|
|
183
183
|
"active:bg-action-dark-active dark:active:bg-action-light-active": e === "alt-system",
|
|
184
184
|
"active:bg-action-light-active dark:active:bg-action-dark-active": e === "system"
|
|
185
185
|
});
|
|
186
186
|
if (r === "danger")
|
|
187
|
-
return
|
|
187
|
+
return n("active:text-copy-lighter-active", {
|
|
188
188
|
"active:bg-action-danger-dark-active": e === "dark",
|
|
189
189
|
"active:bg-action-danger-light-active": e === "light",
|
|
190
190
|
"active:bg-action-danger-dark-active dark:active:bg-action-danger-light-active": e === "system",
|
|
@@ -192,7 +192,7 @@ const O = "av-button", T = "icon", M = "button", z = "link", ee = ({
|
|
|
192
192
|
});
|
|
193
193
|
if (r === "selected")
|
|
194
194
|
return "active:text-copy-lighter-active active:bg-action-selected-dark-active";
|
|
195
|
-
},
|
|
195
|
+
}, ue = ({
|
|
196
196
|
mode: e,
|
|
197
197
|
noBorder: t,
|
|
198
198
|
variant: r
|
|
@@ -200,21 +200,21 @@ const O = "av-button", T = "icon", M = "button", z = "link", ee = ({
|
|
|
200
200
|
if (t)
|
|
201
201
|
return "border border-transparent";
|
|
202
202
|
if (r === "primary")
|
|
203
|
-
return
|
|
203
|
+
return n("border", {
|
|
204
204
|
"border-border-dark": e === "dark",
|
|
205
205
|
"border-border-accent": e === "light",
|
|
206
206
|
"border-border-dark dark:border-border-accent": e === "system",
|
|
207
207
|
"border-border-accent dark:border-border-dark": e === "alt-system"
|
|
208
208
|
});
|
|
209
209
|
if (r === "secondary")
|
|
210
|
-
return
|
|
210
|
+
return n("border", {
|
|
211
211
|
"border-border-dark": e === "light",
|
|
212
212
|
"border-border-accent": e === "dark",
|
|
213
213
|
"border-border-dark dark:border-border-accent": e === "alt-system",
|
|
214
214
|
"border-border-accent dark:border-border-dark": e === "system"
|
|
215
215
|
});
|
|
216
216
|
if (r === "danger")
|
|
217
|
-
return
|
|
217
|
+
return n("border", {
|
|
218
218
|
"border-border-danger-dark": e === "dark",
|
|
219
219
|
"border-border-danger-medium": e === "light",
|
|
220
220
|
"border-border-danger-dark dark:border-border-danger-medium": e === "system",
|
|
@@ -222,18 +222,18 @@ const O = "av-button", T = "icon", M = "button", z = "link", ee = ({
|
|
|
222
222
|
});
|
|
223
223
|
if (r === "selected")
|
|
224
224
|
return "border border-border-selected-dark";
|
|
225
|
-
},
|
|
225
|
+
}, ge = ({
|
|
226
226
|
focusMode: e
|
|
227
|
-
}) =>
|
|
227
|
+
}) => n("focus:outline", "focus:outline-2", "focus:outline-offset-2", {
|
|
228
228
|
"focus:outline-focus-dark": e === "dark",
|
|
229
229
|
"focus:outline-focus-light": e === "light",
|
|
230
230
|
"focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
|
|
231
231
|
"focus:outline-focus-dark dark:focus:outline-focus-light": e === "system"
|
|
232
|
-
}),
|
|
232
|
+
}), me = ({
|
|
233
233
|
mode: e,
|
|
234
234
|
raw: t,
|
|
235
235
|
iconClassName: r
|
|
236
|
-
}) => t ? "" :
|
|
236
|
+
}) => t ? "" : n(
|
|
237
237
|
{
|
|
238
238
|
"text-copy-accent-dark": e === "light" || e === "alt-system",
|
|
239
239
|
"text-copy-light": e === "dark" || e === "system",
|
|
@@ -241,134 +241,134 @@ const O = "av-button", T = "icon", M = "button", z = "link", ee = ({
|
|
|
241
241
|
"dark:text-copy-accent-dark": e === "system"
|
|
242
242
|
},
|
|
243
243
|
r
|
|
244
|
-
),
|
|
244
|
+
), he = ({
|
|
245
245
|
animated: e
|
|
246
|
-
}) =>
|
|
247
|
-
"transition-opacity duration-300 ease-in": e
|
|
248
|
-
}),
|
|
246
|
+
}) => n({
|
|
247
|
+
"transition-opacity duration-300 ease-in-out": e
|
|
248
|
+
}), V = ({
|
|
249
249
|
type: e,
|
|
250
250
|
className: t,
|
|
251
251
|
raw: r,
|
|
252
252
|
mode: a,
|
|
253
|
-
focusMode:
|
|
253
|
+
focusMode: o,
|
|
254
254
|
disabled: i,
|
|
255
|
-
fullWidth:
|
|
256
|
-
size:
|
|
255
|
+
fullWidth: l,
|
|
256
|
+
size: d,
|
|
257
257
|
noBorder: s,
|
|
258
|
-
labelRight:
|
|
259
|
-
labelLeft:
|
|
258
|
+
labelRight: f,
|
|
259
|
+
labelLeft: k,
|
|
260
260
|
noBackground: u,
|
|
261
|
-
variant:
|
|
261
|
+
variant: c,
|
|
262
262
|
truncate: m,
|
|
263
|
-
align:
|
|
264
|
-
radius:
|
|
265
|
-
animated:
|
|
266
|
-
}) => (
|
|
267
|
-
|
|
268
|
-
|
|
263
|
+
align: N,
|
|
264
|
+
radius: E,
|
|
265
|
+
animated: T
|
|
266
|
+
}) => (c || (c = "primary"), r ? n(F, t) : n(
|
|
267
|
+
F,
|
|
268
|
+
oe({
|
|
269
269
|
mode: a,
|
|
270
|
-
variant:
|
|
270
|
+
variant: c,
|
|
271
271
|
noBackground: u,
|
|
272
272
|
truncate: m
|
|
273
273
|
}),
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
274
|
+
le({ mode: a, noBackground: u, variant: c }),
|
|
275
|
+
ce({ radius: E }),
|
|
276
|
+
ie({
|
|
277
277
|
type: e,
|
|
278
|
-
size:
|
|
279
|
-
labelRight:
|
|
280
|
-
labelLeft:
|
|
281
|
-
align:
|
|
282
|
-
animated:
|
|
278
|
+
size: d,
|
|
279
|
+
labelRight: f,
|
|
280
|
+
labelLeft: k,
|
|
281
|
+
align: N,
|
|
282
|
+
animated: T
|
|
283
283
|
}),
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
284
|
+
ne({ type: e, size: d, labelRight: f, labelLeft: k }),
|
|
285
|
+
ue({ mode: a, variant: c, noBorder: s }),
|
|
286
|
+
ge({ focusMode: o }),
|
|
287
|
+
de({ mode: a, variant: c, disabled: i }),
|
|
288
|
+
se({ mode: a, variant: c, disabled: i }),
|
|
289
289
|
{
|
|
290
|
-
"w-full":
|
|
290
|
+
"w-full": l,
|
|
291
291
|
"disabled:cursor-not-allowed disabled:opacity-50": i
|
|
292
292
|
},
|
|
293
|
-
|
|
294
|
-
"transition-[width] duration-300 ease-in
|
|
293
|
+
n({
|
|
294
|
+
"transition-[width] duration-300 ease-in": e === R && T
|
|
295
295
|
}),
|
|
296
296
|
t
|
|
297
|
-
)),
|
|
297
|
+
)), be = (e, t, r) => {
|
|
298
298
|
var a;
|
|
299
299
|
!t && (!document.activeElement || document.activeElement !== e.currentTarget) && typeof ((a = e == null ? void 0 : e.currentTarget) == null ? void 0 : a.focus) == "function" && e.currentTarget.focus(), typeof r == "function" && r(e);
|
|
300
|
-
},
|
|
301
|
-
const { onClick: r, noInternalClick: a = !1, ...
|
|
300
|
+
}, O = I.forwardRef((e, t) => {
|
|
301
|
+
const { onClick: r, noInternalClick: a = !1, ...o } = e;
|
|
302
302
|
return /* @__PURE__ */ g(
|
|
303
303
|
"button",
|
|
304
304
|
{
|
|
305
305
|
ref: t,
|
|
306
306
|
onClick: (i) => {
|
|
307
|
-
|
|
307
|
+
be(i, a, r);
|
|
308
308
|
},
|
|
309
|
-
...
|
|
309
|
+
...o
|
|
310
310
|
}
|
|
311
311
|
);
|
|
312
312
|
});
|
|
313
|
-
|
|
314
|
-
const
|
|
313
|
+
O.displayName = "BaseButton";
|
|
314
|
+
const J = I.forwardRef(
|
|
315
315
|
({
|
|
316
316
|
children: e,
|
|
317
317
|
disabled: t = !1,
|
|
318
318
|
mode: r = "system",
|
|
319
319
|
focusMode: a = "system",
|
|
320
|
-
fullWidth:
|
|
320
|
+
fullWidth: o = !1,
|
|
321
321
|
className: i,
|
|
322
|
-
size:
|
|
323
|
-
raw:
|
|
322
|
+
size: l = "medium",
|
|
323
|
+
raw: d = !1,
|
|
324
324
|
noBorder: s = !1,
|
|
325
|
-
variant:
|
|
326
|
-
truncate:
|
|
325
|
+
variant: f = "primary",
|
|
326
|
+
truncate: k = !1,
|
|
327
327
|
radius: u = "large",
|
|
328
|
-
...
|
|
328
|
+
...c
|
|
329
329
|
}, m) => {
|
|
330
|
-
const
|
|
331
|
-
type:
|
|
330
|
+
const N = V({
|
|
331
|
+
type: S,
|
|
332
332
|
mode: r,
|
|
333
333
|
focusMode: a,
|
|
334
|
-
fullWidth:
|
|
334
|
+
fullWidth: o,
|
|
335
335
|
disabled: t,
|
|
336
|
-
raw:
|
|
336
|
+
raw: d,
|
|
337
337
|
className: i,
|
|
338
|
-
size:
|
|
338
|
+
size: l,
|
|
339
339
|
noBorder: s,
|
|
340
|
-
variant:
|
|
341
|
-
truncate:
|
|
340
|
+
variant: f,
|
|
341
|
+
truncate: k,
|
|
342
342
|
radius: u
|
|
343
343
|
});
|
|
344
344
|
return /* @__PURE__ */ g(
|
|
345
|
-
|
|
345
|
+
O,
|
|
346
346
|
{
|
|
347
347
|
ref: m,
|
|
348
|
-
className:
|
|
348
|
+
className: N,
|
|
349
349
|
disabled: t,
|
|
350
|
-
...
|
|
350
|
+
...c,
|
|
351
351
|
children: e
|
|
352
352
|
}
|
|
353
353
|
);
|
|
354
354
|
}
|
|
355
355
|
);
|
|
356
|
-
|
|
357
|
-
function
|
|
358
|
-
const e =
|
|
359
|
-
return
|
|
356
|
+
J.displayName = "Button";
|
|
357
|
+
function fe() {
|
|
358
|
+
const e = w(!1);
|
|
359
|
+
return A(() => (e.current = !0, () => {
|
|
360
360
|
e.current = !1;
|
|
361
|
-
}), []),
|
|
361
|
+
}), []), ae(() => e.current, []);
|
|
362
362
|
}
|
|
363
|
-
function
|
|
364
|
-
return
|
|
363
|
+
function ye(e) {
|
|
364
|
+
return P(() => e.every((t) => t == null) ? () => {
|
|
365
365
|
} : (t) => {
|
|
366
366
|
e.forEach((r) => {
|
|
367
367
|
typeof r == "function" ? r(t) : r != null && (r.current = t);
|
|
368
368
|
});
|
|
369
|
-
}, e);
|
|
369
|
+
}, [...e]);
|
|
370
370
|
}
|
|
371
|
-
const
|
|
371
|
+
const ve = {
|
|
372
372
|
x: 0,
|
|
373
373
|
y: 0,
|
|
374
374
|
width: 0,
|
|
@@ -378,148 +378,166 @@ const me = {
|
|
|
378
378
|
bottom: 0,
|
|
379
379
|
right: 0
|
|
380
380
|
};
|
|
381
|
-
function
|
|
382
|
-
const t =
|
|
383
|
-
const s =
|
|
381
|
+
function M(e) {
|
|
382
|
+
const t = fe(), r = w(0), a = w(null), [o, i] = G(ve), l = P(() => typeof ResizeObserver > "u" ? null : new ResizeObserver((d) => {
|
|
383
|
+
const s = d[0];
|
|
384
384
|
s && (cancelAnimationFrame(r.current), r.current = requestAnimationFrame(() => {
|
|
385
385
|
a.current && t() && i(s.contentRect);
|
|
386
386
|
}));
|
|
387
387
|
}), [t]);
|
|
388
|
-
return
|
|
389
|
-
|
|
390
|
-
}), [
|
|
388
|
+
return A(() => (a.current && (l == null || l.observe(a.current, e)), () => {
|
|
389
|
+
l == null || l.disconnect(), r.current && cancelAnimationFrame(r.current);
|
|
390
|
+
}), [l, e]), [a, o];
|
|
391
391
|
}
|
|
392
|
-
const
|
|
392
|
+
const C = {
|
|
393
393
|
small: 24,
|
|
394
394
|
// w-6
|
|
395
395
|
medium: 32,
|
|
396
396
|
// w-8
|
|
397
397
|
large: 48
|
|
398
398
|
// w-12
|
|
399
|
-
},
|
|
399
|
+
}, ke = {
|
|
400
400
|
small: 8 * 2,
|
|
401
401
|
// px-2 x 2
|
|
402
402
|
medium: 12 * 2,
|
|
403
403
|
// px-3 x 2
|
|
404
404
|
large: 16 * 2
|
|
405
405
|
// px-4 x 2
|
|
406
|
-
},
|
|
406
|
+
}, pe = 2, xe = 300, K = I.forwardRef(
|
|
407
407
|
({
|
|
408
408
|
children: e,
|
|
409
409
|
disabled: t = !1,
|
|
410
410
|
mode: r = "system",
|
|
411
411
|
focusMode: a = "system",
|
|
412
|
-
fullWidth:
|
|
412
|
+
fullWidth: o = !1,
|
|
413
413
|
className: i,
|
|
414
|
-
type:
|
|
415
|
-
raw:
|
|
414
|
+
type: l = "button",
|
|
415
|
+
raw: d = !1,
|
|
416
416
|
noBorder: s = !1,
|
|
417
|
-
"aria-label":
|
|
418
|
-
label:
|
|
417
|
+
"aria-label": f,
|
|
418
|
+
label: k,
|
|
419
419
|
size: u = "medium",
|
|
420
|
-
labelRight:
|
|
420
|
+
labelRight: c,
|
|
421
421
|
labelLeft: m,
|
|
422
|
-
noBackground:
|
|
423
|
-
align:
|
|
424
|
-
radius:
|
|
425
|
-
variant:
|
|
422
|
+
noBackground: N = !1,
|
|
423
|
+
align: E = "center",
|
|
424
|
+
radius: T = "large",
|
|
425
|
+
variant: Q = "primary",
|
|
426
426
|
iconClassName: X,
|
|
427
427
|
animated: y = !1,
|
|
428
|
-
...
|
|
429
|
-
},
|
|
430
|
-
const
|
|
431
|
-
type:
|
|
428
|
+
...Y
|
|
429
|
+
}, Z) => {
|
|
430
|
+
const $ = V({
|
|
431
|
+
type: R,
|
|
432
432
|
mode: r,
|
|
433
433
|
focusMode: a,
|
|
434
|
-
fullWidth:
|
|
434
|
+
fullWidth: o,
|
|
435
435
|
disabled: t,
|
|
436
|
-
raw:
|
|
436
|
+
raw: d,
|
|
437
437
|
className: i,
|
|
438
438
|
noBorder: s,
|
|
439
439
|
size: u,
|
|
440
|
-
labelRight:
|
|
440
|
+
labelRight: c,
|
|
441
441
|
labelLeft: m,
|
|
442
|
-
noBackground:
|
|
443
|
-
align:
|
|
444
|
-
radius:
|
|
445
|
-
variant:
|
|
442
|
+
noBackground: N,
|
|
443
|
+
align: E,
|
|
444
|
+
radius: T,
|
|
445
|
+
variant: Q,
|
|
446
446
|
animated: y
|
|
447
|
-
}),
|
|
448
|
-
return
|
|
449
|
-
|
|
450
|
-
}, [
|
|
451
|
-
|
|
447
|
+
}), ee = me({ mode: r, raw: d, iconClassName: X }), U = he({ animated: y }), re = "flex items-center justify-center relative w-full h-full overflow-hidden", [h, _] = M(), [b, z] = M(), [B, W] = M(), L = w(0), v = w(null), p = w(null), te = ye([Z, v]);
|
|
448
|
+
return D(() => {
|
|
449
|
+
B && B.current && y && (L.current = W.width + ke[u] + (s ? 0 : pe), v.current && !v.current.style.width && (v.current.style.width = `${C[u]}px`));
|
|
450
|
+
}, [W, B, u, s, y]), D(() => {
|
|
451
|
+
if (v && v.current && y) {
|
|
452
|
+
let x = C[u];
|
|
453
|
+
c && h && _.width > 0 ? x = _.width + L.current : m && b && z.width > 0 && (x = z.width + L.current), p.current && clearTimeout(p.current), x !== parseInt(v.current.style.width || "0", 10) && (h.current && (h.current.style.opacity = "0"), b.current && (b.current.style.opacity = "0"), v.current.style.width = `${x}px`, x > C[u] && (p.current = setTimeout(() => {
|
|
454
|
+
h.current && c && (h.current.style.opacity = "1"), b.current && m && (b.current.style.opacity = "1"), p.current = null;
|
|
455
|
+
}, xe * 0.8))), x === C[u] && (h.current && (h.current.style.opacity = "0"), b.current && (b.current.style.opacity = "0"));
|
|
456
|
+
}
|
|
452
457
|
}, [
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
458
|
+
_,
|
|
459
|
+
c,
|
|
460
|
+
h,
|
|
461
|
+
z,
|
|
457
462
|
m,
|
|
458
|
-
|
|
463
|
+
b,
|
|
459
464
|
u,
|
|
460
465
|
y
|
|
461
|
-
]),
|
|
462
|
-
|
|
466
|
+
]), A(() => () => {
|
|
467
|
+
p.current && clearTimeout(p.current);
|
|
468
|
+
}, []), /* @__PURE__ */ g(
|
|
469
|
+
O,
|
|
463
470
|
{
|
|
464
|
-
ref:
|
|
465
|
-
className:
|
|
471
|
+
ref: te,
|
|
472
|
+
className: $,
|
|
466
473
|
disabled: t,
|
|
467
|
-
type:
|
|
468
|
-
"aria-label":
|
|
469
|
-
...
|
|
470
|
-
children: [
|
|
474
|
+
type: l,
|
|
475
|
+
"aria-label": f || k,
|
|
476
|
+
...Y,
|
|
477
|
+
children: /* @__PURE__ */ q("div", { className: re, children: [
|
|
471
478
|
/* @__PURE__ */ g(
|
|
472
|
-
|
|
479
|
+
H,
|
|
473
480
|
{
|
|
474
481
|
label: m,
|
|
475
|
-
labelRef:
|
|
476
|
-
labelClass:
|
|
477
|
-
labelInnerClass: "pr-2"
|
|
482
|
+
labelRef: b,
|
|
483
|
+
labelClass: U,
|
|
484
|
+
labelInnerClass: "pr-2",
|
|
485
|
+
initiallyHidden: y
|
|
478
486
|
}
|
|
479
487
|
),
|
|
480
|
-
/* @__PURE__ */ g("span", { ref:
|
|
488
|
+
/* @__PURE__ */ g("span", { ref: B, className: ee, children: e }),
|
|
481
489
|
/* @__PURE__ */ g(
|
|
482
|
-
|
|
490
|
+
H,
|
|
483
491
|
{
|
|
484
|
-
label:
|
|
485
|
-
labelRef:
|
|
486
|
-
labelClass:
|
|
487
|
-
labelInnerClass: "pl-2"
|
|
492
|
+
label: c,
|
|
493
|
+
labelRef: h,
|
|
494
|
+
labelClass: U,
|
|
495
|
+
labelInnerClass: "pl-2",
|
|
496
|
+
initiallyHidden: y
|
|
488
497
|
}
|
|
489
498
|
)
|
|
490
|
-
]
|
|
499
|
+
] })
|
|
491
500
|
}
|
|
492
501
|
);
|
|
493
502
|
}
|
|
494
|
-
),
|
|
503
|
+
), H = ({
|
|
495
504
|
labelRef: e,
|
|
496
505
|
labelClass: t,
|
|
497
506
|
label: r,
|
|
498
|
-
labelInnerClass: a
|
|
499
|
-
|
|
500
|
-
|
|
507
|
+
labelInnerClass: a,
|
|
508
|
+
initiallyHidden: o = !1
|
|
509
|
+
}) => /* @__PURE__ */ g(
|
|
510
|
+
"span",
|
|
511
|
+
{
|
|
512
|
+
ref: e,
|
|
513
|
+
className: t,
|
|
514
|
+
style: o ? { opacity: 0 } : void 0,
|
|
515
|
+
children: r && /* @__PURE__ */ g("span", { className: a, children: r })
|
|
516
|
+
}
|
|
517
|
+
);
|
|
518
|
+
K.displayName = "ButtonIcon";
|
|
501
519
|
/*!
|
|
502
|
-
@versini/ui-button v6.0.
|
|
520
|
+
@versini/ui-button v6.0.7
|
|
503
521
|
© 2025 gizmette.com
|
|
504
522
|
*/
|
|
505
523
|
try {
|
|
506
524
|
window.__VERSINI_UI_BUTTON__ || (window.__VERSINI_UI_BUTTON__ = {
|
|
507
|
-
version: "6.0.
|
|
508
|
-
buildTime: "
|
|
525
|
+
version: "6.0.7",
|
|
526
|
+
buildTime: "06/20/2025 05:21 PM EDT",
|
|
509
527
|
homepage: "https://github.com/aversini/ui-components",
|
|
510
528
|
license: "MIT"
|
|
511
529
|
});
|
|
512
530
|
} catch {
|
|
513
531
|
}
|
|
514
|
-
const
|
|
532
|
+
const we = I.forwardRef(
|
|
515
533
|
({
|
|
516
534
|
children: e,
|
|
517
535
|
mode: t = "system",
|
|
518
536
|
className: r,
|
|
519
537
|
active: a = !1,
|
|
520
|
-
...
|
|
538
|
+
...o
|
|
521
539
|
}, i) => {
|
|
522
|
-
const
|
|
540
|
+
const l = a ? n(
|
|
523
541
|
"relative",
|
|
524
542
|
"focus-within:static",
|
|
525
543
|
"focus-within:after:border-transparent",
|
|
@@ -536,63 +554,63 @@ const ve = B.forwardRef(
|
|
|
536
554
|
"after:border-table-light dark:after:border-table-dark": t === "alt-system"
|
|
537
555
|
}
|
|
538
556
|
) : "";
|
|
539
|
-
return /* @__PURE__ */ g("div", { className:
|
|
540
|
-
|
|
557
|
+
return /* @__PURE__ */ g("div", { className: l, children: /* @__PURE__ */ g(
|
|
558
|
+
K,
|
|
541
559
|
{
|
|
542
|
-
className:
|
|
560
|
+
className: n("justify-center", r),
|
|
543
561
|
ref: i,
|
|
544
562
|
mode: t,
|
|
545
563
|
radius: "small",
|
|
546
|
-
...
|
|
564
|
+
...o,
|
|
547
565
|
children: e
|
|
548
566
|
}
|
|
549
567
|
) });
|
|
550
568
|
}
|
|
551
569
|
);
|
|
552
|
-
|
|
553
|
-
const
|
|
570
|
+
we.displayName = "ButtonSort";
|
|
571
|
+
const Ne = 200, Te = ({
|
|
554
572
|
string: e,
|
|
555
|
-
idealLength: t =
|
|
573
|
+
idealLength: t = Ne
|
|
556
574
|
}) => {
|
|
557
575
|
if (e.length <= t)
|
|
558
576
|
return { string: e, isTruncated: !1 };
|
|
559
577
|
if (e.charAt(t) === " ")
|
|
560
578
|
return { string: e.slice(0, t), isTruncated: !0 };
|
|
561
|
-
const
|
|
579
|
+
const o = e.slice(t).search(" ");
|
|
562
580
|
return {
|
|
563
|
-
string: e.slice(0, t +
|
|
581
|
+
string: e.slice(0, t + o),
|
|
564
582
|
isTruncated: !0
|
|
565
583
|
};
|
|
566
|
-
},
|
|
584
|
+
}, Re = ({
|
|
567
585
|
children: e,
|
|
568
586
|
length: t = 200,
|
|
569
587
|
mode: r = "system",
|
|
570
588
|
focusMode: a = "system"
|
|
571
589
|
}) => {
|
|
572
|
-
const [
|
|
590
|
+
const [o, i] = G(!1);
|
|
573
591
|
if (typeof e != "string")
|
|
574
592
|
return e;
|
|
575
|
-
const { string:
|
|
593
|
+
const { string: l, isTruncated: d } = Te({
|
|
576
594
|
string: e,
|
|
577
595
|
idealLength: t
|
|
578
596
|
});
|
|
579
|
-
return /* @__PURE__ */
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
597
|
+
return /* @__PURE__ */ q("span", { style: { wordBreak: "break-word" }, children: [
|
|
598
|
+
o ? e : l,
|
|
599
|
+
d && /* @__PURE__ */ g(
|
|
600
|
+
J,
|
|
583
601
|
{
|
|
584
602
|
mode: r,
|
|
585
603
|
focusMode: a,
|
|
586
604
|
className: "ml-2",
|
|
587
605
|
size: "small",
|
|
588
|
-
onClick: (
|
|
589
|
-
|
|
606
|
+
onClick: (f) => {
|
|
607
|
+
f.preventDefault(), i(!o);
|
|
590
608
|
},
|
|
591
|
-
children:
|
|
609
|
+
children: o ? "less..." : "more..."
|
|
592
610
|
}
|
|
593
611
|
)
|
|
594
612
|
] });
|
|
595
613
|
};
|
|
596
614
|
export {
|
|
597
|
-
|
|
615
|
+
Re as Truncate
|
|
598
616
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Truncate as o } from "./components/Truncate/Truncate.js";
|
|
2
2
|
/*!
|
|
3
|
-
@versini/ui-truncate v4.0.
|
|
3
|
+
@versini/ui-truncate v4.0.7
|
|
4
4
|
© 2025 gizmette.com
|
|
5
5
|
*/
|
|
6
6
|
try {
|
|
7
7
|
window.__VERSINI_UI_TRUNCATE__ || (window.__VERSINI_UI_TRUNCATE__ = {
|
|
8
|
-
version: "4.0.
|
|
9
|
-
buildTime: "
|
|
8
|
+
version: "4.0.7",
|
|
9
|
+
buildTime: "06/20/2025 05:21 PM EDT",
|
|
10
10
|
homepage: "https://github.com/aversini/ui-components",
|
|
11
11
|
license: "MIT"
|
|
12
12
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/ui-truncate",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@tailwindcss/typography": "0.5.16",
|
|
43
|
-
"@versini/ui-button": "6.0.
|
|
44
|
-
"tailwindcss": "4.1.
|
|
43
|
+
"@versini/ui-button": "6.0.7",
|
|
44
|
+
"tailwindcss": "4.1.10"
|
|
45
45
|
},
|
|
46
46
|
"sideEffects": [
|
|
47
47
|
"**/*.css"
|
|
48
48
|
],
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "2fffae99315244f0662bdecbe45a89bc770f0f15"
|
|
50
50
|
}
|