@versini/ui-truncate 1.1.1 → 1.1.3
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 +59 -45
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -3
- package/package.json +3 -3
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import { jsx as h, jsxs as x } from "react/jsx-runtime";
|
|
2
2
|
import o from "clsx";
|
|
3
|
-
import k, { useState as
|
|
4
|
-
const
|
|
3
|
+
import k, { useState as U } from "react";
|
|
4
|
+
const y = "av-button";
|
|
5
|
+
/*!
|
|
6
|
+
@versini/ui-spacing v1.0.0
|
|
7
|
+
© 2024 gizmette.com
|
|
8
|
+
*/
|
|
9
|
+
try {
|
|
10
|
+
window.__VERSINI_UI_SPACING__ || (window.__VERSINI_UI_SPACING__ = {
|
|
11
|
+
version: "1.0.0",
|
|
12
|
+
buildTime: "12/24/2024 06:47 PM EST",
|
|
13
|
+
homepage: "https://github.com/aversini/ui-components",
|
|
14
|
+
license: "MIT"
|
|
15
|
+
});
|
|
16
|
+
} catch {
|
|
17
|
+
}
|
|
18
|
+
const C = (e) => {
|
|
5
19
|
let t = "";
|
|
6
20
|
if (typeof e == "number" || typeof e == "string")
|
|
7
21
|
t = "m-" + e;
|
|
@@ -10,7 +24,7 @@ const p = "av-button", S = (e) => {
|
|
|
10
24
|
(e == null ? void 0 : e.t) !== void 0 && r.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && r.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && r.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && r.push(`ml-${e.l}`), t = r.join(" ");
|
|
11
25
|
}
|
|
12
26
|
return t;
|
|
13
|
-
}, T = "icon", w = "button",
|
|
27
|
+
}, T = "icon", w = "button", j = "link", L = ({
|
|
14
28
|
type: e,
|
|
15
29
|
size: t,
|
|
16
30
|
labelRight: r,
|
|
@@ -25,7 +39,7 @@ const p = "av-button", S = (e) => {
|
|
|
25
39
|
[l]: t === "medium",
|
|
26
40
|
[n]: t === "large"
|
|
27
41
|
});
|
|
28
|
-
case
|
|
42
|
+
case j:
|
|
29
43
|
return o("px-4 text-center", {
|
|
30
44
|
[d]: t === "small",
|
|
31
45
|
[l]: t === "medium",
|
|
@@ -76,7 +90,7 @@ const p = "av-button", S = (e) => {
|
|
|
76
90
|
"bg-action-danger-dark text-copy-light dark:bg-action-danger-light dark:text-copy-lighter": e === "system",
|
|
77
91
|
"bg-action-danger-light text-copy-lighter dark:bg-action-danger-dark dark:text-copy-light": e === "alt-system"
|
|
78
92
|
});
|
|
79
|
-
},
|
|
93
|
+
}, A = ({
|
|
80
94
|
mode: e,
|
|
81
95
|
disabled: t,
|
|
82
96
|
variant: r
|
|
@@ -104,7 +118,7 @@ const p = "av-button", S = (e) => {
|
|
|
104
118
|
"hover:bg-action-danger-dark-hover dark:hover:bg-action-danger-light-hover": e === "system",
|
|
105
119
|
"hover:bg-action-danger-light-hover dark:hover:bg-action-danger-dark-hover": e === "alt-system"
|
|
106
120
|
});
|
|
107
|
-
},
|
|
121
|
+
}, P = ({
|
|
108
122
|
mode: e,
|
|
109
123
|
disabled: t,
|
|
110
124
|
variant: r
|
|
@@ -132,7 +146,7 @@ const p = "av-button", S = (e) => {
|
|
|
132
146
|
"active:bg-action-danger-dark-active dark:active:bg-action-danger-light-active": e === "system",
|
|
133
147
|
"active:bg-action-danger-light-active dark:active:bg-action-danger-dark-active": e === "alt-system"
|
|
134
148
|
});
|
|
135
|
-
},
|
|
149
|
+
}, V = ({
|
|
136
150
|
mode: e,
|
|
137
151
|
noBorder: t,
|
|
138
152
|
variant: r
|
|
@@ -160,12 +174,12 @@ const p = "av-button", S = (e) => {
|
|
|
160
174
|
"border-border-danger-dark dark:border-border-danger-medium": e === "system",
|
|
161
175
|
"border-border-danger-medium dark:border-border-danger-dark": e === "alt-system"
|
|
162
176
|
});
|
|
163
|
-
},
|
|
177
|
+
}, $ = ({ focusMode: e }) => o("focus:outline", "focus:outline-2", "focus:outline-offset-2", {
|
|
164
178
|
"focus:outline-focus-dark": e === "dark",
|
|
165
179
|
"focus:outline-focus-light": e === "light",
|
|
166
180
|
"focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
|
|
167
181
|
"focus:outline-focus-dark dark:focus:outline-focus-light": e === "system"
|
|
168
|
-
}),
|
|
182
|
+
}), _ = ({
|
|
169
183
|
type: e,
|
|
170
184
|
className: t,
|
|
171
185
|
raw: r,
|
|
@@ -182,37 +196,37 @@ const p = "av-button", S = (e) => {
|
|
|
182
196
|
variant: c,
|
|
183
197
|
noTruncate: v,
|
|
184
198
|
align: f
|
|
185
|
-
}) => (c || (c = "primary"), r ? o(
|
|
186
|
-
|
|
199
|
+
}) => (c || (c = "primary"), r ? o(y, t) : o(
|
|
200
|
+
y,
|
|
187
201
|
t,
|
|
188
|
-
|
|
202
|
+
C(m),
|
|
189
203
|
W({ mode: a, variant: c, noBackground: g, noTruncate: v }),
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
$({ mode: a, variant: c, disabled: d }),
|
|
204
|
+
L({ type: e, size: n, labelRight: s, labelLeft: b, align: f }),
|
|
205
|
+
V({ mode: a, variant: c, noBorder: u }),
|
|
206
|
+
$({ focusMode: i }),
|
|
194
207
|
A({ mode: a, variant: c, disabled: d }),
|
|
208
|
+
P({ mode: a, variant: c, disabled: d }),
|
|
195
209
|
{
|
|
196
210
|
"w-full": l,
|
|
197
211
|
"disabled:cursor-not-allowed disabled:opacity-50": d
|
|
198
212
|
}
|
|
199
|
-
)),
|
|
213
|
+
)), G = (e, t, r) => {
|
|
200
214
|
var a;
|
|
201
215
|
!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);
|
|
202
|
-
},
|
|
216
|
+
}, p = k.forwardRef((e, t) => {
|
|
203
217
|
const { onClick: r, noInternalClick: a = !1, ...i } = e;
|
|
204
218
|
return /* @__PURE__ */ h(
|
|
205
219
|
"button",
|
|
206
220
|
{
|
|
207
221
|
ref: t,
|
|
208
222
|
onClick: (d) => {
|
|
209
|
-
|
|
223
|
+
G(d, a, r);
|
|
210
224
|
},
|
|
211
225
|
...i
|
|
212
226
|
}
|
|
213
227
|
);
|
|
214
228
|
});
|
|
215
|
-
|
|
229
|
+
p.displayName = "BaseButton";
|
|
216
230
|
const N = k.forwardRef(
|
|
217
231
|
({
|
|
218
232
|
children: e,
|
|
@@ -229,7 +243,7 @@ const N = k.forwardRef(
|
|
|
229
243
|
noTruncate: m = !1,
|
|
230
244
|
...g
|
|
231
245
|
}, c) => {
|
|
232
|
-
const v =
|
|
246
|
+
const v = _({
|
|
233
247
|
type: w,
|
|
234
248
|
mode: r,
|
|
235
249
|
focusMode: a,
|
|
@@ -244,7 +258,7 @@ const N = k.forwardRef(
|
|
|
244
258
|
noTruncate: m
|
|
245
259
|
});
|
|
246
260
|
return /* @__PURE__ */ h(
|
|
247
|
-
|
|
261
|
+
p,
|
|
248
262
|
{
|
|
249
263
|
ref: c,
|
|
250
264
|
className: v,
|
|
@@ -257,19 +271,19 @@ const N = k.forwardRef(
|
|
|
257
271
|
);
|
|
258
272
|
N.displayName = "Button";
|
|
259
273
|
/*!
|
|
260
|
-
@versini/ui-button v1.
|
|
274
|
+
@versini/ui-button v1.3.0
|
|
261
275
|
© 2024 gizmette.com
|
|
262
276
|
*/
|
|
263
277
|
try {
|
|
264
278
|
window.__VERSINI_UI_BUTTON__ || (window.__VERSINI_UI_BUTTON__ = {
|
|
265
|
-
version: "1.
|
|
266
|
-
buildTime: "12/
|
|
279
|
+
version: "1.3.0",
|
|
280
|
+
buildTime: "12/24/2024 06:47 PM EST",
|
|
267
281
|
homepage: "https://github.com/aversini/ui-components",
|
|
268
282
|
license: "MIT"
|
|
269
283
|
});
|
|
270
284
|
} catch {
|
|
271
285
|
}
|
|
272
|
-
const
|
|
286
|
+
const D = k.forwardRef(
|
|
273
287
|
({
|
|
274
288
|
children: e,
|
|
275
289
|
disabled: t = !1,
|
|
@@ -287,11 +301,11 @@ const F = k.forwardRef(
|
|
|
287
301
|
labelLeft: c,
|
|
288
302
|
spacing: v,
|
|
289
303
|
noBackground: f = !1,
|
|
290
|
-
align:
|
|
291
|
-
active:
|
|
292
|
-
...
|
|
293
|
-
},
|
|
294
|
-
const M =
|
|
304
|
+
align: B = "center",
|
|
305
|
+
active: I = !1,
|
|
306
|
+
...E
|
|
307
|
+
}, R) => {
|
|
308
|
+
const M = _({
|
|
295
309
|
type: T,
|
|
296
310
|
mode: r,
|
|
297
311
|
focusMode: a,
|
|
@@ -305,13 +319,13 @@ const F = k.forwardRef(
|
|
|
305
319
|
labelLeft: c,
|
|
306
320
|
spacing: v,
|
|
307
321
|
noBackground: f,
|
|
308
|
-
align:
|
|
309
|
-
}),
|
|
322
|
+
align: B
|
|
323
|
+
}), S = o({
|
|
310
324
|
"text-copy-accent-dark": r === "light" && !n,
|
|
311
325
|
"text-copy-light": r === "dark" && !n,
|
|
312
326
|
"text-copy-accent-dark dark:text-copy-light": r === "alt-system" && !n,
|
|
313
327
|
"text-copy-light dark:text-copy-accent-dark": r === "system" && !n
|
|
314
|
-
}),
|
|
328
|
+
}), z = I ? o(
|
|
315
329
|
"relative",
|
|
316
330
|
"focus-within:static",
|
|
317
331
|
"focus-within:after:border-transparent",
|
|
@@ -328,28 +342,28 @@ const F = k.forwardRef(
|
|
|
328
342
|
"after:border-table-light dark:after:border-table-dark": r === "alt-system"
|
|
329
343
|
}
|
|
330
344
|
) : "";
|
|
331
|
-
return /* @__PURE__ */ h("div", { className:
|
|
332
|
-
|
|
345
|
+
return /* @__PURE__ */ h("div", { className: z, children: /* @__PURE__ */ x(
|
|
346
|
+
p,
|
|
333
347
|
{
|
|
334
|
-
ref:
|
|
348
|
+
ref: R,
|
|
335
349
|
className: M,
|
|
336
350
|
disabled: t,
|
|
337
351
|
type: l,
|
|
338
352
|
"aria-label": s || b,
|
|
339
|
-
...
|
|
353
|
+
...E,
|
|
340
354
|
children: [
|
|
341
355
|
c && /* @__PURE__ */ h("span", { className: "pr-2", children: c }),
|
|
342
|
-
/* @__PURE__ */ h("div", { className:
|
|
356
|
+
/* @__PURE__ */ h("div", { className: S, children: e }),
|
|
343
357
|
g && /* @__PURE__ */ h("span", { className: "pl-2", children: g })
|
|
344
358
|
]
|
|
345
359
|
}
|
|
346
360
|
) });
|
|
347
361
|
}
|
|
348
362
|
);
|
|
349
|
-
|
|
350
|
-
const
|
|
363
|
+
D.displayName = "ButtonSort";
|
|
364
|
+
const O = 200, F = ({
|
|
351
365
|
string: e,
|
|
352
|
-
idealLength: t =
|
|
366
|
+
idealLength: t = O
|
|
353
367
|
}) => {
|
|
354
368
|
if (e.length <= t)
|
|
355
369
|
return { string: e, isTruncated: !1 };
|
|
@@ -366,14 +380,14 @@ const G = 200, H = ({
|
|
|
366
380
|
mode: r = "system",
|
|
367
381
|
focusMode: a = "system"
|
|
368
382
|
}) => {
|
|
369
|
-
const [i, d] =
|
|
383
|
+
const [i, d] = U(!1);
|
|
370
384
|
if (typeof e != "string")
|
|
371
385
|
return e;
|
|
372
|
-
const { string: l, isTruncated: n } =
|
|
386
|
+
const { string: l, isTruncated: n } = F({
|
|
373
387
|
string: e,
|
|
374
388
|
idealLength: t
|
|
375
389
|
});
|
|
376
|
-
return /* @__PURE__ */ x("span", { children: [
|
|
390
|
+
return /* @__PURE__ */ x("span", { style: { wordBreak: "break-word" }, children: [
|
|
377
391
|
i ? e : l,
|
|
378
392
|
n && /* @__PURE__ */ h(
|
|
379
393
|
N,
|
package/dist/index.d.ts
CHANGED
|
@@ -8,15 +8,18 @@ type TruncateProps = {
|
|
|
8
8
|
children: React.ReactNode;
|
|
9
9
|
/**
|
|
10
10
|
* The maximum length of the text.
|
|
11
|
+
* @default 200
|
|
11
12
|
*/
|
|
12
13
|
length?: number;
|
|
13
14
|
/**
|
|
14
15
|
* The mode of Button. This will change the color of the Button.
|
|
16
|
+
* @default "system"
|
|
15
17
|
*/
|
|
16
18
|
mode?: "dark" | "light" | "system" | "alt-system";
|
|
17
19
|
/**
|
|
18
20
|
* The type of focus for the Button. This will change the color
|
|
19
21
|
* of the focus ring around the Button.
|
|
22
|
+
* @default "system"
|
|
20
23
|
*/
|
|
21
24
|
focusMode?: "dark" | "light" | "system" | "alt-system";
|
|
22
25
|
};
|
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 v1.1.
|
|
3
|
+
@versini/ui-truncate v1.1.3
|
|
4
4
|
© 2024 gizmette.com
|
|
5
5
|
*/
|
|
6
6
|
try {
|
|
7
7
|
window.__VERSINI_UI_TRUNCATE__ || (window.__VERSINI_UI_TRUNCATE__ = {
|
|
8
|
-
version: "1.1.
|
|
9
|
-
buildTime: "12/
|
|
8
|
+
version: "1.1.3",
|
|
9
|
+
buildTime: "12/24/2024 06:47 PM EST",
|
|
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": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@tailwindcss/typography": "0.5.15",
|
|
42
|
-
"@versini/ui-button": "1.
|
|
42
|
+
"@versini/ui-button": "1.3.0",
|
|
43
43
|
"tailwindcss": "3.4.17"
|
|
44
44
|
},
|
|
45
45
|
"sideEffects": [
|
|
46
46
|
"**/*.css"
|
|
47
47
|
],
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "cb948414a675c01f3328ed6470ccf4b58f73534f"
|
|
49
49
|
}
|