@onlynative/components 0.0.0-alpha.1 → 0.0.0-alpha.2
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/LICENSE +21 -0
- package/dist/appbar/index.js +51 -47
- package/dist/avatar/index.js +13 -20
- package/dist/button/index.js +19 -20
- package/dist/card/index.js +17 -12
- package/dist/checkbox/index.js +17 -21
- package/dist/chip/index.js +21 -22
- package/dist/icon-button/index.js +13 -18
- package/dist/index.js +45 -39
- package/dist/keyboard-avoiding-wrapper/index.js +2 -6
- package/dist/layout/index.js +3 -3
- package/dist/list/index.js +27 -29
- package/dist/radio/index.js +14 -12
- package/dist/switch/index.js +17 -21
- package/dist/text-field/index.js +28 -32
- package/dist/typography/index.js +1 -1
- package/llms.txt +2 -2
- package/package.json +27 -27
package/dist/list/index.js
CHANGED
|
@@ -27,17 +27,11 @@ __export(list_exports, {
|
|
|
27
27
|
module.exports = __toCommonJS(list_exports);
|
|
28
28
|
|
|
29
29
|
// src/list/List.tsx
|
|
30
|
-
var import_react = require("react");
|
|
31
|
-
var import_react_native5 = require("react-native");
|
|
32
30
|
var import_core = require("@onlynative/core");
|
|
33
|
-
|
|
34
|
-
// src/list/styles.ts
|
|
35
|
-
var import_react_native4 = require("react-native");
|
|
36
|
-
|
|
37
|
-
// ../utils/dist/index.mjs
|
|
38
|
-
var import_react_native = require("react-native");
|
|
39
|
-
var import_react_native2 = require("react-native");
|
|
31
|
+
var import_react = require("react");
|
|
40
32
|
var import_react_native3 = require("react-native");
|
|
33
|
+
|
|
34
|
+
// ../utils/src/color.ts
|
|
41
35
|
function parseHexColor(color) {
|
|
42
36
|
const normalized = color.replace("#", "");
|
|
43
37
|
if (normalized.length !== 6 && normalized.length !== 8) {
|
|
@@ -80,6 +74,9 @@ function blendColor(base, overlay, overlayAlpha) {
|
|
|
80
74
|
);
|
|
81
75
|
return `rgb(${r}, ${g}, ${b})`;
|
|
82
76
|
}
|
|
77
|
+
|
|
78
|
+
// ../utils/src/pressable.ts
|
|
79
|
+
var import_react_native = require("react-native");
|
|
83
80
|
function resolvePressableStyle(base, hovered, pressed, disabled, isDisabled, style) {
|
|
84
81
|
if (typeof style === "function") {
|
|
85
82
|
return (state) => [
|
|
@@ -100,6 +97,7 @@ function resolvePressableStyle(base, hovered, pressed, disabled, isDisabled, sty
|
|
|
100
97
|
}
|
|
101
98
|
|
|
102
99
|
// src/list/styles.ts
|
|
100
|
+
var import_react_native2 = require("react-native");
|
|
103
101
|
var ITEM_PADDING_VERTICAL = 12;
|
|
104
102
|
var INSET_START = 56;
|
|
105
103
|
var MIN_HEIGHT = {
|
|
@@ -108,7 +106,7 @@ var MIN_HEIGHT = {
|
|
|
108
106
|
3: 88
|
|
109
107
|
};
|
|
110
108
|
function createListStyles(theme) {
|
|
111
|
-
return
|
|
109
|
+
return import_react_native2.StyleSheet.create({
|
|
112
110
|
container: {
|
|
113
111
|
paddingVertical: theme.spacing.sm
|
|
114
112
|
}
|
|
@@ -145,7 +143,7 @@ function getItemColors(theme, containerColor) {
|
|
|
145
143
|
}
|
|
146
144
|
function createListItemStyles(theme, lines, containerColor) {
|
|
147
145
|
const colors = getItemColors(theme, containerColor);
|
|
148
|
-
return
|
|
146
|
+
return import_react_native2.StyleSheet.create({
|
|
149
147
|
container: {
|
|
150
148
|
flexDirection: "row",
|
|
151
149
|
alignItems: lines === 3 ? "flex-start" : "center",
|
|
@@ -200,7 +198,7 @@ function createListItemStyles(theme, lines, containerColor) {
|
|
|
200
198
|
});
|
|
201
199
|
}
|
|
202
200
|
function createDividerStyles(theme, inset) {
|
|
203
|
-
return
|
|
201
|
+
return import_react_native2.StyleSheet.create({
|
|
204
202
|
divider: {
|
|
205
203
|
height: 1,
|
|
206
204
|
backgroundColor: theme.colors.outlineVariant,
|
|
@@ -214,13 +212,13 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
214
212
|
function List({ children, style, ...props }) {
|
|
215
213
|
const theme = (0, import_core.useTheme)();
|
|
216
214
|
const styles = (0, import_react.useMemo)(() => createListStyles(theme), [theme]);
|
|
217
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
215
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native3.View, { ...props, style: [styles.container, style], children });
|
|
218
216
|
}
|
|
219
217
|
|
|
220
218
|
// src/list/ListItem.tsx
|
|
221
|
-
var import_react2 = require("react");
|
|
222
|
-
var import_react_native6 = require("react-native");
|
|
223
219
|
var import_core2 = require("@onlynative/core");
|
|
220
|
+
var import_react2 = require("react");
|
|
221
|
+
var import_react_native4 = require("react-native");
|
|
224
222
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
225
223
|
function getLines(supportingText, overlineText, supportingTextNumberOfLines) {
|
|
226
224
|
if (supportingText && overlineText || supportingText && supportingTextNumberOfLines && supportingTextNumberOfLines > 1) {
|
|
@@ -256,12 +254,12 @@ function ListItem({
|
|
|
256
254
|
[theme, lines, containerColor]
|
|
257
255
|
);
|
|
258
256
|
const content = /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
259
|
-
leadingContent != null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
260
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
261
|
-
overlineText != null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
262
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
257
|
+
leadingContent != null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native4.View, { style: styles.leadingContent, children: leadingContent }),
|
|
258
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native4.View, { style: styles.textBlock, children: [
|
|
259
|
+
overlineText != null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native4.Text, { style: styles.overlineText, numberOfLines: 1, children: overlineText }),
|
|
260
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native4.Text, { style: styles.headlineText, numberOfLines: 1, children: headlineText }),
|
|
263
261
|
supportingText != null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
264
|
-
|
|
262
|
+
import_react_native4.Text,
|
|
265
263
|
{
|
|
266
264
|
style: styles.supportingText,
|
|
267
265
|
numberOfLines: supportingTextNumberOfLines,
|
|
@@ -269,21 +267,21 @@ function ListItem({
|
|
|
269
267
|
}
|
|
270
268
|
)
|
|
271
269
|
] }),
|
|
272
|
-
(trailingContent != null || trailingSupportingText != null) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
273
|
-
trailingSupportingText != null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
270
|
+
(trailingContent != null || trailingSupportingText != null) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native4.View, { style: styles.trailingBlock, children: [
|
|
271
|
+
trailingSupportingText != null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native4.Text, { style: styles.trailingSupportingText, numberOfLines: 1, children: trailingSupportingText }),
|
|
274
272
|
trailingContent
|
|
275
273
|
] })
|
|
276
274
|
] });
|
|
277
275
|
if (!isInteractive) {
|
|
278
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native4.View, { ...props, style: [styles.container, style], children: content });
|
|
279
277
|
}
|
|
280
278
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
281
|
-
|
|
279
|
+
import_react_native4.Pressable,
|
|
282
280
|
{
|
|
283
281
|
...props,
|
|
284
282
|
role: "button",
|
|
285
283
|
accessibilityState: { disabled: isDisabled },
|
|
286
|
-
hitSlop:
|
|
284
|
+
hitSlop: import_react_native4.Platform.OS === "web" ? void 0 : 4,
|
|
287
285
|
disabled: isDisabled,
|
|
288
286
|
onPress,
|
|
289
287
|
style: resolvePressableStyle(
|
|
@@ -294,15 +292,15 @@ function ListItem({
|
|
|
294
292
|
isDisabled,
|
|
295
293
|
style
|
|
296
294
|
),
|
|
297
|
-
children: isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
295
|
+
children: isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native4.View, { style: styles.disabledContentWrapper, children: content }) : content
|
|
298
296
|
}
|
|
299
297
|
);
|
|
300
298
|
}
|
|
301
299
|
|
|
302
300
|
// src/list/ListDivider.tsx
|
|
303
|
-
var import_react3 = require("react");
|
|
304
|
-
var import_react_native7 = require("react-native");
|
|
305
301
|
var import_core3 = require("@onlynative/core");
|
|
302
|
+
var import_react3 = require("react");
|
|
303
|
+
var import_react_native5 = require("react-native");
|
|
306
304
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
307
305
|
function ListDivider({
|
|
308
306
|
inset = false,
|
|
@@ -314,7 +312,7 @@ function ListDivider({
|
|
|
314
312
|
() => createDividerStyles(theme, inset),
|
|
315
313
|
[theme, inset]
|
|
316
314
|
);
|
|
317
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native5.View, { ...props, style: [styles.divider, style] });
|
|
318
316
|
}
|
|
319
317
|
// Annotate the CommonJS export names for ESM import in node:
|
|
320
318
|
0 && (module.exports = {
|
package/dist/radio/index.js
CHANGED
|
@@ -25,14 +25,9 @@ __export(radio_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(radio_exports);
|
|
26
26
|
|
|
27
27
|
// src/radio/Radio.tsx
|
|
28
|
-
var import_react = require("react");
|
|
29
|
-
var import_react_native5 = require("react-native");
|
|
30
28
|
var import_core = require("@onlynative/core");
|
|
31
29
|
|
|
32
|
-
// ../utils/
|
|
33
|
-
var import_react_native = require("react-native");
|
|
34
|
-
var import_react_native2 = require("react-native");
|
|
35
|
-
var import_react_native3 = require("react-native");
|
|
30
|
+
// ../utils/src/color.ts
|
|
36
31
|
function parseHexColor(color) {
|
|
37
32
|
const normalized = color.replace("#", "");
|
|
38
33
|
if (normalized.length !== 6 && normalized.length !== 8) {
|
|
@@ -57,6 +52,9 @@ function alphaColor(color, alpha) {
|
|
|
57
52
|
}
|
|
58
53
|
return `rgba(${channels.r}, ${channels.g}, ${channels.b}, ${boundedAlpha})`;
|
|
59
54
|
}
|
|
55
|
+
|
|
56
|
+
// ../utils/src/pressable.ts
|
|
57
|
+
var import_react_native = require("react-native");
|
|
60
58
|
function resolvePressableStyle(base, hovered, pressed, disabled, isDisabled, style) {
|
|
61
59
|
if (typeof style === "function") {
|
|
62
60
|
return (state) => [
|
|
@@ -76,8 +74,12 @@ function resolvePressableStyle(base, hovered, pressed, disabled, isDisabled, sty
|
|
|
76
74
|
];
|
|
77
75
|
}
|
|
78
76
|
|
|
77
|
+
// src/radio/Radio.tsx
|
|
78
|
+
var import_react = require("react");
|
|
79
|
+
var import_react_native3 = require("react-native");
|
|
80
|
+
|
|
79
81
|
// src/radio/styles.ts
|
|
80
|
-
var
|
|
82
|
+
var import_react_native2 = require("react-native");
|
|
81
83
|
function getColors(theme, selected) {
|
|
82
84
|
const disabledOnSurface38 = alphaColor(theme.colors.onSurface, 0.38);
|
|
83
85
|
if (selected) {
|
|
@@ -141,7 +143,7 @@ function createStyles(theme, selected, containerColor, contentColor) {
|
|
|
141
143
|
const outerSize = 20;
|
|
142
144
|
const innerSize = 10;
|
|
143
145
|
const touchTarget = 48;
|
|
144
|
-
return
|
|
146
|
+
return import_react_native2.StyleSheet.create({
|
|
145
147
|
container: {
|
|
146
148
|
width: touchTarget,
|
|
147
149
|
height: touchTarget,
|
|
@@ -208,7 +210,7 @@ function Radio({
|
|
|
208
210
|
}
|
|
209
211
|
};
|
|
210
212
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
211
|
-
|
|
213
|
+
import_react_native3.Pressable,
|
|
212
214
|
{
|
|
213
215
|
...props,
|
|
214
216
|
accessibilityRole: "radio",
|
|
@@ -216,7 +218,7 @@ function Radio({
|
|
|
216
218
|
disabled: isDisabled,
|
|
217
219
|
checked: isSelected
|
|
218
220
|
},
|
|
219
|
-
hitSlop:
|
|
221
|
+
hitSlop: import_react_native3.Platform.OS === "web" ? void 0 : 4,
|
|
220
222
|
disabled: isDisabled,
|
|
221
223
|
onPress: handlePress,
|
|
222
224
|
style: resolvePressableStyle(
|
|
@@ -228,11 +230,11 @@ function Radio({
|
|
|
228
230
|
style
|
|
229
231
|
),
|
|
230
232
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
231
|
-
|
|
233
|
+
import_react_native3.View,
|
|
232
234
|
{
|
|
233
235
|
style: [styles.outer, isDisabled ? styles.disabledOuter : void 0],
|
|
234
236
|
children: isSelected ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
235
|
-
|
|
237
|
+
import_react_native3.View,
|
|
236
238
|
{
|
|
237
239
|
style: [
|
|
238
240
|
styles.inner,
|
package/dist/switch/index.js
CHANGED
|
@@ -25,22 +25,9 @@ __export(switch_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(switch_exports);
|
|
26
26
|
|
|
27
27
|
// src/switch/Switch.tsx
|
|
28
|
-
var import_react = require("react");
|
|
29
|
-
var import_react_native5 = require("react-native");
|
|
30
28
|
var import_core = require("@onlynative/core");
|
|
31
29
|
|
|
32
|
-
// ../utils/
|
|
33
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
34
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
35
|
-
}) : x)(function(x) {
|
|
36
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
37
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
// ../utils/dist/index.mjs
|
|
41
|
-
var import_react_native = require("react-native");
|
|
42
|
-
var import_react_native2 = require("react-native");
|
|
43
|
-
var import_react_native3 = require("react-native");
|
|
30
|
+
// ../utils/src/color.ts
|
|
44
31
|
function parseHexColor(color) {
|
|
45
32
|
const normalized = color.replace("#", "");
|
|
46
33
|
if (normalized.length !== 6 && normalized.length !== 8) {
|
|
@@ -83,13 +70,15 @@ function blendColor(base, overlay, overlayAlpha) {
|
|
|
83
70
|
);
|
|
84
71
|
return `rgb(${r}, ${g}, ${b})`;
|
|
85
72
|
}
|
|
73
|
+
|
|
74
|
+
// ../utils/src/icon.ts
|
|
86
75
|
var _MCIcons = null;
|
|
87
76
|
var _resolved = false;
|
|
88
77
|
function getMaterialCommunityIcons() {
|
|
89
78
|
if (!_resolved) {
|
|
90
79
|
_resolved = true;
|
|
91
80
|
try {
|
|
92
|
-
const mod =
|
|
81
|
+
const mod = require("@expo/vector-icons/MaterialCommunityIcons");
|
|
93
82
|
_MCIcons = mod.default || mod;
|
|
94
83
|
} catch {
|
|
95
84
|
_MCIcons = null;
|
|
@@ -102,6 +91,9 @@ function getMaterialCommunityIcons() {
|
|
|
102
91
|
}
|
|
103
92
|
return _MCIcons;
|
|
104
93
|
}
|
|
94
|
+
|
|
95
|
+
// ../utils/src/pressable.ts
|
|
96
|
+
var import_react_native = require("react-native");
|
|
105
97
|
function resolvePressableStyle(base, hovered, pressed, disabled, isDisabled, style) {
|
|
106
98
|
if (typeof style === "function") {
|
|
107
99
|
return (state) => [
|
|
@@ -121,12 +113,16 @@ function resolvePressableStyle(base, hovered, pressed, disabled, isDisabled, sty
|
|
|
121
113
|
];
|
|
122
114
|
}
|
|
123
115
|
function resolveColorFromStyle(...styles) {
|
|
124
|
-
const flattened =
|
|
116
|
+
const flattened = import_react_native.StyleSheet.flatten(styles);
|
|
125
117
|
return typeof (flattened == null ? void 0 : flattened.color) === "string" ? flattened.color : void 0;
|
|
126
118
|
}
|
|
127
119
|
|
|
120
|
+
// src/switch/Switch.tsx
|
|
121
|
+
var import_react = require("react");
|
|
122
|
+
var import_react_native3 = require("react-native");
|
|
123
|
+
|
|
128
124
|
// src/switch/styles.ts
|
|
129
|
-
var
|
|
125
|
+
var import_react_native2 = require("react-native");
|
|
130
126
|
function getColors(theme, selected) {
|
|
131
127
|
const disabledOnSurface12 = alphaColor(theme.colors.onSurface, 0.12);
|
|
132
128
|
const disabledOnSurface38 = alphaColor(theme.colors.onSurface, 0.38);
|
|
@@ -214,7 +210,7 @@ function createStyles(theme, selected, hasIcon, containerColor, contentColor) {
|
|
|
214
210
|
const trackHeight = 32;
|
|
215
211
|
const trackPadding = 4;
|
|
216
212
|
const thumbOffset = selected ? trackWidth - trackPadding - thumbSize : trackPadding;
|
|
217
|
-
return
|
|
213
|
+
return import_react_native2.StyleSheet.create({
|
|
218
214
|
track: {
|
|
219
215
|
width: trackWidth,
|
|
220
216
|
height: trackHeight,
|
|
@@ -295,7 +291,7 @@ function Switch({
|
|
|
295
291
|
const MaterialCommunityIcons = iconName ? getMaterialCommunityIcons() : null;
|
|
296
292
|
const iconSize = 16;
|
|
297
293
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
298
|
-
|
|
294
|
+
import_react_native3.Pressable,
|
|
299
295
|
{
|
|
300
296
|
...props,
|
|
301
297
|
accessibilityRole: "switch",
|
|
@@ -303,7 +299,7 @@ function Switch({
|
|
|
303
299
|
disabled: isDisabled,
|
|
304
300
|
checked: isSelected
|
|
305
301
|
},
|
|
306
|
-
hitSlop:
|
|
302
|
+
hitSlop: import_react_native3.Platform.OS === "web" ? void 0 : 4,
|
|
307
303
|
disabled: isDisabled,
|
|
308
304
|
onPress: handlePress,
|
|
309
305
|
style: resolvePressableStyle(
|
|
@@ -315,7 +311,7 @@ function Switch({
|
|
|
315
311
|
style
|
|
316
312
|
),
|
|
317
313
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
318
|
-
|
|
314
|
+
import_react_native3.View,
|
|
319
315
|
{
|
|
320
316
|
style: [styles.thumb, isDisabled ? styles.disabledThumb : void 0],
|
|
321
317
|
children: iconName ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
package/dist/text-field/index.js
CHANGED
|
@@ -25,22 +25,9 @@ __export(text_field_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(text_field_exports);
|
|
26
26
|
|
|
27
27
|
// src/text-field/TextField.tsx
|
|
28
|
-
var import_react = require("react");
|
|
29
|
-
var import_react_native5 = require("react-native");
|
|
30
28
|
var import_core = require("@onlynative/core");
|
|
31
29
|
|
|
32
|
-
// ../utils/
|
|
33
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
34
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
35
|
-
}) : x)(function(x) {
|
|
36
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
37
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
// ../utils/dist/index.mjs
|
|
41
|
-
var import_react_native = require("react-native");
|
|
42
|
-
var import_react_native2 = require("react-native");
|
|
43
|
-
var import_react_native3 = require("react-native");
|
|
30
|
+
// ../utils/src/color.ts
|
|
44
31
|
function parseHexColor(color) {
|
|
45
32
|
const normalized = color.replace("#", "");
|
|
46
33
|
if (normalized.length !== 6 && normalized.length !== 8) {
|
|
@@ -65,13 +52,15 @@ function alphaColor(color, alpha) {
|
|
|
65
52
|
}
|
|
66
53
|
return `rgba(${channels.r}, ${channels.g}, ${channels.b}, ${boundedAlpha})`;
|
|
67
54
|
}
|
|
55
|
+
|
|
56
|
+
// ../utils/src/icon.ts
|
|
68
57
|
var _MCIcons = null;
|
|
69
58
|
var _resolved = false;
|
|
70
59
|
function getMaterialCommunityIcons() {
|
|
71
60
|
if (!_resolved) {
|
|
72
61
|
_resolved = true;
|
|
73
62
|
try {
|
|
74
|
-
const mod =
|
|
63
|
+
const mod = require("@expo/vector-icons/MaterialCommunityIcons");
|
|
75
64
|
_MCIcons = mod.default || mod;
|
|
76
65
|
} catch {
|
|
77
66
|
_MCIcons = null;
|
|
@@ -84,12 +73,19 @@ function getMaterialCommunityIcons() {
|
|
|
84
73
|
}
|
|
85
74
|
return _MCIcons;
|
|
86
75
|
}
|
|
76
|
+
|
|
77
|
+
// ../utils/src/rtl.ts
|
|
78
|
+
var import_react_native = require("react-native");
|
|
87
79
|
function transformOrigin(vertical = "top") {
|
|
88
|
-
return
|
|
80
|
+
return import_react_native.I18nManager.isRTL ? `right ${vertical}` : `left ${vertical}`;
|
|
89
81
|
}
|
|
90
82
|
|
|
83
|
+
// src/text-field/TextField.tsx
|
|
84
|
+
var import_react = require("react");
|
|
85
|
+
var import_react_native3 = require("react-native");
|
|
86
|
+
|
|
91
87
|
// src/text-field/styles.ts
|
|
92
|
-
var
|
|
88
|
+
var import_react_native2 = require("react-native");
|
|
93
89
|
var CONTAINER_HEIGHT = 56;
|
|
94
90
|
var ICON_SIZE = 24;
|
|
95
91
|
var LABEL_FLOATED_LINE_HEIGHT = 16;
|
|
@@ -148,7 +144,7 @@ function createStyles(theme, variant) {
|
|
|
148
144
|
const isFilled = variant === "filled";
|
|
149
145
|
return {
|
|
150
146
|
colors,
|
|
151
|
-
styles:
|
|
147
|
+
styles: import_react_native2.StyleSheet.create({
|
|
152
148
|
root: {
|
|
153
149
|
alignSelf: "stretch"
|
|
154
150
|
},
|
|
@@ -325,13 +321,13 @@ function TextField({
|
|
|
325
321
|
const isControlled = value !== void 0;
|
|
326
322
|
const hasValue = isControlled ? value !== "" : internalHasText;
|
|
327
323
|
const isLabelFloated = isFocused || hasValue;
|
|
328
|
-
const labelAnimRef = (0, import_react.useRef)(new
|
|
324
|
+
const labelAnimRef = (0, import_react.useRef)(new import_react_native3.Animated.Value(isLabelFloated ? 1 : 0));
|
|
329
325
|
const labelAnim = labelAnimRef.current;
|
|
330
326
|
(0, import_react.useEffect)(() => {
|
|
331
|
-
|
|
327
|
+
import_react_native3.Animated.timing(labelAnim, {
|
|
332
328
|
toValue: isLabelFloated ? 1 : 0,
|
|
333
329
|
duration: 150,
|
|
334
|
-
useNativeDriver:
|
|
330
|
+
useNativeDriver: import_react_native3.Platform.OS !== "web"
|
|
335
331
|
}).start();
|
|
336
332
|
}, [isLabelFloated, labelAnim]);
|
|
337
333
|
const labelScale = (0, import_react.useMemo)(() => {
|
|
@@ -409,9 +405,9 @@ function TextField({
|
|
|
409
405
|
[styles, isFocused, isError, isDisabled]
|
|
410
406
|
);
|
|
411
407
|
const displaySupportingText = isError ? errorText : supportingText;
|
|
412
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
413
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
414
|
-
leadingIcon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_native3.View, { style: [styles.root, style], children: [
|
|
409
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native3.Pressable, { onPress: handleContainerPress, disabled: isDisabled, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_native3.View, { style: containerStyle, children: [
|
|
410
|
+
leadingIcon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native3.View, { style: styles.leadingIcon, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
415
411
|
MaterialCommunityIcons,
|
|
416
412
|
{
|
|
417
413
|
name: leadingIcon,
|
|
@@ -420,14 +416,14 @@ function TextField({
|
|
|
420
416
|
}
|
|
421
417
|
) }) : null,
|
|
422
418
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
423
|
-
|
|
419
|
+
import_react_native3.View,
|
|
424
420
|
{
|
|
425
421
|
style: [
|
|
426
422
|
styles.inputWrapper,
|
|
427
423
|
label ? styles.inputWrapperWithLabel : void 0
|
|
428
424
|
],
|
|
429
425
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
430
|
-
|
|
426
|
+
import_react_native3.TextInput,
|
|
431
427
|
{
|
|
432
428
|
ref: inputRef,
|
|
433
429
|
...textInputProps,
|
|
@@ -453,14 +449,14 @@ function TextField({
|
|
|
453
449
|
}
|
|
454
450
|
),
|
|
455
451
|
trailingIcon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
456
|
-
|
|
452
|
+
import_react_native3.Pressable,
|
|
457
453
|
{
|
|
458
454
|
onPress: onTrailingIconPress,
|
|
459
455
|
disabled: isDisabled || !onTrailingIconPress,
|
|
460
456
|
accessibilityRole: "button",
|
|
461
457
|
hitSlop: 12,
|
|
462
458
|
style: styles.trailingIconPressable,
|
|
463
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
459
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native3.View, { style: styles.trailingIcon, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
464
460
|
MaterialCommunityIcons,
|
|
465
461
|
{
|
|
466
462
|
name: trailingIcon,
|
|
@@ -471,7 +467,7 @@ function TextField({
|
|
|
471
467
|
}
|
|
472
468
|
) : null,
|
|
473
469
|
label ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
474
|
-
|
|
470
|
+
import_react_native3.Animated.Text,
|
|
475
471
|
{
|
|
476
472
|
numberOfLines: 1,
|
|
477
473
|
style: [
|
|
@@ -491,10 +487,10 @@ function TextField({
|
|
|
491
487
|
children: label
|
|
492
488
|
}
|
|
493
489
|
) : null,
|
|
494
|
-
isFilled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
490
|
+
isFilled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native3.View, { style: indicatorStyle }) : null
|
|
495
491
|
] }) }),
|
|
496
|
-
displaySupportingText ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
497
|
-
|
|
492
|
+
displaySupportingText ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native3.View, { style: styles.supportingTextRow, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
493
|
+
import_react_native3.Text,
|
|
498
494
|
{
|
|
499
495
|
style: [
|
|
500
496
|
styles.supportingText,
|
package/dist/typography/index.js
CHANGED
|
@@ -25,9 +25,9 @@ __export(typography_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(typography_exports);
|
|
26
26
|
|
|
27
27
|
// src/typography/Typography.tsx
|
|
28
|
+
var import_core = require("@onlynative/core");
|
|
28
29
|
var import_react = require("react");
|
|
29
30
|
var import_react_native = require("react-native");
|
|
30
|
-
var import_core = require("@onlynative/core");
|
|
31
31
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
32
|
var HEADING_VARIANTS = /* @__PURE__ */ new Set([
|
|
33
33
|
"displayLarge",
|
package/llms.txt
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @onlynative/components — MD3 UI Components for React Native
|
|
2
2
|
|
|
3
|
-
> Version: 0.0.0-alpha.
|
|
4
|
-
> Peer deps: @onlynative/core >=0.0.0-alpha.
|
|
3
|
+
> Version: 0.0.0-alpha.2
|
|
4
|
+
> Peer deps: @onlynative/core >=0.0.0-alpha.2, react >=18, react-native >=0.72, react-native-safe-area-context >=4
|
|
5
5
|
> Optional: @expo/vector-icons >=14 (only needed for icon props)
|
|
6
6
|
|
|
7
7
|
## Usage
|
package/package.json
CHANGED
|
@@ -1,88 +1,88 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onlynative/components",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.2",
|
|
4
4
|
"description": "Material Design 3 UI components for React Native, part of OnlyNative UI.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"module": "dist/index.js",
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
10
|
-
"react-native": "
|
|
10
|
+
"react-native": "dist/index.js",
|
|
11
11
|
"source": "src/index.ts",
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
14
|
"types": "./dist/index.d.ts",
|
|
15
|
-
"react-native": "./
|
|
15
|
+
"react-native": "./dist/index.js",
|
|
16
16
|
"default": "./dist/index.js"
|
|
17
17
|
},
|
|
18
18
|
"./typography": {
|
|
19
19
|
"types": "./dist/typography/index.d.ts",
|
|
20
|
-
"react-native": "./
|
|
20
|
+
"react-native": "./dist/typography/index.js",
|
|
21
21
|
"default": "./dist/typography/index.js"
|
|
22
22
|
},
|
|
23
23
|
"./layout": {
|
|
24
24
|
"types": "./dist/layout/index.d.ts",
|
|
25
|
-
"react-native": "./
|
|
25
|
+
"react-native": "./dist/layout/index.js",
|
|
26
26
|
"default": "./dist/layout/index.js"
|
|
27
27
|
},
|
|
28
28
|
"./button": {
|
|
29
29
|
"types": "./dist/button/index.d.ts",
|
|
30
|
-
"react-native": "./
|
|
30
|
+
"react-native": "./dist/button/index.js",
|
|
31
31
|
"default": "./dist/button/index.js"
|
|
32
32
|
},
|
|
33
33
|
"./icon-button": {
|
|
34
34
|
"types": "./dist/icon-button/index.d.ts",
|
|
35
|
-
"react-native": "./
|
|
35
|
+
"react-native": "./dist/icon-button/index.js",
|
|
36
36
|
"default": "./dist/icon-button/index.js"
|
|
37
37
|
},
|
|
38
38
|
"./appbar": {
|
|
39
39
|
"types": "./dist/appbar/index.d.ts",
|
|
40
|
-
"react-native": "./
|
|
40
|
+
"react-native": "./dist/appbar/index.js",
|
|
41
41
|
"default": "./dist/appbar/index.js"
|
|
42
42
|
},
|
|
43
43
|
"./card": {
|
|
44
44
|
"types": "./dist/card/index.d.ts",
|
|
45
|
-
"react-native": "./
|
|
45
|
+
"react-native": "./dist/card/index.js",
|
|
46
46
|
"default": "./dist/card/index.js"
|
|
47
47
|
},
|
|
48
48
|
"./chip": {
|
|
49
49
|
"types": "./dist/chip/index.d.ts",
|
|
50
|
-
"react-native": "./
|
|
50
|
+
"react-native": "./dist/chip/index.js",
|
|
51
51
|
"default": "./dist/chip/index.js"
|
|
52
52
|
},
|
|
53
53
|
"./checkbox": {
|
|
54
54
|
"types": "./dist/checkbox/index.d.ts",
|
|
55
|
-
"react-native": "./
|
|
55
|
+
"react-native": "./dist/checkbox/index.js",
|
|
56
56
|
"default": "./dist/checkbox/index.js"
|
|
57
57
|
},
|
|
58
58
|
"./radio": {
|
|
59
59
|
"types": "./dist/radio/index.d.ts",
|
|
60
|
-
"react-native": "./
|
|
60
|
+
"react-native": "./dist/radio/index.js",
|
|
61
61
|
"default": "./dist/radio/index.js"
|
|
62
62
|
},
|
|
63
63
|
"./switch": {
|
|
64
64
|
"types": "./dist/switch/index.d.ts",
|
|
65
|
-
"react-native": "./
|
|
65
|
+
"react-native": "./dist/switch/index.js",
|
|
66
66
|
"default": "./dist/switch/index.js"
|
|
67
67
|
},
|
|
68
68
|
"./text-field": {
|
|
69
69
|
"types": "./dist/text-field/index.d.ts",
|
|
70
|
-
"react-native": "./
|
|
70
|
+
"react-native": "./dist/text-field/index.js",
|
|
71
71
|
"default": "./dist/text-field/index.js"
|
|
72
72
|
},
|
|
73
73
|
"./list": {
|
|
74
74
|
"types": "./dist/list/index.d.ts",
|
|
75
|
-
"react-native": "./
|
|
75
|
+
"react-native": "./dist/list/index.js",
|
|
76
76
|
"default": "./dist/list/index.js"
|
|
77
77
|
},
|
|
78
78
|
"./keyboard-avoiding-wrapper": {
|
|
79
79
|
"types": "./dist/keyboard-avoiding-wrapper/index.d.ts",
|
|
80
|
-
"react-native": "./
|
|
80
|
+
"react-native": "./dist/keyboard-avoiding-wrapper/index.js",
|
|
81
81
|
"default": "./dist/keyboard-avoiding-wrapper/index.js"
|
|
82
82
|
},
|
|
83
83
|
"./avatar": {
|
|
84
84
|
"types": "./dist/avatar/index.d.ts",
|
|
85
|
-
"react-native": "./
|
|
85
|
+
"react-native": "./dist/avatar/index.js",
|
|
86
86
|
"default": "./dist/avatar/index.js"
|
|
87
87
|
}
|
|
88
88
|
},
|
|
@@ -153,14 +153,9 @@
|
|
|
153
153
|
"md3",
|
|
154
154
|
"material-you"
|
|
155
155
|
],
|
|
156
|
-
"scripts": {
|
|
157
|
-
"build": "tsup",
|
|
158
|
-
"typecheck": "tsc --noEmit",
|
|
159
|
-
"test": "jest --passWithNoTests"
|
|
160
|
-
},
|
|
161
156
|
"peerDependencies": {
|
|
162
157
|
"@expo/vector-icons": ">=14.0.0",
|
|
163
|
-
"@onlynative/core": ">=0.0.0-alpha.
|
|
158
|
+
"@onlynative/core": ">=0.0.0-alpha.2",
|
|
164
159
|
"react": ">=18.0.0",
|
|
165
160
|
"react-native": ">=0.72.0",
|
|
166
161
|
"react-native-safe-area-context": ">=4.0.0"
|
|
@@ -172,8 +167,6 @@
|
|
|
172
167
|
},
|
|
173
168
|
"devDependencies": {
|
|
174
169
|
"@react-native/babel-preset": "^0.81.5",
|
|
175
|
-
"@onlynative/core": "workspace:*",
|
|
176
|
-
"@onlynative/utils": "workspace:*",
|
|
177
170
|
"@testing-library/react-native": "^13.3.3",
|
|
178
171
|
"@types/jest": "^29.5.14",
|
|
179
172
|
"@types/react": "^19.0.0",
|
|
@@ -182,6 +175,13 @@
|
|
|
182
175
|
"react-native": "0.81.5",
|
|
183
176
|
"react-test-renderer": "19.1.0",
|
|
184
177
|
"tsup": "^8.0.0",
|
|
185
|
-
"typescript": "^5.0.0"
|
|
178
|
+
"typescript": "^5.0.0",
|
|
179
|
+
"@onlynative/core": "0.0.0-alpha.2",
|
|
180
|
+
"@onlynative/utils": "0.1.0-alpha.3"
|
|
181
|
+
},
|
|
182
|
+
"scripts": {
|
|
183
|
+
"build": "tsup",
|
|
184
|
+
"typecheck": "tsc --noEmit",
|
|
185
|
+
"test": "jest --passWithNoTests"
|
|
186
186
|
}
|
|
187
|
-
}
|
|
187
|
+
}
|