@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/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 OnlyNative
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/appbar/index.js
CHANGED
|
@@ -25,28 +25,9 @@ __export(appbar_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(appbar_exports);
|
|
26
26
|
|
|
27
27
|
// src/appbar/AppBar.tsx
|
|
28
|
-
var import_react3 = require("react");
|
|
29
|
-
var import_react_native8 = require("react-native");
|
|
30
|
-
var import_react_native_safe_area_context = require("react-native-safe-area-context");
|
|
31
28
|
var import_core4 = require("@onlynative/core");
|
|
32
29
|
|
|
33
|
-
// src/
|
|
34
|
-
var import_react = require("react");
|
|
35
|
-
var import_react_native5 = require("react-native");
|
|
36
|
-
var import_core = require("@onlynative/core");
|
|
37
|
-
|
|
38
|
-
// ../utils/dist/chunk-OQRDRRQA.mjs
|
|
39
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
40
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
41
|
-
}) : x)(function(x) {
|
|
42
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
43
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
// ../utils/dist/index.mjs
|
|
47
|
-
var import_react_native = require("react-native");
|
|
48
|
-
var import_react_native2 = require("react-native");
|
|
49
|
-
var import_react_native3 = require("react-native");
|
|
30
|
+
// ../utils/src/color.ts
|
|
50
31
|
function parseHexColor(color) {
|
|
51
32
|
const normalized = color.replace("#", "");
|
|
52
33
|
if (normalized.length !== 6 && normalized.length !== 8) {
|
|
@@ -89,13 +70,15 @@ function blendColor(base, overlay, overlayAlpha) {
|
|
|
89
70
|
);
|
|
90
71
|
return `rgb(${r}, ${g}, ${b})`;
|
|
91
72
|
}
|
|
73
|
+
|
|
74
|
+
// ../utils/src/icon.ts
|
|
92
75
|
var _MCIcons = null;
|
|
93
76
|
var _resolved = false;
|
|
94
77
|
function getMaterialCommunityIcons() {
|
|
95
78
|
if (!_resolved) {
|
|
96
79
|
_resolved = true;
|
|
97
80
|
try {
|
|
98
|
-
const mod =
|
|
81
|
+
const mod = require("@expo/vector-icons/MaterialCommunityIcons");
|
|
99
82
|
_MCIcons = mod.default || mod;
|
|
100
83
|
} catch {
|
|
101
84
|
_MCIcons = null;
|
|
@@ -108,17 +91,30 @@ function getMaterialCommunityIcons() {
|
|
|
108
91
|
}
|
|
109
92
|
return _MCIcons;
|
|
110
93
|
}
|
|
94
|
+
|
|
95
|
+
// ../utils/src/rtl.ts
|
|
96
|
+
var import_react_native = require("react-native");
|
|
111
97
|
function selectRTL(ltr, rtl) {
|
|
112
|
-
return
|
|
98
|
+
return import_react_native.I18nManager.isRTL ? rtl : ltr;
|
|
113
99
|
}
|
|
114
100
|
|
|
101
|
+
// src/appbar/AppBar.tsx
|
|
102
|
+
var import_react3 = require("react");
|
|
103
|
+
var import_react_native6 = require("react-native");
|
|
104
|
+
var import_react_native_safe_area_context = require("react-native-safe-area-context");
|
|
105
|
+
|
|
106
|
+
// src/icon-button/IconButton.tsx
|
|
107
|
+
var import_core = require("@onlynative/core");
|
|
108
|
+
var import_react = require("react");
|
|
109
|
+
var import_react_native3 = require("react-native");
|
|
110
|
+
|
|
115
111
|
// src/icon-button/styles.ts
|
|
116
|
-
var
|
|
112
|
+
var import_react_native2 = require("react-native");
|
|
117
113
|
function createStyles(theme) {
|
|
118
114
|
const disabledContainerColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
119
115
|
const disabledOutlineColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
120
116
|
const toggleUnselectedContainerColor = theme.colors.surfaceContainerHighest;
|
|
121
|
-
return
|
|
117
|
+
return import_react_native2.StyleSheet.create({
|
|
122
118
|
container: {
|
|
123
119
|
borderRadius: theme.shape.cornerFull,
|
|
124
120
|
alignItems: "center",
|
|
@@ -353,11 +349,13 @@ function createStyles(theme) {
|
|
|
353
349
|
borderColor: disabledContainerColor,
|
|
354
350
|
cursor: "auto"
|
|
355
351
|
},
|
|
352
|
+
// eslint-disable-next-line react-native/no-color-literals
|
|
356
353
|
disabledOutlined: {
|
|
357
354
|
backgroundColor: "transparent",
|
|
358
355
|
borderColor: disabledOutlineColor,
|
|
359
356
|
cursor: "auto"
|
|
360
357
|
},
|
|
358
|
+
// eslint-disable-next-line react-native/no-color-literals
|
|
361
359
|
disabledStandard: {
|
|
362
360
|
backgroundColor: "transparent",
|
|
363
361
|
borderColor: "transparent",
|
|
@@ -556,7 +554,7 @@ function IconButton({
|
|
|
556
554
|
};
|
|
557
555
|
}, [containerColor, resolvedIconColor, theme.stateLayer]);
|
|
558
556
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
559
|
-
|
|
557
|
+
import_react_native3.Pressable,
|
|
560
558
|
{
|
|
561
559
|
...props,
|
|
562
560
|
accessibilityRole: "button",
|
|
@@ -598,9 +596,9 @@ function IconButton({
|
|
|
598
596
|
}
|
|
599
597
|
|
|
600
598
|
// src/typography/Typography.tsx
|
|
601
|
-
var import_react2 = require("react");
|
|
602
|
-
var import_react_native6 = require("react-native");
|
|
603
599
|
var import_core2 = require("@onlynative/core");
|
|
600
|
+
var import_react2 = require("react");
|
|
601
|
+
var import_react_native4 = require("react-native");
|
|
604
602
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
605
603
|
var HEADING_VARIANTS = /* @__PURE__ */ new Set([
|
|
606
604
|
"displayLarge",
|
|
@@ -615,7 +613,7 @@ function Typography({
|
|
|
615
613
|
variant = "bodyMedium",
|
|
616
614
|
color,
|
|
617
615
|
style,
|
|
618
|
-
as: Component =
|
|
616
|
+
as: Component = import_react_native4.Text,
|
|
619
617
|
accessibilityRole,
|
|
620
618
|
...textProps
|
|
621
619
|
}) {
|
|
@@ -624,7 +622,7 @@ function Typography({
|
|
|
624
622
|
const resolvedRole = accessibilityRole != null ? accessibilityRole : HEADING_VARIANTS.has(variant) ? "header" : void 0;
|
|
625
623
|
const lineHeightFix = (0, import_react2.useMemo)(() => {
|
|
626
624
|
if (!style) return void 0;
|
|
627
|
-
const flat =
|
|
625
|
+
const flat = import_react_native4.StyleSheet.flatten(style);
|
|
628
626
|
if (!(flat == null ? void 0 : flat.fontSize) || flat.lineHeight) return void 0;
|
|
629
627
|
const ratio = typographyStyle.lineHeight / typographyStyle.fontSize;
|
|
630
628
|
return { lineHeight: Math.ceil(flat.fontSize * ratio) };
|
|
@@ -647,8 +645,8 @@ function Typography({
|
|
|
647
645
|
}
|
|
648
646
|
|
|
649
647
|
// src/appbar/styles.ts
|
|
650
|
-
var import_react_native7 = require("react-native");
|
|
651
648
|
var import_core3 = require("@onlynative/core");
|
|
649
|
+
var import_react_native5 = require("react-native");
|
|
652
650
|
function getColorSchemeColors(theme, colorScheme) {
|
|
653
651
|
switch (colorScheme) {
|
|
654
652
|
case "surfaceContainerLowest":
|
|
@@ -705,7 +703,7 @@ function getColorSchemeColors(theme, colorScheme) {
|
|
|
705
703
|
function createStyles2(theme, schemeColors) {
|
|
706
704
|
var _a;
|
|
707
705
|
const topAppBar = (_a = theme.topAppBar) != null ? _a : import_core3.defaultTopAppBarTokens;
|
|
708
|
-
return
|
|
706
|
+
return import_react_native5.StyleSheet.create({
|
|
709
707
|
root: {
|
|
710
708
|
backgroundColor: schemeColors.containerColor
|
|
711
709
|
},
|
|
@@ -794,7 +792,7 @@ function createStyles2(theme, schemeColors) {
|
|
|
794
792
|
// src/appbar/AppBar.tsx
|
|
795
793
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
796
794
|
function getBackIcon() {
|
|
797
|
-
if (
|
|
795
|
+
if (import_react_native6.Platform.OS === "ios") {
|
|
798
796
|
return selectRTL("chevron-left", "chevron-right");
|
|
799
797
|
}
|
|
800
798
|
return selectRTL("arrow-left", "arrow-right");
|
|
@@ -825,7 +823,7 @@ function withTopInset(enabled, content, style) {
|
|
|
825
823
|
if (enabled) {
|
|
826
824
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native_safe_area_context.SafeAreaView, { edges: ["top"], style, children: content });
|
|
827
825
|
}
|
|
828
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native6.View, { style, children: content });
|
|
829
827
|
}
|
|
830
828
|
function measureWidth(event) {
|
|
831
829
|
return Math.round(event.nativeEvent.layout.width);
|
|
@@ -886,7 +884,7 @@ function AppBar({
|
|
|
886
884
|
if (!canGoBack) {
|
|
887
885
|
return null;
|
|
888
886
|
}
|
|
889
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native6.View, { style: styles.iconFrame, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
890
888
|
IconButton,
|
|
891
889
|
{
|
|
892
890
|
icon: getBackIcon(),
|
|
@@ -905,8 +903,8 @@ function AppBar({
|
|
|
905
903
|
if (!actions || actions.length === 0) {
|
|
906
904
|
return null;
|
|
907
905
|
}
|
|
908
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
909
|
-
|
|
906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native6.View, { style: styles.actionsRow, children: actions.map((action, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
907
|
+
import_react_native6.View,
|
|
910
908
|
{
|
|
911
909
|
style: styles.iconFrame,
|
|
912
910
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
@@ -924,7 +922,13 @@ function AppBar({
|
|
|
924
922
|
},
|
|
925
923
|
`${String(action.icon)}-${index}`
|
|
926
924
|
)) });
|
|
927
|
-
}, [
|
|
925
|
+
}, [
|
|
926
|
+
actions,
|
|
927
|
+
resolvedContentColor,
|
|
928
|
+
styles.actionsRow,
|
|
929
|
+
styles.iconFrame,
|
|
930
|
+
trailing
|
|
931
|
+
]);
|
|
928
932
|
const onLeadingLayout = (0, import_react3.useCallback)((event) => {
|
|
929
933
|
const nextWidth = measureWidth(event);
|
|
930
934
|
setLeadingWidth((currentWidth) => {
|
|
@@ -943,9 +947,9 @@ function AppBar({
|
|
|
943
947
|
return nextWidth;
|
|
944
948
|
});
|
|
945
949
|
}, []);
|
|
946
|
-
const topRow = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
950
|
+
const topRow = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native6.View, { style: styles.topRow, children: [
|
|
947
951
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
948
|
-
|
|
952
|
+
import_react_native6.View,
|
|
949
953
|
{
|
|
950
954
|
collapsable: false,
|
|
951
955
|
onLayout: onLeadingLayout,
|
|
@@ -953,9 +957,9 @@ function AppBar({
|
|
|
953
957
|
children: leadingContent
|
|
954
958
|
}
|
|
955
959
|
),
|
|
956
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
960
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native6.View, { style: styles.topRowSpacer }),
|
|
957
961
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
958
|
-
|
|
962
|
+
import_react_native6.View,
|
|
959
963
|
{
|
|
960
964
|
collapsable: false,
|
|
961
965
|
onLayout: onActionsLayout,
|
|
@@ -977,10 +981,10 @@ function AppBar({
|
|
|
977
981
|
containerOverride
|
|
978
982
|
];
|
|
979
983
|
if (isExpanded) {
|
|
980
|
-
const content2 = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
984
|
+
const content2 = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native6.View, { style: [styles.expandedContainer, getSizeStyle2(styles, size)], children: [
|
|
981
985
|
topRow,
|
|
982
986
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
983
|
-
|
|
987
|
+
import_react_native6.View,
|
|
984
988
|
{
|
|
985
989
|
style: [
|
|
986
990
|
styles.expandedTitleContainer,
|
|
@@ -1004,11 +1008,11 @@ function AppBar({
|
|
|
1004
1008
|
}
|
|
1005
1009
|
)
|
|
1006
1010
|
] });
|
|
1007
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1011
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native6.View, { style: rootStyle, children: withTopInset(insetTop, content2, safeAreaStyle) });
|
|
1008
1012
|
}
|
|
1009
|
-
const content = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1013
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_native6.View, { style: styles.smallContainer, children: [
|
|
1010
1014
|
topRow,
|
|
1011
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1015
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native6.View, { style: [styles.overlayTitleContainer, overlayTitleInsetStyle], children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1012
1016
|
Typography,
|
|
1013
1017
|
{
|
|
1014
1018
|
...APP_BAR_TITLE_TEXT_PROPS,
|
|
@@ -1023,7 +1027,7 @@ function AppBar({
|
|
|
1023
1027
|
}
|
|
1024
1028
|
) })
|
|
1025
1029
|
] });
|
|
1026
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1030
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native6.View, { style: rootStyle, children: withTopInset(insetTop, content, safeAreaStyle) });
|
|
1027
1031
|
}
|
|
1028
1032
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1029
1033
|
0 && (module.exports = {
|
package/dist/avatar/index.js
CHANGED
|
@@ -25,22 +25,9 @@ __export(avatar_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(avatar_exports);
|
|
26
26
|
|
|
27
27
|
// src/avatar/Avatar.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;
|
|
@@ -103,10 +92,14 @@ function getMaterialCommunityIcons() {
|
|
|
103
92
|
return _MCIcons;
|
|
104
93
|
}
|
|
105
94
|
|
|
95
|
+
// src/avatar/Avatar.tsx
|
|
96
|
+
var import_react = require("react");
|
|
97
|
+
var import_react_native2 = require("react-native");
|
|
98
|
+
|
|
106
99
|
// src/avatar/styles.ts
|
|
107
|
-
var
|
|
100
|
+
var import_react_native = require("react-native");
|
|
108
101
|
function createStyles(theme) {
|
|
109
|
-
return
|
|
102
|
+
return import_react_native.StyleSheet.create({
|
|
110
103
|
container: {
|
|
111
104
|
borderRadius: theme.shape.cornerFull,
|
|
112
105
|
alignItems: "center",
|
|
@@ -201,7 +194,7 @@ function Avatar({
|
|
|
201
194
|
}),
|
|
202
195
|
[bgColor, fgColor, theme.stateLayer]
|
|
203
196
|
);
|
|
204
|
-
const content = imageUri ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
197
|
+
const content = imageUri ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.Image, { source: { uri: imageUri }, style: styles.image, accessible: false }) : label && !icon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.Text, { style: initialsStyle, numberOfLines: 1, allowFontScaling: false, children: initials }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
205
198
|
MaterialCommunityIcons,
|
|
206
199
|
{
|
|
207
200
|
name: icon != null ? icon : "account",
|
|
@@ -211,7 +204,7 @@ function Avatar({
|
|
|
211
204
|
);
|
|
212
205
|
if (!isInteractive) {
|
|
213
206
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
214
|
-
|
|
207
|
+
import_react_native2.View,
|
|
215
208
|
{
|
|
216
209
|
...props,
|
|
217
210
|
accessibilityLabel,
|
|
@@ -221,7 +214,7 @@ function Avatar({
|
|
|
221
214
|
);
|
|
222
215
|
}
|
|
223
216
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
224
|
-
|
|
217
|
+
import_react_native2.Pressable,
|
|
225
218
|
{
|
|
226
219
|
...props,
|
|
227
220
|
accessibilityRole: "button",
|
package/dist/button/index.js
CHANGED
|
@@ -25,22 +25,9 @@ __export(button_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(button_exports);
|
|
26
26
|
|
|
27
27
|
// src/button/Button.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,6 +70,9 @@ function blendColor(base, overlay, overlayAlpha) {
|
|
|
83
70
|
);
|
|
84
71
|
return `rgb(${r}, ${g}, ${b})`;
|
|
85
72
|
}
|
|
73
|
+
|
|
74
|
+
// ../utils/src/elevation.ts
|
|
75
|
+
var import_react_native = require("react-native");
|
|
86
76
|
function elevationStyle(level) {
|
|
87
77
|
if (import_react_native.Platform.OS === "web") {
|
|
88
78
|
const { shadowOffset, shadowOpacity, shadowRadius } = level;
|
|
@@ -104,13 +94,15 @@ function elevationStyle(level) {
|
|
|
104
94
|
elevation: level.elevation
|
|
105
95
|
};
|
|
106
96
|
}
|
|
97
|
+
|
|
98
|
+
// ../utils/src/icon.ts
|
|
107
99
|
var _MCIcons = null;
|
|
108
100
|
var _resolved = false;
|
|
109
101
|
function getMaterialCommunityIcons() {
|
|
110
102
|
if (!_resolved) {
|
|
111
103
|
_resolved = true;
|
|
112
104
|
try {
|
|
113
|
-
const mod =
|
|
105
|
+
const mod = require("@expo/vector-icons/MaterialCommunityIcons");
|
|
114
106
|
_MCIcons = mod.default || mod;
|
|
115
107
|
} catch {
|
|
116
108
|
_MCIcons = null;
|
|
@@ -123,6 +115,9 @@ function getMaterialCommunityIcons() {
|
|
|
123
115
|
}
|
|
124
116
|
return _MCIcons;
|
|
125
117
|
}
|
|
118
|
+
|
|
119
|
+
// ../utils/src/pressable.ts
|
|
120
|
+
var import_react_native2 = require("react-native");
|
|
126
121
|
function resolvePressableStyle(base, hovered, pressed, disabled, isDisabled, style) {
|
|
127
122
|
if (typeof style === "function") {
|
|
128
123
|
return (state) => [
|
|
@@ -146,8 +141,12 @@ function resolveColorFromStyle(...styles) {
|
|
|
146
141
|
return typeof (flattened == null ? void 0 : flattened.color) === "string" ? flattened.color : void 0;
|
|
147
142
|
}
|
|
148
143
|
|
|
149
|
-
// src/button/
|
|
144
|
+
// src/button/Button.tsx
|
|
145
|
+
var import_react = require("react");
|
|
150
146
|
var import_react_native4 = require("react-native");
|
|
147
|
+
|
|
148
|
+
// src/button/styles.ts
|
|
149
|
+
var import_react_native3 = require("react-native");
|
|
151
150
|
function getVariantColors(theme, variant) {
|
|
152
151
|
const disabledContainerColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
153
152
|
const disabledLabelColor = alphaColor(theme.colors.onSurface, 0.38);
|
|
@@ -328,7 +327,7 @@ function createStyles(theme, variant, hasLeadingIcon, hasTrailingIcon, container
|
|
|
328
327
|
const elevationLevel1 = elevationStyle(theme.elevation.level1);
|
|
329
328
|
const elevationLevel2 = elevationStyle(theme.elevation.level2);
|
|
330
329
|
const baseElevation = variant === "elevated" ? elevationLevel1 : elevationLevel0;
|
|
331
|
-
return
|
|
330
|
+
return import_react_native3.StyleSheet.create({
|
|
332
331
|
container: {
|
|
333
332
|
alignSelf: "flex-start",
|
|
334
333
|
alignItems: "center",
|
|
@@ -426,12 +425,12 @@ function Button({
|
|
|
426
425
|
[isDisabled, styles.disabledLabel, styles.label, labelStyleOverride]
|
|
427
426
|
);
|
|
428
427
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
429
|
-
|
|
428
|
+
import_react_native4.Pressable,
|
|
430
429
|
{
|
|
431
430
|
...props,
|
|
432
431
|
accessibilityRole: "button",
|
|
433
432
|
accessibilityState: { disabled: isDisabled },
|
|
434
|
-
hitSlop:
|
|
433
|
+
hitSlop: import_react_native4.Platform.OS === "web" ? void 0 : 4,
|
|
435
434
|
disabled: isDisabled,
|
|
436
435
|
style: resolvePressableStyle(
|
|
437
436
|
styles.container,
|
|
@@ -451,7 +450,7 @@ function Button({
|
|
|
451
450
|
style: styles.leadingIcon
|
|
452
451
|
}
|
|
453
452
|
) : null,
|
|
454
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
453
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native4.Text, { style: computedLabelStyle, children }),
|
|
455
454
|
trailingIcon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
456
455
|
MaterialCommunityIcons,
|
|
457
456
|
{
|
package/dist/card/index.js
CHANGED
|
@@ -25,14 +25,9 @@ __export(card_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(card_exports);
|
|
26
26
|
|
|
27
27
|
// src/card/Card.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) {
|
|
@@ -75,6 +70,9 @@ function blendColor(base, overlay, overlayAlpha) {
|
|
|
75
70
|
);
|
|
76
71
|
return `rgb(${r}, ${g}, ${b})`;
|
|
77
72
|
}
|
|
73
|
+
|
|
74
|
+
// ../utils/src/elevation.ts
|
|
75
|
+
var import_react_native = require("react-native");
|
|
78
76
|
function elevationStyle(level) {
|
|
79
77
|
if (import_react_native.Platform.OS === "web") {
|
|
80
78
|
const { shadowOffset, shadowOpacity, shadowRadius } = level;
|
|
@@ -96,6 +94,9 @@ function elevationStyle(level) {
|
|
|
96
94
|
elevation: level.elevation
|
|
97
95
|
};
|
|
98
96
|
}
|
|
97
|
+
|
|
98
|
+
// ../utils/src/pressable.ts
|
|
99
|
+
var import_react_native2 = require("react-native");
|
|
99
100
|
function resolvePressableStyle(base, hovered, pressed, disabled, isDisabled, style) {
|
|
100
101
|
if (typeof style === "function") {
|
|
101
102
|
return (state) => [
|
|
@@ -115,8 +116,12 @@ function resolvePressableStyle(base, hovered, pressed, disabled, isDisabled, sty
|
|
|
115
116
|
];
|
|
116
117
|
}
|
|
117
118
|
|
|
118
|
-
// src/card/
|
|
119
|
+
// src/card/Card.tsx
|
|
120
|
+
var import_react = require("react");
|
|
119
121
|
var import_react_native4 = require("react-native");
|
|
122
|
+
|
|
123
|
+
// src/card/styles.ts
|
|
124
|
+
var import_react_native3 = require("react-native");
|
|
120
125
|
function getVariantColors(theme, variant) {
|
|
121
126
|
const disabledContainerColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
122
127
|
const disabledOutlineColor = alphaColor(theme.colors.onSurface, 0.12);
|
|
@@ -200,7 +205,7 @@ function createStyles(theme, variant, containerColor) {
|
|
|
200
205
|
const elevationLevel1 = elevationStyle(theme.elevation.level1);
|
|
201
206
|
const elevationLevel2 = elevationStyle(theme.elevation.level2);
|
|
202
207
|
const baseElevation = variant === "elevated" ? elevationLevel1 : elevationLevel0;
|
|
203
|
-
return
|
|
208
|
+
return import_react_native3.StyleSheet.create({
|
|
204
209
|
container: {
|
|
205
210
|
borderRadius: theme.shape.cornerMedium,
|
|
206
211
|
backgroundColor: colors.backgroundColor,
|
|
@@ -250,15 +255,15 @@ function Card({
|
|
|
250
255
|
[theme, variant, containerColor]
|
|
251
256
|
);
|
|
252
257
|
if (!isInteractive) {
|
|
253
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native4.View, { ...props, style: [styles.container, style], children });
|
|
254
259
|
}
|
|
255
260
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
256
|
-
|
|
261
|
+
import_react_native4.Pressable,
|
|
257
262
|
{
|
|
258
263
|
...props,
|
|
259
264
|
role: "button",
|
|
260
265
|
accessibilityState: { disabled: isDisabled },
|
|
261
|
-
hitSlop:
|
|
266
|
+
hitSlop: import_react_native4.Platform.OS === "web" ? void 0 : 4,
|
|
262
267
|
disabled: isDisabled,
|
|
263
268
|
onPress,
|
|
264
269
|
style: resolvePressableStyle(
|
|
@@ -269,7 +274,7 @@ function Card({
|
|
|
269
274
|
isDisabled,
|
|
270
275
|
style
|
|
271
276
|
),
|
|
272
|
-
children: isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
277
|
+
children: isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native4.View, { style: styles.disabledContent, children }) : children
|
|
273
278
|
}
|
|
274
279
|
);
|
|
275
280
|
}
|
package/dist/checkbox/index.js
CHANGED
|
@@ -25,22 +25,9 @@ __export(checkbox_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(checkbox_exports);
|
|
26
26
|
|
|
27
27
|
// src/checkbox/Checkbox.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/checkbox/Checkbox.tsx
|
|
121
|
+
var import_react = require("react");
|
|
122
|
+
var import_react_native3 = require("react-native");
|
|
123
|
+
|
|
128
124
|
// src/checkbox/styles.ts
|
|
129
|
-
var
|
|
125
|
+
var import_react_native2 = require("react-native");
|
|
130
126
|
function getColors(theme, checked) {
|
|
131
127
|
const disabledOnSurface38 = alphaColor(theme.colors.onSurface, 0.38);
|
|
132
128
|
if (checked) {
|
|
@@ -202,7 +198,7 @@ function createStyles(theme, checked, containerColor, contentColor) {
|
|
|
202
198
|
);
|
|
203
199
|
const size = 18;
|
|
204
200
|
const touchTarget = 48;
|
|
205
|
-
return
|
|
201
|
+
return import_react_native2.StyleSheet.create({
|
|
206
202
|
container: {
|
|
207
203
|
width: touchTarget,
|
|
208
204
|
height: touchTarget,
|
|
@@ -277,7 +273,7 @@ function Checkbox({
|
|
|
277
273
|
}
|
|
278
274
|
};
|
|
279
275
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
280
|
-
|
|
276
|
+
import_react_native3.Pressable,
|
|
281
277
|
{
|
|
282
278
|
...props,
|
|
283
279
|
accessibilityRole: "checkbox",
|
|
@@ -285,7 +281,7 @@ function Checkbox({
|
|
|
285
281
|
disabled: isDisabled,
|
|
286
282
|
checked: isChecked
|
|
287
283
|
},
|
|
288
|
-
hitSlop:
|
|
284
|
+
hitSlop: import_react_native3.Platform.OS === "web" ? void 0 : 4,
|
|
289
285
|
disabled: isDisabled,
|
|
290
286
|
onPress: handlePress,
|
|
291
287
|
style: resolvePressableStyle(
|
|
@@ -296,7 +292,7 @@ function Checkbox({
|
|
|
296
292
|
isDisabled,
|
|
297
293
|
style
|
|
298
294
|
),
|
|
299
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
295
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native3.View, { style: [styles.box, isDisabled ? styles.disabledBox : void 0], children: isChecked ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
300
296
|
MaterialCommunityIcons,
|
|
301
297
|
{
|
|
302
298
|
name: "check",
|