@atlure/ui 0.12.2 → 0.12.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlure/ui",
3
- "version": "0.12.2",
3
+ "version": "0.12.4",
4
4
  "description": "Atlure React Native component library: NativeWind primitives built on @atlure/tokens, shipped as untranspiled TypeScript source",
5
5
  "license": "MIT",
6
6
  "author": "David Moreira",
@@ -37,9 +37,9 @@
37
37
  "class-variance-authority": "0.7.1",
38
38
  "clsx": "2.1.1",
39
39
  "tailwind-merge": "2.6.0",
40
- "@atlure/icons": "0.12.2",
41
- "@atlure/tokens": "0.12.2",
42
- "@atlure/types": "0.12.2"
40
+ "@atlure/icons": "0.12.4",
41
+ "@atlure/tokens": "0.12.4",
42
+ "@atlure/types": "0.12.4"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "nativewind": "^4.2.6",
@@ -4,8 +4,8 @@ import { Platform, TextInput, type TextInputProps, View } from "react-native";
4
4
  import { cn } from "../../lib/cn";
5
5
  import { touchTargetHitSlop } from "../../lib/touch-target";
6
6
  import {
7
- inputFieldWrapperClassName,
8
7
  inputIconSlotVariants,
8
+ inputTextClassName,
9
9
  inputVariants,
10
10
  type InputVariantProps,
11
11
  } from "../../variants/input-variants";
@@ -22,7 +22,7 @@ export interface InputProps extends Omit<TextInputProps, "editable" | "multiline
22
22
  ref?: Ref<ComponentRef<typeof TextInput>>;
23
23
  }
24
24
 
25
- const SINGLE_LINE_VERTICAL_FIX =
25
+ const TEXT_INPUT_RESET =
26
26
  Platform.OS === "android"
27
27
  ? { paddingTop: 0, paddingBottom: 0, includeFontPadding: false as const }
28
28
  : { paddingTop: 0, paddingBottom: 0 };
@@ -45,22 +45,8 @@ export function Input({
45
45
  const isControlInvalid = isInvalid ?? field?.isInvalid ?? false;
46
46
  const isControlRequired = isRequired ?? field?.isRequired ?? false;
47
47
 
48
- const verticalFix = isMultiline ? null : SINGLE_LINE_VERTICAL_FIX;
49
-
50
- const control = (
51
- <TextInput
52
- accessibilityState={{ disabled: isControlDisabled }}
53
- accessibilityLabelledBy={field?.labelledBy}
54
- aria-labelledby={field?.labelledBy}
55
- aria-describedby={field?.describedBy}
56
- aria-disabled={isControlDisabled}
57
- aria-invalid={isControlInvalid}
58
- aria-required={isControlRequired}
59
- nativeID={nativeID ?? field?.nativeID}
60
- editable={!isControlDisabled}
61
- multiline={isMultiline}
62
- textAlignVertical={isMultiline ? "top" : "center"}
63
- hitSlop={touchTargetHitSlop(size)}
48
+ return (
49
+ <View
64
50
  className={cn(
65
51
  inputVariants({
66
52
  size,
@@ -72,21 +58,27 @@ export function Input({
72
58
  }),
73
59
  className,
74
60
  )}
75
- style={verticalFix ? [verticalFix, style] : style}
76
- {...textInputProps}
77
- />
78
- );
79
-
80
- if (!leadingIcon && !trailingIcon) {
81
- return control;
82
- }
83
-
84
- return (
85
- <View className={inputFieldWrapperClassName}>
61
+ >
86
62
  {leadingIcon ? (
87
63
  <View className={inputIconSlotVariants({ slot: "leading" })}>{leadingIcon}</View>
88
64
  ) : null}
89
- {control}
65
+ <TextInput
66
+ accessibilityState={{ disabled: isControlDisabled }}
67
+ accessibilityLabelledBy={field?.labelledBy}
68
+ aria-labelledby={field?.labelledBy}
69
+ aria-describedby={field?.describedBy}
70
+ aria-disabled={isControlDisabled}
71
+ aria-invalid={isControlInvalid}
72
+ aria-required={isControlRequired}
73
+ nativeID={nativeID ?? field?.nativeID}
74
+ editable={!isControlDisabled}
75
+ multiline={isMultiline}
76
+ textAlignVertical={isMultiline ? "top" : "center"}
77
+ hitSlop={touchTargetHitSlop(size)}
78
+ className={inputTextClassName}
79
+ style={[TEXT_INPUT_RESET, style]}
80
+ {...textInputProps}
81
+ />
90
82
  {trailingIcon ? (
91
83
  <View className={inputIconSlotVariants({ slot: "trailing" })}>{trailingIcon}</View>
92
84
  ) : null}
@@ -1,7 +1,7 @@
1
1
  import { cva, type VariantProps } from "class-variance-authority";
2
2
 
3
3
  export const inputVariants = cva(
4
- "w-full rounded-md border bg-input-background px-md text-base text-foreground placeholder:text-muted-foreground",
4
+ "w-full flex-row items-center rounded-md border bg-input-background px-md",
5
5
  {
6
6
  variants: {
7
7
  size: {
@@ -18,7 +18,7 @@ export const inputVariants = cva(
18
18
  false: "",
19
19
  },
20
20
  isMultiline: {
21
- true: "h-auto min-h-control-lg py-sm",
21
+ true: "h-auto min-h-control-lg py-sm items-start",
22
22
  false: "",
23
23
  },
24
24
  hasLeadingIcon: {
@@ -41,6 +41,9 @@ export const inputVariants = cva(
41
41
  },
42
42
  );
43
43
 
44
+ export const inputTextClassName =
45
+ "flex-1 text-base text-foreground placeholder:text-muted-foreground";
46
+
44
47
  export const inputIconSlotVariants = cva("absolute inset-y-0 justify-center", {
45
48
  variants: {
46
49
  slot: {