@versini/ui-truncate 1.0.0 → 1.0.1
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 +40 -37
- package/dist/index.js +3 -3
- package/package.json +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as h, jsxs as x } from "react/jsx-runtime";
|
|
2
2
|
import o from "clsx";
|
|
3
|
-
import k, { useState as
|
|
3
|
+
import k, { useState as L } from "react";
|
|
4
4
|
const p = "av-button", U = (e) => {
|
|
5
5
|
let t = "";
|
|
6
6
|
if (typeof e == "number" || typeof e == "string")
|
|
@@ -10,7 +10,7 @@ const p = "av-button", U = (e) => {
|
|
|
10
10
|
(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
11
|
}
|
|
12
12
|
return t;
|
|
13
|
-
}, T = "icon", w = "button",
|
|
13
|
+
}, T = "icon", w = "button", C = "link", S = ({
|
|
14
14
|
type: e,
|
|
15
15
|
size: t,
|
|
16
16
|
labelRight: r,
|
|
@@ -25,7 +25,7 @@ const p = "av-button", U = (e) => {
|
|
|
25
25
|
[l]: t === "medium",
|
|
26
26
|
[n]: t === "large"
|
|
27
27
|
});
|
|
28
|
-
case
|
|
28
|
+
case C:
|
|
29
29
|
return o("px-4 text-center", {
|
|
30
30
|
[d]: t === "small",
|
|
31
31
|
[l]: t === "medium",
|
|
@@ -104,7 +104,7 @@ const p = "av-button", U = (e) => {
|
|
|
104
104
|
"hover:bg-action-danger-dark-hover dark:hover:bg-action-danger-light-hover": e === "system",
|
|
105
105
|
"hover:bg-action-danger-light-hover dark:hover:bg-action-danger-dark-hover": e === "alt-system"
|
|
106
106
|
});
|
|
107
|
-
},
|
|
107
|
+
}, $ = ({
|
|
108
108
|
mode: e,
|
|
109
109
|
disabled: t,
|
|
110
110
|
variant: r
|
|
@@ -132,7 +132,7 @@ const p = "av-button", U = (e) => {
|
|
|
132
132
|
"active:bg-action-danger-dark-active dark:active:bg-action-danger-light-active": e === "system",
|
|
133
133
|
"active:bg-action-danger-light-active dark:active:bg-action-danger-dark-active": e === "alt-system"
|
|
134
134
|
});
|
|
135
|
-
},
|
|
135
|
+
}, A = ({
|
|
136
136
|
mode: e,
|
|
137
137
|
noBorder: t,
|
|
138
138
|
variant: r
|
|
@@ -160,7 +160,7 @@ const p = "av-button", U = (e) => {
|
|
|
160
160
|
"border-border-danger-dark dark:border-border-danger-medium": e === "system",
|
|
161
161
|
"border-border-danger-medium dark:border-border-danger-dark": e === "alt-system"
|
|
162
162
|
});
|
|
163
|
-
},
|
|
163
|
+
}, O = ({ focusMode: e }) => o("focus:outline", "focus:outline-2", "focus:outline-offset-2", {
|
|
164
164
|
"focus:outline-focus-dark": e === "dark",
|
|
165
165
|
"focus:outline-focus-light": e === "light",
|
|
166
166
|
"focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
|
|
@@ -187,16 +187,16 @@ const p = "av-button", U = (e) => {
|
|
|
187
187
|
t,
|
|
188
188
|
U(m),
|
|
189
189
|
W({ mode: a, variant: c, noBackground: g, noTruncate: v }),
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
190
|
+
S({ type: e, size: n, labelRight: s, labelLeft: b, align: f }),
|
|
191
|
+
A({ mode: a, variant: c, noBorder: u }),
|
|
192
|
+
O({ focusMode: i }),
|
|
193
193
|
D({ mode: a, variant: c, disabled: d }),
|
|
194
|
-
|
|
194
|
+
$({ mode: a, variant: c, disabled: d }),
|
|
195
195
|
{
|
|
196
196
|
"w-full": l,
|
|
197
197
|
"disabled:cursor-not-allowed disabled:opacity-50": d
|
|
198
198
|
}
|
|
199
|
-
)),
|
|
199
|
+
)), V = (e, t, r) => {
|
|
200
200
|
var a;
|
|
201
201
|
!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
202
|
}, y = k.forwardRef((e, t) => {
|
|
@@ -206,7 +206,7 @@ const p = "av-button", U = (e) => {
|
|
|
206
206
|
{
|
|
207
207
|
ref: t,
|
|
208
208
|
onClick: (d) => {
|
|
209
|
-
|
|
209
|
+
V(d, a, r);
|
|
210
210
|
},
|
|
211
211
|
...i
|
|
212
212
|
}
|
|
@@ -257,19 +257,19 @@ const N = k.forwardRef(
|
|
|
257
257
|
);
|
|
258
258
|
N.displayName = "Button";
|
|
259
259
|
/*!
|
|
260
|
-
@versini/ui-button v1.1.
|
|
260
|
+
@versini/ui-button v1.1.4
|
|
261
261
|
© 2024 gizmette.com
|
|
262
262
|
*/
|
|
263
263
|
try {
|
|
264
264
|
window.__VERSINI_UI_BUTTON__ || (window.__VERSINI_UI_BUTTON__ = {
|
|
265
|
-
version: "1.1.
|
|
266
|
-
buildTime: "09/
|
|
265
|
+
version: "1.1.4",
|
|
266
|
+
buildTime: "09/24/2024 07:45 PM EDT",
|
|
267
267
|
homepage: "https://github.com/aversini/ui-components",
|
|
268
268
|
license: "MIT"
|
|
269
269
|
});
|
|
270
270
|
} catch {
|
|
271
271
|
}
|
|
272
|
-
const
|
|
272
|
+
const F = k.forwardRef(
|
|
273
273
|
({
|
|
274
274
|
children: e,
|
|
275
275
|
disabled: t = !1,
|
|
@@ -289,8 +289,8 @@ const V = k.forwardRef(
|
|
|
289
289
|
noBackground: f = !1,
|
|
290
290
|
align: _ = "center",
|
|
291
291
|
active: E = !1,
|
|
292
|
-
...
|
|
293
|
-
},
|
|
292
|
+
...R
|
|
293
|
+
}, I) => {
|
|
294
294
|
const M = B({
|
|
295
295
|
type: T,
|
|
296
296
|
mode: r,
|
|
@@ -306,12 +306,12 @@ const V = k.forwardRef(
|
|
|
306
306
|
spacing: v,
|
|
307
307
|
noBackground: f,
|
|
308
308
|
align: _
|
|
309
|
-
}),
|
|
309
|
+
}), z = o({
|
|
310
310
|
"text-copy-accent-dark": r === "light" && !n,
|
|
311
311
|
"text-copy-light": r === "dark" && !n,
|
|
312
312
|
"text-copy-accent-dark dark:text-copy-light": r === "alt-system" && !n,
|
|
313
313
|
"text-copy-light dark:text-copy-accent-dark": r === "system" && !n
|
|
314
|
-
}),
|
|
314
|
+
}), j = E ? o(
|
|
315
315
|
"relative",
|
|
316
316
|
"focus-within:static",
|
|
317
317
|
"focus-within:after:border-transparent",
|
|
@@ -328,47 +328,50 @@ const V = k.forwardRef(
|
|
|
328
328
|
"after:border-table-light dark:after:border-table-dark": r === "alt-system"
|
|
329
329
|
}
|
|
330
330
|
) : "";
|
|
331
|
-
return /* @__PURE__ */ h("div", { className:
|
|
331
|
+
return /* @__PURE__ */ h("div", { className: j, children: /* @__PURE__ */ x(
|
|
332
332
|
y,
|
|
333
333
|
{
|
|
334
|
-
ref:
|
|
334
|
+
ref: I,
|
|
335
335
|
className: M,
|
|
336
336
|
disabled: t,
|
|
337
337
|
type: l,
|
|
338
338
|
"aria-label": s || b,
|
|
339
|
-
...
|
|
339
|
+
...R,
|
|
340
340
|
children: [
|
|
341
341
|
c && /* @__PURE__ */ h("span", { className: "pr-2", children: c }),
|
|
342
|
-
/* @__PURE__ */ h("div", { className:
|
|
342
|
+
/* @__PURE__ */ h("div", { className: z, children: e }),
|
|
343
343
|
g && /* @__PURE__ */ h("span", { className: "pl-2", children: g })
|
|
344
344
|
]
|
|
345
345
|
}
|
|
346
346
|
) });
|
|
347
347
|
}
|
|
348
348
|
);
|
|
349
|
-
|
|
350
|
-
const G = 200, H =
|
|
349
|
+
F.displayName = "ButtonSort";
|
|
350
|
+
const G = 200, H = ({
|
|
351
351
|
string: e,
|
|
352
|
-
|
|
353
|
-
omission: r = H
|
|
352
|
+
idealLength: t = G
|
|
354
353
|
}) => {
|
|
355
|
-
|
|
356
|
-
if (t >= a)
|
|
354
|
+
if (e.length <= t)
|
|
357
355
|
return { string: e, isTruncated: !1 };
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
356
|
+
if (e.charAt(t) === " ")
|
|
357
|
+
return { string: e.slice(0, t), isTruncated: !0 };
|
|
358
|
+
const i = e.slice(t).search(" ");
|
|
359
|
+
return {
|
|
360
|
+
string: e.slice(0, t + i),
|
|
361
|
+
isTruncated: !0
|
|
362
|
+
};
|
|
363
|
+
}, K = ({
|
|
361
364
|
children: e,
|
|
362
365
|
length: t = 200,
|
|
363
366
|
mode: r = "system",
|
|
364
367
|
focusMode: a = "system"
|
|
365
368
|
}) => {
|
|
366
|
-
const [i, d] =
|
|
369
|
+
const [i, d] = L(!1);
|
|
367
370
|
if (typeof e != "string")
|
|
368
371
|
return e;
|
|
369
|
-
const { string: l, isTruncated: n } =
|
|
372
|
+
const { string: l, isTruncated: n } = H({
|
|
370
373
|
string: e,
|
|
371
|
-
|
|
374
|
+
idealLength: t
|
|
372
375
|
});
|
|
373
376
|
return /* @__PURE__ */ x("span", { children: [
|
|
374
377
|
i ? e : l,
|
|
@@ -388,5 +391,5 @@ const G = 200, H = "===+-av-+===", P = ({
|
|
|
388
391
|
] });
|
|
389
392
|
};
|
|
390
393
|
export {
|
|
391
|
-
|
|
394
|
+
K as Truncate
|
|
392
395
|
};
|
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.0.
|
|
3
|
+
@versini/ui-truncate v1.0.1
|
|
4
4
|
© 2024 gizmette.com
|
|
5
5
|
*/
|
|
6
6
|
try {
|
|
7
7
|
window.__VERSINI_UI_TRUNCATE__ || (window.__VERSINI_UI_TRUNCATE__ = {
|
|
8
|
-
version: "1.0.
|
|
9
|
-
buildTime: "09/
|
|
8
|
+
version: "1.0.1",
|
|
9
|
+
buildTime: "09/24/2024 07:45 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": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -38,15 +38,15 @@
|
|
|
38
38
|
"react-dom": "^18.3.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@versini/ui-styles": "1.10.
|
|
41
|
+
"@versini/ui-styles": "1.10.1"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@tailwindcss/typography": "0.5.15",
|
|
45
|
-
"@versini/ui-button": "1.1.
|
|
46
|
-
"tailwindcss": "3.4.
|
|
45
|
+
"@versini/ui-button": "1.1.4",
|
|
46
|
+
"tailwindcss": "3.4.13"
|
|
47
47
|
},
|
|
48
48
|
"sideEffects": [
|
|
49
49
|
"**/*.css"
|
|
50
50
|
],
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "c2f456415637bdc3c29f1cde017a7385874b8440"
|
|
52
52
|
}
|