@xsolla/xui-typography 0.133.0 → 0.135.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/web/index.js CHANGED
@@ -35,117 +35,12 @@ __export(index_exports, {
35
35
  module.exports = __toCommonJS(index_exports);
36
36
 
37
37
  // src/Typography.tsx
38
- var import_react2 = require("react");
39
-
40
- // ../primitives-web/src/filterDOMProps.ts
41
- var import_react = __toESM(require("react"));
42
- var NON_HTML_PROPS = /* @__PURE__ */ new Set([
43
- // BoxProps — layout & styling
44
- "backgroundColor",
45
- "borderColor",
46
- "borderWidth",
47
- "borderBottomWidth",
48
- "borderBottomColor",
49
- "borderTopWidth",
50
- "borderTopColor",
51
- "borderLeftWidth",
52
- "borderLeftColor",
53
- "borderRightWidth",
54
- "borderRightColor",
55
- "borderRadius",
56
- "borderStyle",
57
- "flexDirection",
58
- "flexWrap",
59
- "alignItems",
60
- "justifyContent",
61
- "alignSelf",
62
- "flex",
63
- "flexShrink",
64
- "gap",
65
- "position",
66
- "top",
67
- "bottom",
68
- "left",
69
- "right",
70
- "outline",
71
- "overflow",
72
- "overflowX",
73
- "overflowY",
74
- "zIndex",
75
- "cursor",
76
- "padding",
77
- "paddingHorizontal",
78
- "paddingVertical",
79
- "paddingTop",
80
- "paddingBottom",
81
- "paddingLeft",
82
- "paddingRight",
83
- "margin",
84
- "marginTop",
85
- "marginBottom",
86
- "marginLeft",
87
- "marginRight",
88
- "minWidth",
89
- "minHeight",
90
- "maxWidth",
91
- "maxHeight",
92
- "hoverStyle",
93
- "pressStyle",
94
- "focusStyle",
95
- "outlineColor",
96
- "outlineWidth",
97
- "outlineOffset",
98
- "outlineStyle",
99
- // BoxProps — RN-only
100
- "onPress",
101
- "onLayout",
102
- "onMoveShouldSetResponder",
103
- "onResponderGrant",
104
- "onResponderMove",
105
- "onResponderRelease",
106
- "onResponderTerminate",
107
- "testID",
108
- // Box — custom element type
109
- "elementType",
110
- // TextProps
111
- "fontSize",
112
- "fontWeight",
113
- "fontFamily",
114
- "lineHeight",
115
- "whiteSpace",
116
- "textAlign",
117
- "textDecoration",
118
- "numberOfLines",
119
- "letterSpacing",
120
- "textTransform",
121
- // SpinnerProps
122
- "strokeWidth",
123
- // DividerProps
124
- "vertical",
125
- "dashStroke"
126
- ]);
127
- function createFilteredElement(defaultTag) {
128
- const Component = import_react.default.forwardRef(
129
- ({ children, elementType, ...props }, ref) => {
130
- const Tag = elementType || defaultTag;
131
- const htmlProps = {};
132
- for (const key of Object.keys(props)) {
133
- if (!NON_HTML_PROPS.has(key)) {
134
- htmlProps[key] = props[key];
135
- }
136
- }
137
- return import_react.default.createElement(Tag, { ref, ...htmlProps }, children);
138
- }
139
- );
140
- Component.displayName = `Filtered(${defaultTag})`;
141
- return Component;
142
- }
38
+ var import_react = require("react");
143
39
 
144
40
  // ../primitives-web/src/Text.tsx
145
41
  var import_styled_components = __toESM(require("styled-components"));
146
42
  var import_jsx_runtime = require("react/jsx-runtime");
147
- var FilteredSpan = createFilteredElement("span");
148
- var StyledText = (0, import_styled_components.default)(FilteredSpan)`
43
+ var StyledText = import_styled_components.default.span`
149
44
  color: ${(props) => props.color || "inherit"};
150
45
  font-size: ${(props) => typeof props.fontSize === "number" ? `${props.fontSize}px` : props.fontSize || "inherit"};
151
46
  font-weight: ${(props) => props.fontWeight || "normal"};
@@ -196,22 +91,41 @@ var getColor = (color, theme) => {
196
91
  return colorMap[color] || color;
197
92
  };
198
93
  var isHeadingVariant = (variant) => variant === "h1" || variant === "h2" || variant === "h3" || variant === "h4" || variant === "h5" || variant === "display";
94
+ var bodyMap = {
95
+ bodyLg: "body-lg",
96
+ bodyLgAccent: "body-lg",
97
+ bodyLgParagraph: "body-lg",
98
+ bodyMd: "body-md",
99
+ bodyMdAccent: "body-md",
100
+ bodyMdParagraph: "body-md",
101
+ bodySm: "body-sm",
102
+ bodySmAccent: "body-sm",
103
+ bodySmParagraph: "body-sm",
104
+ bodyXs: "body-xs",
105
+ bodyXsAccent: "body-xs",
106
+ bodyXsParagraph: "body-xs",
107
+ bodyXxs: "body-xxs",
108
+ bodyXxsAccent: "body-xxs",
109
+ bodyXxsParagraph: "body-xxs"
110
+ };
111
+ var headingMap = {
112
+ h1: "h1",
113
+ h2: "h2",
114
+ h3: "h3",
115
+ h4: "h4",
116
+ h5: "h5"
117
+ };
199
118
  var getVariantStyles = (variant, typographyTokens) => {
200
119
  if (typographyTokens) {
201
- const headingMap = {
202
- h1: "h1",
203
- h2: "h2",
204
- h3: "h3",
205
- h4: "h4",
206
- h5: "h5"
207
- };
208
120
  if (headingMap[variant]) {
209
121
  const token = typographyTokens.heading[headingMap[variant]];
210
122
  if (token) {
211
123
  return {
212
124
  fontSize: token.fontSize,
213
125
  fontWeight: String(token.fontWeight),
214
- lineHeight: token.lineHeight
126
+ lineHeight: token.lineHeight,
127
+ scaleStep: token.scaleStep,
128
+ lineHeightCategory: token.lineHeightCategory
215
129
  };
216
130
  }
217
131
  }
@@ -220,83 +134,224 @@ var getVariantStyles = (variant, typographyTokens) => {
220
134
  return {
221
135
  fontSize: token.fontSize,
222
136
  fontWeight: String(token.fontWeight),
223
- lineHeight: token.lineHeight
137
+ lineHeight: token.lineHeight,
138
+ scaleStep: token.scaleStep,
139
+ lineHeightCategory: token.lineHeightCategory
224
140
  };
225
141
  }
226
- const bodyMap = {
227
- bodyLg: "body-lg",
228
- bodyLgAccent: "body-lg",
229
- bodyLgParagraph: "body-lg",
230
- bodyMd: "body-md",
231
- bodyMdAccent: "body-md",
232
- bodyMdParagraph: "body-md",
233
- bodySm: "body-sm",
234
- bodySmAccent: "body-sm",
235
- bodySmParagraph: "body-sm",
236
- bodyXs: "body-xs",
237
- bodyXsAccent: "body-xs",
238
- bodyXsParagraph: "body-xs"
239
- };
240
142
  const bodyKey = bodyMap[variant];
241
143
  if (bodyKey && typographyTokens.basic?.[bodyKey]) {
242
144
  const token = typographyTokens.basic[bodyKey];
243
145
  let fontWeight = token.fontWeight;
244
146
  let lineHeight = token.lineHeight;
147
+ let lineHeightCategory = token.lineHeightCategory;
148
+ let lineHeightScaleStep;
245
149
  if (variant.includes("Accent") && token.accent) {
246
150
  fontWeight = token.accent.fontWeight;
247
151
  }
248
152
  if (variant.includes("Paragraph") && token.paragraph) {
249
153
  lineHeight = token.paragraph.lineHeight;
154
+ lineHeightCategory = "text";
155
+ lineHeightScaleStep = token.paragraph.lineHeightScaleStep;
250
156
  }
251
157
  return {
252
158
  fontSize: token.fontSize,
253
159
  fontWeight: String(fontWeight),
254
- lineHeight
160
+ lineHeight,
161
+ scaleStep: token.scaleStep,
162
+ lineHeightCategory,
163
+ lineHeightScaleStep
255
164
  };
256
165
  }
257
166
  }
258
167
  switch (variant) {
259
168
  case "h1":
260
- return { fontSize: 56, fontWeight: "400", lineHeight: "68px" };
169
+ return {
170
+ fontSize: 56,
171
+ fontWeight: "400",
172
+ lineHeight: "56px",
173
+ scaleStep: "650",
174
+ lineHeightCategory: "display"
175
+ };
261
176
  case "h2":
262
- return { fontSize: 48, fontWeight: "400", lineHeight: "58px" };
177
+ return {
178
+ fontSize: 48,
179
+ fontWeight: "400",
180
+ lineHeight: "48px",
181
+ scaleStep: "550",
182
+ lineHeightCategory: "display"
183
+ };
263
184
  case "h3":
264
- return { fontSize: 32, fontWeight: "400", lineHeight: "38px" };
185
+ return {
186
+ fontSize: 32,
187
+ fontWeight: "400",
188
+ lineHeight: "32px",
189
+ scaleStep: "350",
190
+ lineHeightCategory: "display"
191
+ };
265
192
  case "h4":
266
- return { fontSize: 24, fontWeight: "400", lineHeight: "28px" };
193
+ return {
194
+ fontSize: 24,
195
+ fontWeight: "400",
196
+ lineHeight: "24px",
197
+ scaleStep: "250",
198
+ lineHeightCategory: "display"
199
+ };
267
200
  case "h5":
268
- return { fontSize: 20, fontWeight: "600", lineHeight: "24px" };
201
+ return {
202
+ fontSize: 20,
203
+ fontWeight: "600",
204
+ lineHeight: "20px",
205
+ scaleStep: "200",
206
+ lineHeightCategory: "display"
207
+ };
269
208
  case "display":
270
- return { fontSize: 64, fontWeight: "400", lineHeight: "78px" };
209
+ return {
210
+ fontSize: 64,
211
+ fontWeight: "400",
212
+ lineHeight: "64px",
213
+ scaleStep: "750",
214
+ lineHeightCategory: "display"
215
+ };
271
216
  case "bodyLg":
272
- return { fontSize: 18, fontWeight: "400", lineHeight: "24px" };
217
+ return {
218
+ fontSize: 18,
219
+ fontWeight: "400",
220
+ lineHeight: "24px",
221
+ scaleStep: "175",
222
+ lineHeightCategory: "compact"
223
+ };
273
224
  case "bodyLgAccent":
274
- return { fontSize: 18, fontWeight: "500", lineHeight: "24px" };
225
+ return {
226
+ fontSize: 18,
227
+ fontWeight: "500",
228
+ lineHeight: "24px",
229
+ scaleStep: "175",
230
+ lineHeightCategory: "compact"
231
+ };
275
232
  case "bodyLgParagraph":
276
- return { fontSize: 18, fontWeight: "400", lineHeight: "26px" };
233
+ return {
234
+ fontSize: 18,
235
+ fontWeight: "400",
236
+ lineHeight: "26px",
237
+ scaleStep: "175",
238
+ lineHeightCategory: "text"
239
+ };
277
240
  case "bodyMd":
278
- return { fontSize: 16, fontWeight: "400", lineHeight: "20px" };
241
+ return {
242
+ fontSize: 16,
243
+ fontWeight: "400",
244
+ lineHeight: "20px",
245
+ scaleStep: "150",
246
+ lineHeightCategory: "compact"
247
+ };
279
248
  case "bodyMdAccent":
280
- return { fontSize: 16, fontWeight: "500", lineHeight: "20px" };
249
+ return {
250
+ fontSize: 16,
251
+ fontWeight: "500",
252
+ lineHeight: "20px",
253
+ scaleStep: "150",
254
+ lineHeightCategory: "compact"
255
+ };
281
256
  case "bodyMdParagraph":
282
- return { fontSize: 16, fontWeight: "400", lineHeight: "22px" };
257
+ return {
258
+ fontSize: 16,
259
+ fontWeight: "400",
260
+ lineHeight: "22px",
261
+ scaleStep: "150",
262
+ lineHeightCategory: "text"
263
+ };
283
264
  case "bodySm":
284
- return { fontSize: 14, fontWeight: "400", lineHeight: "18px" };
265
+ return {
266
+ fontSize: 14,
267
+ fontWeight: "400",
268
+ lineHeight: "18px",
269
+ scaleStep: "125",
270
+ lineHeightCategory: "compact"
271
+ };
285
272
  case "bodySmAccent":
286
- return { fontSize: 14, fontWeight: "500", lineHeight: "18px" };
273
+ return {
274
+ fontSize: 14,
275
+ fontWeight: "500",
276
+ lineHeight: "18px",
277
+ scaleStep: "125",
278
+ lineHeightCategory: "compact"
279
+ };
287
280
  case "bodySmParagraph":
288
- return { fontSize: 14, fontWeight: "400", lineHeight: "20px" };
281
+ return {
282
+ fontSize: 14,
283
+ fontWeight: "400",
284
+ lineHeight: "20px",
285
+ scaleStep: "125",
286
+ lineHeightCategory: "text"
287
+ };
289
288
  case "bodyXs":
290
- return { fontSize: 12, fontWeight: "400", lineHeight: "16px" };
289
+ return {
290
+ fontSize: 12,
291
+ fontWeight: "400",
292
+ lineHeight: "16px",
293
+ scaleStep: "100",
294
+ lineHeightCategory: "compact"
295
+ };
291
296
  case "bodyXsAccent":
292
- return { fontSize: 12, fontWeight: "500", lineHeight: "16px" };
297
+ return {
298
+ fontSize: 12,
299
+ fontWeight: "500",
300
+ lineHeight: "16px",
301
+ scaleStep: "100",
302
+ lineHeightCategory: "compact"
303
+ };
293
304
  case "bodyXsParagraph":
294
- return { fontSize: 12, fontWeight: "400", lineHeight: "18px" };
305
+ return {
306
+ fontSize: 12,
307
+ fontWeight: "400",
308
+ lineHeight: "18px",
309
+ scaleStep: "100",
310
+ lineHeightCategory: "text"
311
+ };
312
+ case "bodyXxs":
313
+ return {
314
+ fontSize: 10,
315
+ fontWeight: "400",
316
+ lineHeight: "14px",
317
+ scaleStep: "75",
318
+ lineHeightCategory: "compact"
319
+ };
320
+ case "bodyXxsAccent":
321
+ return {
322
+ fontSize: 10,
323
+ fontWeight: "500",
324
+ lineHeight: "14px",
325
+ scaleStep: "75",
326
+ lineHeightCategory: "compact"
327
+ };
328
+ case "bodyXxsParagraph":
329
+ return {
330
+ fontSize: 10,
331
+ fontWeight: "400",
332
+ lineHeight: "14px",
333
+ scaleStep: "75",
334
+ lineHeightCategory: "text"
335
+ };
295
336
  default:
296
- return { fontSize: 16, fontWeight: "400", lineHeight: "20px" };
337
+ return {
338
+ fontSize: 16,
339
+ fontWeight: "400",
340
+ lineHeight: "20px",
341
+ scaleStep: "150",
342
+ lineHeightCategory: "compact"
343
+ };
297
344
  }
298
345
  };
299
- var Typography = (0, import_react2.forwardRef)(
346
+ function getResponsiveLineHeight(styles) {
347
+ const step = styles.lineHeightScaleStep || styles.scaleStep;
348
+ if (!step) return void 0;
349
+ const cat = styles.lineHeightCategory;
350
+ if (cat === "display") return import_xui_core.cssVar.lhDisplay(step);
351
+ if (cat === "text") return import_xui_core.cssVar.lhText(step);
352
+ return import_xui_core.cssVar.lhCompact(step);
353
+ }
354
+ var Typography = (0, import_react.forwardRef)(
300
355
  ({
301
356
  children,
302
357
  align = "inherit",
@@ -317,6 +372,9 @@ var Typography = (0, import_react2.forwardRef)(
317
372
  const colorValue = getColor(color, theme);
318
373
  const contextFonts = productContext ? (0, import_xui_core.getFonts)(productContext) : theme.fonts;
319
374
  const fontFamily = isHeadingVariant(variant) ? contextFonts?.heading : contextFonts?.body;
375
+ const useResponsiveCSS = import_xui_core.isWeb && variantStyles.scaleStep;
376
+ const responsiveFontSize = useResponsiveCSS ? import_xui_core.cssVar.fontSize(variantStyles.scaleStep) : void 0;
377
+ const responsiveLineHeight = useResponsiveCSS ? getResponsiveLineHeight(variantStyles) : void 0;
320
378
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
321
379
  Text,
322
380
  {
@@ -324,7 +382,7 @@ var Typography = (0, import_react2.forwardRef)(
324
382
  ref,
325
383
  as,
326
384
  color: colorValue,
327
- fontSize: variantStyles.fontSize,
385
+ fontSize: useResponsiveCSS ? void 0 : variantStyles.fontSize,
328
386
  fontWeight: variantStyles.fontWeight,
329
387
  fontFamily,
330
388
  numberOfLines: noWrap ? 1 : void 0,
@@ -332,7 +390,7 @@ var Typography = (0, import_react2.forwardRef)(
332
390
  marginTop,
333
391
  marginBottom,
334
392
  textAlign: align === "inherit" ? void 0 : align,
335
- lineHeight: variantStyles.lineHeight,
393
+ ...useResponsiveCSS ? { fontSize: responsiveFontSize, lineHeight: responsiveLineHeight } : { lineHeight: variantStyles.lineHeight },
336
394
  ...noWrap && {
337
395
  overflow: "hidden",
338
396
  textOverflow: "ellipsis",
package/web/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.tsx","../../src/Typography.tsx","../../../primitives-web/src/filterDOMProps.ts","../../../primitives-web/src/Text.tsx"],"sourcesContent":["export * from \"./Typography\";\nexport * from \"./types\";\n","import { forwardRef } from \"react\";\n// @ts-expect-error - this will be resolved at build time\nimport { Text } from \"@xsolla/xui-primitives\";\nimport {\n useResolvedTheme,\n getTypographyTokens,\n getFonts,\n isNative,\n} from \"@xsolla/xui-core\";\nimport type { ColorType, TypographyProps, VariantType } from \"./types\";\n\nconst getColor = (\n color: ColorType | string,\n theme: any\n): string | undefined => {\n if (color === \"inherit\") {\n return isNative ? theme?.colors?.content?.primary : undefined;\n }\n\n const colorMap: Record<string, string> = {\n primary: theme?.colors?.content?.primary,\n secondary: theme?.colors?.content?.secondary,\n tertiary: theme?.colors?.content?.tertiary,\n brand: theme?.colors?.content?.brand?.primary,\n brandSecondary: theme?.colors?.content?.brand?.secondary,\n success: theme?.colors?.content?.success?.primary,\n warning: theme?.colors?.content?.warning?.primary,\n alert: theme?.colors?.content?.alert?.primary,\n neutral: theme?.colors?.content?.neutral?.primary,\n };\n\n return colorMap[color] || color;\n};\n\nconst isHeadingVariant = (variant: VariantType): boolean =>\n variant === \"h1\" ||\n variant === \"h2\" ||\n variant === \"h3\" ||\n variant === \"h4\" ||\n variant === \"h5\" ||\n variant === \"display\";\n\nconst getVariantStyles = (variant: VariantType, typographyTokens?: any) => {\n // If typography tokens are provided from theme, use them\n if (typographyTokens) {\n const headingMap: Record<string, keyof typeof typographyTokens.heading> = {\n h1: \"h1\",\n h2: \"h2\",\n h3: \"h3\",\n h4: \"h4\",\n h5: \"h5\",\n };\n\n if (headingMap[variant]) {\n const token = typographyTokens.heading[headingMap[variant]];\n if (token) {\n return {\n fontSize: token.fontSize,\n fontWeight: String(token.fontWeight),\n lineHeight: token.lineHeight,\n };\n }\n }\n\n if (variant === \"display\" && typographyTokens.basic?.display) {\n const token = typographyTokens.basic.display;\n return {\n fontSize: token.fontSize,\n fontWeight: String(token.fontWeight),\n lineHeight: token.lineHeight,\n };\n }\n\n // Body variants\n const bodyMap: Record<string, string> = {\n bodyLg: \"body-lg\",\n bodyLgAccent: \"body-lg\",\n bodyLgParagraph: \"body-lg\",\n bodyMd: \"body-md\",\n bodyMdAccent: \"body-md\",\n bodyMdParagraph: \"body-md\",\n bodySm: \"body-sm\",\n bodySmAccent: \"body-sm\",\n bodySmParagraph: \"body-sm\",\n bodyXs: \"body-xs\",\n bodyXsAccent: \"body-xs\",\n bodyXsParagraph: \"body-xs\",\n };\n\n const bodyKey = bodyMap[variant];\n if (bodyKey && typographyTokens.basic?.[bodyKey]) {\n const token = typographyTokens.basic[bodyKey];\n let fontWeight = token.fontWeight;\n let lineHeight = token.lineHeight;\n\n if (variant.includes(\"Accent\") && token.accent) {\n fontWeight = token.accent.fontWeight;\n }\n\n if (variant.includes(\"Paragraph\") && token.paragraph) {\n lineHeight = token.paragraph.lineHeight;\n }\n\n return {\n fontSize: token.fontSize,\n fontWeight: String(fontWeight),\n lineHeight: lineHeight,\n };\n }\n }\n\n // Fallback to default styles (B2B mode for backwards compatibility)\n switch (variant) {\n case \"h1\":\n return { fontSize: 56, fontWeight: \"400\", lineHeight: \"68px\" };\n case \"h2\":\n return { fontSize: 48, fontWeight: \"400\", lineHeight: \"58px\" };\n case \"h3\":\n return { fontSize: 32, fontWeight: \"400\", lineHeight: \"38px\" };\n case \"h4\":\n return { fontSize: 24, fontWeight: \"400\", lineHeight: \"28px\" };\n case \"h5\":\n return { fontSize: 20, fontWeight: \"600\", lineHeight: \"24px\" };\n case \"display\":\n return { fontSize: 64, fontWeight: \"400\", lineHeight: \"78px\" };\n case \"bodyLg\":\n return { fontSize: 18, fontWeight: \"400\", lineHeight: \"24px\" };\n case \"bodyLgAccent\":\n return { fontSize: 18, fontWeight: \"500\", lineHeight: \"24px\" };\n case \"bodyLgParagraph\":\n return { fontSize: 18, fontWeight: \"400\", lineHeight: \"26px\" };\n case \"bodyMd\":\n return { fontSize: 16, fontWeight: \"400\", lineHeight: \"20px\" };\n case \"bodyMdAccent\":\n return { fontSize: 16, fontWeight: \"500\", lineHeight: \"20px\" };\n case \"bodyMdParagraph\":\n return { fontSize: 16, fontWeight: \"400\", lineHeight: \"22px\" };\n case \"bodySm\":\n return { fontSize: 14, fontWeight: \"400\", lineHeight: \"18px\" };\n case \"bodySmAccent\":\n return { fontSize: 14, fontWeight: \"500\", lineHeight: \"18px\" };\n case \"bodySmParagraph\":\n return { fontSize: 14, fontWeight: \"400\", lineHeight: \"20px\" };\n case \"bodyXs\":\n return { fontSize: 12, fontWeight: \"400\", lineHeight: \"16px\" };\n case \"bodyXsAccent\":\n return { fontSize: 12, fontWeight: \"500\", lineHeight: \"16px\" };\n case \"bodyXsParagraph\":\n return { fontSize: 12, fontWeight: \"400\", lineHeight: \"18px\" };\n default:\n return { fontSize: 16, fontWeight: \"400\", lineHeight: \"20px\" };\n }\n};\n\nexport const Typography = forwardRef<any, TypographyProps>(\n (\n {\n children,\n align = \"inherit\",\n noWrap = false,\n variant = \"bodyMd\",\n color = \"inherit\",\n marginBottom = 0,\n marginTop = 0,\n as,\n productContext,\n themeMode,\n themeProductContext,\n ...rest\n },\n ref\n ) => {\n const { theme } = useResolvedTheme({ themeMode, themeProductContext });\n // If productContext is provided, use tokens for that specific context\n // Otherwise, use the tokens from the theme (context)\n const typographyTokens = productContext\n ? getTypographyTokens(productContext)\n : (theme as any).typographyTokens;\n const variantStyles = getVariantStyles(variant, typographyTokens);\n const colorValue = getColor(color, theme);\n const contextFonts = productContext\n ? getFonts(productContext)\n : (theme.fonts as Record<string, string>);\n const fontFamily = isHeadingVariant(variant)\n ? contextFonts?.heading\n : contextFonts?.body;\n\n return (\n <Text\n {...rest}\n ref={ref}\n as={as}\n color={colorValue}\n fontSize={variantStyles.fontSize}\n fontWeight={variantStyles.fontWeight}\n fontFamily={fontFamily}\n numberOfLines={noWrap ? 1 : undefined}\n style={{\n marginTop,\n marginBottom,\n textAlign: align === \"inherit\" ? undefined : align,\n lineHeight: variantStyles.lineHeight,\n ...(noWrap && {\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n }),\n ...rest.style,\n }}\n >\n {children}\n </Text>\n );\n }\n);\n\nTypography.displayName = \"Typography\";\n","import React from \"react\";\n\n// Props from BoxProps, TextProps, SpinnerProps, IconProps, DividerProps\n// that are NOT valid HTML attributes and must not reach the DOM.\nexport const NON_HTML_PROPS = new Set([\n // BoxProps — layout & styling\n \"backgroundColor\",\n \"borderColor\",\n \"borderWidth\",\n \"borderBottomWidth\",\n \"borderBottomColor\",\n \"borderTopWidth\",\n \"borderTopColor\",\n \"borderLeftWidth\",\n \"borderLeftColor\",\n \"borderRightWidth\",\n \"borderRightColor\",\n \"borderRadius\",\n \"borderStyle\",\n \"flexDirection\",\n \"flexWrap\",\n \"alignItems\",\n \"justifyContent\",\n \"alignSelf\",\n \"flex\",\n \"flexShrink\",\n \"gap\",\n \"position\",\n \"top\",\n \"bottom\",\n \"left\",\n \"right\",\n \"outline\",\n \"overflow\",\n \"overflowX\",\n \"overflowY\",\n \"zIndex\",\n \"cursor\",\n \"padding\",\n \"paddingHorizontal\",\n \"paddingVertical\",\n \"paddingTop\",\n \"paddingBottom\",\n \"paddingLeft\",\n \"paddingRight\",\n \"margin\",\n \"marginTop\",\n \"marginBottom\",\n \"marginLeft\",\n \"marginRight\",\n \"minWidth\",\n \"minHeight\",\n \"maxWidth\",\n \"maxHeight\",\n \"hoverStyle\",\n \"pressStyle\",\n \"focusStyle\",\n \"outlineColor\",\n \"outlineWidth\",\n \"outlineOffset\",\n \"outlineStyle\",\n // BoxProps — RN-only\n \"onPress\",\n \"onLayout\",\n \"onMoveShouldSetResponder\",\n \"onResponderGrant\",\n \"onResponderMove\",\n \"onResponderRelease\",\n \"onResponderTerminate\",\n \"testID\",\n // Box — custom element type\n \"elementType\",\n // TextProps\n \"fontSize\",\n \"fontWeight\",\n \"fontFamily\",\n \"lineHeight\",\n \"whiteSpace\",\n \"textAlign\",\n \"textDecoration\",\n \"numberOfLines\",\n \"letterSpacing\",\n \"textTransform\",\n // SpinnerProps\n \"strokeWidth\",\n // DividerProps\n \"vertical\",\n \"dashStroke\",\n]);\n\n/**\n * Creates a React component that renders the given HTML tag\n * but filters out non-HTML props before they reach the DOM.\n *\n * Usage: `const FilteredDiv = createFilteredElement(\"div\");`\n * Then: `const StyledBox = styled(FilteredDiv)<BoxProps>\\`...\\`;`\n *\n * styled-components can still read ALL props for CSS interpolation,\n * but only valid HTML attributes are forwarded to the DOM element.\n */\nexport function createFilteredElement(defaultTag: string) {\n const Component = React.forwardRef<HTMLElement, any>(\n ({ children, elementType, ...props }, ref) => {\n const Tag = elementType || defaultTag;\n const htmlProps: Record<string, unknown> = {};\n for (const key of Object.keys(props)) {\n if (!NON_HTML_PROPS.has(key)) {\n htmlProps[key] = props[key];\n }\n }\n return React.createElement(Tag, { ref, ...htmlProps }, children);\n }\n );\n Component.displayName = `Filtered(${defaultTag})`;\n return Component;\n}\n","import React from \"react\";\nimport styled from \"styled-components\";\nimport { TextProps } from \"@xsolla/xui-primitives-core\";\nimport { createFilteredElement } from \"./filterDOMProps\";\n\nconst FilteredSpan = createFilteredElement(\"span\");\n\nconst StyledText = styled(FilteredSpan)<TextProps>`\n color: ${(props) => props.color || \"inherit\"};\n font-size: ${(props) =>\n typeof props.fontSize === \"number\"\n ? `${props.fontSize}px`\n : props.fontSize || \"inherit\"};\n font-weight: ${(props) => props.fontWeight || \"normal\"};\n font-family: ${(props) =>\n props.fontFamily ||\n '\"Aktiv Grotesk\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif'};\n line-height: ${(props) =>\n typeof props.lineHeight === \"number\"\n ? `${props.lineHeight}px`\n : props.lineHeight || \"inherit\"};\n white-space: ${(props) => props.whiteSpace || \"normal\"};\n text-align: ${(props) => props.textAlign || \"inherit\"};\n text-decoration: ${(props) => props.textDecoration || \"none\"};\n`;\n\nexport const Text: React.FC<TextProps> = ({\n style,\n className,\n id,\n role,\n numberOfLines: _numberOfLines,\n ...props\n}) => {\n return (\n <StyledText\n {...props}\n style={style}\n className={className}\n id={id}\n role={role}\n />\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAA2B;;;ACA3B,mBAAkB;AAIX,IAAM,iBAAiB,oBAAI,IAAI;AAAA;AAAA,EAEpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AA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AAQ;AAAA,IACR,SAAS;AAAA,IACT,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,eAAe;AAAA,IACf,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,GACA,QACG;AACH,UAAM,EAAE,MAAM,QAAI,kCAAiB,EAAE,WAAW,oBAAoB,CAAC;AAGrE,UAAM,mBAAmB,qBACrB,qCAAoB,cAAc,IACjC,MAAc;AACnB,UAAM,gBAAgB,iBAAiB,SAAS,gBAAgB;AAChE,UAAM,aAAa,SAAS,OAAO,KAAK;AACxC,UAAM,eAAe,qBACjB,0BAAS,cAAc,IACtB,MAAM;AACX,UAAM,aAAa,iBAAiB,OAAO,IACvC,cAAc,UACd,cAAc;AAElB,WACE;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACJ;AAAA,QACA;AAAA,QACA,OAAO;AAAA,QACP,UAAU,cAAc;AAAA,QACxB,YAAY,cAAc;AAAA,QAC1B;AAAA,QACA,eAAe,SAAS,IAAI;AAAA,QAC5B,OAAO;AAAA,UACL;AAAA,UACA;AAAA,UACA,WAAW,UAAU,YAAY,SAAY;AAAA,UAC7C,YAAY,cAAc;AAAA,UAC1B,GAAI,UAAU;AAAA,YACZ,UAAU;AAAA,YACV,cAAc;AAAA,YACd,YAAY;AAAA,UACd;AAAA,UACA,GAAG,KAAK;AAAA,QACV;AAAA,QAEC;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AAEA,WAAW,cAAc;","names":["import_react","React","styled","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../../src/index.tsx","../../src/Typography.tsx","../../../primitives-web/src/Text.tsx"],"sourcesContent":["export * from \"./Typography\";\nexport * from \"./types\";\n","import { forwardRef } from \"react\";\n// @ts-expect-error - this will be resolved at build time\nimport { Text } from \"@xsolla/xui-primitives\";\nimport {\n useResolvedTheme,\n getTypographyTokens,\n getFonts,\n isWeb,\n isNative,\n cssVar,\n} from \"@xsolla/xui-core\";\nimport type { ColorType, TypographyProps, VariantType } from \"./types\";\n\nconst getColor = (\n color: ColorType | string,\n theme: any\n): string | undefined => {\n if (color === \"inherit\") {\n return isNative ? theme?.colors?.content?.primary : undefined;\n }\n\n const colorMap: Record<string, string> = {\n primary: theme?.colors?.content?.primary,\n secondary: theme?.colors?.content?.secondary,\n tertiary: theme?.colors?.content?.tertiary,\n brand: theme?.colors?.content?.brand?.primary,\n brandSecondary: theme?.colors?.content?.brand?.secondary,\n success: theme?.colors?.content?.success?.primary,\n warning: theme?.colors?.content?.warning?.primary,\n alert: theme?.colors?.content?.alert?.primary,\n neutral: theme?.colors?.content?.neutral?.primary,\n };\n\n return colorMap[color] || color;\n};\n\nconst isHeadingVariant = (variant: VariantType): boolean =>\n variant === \"h1\" ||\n variant === \"h2\" ||\n variant === \"h3\" ||\n variant === \"h4\" ||\n variant === \"h5\" ||\n variant === \"display\";\n\nconst bodyMap: Record<string, string> = {\n bodyLg: \"body-lg\",\n bodyLgAccent: \"body-lg\",\n bodyLgParagraph: \"body-lg\",\n bodyMd: \"body-md\",\n bodyMdAccent: \"body-md\",\n bodyMdParagraph: \"body-md\",\n bodySm: \"body-sm\",\n bodySmAccent: \"body-sm\",\n bodySmParagraph: \"body-sm\",\n bodyXs: \"body-xs\",\n bodyXsAccent: \"body-xs\",\n bodyXsParagraph: \"body-xs\",\n bodyXxs: \"body-xxs\",\n bodyXxsAccent: \"body-xxs\",\n bodyXxsParagraph: \"body-xxs\",\n};\n\nconst headingMap: Record<string, string> = {\n h1: \"h1\",\n h2: \"h2\",\n h3: \"h3\",\n h4: \"h4\",\n h5: \"h5\",\n};\n\nconst getVariantStyles = (variant: VariantType, typographyTokens?: any) => {\n if (typographyTokens) {\n if (headingMap[variant]) {\n const token = typographyTokens.heading[headingMap[variant]];\n if (token) {\n return {\n fontSize: token.fontSize,\n fontWeight: String(token.fontWeight),\n lineHeight: token.lineHeight,\n scaleStep: token.scaleStep,\n lineHeightCategory: token.lineHeightCategory,\n };\n }\n }\n\n if (variant === \"display\" && typographyTokens.basic?.display) {\n const token = typographyTokens.basic.display;\n return {\n fontSize: token.fontSize,\n fontWeight: String(token.fontWeight),\n lineHeight: token.lineHeight,\n scaleStep: token.scaleStep,\n lineHeightCategory: token.lineHeightCategory,\n };\n }\n\n const bodyKey = bodyMap[variant];\n if (bodyKey && typographyTokens.basic?.[bodyKey]) {\n const token = typographyTokens.basic[bodyKey];\n let fontWeight = token.fontWeight;\n let lineHeight = token.lineHeight;\n let lineHeightCategory = token.lineHeightCategory;\n let lineHeightScaleStep: string | undefined;\n\n if (variant.includes(\"Accent\") && token.accent) {\n fontWeight = token.accent.fontWeight;\n }\n\n if (variant.includes(\"Paragraph\") && token.paragraph) {\n lineHeight = token.paragraph.lineHeight;\n lineHeightCategory = \"text\";\n lineHeightScaleStep = token.paragraph.lineHeightScaleStep;\n }\n\n return {\n fontSize: token.fontSize,\n fontWeight: String(fontWeight),\n lineHeight,\n scaleStep: token.scaleStep,\n lineHeightCategory,\n lineHeightScaleStep,\n };\n }\n }\n\n switch (variant) {\n case \"h1\":\n return {\n fontSize: 56,\n fontWeight: \"400\",\n lineHeight: \"56px\",\n scaleStep: \"650\",\n lineHeightCategory: \"display\" as const,\n };\n case \"h2\":\n return {\n fontSize: 48,\n fontWeight: \"400\",\n lineHeight: \"48px\",\n scaleStep: \"550\",\n lineHeightCategory: \"display\" as const,\n };\n case \"h3\":\n return {\n fontSize: 32,\n fontWeight: \"400\",\n lineHeight: \"32px\",\n scaleStep: \"350\",\n lineHeightCategory: \"display\" as const,\n };\n case \"h4\":\n return {\n fontSize: 24,\n fontWeight: \"400\",\n lineHeight: \"24px\",\n scaleStep: \"250\",\n lineHeightCategory: \"display\" as const,\n };\n case \"h5\":\n return {\n fontSize: 20,\n fontWeight: \"600\",\n lineHeight: \"20px\",\n scaleStep: \"200\",\n lineHeightCategory: \"display\" as const,\n };\n case \"display\":\n return {\n fontSize: 64,\n fontWeight: \"400\",\n lineHeight: \"64px\",\n scaleStep: \"750\",\n lineHeightCategory: \"display\" as const,\n };\n case \"bodyLg\":\n return {\n fontSize: 18,\n fontWeight: \"400\",\n lineHeight: \"24px\",\n scaleStep: \"175\",\n lineHeightCategory: \"compact\" as const,\n };\n case \"bodyLgAccent\":\n return {\n fontSize: 18,\n fontWeight: \"500\",\n lineHeight: \"24px\",\n scaleStep: \"175\",\n lineHeightCategory: \"compact\" as const,\n };\n case \"bodyLgParagraph\":\n return {\n fontSize: 18,\n fontWeight: \"400\",\n lineHeight: \"26px\",\n scaleStep: \"175\",\n lineHeightCategory: \"text\" as const,\n };\n case \"bodyMd\":\n return {\n fontSize: 16,\n fontWeight: \"400\",\n lineHeight: \"20px\",\n scaleStep: \"150\",\n lineHeightCategory: \"compact\" as const,\n };\n case \"bodyMdAccent\":\n return {\n fontSize: 16,\n fontWeight: \"500\",\n lineHeight: \"20px\",\n scaleStep: \"150\",\n lineHeightCategory: \"compact\" as const,\n };\n case \"bodyMdParagraph\":\n return {\n fontSize: 16,\n fontWeight: \"400\",\n lineHeight: \"22px\",\n scaleStep: \"150\",\n lineHeightCategory: \"text\" as const,\n };\n case \"bodySm\":\n return {\n fontSize: 14,\n fontWeight: \"400\",\n lineHeight: \"18px\",\n scaleStep: \"125\",\n lineHeightCategory: \"compact\" as const,\n };\n case \"bodySmAccent\":\n return {\n fontSize: 14,\n fontWeight: \"500\",\n lineHeight: \"18px\",\n scaleStep: \"125\",\n lineHeightCategory: \"compact\" as const,\n };\n case \"bodySmParagraph\":\n return {\n fontSize: 14,\n fontWeight: \"400\",\n lineHeight: \"20px\",\n scaleStep: \"125\",\n lineHeightCategory: \"text\" as const,\n };\n case \"bodyXs\":\n return {\n fontSize: 12,\n fontWeight: \"400\",\n lineHeight: \"16px\",\n scaleStep: \"100\",\n lineHeightCategory: \"compact\" as const,\n };\n case \"bodyXsAccent\":\n return {\n fontSize: 12,\n fontWeight: \"500\",\n lineHeight: \"16px\",\n scaleStep: \"100\",\n lineHeightCategory: \"compact\" as const,\n };\n case \"bodyXsParagraph\":\n return {\n fontSize: 12,\n fontWeight: \"400\",\n lineHeight: \"18px\",\n scaleStep: \"100\",\n lineHeightCategory: \"text\" as const,\n };\n case \"bodyXxs\":\n return {\n fontSize: 10,\n fontWeight: \"400\",\n lineHeight: \"14px\",\n scaleStep: \"75\",\n lineHeightCategory: \"compact\" as const,\n };\n case \"bodyXxsAccent\":\n return {\n fontSize: 10,\n fontWeight: \"500\",\n lineHeight: \"14px\",\n scaleStep: \"75\",\n lineHeightCategory: \"compact\" as const,\n };\n case \"bodyXxsParagraph\":\n return {\n fontSize: 10,\n fontWeight: \"400\",\n lineHeight: \"14px\",\n scaleStep: \"75\",\n lineHeightCategory: \"text\" as const,\n };\n default:\n return {\n fontSize: 16,\n fontWeight: \"400\",\n lineHeight: \"20px\",\n scaleStep: \"150\",\n lineHeightCategory: \"compact\" as const,\n };\n }\n};\n\nfunction getResponsiveLineHeight(\n styles: ReturnType<typeof getVariantStyles>\n): string | undefined {\n const step = styles.lineHeightScaleStep || styles.scaleStep;\n if (!step) return undefined;\n\n const cat = styles.lineHeightCategory;\n if (cat === \"display\") return cssVar.lhDisplay(step);\n if (cat === \"text\") return cssVar.lhText(step);\n return cssVar.lhCompact(step);\n}\n\nexport const Typography = forwardRef<any, TypographyProps>(\n (\n {\n children,\n align = \"inherit\",\n noWrap = false,\n variant = \"bodyMd\",\n color = \"inherit\",\n marginBottom = 0,\n marginTop = 0,\n as,\n productContext,\n themeMode,\n themeProductContext,\n ...rest\n },\n ref\n ) => {\n const { theme } = useResolvedTheme({ themeMode, themeProductContext });\n const typographyTokens = productContext\n ? getTypographyTokens(productContext)\n : (theme as any).typographyTokens;\n const variantStyles = getVariantStyles(variant, typographyTokens);\n const colorValue = getColor(color, theme);\n const contextFonts = productContext\n ? getFonts(productContext)\n : (theme.fonts as Record<string, string>);\n const fontFamily = isHeadingVariant(variant)\n ? contextFonts?.heading\n : contextFonts?.body;\n\n const useResponsiveCSS = isWeb && variantStyles.scaleStep;\n\n const responsiveFontSize = useResponsiveCSS\n ? cssVar.fontSize(variantStyles.scaleStep!)\n : undefined;\n const responsiveLineHeight = useResponsiveCSS\n ? getResponsiveLineHeight(variantStyles)\n : undefined;\n\n return (\n <Text\n {...rest}\n ref={ref}\n as={as}\n color={colorValue}\n fontSize={useResponsiveCSS ? undefined : variantStyles.fontSize}\n fontWeight={variantStyles.fontWeight}\n fontFamily={fontFamily}\n numberOfLines={noWrap ? 1 : undefined}\n style={{\n marginTop,\n marginBottom,\n textAlign: align === \"inherit\" ? undefined : align,\n ...(useResponsiveCSS\n ? { fontSize: responsiveFontSize, lineHeight: responsiveLineHeight }\n : { lineHeight: variantStyles.lineHeight }),\n ...(noWrap && {\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n whiteSpace: \"nowrap\",\n }),\n ...rest.style,\n }}\n >\n {children}\n </Text>\n );\n }\n);\n\nTypography.displayName = \"Typography\";\n","import React from \"react\";\nimport styled from \"styled-components\";\nimport { TextProps } from \"@xsolla/xui-primitives-core\";\n\nconst StyledText = styled.span<TextProps>`\n color: ${(props) => props.color || \"inherit\"};\n font-size: ${(props) =>\n typeof props.fontSize === \"number\"\n ? `${props.fontSize}px`\n : props.fontSize || \"inherit\"};\n font-weight: ${(props) => props.fontWeight || \"normal\"};\n font-family: ${(props) =>\n props.fontFamily ||\n '\"Aktiv Grotesk\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif'};\n line-height: ${(props) =>\n typeof props.lineHeight === \"number\"\n ? `${props.lineHeight}px`\n : props.lineHeight || \"inherit\"};\n white-space: ${(props) => props.whiteSpace || \"normal\"};\n text-align: ${(props) => props.textAlign || \"inherit\"};\n text-decoration: ${(props) => props.textDecoration || \"none\"};\n`;\n\nexport const Text: React.FC<TextProps> = ({\n style,\n className,\n id,\n role,\n numberOfLines: _numberOfLines,\n ...props\n}) => {\n return (\n <StyledText\n {...props}\n style={style}\n className={className}\n id={id}\n role={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