@versini/ui-truncate 4.0.4 → 4.0.5
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/README.md +56 -0
- package/dist/components/Truncate/Truncate.js +74 -74
- package/dist/index.js +3 -3
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,3 +1,59 @@
|
|
|
1
1
|
# @versini/ui-truncate
|
|
2
2
|
|
|
3
3
|
A simple truncate component for React.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @versini/ui-truncate
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { Truncate } from "@versini/ui-truncate";
|
|
15
|
+
|
|
16
|
+
function App() {
|
|
17
|
+
return (
|
|
18
|
+
<Truncate length={100} mode="dark" focusMode="light">
|
|
19
|
+
This is a very long text that needs to be truncated.
|
|
20
|
+
</Truncate>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Props
|
|
26
|
+
|
|
27
|
+
| Prop | Type | Default | Description |
|
|
28
|
+
| ----------- | ----------------------------------------------- | ---------- | -------------------------------------------------------------------- |
|
|
29
|
+
| `children` | `React.ReactNode` | `null` | The content to render. If not a string, it will be rendered as-is. |
|
|
30
|
+
| `length` | `number` | `200` | The maximum number of characters to display before truncating. |
|
|
31
|
+
| `mode` | `"dark" \| "light" \| "system" \| "alt-system"` | `"system"` | The mode of the button used for toggling truncated text. |
|
|
32
|
+
| `focusMode` | `"dark" \| "light" \| "system" \| "alt-system"` | `"system"` | The focus mode of the button, affecting the focus ring's appearance. |
|
|
33
|
+
|
|
34
|
+
## Example
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import { Truncate } from "@versini/ui-truncate";
|
|
38
|
+
|
|
39
|
+
function App() {
|
|
40
|
+
return (
|
|
41
|
+
<div>
|
|
42
|
+
<Truncate length={50} mode="light" focusMode="dark">
|
|
43
|
+
Lorem ipsum dolor sit amet. Sed do ut labore et dolore magna aliqua. Sed
|
|
44
|
+
do ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet.
|
|
45
|
+
</Truncate>
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Behavior
|
|
52
|
+
|
|
53
|
+
- If the `children` prop is not a string, the component will render the `children` as-is without truncation.
|
|
54
|
+
- If the text exceeds the specified `length`, it will be truncated, and a button will appear to toggle between the truncated and full text.
|
|
55
|
+
- The button's appearance and focus ring can be customized using the `mode` and `focusMode` props.
|
|
56
|
+
|
|
57
|
+
## License
|
|
58
|
+
|
|
59
|
+
MIT
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { jsx as g, jsxs as W } from "react/jsx-runtime";
|
|
2
|
-
import B, { useRef as x, useLayoutEffect as
|
|
3
|
-
import
|
|
2
|
+
import B, { useRef as x, useLayoutEffect as S, useState as F, useMemo as D, useEffect as V, useCallback as $ } from "react";
|
|
3
|
+
import o from "clsx";
|
|
4
4
|
const O = "av-button", T = "icon", M = "button", z = "link", ee = ({
|
|
5
5
|
type: e,
|
|
6
6
|
size: t,
|
|
7
7
|
labelRight: r,
|
|
8
8
|
labelLeft: a,
|
|
9
|
-
align:
|
|
9
|
+
align: n,
|
|
10
10
|
animated: i
|
|
11
11
|
}) => {
|
|
12
12
|
const d = "max-h-8 py-0 px-2", c = "max-h-9 h-8 px-3", s = "max-h-12 py-2 px-4";
|
|
13
13
|
switch (e) {
|
|
14
14
|
case M:
|
|
15
15
|
case z:
|
|
16
|
-
return
|
|
16
|
+
return o({
|
|
17
17
|
[d]: t === "small",
|
|
18
18
|
[c]: t === "medium",
|
|
19
19
|
[s]: t === "large"
|
|
20
20
|
});
|
|
21
21
|
case T:
|
|
22
|
-
return
|
|
23
|
-
"justify-center":
|
|
24
|
-
"justify-start":
|
|
25
|
-
"justify-end":
|
|
22
|
+
return o("flex items-center", {
|
|
23
|
+
"justify-center": n === "center",
|
|
24
|
+
"justify-start": n === "left",
|
|
25
|
+
"justify-end": n === "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),
|
|
@@ -43,19 +43,19 @@ const O = "av-button", T = "icon", M = "button", z = "link", ee = ({
|
|
|
43
43
|
labelRight: r,
|
|
44
44
|
labelLeft: a
|
|
45
45
|
}) => {
|
|
46
|
-
const
|
|
46
|
+
const n = "text-sm font-medium", i = "text-base font-medium", d = "text-lg font-medium";
|
|
47
47
|
switch (e) {
|
|
48
48
|
case M:
|
|
49
49
|
case z:
|
|
50
|
-
return
|
|
50
|
+
return o({
|
|
51
51
|
"text-center": e === z,
|
|
52
|
-
[
|
|
52
|
+
[n]: t === "small",
|
|
53
53
|
[i]: t === "medium",
|
|
54
54
|
[d]: t === "large"
|
|
55
55
|
});
|
|
56
56
|
case T:
|
|
57
|
-
return
|
|
58
|
-
[
|
|
57
|
+
return o({
|
|
58
|
+
[n]: t === "small" && (r || a),
|
|
59
59
|
[i]: t === "medium" && (r || a),
|
|
60
60
|
[d]: t === "large" && (r || a)
|
|
61
61
|
});
|
|
@@ -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 o("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 o("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 o("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,7 +93,7 @@ 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 o("not-prose text-copy-lighter", {
|
|
97
97
|
truncate: r
|
|
98
98
|
});
|
|
99
99
|
}, ae = ({
|
|
@@ -103,21 +103,21 @@ const O = "av-button", T = "icon", M = "button", z = "link", ee = ({
|
|
|
103
103
|
}) => {
|
|
104
104
|
if (!t) {
|
|
105
105
|
if (r === "primary")
|
|
106
|
-
return
|
|
106
|
+
return o({
|
|
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 o({
|
|
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 o({
|
|
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",
|
|
@@ -128,11 +128,11 @@ const O = "av-button", T = "icon", M = "button", z = "link", ee = ({
|
|
|
128
128
|
}
|
|
129
129
|
}, ie = ({
|
|
130
130
|
radius: e
|
|
131
|
-
}) =>
|
|
131
|
+
}) => o({
|
|
132
132
|
"rounded-full": e === "large",
|
|
133
133
|
"rounded-md": e === "medium",
|
|
134
134
|
"rounded-xs": e === "small"
|
|
135
|
-
}),
|
|
135
|
+
}), oe = ({
|
|
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 o("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 o("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 o("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
|
+
}, ne = ({
|
|
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 o("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 o("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 o("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",
|
|
@@ -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 o("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 o("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 o("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",
|
|
@@ -224,7 +224,7 @@ const O = "av-button", T = "icon", M = "button", z = "link", ee = ({
|
|
|
224
224
|
return "border border-border-selected-dark";
|
|
225
225
|
}, le = ({
|
|
226
226
|
focusMode: e
|
|
227
|
-
}) =>
|
|
227
|
+
}) => o("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",
|
|
@@ -233,7 +233,7 @@ const O = "av-button", T = "icon", M = "button", z = "link", ee = ({
|
|
|
233
233
|
mode: e,
|
|
234
234
|
raw: t,
|
|
235
235
|
iconClassName: r
|
|
236
|
-
}) => t ? "" :
|
|
236
|
+
}) => t ? "" : o(
|
|
237
237
|
{
|
|
238
238
|
"text-copy-accent-dark": e === "light" || e === "alt-system",
|
|
239
239
|
"text-copy-light": e === "dark" || e === "system",
|
|
@@ -243,14 +243,14 @@ const O = "av-button", T = "icon", M = "button", z = "link", ee = ({
|
|
|
243
243
|
r
|
|
244
244
|
), se = ({
|
|
245
245
|
animated: e
|
|
246
|
-
}) =>
|
|
246
|
+
}) => o({
|
|
247
247
|
"transition-opacity duration-300 ease-in": e
|
|
248
248
|
}), q = ({
|
|
249
249
|
type: e,
|
|
250
250
|
className: t,
|
|
251
251
|
raw: r,
|
|
252
252
|
mode: a,
|
|
253
|
-
focusMode:
|
|
253
|
+
focusMode: n,
|
|
254
254
|
disabled: i,
|
|
255
255
|
fullWidth: d,
|
|
256
256
|
size: c,
|
|
@@ -263,7 +263,7 @@ const O = "av-button", T = "icon", M = "button", z = "link", ee = ({
|
|
|
263
263
|
align: p,
|
|
264
264
|
radius: R,
|
|
265
265
|
animated: w
|
|
266
|
-
}) => (l || (l = "primary"), r ?
|
|
266
|
+
}) => (l || (l = "primary"), r ? o(O, t) : o(
|
|
267
267
|
O,
|
|
268
268
|
te({
|
|
269
269
|
mode: a,
|
|
@@ -283,14 +283,14 @@ const O = "av-button", T = "icon", M = "button", z = "link", ee = ({
|
|
|
283
283
|
}),
|
|
284
284
|
re({ type: e, size: c, labelRight: h, labelLeft: f }),
|
|
285
285
|
de({ mode: a, variant: l, noBorder: s }),
|
|
286
|
-
le({ focusMode:
|
|
287
|
-
ne({ mode: a, variant: l, disabled: i }),
|
|
286
|
+
le({ focusMode: n }),
|
|
288
287
|
oe({ mode: a, variant: l, disabled: i }),
|
|
288
|
+
ne({ mode: a, variant: l, disabled: i }),
|
|
289
289
|
{
|
|
290
290
|
"w-full": d,
|
|
291
291
|
"disabled:cursor-not-allowed disabled:opacity-50": i
|
|
292
292
|
},
|
|
293
|
-
|
|
293
|
+
o({
|
|
294
294
|
"transition-[width] duration-300 ease-in-out": e === T && w
|
|
295
295
|
}),
|
|
296
296
|
t
|
|
@@ -298,7 +298,7 @@ const O = "av-button", T = "icon", M = "button", z = "link", ee = ({
|
|
|
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
300
|
}, L = B.forwardRef((e, t) => {
|
|
301
|
-
const { onClick: r, noInternalClick: a = !1, ...
|
|
301
|
+
const { onClick: r, noInternalClick: a = !1, ...n } = e;
|
|
302
302
|
return /* @__PURE__ */ g(
|
|
303
303
|
"button",
|
|
304
304
|
{
|
|
@@ -306,18 +306,18 @@ const O = "av-button", T = "icon", M = "button", z = "link", ee = ({
|
|
|
306
306
|
onClick: (i) => {
|
|
307
307
|
ue(i, a, r);
|
|
308
308
|
},
|
|
309
|
-
...
|
|
309
|
+
...n
|
|
310
310
|
}
|
|
311
311
|
);
|
|
312
312
|
});
|
|
313
313
|
L.displayName = "BaseButton";
|
|
314
|
-
const
|
|
314
|
+
const G = B.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: n = !1,
|
|
321
321
|
className: i,
|
|
322
322
|
size: d = "medium",
|
|
323
323
|
raw: c = !1,
|
|
@@ -331,7 +331,7 @@ const P = B.forwardRef(
|
|
|
331
331
|
type: M,
|
|
332
332
|
mode: r,
|
|
333
333
|
focusMode: a,
|
|
334
|
-
fullWidth:
|
|
334
|
+
fullWidth: n,
|
|
335
335
|
disabled: t,
|
|
336
336
|
raw: c,
|
|
337
337
|
className: i,
|
|
@@ -353,7 +353,7 @@ const P = B.forwardRef(
|
|
|
353
353
|
);
|
|
354
354
|
}
|
|
355
355
|
);
|
|
356
|
-
|
|
356
|
+
G.displayName = "Button";
|
|
357
357
|
function ge() {
|
|
358
358
|
const e = x(!1);
|
|
359
359
|
return V(() => (e.current = !0, () => {
|
|
@@ -361,7 +361,7 @@ function ge() {
|
|
|
361
361
|
}), []), $(() => e.current, []);
|
|
362
362
|
}
|
|
363
363
|
function he(e) {
|
|
364
|
-
return
|
|
364
|
+
return D(() => 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);
|
|
@@ -379,7 +379,7 @@ const me = {
|
|
|
379
379
|
right: 0
|
|
380
380
|
};
|
|
381
381
|
function _(e) {
|
|
382
|
-
const t = ge(), r = x(0), a = x(null), [
|
|
382
|
+
const t = ge(), r = x(0), a = x(null), [n, i] = F(me), d = D(() => typeof ResizeObserver > "u" ? null : new ResizeObserver((c) => {
|
|
383
383
|
const s = c[0];
|
|
384
384
|
s && (cancelAnimationFrame(r.current), r.current = requestAnimationFrame(() => {
|
|
385
385
|
a.current && t() && i(s.contentRect);
|
|
@@ -387,7 +387,7 @@ function _(e) {
|
|
|
387
387
|
}), [t]);
|
|
388
388
|
return V(() => (a.current && (d == null || d.observe(a.current, e)), () => {
|
|
389
389
|
d == null || d.disconnect(), r.current && cancelAnimationFrame(r.current);
|
|
390
|
-
}), [d, e]), [a,
|
|
390
|
+
}), [d, e]), [a, n];
|
|
391
391
|
}
|
|
392
392
|
const be = {
|
|
393
393
|
small: 24,
|
|
@@ -403,13 +403,13 @@ const be = {
|
|
|
403
403
|
// px-3 x 2
|
|
404
404
|
large: 16 * 2
|
|
405
405
|
// px-4 x 2
|
|
406
|
-
}, ye = 2,
|
|
406
|
+
}, ye = 2, H = B.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: n = !1,
|
|
413
413
|
className: i,
|
|
414
414
|
type: d = "button",
|
|
415
415
|
raw: c = !1,
|
|
@@ -422,7 +422,7 @@ const be = {
|
|
|
422
422
|
noBackground: p = !1,
|
|
423
423
|
align: R = "center",
|
|
424
424
|
radius: w = "large",
|
|
425
|
-
variant:
|
|
425
|
+
variant: P = "primary",
|
|
426
426
|
iconClassName: X,
|
|
427
427
|
animated: y = !1,
|
|
428
428
|
...Z
|
|
@@ -431,7 +431,7 @@ const be = {
|
|
|
431
431
|
type: T,
|
|
432
432
|
mode: r,
|
|
433
433
|
focusMode: a,
|
|
434
|
-
fullWidth:
|
|
434
|
+
fullWidth: n,
|
|
435
435
|
disabled: t,
|
|
436
436
|
raw: c,
|
|
437
437
|
className: i,
|
|
@@ -442,12 +442,12 @@ const be = {
|
|
|
442
442
|
noBackground: p,
|
|
443
443
|
align: R,
|
|
444
444
|
radius: w,
|
|
445
|
-
variant:
|
|
445
|
+
variant: P,
|
|
446
446
|
animated: y
|
|
447
|
-
}), Q = ce({ mode: r, raw: c, iconClassName: X }), j = se({ animated: y }), [b, C] = _(), [v, E] = _(), [N,
|
|
448
|
-
return
|
|
449
|
-
N && N.current && y && (I.current =
|
|
450
|
-
}, [
|
|
447
|
+
}), Q = ce({ mode: r, raw: c, iconClassName: X }), j = se({ animated: y }), [b, C] = _(), [v, E] = _(), [N, A] = _(), I = x(0), k = x(null), Y = he([J, k]);
|
|
448
|
+
return S(() => {
|
|
449
|
+
N && N.current && y && (I.current = A.width + fe[u] + (s ? 0 : ye));
|
|
450
|
+
}, [A, N, u, s, y]), S(() => {
|
|
451
451
|
k && k.current && y && (l && b && C.width > 0 ? (b.current && (b.current.style.opacity = "100"), k.current.style.width = `${C.width + I.current}px`) : m && E.width > 0 ? (v.current && (v.current.style.opacity = "100"), k.current.style.width = `${E.width + I.current}px`) : (b.current && (b.current.style.opacity = "0"), v.current && (v.current.style.opacity = "0"), k.current.style.width = `${be[u]}px`));
|
|
452
452
|
}, [
|
|
453
453
|
C,
|
|
@@ -497,15 +497,15 @@ const be = {
|
|
|
497
497
|
label: r,
|
|
498
498
|
labelInnerClass: a
|
|
499
499
|
}) => /* @__PURE__ */ g("span", { ref: e, className: t, children: r && /* @__PURE__ */ g("span", { className: a, children: r }) });
|
|
500
|
-
|
|
500
|
+
H.displayName = "ButtonIcon";
|
|
501
501
|
/*!
|
|
502
|
-
@versini/ui-button v6.0.
|
|
502
|
+
@versini/ui-button v6.0.5
|
|
503
503
|
© 2025 gizmette.com
|
|
504
504
|
*/
|
|
505
505
|
try {
|
|
506
506
|
window.__VERSINI_UI_BUTTON__ || (window.__VERSINI_UI_BUTTON__ = {
|
|
507
|
-
version: "6.0.
|
|
508
|
-
buildTime: "04/
|
|
507
|
+
version: "6.0.5",
|
|
508
|
+
buildTime: "04/12/2025 09:18 AM EDT",
|
|
509
509
|
homepage: "https://github.com/aversini/ui-components",
|
|
510
510
|
license: "MIT"
|
|
511
511
|
});
|
|
@@ -517,9 +517,9 @@ const ve = B.forwardRef(
|
|
|
517
517
|
mode: t = "system",
|
|
518
518
|
className: r,
|
|
519
519
|
active: a = !1,
|
|
520
|
-
...
|
|
520
|
+
...n
|
|
521
521
|
}, i) => {
|
|
522
|
-
const d = a ?
|
|
522
|
+
const d = a ? o(
|
|
523
523
|
"relative",
|
|
524
524
|
"focus-within:static",
|
|
525
525
|
"focus-within:after:border-transparent",
|
|
@@ -537,13 +537,13 @@ const ve = B.forwardRef(
|
|
|
537
537
|
}
|
|
538
538
|
) : "";
|
|
539
539
|
return /* @__PURE__ */ g("div", { className: d, children: /* @__PURE__ */ g(
|
|
540
|
-
|
|
540
|
+
H,
|
|
541
541
|
{
|
|
542
|
-
className:
|
|
542
|
+
className: o("justify-center", r),
|
|
543
543
|
ref: i,
|
|
544
544
|
mode: t,
|
|
545
545
|
radius: "small",
|
|
546
|
-
...
|
|
546
|
+
...n,
|
|
547
547
|
children: e
|
|
548
548
|
}
|
|
549
549
|
) });
|
|
@@ -558,9 +558,9 @@ const ke = 200, pe = ({
|
|
|
558
558
|
return { string: e, isTruncated: !1 };
|
|
559
559
|
if (e.charAt(t) === " ")
|
|
560
560
|
return { string: e.slice(0, t), isTruncated: !0 };
|
|
561
|
-
const
|
|
561
|
+
const n = e.slice(t).search(" ");
|
|
562
562
|
return {
|
|
563
|
-
string: e.slice(0, t +
|
|
563
|
+
string: e.slice(0, t + n),
|
|
564
564
|
isTruncated: !0
|
|
565
565
|
};
|
|
566
566
|
}, Be = ({
|
|
@@ -569,7 +569,7 @@ const ke = 200, pe = ({
|
|
|
569
569
|
mode: r = "system",
|
|
570
570
|
focusMode: a = "system"
|
|
571
571
|
}) => {
|
|
572
|
-
const [
|
|
572
|
+
const [n, i] = F(!1);
|
|
573
573
|
if (typeof e != "string")
|
|
574
574
|
return e;
|
|
575
575
|
const { string: d, isTruncated: c } = pe({
|
|
@@ -577,18 +577,18 @@ const ke = 200, pe = ({
|
|
|
577
577
|
idealLength: t
|
|
578
578
|
});
|
|
579
579
|
return /* @__PURE__ */ W("span", { style: { wordBreak: "break-word" }, children: [
|
|
580
|
-
|
|
580
|
+
n ? e : d,
|
|
581
581
|
c && /* @__PURE__ */ g(
|
|
582
|
-
|
|
582
|
+
G,
|
|
583
583
|
{
|
|
584
584
|
mode: r,
|
|
585
585
|
focusMode: a,
|
|
586
586
|
className: "ml-2",
|
|
587
587
|
size: "small",
|
|
588
588
|
onClick: (h) => {
|
|
589
|
-
h.preventDefault(), i(!
|
|
589
|
+
h.preventDefault(), i(!n);
|
|
590
590
|
},
|
|
591
|
-
children:
|
|
591
|
+
children: n ? "less..." : "more..."
|
|
592
592
|
}
|
|
593
593
|
)
|
|
594
594
|
] });
|
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.5
|
|
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: "04/
|
|
8
|
+
version: "4.0.5",
|
|
9
|
+
buildTime: "04/12/2025 09:18 AM 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.5",
|
|
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.5",
|
|
44
|
+
"tailwindcss": "4.1.3"
|
|
45
45
|
},
|
|
46
46
|
"sideEffects": [
|
|
47
47
|
"**/*.css"
|
|
48
48
|
],
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "1bc09c4f0904bd8c01a22b1a32299fdd7598ae32"
|
|
50
50
|
}
|