@onlynative/components 0.0.0-alpha.3 → 0.0.0-alpha.4
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/appbar/index.js +34 -23
- package/dist/index.d.ts +0 -1
- package/dist/index.js +142 -130
- package/dist/layout/index.d.ts +2 -1
- package/dist/layout/index.js +21 -8
- package/llms.txt +2 -2
- package/package.json +6 -3
package/dist/appbar/index.js
CHANGED
|
@@ -100,8 +100,7 @@ function selectRTL(ltr, rtl) {
|
|
|
100
100
|
|
|
101
101
|
// src/appbar/AppBar.tsx
|
|
102
102
|
var import_react3 = require("react");
|
|
103
|
-
var
|
|
104
|
-
var import_react_native_safe_area_context = require("react-native-safe-area-context");
|
|
103
|
+
var import_react_native7 = require("react-native");
|
|
105
104
|
|
|
106
105
|
// src/icon-button/IconButton.tsx
|
|
107
106
|
var import_core = require("@onlynative/core");
|
|
@@ -595,10 +594,22 @@ function IconButton({
|
|
|
595
594
|
);
|
|
596
595
|
}
|
|
597
596
|
|
|
597
|
+
// src/safe-area.tsx
|
|
598
|
+
var import_react_native4 = require("react-native");
|
|
599
|
+
var SafeAreaViewComponent = import_react_native4.View;
|
|
600
|
+
try {
|
|
601
|
+
const safeArea = require("react-native-safe-area-context");
|
|
602
|
+
SafeAreaViewComponent = safeArea.SafeAreaView;
|
|
603
|
+
} catch {
|
|
604
|
+
console.warn(
|
|
605
|
+
'[@onlynative/components] "react-native-safe-area-context" is not installed. Layout and AppBar will render without safe area insets. Run `npx expo install react-native-safe-area-context` to fix this.'
|
|
606
|
+
);
|
|
607
|
+
}
|
|
608
|
+
|
|
598
609
|
// src/typography/Typography.tsx
|
|
599
610
|
var import_core2 = require("@onlynative/core");
|
|
600
611
|
var import_react2 = require("react");
|
|
601
|
-
var
|
|
612
|
+
var import_react_native5 = require("react-native");
|
|
602
613
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
603
614
|
var HEADING_VARIANTS = /* @__PURE__ */ new Set([
|
|
604
615
|
"displayLarge",
|
|
@@ -613,7 +624,7 @@ function Typography({
|
|
|
613
624
|
variant = "bodyMedium",
|
|
614
625
|
color,
|
|
615
626
|
style,
|
|
616
|
-
as: Component =
|
|
627
|
+
as: Component = import_react_native5.Text,
|
|
617
628
|
accessibilityRole,
|
|
618
629
|
...textProps
|
|
619
630
|
}) {
|
|
@@ -622,7 +633,7 @@ function Typography({
|
|
|
622
633
|
const resolvedRole = accessibilityRole != null ? accessibilityRole : HEADING_VARIANTS.has(variant) ? "header" : void 0;
|
|
623
634
|
const lineHeightFix = (0, import_react2.useMemo)(() => {
|
|
624
635
|
if (!style) return void 0;
|
|
625
|
-
const flat =
|
|
636
|
+
const flat = import_react_native5.StyleSheet.flatten(style);
|
|
626
637
|
if (!(flat == null ? void 0 : flat.fontSize) || flat.lineHeight) return void 0;
|
|
627
638
|
const ratio = typographyStyle.lineHeight / typographyStyle.fontSize;
|
|
628
639
|
return { lineHeight: Math.ceil(flat.fontSize * ratio) };
|
|
@@ -646,7 +657,7 @@ function Typography({
|
|
|
646
657
|
|
|
647
658
|
// src/appbar/styles.ts
|
|
648
659
|
var import_core3 = require("@onlynative/core");
|
|
649
|
-
var
|
|
660
|
+
var import_react_native6 = require("react-native");
|
|
650
661
|
function getColorSchemeColors(theme, colorScheme) {
|
|
651
662
|
switch (colorScheme) {
|
|
652
663
|
case "surfaceContainerLowest":
|
|
@@ -703,7 +714,7 @@ function getColorSchemeColors(theme, colorScheme) {
|
|
|
703
714
|
function createStyles2(theme, schemeColors) {
|
|
704
715
|
var _a;
|
|
705
716
|
const topAppBar = (_a = theme.topAppBar) != null ? _a : import_core3.defaultTopAppBarTokens;
|
|
706
|
-
return
|
|
717
|
+
return import_react_native6.StyleSheet.create({
|
|
707
718
|
root: {
|
|
708
719
|
backgroundColor: schemeColors.containerColor
|
|
709
720
|
},
|
|
@@ -792,7 +803,7 @@ function createStyles2(theme, schemeColors) {
|
|
|
792
803
|
// src/appbar/AppBar.tsx
|
|
793
804
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
794
805
|
function getBackIcon() {
|
|
795
|
-
if (
|
|
806
|
+
if (import_react_native7.Platform.OS === "ios") {
|
|
796
807
|
return selectRTL("chevron-left", "chevron-right");
|
|
797
808
|
}
|
|
798
809
|
return selectRTL("arrow-left", "arrow-right");
|
|
@@ -821,9 +832,9 @@ function getSizeStyle2(styles, size) {
|
|
|
821
832
|
}
|
|
822
833
|
function withTopInset(enabled, content, style) {
|
|
823
834
|
if (enabled) {
|
|
824
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
835
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SafeAreaViewComponent, { edges: ["top"], style, children: content });
|
|
825
836
|
}
|
|
826
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
837
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style, children: content });
|
|
827
838
|
}
|
|
828
839
|
function measureWidth(event) {
|
|
829
840
|
return Math.round(event.nativeEvent.layout.width);
|
|
@@ -884,7 +895,7 @@ function AppBar({
|
|
|
884
895
|
if (!canGoBack) {
|
|
885
896
|
return null;
|
|
886
897
|
}
|
|
887
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: styles.iconFrame, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
888
899
|
IconButton,
|
|
889
900
|
{
|
|
890
901
|
icon: getBackIcon(),
|
|
@@ -903,8 +914,8 @@ function AppBar({
|
|
|
903
914
|
if (!actions || actions.length === 0) {
|
|
904
915
|
return null;
|
|
905
916
|
}
|
|
906
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
907
|
-
|
|
917
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: styles.actionsRow, children: actions.map((action, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
918
|
+
import_react_native7.View,
|
|
908
919
|
{
|
|
909
920
|
style: styles.iconFrame,
|
|
910
921
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
@@ -947,9 +958,9 @@ function AppBar({
|
|
|
947
958
|
return nextWidth;
|
|
948
959
|
});
|
|
949
960
|
}, []);
|
|
950
|
-
const topRow = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
961
|
+
const topRow = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: styles.topRow, children: [
|
|
951
962
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
952
|
-
|
|
963
|
+
import_react_native7.View,
|
|
953
964
|
{
|
|
954
965
|
collapsable: false,
|
|
955
966
|
onLayout: onLeadingLayout,
|
|
@@ -957,9 +968,9 @@ function AppBar({
|
|
|
957
968
|
children: leadingContent
|
|
958
969
|
}
|
|
959
970
|
),
|
|
960
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
971
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: styles.topRowSpacer }),
|
|
961
972
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
962
|
-
|
|
973
|
+
import_react_native7.View,
|
|
963
974
|
{
|
|
964
975
|
collapsable: false,
|
|
965
976
|
onLayout: onActionsLayout,
|
|
@@ -981,10 +992,10 @@ function AppBar({
|
|
|
981
992
|
containerOverride
|
|
982
993
|
];
|
|
983
994
|
if (isExpanded) {
|
|
984
|
-
const content2 = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
995
|
+
const content2 = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: [styles.expandedContainer, getSizeStyle2(styles, size)], children: [
|
|
985
996
|
topRow,
|
|
986
997
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
987
|
-
|
|
998
|
+
import_react_native7.View,
|
|
988
999
|
{
|
|
989
1000
|
style: [
|
|
990
1001
|
styles.expandedTitleContainer,
|
|
@@ -1008,11 +1019,11 @@ function AppBar({
|
|
|
1008
1019
|
}
|
|
1009
1020
|
)
|
|
1010
1021
|
] });
|
|
1011
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1022
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: rootStyle, children: withTopInset(insetTop, content2, safeAreaStyle) });
|
|
1012
1023
|
}
|
|
1013
|
-
const content = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1024
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native7.View, { style: styles.smallContainer, children: [
|
|
1014
1025
|
topRow,
|
|
1015
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1026
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: [styles.overlayTitleContainer, overlayTitleInsetStyle], children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1016
1027
|
Typography,
|
|
1017
1028
|
{
|
|
1018
1029
|
...APP_BAR_TITLE_TEXT_PROPS,
|
|
@@ -1027,7 +1038,7 @@ function AppBar({
|
|
|
1027
1038
|
}
|
|
1028
1039
|
) })
|
|
1029
1040
|
] });
|
|
1030
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1041
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native7.View, { style: rootStyle, children: withTopInset(insetTop, content, safeAreaStyle) });
|
|
1031
1042
|
}
|
|
1032
1043
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1033
1044
|
0 && (module.exports = {
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,5 @@ export { Avatar, AvatarProps, AvatarSize } from './avatar/index.js';
|
|
|
16
16
|
import 'react/jsx-runtime';
|
|
17
17
|
import 'react';
|
|
18
18
|
import 'react-native';
|
|
19
|
-
import 'react-native-safe-area-context';
|
|
20
19
|
import '@onlynative/core';
|
|
21
20
|
import '@expo/vector-icons/MaterialCommunityIcons';
|
package/dist/index.js
CHANGED
|
@@ -105,8 +105,21 @@ function Typography({
|
|
|
105
105
|
// src/layout/Layout.tsx
|
|
106
106
|
var import_core2 = require("@onlynative/core");
|
|
107
107
|
var import_react2 = require("react");
|
|
108
|
+
var import_react_native3 = require("react-native");
|
|
109
|
+
|
|
110
|
+
// src/safe-area.tsx
|
|
108
111
|
var import_react_native2 = require("react-native");
|
|
109
|
-
var
|
|
112
|
+
var SafeAreaViewComponent = import_react_native2.View;
|
|
113
|
+
try {
|
|
114
|
+
const safeArea = require("react-native-safe-area-context");
|
|
115
|
+
SafeAreaViewComponent = safeArea.SafeAreaView;
|
|
116
|
+
} catch {
|
|
117
|
+
console.warn(
|
|
118
|
+
'[@onlynative/components] "react-native-safe-area-context" is not installed. Layout and AppBar will render without safe area insets. Run `npx expo install react-native-safe-area-context` to fix this.'
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// src/layout/Layout.tsx
|
|
110
123
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
111
124
|
var defaultEdges = ["bottom"];
|
|
112
125
|
function resolveEdges(immersive, edges) {
|
|
@@ -118,7 +131,7 @@ function resolveEdges(immersive, edges) {
|
|
|
118
131
|
}
|
|
119
132
|
return defaultEdges;
|
|
120
133
|
}
|
|
121
|
-
var styles =
|
|
134
|
+
var styles = import_react_native3.StyleSheet.create({
|
|
122
135
|
root: {
|
|
123
136
|
flex: 1
|
|
124
137
|
}
|
|
@@ -127,7 +140,7 @@ function removeBackgroundColor(style) {
|
|
|
127
140
|
if (!style) {
|
|
128
141
|
return void 0;
|
|
129
142
|
}
|
|
130
|
-
const flattenedStyle =
|
|
143
|
+
const flattenedStyle = import_react_native3.StyleSheet.flatten(style);
|
|
131
144
|
if (!flattenedStyle || flattenedStyle.backgroundColor === void 0) {
|
|
132
145
|
return style;
|
|
133
146
|
}
|
|
@@ -150,7 +163,7 @@ function Layout({ immersive, edges, children, style }) {
|
|
|
150
163
|
[immersive, edges]
|
|
151
164
|
);
|
|
152
165
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
153
|
-
|
|
166
|
+
SafeAreaViewComponent,
|
|
154
167
|
{
|
|
155
168
|
style: [styles.root, themeBackgroundStyle, styleWithoutBackground],
|
|
156
169
|
edges: safeAreaEdges,
|
|
@@ -162,7 +175,7 @@ function Layout({ immersive, edges, children, style }) {
|
|
|
162
175
|
// src/layout/Box.tsx
|
|
163
176
|
var import_core3 = require("@onlynative/core");
|
|
164
177
|
var import_react3 = require("react");
|
|
165
|
-
var
|
|
178
|
+
var import_react_native4 = require("react-native");
|
|
166
179
|
|
|
167
180
|
// src/layout/resolveSpacing.ts
|
|
168
181
|
function resolveSpacing(spacing, value) {
|
|
@@ -260,7 +273,7 @@ function Box({
|
|
|
260
273
|
justify,
|
|
261
274
|
bg
|
|
262
275
|
]);
|
|
263
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native4.View, { ...viewProps, style: [layoutStyle, style] });
|
|
264
277
|
}
|
|
265
278
|
|
|
266
279
|
// src/layout/Column.tsx
|
|
@@ -279,7 +292,7 @@ function Column({ inverted = false, style, ...boxProps }) {
|
|
|
279
292
|
// src/layout/Grid.tsx
|
|
280
293
|
var import_core4 = require("@onlynative/core");
|
|
281
294
|
var import_react6 = __toESM(require("react"));
|
|
282
|
-
var
|
|
295
|
+
var import_react_native5 = require("react-native");
|
|
283
296
|
|
|
284
297
|
// src/layout/Row.tsx
|
|
285
298
|
var import_react5 = require("react");
|
|
@@ -333,7 +346,7 @@ function Grid({
|
|
|
333
346
|
);
|
|
334
347
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { wrap: true, rowGap: resolvedRowGap, ...rowProps, style: [rowStyle, style], children: import_react6.default.Children.map(
|
|
335
348
|
children,
|
|
336
|
-
(child) => child != null ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
349
|
+
(child) => child != null ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native5.View, { style: cellStyle, children: child }) : null
|
|
337
350
|
) });
|
|
338
351
|
}
|
|
339
352
|
|
|
@@ -385,9 +398,9 @@ function blendColor(base, overlay, overlayAlpha) {
|
|
|
385
398
|
}
|
|
386
399
|
|
|
387
400
|
// ../utils/src/elevation.ts
|
|
388
|
-
var
|
|
401
|
+
var import_react_native6 = require("react-native");
|
|
389
402
|
function elevationStyle(level) {
|
|
390
|
-
if (
|
|
403
|
+
if (import_react_native6.Platform.OS === "web") {
|
|
391
404
|
const { shadowOffset, shadowOpacity, shadowRadius } = level;
|
|
392
405
|
if (shadowOpacity === 0) {
|
|
393
406
|
return { boxShadow: "none" };
|
|
@@ -430,7 +443,7 @@ function getMaterialCommunityIcons() {
|
|
|
430
443
|
}
|
|
431
444
|
|
|
432
445
|
// ../utils/src/pressable.ts
|
|
433
|
-
var
|
|
446
|
+
var import_react_native7 = require("react-native");
|
|
434
447
|
function resolvePressableStyle(base, hovered, pressed, disabled, isDisabled, style) {
|
|
435
448
|
if (typeof style === "function") {
|
|
436
449
|
return (state) => [
|
|
@@ -450,25 +463,25 @@ function resolvePressableStyle(base, hovered, pressed, disabled, isDisabled, sty
|
|
|
450
463
|
];
|
|
451
464
|
}
|
|
452
465
|
function resolveColorFromStyle(...styles3) {
|
|
453
|
-
const flattened =
|
|
466
|
+
const flattened = import_react_native7.StyleSheet.flatten(styles3);
|
|
454
467
|
return typeof (flattened == null ? void 0 : flattened.color) === "string" ? flattened.color : void 0;
|
|
455
468
|
}
|
|
456
469
|
|
|
457
470
|
// ../utils/src/rtl.ts
|
|
458
|
-
var
|
|
471
|
+
var import_react_native8 = require("react-native");
|
|
459
472
|
function transformOrigin(vertical = "top") {
|
|
460
|
-
return
|
|
473
|
+
return import_react_native8.I18nManager.isRTL ? `right ${vertical}` : `left ${vertical}`;
|
|
461
474
|
}
|
|
462
475
|
function selectRTL(ltr, rtl) {
|
|
463
|
-
return
|
|
476
|
+
return import_react_native8.I18nManager.isRTL ? rtl : ltr;
|
|
464
477
|
}
|
|
465
478
|
|
|
466
479
|
// src/button/Button.tsx
|
|
467
480
|
var import_react7 = require("react");
|
|
468
|
-
var
|
|
481
|
+
var import_react_native10 = require("react-native");
|
|
469
482
|
|
|
470
483
|
// src/button/styles.ts
|
|
471
|
-
var
|
|
484
|
+
var import_react_native9 = require("react-native");
|
|
472
485
|
function getVariantColors(theme, variant) {
|
|
473
486
|
const disabledContainerColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
474
487
|
const disabledLabelColor = alphaColor(theme.colors.onSurface, 0.38);
|
|
@@ -649,7 +662,7 @@ function createStyles(theme, variant, hasLeadingIcon, hasTrailingIcon, container
|
|
|
649
662
|
const elevationLevel1 = elevationStyle(theme.elevation.level1);
|
|
650
663
|
const elevationLevel2 = elevationStyle(theme.elevation.level2);
|
|
651
664
|
const baseElevation = variant === "elevated" ? elevationLevel1 : elevationLevel0;
|
|
652
|
-
return
|
|
665
|
+
return import_react_native9.StyleSheet.create({
|
|
653
666
|
container: {
|
|
654
667
|
alignSelf: "flex-start",
|
|
655
668
|
alignItems: "center",
|
|
@@ -747,12 +760,12 @@ function Button({
|
|
|
747
760
|
[isDisabled, styles3.disabledLabel, styles3.label, labelStyleOverride]
|
|
748
761
|
);
|
|
749
762
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
750
|
-
|
|
763
|
+
import_react_native10.Pressable,
|
|
751
764
|
{
|
|
752
765
|
...props,
|
|
753
766
|
accessibilityRole: "button",
|
|
754
767
|
accessibilityState: { disabled: isDisabled },
|
|
755
|
-
hitSlop:
|
|
768
|
+
hitSlop: import_react_native10.Platform.OS === "web" ? void 0 : 4,
|
|
756
769
|
disabled: isDisabled,
|
|
757
770
|
style: resolvePressableStyle(
|
|
758
771
|
styles3.container,
|
|
@@ -772,7 +785,7 @@ function Button({
|
|
|
772
785
|
style: styles3.leadingIcon
|
|
773
786
|
}
|
|
774
787
|
) : null,
|
|
775
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
788
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native10.Text, { style: computedLabelStyle, children }),
|
|
776
789
|
trailingIcon ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
777
790
|
MaterialCommunityIcons,
|
|
778
791
|
{
|
|
@@ -790,15 +803,15 @@ function Button({
|
|
|
790
803
|
// src/icon-button/IconButton.tsx
|
|
791
804
|
var import_core6 = require("@onlynative/core");
|
|
792
805
|
var import_react8 = require("react");
|
|
793
|
-
var
|
|
806
|
+
var import_react_native12 = require("react-native");
|
|
794
807
|
|
|
795
808
|
// src/icon-button/styles.ts
|
|
796
|
-
var
|
|
809
|
+
var import_react_native11 = require("react-native");
|
|
797
810
|
function createStyles2(theme) {
|
|
798
811
|
const disabledContainerColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
799
812
|
const disabledOutlineColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
800
813
|
const toggleUnselectedContainerColor = theme.colors.surfaceContainerHighest;
|
|
801
|
-
return
|
|
814
|
+
return import_react_native11.StyleSheet.create({
|
|
802
815
|
container: {
|
|
803
816
|
borderRadius: theme.shape.cornerFull,
|
|
804
817
|
alignItems: "center",
|
|
@@ -1238,7 +1251,7 @@ function IconButton({
|
|
|
1238
1251
|
};
|
|
1239
1252
|
}, [containerColor, resolvedIconColor, theme.stateLayer]);
|
|
1240
1253
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1241
|
-
|
|
1254
|
+
import_react_native12.Pressable,
|
|
1242
1255
|
{
|
|
1243
1256
|
...props,
|
|
1244
1257
|
accessibilityRole: "button",
|
|
@@ -1282,12 +1295,11 @@ function IconButton({
|
|
|
1282
1295
|
// src/appbar/AppBar.tsx
|
|
1283
1296
|
var import_core8 = require("@onlynative/core");
|
|
1284
1297
|
var import_react9 = require("react");
|
|
1285
|
-
var
|
|
1286
|
-
var import_react_native_safe_area_context2 = require("react-native-safe-area-context");
|
|
1298
|
+
var import_react_native14 = require("react-native");
|
|
1287
1299
|
|
|
1288
1300
|
// src/appbar/styles.ts
|
|
1289
1301
|
var import_core7 = require("@onlynative/core");
|
|
1290
|
-
var
|
|
1302
|
+
var import_react_native13 = require("react-native");
|
|
1291
1303
|
function getColorSchemeColors(theme, colorScheme) {
|
|
1292
1304
|
switch (colorScheme) {
|
|
1293
1305
|
case "surfaceContainerLowest":
|
|
@@ -1344,7 +1356,7 @@ function getColorSchemeColors(theme, colorScheme) {
|
|
|
1344
1356
|
function createStyles3(theme, schemeColors) {
|
|
1345
1357
|
var _a;
|
|
1346
1358
|
const topAppBar = (_a = theme.topAppBar) != null ? _a : import_core7.defaultTopAppBarTokens;
|
|
1347
|
-
return
|
|
1359
|
+
return import_react_native13.StyleSheet.create({
|
|
1348
1360
|
root: {
|
|
1349
1361
|
backgroundColor: schemeColors.containerColor
|
|
1350
1362
|
},
|
|
@@ -1433,7 +1445,7 @@ function createStyles3(theme, schemeColors) {
|
|
|
1433
1445
|
// src/appbar/AppBar.tsx
|
|
1434
1446
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1435
1447
|
function getBackIcon() {
|
|
1436
|
-
if (
|
|
1448
|
+
if (import_react_native14.Platform.OS === "ios") {
|
|
1437
1449
|
return selectRTL("chevron-left", "chevron-right");
|
|
1438
1450
|
}
|
|
1439
1451
|
return selectRTL("arrow-left", "arrow-right");
|
|
@@ -1462,9 +1474,9 @@ function getSizeStyle2(styles3, size) {
|
|
|
1462
1474
|
}
|
|
1463
1475
|
function withTopInset(enabled, content, style) {
|
|
1464
1476
|
if (enabled) {
|
|
1465
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SafeAreaViewComponent, { edges: ["top"], style, children: content });
|
|
1466
1478
|
}
|
|
1467
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1479
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native14.View, { style, children: content });
|
|
1468
1480
|
}
|
|
1469
1481
|
function measureWidth(event) {
|
|
1470
1482
|
return Math.round(event.nativeEvent.layout.width);
|
|
@@ -1525,7 +1537,7 @@ function AppBar({
|
|
|
1525
1537
|
if (!canGoBack) {
|
|
1526
1538
|
return null;
|
|
1527
1539
|
}
|
|
1528
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native14.View, { style: styles3.iconFrame, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1529
1541
|
IconButton,
|
|
1530
1542
|
{
|
|
1531
1543
|
icon: getBackIcon(),
|
|
@@ -1544,8 +1556,8 @@ function AppBar({
|
|
|
1544
1556
|
if (!actions || actions.length === 0) {
|
|
1545
1557
|
return null;
|
|
1546
1558
|
}
|
|
1547
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1548
|
-
|
|
1559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native14.View, { style: styles3.actionsRow, children: actions.map((action, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1560
|
+
import_react_native14.View,
|
|
1549
1561
|
{
|
|
1550
1562
|
style: styles3.iconFrame,
|
|
1551
1563
|
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
@@ -1588,9 +1600,9 @@ function AppBar({
|
|
|
1588
1600
|
return nextWidth;
|
|
1589
1601
|
});
|
|
1590
1602
|
}, []);
|
|
1591
|
-
const topRow = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1603
|
+
const topRow = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_native14.View, { style: styles3.topRow, children: [
|
|
1592
1604
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1593
|
-
|
|
1605
|
+
import_react_native14.View,
|
|
1594
1606
|
{
|
|
1595
1607
|
collapsable: false,
|
|
1596
1608
|
onLayout: onLeadingLayout,
|
|
@@ -1598,9 +1610,9 @@ function AppBar({
|
|
|
1598
1610
|
children: leadingContent
|
|
1599
1611
|
}
|
|
1600
1612
|
),
|
|
1601
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1613
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native14.View, { style: styles3.topRowSpacer }),
|
|
1602
1614
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1603
|
-
|
|
1615
|
+
import_react_native14.View,
|
|
1604
1616
|
{
|
|
1605
1617
|
collapsable: false,
|
|
1606
1618
|
onLayout: onActionsLayout,
|
|
@@ -1622,10 +1634,10 @@ function AppBar({
|
|
|
1622
1634
|
containerOverride
|
|
1623
1635
|
];
|
|
1624
1636
|
if (isExpanded) {
|
|
1625
|
-
const content2 = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1637
|
+
const content2 = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_native14.View, { style: [styles3.expandedContainer, getSizeStyle2(styles3, size)], children: [
|
|
1626
1638
|
topRow,
|
|
1627
1639
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1628
|
-
|
|
1640
|
+
import_react_native14.View,
|
|
1629
1641
|
{
|
|
1630
1642
|
style: [
|
|
1631
1643
|
styles3.expandedTitleContainer,
|
|
@@ -1649,11 +1661,11 @@ function AppBar({
|
|
|
1649
1661
|
}
|
|
1650
1662
|
)
|
|
1651
1663
|
] });
|
|
1652
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native14.View, { style: rootStyle, children: withTopInset(insetTop, content2, safeAreaStyle) });
|
|
1653
1665
|
}
|
|
1654
|
-
const content = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1666
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_native14.View, { style: styles3.smallContainer, children: [
|
|
1655
1667
|
topRow,
|
|
1656
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1668
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native14.View, { style: [styles3.overlayTitleContainer, overlayTitleInsetStyle], children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1657
1669
|
Typography,
|
|
1658
1670
|
{
|
|
1659
1671
|
...APP_BAR_TITLE_TEXT_PROPS,
|
|
@@ -1668,16 +1680,16 @@ function AppBar({
|
|
|
1668
1680
|
}
|
|
1669
1681
|
) })
|
|
1670
1682
|
] });
|
|
1671
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native14.View, { style: rootStyle, children: withTopInset(insetTop, content, safeAreaStyle) });
|
|
1672
1684
|
}
|
|
1673
1685
|
|
|
1674
1686
|
// src/card/Card.tsx
|
|
1675
1687
|
var import_core9 = require("@onlynative/core");
|
|
1676
1688
|
var import_react10 = require("react");
|
|
1677
|
-
var
|
|
1689
|
+
var import_react_native16 = require("react-native");
|
|
1678
1690
|
|
|
1679
1691
|
// src/card/styles.ts
|
|
1680
|
-
var
|
|
1692
|
+
var import_react_native15 = require("react-native");
|
|
1681
1693
|
function getVariantColors2(theme, variant) {
|
|
1682
1694
|
const disabledContainerColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
1683
1695
|
const disabledOutlineColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
@@ -1761,7 +1773,7 @@ function createStyles4(theme, variant, containerColor) {
|
|
|
1761
1773
|
const elevationLevel1 = elevationStyle(theme.elevation.level1);
|
|
1762
1774
|
const elevationLevel2 = elevationStyle(theme.elevation.level2);
|
|
1763
1775
|
const baseElevation = variant === "elevated" ? elevationLevel1 : elevationLevel0;
|
|
1764
|
-
return
|
|
1776
|
+
return import_react_native15.StyleSheet.create({
|
|
1765
1777
|
container: {
|
|
1766
1778
|
borderRadius: theme.shape.cornerMedium,
|
|
1767
1779
|
backgroundColor: colors.backgroundColor,
|
|
@@ -1811,15 +1823,15 @@ function Card({
|
|
|
1811
1823
|
[theme, variant, containerColor]
|
|
1812
1824
|
);
|
|
1813
1825
|
if (!isInteractive) {
|
|
1814
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native16.View, { ...props, style: [styles3.container, style], children });
|
|
1815
1827
|
}
|
|
1816
1828
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1817
|
-
|
|
1829
|
+
import_react_native16.Pressable,
|
|
1818
1830
|
{
|
|
1819
1831
|
...props,
|
|
1820
1832
|
role: "button",
|
|
1821
1833
|
accessibilityState: { disabled: isDisabled },
|
|
1822
|
-
hitSlop:
|
|
1834
|
+
hitSlop: import_react_native16.Platform.OS === "web" ? void 0 : 4,
|
|
1823
1835
|
disabled: isDisabled,
|
|
1824
1836
|
onPress,
|
|
1825
1837
|
style: resolvePressableStyle(
|
|
@@ -1830,7 +1842,7 @@ function Card({
|
|
|
1830
1842
|
isDisabled,
|
|
1831
1843
|
style
|
|
1832
1844
|
),
|
|
1833
|
-
children: isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1845
|
+
children: isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native16.View, { style: styles3.disabledContent, children }) : children
|
|
1834
1846
|
}
|
|
1835
1847
|
);
|
|
1836
1848
|
}
|
|
@@ -1838,10 +1850,10 @@ function Card({
|
|
|
1838
1850
|
// src/chip/Chip.tsx
|
|
1839
1851
|
var import_core10 = require("@onlynative/core");
|
|
1840
1852
|
var import_react11 = require("react");
|
|
1841
|
-
var
|
|
1853
|
+
var import_react_native18 = require("react-native");
|
|
1842
1854
|
|
|
1843
1855
|
// src/chip/styles.ts
|
|
1844
|
-
var
|
|
1856
|
+
var import_react_native17 = require("react-native");
|
|
1845
1857
|
function getVariantColors3(theme, variant, elevated, selected) {
|
|
1846
1858
|
const disabledContainerColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
1847
1859
|
const disabledLabelColor = alphaColor(theme.colors.onSurface, 0.38);
|
|
@@ -1969,7 +1981,7 @@ function createStyles5(theme, variant, elevated, selected, hasLeadingContent, ha
|
|
|
1969
1981
|
const elevationLevel2 = elevationStyle(theme.elevation.level2);
|
|
1970
1982
|
const isElevated = elevated && variant !== "input";
|
|
1971
1983
|
const baseElevation = isElevated ? elevationLevel1 : elevationLevel0;
|
|
1972
|
-
return
|
|
1984
|
+
return import_react_native17.StyleSheet.create({
|
|
1973
1985
|
container: {
|
|
1974
1986
|
alignSelf: "flex-start",
|
|
1975
1987
|
alignItems: "center",
|
|
@@ -2090,7 +2102,7 @@ function Chip({
|
|
|
2090
2102
|
);
|
|
2091
2103
|
const renderLeadingContent = () => {
|
|
2092
2104
|
if (variant === "input" && avatar) {
|
|
2093
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native18.View, { style: styles3.avatar, children: avatar });
|
|
2094
2106
|
}
|
|
2095
2107
|
if (leadingIcon) {
|
|
2096
2108
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
@@ -2117,7 +2129,7 @@ function Chip({
|
|
|
2117
2129
|
return null;
|
|
2118
2130
|
};
|
|
2119
2131
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
2120
|
-
|
|
2132
|
+
import_react_native18.Pressable,
|
|
2121
2133
|
{
|
|
2122
2134
|
...props,
|
|
2123
2135
|
accessibilityRole: "button",
|
|
@@ -2125,7 +2137,7 @@ function Chip({
|
|
|
2125
2137
|
disabled: isDisabled,
|
|
2126
2138
|
...variant === "filter" ? { selected: isSelected } : void 0
|
|
2127
2139
|
},
|
|
2128
|
-
hitSlop:
|
|
2140
|
+
hitSlop: import_react_native18.Platform.OS === "web" ? void 0 : 4,
|
|
2129
2141
|
disabled: isDisabled,
|
|
2130
2142
|
style: resolvePressableStyle(
|
|
2131
2143
|
styles3.container,
|
|
@@ -2137,9 +2149,9 @@ function Chip({
|
|
|
2137
2149
|
),
|
|
2138
2150
|
children: [
|
|
2139
2151
|
renderLeadingContent(),
|
|
2140
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2152
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native18.Text, { style: computedLabelStyle, children }),
|
|
2141
2153
|
showCloseIcon ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2142
|
-
|
|
2154
|
+
import_react_native18.Pressable,
|
|
2143
2155
|
{
|
|
2144
2156
|
onPress: onClose,
|
|
2145
2157
|
accessibilityRole: "button",
|
|
@@ -2164,10 +2176,10 @@ function Chip({
|
|
|
2164
2176
|
// src/checkbox/Checkbox.tsx
|
|
2165
2177
|
var import_core11 = require("@onlynative/core");
|
|
2166
2178
|
var import_react12 = require("react");
|
|
2167
|
-
var
|
|
2179
|
+
var import_react_native20 = require("react-native");
|
|
2168
2180
|
|
|
2169
2181
|
// src/checkbox/styles.ts
|
|
2170
|
-
var
|
|
2182
|
+
var import_react_native19 = require("react-native");
|
|
2171
2183
|
function getColors(theme, checked) {
|
|
2172
2184
|
const disabledOnSurface38 = alphaColor(theme.colors.onSurface, 0.38);
|
|
2173
2185
|
if (checked) {
|
|
@@ -2243,7 +2255,7 @@ function createStyles6(theme, checked, containerColor, contentColor) {
|
|
|
2243
2255
|
);
|
|
2244
2256
|
const size = 18;
|
|
2245
2257
|
const touchTarget = 48;
|
|
2246
|
-
return
|
|
2258
|
+
return import_react_native19.StyleSheet.create({
|
|
2247
2259
|
container: {
|
|
2248
2260
|
width: touchTarget,
|
|
2249
2261
|
height: touchTarget,
|
|
@@ -2318,7 +2330,7 @@ function Checkbox({
|
|
|
2318
2330
|
}
|
|
2319
2331
|
};
|
|
2320
2332
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2321
|
-
|
|
2333
|
+
import_react_native20.Pressable,
|
|
2322
2334
|
{
|
|
2323
2335
|
...props,
|
|
2324
2336
|
accessibilityRole: "checkbox",
|
|
@@ -2326,7 +2338,7 @@ function Checkbox({
|
|
|
2326
2338
|
disabled: isDisabled,
|
|
2327
2339
|
checked: isChecked
|
|
2328
2340
|
},
|
|
2329
|
-
hitSlop:
|
|
2341
|
+
hitSlop: import_react_native20.Platform.OS === "web" ? void 0 : 4,
|
|
2330
2342
|
disabled: isDisabled,
|
|
2331
2343
|
onPress: handlePress,
|
|
2332
2344
|
style: resolvePressableStyle(
|
|
@@ -2337,7 +2349,7 @@ function Checkbox({
|
|
|
2337
2349
|
isDisabled,
|
|
2338
2350
|
style
|
|
2339
2351
|
),
|
|
2340
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2352
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native20.View, { style: [styles3.box, isDisabled ? styles3.disabledBox : void 0], children: isChecked ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2341
2353
|
MaterialCommunityIcons,
|
|
2342
2354
|
{
|
|
2343
2355
|
name: "check",
|
|
@@ -2352,10 +2364,10 @@ function Checkbox({
|
|
|
2352
2364
|
// src/radio/Radio.tsx
|
|
2353
2365
|
var import_core12 = require("@onlynative/core");
|
|
2354
2366
|
var import_react13 = require("react");
|
|
2355
|
-
var
|
|
2367
|
+
var import_react_native22 = require("react-native");
|
|
2356
2368
|
|
|
2357
2369
|
// src/radio/styles.ts
|
|
2358
|
-
var
|
|
2370
|
+
var import_react_native21 = require("react-native");
|
|
2359
2371
|
function getColors2(theme, selected) {
|
|
2360
2372
|
const disabledOnSurface38 = alphaColor(theme.colors.onSurface, 0.38);
|
|
2361
2373
|
if (selected) {
|
|
@@ -2419,7 +2431,7 @@ function createStyles7(theme, selected, containerColor, contentColor) {
|
|
|
2419
2431
|
const outerSize = 20;
|
|
2420
2432
|
const innerSize = 10;
|
|
2421
2433
|
const touchTarget = 48;
|
|
2422
|
-
return
|
|
2434
|
+
return import_react_native21.StyleSheet.create({
|
|
2423
2435
|
container: {
|
|
2424
2436
|
width: touchTarget,
|
|
2425
2437
|
height: touchTarget,
|
|
@@ -2486,7 +2498,7 @@ function Radio({
|
|
|
2486
2498
|
}
|
|
2487
2499
|
};
|
|
2488
2500
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2489
|
-
|
|
2501
|
+
import_react_native22.Pressable,
|
|
2490
2502
|
{
|
|
2491
2503
|
...props,
|
|
2492
2504
|
accessibilityRole: "radio",
|
|
@@ -2494,7 +2506,7 @@ function Radio({
|
|
|
2494
2506
|
disabled: isDisabled,
|
|
2495
2507
|
checked: isSelected
|
|
2496
2508
|
},
|
|
2497
|
-
hitSlop:
|
|
2509
|
+
hitSlop: import_react_native22.Platform.OS === "web" ? void 0 : 4,
|
|
2498
2510
|
disabled: isDisabled,
|
|
2499
2511
|
onPress: handlePress,
|
|
2500
2512
|
style: resolvePressableStyle(
|
|
@@ -2506,11 +2518,11 @@ function Radio({
|
|
|
2506
2518
|
style
|
|
2507
2519
|
),
|
|
2508
2520
|
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2509
|
-
|
|
2521
|
+
import_react_native22.View,
|
|
2510
2522
|
{
|
|
2511
2523
|
style: [styles3.outer, isDisabled ? styles3.disabledOuter : void 0],
|
|
2512
2524
|
children: isSelected ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2513
|
-
|
|
2525
|
+
import_react_native22.View,
|
|
2514
2526
|
{
|
|
2515
2527
|
style: [
|
|
2516
2528
|
styles3.inner,
|
|
@@ -2527,10 +2539,10 @@ function Radio({
|
|
|
2527
2539
|
// src/switch/Switch.tsx
|
|
2528
2540
|
var import_core13 = require("@onlynative/core");
|
|
2529
2541
|
var import_react14 = require("react");
|
|
2530
|
-
var
|
|
2542
|
+
var import_react_native24 = require("react-native");
|
|
2531
2543
|
|
|
2532
2544
|
// src/switch/styles.ts
|
|
2533
|
-
var
|
|
2545
|
+
var import_react_native23 = require("react-native");
|
|
2534
2546
|
function getColors3(theme, selected) {
|
|
2535
2547
|
const disabledOnSurface12 = alphaColor(theme.colors.onSurface, 0.12);
|
|
2536
2548
|
const disabledOnSurface38 = alphaColor(theme.colors.onSurface, 0.38);
|
|
@@ -2618,7 +2630,7 @@ function createStyles8(theme, selected, hasIcon, containerColor, contentColor) {
|
|
|
2618
2630
|
const trackHeight = 32;
|
|
2619
2631
|
const trackPadding = 4;
|
|
2620
2632
|
const thumbOffset = selected ? trackWidth - trackPadding - thumbSize : trackPadding;
|
|
2621
|
-
return
|
|
2633
|
+
return import_react_native23.StyleSheet.create({
|
|
2622
2634
|
track: {
|
|
2623
2635
|
width: trackWidth,
|
|
2624
2636
|
height: trackHeight,
|
|
@@ -2699,7 +2711,7 @@ function Switch({
|
|
|
2699
2711
|
const MaterialCommunityIcons = iconName ? getMaterialCommunityIcons() : null;
|
|
2700
2712
|
const iconSize = 16;
|
|
2701
2713
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2702
|
-
|
|
2714
|
+
import_react_native24.Pressable,
|
|
2703
2715
|
{
|
|
2704
2716
|
...props,
|
|
2705
2717
|
accessibilityRole: "switch",
|
|
@@ -2707,7 +2719,7 @@ function Switch({
|
|
|
2707
2719
|
disabled: isDisabled,
|
|
2708
2720
|
checked: isSelected
|
|
2709
2721
|
},
|
|
2710
|
-
hitSlop:
|
|
2722
|
+
hitSlop: import_react_native24.Platform.OS === "web" ? void 0 : 4,
|
|
2711
2723
|
disabled: isDisabled,
|
|
2712
2724
|
onPress: handlePress,
|
|
2713
2725
|
style: resolvePressableStyle(
|
|
@@ -2719,7 +2731,7 @@ function Switch({
|
|
|
2719
2731
|
style
|
|
2720
2732
|
),
|
|
2721
2733
|
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2722
|
-
|
|
2734
|
+
import_react_native24.View,
|
|
2723
2735
|
{
|
|
2724
2736
|
style: [styles3.thumb, isDisabled ? styles3.disabledThumb : void 0],
|
|
2725
2737
|
children: iconName ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
@@ -2739,10 +2751,10 @@ function Switch({
|
|
|
2739
2751
|
// src/text-field/TextField.tsx
|
|
2740
2752
|
var import_core14 = require("@onlynative/core");
|
|
2741
2753
|
var import_react15 = require("react");
|
|
2742
|
-
var
|
|
2754
|
+
var import_react_native26 = require("react-native");
|
|
2743
2755
|
|
|
2744
2756
|
// src/text-field/styles.ts
|
|
2745
|
-
var
|
|
2757
|
+
var import_react_native25 = require("react-native");
|
|
2746
2758
|
var CONTAINER_HEIGHT = 56;
|
|
2747
2759
|
var ICON_SIZE = 24;
|
|
2748
2760
|
var LABEL_FLOATED_LINE_HEIGHT = 16;
|
|
@@ -2801,7 +2813,7 @@ function createStyles9(theme, variant) {
|
|
|
2801
2813
|
const isFilled = variant === "filled";
|
|
2802
2814
|
return {
|
|
2803
2815
|
colors,
|
|
2804
|
-
styles:
|
|
2816
|
+
styles: import_react_native25.StyleSheet.create({
|
|
2805
2817
|
root: {
|
|
2806
2818
|
alignSelf: "stretch"
|
|
2807
2819
|
},
|
|
@@ -2978,13 +2990,13 @@ function TextField({
|
|
|
2978
2990
|
const isControlled = value !== void 0;
|
|
2979
2991
|
const hasValue = isControlled ? value !== "" : internalHasText;
|
|
2980
2992
|
const isLabelFloated = isFocused || hasValue;
|
|
2981
|
-
const labelAnimRef = (0, import_react15.useRef)(new
|
|
2993
|
+
const labelAnimRef = (0, import_react15.useRef)(new import_react_native26.Animated.Value(isLabelFloated ? 1 : 0));
|
|
2982
2994
|
const labelAnim = labelAnimRef.current;
|
|
2983
2995
|
(0, import_react15.useEffect)(() => {
|
|
2984
|
-
|
|
2996
|
+
import_react_native26.Animated.timing(labelAnim, {
|
|
2985
2997
|
toValue: isLabelFloated ? 1 : 0,
|
|
2986
2998
|
duration: 150,
|
|
2987
|
-
useNativeDriver:
|
|
2999
|
+
useNativeDriver: import_react_native26.Platform.OS !== "web"
|
|
2988
3000
|
}).start();
|
|
2989
3001
|
}, [isLabelFloated, labelAnim]);
|
|
2990
3002
|
const labelScale = (0, import_react15.useMemo)(() => {
|
|
@@ -3062,9 +3074,9 @@ function TextField({
|
|
|
3062
3074
|
[styles3, isFocused, isError, isDisabled]
|
|
3063
3075
|
);
|
|
3064
3076
|
const displaySupportingText = isError ? errorText : supportingText;
|
|
3065
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
3066
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3067
|
-
leadingIcon ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3077
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native26.View, { style: [styles3.root, style], children: [
|
|
3078
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native26.Pressable, { onPress: handleContainerPress, disabled: isDisabled, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native26.View, { style: containerStyle, children: [
|
|
3079
|
+
leadingIcon ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native26.View, { style: styles3.leadingIcon, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3068
3080
|
MaterialCommunityIcons,
|
|
3069
3081
|
{
|
|
3070
3082
|
name: leadingIcon,
|
|
@@ -3073,14 +3085,14 @@ function TextField({
|
|
|
3073
3085
|
}
|
|
3074
3086
|
) }) : null,
|
|
3075
3087
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3076
|
-
|
|
3088
|
+
import_react_native26.View,
|
|
3077
3089
|
{
|
|
3078
3090
|
style: [
|
|
3079
3091
|
styles3.inputWrapper,
|
|
3080
3092
|
label ? styles3.inputWrapperWithLabel : void 0
|
|
3081
3093
|
],
|
|
3082
3094
|
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3083
|
-
|
|
3095
|
+
import_react_native26.TextInput,
|
|
3084
3096
|
{
|
|
3085
3097
|
ref: inputRef,
|
|
3086
3098
|
...textInputProps,
|
|
@@ -3106,14 +3118,14 @@ function TextField({
|
|
|
3106
3118
|
}
|
|
3107
3119
|
),
|
|
3108
3120
|
trailingIcon ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3109
|
-
|
|
3121
|
+
import_react_native26.Pressable,
|
|
3110
3122
|
{
|
|
3111
3123
|
onPress: onTrailingIconPress,
|
|
3112
3124
|
disabled: isDisabled || !onTrailingIconPress,
|
|
3113
3125
|
accessibilityRole: "button",
|
|
3114
3126
|
hitSlop: 12,
|
|
3115
3127
|
style: styles3.trailingIconPressable,
|
|
3116
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3128
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native26.View, { style: styles3.trailingIcon, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3117
3129
|
MaterialCommunityIcons,
|
|
3118
3130
|
{
|
|
3119
3131
|
name: trailingIcon,
|
|
@@ -3124,7 +3136,7 @@ function TextField({
|
|
|
3124
3136
|
}
|
|
3125
3137
|
) : null,
|
|
3126
3138
|
label ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3127
|
-
|
|
3139
|
+
import_react_native26.Animated.Text,
|
|
3128
3140
|
{
|
|
3129
3141
|
numberOfLines: 1,
|
|
3130
3142
|
style: [
|
|
@@ -3144,10 +3156,10 @@ function TextField({
|
|
|
3144
3156
|
children: label
|
|
3145
3157
|
}
|
|
3146
3158
|
) : null,
|
|
3147
|
-
isFilled ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3159
|
+
isFilled ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native26.View, { style: indicatorStyle }) : null
|
|
3148
3160
|
] }) }),
|
|
3149
|
-
displaySupportingText ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3150
|
-
|
|
3161
|
+
displaySupportingText ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native26.View, { style: styles3.supportingTextRow, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3162
|
+
import_react_native26.Text,
|
|
3151
3163
|
{
|
|
3152
3164
|
style: [
|
|
3153
3165
|
styles3.supportingText,
|
|
@@ -3162,10 +3174,10 @@ function TextField({
|
|
|
3162
3174
|
// src/list/List.tsx
|
|
3163
3175
|
var import_core15 = require("@onlynative/core");
|
|
3164
3176
|
var import_react16 = require("react");
|
|
3165
|
-
var
|
|
3177
|
+
var import_react_native28 = require("react-native");
|
|
3166
3178
|
|
|
3167
3179
|
// src/list/styles.ts
|
|
3168
|
-
var
|
|
3180
|
+
var import_react_native27 = require("react-native");
|
|
3169
3181
|
var ITEM_PADDING_VERTICAL = 12;
|
|
3170
3182
|
var INSET_START = 56;
|
|
3171
3183
|
var MIN_HEIGHT = {
|
|
@@ -3174,7 +3186,7 @@ var MIN_HEIGHT = {
|
|
|
3174
3186
|
3: 88
|
|
3175
3187
|
};
|
|
3176
3188
|
function createListStyles(theme) {
|
|
3177
|
-
return
|
|
3189
|
+
return import_react_native27.StyleSheet.create({
|
|
3178
3190
|
container: {
|
|
3179
3191
|
paddingVertical: theme.spacing.sm
|
|
3180
3192
|
}
|
|
@@ -3211,7 +3223,7 @@ function getItemColors(theme, containerColor) {
|
|
|
3211
3223
|
}
|
|
3212
3224
|
function createListItemStyles(theme, lines, containerColor) {
|
|
3213
3225
|
const colors = getItemColors(theme, containerColor);
|
|
3214
|
-
return
|
|
3226
|
+
return import_react_native27.StyleSheet.create({
|
|
3215
3227
|
container: {
|
|
3216
3228
|
flexDirection: "row",
|
|
3217
3229
|
alignItems: lines === 3 ? "flex-start" : "center",
|
|
@@ -3266,7 +3278,7 @@ function createListItemStyles(theme, lines, containerColor) {
|
|
|
3266
3278
|
});
|
|
3267
3279
|
}
|
|
3268
3280
|
function createDividerStyles(theme, inset) {
|
|
3269
|
-
return
|
|
3281
|
+
return import_react_native27.StyleSheet.create({
|
|
3270
3282
|
divider: {
|
|
3271
3283
|
height: 1,
|
|
3272
3284
|
backgroundColor: theme.colors.outlineVariant,
|
|
@@ -3280,13 +3292,13 @@ var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
|
3280
3292
|
function List({ children, style, ...props }) {
|
|
3281
3293
|
const theme = (0, import_core15.useTheme)();
|
|
3282
3294
|
const styles3 = (0, import_react16.useMemo)(() => createListStyles(theme), [theme]);
|
|
3283
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_native28.View, { ...props, style: [styles3.container, style], children });
|
|
3284
3296
|
}
|
|
3285
3297
|
|
|
3286
3298
|
// src/list/ListItem.tsx
|
|
3287
3299
|
var import_core16 = require("@onlynative/core");
|
|
3288
3300
|
var import_react17 = require("react");
|
|
3289
|
-
var
|
|
3301
|
+
var import_react_native29 = require("react-native");
|
|
3290
3302
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3291
3303
|
function getLines(supportingText, overlineText, supportingTextNumberOfLines) {
|
|
3292
3304
|
if (supportingText && overlineText || supportingText && supportingTextNumberOfLines && supportingTextNumberOfLines > 1) {
|
|
@@ -3322,12 +3334,12 @@ function ListItem({
|
|
|
3322
3334
|
[theme, lines, containerColor]
|
|
3323
3335
|
);
|
|
3324
3336
|
const content = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
3325
|
-
leadingContent != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3326
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3327
|
-
overlineText != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3328
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3337
|
+
leadingContent != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native29.View, { style: styles3.leadingContent, children: leadingContent }),
|
|
3338
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native29.View, { style: styles3.textBlock, children: [
|
|
3339
|
+
overlineText != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native29.Text, { style: styles3.overlineText, numberOfLines: 1, children: overlineText }),
|
|
3340
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native29.Text, { style: styles3.headlineText, numberOfLines: 1, children: headlineText }),
|
|
3329
3341
|
supportingText != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3330
|
-
|
|
3342
|
+
import_react_native29.Text,
|
|
3331
3343
|
{
|
|
3332
3344
|
style: styles3.supportingText,
|
|
3333
3345
|
numberOfLines: supportingTextNumberOfLines,
|
|
@@ -3335,21 +3347,21 @@ function ListItem({
|
|
|
3335
3347
|
}
|
|
3336
3348
|
)
|
|
3337
3349
|
] }),
|
|
3338
|
-
(trailingContent != null || trailingSupportingText != null) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3339
|
-
trailingSupportingText != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3350
|
+
(trailingContent != null || trailingSupportingText != null) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native29.View, { style: styles3.trailingBlock, children: [
|
|
3351
|
+
trailingSupportingText != null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native29.Text, { style: styles3.trailingSupportingText, numberOfLines: 1, children: trailingSupportingText }),
|
|
3340
3352
|
trailingContent
|
|
3341
3353
|
] })
|
|
3342
3354
|
] });
|
|
3343
3355
|
if (!isInteractive) {
|
|
3344
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3356
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native29.View, { ...props, style: [styles3.container, style], children: content });
|
|
3345
3357
|
}
|
|
3346
3358
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3347
|
-
|
|
3359
|
+
import_react_native29.Pressable,
|
|
3348
3360
|
{
|
|
3349
3361
|
...props,
|
|
3350
3362
|
role: "button",
|
|
3351
3363
|
accessibilityState: { disabled: isDisabled },
|
|
3352
|
-
hitSlop:
|
|
3364
|
+
hitSlop: import_react_native29.Platform.OS === "web" ? void 0 : 4,
|
|
3353
3365
|
disabled: isDisabled,
|
|
3354
3366
|
onPress,
|
|
3355
3367
|
style: resolvePressableStyle(
|
|
@@ -3360,7 +3372,7 @@ function ListItem({
|
|
|
3360
3372
|
isDisabled,
|
|
3361
3373
|
style
|
|
3362
3374
|
),
|
|
3363
|
-
children: isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3375
|
+
children: isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native29.View, { style: styles3.disabledContentWrapper, children: content }) : content
|
|
3364
3376
|
}
|
|
3365
3377
|
);
|
|
3366
3378
|
}
|
|
@@ -3368,7 +3380,7 @@ function ListItem({
|
|
|
3368
3380
|
// src/list/ListDivider.tsx
|
|
3369
3381
|
var import_core17 = require("@onlynative/core");
|
|
3370
3382
|
var import_react18 = require("react");
|
|
3371
|
-
var
|
|
3383
|
+
var import_react_native30 = require("react-native");
|
|
3372
3384
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3373
3385
|
function ListDivider({
|
|
3374
3386
|
inset = false,
|
|
@@ -3380,16 +3392,16 @@ function ListDivider({
|
|
|
3380
3392
|
() => createDividerStyles(theme, inset),
|
|
3381
3393
|
[theme, inset]
|
|
3382
3394
|
);
|
|
3383
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native30.View, { ...props, style: [styles3.divider, style] });
|
|
3384
3396
|
}
|
|
3385
3397
|
|
|
3386
3398
|
// src/keyboard-avoiding-wrapper/KeyboardAvoidingWrapper.tsx
|
|
3387
3399
|
var import_react19 = require("react");
|
|
3388
|
-
var
|
|
3400
|
+
var import_react_native32 = require("react-native");
|
|
3389
3401
|
|
|
3390
3402
|
// src/keyboard-avoiding-wrapper/styles.ts
|
|
3391
|
-
var
|
|
3392
|
-
var styles2 =
|
|
3403
|
+
var import_react_native31 = require("react-native");
|
|
3404
|
+
var styles2 = import_react_native31.StyleSheet.create({
|
|
3393
3405
|
root: {
|
|
3394
3406
|
flex: 1
|
|
3395
3407
|
},
|
|
@@ -3400,7 +3412,7 @@ var styles2 = import_react_native30.StyleSheet.create({
|
|
|
3400
3412
|
|
|
3401
3413
|
// src/keyboard-avoiding-wrapper/KeyboardAvoidingWrapper.tsx
|
|
3402
3414
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3403
|
-
var isIOS =
|
|
3415
|
+
var isIOS = import_react_native32.Platform.OS === "ios";
|
|
3404
3416
|
function KeyboardAvoidingWrapper({
|
|
3405
3417
|
children,
|
|
3406
3418
|
behavior = "padding",
|
|
@@ -3416,25 +3428,25 @@ function KeyboardAvoidingWrapper({
|
|
|
3416
3428
|
const subscriptions = [];
|
|
3417
3429
|
if (onKeyboardShow) {
|
|
3418
3430
|
const showEvent = isIOS ? "keyboardWillShow" : "keyboardDidShow";
|
|
3419
|
-
subscriptions.push(
|
|
3431
|
+
subscriptions.push(import_react_native32.Keyboard.addListener(showEvent, onKeyboardShow));
|
|
3420
3432
|
}
|
|
3421
3433
|
if (onKeyboardHide) {
|
|
3422
3434
|
const hideEvent = isIOS ? "keyboardWillHide" : "keyboardDidHide";
|
|
3423
|
-
subscriptions.push(
|
|
3435
|
+
subscriptions.push(import_react_native32.Keyboard.addListener(hideEvent, onKeyboardHide));
|
|
3424
3436
|
}
|
|
3425
3437
|
return () => {
|
|
3426
3438
|
subscriptions.forEach((sub) => sub.remove());
|
|
3427
3439
|
};
|
|
3428
3440
|
}, [onKeyboardShow, onKeyboardHide]);
|
|
3429
3441
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3430
|
-
|
|
3442
|
+
import_react_native32.KeyboardAvoidingView,
|
|
3431
3443
|
{
|
|
3432
3444
|
style: [styles2.root, style],
|
|
3433
3445
|
behavior,
|
|
3434
3446
|
keyboardVerticalOffset,
|
|
3435
3447
|
enabled: !isIOS && enabled,
|
|
3436
3448
|
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3437
|
-
|
|
3449
|
+
import_react_native32.ScrollView,
|
|
3438
3450
|
{
|
|
3439
3451
|
automaticallyAdjustKeyboardInsets: isIOS && enabled,
|
|
3440
3452
|
keyboardShouldPersistTaps: "handled",
|
|
@@ -3451,12 +3463,12 @@ function KeyboardAvoidingWrapper({
|
|
|
3451
3463
|
// src/avatar/Avatar.tsx
|
|
3452
3464
|
var import_core18 = require("@onlynative/core");
|
|
3453
3465
|
var import_react20 = require("react");
|
|
3454
|
-
var
|
|
3466
|
+
var import_react_native34 = require("react-native");
|
|
3455
3467
|
|
|
3456
3468
|
// src/avatar/styles.ts
|
|
3457
|
-
var
|
|
3469
|
+
var import_react_native33 = require("react-native");
|
|
3458
3470
|
function createStyles10(theme) {
|
|
3459
|
-
return
|
|
3471
|
+
return import_react_native33.StyleSheet.create({
|
|
3460
3472
|
container: {
|
|
3461
3473
|
borderRadius: theme.shape.cornerFull,
|
|
3462
3474
|
alignItems: "center",
|
|
@@ -3551,7 +3563,7 @@ function Avatar({
|
|
|
3551
3563
|
}),
|
|
3552
3564
|
[bgColor, fgColor, theme.stateLayer]
|
|
3553
3565
|
);
|
|
3554
|
-
const content = imageUri ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3566
|
+
const content = imageUri ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native34.Image, { source: { uri: imageUri }, style: styles3.image, accessible: false }) : label && !icon ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native34.Text, { style: initialsStyle, numberOfLines: 1, allowFontScaling: false, children: initials }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3555
3567
|
MaterialCommunityIcons,
|
|
3556
3568
|
{
|
|
3557
3569
|
name: icon != null ? icon : "account",
|
|
@@ -3561,7 +3573,7 @@ function Avatar({
|
|
|
3561
3573
|
);
|
|
3562
3574
|
if (!isInteractive) {
|
|
3563
3575
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3564
|
-
|
|
3576
|
+
import_react_native34.View,
|
|
3565
3577
|
{
|
|
3566
3578
|
...props,
|
|
3567
3579
|
accessibilityLabel,
|
|
@@ -3571,7 +3583,7 @@ function Avatar({
|
|
|
3571
3583
|
);
|
|
3572
3584
|
}
|
|
3573
3585
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3574
|
-
|
|
3586
|
+
import_react_native34.Pressable,
|
|
3575
3587
|
{
|
|
3576
3588
|
...props,
|
|
3577
3589
|
accessibilityRole: "button",
|
package/dist/layout/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { PropsWithChildren } from 'react';
|
|
3
3
|
import { StyleProp, ViewStyle, ViewProps, FlexAlignType } from 'react-native';
|
|
4
|
-
import { Edge } from 'react-native-safe-area-context';
|
|
5
4
|
import { MaterialTheme } from '@onlynative/core';
|
|
6
5
|
|
|
6
|
+
type Edge = 'top' | 'right' | 'bottom' | 'left';
|
|
7
|
+
|
|
7
8
|
interface LayoutProps extends PropsWithChildren {
|
|
8
9
|
/**
|
|
9
10
|
* When `true`, removes all safe area insets for full-screen layout.
|
package/dist/layout/index.js
CHANGED
|
@@ -41,8 +41,21 @@ module.exports = __toCommonJS(layout_exports);
|
|
|
41
41
|
// src/layout/Layout.tsx
|
|
42
42
|
var import_core = require("@onlynative/core");
|
|
43
43
|
var import_react = require("react");
|
|
44
|
+
var import_react_native2 = require("react-native");
|
|
45
|
+
|
|
46
|
+
// src/safe-area.tsx
|
|
44
47
|
var import_react_native = require("react-native");
|
|
45
|
-
var
|
|
48
|
+
var SafeAreaViewComponent = import_react_native.View;
|
|
49
|
+
try {
|
|
50
|
+
const safeArea = require("react-native-safe-area-context");
|
|
51
|
+
SafeAreaViewComponent = safeArea.SafeAreaView;
|
|
52
|
+
} catch {
|
|
53
|
+
console.warn(
|
|
54
|
+
'[@onlynative/components] "react-native-safe-area-context" is not installed. Layout and AppBar will render without safe area insets. Run `npx expo install react-native-safe-area-context` to fix this.'
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// src/layout/Layout.tsx
|
|
46
59
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
47
60
|
var defaultEdges = ["bottom"];
|
|
48
61
|
function resolveEdges(immersive, edges) {
|
|
@@ -54,7 +67,7 @@ function resolveEdges(immersive, edges) {
|
|
|
54
67
|
}
|
|
55
68
|
return defaultEdges;
|
|
56
69
|
}
|
|
57
|
-
var styles =
|
|
70
|
+
var styles = import_react_native2.StyleSheet.create({
|
|
58
71
|
root: {
|
|
59
72
|
flex: 1
|
|
60
73
|
}
|
|
@@ -63,7 +76,7 @@ function removeBackgroundColor(style) {
|
|
|
63
76
|
if (!style) {
|
|
64
77
|
return void 0;
|
|
65
78
|
}
|
|
66
|
-
const flattenedStyle =
|
|
79
|
+
const flattenedStyle = import_react_native2.StyleSheet.flatten(style);
|
|
67
80
|
if (!flattenedStyle || flattenedStyle.backgroundColor === void 0) {
|
|
68
81
|
return style;
|
|
69
82
|
}
|
|
@@ -86,7 +99,7 @@ function Layout({ immersive, edges, children, style }) {
|
|
|
86
99
|
[immersive, edges]
|
|
87
100
|
);
|
|
88
101
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
89
|
-
|
|
102
|
+
SafeAreaViewComponent,
|
|
90
103
|
{
|
|
91
104
|
style: [styles.root, themeBackgroundStyle, styleWithoutBackground],
|
|
92
105
|
edges: safeAreaEdges,
|
|
@@ -98,7 +111,7 @@ function Layout({ immersive, edges, children, style }) {
|
|
|
98
111
|
// src/layout/Box.tsx
|
|
99
112
|
var import_core2 = require("@onlynative/core");
|
|
100
113
|
var import_react2 = require("react");
|
|
101
|
-
var
|
|
114
|
+
var import_react_native3 = require("react-native");
|
|
102
115
|
|
|
103
116
|
// src/layout/resolveSpacing.ts
|
|
104
117
|
function resolveSpacing(spacing, value) {
|
|
@@ -196,7 +209,7 @@ function Box({
|
|
|
196
209
|
justify,
|
|
197
210
|
bg
|
|
198
211
|
]);
|
|
199
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
212
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native3.View, { ...viewProps, style: [layoutStyle, style] });
|
|
200
213
|
}
|
|
201
214
|
|
|
202
215
|
// src/layout/Column.tsx
|
|
@@ -215,7 +228,7 @@ function Column({ inverted = false, style, ...boxProps }) {
|
|
|
215
228
|
// src/layout/Grid.tsx
|
|
216
229
|
var import_core3 = require("@onlynative/core");
|
|
217
230
|
var import_react5 = __toESM(require("react"));
|
|
218
|
-
var
|
|
231
|
+
var import_react_native4 = require("react-native");
|
|
219
232
|
|
|
220
233
|
// src/layout/Row.tsx
|
|
221
234
|
var import_react4 = require("react");
|
|
@@ -269,7 +282,7 @@ function Grid({
|
|
|
269
282
|
);
|
|
270
283
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { wrap: true, rowGap: resolvedRowGap, ...rowProps, style: [rowStyle, style], children: import_react5.default.Children.map(
|
|
271
284
|
children,
|
|
272
|
-
(child) => child != null ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
285
|
+
(child) => child != null ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native4.View, { style: cellStyle, children: child }) : null
|
|
273
286
|
) });
|
|
274
287
|
}
|
|
275
288
|
// Annotate the CommonJS export names for ESM import in node:
|
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.4
|
|
4
|
+
> Peer deps: @onlynative/core >=0.0.0-alpha.4, 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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onlynative/components",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.4",
|
|
4
4
|
"description": "Material Design 3 UI components for React Native, part of OnlyNative UI.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
],
|
|
156
156
|
"peerDependencies": {
|
|
157
157
|
"@expo/vector-icons": ">=14.0.0",
|
|
158
|
-
"@onlynative/core": ">=0.0.0-alpha.
|
|
158
|
+
"@onlynative/core": ">=0.0.0-alpha.4",
|
|
159
159
|
"react": ">=18.0.0",
|
|
160
160
|
"react-native": ">=0.72.0",
|
|
161
161
|
"react-native-safe-area-context": ">=4.0.0"
|
|
@@ -163,6 +163,9 @@
|
|
|
163
163
|
"peerDependenciesMeta": {
|
|
164
164
|
"@expo/vector-icons": {
|
|
165
165
|
"optional": true
|
|
166
|
+
},
|
|
167
|
+
"react-native-safe-area-context": {
|
|
168
|
+
"optional": true
|
|
166
169
|
}
|
|
167
170
|
},
|
|
168
171
|
"devDependencies": {
|
|
@@ -176,7 +179,7 @@
|
|
|
176
179
|
"react-test-renderer": "19.1.0",
|
|
177
180
|
"tsup": "^8.0.0",
|
|
178
181
|
"typescript": "^5.0.0",
|
|
179
|
-
"@onlynative/core": "0.0.0-alpha.
|
|
182
|
+
"@onlynative/core": "0.0.0-alpha.4",
|
|
180
183
|
"@onlynative/utils": "0.1.0-alpha.3"
|
|
181
184
|
},
|
|
182
185
|
"scripts": {
|