@xsolla/xui-button 0.196.1 → 0.197.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/package.json +4 -4
- package/web/index.js +34 -2
- package/web/index.js.map +1 -1
- package/web/index.mjs +34 -2
- package/web/index.mjs.map +1 -1
package/web/index.mjs
CHANGED
|
@@ -47,7 +47,11 @@ var ADDITIONAL_BLOCKED_PROPS = /* @__PURE__ */ new Set([
|
|
|
47
47
|
"fontSize",
|
|
48
48
|
"fontWeight",
|
|
49
49
|
"fontFamily",
|
|
50
|
-
"textDecoration"
|
|
50
|
+
"textDecoration",
|
|
51
|
+
// Cross-platform layout prop that Text consumes as CSS, never as an
|
|
52
|
+
// attribute. Pinned explicitly because it is now spread into the styled
|
|
53
|
+
// component rather than destructured away before it can reach the DOM.
|
|
54
|
+
"numberOfLines"
|
|
51
55
|
]);
|
|
52
56
|
function shouldForwardProp(key) {
|
|
53
57
|
if (ADDITIONAL_BLOCKED_PROPS.has(key)) return false;
|
|
@@ -254,6 +258,32 @@ Box.displayName = "Box";
|
|
|
254
258
|
|
|
255
259
|
// ../../foundation/primitives-web/src/Text.tsx
|
|
256
260
|
import styled2 from "styled-components";
|
|
261
|
+
|
|
262
|
+
// ../../foundation/primitives-web/src/textTruncation.ts
|
|
263
|
+
var truncationStyles = (numberOfLines) => {
|
|
264
|
+
if (!numberOfLines || numberOfLines < 1) return "";
|
|
265
|
+
if (numberOfLines === 1) {
|
|
266
|
+
return `
|
|
267
|
+
display: block;
|
|
268
|
+
max-width: 100%;
|
|
269
|
+
min-width: 0;
|
|
270
|
+
overflow: hidden;
|
|
271
|
+
text-overflow: ellipsis;
|
|
272
|
+
white-space: nowrap;
|
|
273
|
+
`;
|
|
274
|
+
}
|
|
275
|
+
return `
|
|
276
|
+
display: -webkit-box;
|
|
277
|
+
-webkit-box-orient: vertical;
|
|
278
|
+
-webkit-line-clamp: ${numberOfLines};
|
|
279
|
+
line-clamp: ${numberOfLines};
|
|
280
|
+
max-width: 100%;
|
|
281
|
+
min-width: 0;
|
|
282
|
+
overflow: hidden;
|
|
283
|
+
`;
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
// ../../foundation/primitives-web/src/Text.tsx
|
|
257
287
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
258
288
|
var FilteredSpan = createFilteredElement("span");
|
|
259
289
|
var StyledText = styled2(FilteredSpan)`
|
|
@@ -265,6 +295,9 @@ var StyledText = styled2(FilteredSpan)`
|
|
|
265
295
|
white-space: ${(props) => props.whiteSpace || "normal"};
|
|
266
296
|
text-align: ${(props) => props.textAlign || "inherit"};
|
|
267
297
|
text-decoration: ${(props) => props.textDecoration || "none"};
|
|
298
|
+
|
|
299
|
+
/* Keep last: single-line truncation has to win over white-space above. */
|
|
300
|
+
${(props) => truncationStyles(props.numberOfLines)}
|
|
268
301
|
`;
|
|
269
302
|
var Text = ({
|
|
270
303
|
style,
|
|
@@ -273,7 +306,6 @@ var Text = ({
|
|
|
273
306
|
role,
|
|
274
307
|
testID,
|
|
275
308
|
"data-testid": dataTestId,
|
|
276
|
-
numberOfLines: _numberOfLines,
|
|
277
309
|
...props
|
|
278
310
|
}) => {
|
|
279
311
|
return /* @__PURE__ */ jsx2(
|