@xsolla/xui-button 0.196.0 → 0.197.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xsolla/xui-button",
3
- "version": "0.196.0",
3
+ "version": "0.197.0",
4
4
  "main": "./web/index.js",
5
5
  "module": "./web/index.mjs",
6
6
  "types": "./web/index.d.ts",
@@ -13,9 +13,9 @@
13
13
  "test:coverage": "vitest run --coverage"
14
14
  },
15
15
  "dependencies": {
16
- "@xsolla/xui-core": "0.196.0",
17
- "@xsolla/xui-icons": "0.196.0",
18
- "@xsolla/xui-primitives-core": "0.196.0"
16
+ "@xsolla/xui-core": "0.197.0",
17
+ "@xsolla/xui-icons": "0.197.0",
18
+ "@xsolla/xui-primitives-core": "0.197.0"
19
19
  },
20
20
  "peerDependencies": {
21
21
  "react": ">=16.8.0",
package/web/index.js CHANGED
@@ -88,7 +88,11 @@ var ADDITIONAL_BLOCKED_PROPS = /* @__PURE__ */ new Set([
88
88
  "fontSize",
89
89
  "fontWeight",
90
90
  "fontFamily",
91
- "textDecoration"
91
+ "textDecoration",
92
+ // Cross-platform layout prop that Text consumes as CSS, never as an
93
+ // attribute. Pinned explicitly because it is now spread into the styled
94
+ // component rather than destructured away before it can reach the DOM.
95
+ "numberOfLines"
92
96
  ]);
93
97
  function shouldForwardProp(key) {
94
98
  if (ADDITIONAL_BLOCKED_PROPS.has(key)) return false;
@@ -295,6 +299,32 @@ Box.displayName = "Box";
295
299
 
296
300
  // ../../foundation/primitives-web/src/Text.tsx
297
301
  var import_styled_components2 = __toESM(require("styled-components"));
302
+
303
+ // ../../foundation/primitives-web/src/textTruncation.ts
304
+ var truncationStyles = (numberOfLines) => {
305
+ if (!numberOfLines || numberOfLines < 1) return "";
306
+ if (numberOfLines === 1) {
307
+ return `
308
+ display: block;
309
+ max-width: 100%;
310
+ min-width: 0;
311
+ overflow: hidden;
312
+ text-overflow: ellipsis;
313
+ white-space: nowrap;
314
+ `;
315
+ }
316
+ return `
317
+ display: -webkit-box;
318
+ -webkit-box-orient: vertical;
319
+ -webkit-line-clamp: ${numberOfLines};
320
+ line-clamp: ${numberOfLines};
321
+ max-width: 100%;
322
+ min-width: 0;
323
+ overflow: hidden;
324
+ `;
325
+ };
326
+
327
+ // ../../foundation/primitives-web/src/Text.tsx
298
328
  var import_jsx_runtime2 = require("react/jsx-runtime");
299
329
  var FilteredSpan = createFilteredElement("span");
300
330
  var StyledText = (0, import_styled_components2.default)(FilteredSpan)`
@@ -306,6 +336,9 @@ var StyledText = (0, import_styled_components2.default)(FilteredSpan)`
306
336
  white-space: ${(props) => props.whiteSpace || "normal"};
307
337
  text-align: ${(props) => props.textAlign || "inherit"};
308
338
  text-decoration: ${(props) => props.textDecoration || "none"};
339
+
340
+ /* Keep last: single-line truncation has to win over white-space above. */
341
+ ${(props) => truncationStyles(props.numberOfLines)}
309
342
  `;
310
343
  var Text = ({
311
344
  style,
@@ -314,7 +347,6 @@ var Text = ({
314
347
  role,
315
348
  testID,
316
349
  "data-testid": dataTestId,
317
- numberOfLines: _numberOfLines,
318
350
  ...props
319
351
  }) => {
320
352
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(