@xaui/native 0.0.8 → 0.0.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/accordion/index.cjs +86 -68
- package/dist/accordion/index.js +2 -2
- package/dist/autocomplete/index.cjs +1503 -0
- package/dist/autocomplete/index.d.cts +70 -0
- package/dist/autocomplete/index.d.ts +70 -0
- package/dist/autocomplete/index.js +11 -0
- package/dist/button/index.cjs +87 -69
- package/dist/button/index.js +2 -2
- package/dist/checkbox/index.cjs +48 -30
- package/dist/checkbox/index.js +1 -1
- package/dist/{chunk-B2VGVZ3J.js → chunk-63LRW4QD.js} +1 -1
- package/dist/chunk-6HUSEZDJ.js +1138 -0
- package/dist/chunk-7LXW4BXD.js +606 -0
- package/dist/chunk-GBHQCAKW.js +19 -0
- package/dist/{chunk-R34CVLCX.js → chunk-GNJIET26.js} +1 -1
- package/dist/chunk-NBRASCX4.js +145 -0
- package/dist/chunk-ZYTBRHLJ.js +150 -0
- package/dist/core/index.cjs +68 -10
- package/dist/core/index.d.cts +9 -1
- package/dist/core/index.d.ts +9 -1
- package/dist/core/index.js +5 -1
- package/dist/divider/index.cjs +31 -13
- package/dist/divider/index.js +2 -2
- package/dist/icon/index.cjs +680 -0
- package/dist/icon/index.d.cts +36 -0
- package/dist/icon/index.d.ts +36 -0
- package/dist/icon/index.js +13 -0
- package/dist/index.cjs +1641 -53
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +16 -4
- package/dist/indicator/index.cjs +60 -42
- package/dist/indicator/index.js +2 -2
- package/dist/progress/index.cjs +45 -27
- package/dist/progress/index.js +1 -1
- package/dist/select/index.cjs +107 -89
- package/dist/select/index.js +10 -23
- package/dist/switch/index.cjs +58 -40
- package/dist/switch/index.js +1 -1
- package/dist/typography/index.cjs +223 -0
- package/dist/typography/index.d.cts +43 -0
- package/dist/typography/index.d.ts +43 -0
- package/dist/typography/index.js +7 -0
- package/dist/view/index.cjs +8 -2
- package/dist/view/index.d.cts +11 -1
- package/dist/view/index.d.ts +11 -1
- package/dist/view/index.js +8 -2
- package/package.json +16 -1
- package/dist/chunk-ORMNMNOK.js +0 -89
package/dist/switch/index.cjs
CHANGED
|
@@ -35,25 +35,43 @@ __export(switch_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(switch_exports);
|
|
36
36
|
|
|
37
37
|
// src/components/switch/switch.tsx
|
|
38
|
-
var
|
|
39
|
-
var
|
|
38
|
+
var import_react7 = __toESM(require("react"), 1);
|
|
39
|
+
var import_react_native6 = require("react-native");
|
|
40
40
|
|
|
41
41
|
// src/components/switch/switch.hook.ts
|
|
42
|
-
var
|
|
42
|
+
var import_react6 = require("react");
|
|
43
43
|
var import_core = require("@xaui/core");
|
|
44
44
|
|
|
45
45
|
// src/core/theme-context.tsx
|
|
46
|
-
var
|
|
47
|
-
var
|
|
46
|
+
var import_react4 = __toESM(require("react"), 1);
|
|
47
|
+
var import_react_native2 = require("react-native");
|
|
48
48
|
var import_theme = require("@xaui/core/theme");
|
|
49
49
|
var import_palette = require("@xaui/core/palette");
|
|
50
|
-
var XUIThemeContext = (0, import_react.createContext)(null);
|
|
51
50
|
|
|
52
|
-
// src/core/
|
|
51
|
+
// src/core/portal/portal.tsx
|
|
53
52
|
var import_react2 = require("react");
|
|
54
|
-
|
|
53
|
+
|
|
54
|
+
// src/core/portal/portal-context.ts
|
|
55
|
+
var import_react = require("react");
|
|
56
|
+
var PortalContext = (0, import_react.createContext)(null);
|
|
57
|
+
|
|
58
|
+
// src/core/portal/portal-host.tsx
|
|
59
|
+
var import_react3 = __toESM(require("react"), 1);
|
|
60
|
+
var import_react_native = require("react-native");
|
|
61
|
+
var hostStyles = import_react_native.StyleSheet.create({
|
|
62
|
+
container: {
|
|
63
|
+
flex: 1
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// src/core/theme-context.tsx
|
|
68
|
+
var XUIThemeContext = (0, import_react4.createContext)(null);
|
|
69
|
+
|
|
70
|
+
// src/core/theme-hooks.ts
|
|
71
|
+
var import_react5 = require("react");
|
|
72
|
+
var import_react_native3 = require("react-native");
|
|
55
73
|
function useXUITheme() {
|
|
56
|
-
const theme = (0,
|
|
74
|
+
const theme = (0, import_react5.useContext)(XUIThemeContext);
|
|
57
75
|
if (!theme) {
|
|
58
76
|
throw new Error("useXUITheme must be used within XUIProvider");
|
|
59
77
|
}
|
|
@@ -71,7 +89,7 @@ var useSwitchColorScheme = (themeColor) => {
|
|
|
71
89
|
};
|
|
72
90
|
var useSwitchSizeStyles = (variant, size) => {
|
|
73
91
|
const theme = useXUITheme();
|
|
74
|
-
const sizeStyles = (0,
|
|
92
|
+
const sizeStyles = (0, import_react6.useMemo)(() => {
|
|
75
93
|
if (variant === "overlap") {
|
|
76
94
|
const sizes2 = {
|
|
77
95
|
sm: {
|
|
@@ -127,7 +145,7 @@ var useSwitchSizeStyles = (variant, size) => {
|
|
|
127
145
|
};
|
|
128
146
|
var useSwitchRadiusStyles = (radius) => {
|
|
129
147
|
const theme = useXUITheme();
|
|
130
|
-
const radiusStyles = (0,
|
|
148
|
+
const radiusStyles = (0, import_react6.useMemo)(() => {
|
|
131
149
|
const radii = {
|
|
132
150
|
none: theme.borderRadius.none,
|
|
133
151
|
sm: theme.borderRadius.sm,
|
|
@@ -137,7 +155,7 @@ var useSwitchRadiusStyles = (radius) => {
|
|
|
137
155
|
};
|
|
138
156
|
return { borderRadius: radii[radius] };
|
|
139
157
|
}, [radius, theme]);
|
|
140
|
-
const thumbRadius = (0,
|
|
158
|
+
const thumbRadius = (0, import_react6.useMemo)(() => {
|
|
141
159
|
const radii = {
|
|
142
160
|
none: theme.borderRadius.none,
|
|
143
161
|
sm: theme.borderRadius.sm,
|
|
@@ -157,7 +175,7 @@ var useSwitchTrackStyles = ({
|
|
|
157
175
|
radiusStyles
|
|
158
176
|
}) => {
|
|
159
177
|
const theme = useXUITheme();
|
|
160
|
-
const trackStyles = (0,
|
|
178
|
+
const trackStyles = (0, import_react6.useMemo)(() => {
|
|
161
179
|
const backgroundColor = isSelected ? variant === "overlap" ? colorScheme.background : colorScheme.main : theme.colors.default.background;
|
|
162
180
|
return {
|
|
163
181
|
width: sizeStyles.trackWidth,
|
|
@@ -177,7 +195,7 @@ var useSwitchThumbStyles = ({
|
|
|
177
195
|
thumbRadius
|
|
178
196
|
}) => {
|
|
179
197
|
const theme = useXUITheme();
|
|
180
|
-
const thumbStyles = (0,
|
|
198
|
+
const thumbStyles = (0, import_react6.useMemo)(() => {
|
|
181
199
|
const baseStyle = {
|
|
182
200
|
width: sizeStyles.thumbSize,
|
|
183
201
|
height: sizeStyles.thumbSize,
|
|
@@ -193,7 +211,7 @@ var useSwitchThumbStyles = ({
|
|
|
193
211
|
return thumbStyles;
|
|
194
212
|
};
|
|
195
213
|
var useSwitchContainerStyles = (labelAlignment) => {
|
|
196
|
-
const containerStyles = (0,
|
|
214
|
+
const containerStyles = (0, import_react6.useMemo)(() => {
|
|
197
215
|
const isJustified = labelAlignment === "justify-left" || labelAlignment === "justify-right";
|
|
198
216
|
return {
|
|
199
217
|
flexDirection: labelAlignment === "left" || labelAlignment === "justify-left" ? "row-reverse" : "row",
|
|
@@ -204,9 +222,9 @@ var useSwitchContainerStyles = (labelAlignment) => {
|
|
|
204
222
|
};
|
|
205
223
|
|
|
206
224
|
// src/components/switch/switch.animation.ts
|
|
207
|
-
var
|
|
225
|
+
var import_react_native4 = require("react-native");
|
|
208
226
|
var runThumbPositionAnimation = (thumbPosition, isSelected) => {
|
|
209
|
-
|
|
227
|
+
import_react_native4.Animated.spring(thumbPosition, {
|
|
210
228
|
toValue: isSelected ? 1 : 0,
|
|
211
229
|
useNativeDriver: true,
|
|
212
230
|
damping: 15,
|
|
@@ -214,24 +232,24 @@ var runThumbPositionAnimation = (thumbPosition, isSelected) => {
|
|
|
214
232
|
}).start();
|
|
215
233
|
};
|
|
216
234
|
var runSwitchPressInAnimation = (animatedScale, animatedThumbScale, isOverlap) => {
|
|
217
|
-
|
|
218
|
-
|
|
235
|
+
import_react_native4.Animated.parallel([
|
|
236
|
+
import_react_native4.Animated.spring(animatedScale, {
|
|
219
237
|
toValue: 0.95,
|
|
220
238
|
useNativeDriver: true
|
|
221
239
|
}),
|
|
222
|
-
|
|
240
|
+
import_react_native4.Animated.spring(animatedThumbScale, {
|
|
223
241
|
toValue: isOverlap ? 1.1 : 1.2,
|
|
224
242
|
useNativeDriver: true
|
|
225
243
|
})
|
|
226
244
|
]).start();
|
|
227
245
|
};
|
|
228
246
|
var runSwitchPressOutAnimation = (animatedScale, animatedThumbScale) => {
|
|
229
|
-
|
|
230
|
-
|
|
247
|
+
import_react_native4.Animated.parallel([
|
|
248
|
+
import_react_native4.Animated.spring(animatedScale, {
|
|
231
249
|
toValue: 1,
|
|
232
250
|
useNativeDriver: true
|
|
233
251
|
}),
|
|
234
|
-
|
|
252
|
+
import_react_native4.Animated.spring(animatedThumbScale, {
|
|
235
253
|
toValue: 1,
|
|
236
254
|
useNativeDriver: true
|
|
237
255
|
})
|
|
@@ -239,8 +257,8 @@ var runSwitchPressOutAnimation = (animatedScale, animatedThumbScale) => {
|
|
|
239
257
|
};
|
|
240
258
|
|
|
241
259
|
// src/components/switch/switch.style.ts
|
|
242
|
-
var
|
|
243
|
-
var styles =
|
|
260
|
+
var import_react_native5 = require("react-native");
|
|
261
|
+
var styles = import_react_native5.StyleSheet.create({
|
|
244
262
|
container: {
|
|
245
263
|
flexDirection: "row",
|
|
246
264
|
alignItems: "center",
|
|
@@ -292,11 +310,11 @@ var Switch = ({
|
|
|
292
310
|
}) => {
|
|
293
311
|
const theme = useXUITheme();
|
|
294
312
|
const isControlled = typeof isSelectedProp === "boolean";
|
|
295
|
-
const [internalSelected, setInternalSelected] = (0,
|
|
313
|
+
const [internalSelected, setInternalSelected] = (0, import_react7.useState)(isSelectedProp ?? false);
|
|
296
314
|
const isSelected = isControlled ? isSelectedProp : internalSelected;
|
|
297
|
-
const scale = (0,
|
|
298
|
-
const thumbPosition = (0,
|
|
299
|
-
const thumbScale = (0,
|
|
315
|
+
const scale = (0, import_react7.useRef)(new import_react_native6.Animated.Value(1)).current;
|
|
316
|
+
const thumbPosition = (0, import_react7.useRef)(new import_react_native6.Animated.Value(isSelected ? 1 : 0)).current;
|
|
317
|
+
const thumbScale = (0, import_react7.useRef)(new import_react_native6.Animated.Value(1)).current;
|
|
300
318
|
const colorScheme = useSwitchColorScheme(themeColor);
|
|
301
319
|
const sizeStyles = useSwitchSizeStyles(variant, size);
|
|
302
320
|
const { radiusStyles, thumbRadius } = useSwitchRadiusStyles(radius);
|
|
@@ -315,20 +333,20 @@ var Switch = ({
|
|
|
315
333
|
thumbRadius
|
|
316
334
|
});
|
|
317
335
|
const containerStyles = useSwitchContainerStyles(labelAlignment);
|
|
318
|
-
const maxTranslateX = (0,
|
|
336
|
+
const maxTranslateX = (0, import_react7.useMemo)(() => {
|
|
319
337
|
if (variant === "overlap") {
|
|
320
338
|
return sizeStyles.trackWidth - sizeStyles.thumbSize;
|
|
321
339
|
}
|
|
322
340
|
return sizeStyles.trackWidth - sizeStyles.thumbSize - sizeStyles.padding * 2;
|
|
323
341
|
}, [sizeStyles, variant]);
|
|
324
|
-
const translateX = (0,
|
|
342
|
+
const translateX = (0, import_react7.useMemo)(
|
|
325
343
|
() => thumbPosition.interpolate({
|
|
326
344
|
inputRange: [0, 1],
|
|
327
345
|
outputRange: [0, maxTranslateX]
|
|
328
346
|
}),
|
|
329
347
|
[maxTranslateX, thumbPosition]
|
|
330
348
|
);
|
|
331
|
-
(0,
|
|
349
|
+
(0, import_react7.useEffect)(() => {
|
|
332
350
|
runThumbPositionAnimation(thumbPosition, isSelected);
|
|
333
351
|
}, [isSelected, thumbPosition]);
|
|
334
352
|
const handlePress = () => {
|
|
@@ -347,8 +365,8 @@ var Switch = ({
|
|
|
347
365
|
if (isDisabled) return;
|
|
348
366
|
runSwitchPressOutAnimation(scale, thumbScale);
|
|
349
367
|
};
|
|
350
|
-
return /* @__PURE__ */
|
|
351
|
-
|
|
368
|
+
return /* @__PURE__ */ import_react7.default.createElement(
|
|
369
|
+
import_react_native6.Pressable,
|
|
352
370
|
{
|
|
353
371
|
onPress: handlePress,
|
|
354
372
|
onPressIn: handlePressIn,
|
|
@@ -369,8 +387,8 @@ var Switch = ({
|
|
|
369
387
|
style
|
|
370
388
|
]
|
|
371
389
|
},
|
|
372
|
-
/* @__PURE__ */
|
|
373
|
-
|
|
390
|
+
/* @__PURE__ */ import_react7.default.createElement(
|
|
391
|
+
import_react_native6.Animated.View,
|
|
374
392
|
{
|
|
375
393
|
style: [
|
|
376
394
|
styles.track,
|
|
@@ -380,8 +398,8 @@ var Switch = ({
|
|
|
380
398
|
}
|
|
381
399
|
]
|
|
382
400
|
},
|
|
383
|
-
/* @__PURE__ */
|
|
384
|
-
|
|
401
|
+
/* @__PURE__ */ import_react7.default.createElement(import_react_native6.View, { style: styles.thumbContainer }, /* @__PURE__ */ import_react7.default.createElement(
|
|
402
|
+
import_react_native6.Animated.View,
|
|
385
403
|
{
|
|
386
404
|
style: [
|
|
387
405
|
styles.thumb,
|
|
@@ -393,8 +411,8 @@ var Switch = ({
|
|
|
393
411
|
}
|
|
394
412
|
))
|
|
395
413
|
),
|
|
396
|
-
label && /* @__PURE__ */
|
|
397
|
-
|
|
414
|
+
label && /* @__PURE__ */ import_react7.default.createElement(
|
|
415
|
+
import_react_native6.Text,
|
|
398
416
|
{
|
|
399
417
|
style: [
|
|
400
418
|
styles.label,
|
package/dist/switch/index.js
CHANGED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/components/typography/index.ts
|
|
31
|
+
var typography_exports = {};
|
|
32
|
+
__export(typography_exports, {
|
|
33
|
+
Typography: () => Typography
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(typography_exports);
|
|
36
|
+
|
|
37
|
+
// src/components/typography/typography.tsx
|
|
38
|
+
var import_react7 = __toESM(require("react"), 1);
|
|
39
|
+
var import_react_native5 = require("react-native");
|
|
40
|
+
|
|
41
|
+
// src/components/typography/typography.style.ts
|
|
42
|
+
var import_react_native = require("react-native");
|
|
43
|
+
var styles = import_react_native.StyleSheet.create({
|
|
44
|
+
text: {
|
|
45
|
+
includeFontPadding: false
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// src/components/typography/typography.hook.ts
|
|
50
|
+
var import_react6 = require("react");
|
|
51
|
+
|
|
52
|
+
// src/core/theme-context.tsx
|
|
53
|
+
var import_react4 = __toESM(require("react"), 1);
|
|
54
|
+
var import_react_native3 = require("react-native");
|
|
55
|
+
var import_theme = require("@xaui/core/theme");
|
|
56
|
+
var import_palette = require("@xaui/core/palette");
|
|
57
|
+
|
|
58
|
+
// src/core/portal/portal.tsx
|
|
59
|
+
var import_react2 = require("react");
|
|
60
|
+
|
|
61
|
+
// src/core/portal/portal-context.ts
|
|
62
|
+
var import_react = require("react");
|
|
63
|
+
var PortalContext = (0, import_react.createContext)(null);
|
|
64
|
+
|
|
65
|
+
// src/core/portal/portal-host.tsx
|
|
66
|
+
var import_react3 = __toESM(require("react"), 1);
|
|
67
|
+
var import_react_native2 = require("react-native");
|
|
68
|
+
var hostStyles = import_react_native2.StyleSheet.create({
|
|
69
|
+
container: {
|
|
70
|
+
flex: 1
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// src/core/theme-context.tsx
|
|
75
|
+
var XUIThemeContext = (0, import_react4.createContext)(null);
|
|
76
|
+
|
|
77
|
+
// src/core/theme-hooks.ts
|
|
78
|
+
var import_react5 = require("react");
|
|
79
|
+
var import_react_native4 = require("react-native");
|
|
80
|
+
function useXUITheme() {
|
|
81
|
+
const theme = (0, import_react5.useContext)(XUIThemeContext);
|
|
82
|
+
if (!theme) {
|
|
83
|
+
throw new Error("useXUITheme must be used within XUIProvider");
|
|
84
|
+
}
|
|
85
|
+
return theme;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// src/core/index.ts
|
|
89
|
+
var import_theme2 = require("@xaui/core/theme");
|
|
90
|
+
|
|
91
|
+
// src/components/typography/typography.hook.ts
|
|
92
|
+
var import_core2 = require("@xaui/core");
|
|
93
|
+
var knownVariants = {
|
|
94
|
+
caption: true,
|
|
95
|
+
headlineLarge: true,
|
|
96
|
+
headlineMedium: true,
|
|
97
|
+
headlineSmall: true,
|
|
98
|
+
subtitleLarge: true,
|
|
99
|
+
subtitleMedium: true,
|
|
100
|
+
subtitleSmall: true,
|
|
101
|
+
bodyLarge: true,
|
|
102
|
+
bodyMedium: true,
|
|
103
|
+
bodySmall: true
|
|
104
|
+
};
|
|
105
|
+
var isKnownVariant = (variant) => {
|
|
106
|
+
return Boolean(knownVariants[variant]);
|
|
107
|
+
};
|
|
108
|
+
var useTypographyColor = (themeColor) => {
|
|
109
|
+
const theme = useXUITheme();
|
|
110
|
+
const color = (0, import_react6.useMemo)(() => {
|
|
111
|
+
if (themeColor === "default") {
|
|
112
|
+
return theme.colors.foreground;
|
|
113
|
+
}
|
|
114
|
+
const safeThemeColor = (0, import_core2.getSafeThemeColor)(themeColor);
|
|
115
|
+
return theme.colors[safeThemeColor].main;
|
|
116
|
+
}, [theme, themeColor]);
|
|
117
|
+
return color;
|
|
118
|
+
};
|
|
119
|
+
var useTypographyVariantStyles = (variant) => {
|
|
120
|
+
const theme = useXUITheme();
|
|
121
|
+
const variantStyles = (0, import_react6.useMemo)(() => {
|
|
122
|
+
if (!isKnownVariant(variant)) {
|
|
123
|
+
return {
|
|
124
|
+
fontFamily: theme.fontFamilies.body,
|
|
125
|
+
fontSize: theme.fontSizes.md,
|
|
126
|
+
fontWeight: theme.fontWeights.normal
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
const styles2 = {
|
|
130
|
+
caption: {
|
|
131
|
+
fontFamily: theme.fontFamilies.body,
|
|
132
|
+
fontSize: theme.fontSizes.xs,
|
|
133
|
+
fontWeight: theme.fontWeights.normal
|
|
134
|
+
},
|
|
135
|
+
headlineLarge: {
|
|
136
|
+
fontFamily: theme.fontFamilies.heading,
|
|
137
|
+
fontSize: theme.fontSizes["4xl"] + 3,
|
|
138
|
+
fontWeight: theme.fontWeights.bold
|
|
139
|
+
},
|
|
140
|
+
headlineMedium: {
|
|
141
|
+
fontFamily: theme.fontFamilies.heading,
|
|
142
|
+
fontSize: theme.fontSizes["3xl"] + 3,
|
|
143
|
+
fontWeight: theme.fontWeights.bold
|
|
144
|
+
},
|
|
145
|
+
headlineSmall: {
|
|
146
|
+
fontFamily: theme.fontFamilies.heading,
|
|
147
|
+
fontSize: theme.fontSizes["2xl"] + 3,
|
|
148
|
+
fontWeight: theme.fontWeights.semibold
|
|
149
|
+
},
|
|
150
|
+
subtitleLarge: {
|
|
151
|
+
fontFamily: theme.fontFamilies.body,
|
|
152
|
+
fontSize: theme.fontSizes.md + 5,
|
|
153
|
+
fontWeight: theme.fontWeights.medium
|
|
154
|
+
},
|
|
155
|
+
subtitleMedium: {
|
|
156
|
+
fontFamily: theme.fontFamilies.body,
|
|
157
|
+
fontSize: theme.fontSizes.sm + 5,
|
|
158
|
+
fontWeight: theme.fontWeights.medium
|
|
159
|
+
},
|
|
160
|
+
subtitleSmall: {
|
|
161
|
+
fontFamily: theme.fontFamilies.body,
|
|
162
|
+
fontSize: theme.fontSizes.xs + 5,
|
|
163
|
+
fontWeight: theme.fontWeights.medium
|
|
164
|
+
},
|
|
165
|
+
bodyLarge: {
|
|
166
|
+
fontFamily: theme.fontFamilies.body,
|
|
167
|
+
fontSize: theme.fontSizes.md,
|
|
168
|
+
fontWeight: theme.fontWeights.normal
|
|
169
|
+
},
|
|
170
|
+
bodyMedium: {
|
|
171
|
+
fontFamily: theme.fontFamilies.body,
|
|
172
|
+
fontSize: theme.fontSizes.sm,
|
|
173
|
+
fontWeight: theme.fontWeights.normal
|
|
174
|
+
},
|
|
175
|
+
bodySmall: {
|
|
176
|
+
fontFamily: theme.fontFamilies.body,
|
|
177
|
+
fontSize: theme.fontSizes.xs,
|
|
178
|
+
fontWeight: theme.fontWeights.normal
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
return styles2[variant];
|
|
182
|
+
}, [theme, variant]);
|
|
183
|
+
return variantStyles;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
// src/components/typography/typography.tsx
|
|
187
|
+
var Typography = ({
|
|
188
|
+
children,
|
|
189
|
+
align,
|
|
190
|
+
themeColor = "default",
|
|
191
|
+
variant = "bodyMedium",
|
|
192
|
+
maxLines,
|
|
193
|
+
overflow = "clip",
|
|
194
|
+
style
|
|
195
|
+
}) => {
|
|
196
|
+
const color = useTypographyColor(themeColor);
|
|
197
|
+
const variantStyles = useTypographyVariantStyles(variant);
|
|
198
|
+
const colorStyle = { color };
|
|
199
|
+
const ellipsizeMode = (0, import_react7.useMemo)(() => {
|
|
200
|
+
if (!maxLines) return void 0;
|
|
201
|
+
if (overflow === "clip") return "clip";
|
|
202
|
+
return "tail";
|
|
203
|
+
}, [maxLines, overflow]);
|
|
204
|
+
return /* @__PURE__ */ import_react7.default.createElement(
|
|
205
|
+
import_react_native5.Text,
|
|
206
|
+
{
|
|
207
|
+
numberOfLines: maxLines,
|
|
208
|
+
ellipsizeMode,
|
|
209
|
+
style: [
|
|
210
|
+
styles.text,
|
|
211
|
+
variantStyles,
|
|
212
|
+
align && { textAlign: align },
|
|
213
|
+
colorStyle,
|
|
214
|
+
style
|
|
215
|
+
]
|
|
216
|
+
},
|
|
217
|
+
children
|
|
218
|
+
);
|
|
219
|
+
};
|
|
220
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
221
|
+
0 && (module.exports = {
|
|
222
|
+
Typography
|
|
223
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { StyleProp, TextStyle } from 'react-native';
|
|
3
|
+
import { T as ThemeColor } from '../index-BOw6tbkc.cjs';
|
|
4
|
+
|
|
5
|
+
type TypographyAlign = 'center' | 'justify' | 'left' | 'right';
|
|
6
|
+
type TypographyVariant = 'caption' | 'headlineLarge' | 'headlineMedium' | 'headlineSmall' | 'subtitleLarge' | 'subtitleMedium' | 'subtitleSmall' | 'bodyLarge' | 'bodyMedium' | 'bodySmall' | string;
|
|
7
|
+
type TypographyProps = {
|
|
8
|
+
/**
|
|
9
|
+
* The content to display inside the typography component.
|
|
10
|
+
*/
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* The text alignment.
|
|
14
|
+
*/
|
|
15
|
+
align?: TypographyAlign;
|
|
16
|
+
/**
|
|
17
|
+
* The theme color for the text.
|
|
18
|
+
* @default 'default'
|
|
19
|
+
*/
|
|
20
|
+
themeColor?: ThemeColor;
|
|
21
|
+
/**
|
|
22
|
+
* The typography variant.
|
|
23
|
+
* @default 'bodyMedium'
|
|
24
|
+
*/
|
|
25
|
+
variant?: TypographyVariant;
|
|
26
|
+
/**
|
|
27
|
+
* Maximum number of lines to display.
|
|
28
|
+
*/
|
|
29
|
+
maxLines?: number;
|
|
30
|
+
/**
|
|
31
|
+
* How to handle text overflow when maxLines is set.
|
|
32
|
+
* @default 'clip'
|
|
33
|
+
*/
|
|
34
|
+
overflow?: 'clip' | 'ellipsis';
|
|
35
|
+
/**
|
|
36
|
+
* Custom styles for the text.
|
|
37
|
+
*/
|
|
38
|
+
style?: StyleProp<TextStyle>;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
declare const Typography: React.FC<TypographyProps>;
|
|
42
|
+
|
|
43
|
+
export { Typography, type TypographyAlign, type TypographyProps, type TypographyVariant };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { StyleProp, TextStyle } from 'react-native';
|
|
3
|
+
import { T as ThemeColor } from '../index-BOw6tbkc.js';
|
|
4
|
+
|
|
5
|
+
type TypographyAlign = 'center' | 'justify' | 'left' | 'right';
|
|
6
|
+
type TypographyVariant = 'caption' | 'headlineLarge' | 'headlineMedium' | 'headlineSmall' | 'subtitleLarge' | 'subtitleMedium' | 'subtitleSmall' | 'bodyLarge' | 'bodyMedium' | 'bodySmall' | string;
|
|
7
|
+
type TypographyProps = {
|
|
8
|
+
/**
|
|
9
|
+
* The content to display inside the typography component.
|
|
10
|
+
*/
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* The text alignment.
|
|
14
|
+
*/
|
|
15
|
+
align?: TypographyAlign;
|
|
16
|
+
/**
|
|
17
|
+
* The theme color for the text.
|
|
18
|
+
* @default 'default'
|
|
19
|
+
*/
|
|
20
|
+
themeColor?: ThemeColor;
|
|
21
|
+
/**
|
|
22
|
+
* The typography variant.
|
|
23
|
+
* @default 'bodyMedium'
|
|
24
|
+
*/
|
|
25
|
+
variant?: TypographyVariant;
|
|
26
|
+
/**
|
|
27
|
+
* Maximum number of lines to display.
|
|
28
|
+
*/
|
|
29
|
+
maxLines?: number;
|
|
30
|
+
/**
|
|
31
|
+
* How to handle text overflow when maxLines is set.
|
|
32
|
+
* @default 'clip'
|
|
33
|
+
*/
|
|
34
|
+
overflow?: 'clip' | 'ellipsis';
|
|
35
|
+
/**
|
|
36
|
+
* Custom styles for the text.
|
|
37
|
+
*/
|
|
38
|
+
style?: StyleProp<TextStyle>;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
declare const Typography: React.FC<TypographyProps>;
|
|
42
|
+
|
|
43
|
+
export { Typography, type TypographyAlign, type TypographyProps, type TypographyVariant };
|
package/dist/view/index.cjs
CHANGED
|
@@ -169,8 +169,10 @@ var Padding = ({
|
|
|
169
169
|
right,
|
|
170
170
|
bottom,
|
|
171
171
|
left,
|
|
172
|
+
fullWidth,
|
|
172
173
|
style
|
|
173
174
|
}) => {
|
|
175
|
+
const fullWidthStyle = fullWidth ? { flexShrink: 1, flexBasis: "auto", width: "100%" } : void 0;
|
|
174
176
|
return /* @__PURE__ */ import_react4.default.createElement(
|
|
175
177
|
import_react_native4.View,
|
|
176
178
|
{
|
|
@@ -184,6 +186,7 @@ var Padding = ({
|
|
|
184
186
|
paddingBottom: bottom,
|
|
185
187
|
paddingLeft: left
|
|
186
188
|
},
|
|
189
|
+
fullWidthStyle,
|
|
187
190
|
style
|
|
188
191
|
]
|
|
189
192
|
},
|
|
@@ -197,21 +200,23 @@ var import_react5 = __toESM(require("react"), 1);
|
|
|
197
200
|
var import_react_native5 = require("react-native");
|
|
198
201
|
var Margin = ({
|
|
199
202
|
children,
|
|
200
|
-
|
|
203
|
+
all,
|
|
201
204
|
horizontal,
|
|
202
205
|
vertical,
|
|
203
206
|
top,
|
|
204
207
|
right,
|
|
205
208
|
bottom,
|
|
206
209
|
left,
|
|
210
|
+
fullWidth,
|
|
207
211
|
style
|
|
208
212
|
}) => {
|
|
213
|
+
const fullWidthStyle = fullWidth ? { flexShrink: 1, flexBasis: "auto", width: "100%" } : void 0;
|
|
209
214
|
return /* @__PURE__ */ import_react5.default.createElement(
|
|
210
215
|
import_react_native5.View,
|
|
211
216
|
{
|
|
212
217
|
style: [
|
|
213
218
|
{
|
|
214
|
-
margin:
|
|
219
|
+
margin: all,
|
|
215
220
|
marginHorizontal: horizontal,
|
|
216
221
|
marginVertical: vertical,
|
|
217
222
|
marginTop: top,
|
|
@@ -219,6 +224,7 @@ var Margin = ({
|
|
|
219
224
|
marginBottom: bottom,
|
|
220
225
|
marginLeft: left
|
|
221
226
|
},
|
|
227
|
+
fullWidthStyle,
|
|
222
228
|
style
|
|
223
229
|
]
|
|
224
230
|
},
|
package/dist/view/index.d.cts
CHANGED
|
@@ -90,6 +90,11 @@ type PaddingProps = {
|
|
|
90
90
|
* Left padding.
|
|
91
91
|
*/
|
|
92
92
|
left?: number;
|
|
93
|
+
/**
|
|
94
|
+
* Whether the padding container should take the full width of its parent.
|
|
95
|
+
* @default false
|
|
96
|
+
*/
|
|
97
|
+
fullWidth?: boolean;
|
|
93
98
|
/**
|
|
94
99
|
* Custom style for the padding container.
|
|
95
100
|
*/
|
|
@@ -106,7 +111,7 @@ type MarginProps = {
|
|
|
106
111
|
/**
|
|
107
112
|
* Margin on all sides.
|
|
108
113
|
*/
|
|
109
|
-
|
|
114
|
+
all?: number;
|
|
110
115
|
/**
|
|
111
116
|
* Horizontal margin.
|
|
112
117
|
*/
|
|
@@ -131,6 +136,11 @@ type MarginProps = {
|
|
|
131
136
|
* Left margin.
|
|
132
137
|
*/
|
|
133
138
|
left?: number;
|
|
139
|
+
/**
|
|
140
|
+
* Whether the margin container should take the full width of its parent.
|
|
141
|
+
* @default false
|
|
142
|
+
*/
|
|
143
|
+
fullWidth?: boolean;
|
|
134
144
|
/**
|
|
135
145
|
* Custom style for the margin container.
|
|
136
146
|
*/
|
package/dist/view/index.d.ts
CHANGED
|
@@ -90,6 +90,11 @@ type PaddingProps = {
|
|
|
90
90
|
* Left padding.
|
|
91
91
|
*/
|
|
92
92
|
left?: number;
|
|
93
|
+
/**
|
|
94
|
+
* Whether the padding container should take the full width of its parent.
|
|
95
|
+
* @default false
|
|
96
|
+
*/
|
|
97
|
+
fullWidth?: boolean;
|
|
93
98
|
/**
|
|
94
99
|
* Custom style for the padding container.
|
|
95
100
|
*/
|
|
@@ -106,7 +111,7 @@ type MarginProps = {
|
|
|
106
111
|
/**
|
|
107
112
|
* Margin on all sides.
|
|
108
113
|
*/
|
|
109
|
-
|
|
114
|
+
all?: number;
|
|
110
115
|
/**
|
|
111
116
|
* Horizontal margin.
|
|
112
117
|
*/
|
|
@@ -131,6 +136,11 @@ type MarginProps = {
|
|
|
131
136
|
* Left margin.
|
|
132
137
|
*/
|
|
133
138
|
left?: number;
|
|
139
|
+
/**
|
|
140
|
+
* Whether the margin container should take the full width of its parent.
|
|
141
|
+
* @default false
|
|
142
|
+
*/
|
|
143
|
+
fullWidth?: boolean;
|
|
134
144
|
/**
|
|
135
145
|
* Custom style for the margin container.
|
|
136
146
|
*/
|