@newtonedev/components 0.1.8 → 0.1.9
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/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/primitives/Text/Text.d.ts +1 -1
- package/dist/primitives/Text/Text.d.ts.map +1 -1
- package/dist/primitives/Text/Text.types.d.ts +2 -0
- package/dist/primitives/Text/Text.types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/primitives/Text/Text.tsx +4 -1
- package/src/primitives/Text/Text.types.ts +3 -0
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React14, { createContext, useState, useMemo, useEffect, useContext, useCallback, useRef } from 'react';
|
|
2
2
|
import { srgbToHex, getColor, DEFAULT_NEUTRAL_SATURATION, DEFAULT_NEUTRAL_HUE, DEFAULT_ACCENT_SATURATION, DEFAULT_ACCENT_HUE, DEFAULT_SUCCESS_SATURATION, DEFAULT_SUCCESS_HUE, DEFAULT_WARNING_SATURATION, DEFAULT_WARNING_HUE, DEFAULT_ERROR_SATURATION, DEFAULT_ERROR_HUE } from 'newtone';
|
|
3
|
-
import { ROLE_DEFAULT_WEIGHTS, BREAKPOINT_ROLE_SCALE, scaleRoleStep,
|
|
3
|
+
import { SEMANTIC_WEIGHT_MAP, ROLE_DEFAULT_WEIGHTS, BREAKPOINT_ROLE_SCALE, scaleRoleStep, resolveResponsiveSize, estimateLineWidths, REFERENCE_LINE_HEIGHT_RATIO, buildFontFeatureSettings, getBreakpointForWidth, fontConfigToFamily, DEFAULT_ROLE_SCALES, DEFAULT_LINE_HEIGHTS, DEFAULT_FONT_SIZES, DEFAULT_FONT_SLOTS, buildGoogleFontsUrl } from '@newtonedev/fonts';
|
|
4
4
|
export { DEFAULT_FONT_SIZES, DEFAULT_LINE_HEIGHTS, DEFAULT_ROLE_SCALES, buildGoogleFontsUrl } from '@newtonedev/fonts';
|
|
5
5
|
import { Text, View, useWindowDimensions, Pressable, TextInput as TextInput$1, ScrollView, PanResponder, Animated, StyleSheet } from 'react-native';
|
|
6
6
|
|
|
@@ -988,6 +988,7 @@ function TextBase({
|
|
|
988
988
|
role = "body",
|
|
989
989
|
color = "primary",
|
|
990
990
|
size: sizeOverride,
|
|
991
|
+
weight: weightOverride,
|
|
991
992
|
align,
|
|
992
993
|
numberOfLines,
|
|
993
994
|
elevation = 1,
|
|
@@ -1004,7 +1005,7 @@ function TextBase({
|
|
|
1004
1005
|
const { config, reportingEndpoint } = useNewtoneTheme();
|
|
1005
1006
|
const size = sizeOverride ?? "md";
|
|
1006
1007
|
const fontSlot = tokens.typography.fonts[scope];
|
|
1007
|
-
const resolvedFontWeight = config.typography.roleWeights?.[role] ?? ROLE_DEFAULT_WEIGHTS[role];
|
|
1008
|
+
const resolvedFontWeight = weightOverride ? SEMANTIC_WEIGHT_MAP[weightOverride] : config.typography.roleWeights?.[role] ?? ROLE_DEFAULT_WEIGHTS[role];
|
|
1008
1009
|
const breakpoint = useBreakpoint();
|
|
1009
1010
|
const baseStep = config.typography.roles[role][size];
|
|
1010
1011
|
const bpScale = BREAKPOINT_ROLE_SCALE[breakpoint][role];
|