@onlynative/components 0.1.0-alpha.2 → 0.1.0-alpha.3

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/index.js CHANGED
@@ -52,6 +52,7 @@ __export(index_exports, {
52
52
  module.exports = __toCommonJS(index_exports);
53
53
 
54
54
  // src/typography/Typography.tsx
55
+ var import_react = require("react");
55
56
  var import_react_native = require("react-native");
56
57
  var import_core = require("@onlynative/core");
57
58
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -75,6 +76,13 @@ function Typography({
75
76
  const theme = (0, import_core.useTheme)();
76
77
  const typographyStyle = theme.typography[variant];
77
78
  const resolvedRole = accessibilityRole != null ? accessibilityRole : HEADING_VARIANTS.has(variant) ? "header" : void 0;
79
+ const lineHeightFix = (0, import_react.useMemo)(() => {
80
+ if (!style) return void 0;
81
+ const flat = import_react_native.StyleSheet.flatten(style);
82
+ if (!(flat == null ? void 0 : flat.fontSize) || flat.lineHeight) return void 0;
83
+ const ratio = typographyStyle.lineHeight / typographyStyle.fontSize;
84
+ return { lineHeight: Math.ceil(flat.fontSize * ratio) };
85
+ }, [style, typographyStyle.fontSize, typographyStyle.lineHeight]);
78
86
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
79
87
  Component,
80
88
  {
@@ -84,6 +92,7 @@ function Typography({
84
92
  { color: theme.colors.onSurface },
85
93
  typographyStyle,
86
94
  style,
95
+ lineHeightFix,
87
96
  color != null ? { color } : void 0
88
97
  ],
89
98
  children
@@ -92,7 +101,7 @@ function Typography({
92
101
  }
93
102
 
94
103
  // src/layout/Layout.tsx
95
- var import_react = require("react");
104
+ var import_react2 = require("react");
96
105
  var import_react_native2 = require("react-native");
97
106
  var import_react_native_safe_area_context = require("react-native-safe-area-context");
98
107
  var import_core2 = require("@onlynative/core");
@@ -126,15 +135,15 @@ function removeBackgroundColor(style) {
126
135
  }
127
136
  function Layout({ immersive, edges, children, style }) {
128
137
  const theme = (0, import_core2.useTheme)();
129
- const themeBackgroundStyle = (0, import_react.useMemo)(
138
+ const themeBackgroundStyle = (0, import_react2.useMemo)(
130
139
  () => ({ backgroundColor: theme.colors.background }),
131
140
  [theme.colors.background]
132
141
  );
133
- const styleWithoutBackground = (0, import_react.useMemo)(
142
+ const styleWithoutBackground = (0, import_react2.useMemo)(
134
143
  () => removeBackgroundColor(style),
135
144
  [style]
136
145
  );
137
- const safeAreaEdges = (0, import_react.useMemo)(
146
+ const safeAreaEdges = (0, import_react2.useMemo)(
138
147
  () => resolveEdges(immersive, edges),
139
148
  [immersive, edges]
140
149
  );
@@ -149,7 +158,7 @@ function Layout({ immersive, edges, children, style }) {
149
158
  }
150
159
 
151
160
  // src/layout/Box.tsx
152
- var import_react2 = require("react");
161
+ var import_react3 = require("react");
153
162
  var import_react_native3 = require("react-native");
154
163
  var import_core3 = require("@onlynative/core");
155
164
 
@@ -188,7 +197,7 @@ function Box({
188
197
  ...viewProps
189
198
  }) {
190
199
  const { spacing } = (0, import_core3.useTheme)();
191
- const layoutStyle = (0, import_react2.useMemo)(() => {
200
+ const layoutStyle = (0, import_react3.useMemo)(() => {
192
201
  const s = (v) => resolveSpacing(spacing, v);
193
202
  return {
194
203
  ...p !== void 0 && { padding: s(p) },
@@ -253,10 +262,10 @@ function Box({
253
262
  }
254
263
 
255
264
  // src/layout/Column.tsx
256
- var import_react3 = require("react");
265
+ var import_react4 = require("react");
257
266
  var import_jsx_runtime4 = require("react/jsx-runtime");
258
267
  function Column({ inverted = false, style, ...boxProps }) {
259
- const directionStyle = (0, import_react3.useMemo)(
268
+ const directionStyle = (0, import_react4.useMemo)(
260
269
  () => ({
261
270
  flexDirection: inverted ? "column-reverse" : "column"
262
271
  }),
@@ -266,12 +275,12 @@ function Column({ inverted = false, style, ...boxProps }) {
266
275
  }
267
276
 
268
277
  // src/layout/Grid.tsx
269
- var import_react5 = __toESM(require("react"));
278
+ var import_react6 = __toESM(require("react"));
270
279
  var import_react_native4 = require("react-native");
271
280
  var import_core4 = require("@onlynative/core");
272
281
 
273
282
  // src/layout/Row.tsx
274
- var import_react4 = require("react");
283
+ var import_react5 = require("react");
275
284
  var import_jsx_runtime5 = require("react/jsx-runtime");
276
285
  function Row({
277
286
  wrap = false,
@@ -279,7 +288,7 @@ function Row({
279
288
  style,
280
289
  ...boxProps
281
290
  }) {
282
- const directionStyle = (0, import_react4.useMemo)(
291
+ const directionStyle = (0, import_react5.useMemo)(
283
292
  () => ({
284
293
  flexDirection: inverted ? "row-reverse" : "row",
285
294
  ...wrap && { flexWrap: "wrap" }
@@ -304,7 +313,7 @@ function Grid({
304
313
  const resolvedColumnGap = resolveSpacing(spacing, columnGap != null ? columnGap : gap);
305
314
  const resolvedRowGap = resolveSpacing(spacing, rowGap != null ? rowGap : gap);
306
315
  const halfGap = resolvedColumnGap ? resolvedColumnGap / 2 : 0;
307
- const cellStyle = (0, import_react5.useMemo)(
316
+ const cellStyle = (0, import_react6.useMemo)(
308
317
  () => ({
309
318
  flexBasis: `${100 / columns}%`,
310
319
  flexShrink: 1,
@@ -313,27 +322,47 @@ function Grid({
313
322
  }),
314
323
  [columns, halfGap]
315
324
  );
316
- const rowStyle = (0, import_react5.useMemo)(
325
+ const rowStyle = (0, import_react6.useMemo)(
317
326
  () => ({
318
327
  marginLeft: -halfGap,
319
328
  marginRight: -halfGap
320
329
  }),
321
330
  [halfGap]
322
331
  );
323
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { wrap: true, rowGap: resolvedRowGap, ...rowProps, style: [rowStyle, style], children: import_react5.default.Children.map(
332
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Row, { wrap: true, rowGap: resolvedRowGap, ...rowProps, style: [rowStyle, style], children: import_react6.default.Children.map(
324
333
  children,
325
334
  (child) => child != null ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native4.View, { style: cellStyle, children: child }) : null
326
335
  ) });
327
336
  }
328
337
 
329
338
  // src/button/Button.tsx
330
- var import_MaterialCommunityIcons = __toESM(require("@expo/vector-icons/MaterialCommunityIcons"));
331
- var import_react6 = require("react");
339
+ var import_react7 = require("react");
332
340
  var import_react_native7 = require("react-native");
333
341
  var import_react_native8 = require("react-native");
334
342
  var import_react_native9 = require("react-native");
335
343
  var import_core5 = require("@onlynative/core");
336
344
 
345
+ // src/utils/icon.ts
346
+ var _MCIcons = null;
347
+ var _resolved = false;
348
+ function getMaterialCommunityIcons() {
349
+ if (!_resolved) {
350
+ _resolved = true;
351
+ try {
352
+ const mod = require("@expo/vector-icons/MaterialCommunityIcons");
353
+ _MCIcons = mod.default || mod;
354
+ } catch {
355
+ _MCIcons = null;
356
+ }
357
+ }
358
+ if (!_MCIcons) {
359
+ throw new Error(
360
+ "@expo/vector-icons is required for icon support. Install it with: npx expo install @expo/vector-icons"
361
+ );
362
+ }
363
+ return _MCIcons;
364
+ }
365
+
337
366
  // src/button/styles.ts
338
367
  var import_react_native6 = require("react-native");
339
368
 
@@ -674,7 +703,7 @@ function Button({
674
703
  const hasLeading = Boolean(leadingIcon);
675
704
  const hasTrailing = Boolean(trailingIcon);
676
705
  const theme = (0, import_core5.useTheme)();
677
- const styles2 = (0, import_react6.useMemo)(
706
+ const styles2 = (0, import_react7.useMemo)(
678
707
  () => createStyles(
679
708
  theme,
680
709
  variant,
@@ -685,14 +714,15 @@ function Button({
685
714
  ),
686
715
  [theme, variant, hasLeading, hasTrailing, containerColor, contentColor]
687
716
  );
688
- const resolvedIconColor = (0, import_react6.useMemo)(() => {
717
+ const MaterialCommunityIcons = leadingIcon || trailingIcon ? getMaterialCommunityIcons() : null;
718
+ const resolvedIconColor = (0, import_react7.useMemo)(() => {
689
719
  const base = import_react_native8.StyleSheet.flatten([
690
720
  styles2.label,
691
721
  isDisabled ? styles2.disabledLabel : void 0
692
722
  ]);
693
723
  return typeof (base == null ? void 0 : base.color) === "string" ? base.color : void 0;
694
724
  }, [styles2.label, styles2.disabledLabel, isDisabled]);
695
- const computedLabelStyle = (0, import_react6.useMemo)(
725
+ const computedLabelStyle = (0, import_react7.useMemo)(
696
726
  () => [
697
727
  styles2.label,
698
728
  isDisabled ? styles2.disabledLabel : void 0,
@@ -718,7 +748,7 @@ function Button({
718
748
  ),
719
749
  children: [
720
750
  leadingIcon ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
721
- import_MaterialCommunityIcons.default,
751
+ MaterialCommunityIcons,
722
752
  {
723
753
  name: leadingIcon,
724
754
  size: iconSize,
@@ -728,7 +758,7 @@ function Button({
728
758
  ) : null,
729
759
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native9.Text, { style: computedLabelStyle, children }),
730
760
  trailingIcon ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
731
- import_MaterialCommunityIcons.default,
761
+ MaterialCommunityIcons,
732
762
  {
733
763
  name: trailingIcon,
734
764
  size: iconSize,
@@ -742,8 +772,7 @@ function Button({
742
772
  }
743
773
 
744
774
  // src/icon-button/IconButton.tsx
745
- var import_MaterialCommunityIcons2 = __toESM(require("@expo/vector-icons/MaterialCommunityIcons"));
746
- var import_react7 = require("react");
775
+ var import_react8 = require("react");
747
776
  var import_react_native11 = require("react-native");
748
777
  var import_core6 = require("@onlynative/core");
749
778
 
@@ -1155,8 +1184,9 @@ function IconButton({
1155
1184
  ...props
1156
1185
  }) {
1157
1186
  var _a;
1187
+ const MaterialCommunityIcons = getMaterialCommunityIcons();
1158
1188
  const theme = (0, import_core6.useTheme)();
1159
- const styles2 = (0, import_react7.useMemo)(() => createStyles2(theme), [theme]);
1189
+ const styles2 = (0, import_react8.useMemo)(() => createStyles2(theme), [theme]);
1160
1190
  const isDisabled = Boolean(disabled);
1161
1191
  const isToggle = selected !== void 0;
1162
1192
  const isSelected = Boolean(selected);
@@ -1164,7 +1194,7 @@ function IconButton({
1164
1194
  const displayIcon = isToggle && isSelected && selectedIcon ? selectedIcon : icon;
1165
1195
  const iconPixelSize = getIconPixelSize(size);
1166
1196
  const accessibilityState = isToggle ? { disabled: isDisabled, selected: isSelected } : { disabled: isDisabled };
1167
- const containerOverrides = (0, import_react7.useMemo)(() => {
1197
+ const containerOverrides = (0, import_react8.useMemo)(() => {
1168
1198
  if (!containerColor) return null;
1169
1199
  const overlay = resolvedIconColor;
1170
1200
  return {
@@ -1220,7 +1250,7 @@ function IconButton({
1220
1250
  return base;
1221
1251
  },
1222
1252
  children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1223
- import_MaterialCommunityIcons2.default,
1253
+ MaterialCommunityIcons,
1224
1254
  {
1225
1255
  name: displayIcon,
1226
1256
  size: iconPixelSize,
@@ -1232,7 +1262,7 @@ function IconButton({
1232
1262
  }
1233
1263
 
1234
1264
  // src/appbar/AppBar.tsx
1235
- var import_react8 = require("react");
1265
+ var import_react9 = require("react");
1236
1266
  var import_react_native14 = require("react-native");
1237
1267
  var import_react_native_safe_area_context2 = require("react-native-safe-area-context");
1238
1268
  var import_core8 = require("@onlynative/core");
@@ -1395,10 +1425,10 @@ function AppBar({
1395
1425
  var _a;
1396
1426
  const theme = (0, import_core8.useTheme)();
1397
1427
  const topAppBar = (_a = theme.topAppBar) != null ? _a : import_core8.defaultTopAppBarTokens;
1398
- const styles2 = (0, import_react8.useMemo)(() => createStyles3(theme), [theme]);
1399
- const [leadingWidth, setLeadingWidth] = (0, import_react8.useState)(0);
1400
- const [actionsWidth, setActionsWidth] = (0, import_react8.useState)(0);
1401
- const titleColorStyle = (0, import_react8.useMemo)(
1428
+ const styles2 = (0, import_react9.useMemo)(() => createStyles3(theme), [theme]);
1429
+ const [leadingWidth, setLeadingWidth] = (0, import_react9.useState)(0);
1430
+ const [actionsWidth, setActionsWidth] = (0, import_react9.useState)(0);
1431
+ const titleColorStyle = (0, import_react9.useMemo)(
1402
1432
  () => ({ color: contentColor != null ? contentColor : theme.colors.onSurface }),
1403
1433
  [contentColor, theme.colors.onSurface]
1404
1434
  );
@@ -1409,15 +1439,15 @@ function AppBar({
1409
1439
  const titleStartInset = topAppBar.horizontalPadding + Math.max(topAppBar.titleStartInset, leadingWidth);
1410
1440
  const compactTitleEndInset = topAppBar.horizontalPadding + actionsWidth;
1411
1441
  const centeredSideInset = topAppBar.horizontalPadding + Math.max(leadingWidth, actionsWidth);
1412
- const expandedTitleInsetStyle = (0, import_react8.useMemo)(
1442
+ const expandedTitleInsetStyle = (0, import_react9.useMemo)(
1413
1443
  () => ({ paddingStart: titleStartInset }),
1414
1444
  [titleStartInset]
1415
1445
  );
1416
- const overlayTitleInsetStyle = (0, import_react8.useMemo)(
1446
+ const overlayTitleInsetStyle = (0, import_react9.useMemo)(
1417
1447
  () => isCenterAligned ? { start: centeredSideInset, end: centeredSideInset } : { start: titleStartInset, end: compactTitleEndInset },
1418
1448
  [centeredSideInset, compactTitleEndInset, isCenterAligned, titleStartInset]
1419
1449
  );
1420
- const leadingContent = (0, import_react8.useMemo)(() => {
1450
+ const leadingContent = (0, import_react9.useMemo)(() => {
1421
1451
  if (leading) {
1422
1452
  return leading;
1423
1453
  }
@@ -1443,7 +1473,7 @@ function AppBar({
1443
1473
  styles2.iconFrame,
1444
1474
  theme.colors.onSurface
1445
1475
  ]);
1446
- const actionsContent = (0, import_react8.useMemo)(() => {
1476
+ const actionsContent = (0, import_react9.useMemo)(() => {
1447
1477
  if (trailing) {
1448
1478
  return trailing;
1449
1479
  }
@@ -1470,7 +1500,7 @@ function AppBar({
1470
1500
  `${String(action.icon)}-${index}`
1471
1501
  )) });
1472
1502
  }, [actions, contentColor, styles2.actionsRow, styles2.iconFrame, trailing]);
1473
- const onLeadingLayout = (0, import_react8.useCallback)((event) => {
1503
+ const onLeadingLayout = (0, import_react9.useCallback)((event) => {
1474
1504
  const nextWidth = measureWidth(event);
1475
1505
  setLeadingWidth((currentWidth) => {
1476
1506
  if (currentWidth === nextWidth) {
@@ -1479,7 +1509,7 @@ function AppBar({
1479
1509
  return nextWidth;
1480
1510
  });
1481
1511
  }, []);
1482
- const onActionsLayout = (0, import_react8.useCallback)((event) => {
1512
+ const onActionsLayout = (0, import_react9.useCallback)((event) => {
1483
1513
  const nextWidth = measureWidth(event);
1484
1514
  setActionsWidth((currentWidth) => {
1485
1515
  if (currentWidth === nextWidth) {
@@ -1572,7 +1602,7 @@ function AppBar({
1572
1602
  }
1573
1603
 
1574
1604
  // src/card/Card.tsx
1575
- var import_react9 = require("react");
1605
+ var import_react10 = require("react");
1576
1606
  var import_react_native16 = require("react-native");
1577
1607
  var import_core9 = require("@onlynative/core");
1578
1608
 
@@ -1706,7 +1736,7 @@ function Card({
1706
1736
  const isDisabled = Boolean(disabled);
1707
1737
  const isInteractive = onPress !== void 0;
1708
1738
  const theme = (0, import_core9.useTheme)();
1709
- const styles2 = (0, import_react9.useMemo)(
1739
+ const styles2 = (0, import_react10.useMemo)(
1710
1740
  () => createStyles4(theme, variant, containerColor),
1711
1741
  [theme, variant, containerColor]
1712
1742
  );
@@ -1737,8 +1767,7 @@ function Card({
1737
1767
  }
1738
1768
 
1739
1769
  // src/chip/Chip.tsx
1740
- var import_MaterialCommunityIcons3 = __toESM(require("@expo/vector-icons/MaterialCommunityIcons"));
1741
- var import_react10 = require("react");
1770
+ var import_react11 = require("react");
1742
1771
  var import_react_native18 = require("react-native");
1743
1772
  var import_core10 = require("@onlynative/core");
1744
1773
 
@@ -1968,8 +1997,10 @@ function Chip({
1968
1997
  const hasLeadingContent = Boolean(
1969
1998
  variant === "input" && avatar || leadingIcon || variant === "filter" && isSelected
1970
1999
  );
2000
+ const needsIcons = Boolean(leadingIcon) || variant === "filter" && isSelected || showCloseIcon;
2001
+ const MaterialCommunityIcons = needsIcons ? getMaterialCommunityIcons() : null;
1971
2002
  const theme = (0, import_core10.useTheme)();
1972
- const styles2 = (0, import_react10.useMemo)(
2003
+ const styles2 = (0, import_react11.useMemo)(
1973
2004
  () => createStyles5(
1974
2005
  theme,
1975
2006
  variant,
@@ -1991,14 +2022,14 @@ function Chip({
1991
2022
  contentColor
1992
2023
  ]
1993
2024
  );
1994
- const resolvedIconColor = (0, import_react10.useMemo)(() => {
2025
+ const resolvedIconColor = (0, import_react11.useMemo)(() => {
1995
2026
  const base = import_react_native18.StyleSheet.flatten([
1996
2027
  styles2.label,
1997
2028
  isDisabled ? styles2.disabledLabel : void 0
1998
2029
  ]);
1999
2030
  return typeof (base == null ? void 0 : base.color) === "string" ? base.color : void 0;
2000
2031
  }, [styles2.label, styles2.disabledLabel, isDisabled]);
2001
- const computedLabelStyle = (0, import_react10.useMemo)(
2032
+ const computedLabelStyle = (0, import_react11.useMemo)(
2002
2033
  () => [
2003
2034
  styles2.label,
2004
2035
  isDisabled ? styles2.disabledLabel : void 0,
@@ -2012,7 +2043,7 @@ function Chip({
2012
2043
  }
2013
2044
  if (leadingIcon) {
2014
2045
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2015
- import_MaterialCommunityIcons3.default,
2046
+ MaterialCommunityIcons,
2016
2047
  {
2017
2048
  name: leadingIcon,
2018
2049
  size: iconSize,
@@ -2023,7 +2054,7 @@ function Chip({
2023
2054
  }
2024
2055
  if (variant === "filter" && isSelected) {
2025
2056
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2026
- import_MaterialCommunityIcons3.default,
2057
+ MaterialCommunityIcons,
2027
2058
  {
2028
2059
  name: "check",
2029
2060
  size: iconSize,
@@ -2065,7 +2096,7 @@ function Chip({
2065
2096
  hitSlop: 4,
2066
2097
  style: styles2.closeButton,
2067
2098
  children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2068
- import_MaterialCommunityIcons3.default,
2099
+ MaterialCommunityIcons,
2069
2100
  {
2070
2101
  name: "close",
2071
2102
  size: iconSize,
@@ -2080,8 +2111,7 @@ function Chip({
2080
2111
  }
2081
2112
 
2082
2113
  // src/checkbox/Checkbox.tsx
2083
- var import_MaterialCommunityIcons4 = __toESM(require("@expo/vector-icons/MaterialCommunityIcons"));
2084
- var import_react11 = require("react");
2114
+ var import_react12 = require("react");
2085
2115
  var import_react_native20 = require("react-native");
2086
2116
  var import_core11 = require("@onlynative/core");
2087
2117
 
@@ -2236,12 +2266,13 @@ function Checkbox({
2236
2266
  }) {
2237
2267
  const isDisabled = Boolean(disabled);
2238
2268
  const isChecked = Boolean(value);
2269
+ const MaterialCommunityIcons = isChecked ? getMaterialCommunityIcons() : null;
2239
2270
  const theme = (0, import_core11.useTheme)();
2240
- const styles2 = (0, import_react11.useMemo)(
2271
+ const styles2 = (0, import_react12.useMemo)(
2241
2272
  () => createStyles6(theme, isChecked, containerColor, contentColor),
2242
2273
  [theme, isChecked, containerColor, contentColor]
2243
2274
  );
2244
- const resolvedIconColor = (0, import_react11.useMemo)(() => {
2275
+ const resolvedIconColor = (0, import_react12.useMemo)(() => {
2245
2276
  const base = import_react_native20.StyleSheet.flatten([
2246
2277
  styles2.iconColor,
2247
2278
  isDisabled ? styles2.disabledIconColor : void 0
@@ -2274,7 +2305,7 @@ function Checkbox({
2274
2305
  style
2275
2306
  ),
2276
2307
  children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_native20.View, { style: [styles2.box, isDisabled ? styles2.disabledBox : void 0], children: isChecked ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2277
- import_MaterialCommunityIcons4.default,
2308
+ MaterialCommunityIcons,
2278
2309
  {
2279
2310
  name: "check",
2280
2311
  size: 14,
@@ -2286,7 +2317,7 @@ function Checkbox({
2286
2317
  }
2287
2318
 
2288
2319
  // src/radio/Radio.tsx
2289
- var import_react12 = require("react");
2320
+ var import_react13 = require("react");
2290
2321
  var import_react_native22 = require("react-native");
2291
2322
  var import_core12 = require("@onlynative/core");
2292
2323
 
@@ -2430,7 +2461,7 @@ function Radio({
2430
2461
  const isDisabled = Boolean(disabled);
2431
2462
  const isSelected = Boolean(value);
2432
2463
  const theme = (0, import_core12.useTheme)();
2433
- const styles2 = (0, import_react12.useMemo)(
2464
+ const styles2 = (0, import_react13.useMemo)(
2434
2465
  () => createStyles7(theme, isSelected, containerColor, contentColor),
2435
2466
  [theme, isSelected, containerColor, contentColor]
2436
2467
  );
@@ -2479,8 +2510,7 @@ function Radio({
2479
2510
  }
2480
2511
 
2481
2512
  // src/switch/Switch.tsx
2482
- var import_MaterialCommunityIcons5 = __toESM(require("@expo/vector-icons/MaterialCommunityIcons"));
2483
- var import_react13 = require("react");
2513
+ var import_react14 = require("react");
2484
2514
  var import_react_native24 = require("react-native");
2485
2515
  var import_core13 = require("@onlynative/core");
2486
2516
 
@@ -2652,11 +2682,11 @@ function Switch({
2652
2682
  const isSelected = Boolean(value);
2653
2683
  const hasIcon = isSelected || Boolean(unselectedIcon);
2654
2684
  const theme = (0, import_core13.useTheme)();
2655
- const styles2 = (0, import_react13.useMemo)(
2685
+ const styles2 = (0, import_react14.useMemo)(
2656
2686
  () => createStyles8(theme, isSelected, hasIcon, containerColor, contentColor),
2657
2687
  [theme, isSelected, hasIcon, containerColor, contentColor]
2658
2688
  );
2659
- const resolvedIconColor = (0, import_react13.useMemo)(() => {
2689
+ const resolvedIconColor = (0, import_react14.useMemo)(() => {
2660
2690
  const base = import_react_native24.StyleSheet.flatten([
2661
2691
  styles2.iconColor,
2662
2692
  isDisabled ? styles2.disabledIconColor : void 0
@@ -2669,6 +2699,7 @@ function Switch({
2669
2699
  }
2670
2700
  };
2671
2701
  const iconName = isSelected ? selectedIcon : unselectedIcon;
2702
+ const MaterialCommunityIcons = iconName ? getMaterialCommunityIcons() : null;
2672
2703
  const iconSize = 16;
2673
2704
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2674
2705
  import_react_native24.Pressable,
@@ -2695,7 +2726,7 @@ function Switch({
2695
2726
  {
2696
2727
  style: [styles2.thumb, isDisabled ? styles2.disabledThumb : void 0],
2697
2728
  children: iconName ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2698
- import_MaterialCommunityIcons5.default,
2729
+ MaterialCommunityIcons,
2699
2730
  {
2700
2731
  name: iconName,
2701
2732
  size: iconSize,
@@ -2709,8 +2740,7 @@ function Switch({
2709
2740
  }
2710
2741
 
2711
2742
  // src/text-field/TextField.tsx
2712
- var import_MaterialCommunityIcons6 = __toESM(require("@expo/vector-icons/MaterialCommunityIcons"));
2713
- var import_react14 = require("react");
2743
+ var import_react15 = require("react");
2714
2744
  var import_react_native26 = require("react-native");
2715
2745
  var import_core14 = require("@onlynative/core");
2716
2746
 
@@ -2938,28 +2968,29 @@ function TextField({
2938
2968
  const isError = Boolean(error) || Boolean(errorText);
2939
2969
  const isFilled = variant === "filled";
2940
2970
  const hasLeadingIcon = Boolean(leadingIcon);
2941
- const { colors, styles: styles2 } = (0, import_react14.useMemo)(
2971
+ const MaterialCommunityIcons = leadingIcon || trailingIcon ? getMaterialCommunityIcons() : null;
2972
+ const { colors, styles: styles2 } = (0, import_react15.useMemo)(
2942
2973
  () => createStyles9(theme, variant),
2943
2974
  [theme, variant]
2944
2975
  );
2945
- const [isFocused, setIsFocused] = (0, import_react14.useState)(false);
2946
- const [internalHasText, setInternalHasText] = (0, import_react14.useState)(
2976
+ const [isFocused, setIsFocused] = (0, import_react15.useState)(false);
2977
+ const [internalHasText, setInternalHasText] = (0, import_react15.useState)(
2947
2978
  () => value !== void 0 && value !== ""
2948
2979
  );
2949
- const inputRef = (0, import_react14.useRef)(null);
2980
+ const inputRef = (0, import_react15.useRef)(null);
2950
2981
  const isControlled = value !== void 0;
2951
2982
  const hasValue = isControlled ? value !== "" : internalHasText;
2952
2983
  const isLabelFloated = isFocused || hasValue;
2953
- const labelAnimRef = (0, import_react14.useRef)(new import_react_native26.Animated.Value(isLabelFloated ? 1 : 0));
2984
+ const labelAnimRef = (0, import_react15.useRef)(new import_react_native26.Animated.Value(isLabelFloated ? 1 : 0));
2954
2985
  const labelAnim = labelAnimRef.current;
2955
- (0, import_react14.useEffect)(() => {
2986
+ (0, import_react15.useEffect)(() => {
2956
2987
  import_react_native26.Animated.timing(labelAnim, {
2957
2988
  toValue: isLabelFloated ? 1 : 0,
2958
2989
  duration: 150,
2959
2990
  useNativeDriver: import_react_native26.Platform.OS !== "web"
2960
2991
  }).start();
2961
2992
  }, [isLabelFloated, labelAnim]);
2962
- const labelScale = (0, import_react14.useMemo)(() => {
2993
+ const labelScale = (0, import_react15.useMemo)(() => {
2963
2994
  const restingScale = theme.typography.bodyLarge.fontSize / theme.typography.bodySmall.fontSize;
2964
2995
  return labelAnim.interpolate({
2965
2996
  inputRange: [0, 1],
@@ -2970,7 +3001,7 @@ function TextField({
2970
3001
  theme.typography.bodyLarge.fontSize,
2971
3002
  theme.typography.bodySmall.fontSize
2972
3003
  ]);
2973
- const labelTranslateY = (0, import_react14.useMemo)(() => {
3004
+ const labelTranslateY = (0, import_react15.useMemo)(() => {
2974
3005
  const restingTop = isFilled ? labelPositions.filledRestingTop : labelPositions.outlinedRestingTop;
2975
3006
  const floatedTop = isFilled ? labelPositions.filledFloatedTop : labelPositions.outlinedFloatedTop;
2976
3007
  const restingOffset = restingTop - floatedTop;
@@ -2981,7 +3012,7 @@ function TextField({
2981
3012
  }, [isFilled, labelAnim]);
2982
3013
  const labelStart = theme.spacing.md + (hasLeadingIcon ? ICON_WITH_GAP - theme.spacing.md : 0);
2983
3014
  const labelStaticTop = isFilled ? labelPositions.filledFloatedTop : labelPositions.outlinedFloatedTop;
2984
- const handleChangeText = (0, import_react14.useCallback)(
3015
+ const handleChangeText = (0, import_react15.useCallback)(
2985
3016
  (text) => {
2986
3017
  if (!isControlled) {
2987
3018
  setInternalHasText(text !== "");
@@ -2990,7 +3021,7 @@ function TextField({
2990
3021
  },
2991
3022
  [isControlled, onChangeText]
2992
3023
  );
2993
- const handleFocus = (0, import_react14.useCallback)(
3024
+ const handleFocus = (0, import_react15.useCallback)(
2994
3025
  (event) => {
2995
3026
  if (isDisabled) return;
2996
3027
  setIsFocused(true);
@@ -2998,14 +3029,14 @@ function TextField({
2998
3029
  },
2999
3030
  [isDisabled, onFocus]
3000
3031
  );
3001
- const handleBlur = (0, import_react14.useCallback)(
3032
+ const handleBlur = (0, import_react15.useCallback)(
3002
3033
  (event) => {
3003
3034
  setIsFocused(false);
3004
3035
  onBlur == null ? void 0 : onBlur(event);
3005
3036
  },
3006
3037
  [onBlur]
3007
3038
  );
3008
- const handleContainerPress = (0, import_react14.useCallback)(() => {
3039
+ const handleContainerPress = (0, import_react15.useCallback)(() => {
3009
3040
  var _a;
3010
3041
  if (!isDisabled) {
3011
3042
  (_a = inputRef.current) == null ? void 0 : _a.focus();
@@ -3014,7 +3045,7 @@ function TextField({
3014
3045
  const labelColor = isDisabled ? colors.disabledLabelColor : isError ? colors.errorLabelColor : isFocused ? colors.focusedLabelColor : colors.labelColor;
3015
3046
  const labelBackgroundColor = variant === "outlined" && isLabelFloated ? theme.colors.surface : "transparent";
3016
3047
  const iconColor = isDisabled ? colors.disabledIconColor : isError ? colors.errorIconColor : contentColor != null ? contentColor : colors.iconColor;
3017
- const containerStyle = (0, import_react14.useMemo)(
3048
+ const containerStyle = (0, import_react15.useMemo)(
3018
3049
  () => [
3019
3050
  styles2.container,
3020
3051
  containerColor && !isDisabled ? { backgroundColor: containerColor } : void 0,
@@ -3024,7 +3055,7 @@ function TextField({
3024
3055
  ],
3025
3056
  [styles2, isFocused, isError, isDisabled, containerColor]
3026
3057
  );
3027
- const indicatorStyle = (0, import_react14.useMemo)(
3058
+ const indicatorStyle = (0, import_react15.useMemo)(
3028
3059
  () => [
3029
3060
  styles2.indicator,
3030
3061
  isFocused && styles2.indicatorFocused,
@@ -3037,7 +3068,7 @@ function TextField({
3037
3068
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react_native26.View, { style: [styles2.root, style], children: [
3038
3069
  /* @__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: [
3039
3070
  leadingIcon ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native26.View, { style: styles2.leadingIcon, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3040
- import_MaterialCommunityIcons6.default,
3071
+ MaterialCommunityIcons,
3041
3072
  {
3042
3073
  name: leadingIcon,
3043
3074
  size: ICON_SIZE2,
@@ -3086,7 +3117,7 @@ function TextField({
3086
3117
  hitSlop: 12,
3087
3118
  style: styles2.trailingIconPressable,
3088
3119
  children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native26.View, { style: styles2.trailingIcon, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3089
- import_MaterialCommunityIcons6.default,
3120
+ MaterialCommunityIcons,
3090
3121
  {
3091
3122
  name: trailingIcon,
3092
3123
  size: ICON_SIZE2,
@@ -3132,7 +3163,7 @@ function TextField({
3132
3163
  }
3133
3164
 
3134
3165
  // src/list/List.tsx
3135
- var import_react15 = require("react");
3166
+ var import_react16 = require("react");
3136
3167
  var import_react_native28 = require("react-native");
3137
3168
  var import_core15 = require("@onlynative/core");
3138
3169
 
@@ -3251,12 +3282,12 @@ function createDividerStyles(theme, inset) {
3251
3282
  var import_jsx_runtime16 = require("react/jsx-runtime");
3252
3283
  function List({ children, style, ...props }) {
3253
3284
  const theme = (0, import_core15.useTheme)();
3254
- const styles2 = (0, import_react15.useMemo)(() => createListStyles(theme), [theme]);
3285
+ const styles2 = (0, import_react16.useMemo)(() => createListStyles(theme), [theme]);
3255
3286
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_native28.View, { ...props, style: [styles2.container, style], children });
3256
3287
  }
3257
3288
 
3258
3289
  // src/list/ListItem.tsx
3259
- var import_react16 = require("react");
3290
+ var import_react17 = require("react");
3260
3291
  var import_react_native29 = require("react-native");
3261
3292
  var import_core16 = require("@onlynative/core");
3262
3293
  var import_jsx_runtime17 = require("react/jsx-runtime");
@@ -3285,7 +3316,7 @@ function ListItem({
3285
3316
  const isInteractive = onPress !== void 0;
3286
3317
  const theme = (0, import_core16.useTheme)();
3287
3318
  const lines = getLines(supportingText, overlineText, supportingTextNumberOfLines);
3288
- const styles2 = (0, import_react16.useMemo)(
3319
+ const styles2 = (0, import_react17.useMemo)(
3289
3320
  () => createListItemStyles(theme, lines, containerColor),
3290
3321
  [theme, lines, containerColor]
3291
3322
  );
@@ -3335,7 +3366,7 @@ function ListItem({
3335
3366
  }
3336
3367
 
3337
3368
  // src/list/ListDivider.tsx
3338
- var import_react17 = require("react");
3369
+ var import_react18 = require("react");
3339
3370
  var import_react_native30 = require("react-native");
3340
3371
  var import_core17 = require("@onlynative/core");
3341
3372
  var import_jsx_runtime18 = require("react/jsx-runtime");
@@ -3345,7 +3376,7 @@ function ListDivider({
3345
3376
  ...props
3346
3377
  }) {
3347
3378
  const theme = (0, import_core17.useTheme)();
3348
- const styles2 = (0, import_react17.useMemo)(
3379
+ const styles2 = (0, import_react18.useMemo)(
3349
3380
  () => createDividerStyles(theme, inset),
3350
3381
  [theme, inset]
3351
3382
  );