@onlynative/components 0.0.0-alpha.0 → 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.
@@ -57,15 +57,11 @@ function KeyboardAvoidingWrapper({
57
57
  const subscriptions = [];
58
58
  if (onKeyboardShow) {
59
59
  const showEvent = isIOS ? "keyboardWillShow" : "keyboardDidShow";
60
- subscriptions.push(
61
- import_react_native2.Keyboard.addListener(showEvent, onKeyboardShow)
62
- );
60
+ subscriptions.push(import_react_native2.Keyboard.addListener(showEvent, onKeyboardShow));
63
61
  }
64
62
  if (onKeyboardHide) {
65
63
  const hideEvent = isIOS ? "keyboardWillHide" : "keyboardDidHide";
66
- subscriptions.push(
67
- import_react_native2.Keyboard.addListener(hideEvent, onKeyboardHide)
68
- );
64
+ subscriptions.push(import_react_native2.Keyboard.addListener(hideEvent, onKeyboardHide));
69
65
  }
70
66
  return () => {
71
67
  subscriptions.forEach((sub) => sub.remove());
@@ -39,10 +39,10 @@ __export(layout_exports, {
39
39
  module.exports = __toCommonJS(layout_exports);
40
40
 
41
41
  // src/layout/Layout.tsx
42
+ var import_core = require("@onlynative/core");
42
43
  var import_react = require("react");
43
44
  var import_react_native = require("react-native");
44
45
  var import_react_native_safe_area_context = require("react-native-safe-area-context");
45
- var import_core = require("@onlynative/core");
46
46
  var import_jsx_runtime = require("react/jsx-runtime");
47
47
  var defaultEdges = ["bottom"];
48
48
  function resolveEdges(immersive, edges) {
@@ -96,9 +96,9 @@ function Layout({ immersive, edges, children, style }) {
96
96
  }
97
97
 
98
98
  // src/layout/Box.tsx
99
+ var import_core2 = require("@onlynative/core");
99
100
  var import_react2 = require("react");
100
101
  var import_react_native2 = require("react-native");
101
- var import_core2 = require("@onlynative/core");
102
102
 
103
103
  // src/layout/resolveSpacing.ts
104
104
  function resolveSpacing(spacing, value) {
@@ -213,9 +213,9 @@ function Column({ inverted = false, style, ...boxProps }) {
213
213
  }
214
214
 
215
215
  // src/layout/Grid.tsx
216
+ var import_core3 = require("@onlynative/core");
216
217
  var import_react5 = __toESM(require("react"));
217
218
  var import_react_native3 = require("react-native");
218
- var import_core3 = require("@onlynative/core");
219
219
 
220
220
  // src/layout/Row.tsx
221
221
  var import_react4 = require("react");
@@ -27,16 +27,11 @@ __export(list_exports, {
27
27
  module.exports = __toCommonJS(list_exports);
28
28
 
29
29
  // src/list/List.tsx
30
- var import_react = require("react");
31
- var import_react_native4 = require("react-native");
32
30
  var import_core = require("@onlynative/core");
33
-
34
- // src/list/styles.ts
31
+ var import_react = require("react");
35
32
  var import_react_native3 = require("react-native");
36
33
 
37
- // ../utils/dist/index.mjs
38
- var import_react_native = require("react-native");
39
- var import_react_native2 = require("react-native");
34
+ // ../utils/src/color.ts
40
35
  function parseHexColor(color) {
41
36
  const normalized = color.replace("#", "");
42
37
  if (normalized.length !== 6 && normalized.length !== 8) {
@@ -80,7 +75,29 @@ function blendColor(base, overlay, overlayAlpha) {
80
75
  return `rgb(${r}, ${g}, ${b})`;
81
76
  }
82
77
 
78
+ // ../utils/src/pressable.ts
79
+ var import_react_native = require("react-native");
80
+ function resolvePressableStyle(base, hovered, pressed, disabled, isDisabled, style) {
81
+ if (typeof style === "function") {
82
+ return (state) => [
83
+ base,
84
+ state.hovered && !state.pressed && !isDisabled ? hovered : void 0,
85
+ state.pressed && !isDisabled ? pressed : void 0,
86
+ isDisabled ? disabled : void 0,
87
+ style(state)
88
+ ];
89
+ }
90
+ return (state) => [
91
+ base,
92
+ state.hovered && !state.pressed && !isDisabled ? hovered : void 0,
93
+ state.pressed && !isDisabled ? pressed : void 0,
94
+ isDisabled ? disabled : void 0,
95
+ style
96
+ ];
97
+ }
98
+
83
99
  // src/list/styles.ts
100
+ var import_react_native2 = require("react-native");
84
101
  var ITEM_PADDING_VERTICAL = 12;
85
102
  var INSET_START = 56;
86
103
  var MIN_HEIGHT = {
@@ -89,7 +106,7 @@ var MIN_HEIGHT = {
89
106
  3: 88
90
107
  };
91
108
  function createListStyles(theme) {
92
- return import_react_native3.StyleSheet.create({
109
+ return import_react_native2.StyleSheet.create({
93
110
  container: {
94
111
  paddingVertical: theme.spacing.sm
95
112
  }
@@ -126,7 +143,7 @@ function getItemColors(theme, containerColor) {
126
143
  }
127
144
  function createListItemStyles(theme, lines, containerColor) {
128
145
  const colors = getItemColors(theme, containerColor);
129
- return import_react_native3.StyleSheet.create({
146
+ return import_react_native2.StyleSheet.create({
130
147
  container: {
131
148
  flexDirection: "row",
132
149
  alignItems: lines === 3 ? "flex-start" : "center",
@@ -181,7 +198,7 @@ function createListItemStyles(theme, lines, containerColor) {
181
198
  });
182
199
  }
183
200
  function createDividerStyles(theme, inset) {
184
- return import_react_native3.StyleSheet.create({
201
+ return import_react_native2.StyleSheet.create({
185
202
  divider: {
186
203
  height: 1,
187
204
  backgroundColor: theme.colors.outlineVariant,
@@ -195,13 +212,13 @@ var import_jsx_runtime = require("react/jsx-runtime");
195
212
  function List({ children, style, ...props }) {
196
213
  const theme = (0, import_core.useTheme)();
197
214
  const styles = (0, import_react.useMemo)(() => createListStyles(theme), [theme]);
198
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native4.View, { ...props, style: [styles.container, style], children });
215
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native3.View, { ...props, style: [styles.container, style], children });
199
216
  }
200
217
 
201
218
  // src/list/ListItem.tsx
202
- var import_react2 = require("react");
203
- var import_react_native5 = require("react-native");
204
219
  var import_core2 = require("@onlynative/core");
220
+ var import_react2 = require("react");
221
+ var import_react_native4 = require("react-native");
205
222
  var import_jsx_runtime2 = require("react/jsx-runtime");
206
223
  function getLines(supportingText, overlineText, supportingTextNumberOfLines) {
207
224
  if (supportingText && overlineText || supportingText && supportingTextNumberOfLines && supportingTextNumberOfLines > 1) {
@@ -227,18 +244,22 @@ function ListItem({
227
244
  const isDisabled = Boolean(disabled);
228
245
  const isInteractive = onPress !== void 0;
229
246
  const theme = (0, import_core2.useTheme)();
230
- const lines = getLines(supportingText, overlineText, supportingTextNumberOfLines);
247
+ const lines = getLines(
248
+ supportingText,
249
+ overlineText,
250
+ supportingTextNumberOfLines
251
+ );
231
252
  const styles = (0, import_react2.useMemo)(
232
253
  () => createListItemStyles(theme, lines, containerColor),
233
254
  [theme, lines, containerColor]
234
255
  );
235
256
  const content = /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
236
- leadingContent != null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native5.View, { style: styles.leadingContent, children: leadingContent }),
237
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native5.View, { style: styles.textBlock, children: [
238
- overlineText != null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native5.Text, { style: styles.overlineText, numberOfLines: 1, children: overlineText }),
239
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native5.Text, { style: styles.headlineText, numberOfLines: 1, children: headlineText }),
257
+ leadingContent != null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native4.View, { style: styles.leadingContent, children: leadingContent }),
258
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native4.View, { style: styles.textBlock, children: [
259
+ overlineText != null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native4.Text, { style: styles.overlineText, numberOfLines: 1, children: overlineText }),
260
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native4.Text, { style: styles.headlineText, numberOfLines: 1, children: headlineText }),
240
261
  supportingText != null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
241
- import_react_native5.Text,
262
+ import_react_native4.Text,
242
263
  {
243
264
  style: styles.supportingText,
244
265
  numberOfLines: supportingTextNumberOfLines,
@@ -246,41 +267,40 @@ function ListItem({
246
267
  }
247
268
  )
248
269
  ] }),
249
- (trailingContent != null || trailingSupportingText != null) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native5.View, { style: styles.trailingBlock, children: [
250
- trailingSupportingText != null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native5.Text, { style: styles.trailingSupportingText, numberOfLines: 1, children: trailingSupportingText }),
270
+ (trailingContent != null || trailingSupportingText != null) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_native4.View, { style: styles.trailingBlock, children: [
271
+ trailingSupportingText != null && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native4.Text, { style: styles.trailingSupportingText, numberOfLines: 1, children: trailingSupportingText }),
251
272
  trailingContent
252
273
  ] })
253
274
  ] });
254
275
  if (!isInteractive) {
255
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native5.View, { ...props, style: [styles.container, style], children: content });
276
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native4.View, { ...props, style: [styles.container, style], children: content });
256
277
  }
257
- const resolvedStyle = (state) => [
258
- styles.container,
259
- styles.interactiveContainer,
260
- state.hovered && !state.pressed && !isDisabled ? styles.hoveredContainer : void 0,
261
- state.pressed && !isDisabled ? styles.pressedContainer : void 0,
262
- isDisabled ? styles.disabledContainer : void 0,
263
- typeof style === "function" ? style(state) : style
264
- ];
265
278
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
266
- import_react_native5.Pressable,
279
+ import_react_native4.Pressable,
267
280
  {
268
281
  ...props,
269
282
  role: "button",
270
283
  accessibilityState: { disabled: isDisabled },
271
- hitSlop: import_react_native5.Platform.OS === "web" ? void 0 : 4,
284
+ hitSlop: import_react_native4.Platform.OS === "web" ? void 0 : 4,
272
285
  disabled: isDisabled,
273
286
  onPress,
274
- style: resolvedStyle,
275
- children: isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native5.View, { style: styles.disabledContentWrapper, children: content }) : content
287
+ style: resolvePressableStyle(
288
+ [styles.container, styles.interactiveContainer],
289
+ styles.hoveredContainer,
290
+ styles.pressedContainer,
291
+ styles.disabledContainer,
292
+ isDisabled,
293
+ style
294
+ ),
295
+ children: isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native4.View, { style: styles.disabledContentWrapper, children: content }) : content
276
296
  }
277
297
  );
278
298
  }
279
299
 
280
300
  // src/list/ListDivider.tsx
281
- var import_react3 = require("react");
282
- var import_react_native6 = require("react-native");
283
301
  var import_core3 = require("@onlynative/core");
302
+ var import_react3 = require("react");
303
+ var import_react_native5 = require("react-native");
284
304
  var import_jsx_runtime3 = require("react/jsx-runtime");
285
305
  function ListDivider({
286
306
  inset = false,
@@ -292,7 +312,7 @@ function ListDivider({
292
312
  () => createDividerStyles(theme, inset),
293
313
  [theme, inset]
294
314
  );
295
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native6.View, { ...props, style: [styles.divider, style] });
315
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_native5.View, { ...props, style: [styles.divider, style] });
296
316
  }
297
317
  // Annotate the CommonJS export names for ESM import in node:
298
318
  0 && (module.exports = {
@@ -25,16 +25,9 @@ __export(radio_exports, {
25
25
  module.exports = __toCommonJS(radio_exports);
26
26
 
27
27
  // src/radio/Radio.tsx
28
- var import_react = require("react");
29
- var import_react_native4 = require("react-native");
30
28
  var import_core = require("@onlynative/core");
31
29
 
32
- // src/radio/styles.ts
33
- var import_react_native3 = require("react-native");
34
-
35
- // ../utils/dist/index.mjs
36
- var import_react_native = require("react-native");
37
- var import_react_native2 = require("react-native");
30
+ // ../utils/src/color.ts
38
31
  function parseHexColor(color) {
39
32
  const normalized = color.replace("#", "");
40
33
  if (normalized.length !== 6 && normalized.length !== 8) {
@@ -60,7 +53,33 @@ function alphaColor(color, alpha) {
60
53
  return `rgba(${channels.r}, ${channels.g}, ${channels.b}, ${boundedAlpha})`;
61
54
  }
62
55
 
56
+ // ../utils/src/pressable.ts
57
+ var import_react_native = require("react-native");
58
+ function resolvePressableStyle(base, hovered, pressed, disabled, isDisabled, style) {
59
+ if (typeof style === "function") {
60
+ return (state) => [
61
+ base,
62
+ state.hovered && !state.pressed && !isDisabled ? hovered : void 0,
63
+ state.pressed && !isDisabled ? pressed : void 0,
64
+ isDisabled ? disabled : void 0,
65
+ style(state)
66
+ ];
67
+ }
68
+ return (state) => [
69
+ base,
70
+ state.hovered && !state.pressed && !isDisabled ? hovered : void 0,
71
+ state.pressed && !isDisabled ? pressed : void 0,
72
+ isDisabled ? disabled : void 0,
73
+ style
74
+ ];
75
+ }
76
+
77
+ // src/radio/Radio.tsx
78
+ var import_react = require("react");
79
+ var import_react_native3 = require("react-native");
80
+
63
81
  // src/radio/styles.ts
82
+ var import_react_native2 = require("react-native");
64
83
  function getColors(theme, selected) {
65
84
  const disabledOnSurface38 = alphaColor(theme.colors.onSurface, 0.38);
66
85
  if (selected) {
@@ -124,7 +143,7 @@ function createStyles(theme, selected, containerColor, contentColor) {
124
143
  const outerSize = 20;
125
144
  const innerSize = 10;
126
145
  const touchTarget = 48;
127
- return import_react_native3.StyleSheet.create({
146
+ return import_react_native2.StyleSheet.create({
128
147
  container: {
129
148
  width: touchTarget,
130
149
  height: touchTarget,
@@ -169,24 +188,6 @@ function createStyles(theme, selected, containerColor, contentColor) {
169
188
 
170
189
  // src/radio/Radio.tsx
171
190
  var import_jsx_runtime = require("react/jsx-runtime");
172
- function resolveStyle(containerStyle, hoveredContainerStyle, pressedContainerStyle, disabledContainerStyle, disabled, style) {
173
- if (typeof style === "function") {
174
- return (state) => [
175
- containerStyle,
176
- state.hovered && !state.pressed && !disabled ? hoveredContainerStyle : void 0,
177
- state.pressed && !disabled ? pressedContainerStyle : void 0,
178
- disabled ? disabledContainerStyle : void 0,
179
- style(state)
180
- ];
181
- }
182
- return (state) => [
183
- containerStyle,
184
- state.hovered && !state.pressed && !disabled ? hoveredContainerStyle : void 0,
185
- state.pressed && !disabled ? pressedContainerStyle : void 0,
186
- disabled ? disabledContainerStyle : void 0,
187
- style
188
- ];
189
- }
190
191
  function Radio({
191
192
  style,
192
193
  value = false,
@@ -209,7 +210,7 @@ function Radio({
209
210
  }
210
211
  };
211
212
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
212
- import_react_native4.Pressable,
213
+ import_react_native3.Pressable,
213
214
  {
214
215
  ...props,
215
216
  accessibilityRole: "radio",
@@ -217,10 +218,10 @@ function Radio({
217
218
  disabled: isDisabled,
218
219
  checked: isSelected
219
220
  },
220
- hitSlop: import_react_native4.Platform.OS === "web" ? void 0 : 4,
221
+ hitSlop: import_react_native3.Platform.OS === "web" ? void 0 : 4,
221
222
  disabled: isDisabled,
222
223
  onPress: handlePress,
223
- style: resolveStyle(
224
+ style: resolvePressableStyle(
224
225
  styles.container,
225
226
  styles.hoveredContainer,
226
227
  styles.pressedContainer,
@@ -229,11 +230,11 @@ function Radio({
229
230
  style
230
231
  ),
231
232
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
232
- import_react_native4.View,
233
+ import_react_native3.View,
233
234
  {
234
235
  style: [styles.outer, isDisabled ? styles.disabledOuter : void 0],
235
236
  children: isSelected ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
236
- import_react_native4.View,
237
+ import_react_native3.View,
237
238
  {
238
239
  style: [
239
240
  styles.inner,
@@ -25,21 +25,9 @@ __export(switch_exports, {
25
25
  module.exports = __toCommonJS(switch_exports);
26
26
 
27
27
  // src/switch/Switch.tsx
28
- var import_react = require("react");
29
- var import_react_native4 = require("react-native");
30
28
  var import_core = require("@onlynative/core");
31
29
 
32
- // ../utils/dist/chunk-OQRDRRQA.mjs
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");
30
+ // ../utils/src/color.ts
43
31
  function parseHexColor(color) {
44
32
  const normalized = color.replace("#", "");
45
33
  if (normalized.length !== 6 && normalized.length !== 8) {
@@ -82,13 +70,15 @@ function blendColor(base, overlay, overlayAlpha) {
82
70
  );
83
71
  return `rgb(${r}, ${g}, ${b})`;
84
72
  }
73
+
74
+ // ../utils/src/icon.ts
85
75
  var _MCIcons = null;
86
76
  var _resolved = false;
87
77
  function getMaterialCommunityIcons() {
88
78
  if (!_resolved) {
89
79
  _resolved = true;
90
80
  try {
91
- const mod = __require("@expo/vector-icons/MaterialCommunityIcons");
81
+ const mod = require("@expo/vector-icons/MaterialCommunityIcons");
92
82
  _MCIcons = mod.default || mod;
93
83
  } catch {
94
84
  _MCIcons = null;
@@ -102,8 +92,37 @@ function getMaterialCommunityIcons() {
102
92
  return _MCIcons;
103
93
  }
104
94
 
105
- // src/switch/styles.ts
95
+ // ../utils/src/pressable.ts
96
+ var import_react_native = require("react-native");
97
+ function resolvePressableStyle(base, hovered, pressed, disabled, isDisabled, style) {
98
+ if (typeof style === "function") {
99
+ return (state) => [
100
+ base,
101
+ state.hovered && !state.pressed && !isDisabled ? hovered : void 0,
102
+ state.pressed && !isDisabled ? pressed : void 0,
103
+ isDisabled ? disabled : void 0,
104
+ style(state)
105
+ ];
106
+ }
107
+ return (state) => [
108
+ base,
109
+ state.hovered && !state.pressed && !isDisabled ? hovered : void 0,
110
+ state.pressed && !isDisabled ? pressed : void 0,
111
+ isDisabled ? disabled : void 0,
112
+ style
113
+ ];
114
+ }
115
+ function resolveColorFromStyle(...styles) {
116
+ const flattened = import_react_native.StyleSheet.flatten(styles);
117
+ return typeof (flattened == null ? void 0 : flattened.color) === "string" ? flattened.color : void 0;
118
+ }
119
+
120
+ // src/switch/Switch.tsx
121
+ var import_react = require("react");
106
122
  var import_react_native3 = require("react-native");
123
+
124
+ // src/switch/styles.ts
125
+ var import_react_native2 = require("react-native");
107
126
  function getColors(theme, selected) {
108
127
  const disabledOnSurface12 = alphaColor(theme.colors.onSurface, 0.12);
109
128
  const disabledOnSurface38 = alphaColor(theme.colors.onSurface, 0.38);
@@ -191,7 +210,7 @@ function createStyles(theme, selected, hasIcon, containerColor, contentColor) {
191
210
  const trackHeight = 32;
192
211
  const trackPadding = 4;
193
212
  const thumbOffset = selected ? trackWidth - trackPadding - thumbSize : trackPadding;
194
- return import_react_native3.StyleSheet.create({
213
+ return import_react_native2.StyleSheet.create({
195
214
  track: {
196
215
  width: trackWidth,
197
216
  height: trackHeight,
@@ -237,24 +256,6 @@ function createStyles(theme, selected, hasIcon, containerColor, contentColor) {
237
256
 
238
257
  // src/switch/Switch.tsx
239
258
  var import_jsx_runtime = require("react/jsx-runtime");
240
- function resolveStyle(trackStyle, hoveredTrackStyle, pressedTrackStyle, disabledTrackStyle, disabled, style) {
241
- if (typeof style === "function") {
242
- return (state) => [
243
- trackStyle,
244
- state.hovered && !state.pressed && !disabled ? hoveredTrackStyle : void 0,
245
- state.pressed && !disabled ? pressedTrackStyle : void 0,
246
- disabled ? disabledTrackStyle : void 0,
247
- style(state)
248
- ];
249
- }
250
- return (state) => [
251
- trackStyle,
252
- state.hovered && !state.pressed && !disabled ? hoveredTrackStyle : void 0,
253
- state.pressed && !disabled ? pressedTrackStyle : void 0,
254
- disabled ? disabledTrackStyle : void 0,
255
- style
256
- ];
257
- }
258
259
  function Switch({
259
260
  style,
260
261
  value = false,
@@ -274,13 +275,13 @@ function Switch({
274
275
  () => createStyles(theme, isSelected, hasIcon, containerColor, contentColor),
275
276
  [theme, isSelected, hasIcon, containerColor, contentColor]
276
277
  );
277
- const resolvedIconColor = (0, import_react.useMemo)(() => {
278
- const base = import_react_native4.StyleSheet.flatten([
278
+ const resolvedIconColor = (0, import_react.useMemo)(
279
+ () => resolveColorFromStyle(
279
280
  styles.iconColor,
280
281
  isDisabled ? styles.disabledIconColor : void 0
281
- ]);
282
- return typeof (base == null ? void 0 : base.color) === "string" ? base.color : void 0;
283
- }, [styles.iconColor, styles.disabledIconColor, isDisabled]);
282
+ ),
283
+ [styles.iconColor, styles.disabledIconColor, isDisabled]
284
+ );
284
285
  const handlePress = () => {
285
286
  if (!isDisabled) {
286
287
  onValueChange == null ? void 0 : onValueChange(!isSelected);
@@ -290,7 +291,7 @@ function Switch({
290
291
  const MaterialCommunityIcons = iconName ? getMaterialCommunityIcons() : null;
291
292
  const iconSize = 16;
292
293
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
293
- import_react_native4.Pressable,
294
+ import_react_native3.Pressable,
294
295
  {
295
296
  ...props,
296
297
  accessibilityRole: "switch",
@@ -298,10 +299,10 @@ function Switch({
298
299
  disabled: isDisabled,
299
300
  checked: isSelected
300
301
  },
301
- hitSlop: import_react_native4.Platform.OS === "web" ? void 0 : 4,
302
+ hitSlop: import_react_native3.Platform.OS === "web" ? void 0 : 4,
302
303
  disabled: isDisabled,
303
304
  onPress: handlePress,
304
- style: resolveStyle(
305
+ style: resolvePressableStyle(
305
306
  styles.track,
306
307
  styles.hoveredTrack,
307
308
  styles.pressedTrack,
@@ -310,7 +311,7 @@ function Switch({
310
311
  style
311
312
  ),
312
313
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
313
- import_react_native4.View,
314
+ import_react_native3.View,
314
315
  {
315
316
  style: [styles.thumb, isDisabled ? styles.disabledThumb : void 0],
316
317
  children: iconName ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -25,21 +25,9 @@ __export(text_field_exports, {
25
25
  module.exports = __toCommonJS(text_field_exports);
26
26
 
27
27
  // src/text-field/TextField.tsx
28
- var import_react = require("react");
29
- var import_react_native4 = require("react-native");
30
28
  var import_core = require("@onlynative/core");
31
29
 
32
- // ../utils/dist/chunk-OQRDRRQA.mjs
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");
30
+ // ../utils/src/color.ts
43
31
  function parseHexColor(color) {
44
32
  const normalized = color.replace("#", "");
45
33
  if (normalized.length !== 6 && normalized.length !== 8) {
@@ -64,13 +52,15 @@ function alphaColor(color, alpha) {
64
52
  }
65
53
  return `rgba(${channels.r}, ${channels.g}, ${channels.b}, ${boundedAlpha})`;
66
54
  }
55
+
56
+ // ../utils/src/icon.ts
67
57
  var _MCIcons = null;
68
58
  var _resolved = false;
69
59
  function getMaterialCommunityIcons() {
70
60
  if (!_resolved) {
71
61
  _resolved = true;
72
62
  try {
73
- const mod = __require("@expo/vector-icons/MaterialCommunityIcons");
63
+ const mod = require("@expo/vector-icons/MaterialCommunityIcons");
74
64
  _MCIcons = mod.default || mod;
75
65
  } catch {
76
66
  _MCIcons = null;
@@ -83,12 +73,19 @@ function getMaterialCommunityIcons() {
83
73
  }
84
74
  return _MCIcons;
85
75
  }
76
+
77
+ // ../utils/src/rtl.ts
78
+ var import_react_native = require("react-native");
86
79
  function transformOrigin(vertical = "top") {
87
- return import_react_native2.I18nManager.isRTL ? `right ${vertical}` : `left ${vertical}`;
80
+ return import_react_native.I18nManager.isRTL ? `right ${vertical}` : `left ${vertical}`;
88
81
  }
89
82
 
90
- // src/text-field/styles.ts
83
+ // src/text-field/TextField.tsx
84
+ var import_react = require("react");
91
85
  var import_react_native3 = require("react-native");
86
+
87
+ // src/text-field/styles.ts
88
+ var import_react_native2 = require("react-native");
92
89
  var CONTAINER_HEIGHT = 56;
93
90
  var ICON_SIZE = 24;
94
91
  var LABEL_FLOATED_LINE_HEIGHT = 16;
@@ -147,7 +144,7 @@ function createStyles(theme, variant) {
147
144
  const isFilled = variant === "filled";
148
145
  return {
149
146
  colors,
150
- styles: import_react_native3.StyleSheet.create({
147
+ styles: import_react_native2.StyleSheet.create({
151
148
  root: {
152
149
  alignSelf: "stretch"
153
150
  },
@@ -324,13 +321,13 @@ function TextField({
324
321
  const isControlled = value !== void 0;
325
322
  const hasValue = isControlled ? value !== "" : internalHasText;
326
323
  const isLabelFloated = isFocused || hasValue;
327
- const labelAnimRef = (0, import_react.useRef)(new import_react_native4.Animated.Value(isLabelFloated ? 1 : 0));
324
+ const labelAnimRef = (0, import_react.useRef)(new import_react_native3.Animated.Value(isLabelFloated ? 1 : 0));
328
325
  const labelAnim = labelAnimRef.current;
329
326
  (0, import_react.useEffect)(() => {
330
- import_react_native4.Animated.timing(labelAnim, {
327
+ import_react_native3.Animated.timing(labelAnim, {
331
328
  toValue: isLabelFloated ? 1 : 0,
332
329
  duration: 150,
333
- useNativeDriver: import_react_native4.Platform.OS !== "web"
330
+ useNativeDriver: import_react_native3.Platform.OS !== "web"
334
331
  }).start();
335
332
  }, [isLabelFloated, labelAnim]);
336
333
  const labelScale = (0, import_react.useMemo)(() => {
@@ -408,9 +405,9 @@ function TextField({
408
405
  [styles, isFocused, isError, isDisabled]
409
406
  );
410
407
  const displaySupportingText = isError ? errorText : supportingText;
411
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_native4.View, { style: [styles.root, style], children: [
412
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native4.Pressable, { onPress: handleContainerPress, disabled: isDisabled, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_native4.View, { style: containerStyle, children: [
413
- leadingIcon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native4.View, { style: styles.leadingIcon, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
408
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_native3.View, { style: [styles.root, style], children: [
409
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native3.Pressable, { onPress: handleContainerPress, disabled: isDisabled, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_native3.View, { style: containerStyle, children: [
410
+ leadingIcon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native3.View, { style: styles.leadingIcon, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
414
411
  MaterialCommunityIcons,
415
412
  {
416
413
  name: leadingIcon,
@@ -419,14 +416,14 @@ function TextField({
419
416
  }
420
417
  ) }) : null,
421
418
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
422
- import_react_native4.View,
419
+ import_react_native3.View,
423
420
  {
424
421
  style: [
425
422
  styles.inputWrapper,
426
423
  label ? styles.inputWrapperWithLabel : void 0
427
424
  ],
428
425
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
429
- import_react_native4.TextInput,
426
+ import_react_native3.TextInput,
430
427
  {
431
428
  ref: inputRef,
432
429
  ...textInputProps,
@@ -452,14 +449,14 @@ function TextField({
452
449
  }
453
450
  ),
454
451
  trailingIcon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
455
- import_react_native4.Pressable,
452
+ import_react_native3.Pressable,
456
453
  {
457
454
  onPress: onTrailingIconPress,
458
455
  disabled: isDisabled || !onTrailingIconPress,
459
456
  accessibilityRole: "button",
460
457
  hitSlop: 12,
461
458
  style: styles.trailingIconPressable,
462
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native4.View, { style: styles.trailingIcon, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
459
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native3.View, { style: styles.trailingIcon, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
463
460
  MaterialCommunityIcons,
464
461
  {
465
462
  name: trailingIcon,
@@ -470,7 +467,7 @@ function TextField({
470
467
  }
471
468
  ) : null,
472
469
  label ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
473
- import_react_native4.Animated.Text,
470
+ import_react_native3.Animated.Text,
474
471
  {
475
472
  numberOfLines: 1,
476
473
  style: [
@@ -490,10 +487,10 @@ function TextField({
490
487
  children: label
491
488
  }
492
489
  ) : null,
493
- isFilled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native4.View, { style: indicatorStyle }) : null
490
+ isFilled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native3.View, { style: indicatorStyle }) : null
494
491
  ] }) }),
495
- displaySupportingText ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native4.View, { style: styles.supportingTextRow, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
496
- import_react_native4.Text,
492
+ displaySupportingText ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native3.View, { style: styles.supportingTextRow, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
493
+ import_react_native3.Text,
497
494
  {
498
495
  style: [
499
496
  styles.supportingText,