@kivid/native-components 1.0.0-alpha.6 → 1.0.0-alpha.8
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/commonjs/components/Avatar/index.js +5 -4
- package/dist/commonjs/components/Avatar/index.js.map +1 -1
- package/dist/commonjs/components/ChatBubble/assets/class-variants.js +6 -6
- package/dist/commonjs/components/ChatBubble/assets/class-variants.js.map +1 -1
- package/dist/commonjs/components/ChatBubble/components/ChatBubbleSeal/index.js +5 -5
- package/dist/commonjs/components/ChatBubble/components/ChatBubbleSeal/index.js.map +1 -1
- package/dist/commonjs/components/ChatBubble/components/ChatBubbleText/index.js +4 -4
- package/dist/commonjs/components/ChatBubble/components/ChatBubbleText/index.js.map +1 -1
- package/dist/commonjs/components/ChatBubble/{context.js → contexts/ChatBubbleContext/index.js} +1 -1
- package/dist/commonjs/components/ChatBubble/contexts/ChatBubbleContext/index.js.map +1 -0
- package/dist/commonjs/components/ChatBubble/contexts/ChatBubbleContext/types.js +6 -0
- package/dist/commonjs/components/ChatBubble/contexts/ChatBubbleContext/types.js.map +1 -0
- package/dist/commonjs/components/ChatBubble/contexts/index.js +17 -0
- package/dist/commonjs/components/ChatBubble/contexts/index.js.map +1 -0
- package/dist/commonjs/components/ChatBubble/index.js +10 -9
- package/dist/commonjs/components/ChatBubble/index.js.map +1 -1
- package/dist/commonjs/components/IconButton/assets/class-variants.js +82 -0
- package/dist/commonjs/components/IconButton/assets/class-variants.js.map +1 -0
- package/dist/commonjs/components/IconButton/assets/design-system-showcase.js +119 -0
- package/dist/commonjs/components/IconButton/assets/design-system-showcase.js.map +1 -0
- package/dist/commonjs/components/IconButton/enums.js +33 -0
- package/dist/commonjs/components/IconButton/enums.js.map +1 -0
- package/dist/commonjs/components/IconButton/index.js +108 -0
- package/dist/commonjs/components/IconButton/index.js.map +1 -0
- package/dist/commonjs/components/IconButton/types.js +6 -0
- package/dist/commonjs/components/IconButton/types.js.map +1 -0
- package/dist/commonjs/components/ListButton/assets/class-variants.js +2 -10
- package/dist/commonjs/components/ListButton/assets/class-variants.js.map +1 -1
- package/dist/commonjs/components/ListButton/assets/design-system-showcase.js +424 -0
- package/dist/commonjs/components/ListButton/assets/design-system-showcase.js.map +1 -0
- package/dist/commonjs/components/ListButton/enums/index.js +0 -11
- package/dist/commonjs/components/ListButton/enums/index.js.map +1 -1
- package/dist/commonjs/components/ListButton/index.js +41 -36
- package/dist/commonjs/components/ListButton/index.js.map +1 -1
- package/dist/commonjs/components/OtpInput/assets/class-variant.js +1 -1
- package/dist/commonjs/components/OtpInput/assets/class-variant.js.map +1 -1
- package/dist/commonjs/components/OtpInput/components/InformationStatus/index.js +13 -11
- package/dist/commonjs/components/OtpInput/components/InformationStatus/index.js.map +1 -1
- package/dist/commonjs/components/OtpInput/enums/index.js +7 -8
- package/dist/commonjs/components/OtpInput/enums/index.js.map +1 -1
- package/dist/commonjs/components/OtpInput/index.js +66 -101
- package/dist/commonjs/components/OtpInput/index.js.map +1 -1
- package/dist/commonjs/components/PasswordInput/index.js +42 -0
- package/dist/commonjs/components/PasswordInput/index.js.map +1 -0
- package/dist/commonjs/components/PasswordInput/types.js +6 -0
- package/dist/commonjs/components/PasswordInput/types.js.map +1 -0
- package/dist/commonjs/components/TextInput/index.js +14 -3
- package/dist/commonjs/components/TextInput/index.js.map +1 -1
- package/dist/commonjs/components/Tooltip/index.js +44 -5
- package/dist/commonjs/components/Tooltip/index.js.map +1 -1
- package/dist/commonjs/components/index.js +33 -0
- package/dist/commonjs/components/index.js.map +1 -1
- package/dist/commonjs/iconography/Icons/index.js +1 -1
- package/dist/commonjs/iconography/Icons/index.js.map +1 -1
- package/dist/module/components/Avatar/index.js +5 -4
- package/dist/module/components/Avatar/index.js.map +1 -1
- package/dist/module/components/ChatBubble/assets/class-variants.js +6 -6
- package/dist/module/components/ChatBubble/assets/class-variants.js.map +1 -1
- package/dist/module/components/ChatBubble/components/ChatBubbleSeal/index.js +4 -4
- package/dist/module/components/ChatBubble/components/ChatBubbleSeal/index.js.map +1 -1
- package/dist/module/components/ChatBubble/components/ChatBubbleText/index.js +5 -4
- package/dist/module/components/ChatBubble/components/ChatBubbleText/index.js.map +1 -1
- package/dist/module/components/ChatBubble/{context.js → contexts/ChatBubbleContext/index.js} +1 -1
- package/dist/module/components/ChatBubble/contexts/ChatBubbleContext/index.js.map +1 -0
- package/dist/module/components/ChatBubble/contexts/ChatBubbleContext/types.js +4 -0
- package/dist/module/components/ChatBubble/contexts/ChatBubbleContext/types.js.map +1 -0
- package/dist/module/components/ChatBubble/contexts/index.js +4 -0
- package/dist/module/components/ChatBubble/contexts/index.js.map +1 -0
- package/dist/module/components/ChatBubble/index.js +9 -8
- package/dist/module/components/ChatBubble/index.js.map +1 -1
- package/dist/module/components/IconButton/assets/class-variants.js +79 -0
- package/dist/module/components/IconButton/assets/class-variants.js.map +1 -0
- package/dist/module/components/IconButton/assets/design-system-showcase.js +115 -0
- package/dist/module/components/IconButton/assets/design-system-showcase.js.map +1 -0
- package/dist/module/components/IconButton/enums.js +29 -0
- package/dist/module/components/IconButton/enums.js.map +1 -0
- package/dist/module/components/IconButton/index.js +103 -0
- package/dist/module/components/IconButton/index.js.map +1 -0
- package/dist/module/components/IconButton/types.js +4 -0
- package/dist/module/components/IconButton/types.js.map +1 -0
- package/dist/module/components/ListButton/assets/class-variants.js +2 -10
- package/dist/module/components/ListButton/assets/class-variants.js.map +1 -1
- package/dist/module/components/ListButton/assets/design-system-showcase.js +420 -0
- package/dist/module/components/ListButton/assets/design-system-showcase.js.map +1 -0
- package/dist/module/components/ListButton/enums/index.js +0 -1
- package/dist/module/components/ListButton/enums/index.js.map +1 -1
- package/dist/module/components/ListButton/index.js +44 -39
- package/dist/module/components/ListButton/index.js.map +1 -1
- package/dist/module/components/OtpInput/assets/class-variant.js +1 -1
- package/dist/module/components/OtpInput/assets/class-variant.js.map +1 -1
- package/dist/module/components/OtpInput/components/InformationStatus/index.js +15 -13
- package/dist/module/components/OtpInput/components/InformationStatus/index.js.map +1 -1
- package/dist/module/components/OtpInput/enums/index.js +6 -7
- package/dist/module/components/OtpInput/enums/index.js.map +1 -1
- package/dist/module/components/OtpInput/index.js +66 -101
- package/dist/module/components/OtpInput/index.js.map +1 -1
- package/dist/module/components/PasswordInput/index.js +37 -0
- package/dist/module/components/PasswordInput/index.js.map +1 -0
- package/dist/module/components/PasswordInput/types.js +4 -0
- package/dist/module/components/PasswordInput/types.js.map +1 -0
- package/dist/module/components/TextInput/index.js +14 -3
- package/dist/module/components/TextInput/index.js.map +1 -1
- package/dist/module/components/Tooltip/index.js +45 -6
- package/dist/module/components/Tooltip/index.js.map +1 -1
- package/dist/module/components/index.js +3 -0
- package/dist/module/components/index.js.map +1 -1
- package/dist/module/iconography/Icons/index.js +2 -2
- package/dist/module/iconography/Icons/index.js.map +1 -1
- package/dist/typescript/components/Avatar/types.d.ts +1 -0
- package/dist/typescript/components/ChatBubble/assets/class-variants.d.ts +1 -1
- package/dist/typescript/components/ChatBubble/components/ChatBubbleSeal/types.d.ts +1 -1
- package/dist/typescript/components/ChatBubble/components/ChatBubbleText/types.d.ts +1 -1
- package/dist/typescript/components/ChatBubble/contexts/ChatBubbleContext/index.d.ts +3 -0
- package/dist/typescript/components/ChatBubble/contexts/ChatBubbleContext/types.d.ts +6 -0
- package/dist/typescript/components/ChatBubble/contexts/index.d.ts +1 -0
- package/dist/typescript/components/ChatBubble/types.d.ts +2 -2
- package/dist/typescript/components/IconButton/assets/class-variants.d.ts +8 -0
- package/dist/typescript/components/IconButton/assets/design-system-showcase.d.ts +17 -0
- package/dist/typescript/components/IconButton/enums.d.ts +22 -0
- package/dist/typescript/components/IconButton/index.d.ts +2 -0
- package/dist/typescript/components/IconButton/types.d.ts +15 -0
- package/dist/typescript/components/ListButton/assets/class-variants.d.ts +1 -4
- package/dist/typescript/components/ListButton/assets/design-system-showcase.d.ts +14 -0
- package/dist/typescript/components/ListButton/enums/index.d.ts +0 -1
- package/dist/typescript/components/ListButton/types.d.ts +7 -5
- package/dist/typescript/components/OtpInput/components/InformationStatus/types.d.ts +2 -2
- package/dist/typescript/components/OtpInput/enums/index.d.ts +2 -3
- package/dist/typescript/components/OtpInput/index.d.ts +1 -1
- package/dist/typescript/components/OtpInput/types.d.ts +4 -4
- package/dist/typescript/components/PasswordInput/index.d.ts +2 -0
- package/dist/typescript/components/PasswordInput/types.d.ts +3 -0
- package/dist/typescript/components/TextInput/index.d.ts +1 -1
- package/dist/typescript/components/TextInput/types.d.ts +3 -0
- package/dist/typescript/components/Tooltip/components/Content/types.d.ts +1 -0
- package/dist/typescript/components/Tooltip/types.d.ts +2 -1
- package/dist/typescript/components/index.d.ts +6 -0
- package/package.json +5 -5
- package/src/components/Avatar/index.tsx +4 -4
- package/src/components/Avatar/types.ts +1 -0
- package/src/components/ChatBubble/assets/class-variants.ts +6 -6
- package/src/components/ChatBubble/components/ChatBubbleSeal/index.tsx +5 -4
- package/src/components/ChatBubble/components/ChatBubbleSeal/types.ts +1 -1
- package/src/components/ChatBubble/components/ChatBubbleText/index.tsx +4 -3
- package/src/components/ChatBubble/components/ChatBubbleText/types.ts +1 -1
- package/src/components/ChatBubble/{context.tsx → contexts/ChatBubbleContext/index.tsx} +1 -10
- package/src/components/ChatBubble/contexts/ChatBubbleContext/types.ts +11 -0
- package/src/components/ChatBubble/contexts/index.ts +1 -0
- package/src/components/ChatBubble/index.tsx +12 -10
- package/src/components/ChatBubble/types.ts +2 -3
- package/src/components/IconButton/assets/class-variants.ts +126 -0
- package/src/components/IconButton/assets/design-system-showcase.ts +246 -0
- package/src/components/IconButton/enums.ts +26 -0
- package/src/components/IconButton/index.tsx +124 -0
- package/src/components/IconButton/types.ts +22 -0
- package/src/components/ListButton/assets/class-variants.ts +2 -11
- package/src/components/ListButton/assets/design-system-showcase.ts +502 -0
- package/src/components/ListButton/enums/index.ts +0 -1
- package/src/components/ListButton/index.tsx +44 -41
- package/src/components/ListButton/types.ts +7 -5
- package/src/components/OtpInput/assets/class-variant.ts +1 -1
- package/src/components/OtpInput/components/InformationStatus/index.tsx +15 -14
- package/src/components/OtpInput/components/InformationStatus/types.ts +2 -2
- package/src/components/OtpInput/enums/index.ts +1 -2
- package/src/components/OtpInput/index.tsx +77 -136
- package/src/components/OtpInput/types.ts +4 -4
- package/src/components/PasswordInput/index.tsx +37 -0
- package/src/components/PasswordInput/types.ts +4 -0
- package/src/components/TextInput/index.tsx +17 -3
- package/src/components/TextInput/types.ts +3 -0
- package/src/components/Tooltip/components/Content/types.ts +1 -0
- package/src/components/Tooltip/index.tsx +57 -5
- package/src/components/Tooltip/types.ts +2 -1
- package/src/components/index.ts +8 -0
- package/src/iconography/Icons/index.tsx +2 -3
- package/dist/commonjs/components/ChatBubble/context.js.map +0 -1
- package/dist/commonjs/components/ListButton/enums/icon-color.js +0 -18
- package/dist/commonjs/components/ListButton/enums/icon-color.js.map +0 -1
- package/dist/module/components/ChatBubble/context.js.map +0 -1
- package/dist/module/components/ListButton/enums/icon-color.js +0 -14
- package/dist/module/components/ListButton/enums/icon-color.js.map +0 -1
- package/dist/typescript/components/ChatBubble/context.d.ts +0 -8
- package/dist/typescript/components/ListButton/enums/icon-color.d.ts +0 -10
- package/src/components/ListButton/enums/icon-color.ts +0 -10
|
@@ -15,16 +15,18 @@ var _react = require("react");
|
|
|
15
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
16
|
function ListButton(props) {
|
|
17
17
|
const {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
iconLeft,
|
|
19
|
+
iconRight,
|
|
20
20
|
children,
|
|
21
|
-
showChevronIcon = true,
|
|
22
21
|
variant = _index2.ListButtonVariantEnum.GRAPE,
|
|
23
22
|
size = _index3.SizeEnum.SMALL,
|
|
24
23
|
corners = _index3.CornersEnum.SMALL,
|
|
25
24
|
disabled = false,
|
|
26
25
|
className,
|
|
26
|
+
iconLeftContainerClassName,
|
|
27
|
+
iconRightContainerClassName,
|
|
27
28
|
accessibilityLabel,
|
|
29
|
+
numberOfLines = 1,
|
|
28
30
|
onPressIn,
|
|
29
31
|
onPressOut,
|
|
30
32
|
...rest
|
|
@@ -40,16 +42,6 @@ function ListButton(props) {
|
|
|
40
42
|
variant
|
|
41
43
|
});
|
|
42
44
|
const animatedValue = (0, _react.useRef)(new _reactNative.Animated.Value(1)).current;
|
|
43
|
-
const mappedIconColor = {
|
|
44
|
-
[_index2.ListButtonIconColorEnum.GHOST]: "#FAFCFC",
|
|
45
|
-
[_index2.ListButtonIconColorEnum.GRAPE]: "#7A50D9",
|
|
46
|
-
[_index2.ListButtonIconColorEnum.JAVA]: "#43C1E0",
|
|
47
|
-
[_index2.ListButtonIconColorEnum.PITAYA]: "#E64595",
|
|
48
|
-
[_index2.ListButtonIconColorEnum.PEAR]: "#3DCC78",
|
|
49
|
-
[_index2.ListButtonIconColorEnum.TANGERINE]: "#FF8B59",
|
|
50
|
-
[_index2.ListButtonIconColorEnum.BLACKBERRY]: "#E65245",
|
|
51
|
-
[_index2.ListButtonIconColorEnum.CHIA]: "#393E3E"
|
|
52
|
-
}[iconColor];
|
|
53
45
|
const handlePressIn = event => {
|
|
54
46
|
_reactNative.Animated.timing(animatedValue, {
|
|
55
47
|
toValue: 0.7,
|
|
@@ -66,47 +58,60 @@ function ListButton(props) {
|
|
|
66
58
|
}).start();
|
|
67
59
|
onPressOut?.(event);
|
|
68
60
|
};
|
|
61
|
+
function renderLeftIcon() {
|
|
62
|
+
if (iconLeft) {
|
|
63
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
64
|
+
className: "mr-400",
|
|
65
|
+
children: iconLeft
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
function renderRightIcon() {
|
|
71
|
+
if (iconRight) {
|
|
72
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
73
|
+
className: "ml-400",
|
|
74
|
+
children: iconRight
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
78
|
+
className: "ml-400",
|
|
79
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_native.ChevronRight, {
|
|
80
|
+
color: chevronIconColor
|
|
81
|
+
})
|
|
82
|
+
});
|
|
83
|
+
}
|
|
69
84
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
|
|
70
85
|
style: {
|
|
71
86
|
opacity: animatedValue
|
|
72
87
|
},
|
|
88
|
+
className: (0, _tailwindPreset.merge)((0, _classVariants.buttonVariants)({
|
|
89
|
+
variant,
|
|
90
|
+
size,
|
|
91
|
+
corners
|
|
92
|
+
}), className),
|
|
73
93
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
|
|
74
|
-
className: (0, _tailwindPreset.merge)((0, _classVariants.buttonVariants)({
|
|
75
|
-
variant,
|
|
76
|
-
size,
|
|
77
|
-
corners
|
|
78
|
-
}), className),
|
|
79
94
|
disabled: disabled,
|
|
80
95
|
accessibilityRole: "button",
|
|
81
|
-
accessibilityLabel: accessibilityLabel,
|
|
96
|
+
accessibilityLabel: accessibilityLabel ?? (typeof children === "string" ? children : undefined),
|
|
82
97
|
accessibilityState: {
|
|
83
98
|
disabled: disabled
|
|
84
99
|
},
|
|
85
100
|
onPressIn: handlePressIn,
|
|
86
101
|
onPressOut: handlePressOut,
|
|
102
|
+
className: "flex-row",
|
|
87
103
|
...rest,
|
|
88
104
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
89
|
-
className:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
93
|
-
className: "mr-400 flex items-center",
|
|
94
|
-
children: icon ?? /*#__PURE__*/(0, _jsxRuntime.jsx)(_native.ChatbubbleEllipses, {
|
|
95
|
-
size: 24,
|
|
96
|
-
color: mappedIconColor
|
|
97
|
-
})
|
|
98
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Typography, {
|
|
105
|
+
className: "flex flex-row items-center flex-1",
|
|
106
|
+
children: [renderLeftIcon(), /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Typography, {
|
|
107
|
+
ellipsizeMode: "tail",
|
|
99
108
|
variant: typographyVariant,
|
|
100
109
|
weight: "700",
|
|
101
|
-
className: (0, _tailwindPreset.merge)(textStyle, "truncate
|
|
110
|
+
className: (0, _tailwindPreset.merge)(textStyle, "truncate flex-1 "),
|
|
111
|
+
numberOfLines: numberOfLines,
|
|
102
112
|
children: children
|
|
103
113
|
})]
|
|
104
|
-
}),
|
|
105
|
-
className: "flex items-center",
|
|
106
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_native.ChevronRight, {
|
|
107
|
-
color: chevronIconColor
|
|
108
|
-
})
|
|
109
|
-
})]
|
|
114
|
+
}), renderRightIcon()]
|
|
110
115
|
})
|
|
111
116
|
});
|
|
112
117
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_index","_index2","_index3","_native","_classVariants","_tailwindPreset","_react","_jsxRuntime","ListButton","props","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_index","_index2","_index3","_native","_classVariants","_tailwindPreset","_react","_jsxRuntime","ListButton","props","iconLeft","iconRight","children","variant","ListButtonVariantEnum","GRAPE","size","SizeEnum","SMALL","corners","CornersEnum","disabled","className","iconLeftContainerClassName","iconRightContainerClassName","accessibilityLabel","numberOfLines","onPressIn","onPressOut","rest","typographyVariantMap","small","medium","large","typographyVariant","chevronIconColor","OUTLINE","textStyle","textVariants","animatedValue","useRef","Animated","Value","current","handlePressIn","event","timing","toValue","duration","useNativeDriver","start","handlePressOut","renderLeftIcon","jsx","View","renderRightIcon","ChevronRight","color","style","opacity","merge","buttonVariants","jsxs","Pressable","accessibilityRole","undefined","accessibilityState","Typography","ellipsize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AAE,IAAAsC,qBAAK,EACd,IAAAC,6BAAc,EAAC;MACbhD,OAAO;MACPG,IAAI;MACJG;IACF,CAAC,CAAC,EACFG,SACF,CAAE;IAAAV,QAAA,eAEF,IAAAL,WAAA,CAAAuD,IAAA,EAAChE,YAAA,CAAAiE,SAAS;MACR1C,QAAQ,EAAEA,QAAS;MACnB2C,iBAAiB,EAAC,QAAQ;MAC1BvC,kBAAkB,EAAEA,kBAAkB,KAAK,OAAOb,QAAQ,KAAK,QAAQ,GAAGA,QAAQ,GAAGqD,SAAS,CAAE;MAChGC,kBAAkB,EAAE;QAClB7C,QAAQ,EAAEA;MACZ,CAAE;MACFM,SAAS,EAAEiB,aAAc;MACzBhB,UAAU,EAAEuB,cAAe;MAC3B7B,SAAS,EAAC,UAAU;MAAA,GAChBO,IAAI;MAAAjB,QAAA,gBAER,IAAAL,WAAA,CAAAuD,IAAA,EAAChE,YAAA,CAAAwD,IAAI;QAAChC,SAAS,EAAC,mCAAmC;QAAAV,QAAA,GAChDwC,cAAc,CAAC,CAAC,eACjB,IAAA7C,WAAA,CAAA8C,GAAA,EAACrD,MAAA,CAAAmE,UAAU;UACTC,aAAa,EAAC,MAAM;UACpBvD,OAAO,EAAEqB,iBAAkB;UAC3BmC,MAAM,EAAC,KAAK;UACZ/C,SAAS,EAAE,IAAAsC,qBAAK,EAACvB,SAAS,EAAE,kBAAkB,CAAE;UAChDX,aAAa,EAAEA,aAAc;UAAAd,QAAA,EAE5BA;QAAQ,CACC,CAAC;MAAA,CACT,CAAC,EAEN2C,eAAe,CAAC,CAAC;IAAA,CACT;EAAC,CACC,CAAC;AAEpB","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.inputVariants = void 0;
|
|
7
7
|
var _classVarianceAuthority = require("class-variance-authority");
|
|
8
|
-
const inputVariants = exports.inputVariants = (0, _classVarianceAuthority.cva)("h-1000 flex-1 text-center text-3 font-bold leading-
|
|
8
|
+
const inputVariants = exports.inputVariants = (0, _classVarianceAuthority.cva)("h-1000 flex-1 text-center text-3 font-bold leading-1300 border-100 bg-chia-100 placeholder-chia-400", {
|
|
9
9
|
variants: {
|
|
10
10
|
rounded: {
|
|
11
11
|
true: "rounded-700",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classVarianceAuthority","require","inputVariants","exports","cva","variants","rounded","true","false","disabled","hasError"],"sourceRoot":"../../../../../src","sources":["components/OtpInput/assets/class-variant.ts"],"mappings":";;;;;;AAAA,IAAAA,uBAAA,GAAAC,OAAA;AAEO,MAAMC,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG,IAAAE,2BAAG,EAC9B,
|
|
1
|
+
{"version":3,"names":["_classVarianceAuthority","require","inputVariants","exports","cva","variants","rounded","true","false","disabled","hasError"],"sourceRoot":"../../../../../src","sources":["components/OtpInput/assets/class-variant.ts"],"mappings":";;;;;;AAAA,IAAAA,uBAAA,GAAAC,OAAA;AAEO,MAAMC,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG,IAAAE,2BAAG,EAC9B,qGAAqG,EACrG;EACEC,QAAQ,EAAE;IACRC,OAAO,EAAE;MACPC,IAAI,EAAE,aAAa;MACnBC,KAAK,EAAE;IACT,CAAC;IACDC,QAAQ,EAAE;MACRF,IAAI,EAAE,YAAY;MAClBC,KAAK,EAAE;IACT,CAAC;IACDE,QAAQ,EAAE;MACRH,IAAI,EAAE,2CAA2C;MACjDC,KAAK,EAAE;IACT;EACF;AACF,CACF,CAAC","ignoreList":[]}
|
|
@@ -21,13 +21,13 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
21
21
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
22
|
function InformationStatus(props) {
|
|
23
23
|
const {
|
|
24
|
-
status = _index7.
|
|
24
|
+
status = _index7.OTPInputInformationStatusEnum.DEFAULT,
|
|
25
25
|
disabled = false,
|
|
26
26
|
onPress
|
|
27
27
|
} = props;
|
|
28
28
|
const renderInformation = (0, _react.useMemo)(() => {
|
|
29
29
|
const textStyle = (0, _tailwindPreset.merge)("", disabled && "opacity-50");
|
|
30
|
-
if (status === _index7.
|
|
30
|
+
if (status === _index7.OTPInputInformationStatusEnum.DEFAULT) {
|
|
31
31
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
32
32
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Button, {
|
|
33
33
|
variant: "outline",
|
|
@@ -44,7 +44,7 @@ function InformationStatus(props) {
|
|
|
44
44
|
})]
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
-
if (status === _index7.
|
|
47
|
+
if (status === _index7.OTPInputInformationStatusEnum.LOADING) {
|
|
48
48
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
49
49
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index3.default, {
|
|
50
50
|
variant: "dark"
|
|
@@ -56,21 +56,23 @@ function InformationStatus(props) {
|
|
|
56
56
|
})]
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
-
if (status === _index7.
|
|
60
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
sealVariant: _index6.SealVariantEnum.SUCCESS,
|
|
64
|
-
label: "Confirmado"
|
|
65
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.HighlightedText, {
|
|
59
|
+
if (status === _index7.OTPInputInformationStatusEnum.SUCCESS) {
|
|
60
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
61
|
+
className: "flex flex-col mt-600 gap-600 items-center",
|
|
62
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.HighlightedText, {
|
|
66
63
|
highlightText: "C\xF3digo validado",
|
|
67
64
|
text: "com sucesso.",
|
|
68
65
|
reverse: true,
|
|
69
66
|
className: textStyle
|
|
67
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_index4.Chip, {
|
|
68
|
+
variant: _index5.ChipVariantEnum.OUTLINE,
|
|
69
|
+
sealVariant: _index6.SealVariantEnum.SUCCESS,
|
|
70
|
+
label: "Confirmado",
|
|
71
|
+
className: "max-w-fit"
|
|
70
72
|
})]
|
|
71
73
|
});
|
|
72
74
|
}
|
|
73
|
-
if (status === _index7.
|
|
75
|
+
if (status === _index7.OTPInputInformationStatusEnum.ERROR) {
|
|
74
76
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
75
77
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Button, {
|
|
76
78
|
variant: "outline",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Object","defineProperty","exports","value","InformationStatus","default","_react","require","_tailwindPreset","_index","_index2","_index3","_interopRequireDefault","_index4","_reactNative","_index5","_index6","_index7","_index8","_jsxRuntime","e","__esModule","props","status","
|
|
1
|
+
{"version":3,"names":["Object","defineProperty","exports","value","InformationStatus","default","_react","require","_tailwindPreset","_index","_index2","_index3","_interopRequireDefault","_index4","_reactNative","_index5","_index6","_index7","_index8","_jsxRuntime","e","__esModule","props","status","OTPInputInformationStatusEnum","DEFAULT","disabled","onPress","renderInformation","useMemo","textStyle","merge","jsxs","Fragment","children","jsx","Button","variant","corners","CornersEnum","MEDIUM","size","SizeEnum","SMALL","HighlightedText","highlightText","text","reverse","className","LOADING","SUCCESS","View","Chip","ChipVariantEnum","OUTLINE","sealVariant","SealVariantEnum","label","ERROR","Text","_default"],"sourceRoot":"../../../../../../src","sources":["components/OtpInput/components/InformationStatus/index.tsx"],"mappings":";AAAA,YAAY;;AAACA,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,KAAA;AAAA;AAAAD,OAAA,CAAAE,iBAAA,GAAAA,iBAAA;AAAAF,OAAA,CAAAG,OAAA;AAEb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,QAAA;QAAAC,QAAA,gBACE,IAAAf,WAAA,CAAAgB,GAAA,EAAC1B,MAAA,CAAA2B,MAAM;UACLC,OAAO,EAAC,SAAS;UACjBC,OAAO,EAAEC,mBAAW,CAACC,MAAO;UAC5Bd,QAAQ,EAAEA,QAAS;UACnBC,OAAO,EAAEA,OAAQ;UACjBc,IAAI,EAAEC,gBAAQ,CAACC,KAAM;UAAAT,QAAA,EACtB;QAED,CAAQ,CAAC,eAET,IAAAf,WAAA,CAAAgB,GAAA,EAACrB,YAAA,CAAA6C,IAAI;UAACX,SAAS,EAAEtB,QAAQ,GAAG,YAAY,GAAG,EAAG;UAAAQ,QAAA,EAAC;QAE/C,CAAM,CAAC;MAAA,CACP,CAAC;IAEP;EACF,CAAC,EAAE,CAACR,QAAQ,EAAEC,OAAO,EAAEJ,MAAM,CAAC,CAAC;EAE/B,oBAAO,IAAAJ,WAAA,CAAAgB,GAAA,EAAAhB,WAAA,CAAAc,QAAA;IAAAC,QAAA,EAAGN;EAAiB,CAAG,CAAC;AACjC;AAAC,IAAAgC,QAAA,GAAA1D,OAAA,CAAAG,OAAA,GAEcD,iBAAiB","ignoreList":[]}
|
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
let
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return InformationStatusEnum;
|
|
6
|
+
exports.OTPInputInformationStatusEnum = void 0;
|
|
7
|
+
let OTPInputInformationStatusEnum = exports.OTPInputInformationStatusEnum = /*#__PURE__*/function (OTPInputInformationStatusEnum) {
|
|
8
|
+
OTPInputInformationStatusEnum["DEFAULT"] = "default";
|
|
9
|
+
OTPInputInformationStatusEnum["ERROR"] = "error";
|
|
10
|
+
OTPInputInformationStatusEnum["SUCCESS"] = "success";
|
|
11
|
+
OTPInputInformationStatusEnum["LOADING"] = "loading";
|
|
12
|
+
return OTPInputInformationStatusEnum;
|
|
14
13
|
}({});
|
|
15
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["OTPInputInformationStatusEnum","exports"],"sourceRoot":"../../../../../src","sources":["components/OtpInput/enums/index.ts"],"mappings":";;;;;;IAAYA,6BAA6B,GAAAC,OAAA,CAAAD,6BAAA,0BAA7BA,6BAA6B;EAA7BA,6BAA6B;EAA7BA,6BAA6B;EAA7BA,6BAA6B;EAA7BA,6BAA6B;EAAA,OAA7BA,6BAA6B;AAAA","ignoreList":[]}
|
|
@@ -6,16 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.OtpInput = OtpInput;
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
+
var _index = require("./enums/index.js");
|
|
9
10
|
var _reactNative = require("react-native");
|
|
10
11
|
var _tailwindPreset = require("@kivid/tailwind-preset");
|
|
11
|
-
var _index = require("./components/index.js");
|
|
12
|
-
var _index2 = require("./enums/index.js");
|
|
13
12
|
var _classVariant = require("./assets/class-variant.js");
|
|
13
|
+
var _index2 = require("./components/index.js");
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
15
|
function OtpInput(props) {
|
|
16
16
|
const {
|
|
17
|
-
status =
|
|
18
|
-
|
|
17
|
+
status = _index.OTPInputInformationStatusEnum.DEFAULT,
|
|
18
|
+
length = 6,
|
|
19
19
|
customInformation,
|
|
20
20
|
rounded = false,
|
|
21
21
|
disabled = false,
|
|
@@ -23,117 +23,82 @@ function OtpInput(props) {
|
|
|
23
23
|
onChange,
|
|
24
24
|
onPressRetryToken
|
|
25
25
|
} = props;
|
|
26
|
-
const
|
|
27
|
-
const [
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
const hasError = status === _index.OTPInputInformationStatusEnum.ERROR;
|
|
27
|
+
const [code, setCode] = (0, _react.useState)('');
|
|
28
|
+
const textInputRef = (0, _react.useRef)(null);
|
|
29
|
+
const codeDigitsArray = new Array(length).fill(0);
|
|
30
|
+
const inputStyle = (0, _tailwindPreset.merge)((0, _classVariant.inputVariants)({
|
|
31
|
+
rounded,
|
|
32
|
+
hasError,
|
|
33
|
+
disabled
|
|
34
|
+
}), inputClassName);
|
|
35
|
+
const [inputContainerIsFocused, setInputContainerIsFocused] = (0, _react.useState)(false);
|
|
36
|
+
function handleOnPress() {
|
|
37
|
+
setInputContainerIsFocused(true);
|
|
38
|
+
textInputRef.current?.focus();
|
|
35
39
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
newValues[targetIndex] = char;
|
|
45
|
-
targetIndex++;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
setInputValues(newValues);
|
|
49
|
-
onChange?.(newValues.join(""));
|
|
50
|
-
const nextEmptyIndex = newValues.findIndex(value => !value);
|
|
51
|
-
if (nextEmptyIndex !== -1) {
|
|
52
|
-
inputsRef.current[nextEmptyIndex]?.focus();
|
|
53
|
-
} else {
|
|
54
|
-
inputsRef.current[OTPInputsQuantity - 1]?.focus();
|
|
55
|
-
}
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
newValues[index] = text;
|
|
59
|
-
setInputValues(newValues);
|
|
60
|
-
onChange?.(newValues.join(""));
|
|
61
|
-
if (text && index < OTPInputsQuantity - 1) {
|
|
62
|
-
const nextEmptyIndex = newValues.findIndex((v, i) => i > index && !v);
|
|
63
|
-
if (nextEmptyIndex !== -1) {
|
|
64
|
-
inputsRef.current[nextEmptyIndex]?.focus();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
const handleKeyDown = (e, index) => {
|
|
69
|
-
if (e.nativeEvent.key === "Backspace") {
|
|
70
|
-
const hasValueAhead = inputValues.slice(index + 1).some(value => value);
|
|
71
|
-
if (hasValueAhead) {
|
|
72
|
-
const lastFilledIndex = [...inputValues].map((value, i) => value ? i : -1).filter(i => i !== -1).pop();
|
|
73
|
-
if (lastFilledIndex !== undefined) {
|
|
74
|
-
inputsRef.current[lastFilledIndex]?.focus();
|
|
75
|
-
}
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
if (inputValues[index]) {
|
|
79
|
-
const newValues = [...inputValues];
|
|
80
|
-
newValues[index] = "";
|
|
81
|
-
setInputValues(newValues);
|
|
82
|
-
}
|
|
83
|
-
if (index > 0) {
|
|
84
|
-
inputsRef.current[index - 1]?.focus();
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
const handleFocus = (event, index) => {
|
|
89
|
-
const firstEmptyIndex = inputValues.findIndex(value => !value);
|
|
90
|
-
if (firstEmptyIndex !== -1 && index > firstEmptyIndex) {
|
|
91
|
-
inputsRef.current[firstEmptyIndex]?.focus();
|
|
92
|
-
event.preventDefault();
|
|
93
|
-
return;
|
|
40
|
+
function handleOnBlur() {
|
|
41
|
+
setInputContainerIsFocused(false);
|
|
42
|
+
}
|
|
43
|
+
function handleChangeText(text) {
|
|
44
|
+
const textInputQuantity = text.replace(/\s+/g, '').slice(0, length);
|
|
45
|
+
setCode(textInputQuantity);
|
|
46
|
+
if (textInputQuantity.length === length) {
|
|
47
|
+
onChange?.(textInputQuantity);
|
|
94
48
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
49
|
+
}
|
|
50
|
+
function handleInformationStatusOnPress() {
|
|
51
|
+
if (code.length === length) {
|
|
52
|
+
onPressRetryToken?.(code);
|
|
98
53
|
}
|
|
99
|
-
}
|
|
54
|
+
}
|
|
100
55
|
function renderInformationStatus() {
|
|
101
56
|
if (customInformation) {
|
|
102
57
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
103
58
|
children: customInformation
|
|
104
59
|
});
|
|
105
60
|
}
|
|
106
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
61
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.InformationStatus, {
|
|
107
62
|
status: status,
|
|
108
|
-
onPress:
|
|
63
|
+
onPress: handleInformationStatusOnPress
|
|
109
64
|
});
|
|
110
65
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
66
|
+
function renderDigit(_value, index) {
|
|
67
|
+
const isCurrentDigit = index === code.length;
|
|
68
|
+
const isLastDigit = index === length - 1;
|
|
69
|
+
const isCodeFull = code.length === length;
|
|
70
|
+
const isDigitFocused = isCurrentDigit && inputContainerIsFocused || isLastDigit && isCodeFull && inputContainerIsFocused;
|
|
71
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
72
|
+
className: inputStyle,
|
|
73
|
+
style: {
|
|
74
|
+
...(isDigitFocused ? {
|
|
75
|
+
borderColor: '#98A3A3'
|
|
76
|
+
} : {}),
|
|
77
|
+
...(code[index] ? {} : {
|
|
78
|
+
color: '#98A3A3'
|
|
79
|
+
})
|
|
80
|
+
},
|
|
81
|
+
children: code[index] ?? "•"
|
|
82
|
+
}, index);
|
|
83
|
+
}
|
|
116
84
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
117
|
-
className: "flex
|
|
85
|
+
className: "flex-col gap-300 max-w-[280px] items-center justify-between",
|
|
118
86
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
119
|
-
className: "flex-row
|
|
120
|
-
children:
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
onKeyPress: e => handleKeyDown(e, i),
|
|
135
|
-
onFocus: e => handleFocus(e, i)
|
|
136
|
-
}, `otp-input-${i}`))
|
|
87
|
+
className: "w-full flex-row justify-around gap-400",
|
|
88
|
+
children: codeDigitsArray.map(renderDigit)
|
|
89
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
|
|
90
|
+
className: "w-full h-1000 absolute text-transparent",
|
|
91
|
+
value: code,
|
|
92
|
+
onChangeText: handleChangeText,
|
|
93
|
+
maxLength: length,
|
|
94
|
+
editable: !disabled,
|
|
95
|
+
returnKeyType: "done",
|
|
96
|
+
textContentType: "oneTimeCode",
|
|
97
|
+
ref: textInputRef,
|
|
98
|
+
onBlur: handleOnBlur,
|
|
99
|
+
onPress: handleOnPress,
|
|
100
|
+
caretHidden: true,
|
|
101
|
+
autoComplete: _reactNative.Platform.OS === "android" ? "sms-otp" : "one-time-code"
|
|
137
102
|
}), renderInformationStatus()]
|
|
138
103
|
});
|
|
139
104
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNative","_tailwindPreset","
|
|
1
|
+
{"version":3,"names":["_react","require","_index","_reactNative","_tailwindPreset","_classVariant","_index2","_jsxRuntime","OtpInput","props","status","OTPInputInformationStatusEnum","DEFAULT","length","customInformation","rounded","disabled","inputClassName","onChange","onPressRetryToken","hasError","ERROR","code","setCode","useState","textInputRef","useRef","codeDigitsArray","Array","fill","inputStyle","merge","inputVariants","inputContainerIsFocused","setInputContainerIsFocused","handleOnPress","current","focus","handleOnBlur","handleChangeText","text","textInputQuantity","replace","slice","handleInformationStatusOnPress","renderInformationStatus","jsx","Fragment","children","InformationStatus","onPress","renderDigit","_value","index","isCurrentDigit","isLastDigit","isCodeFull","isDigitFocused","Text","className","style","borderColor","color","jsxs","View","map","TextInput","value","onChangeText","maxLength","editable","returnKeyType","textContentType","ref","onBlur","caretHidden","autoComplete","Platform","OS","_default","exports","default"],"sourceRoot":"../../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
exports.PasswordInput = PasswordInput;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _index = _interopRequireDefault(require("../TextInput/index.js"));
|
|
9
|
+
var _index2 = require("../IconButton/index.js");
|
|
10
|
+
var _native = require("@kivid/icons/native");
|
|
11
|
+
var _enums = require("../IconButton/enums.js");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
function PasswordInput(props) {
|
|
15
|
+
const [shouldHidePassword, setShouldHidePassword] = (0, _react.useState)(true);
|
|
16
|
+
function toogleHidePassword() {
|
|
17
|
+
setShouldHidePassword(!shouldHidePassword);
|
|
18
|
+
}
|
|
19
|
+
function renderIcon() {
|
|
20
|
+
if (shouldHidePassword) {
|
|
21
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_native.Eye, {
|
|
22
|
+
size: 24,
|
|
23
|
+
className: "text-chia-900"
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_native.EyeOff, {
|
|
27
|
+
size: 24,
|
|
28
|
+
className: "text-chia-900"
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.default, {
|
|
32
|
+
...props,
|
|
33
|
+
secureTextEntry: shouldHidePassword,
|
|
34
|
+
rightIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.IconButton, {
|
|
35
|
+
onPress: toogleHidePassword,
|
|
36
|
+
accessibilityLabel: "Toggle Password Visibility",
|
|
37
|
+
variant: _enums.IconButtonVariantEnum.GHOST,
|
|
38
|
+
icon: renderIcon()
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_index","_interopRequireDefault","_index2","_native","_enums","_jsxRuntime","e","__esModule","default","PasswordInput","props","shouldHidePassword","setShouldHidePassword","useState","toogleHidePassword","renderIcon","jsx","Eye","size","className","EyeOff","secureTextEntry","rightIcon","IconButton","onPress","accessibilityLabel","variant","IconButtonVariantEnum","GHOST","icon"],"sourceRoot":"../../../../src","sources":["components/PasswordInput/index.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAA4D,IAAAM,WAAA,GAAAN,OAAA;AAAA,SAAAE,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAErD,SAASG,aAAaA,CAACC,KAAyB,EAAE;EACvD,MAAM,CAACC,kBAAkB,EAAEC,qBAAqB,CAAC,GAAG,IAAAC,eAAQ,EAAC,IAAI,CAAC;EAElE,SAASC,kBAAkBA,CAAA,EAAG;IAC5BF,qBAAqB,CAAC,CAACD,kBAAkB,CAAC;EAC5C;EAEA,SAASI,UAAUA,CAAA,EAAG;IACpB,IAAIJ,kBAAkB,EAAE;MACtB,oBAAO,IAAAN,WAAA,CAAAW,GAAA,EAACb,OAAA,CAAAc,GAAG;QAACC,IAAI,EAAE,EAAG;QAACC,SAAS,EAAC;MAAe,CAAE,CAAC;IACpD;IAEA,oBAAO,IAAAd,WAAA,CAAAW,GAAA,EAACb,OAAA,CAAAiB,MAAM;MAACF,IAAI,EAAE,EAAG;MAACC,SAAS,EAAC;IAAe,CAAE,CAAC;EACvD;EAEA,oBACE,IAAAd,WAAA,CAAAW,GAAA,EAAChB,MAAA,CAAAQ,OAAS;IAAA,GACJE,KAAK;IACTW,eAAe,EAAEV,kBAAmB;IACpCW,SAAS,eACP,IAAAjB,WAAA,CAAAW,GAAA,EAACd,OAAA,CAAAqB,UAAU;MACTC,OAAO,EAAEV,kBAAmB;MAC5BW,kBAAkB,EAAC,4BAA4B;MAC/CC,OAAO,EAAEC,4BAAqB,CAACC,KAAM;MACrCC,IAAI,EAAEd,UAAU,CAAC;IAAE,CACpB;EACF,CACF,CAAC;AAEN","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/PasswordInput/types.ts"],"mappings":"","ignoreList":[]}
|