@xaui/native 0.0.29 → 0.0.31
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 +1 -0
- package/dist/app-bar/index.cjs +7 -5
- package/dist/app-bar/index.d.cts +8 -1
- package/dist/app-bar/index.d.ts +8 -1
- package/dist/app-bar/index.js +7 -5
- package/dist/typography/index.cjs +76 -6
- package/dist/typography/index.d.cts +68 -2
- package/dist/typography/index.d.ts +68 -2
- package/dist/typography/index.js +74 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -87,6 +87,7 @@ This table lists all public components exported by `@xaui/native` and their impo
|
|
|
87
87
|
| `AutocompleteItem` | Suggestion item for `Autocomplete`. | `import { AutocompleteItem } from '@xaui/native/autocomplete'` |
|
|
88
88
|
| `DatePicker` | Date selection input/picker. | `import { DatePicker } from '@xaui/native/datepicker'` |
|
|
89
89
|
| `Typography` | Themed text component with variants. | `import { Typography } from '@xaui/native/typography'` |
|
|
90
|
+
| `TextSpan` | Text group primitive that shares inherited styles across nested typography. | `import { TextSpan } from '@xaui/native/typography'` |
|
|
90
91
|
| `Column` | Vertical flex layout helper. | `import { Column } from '@xaui/native/view'` |
|
|
91
92
|
| `Row` | Horizontal flex layout helper. | `import { Row } from '@xaui/native/view'` |
|
|
92
93
|
| `Spacer` | Flexible space element in layouts. | `import { Spacer } from '@xaui/native/view'` |
|
package/dist/app-bar/index.cjs
CHANGED
|
@@ -42,7 +42,6 @@ var styles = _reactnative.StyleSheet.create({
|
|
|
42
42
|
width: "100%"
|
|
43
43
|
},
|
|
44
44
|
floatingContainer: {
|
|
45
|
-
paddingHorizontal: 16,
|
|
46
45
|
paddingVertical: 8
|
|
47
46
|
},
|
|
48
47
|
appBar: {
|
|
@@ -56,7 +55,8 @@ var styles = _reactnative.StyleSheet.create({
|
|
|
56
55
|
borderRadius: 0
|
|
57
56
|
},
|
|
58
57
|
floating: {
|
|
59
|
-
width: "
|
|
58
|
+
width: "100%",
|
|
59
|
+
maxWidth: "97%",
|
|
60
60
|
borderRadius: 9999,
|
|
61
61
|
alignSelf: "center"
|
|
62
62
|
},
|
|
@@ -71,7 +71,7 @@ var styles = _reactnative.StyleSheet.create({
|
|
|
71
71
|
flex: 1,
|
|
72
72
|
alignItems: "center",
|
|
73
73
|
justifyContent: "center",
|
|
74
|
-
paddingHorizontal:
|
|
74
|
+
paddingHorizontal: 10
|
|
75
75
|
},
|
|
76
76
|
endContent: {
|
|
77
77
|
flexShrink: 0,
|
|
@@ -97,7 +97,7 @@ var AppBar = ({
|
|
|
97
97
|
const safeThemeColor = _core.getSafeThemeColor.call(void 0, themeColor);
|
|
98
98
|
const colorScheme = theme.colors[safeThemeColor];
|
|
99
99
|
const isDefaultThemeColor = safeThemeColor === "default";
|
|
100
|
-
const backgroundColor = isDefaultThemeColor ? theme.mode === "dark" ? theme.colors.default.background : "#FFFFFF" : colorScheme.background;
|
|
100
|
+
const backgroundColor = isDefaultThemeColor ? theme.mode === "dark" ? theme.colors.default.background : isFloating ? theme.palette.gray[200] : "#FFFFFF" : colorScheme.background;
|
|
101
101
|
const borderBottomColor = isDefaultThemeColor ? theme.mode === "dark" ? "rgba(255, 255, 255, 0.06)" : "rgba(0, 0, 0, 0.08)" : colorScheme.main;
|
|
102
102
|
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.container, isFloating && styles.floatingContainer] }, /* @__PURE__ */ _react2.default.createElement(
|
|
103
103
|
_reactnative.View,
|
|
@@ -125,9 +125,11 @@ var AppBarStartContent = ({
|
|
|
125
125
|
};
|
|
126
126
|
var AppBarContent = ({
|
|
127
127
|
children,
|
|
128
|
+
alignment = "center",
|
|
128
129
|
style
|
|
129
130
|
}) => {
|
|
130
|
-
|
|
131
|
+
const alignItems = alignment === "start" ? "flex-start" : alignment === "center" ? "center" : "flex-end";
|
|
132
|
+
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [styles.content, { alignItems }, style] }, children);
|
|
131
133
|
};
|
|
132
134
|
var AppBarEndContent = ({
|
|
133
135
|
children,
|
package/dist/app-bar/index.d.cts
CHANGED
|
@@ -40,8 +40,15 @@ type AppBarSlotProps = {
|
|
|
40
40
|
*/
|
|
41
41
|
style?: StyleProp<ViewStyle>;
|
|
42
42
|
};
|
|
43
|
+
type AppBarSlotContentAlignment = 'start' | 'center' | 'end';
|
|
43
44
|
type AppBarStartContentProps = AppBarSlotProps;
|
|
44
|
-
type AppBarContentProps = AppBarSlotProps
|
|
45
|
+
type AppBarContentProps = AppBarSlotProps & {
|
|
46
|
+
/**
|
|
47
|
+
* Horizontal alignment for content slot content.
|
|
48
|
+
* @default 'center'
|
|
49
|
+
*/
|
|
50
|
+
alignment?: AppBarSlotContentAlignment;
|
|
51
|
+
};
|
|
45
52
|
type AppBarEndContentProps = AppBarSlotProps;
|
|
46
53
|
|
|
47
54
|
declare const AppBar: React.FC<AppBarProps>;
|
package/dist/app-bar/index.d.ts
CHANGED
|
@@ -40,8 +40,15 @@ type AppBarSlotProps = {
|
|
|
40
40
|
*/
|
|
41
41
|
style?: StyleProp<ViewStyle>;
|
|
42
42
|
};
|
|
43
|
+
type AppBarSlotContentAlignment = 'start' | 'center' | 'end';
|
|
43
44
|
type AppBarStartContentProps = AppBarSlotProps;
|
|
44
|
-
type AppBarContentProps = AppBarSlotProps
|
|
45
|
+
type AppBarContentProps = AppBarSlotProps & {
|
|
46
|
+
/**
|
|
47
|
+
* Horizontal alignment for content slot content.
|
|
48
|
+
* @default 'center'
|
|
49
|
+
*/
|
|
50
|
+
alignment?: AppBarSlotContentAlignment;
|
|
51
|
+
};
|
|
45
52
|
type AppBarEndContentProps = AppBarSlotProps;
|
|
46
53
|
|
|
47
54
|
declare const AppBar: React.FC<AppBarProps>;
|
package/dist/app-bar/index.js
CHANGED
|
@@ -42,7 +42,6 @@ var styles = StyleSheet.create({
|
|
|
42
42
|
width: "100%"
|
|
43
43
|
},
|
|
44
44
|
floatingContainer: {
|
|
45
|
-
paddingHorizontal: 16,
|
|
46
45
|
paddingVertical: 8
|
|
47
46
|
},
|
|
48
47
|
appBar: {
|
|
@@ -56,7 +55,8 @@ var styles = StyleSheet.create({
|
|
|
56
55
|
borderRadius: 0
|
|
57
56
|
},
|
|
58
57
|
floating: {
|
|
59
|
-
width: "
|
|
58
|
+
width: "100%",
|
|
59
|
+
maxWidth: "97%",
|
|
60
60
|
borderRadius: 9999,
|
|
61
61
|
alignSelf: "center"
|
|
62
62
|
},
|
|
@@ -71,7 +71,7 @@ var styles = StyleSheet.create({
|
|
|
71
71
|
flex: 1,
|
|
72
72
|
alignItems: "center",
|
|
73
73
|
justifyContent: "center",
|
|
74
|
-
paddingHorizontal:
|
|
74
|
+
paddingHorizontal: 10
|
|
75
75
|
},
|
|
76
76
|
endContent: {
|
|
77
77
|
flexShrink: 0,
|
|
@@ -97,7 +97,7 @@ var AppBar = ({
|
|
|
97
97
|
const safeThemeColor = getSafeThemeColor(themeColor);
|
|
98
98
|
const colorScheme = theme.colors[safeThemeColor];
|
|
99
99
|
const isDefaultThemeColor = safeThemeColor === "default";
|
|
100
|
-
const backgroundColor = isDefaultThemeColor ? theme.mode === "dark" ? theme.colors.default.background : "#FFFFFF" : colorScheme.background;
|
|
100
|
+
const backgroundColor = isDefaultThemeColor ? theme.mode === "dark" ? theme.colors.default.background : isFloating ? theme.palette.gray[200] : "#FFFFFF" : colorScheme.background;
|
|
101
101
|
const borderBottomColor = isDefaultThemeColor ? theme.mode === "dark" ? "rgba(255, 255, 255, 0.06)" : "rgba(0, 0, 0, 0.08)" : colorScheme.main;
|
|
102
102
|
return /* @__PURE__ */ React.createElement(View, { style: [styles.container, isFloating && styles.floatingContainer] }, /* @__PURE__ */ React.createElement(
|
|
103
103
|
View,
|
|
@@ -125,9 +125,11 @@ var AppBarStartContent = ({
|
|
|
125
125
|
};
|
|
126
126
|
var AppBarContent = ({
|
|
127
127
|
children,
|
|
128
|
+
alignment = "center",
|
|
128
129
|
style
|
|
129
130
|
}) => {
|
|
130
|
-
|
|
131
|
+
const alignItems = alignment === "start" ? "flex-start" : alignment === "center" ? "center" : "flex-end";
|
|
132
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.content, { alignItems }, style] }, children);
|
|
131
133
|
};
|
|
132
134
|
var AppBarEndContent = ({
|
|
133
135
|
children,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }require('../chunk-HSPTLUFA.cjs');
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }require('../chunk-HSPTLUFA.cjs');
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
var _chunkOQ2BLOOGcjs = require('../chunk-OQ2BLOOG.cjs');
|
|
@@ -15,6 +15,13 @@ var styles = _reactnative.StyleSheet.create({
|
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
+
// src/components/typography/text-span.context.ts
|
|
19
|
+
|
|
20
|
+
var TextSpanContext = _react.createContext.call(void 0, {});
|
|
21
|
+
var useTextSpanInheritedStyle = () => {
|
|
22
|
+
return _react.useContext.call(void 0, TextSpanContext);
|
|
23
|
+
};
|
|
24
|
+
|
|
18
25
|
// src/components/typography/typography.hook.ts
|
|
19
26
|
|
|
20
27
|
var _core = require('@xaui/core');
|
|
@@ -137,11 +144,26 @@ var Typography = ({
|
|
|
137
144
|
variant = "bodyMedium",
|
|
138
145
|
maxLines,
|
|
139
146
|
overflow = "clip",
|
|
147
|
+
color,
|
|
148
|
+
letterSpacing,
|
|
149
|
+
fontWeight,
|
|
150
|
+
fontStyle,
|
|
151
|
+
textDecorationLine,
|
|
152
|
+
textTransform,
|
|
140
153
|
style
|
|
141
154
|
}) => {
|
|
142
|
-
const
|
|
155
|
+
const inheritedStyle = useTextSpanInheritedStyle();
|
|
156
|
+
const themeColorValue = useTypographyColor(themeColor);
|
|
143
157
|
const variantStyles = useTypographyVariantStyles(variant);
|
|
144
|
-
const
|
|
158
|
+
const resolvedAlign = _nullishCoalesce(align, () => ( inheritedStyle.align));
|
|
159
|
+
const textStyleOverrides = {
|
|
160
|
+
color: _nullishCoalesce(_nullishCoalesce(color, () => ( inheritedStyle.color)), () => ( themeColorValue)),
|
|
161
|
+
letterSpacing,
|
|
162
|
+
fontWeight: _nullishCoalesce(fontWeight, () => ( inheritedStyle.fontWeight)),
|
|
163
|
+
fontStyle: _nullishCoalesce(fontStyle, () => ( inheritedStyle.fontStyle)),
|
|
164
|
+
textDecorationLine,
|
|
165
|
+
textTransform: _nullishCoalesce(textTransform, () => ( inheritedStyle.textTransform))
|
|
166
|
+
};
|
|
145
167
|
const ellipsizeMode = _react.useMemo.call(void 0, () => {
|
|
146
168
|
if (!maxLines) return void 0;
|
|
147
169
|
if (overflow === "clip") return "clip";
|
|
@@ -155,8 +177,8 @@ var Typography = ({
|
|
|
155
177
|
style: [
|
|
156
178
|
styles.text,
|
|
157
179
|
variantStyles,
|
|
158
|
-
|
|
159
|
-
|
|
180
|
+
resolvedAlign && { textAlign: resolvedAlign },
|
|
181
|
+
textStyleOverrides,
|
|
160
182
|
style
|
|
161
183
|
]
|
|
162
184
|
},
|
|
@@ -164,5 +186,53 @@ var Typography = ({
|
|
|
164
186
|
);
|
|
165
187
|
};
|
|
166
188
|
|
|
189
|
+
// src/components/typography/text-span.tsx
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
var alignToJustifyContent = {
|
|
193
|
+
left: "flex-start",
|
|
194
|
+
center: "center",
|
|
195
|
+
right: "flex-end",
|
|
196
|
+
justify: "space-between"
|
|
197
|
+
};
|
|
198
|
+
var TextSpan = ({
|
|
199
|
+
children,
|
|
200
|
+
color,
|
|
201
|
+
fontWeight,
|
|
202
|
+
fontStyle,
|
|
203
|
+
textTransform,
|
|
204
|
+
spacing,
|
|
205
|
+
align,
|
|
206
|
+
backgroundColor,
|
|
207
|
+
style
|
|
208
|
+
}) => {
|
|
209
|
+
const inheritedTextStyle = {
|
|
210
|
+
color,
|
|
211
|
+
fontWeight,
|
|
212
|
+
fontStyle,
|
|
213
|
+
textTransform,
|
|
214
|
+
align
|
|
215
|
+
};
|
|
216
|
+
return /* @__PURE__ */ _react2.default.createElement(TextSpanContext.Provider, { value: inheritedTextStyle }, /* @__PURE__ */ _react2.default.createElement(
|
|
217
|
+
_reactnative.View,
|
|
218
|
+
{
|
|
219
|
+
style: [
|
|
220
|
+
{
|
|
221
|
+
flexDirection: "row",
|
|
222
|
+
flexWrap: "wrap",
|
|
223
|
+
alignItems: "center",
|
|
224
|
+
...align ? { justifyContent: alignToJustifyContent[align] } : {},
|
|
225
|
+
...typeof spacing === "number" ? { gap: spacing } : {},
|
|
226
|
+
...backgroundColor ? { backgroundColor } : {}
|
|
227
|
+
},
|
|
228
|
+
style
|
|
229
|
+
]
|
|
230
|
+
},
|
|
231
|
+
children
|
|
232
|
+
));
|
|
233
|
+
};
|
|
234
|
+
TextSpan.displayName = "TextSpan";
|
|
235
|
+
|
|
236
|
+
|
|
167
237
|
|
|
168
|
-
exports.Typography = Typography;
|
|
238
|
+
exports.TextSpan = TextSpan; exports.Typography = Typography;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import { StyleProp, TextStyle } from 'react-native';
|
|
2
|
+
import { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
3
3
|
import { T as ThemeColor } from '../index-BOw6tbkc.cjs';
|
|
4
4
|
|
|
5
5
|
type TypographyAlign = 'center' | 'justify' | 'left' | 'right';
|
|
@@ -36,8 +36,74 @@ type TypographyProps = {
|
|
|
36
36
|
* Custom styles for the text.
|
|
37
37
|
*/
|
|
38
38
|
style?: StyleProp<TextStyle>;
|
|
39
|
+
/**
|
|
40
|
+
* Custom text color override.
|
|
41
|
+
*/
|
|
42
|
+
color?: TextStyle['color'];
|
|
43
|
+
/**
|
|
44
|
+
* The spacing between characters.
|
|
45
|
+
*/
|
|
46
|
+
letterSpacing?: number;
|
|
47
|
+
/**
|
|
48
|
+
* The text weight.
|
|
49
|
+
*/
|
|
50
|
+
fontWeight?: TextStyle['fontWeight'];
|
|
51
|
+
/**
|
|
52
|
+
* The text style.
|
|
53
|
+
*/
|
|
54
|
+
fontStyle?: TextStyle['fontStyle'];
|
|
55
|
+
/**
|
|
56
|
+
* Text decoration line.
|
|
57
|
+
*/
|
|
58
|
+
textDecorationLine?: TextStyle['textDecorationLine'];
|
|
59
|
+
/**
|
|
60
|
+
* Text transform mode.
|
|
61
|
+
*/
|
|
62
|
+
textTransform?: TextStyle['textTransform'];
|
|
39
63
|
};
|
|
40
64
|
|
|
41
65
|
declare const Typography: React.FC<TypographyProps>;
|
|
42
66
|
|
|
43
|
-
|
|
67
|
+
type TextSpanAlign = TypographyAlign;
|
|
68
|
+
type TextSpanProps = {
|
|
69
|
+
/**
|
|
70
|
+
* The content to display inside the text span.
|
|
71
|
+
*/
|
|
72
|
+
children: ReactNode;
|
|
73
|
+
/**
|
|
74
|
+
* Inherited text color for nested Typography.
|
|
75
|
+
*/
|
|
76
|
+
color?: TextStyle['color'];
|
|
77
|
+
/**
|
|
78
|
+
* Inherited text weight for nested Typography.
|
|
79
|
+
*/
|
|
80
|
+
fontWeight?: TextStyle['fontWeight'];
|
|
81
|
+
/**
|
|
82
|
+
* Inherited text style for nested Typography.
|
|
83
|
+
*/
|
|
84
|
+
fontStyle?: TextStyle['fontStyle'];
|
|
85
|
+
/**
|
|
86
|
+
* Inherited text transform for nested Typography.
|
|
87
|
+
*/
|
|
88
|
+
textTransform?: TextStyle['textTransform'];
|
|
89
|
+
/**
|
|
90
|
+
* Spacing between children.
|
|
91
|
+
*/
|
|
92
|
+
spacing?: number;
|
|
93
|
+
/**
|
|
94
|
+
* Text alignment for all nested typography unless overridden.
|
|
95
|
+
*/
|
|
96
|
+
align?: TextSpanAlign;
|
|
97
|
+
/**
|
|
98
|
+
* Background color for the text span container.
|
|
99
|
+
*/
|
|
100
|
+
backgroundColor?: ViewStyle['backgroundColor'];
|
|
101
|
+
/**
|
|
102
|
+
* Custom styles for the text span container.
|
|
103
|
+
*/
|
|
104
|
+
style?: StyleProp<ViewStyle>;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
declare const TextSpan: React.FC<TextSpanProps>;
|
|
108
|
+
|
|
109
|
+
export { TextSpan, type TextSpanAlign, type TextSpanProps, Typography, type TypographyAlign, type TypographyProps, type TypographyVariant };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import { StyleProp, TextStyle } from 'react-native';
|
|
2
|
+
import { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
3
3
|
import { T as ThemeColor } from '../index-BOw6tbkc.js';
|
|
4
4
|
|
|
5
5
|
type TypographyAlign = 'center' | 'justify' | 'left' | 'right';
|
|
@@ -36,8 +36,74 @@ type TypographyProps = {
|
|
|
36
36
|
* Custom styles for the text.
|
|
37
37
|
*/
|
|
38
38
|
style?: StyleProp<TextStyle>;
|
|
39
|
+
/**
|
|
40
|
+
* Custom text color override.
|
|
41
|
+
*/
|
|
42
|
+
color?: TextStyle['color'];
|
|
43
|
+
/**
|
|
44
|
+
* The spacing between characters.
|
|
45
|
+
*/
|
|
46
|
+
letterSpacing?: number;
|
|
47
|
+
/**
|
|
48
|
+
* The text weight.
|
|
49
|
+
*/
|
|
50
|
+
fontWeight?: TextStyle['fontWeight'];
|
|
51
|
+
/**
|
|
52
|
+
* The text style.
|
|
53
|
+
*/
|
|
54
|
+
fontStyle?: TextStyle['fontStyle'];
|
|
55
|
+
/**
|
|
56
|
+
* Text decoration line.
|
|
57
|
+
*/
|
|
58
|
+
textDecorationLine?: TextStyle['textDecorationLine'];
|
|
59
|
+
/**
|
|
60
|
+
* Text transform mode.
|
|
61
|
+
*/
|
|
62
|
+
textTransform?: TextStyle['textTransform'];
|
|
39
63
|
};
|
|
40
64
|
|
|
41
65
|
declare const Typography: React.FC<TypographyProps>;
|
|
42
66
|
|
|
43
|
-
|
|
67
|
+
type TextSpanAlign = TypographyAlign;
|
|
68
|
+
type TextSpanProps = {
|
|
69
|
+
/**
|
|
70
|
+
* The content to display inside the text span.
|
|
71
|
+
*/
|
|
72
|
+
children: ReactNode;
|
|
73
|
+
/**
|
|
74
|
+
* Inherited text color for nested Typography.
|
|
75
|
+
*/
|
|
76
|
+
color?: TextStyle['color'];
|
|
77
|
+
/**
|
|
78
|
+
* Inherited text weight for nested Typography.
|
|
79
|
+
*/
|
|
80
|
+
fontWeight?: TextStyle['fontWeight'];
|
|
81
|
+
/**
|
|
82
|
+
* Inherited text style for nested Typography.
|
|
83
|
+
*/
|
|
84
|
+
fontStyle?: TextStyle['fontStyle'];
|
|
85
|
+
/**
|
|
86
|
+
* Inherited text transform for nested Typography.
|
|
87
|
+
*/
|
|
88
|
+
textTransform?: TextStyle['textTransform'];
|
|
89
|
+
/**
|
|
90
|
+
* Spacing between children.
|
|
91
|
+
*/
|
|
92
|
+
spacing?: number;
|
|
93
|
+
/**
|
|
94
|
+
* Text alignment for all nested typography unless overridden.
|
|
95
|
+
*/
|
|
96
|
+
align?: TextSpanAlign;
|
|
97
|
+
/**
|
|
98
|
+
* Background color for the text span container.
|
|
99
|
+
*/
|
|
100
|
+
backgroundColor?: ViewStyle['backgroundColor'];
|
|
101
|
+
/**
|
|
102
|
+
* Custom styles for the text span container.
|
|
103
|
+
*/
|
|
104
|
+
style?: StyleProp<ViewStyle>;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
declare const TextSpan: React.FC<TextSpanProps>;
|
|
108
|
+
|
|
109
|
+
export { TextSpan, type TextSpanAlign, type TextSpanProps, Typography, type TypographyAlign, type TypographyProps, type TypographyVariant };
|
package/dist/typography/index.js
CHANGED
|
@@ -15,6 +15,13 @@ var styles = StyleSheet.create({
|
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
+
// src/components/typography/text-span.context.ts
|
|
19
|
+
import { createContext, useContext } from "react";
|
|
20
|
+
var TextSpanContext = createContext({});
|
|
21
|
+
var useTextSpanInheritedStyle = () => {
|
|
22
|
+
return useContext(TextSpanContext);
|
|
23
|
+
};
|
|
24
|
+
|
|
18
25
|
// src/components/typography/typography.hook.ts
|
|
19
26
|
import { useMemo } from "react";
|
|
20
27
|
import { getSafeThemeColor } from "@xaui/core";
|
|
@@ -137,11 +144,26 @@ var Typography = ({
|
|
|
137
144
|
variant = "bodyMedium",
|
|
138
145
|
maxLines,
|
|
139
146
|
overflow = "clip",
|
|
147
|
+
color,
|
|
148
|
+
letterSpacing,
|
|
149
|
+
fontWeight,
|
|
150
|
+
fontStyle,
|
|
151
|
+
textDecorationLine,
|
|
152
|
+
textTransform,
|
|
140
153
|
style
|
|
141
154
|
}) => {
|
|
142
|
-
const
|
|
155
|
+
const inheritedStyle = useTextSpanInheritedStyle();
|
|
156
|
+
const themeColorValue = useTypographyColor(themeColor);
|
|
143
157
|
const variantStyles = useTypographyVariantStyles(variant);
|
|
144
|
-
const
|
|
158
|
+
const resolvedAlign = align ?? inheritedStyle.align;
|
|
159
|
+
const textStyleOverrides = {
|
|
160
|
+
color: color ?? inheritedStyle.color ?? themeColorValue,
|
|
161
|
+
letterSpacing,
|
|
162
|
+
fontWeight: fontWeight ?? inheritedStyle.fontWeight,
|
|
163
|
+
fontStyle: fontStyle ?? inheritedStyle.fontStyle,
|
|
164
|
+
textDecorationLine,
|
|
165
|
+
textTransform: textTransform ?? inheritedStyle.textTransform
|
|
166
|
+
};
|
|
145
167
|
const ellipsizeMode = useMemo2(() => {
|
|
146
168
|
if (!maxLines) return void 0;
|
|
147
169
|
if (overflow === "clip") return "clip";
|
|
@@ -155,14 +177,62 @@ var Typography = ({
|
|
|
155
177
|
style: [
|
|
156
178
|
styles.text,
|
|
157
179
|
variantStyles,
|
|
158
|
-
|
|
159
|
-
|
|
180
|
+
resolvedAlign && { textAlign: resolvedAlign },
|
|
181
|
+
textStyleOverrides,
|
|
160
182
|
style
|
|
161
183
|
]
|
|
162
184
|
},
|
|
163
185
|
children
|
|
164
186
|
);
|
|
165
187
|
};
|
|
188
|
+
|
|
189
|
+
// src/components/typography/text-span.tsx
|
|
190
|
+
import React2 from "react";
|
|
191
|
+
import { View } from "react-native";
|
|
192
|
+
var alignToJustifyContent = {
|
|
193
|
+
left: "flex-start",
|
|
194
|
+
center: "center",
|
|
195
|
+
right: "flex-end",
|
|
196
|
+
justify: "space-between"
|
|
197
|
+
};
|
|
198
|
+
var TextSpan = ({
|
|
199
|
+
children,
|
|
200
|
+
color,
|
|
201
|
+
fontWeight,
|
|
202
|
+
fontStyle,
|
|
203
|
+
textTransform,
|
|
204
|
+
spacing,
|
|
205
|
+
align,
|
|
206
|
+
backgroundColor,
|
|
207
|
+
style
|
|
208
|
+
}) => {
|
|
209
|
+
const inheritedTextStyle = {
|
|
210
|
+
color,
|
|
211
|
+
fontWeight,
|
|
212
|
+
fontStyle,
|
|
213
|
+
textTransform,
|
|
214
|
+
align
|
|
215
|
+
};
|
|
216
|
+
return /* @__PURE__ */ React2.createElement(TextSpanContext.Provider, { value: inheritedTextStyle }, /* @__PURE__ */ React2.createElement(
|
|
217
|
+
View,
|
|
218
|
+
{
|
|
219
|
+
style: [
|
|
220
|
+
{
|
|
221
|
+
flexDirection: "row",
|
|
222
|
+
flexWrap: "wrap",
|
|
223
|
+
alignItems: "center",
|
|
224
|
+
...align ? { justifyContent: alignToJustifyContent[align] } : {},
|
|
225
|
+
...typeof spacing === "number" ? { gap: spacing } : {},
|
|
226
|
+
...backgroundColor ? { backgroundColor } : {}
|
|
227
|
+
},
|
|
228
|
+
style
|
|
229
|
+
]
|
|
230
|
+
},
|
|
231
|
+
children
|
|
232
|
+
));
|
|
233
|
+
};
|
|
234
|
+
TextSpan.displayName = "TextSpan";
|
|
166
235
|
export {
|
|
236
|
+
TextSpan,
|
|
167
237
|
Typography
|
|
168
238
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xaui/native",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.31",
|
|
4
4
|
"description": "Flutter-inspired React Native UI components with native animations powered by React Native Reanimated",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -238,8 +238,8 @@
|
|
|
238
238
|
"directory": "packages/native"
|
|
239
239
|
},
|
|
240
240
|
"dependencies": {
|
|
241
|
-
"@xaui/core": "0.1.
|
|
242
|
-
"@xaui/icons": "0.0.
|
|
241
|
+
"@xaui/core": "0.1.8",
|
|
242
|
+
"@xaui/icons": "0.0.5"
|
|
243
243
|
},
|
|
244
244
|
"peerDependencies": {
|
|
245
245
|
"react": "^18.0.0 || ^19.0.0",
|