@kukkim/react-native-ui 0.1.0 → 0.1.1
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/lib/module/components/index.js +3 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/input/commonInput.js +61 -0
- package/lib/module/components/input/commonInput.js.map +1 -0
- package/lib/module/components/input/index.js +5 -0
- package/lib/module/components/input/index.js.map +1 -0
- package/lib/module/components/input/types.js +14 -0
- package/lib/module/components/input/types.js.map +1 -0
- package/lib/module/components/popOver/commonPopOver.js +67 -0
- package/lib/module/components/popOver/commonPopOver.js.map +1 -0
- package/lib/module/components/popOver/index.js +5 -0
- package/lib/module/components/popOver/index.js.map +1 -0
- package/lib/module/components/popOver/types.js +14 -0
- package/lib/module/components/popOver/types.js.map +1 -0
- package/lib/module/components/spinner/index.js +3 -0
- package/lib/module/components/spinner/index.js.map +1 -0
- package/lib/module/components/spinner/types.js +2 -0
- package/lib/module/components/spinner/types.js.map +1 -0
- package/lib/module/components/switch/commonSwitch.js +70 -0
- package/lib/module/components/switch/commonSwitch.js.map +1 -0
- package/lib/module/components/switch/index.js +3 -1
- package/lib/module/components/switch/index.js.map +1 -1
- package/lib/module/components/switch/types.js +6 -0
- package/lib/module/components/switch/types.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/components/index.d.ts +3 -0
- package/lib/typescript/src/components/index.d.ts.map +1 -1
- package/lib/typescript/src/components/input/commonInput.d.ts +4 -0
- package/lib/typescript/src/components/input/commonInput.d.ts.map +1 -0
- package/lib/typescript/src/components/input/index.d.ts +3 -0
- package/lib/typescript/src/components/input/index.d.ts.map +1 -0
- package/lib/typescript/src/components/input/types.d.ts +14 -0
- package/lib/typescript/src/components/input/types.d.ts.map +1 -0
- package/lib/typescript/src/components/popOver/commonPopOver.d.ts +4 -0
- package/lib/typescript/src/components/popOver/commonPopOver.d.ts.map +1 -0
- package/lib/typescript/src/components/popOver/index.d.ts +3 -0
- package/lib/typescript/src/components/popOver/index.d.ts.map +1 -0
- package/lib/typescript/src/components/popOver/types.d.ts +12 -0
- package/lib/typescript/src/components/popOver/types.d.ts.map +1 -0
- package/lib/typescript/src/components/spinner/index.d.ts +1 -0
- package/lib/typescript/src/components/spinner/index.d.ts.map +1 -0
- package/lib/typescript/src/components/spinner/types.d.ts +1 -0
- package/lib/typescript/src/components/spinner/types.d.ts.map +1 -0
- package/lib/typescript/src/components/switch/commonSwitch.d.ts +3 -0
- package/lib/typescript/src/components/switch/commonSwitch.d.ts.map +1 -0
- package/lib/typescript/src/components/switch/index.d.ts +2 -0
- package/lib/typescript/src/components/switch/index.d.ts.map +1 -1
- package/lib/typescript/src/components/switch/types.d.ts +11 -0
- package/lib/typescript/src/components/switch/types.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/index.ts +3 -0
- package/src/components/input/commonInput.tsx +65 -0
- package/src/components/input/index.tsx +3 -0
- package/src/components/input/types.ts +23 -0
- package/src/components/popOver/commonPopOver.tsx +71 -0
- package/src/components/popOver/index.ts +3 -0
- package/src/components/popOver/types.tsx +17 -0
- package/src/components/spinner/index.tsx +1 -0
- package/src/components/spinner/types.ts +0 -0
- package/src/components/switch/commonSwitch.tsx +77 -0
- package/src/components/switch/index.ts +3 -0
- package/src/components/switch/types.ts +17 -0
- package/src/index.tsx +3 -0
- package/src/components/switch/index.tsx +0 -1
|
@@ -12,4 +12,7 @@ export { CheckBox } from "./checkBox/index.js";
|
|
|
12
12
|
export { CommonHeader } from "./header/index.js";
|
|
13
13
|
export { CommonCard, FoldableCard } from "./card/index.js";
|
|
14
14
|
export { LinearProgressBar, CircularProgressBar } from "./progressBar/index.js";
|
|
15
|
+
export { CommonInput } from "./input/index.js";
|
|
16
|
+
export { CommonPopOver } from "./popOver/index.js";
|
|
17
|
+
export { CommonSwitch } from "./switch/index.js";
|
|
15
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CommonText","CommonButton","CommonBadge","SafeAreaContainer","ScrollViewContainer","CommonIcon","CommonRating","CommonAvatar","CommonImage","CheckBox","CommonHeader","CommonCard","FoldableCard","LinearProgressBar","CircularProgressBar"],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,iBAAQ;AACnC,SAASC,YAAY,QAAQ,mBAAU;AACvC,SAASC,WAAW,QAAQ,kBAAS;AACrC,SAASC,iBAAiB,EAAEC,mBAAmB,QAAQ,4BAAmB;AAC1E,SAASC,UAAU,QAAQ,iBAAQ;AACnC,SAASC,YAAY,QAAQ,mBAAU;AACvC,SAASC,YAAY,QAAQ,mBAAU;AACvC,SAASC,WAAW,QAAQ,kBAAS;AACrC,SAASC,QAAQ,QAAQ,qBAAY;AACrC,SAASC,YAAY,QAAQ,mBAAU;AACvC,SAASC,UAAU,EAAEC,YAAY,QAAQ,iBAAQ;AACjD,SAASC,iBAAiB,EAAEC,mBAAmB,QAAQ,wBAAe","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["CommonText","CommonButton","CommonBadge","SafeAreaContainer","ScrollViewContainer","CommonIcon","CommonRating","CommonAvatar","CommonImage","CheckBox","CommonHeader","CommonCard","FoldableCard","LinearProgressBar","CircularProgressBar","CommonInput","CommonPopOver","CommonSwitch"],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,iBAAQ;AACnC,SAASC,YAAY,QAAQ,mBAAU;AACvC,SAASC,WAAW,QAAQ,kBAAS;AACrC,SAASC,iBAAiB,EAAEC,mBAAmB,QAAQ,4BAAmB;AAC1E,SAASC,UAAU,QAAQ,iBAAQ;AACnC,SAASC,YAAY,QAAQ,mBAAU;AACvC,SAASC,YAAY,QAAQ,mBAAU;AACvC,SAASC,WAAW,QAAQ,kBAAS;AACrC,SAASC,QAAQ,QAAQ,qBAAY;AACrC,SAASC,YAAY,QAAQ,mBAAU;AACvC,SAASC,UAAU,EAAEC,YAAY,QAAQ,iBAAQ;AACjD,SAASC,iBAAiB,EAAEC,mBAAmB,QAAQ,wBAAe;AACtE,SAASC,WAAW,QAAQ,kBAAS;AACrC,SAASC,aAAa,QAAQ,oBAAW;AACzC,SAASC,YAAY,QAAQ,mBAAU","ignoreList":[]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { StyleSheet, TextInput, View } from 'react-native';
|
|
4
|
+
import { CommonText } from "../text/index.js";
|
|
5
|
+
import { useTheme } from "../../hooks/useTheme.js";
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
const CommonInput = ({
|
|
8
|
+
title,
|
|
9
|
+
warningText,
|
|
10
|
+
type = 'primary',
|
|
11
|
+
...props
|
|
12
|
+
}) => {
|
|
13
|
+
const {
|
|
14
|
+
theme
|
|
15
|
+
} = useTheme();
|
|
16
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
17
|
+
style: styles.container,
|
|
18
|
+
children: [title && /*#__PURE__*/_jsx(CommonText, {
|
|
19
|
+
style: styles.title,
|
|
20
|
+
children: title
|
|
21
|
+
}), /*#__PURE__*/_jsx(TextInput, {
|
|
22
|
+
style: [styles.textInput, {
|
|
23
|
+
backgroundColor: theme.colors.background,
|
|
24
|
+
borderColor: warningText ? theme.colors.warning : theme.colors[type],
|
|
25
|
+
color: warningText ? theme.colors.warning : theme.colors.text
|
|
26
|
+
}],
|
|
27
|
+
autoCapitalize: "none",
|
|
28
|
+
...props
|
|
29
|
+
}), warningText && /*#__PURE__*/_jsx(CommonText, {
|
|
30
|
+
style: [styles.warningTitle, {
|
|
31
|
+
color: theme.colors.warning
|
|
32
|
+
}],
|
|
33
|
+
children: warningText
|
|
34
|
+
})]
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
const styles = StyleSheet.create({
|
|
38
|
+
container: {
|
|
39
|
+
flex: 1,
|
|
40
|
+
padding: 5
|
|
41
|
+
},
|
|
42
|
+
textInput: {
|
|
43
|
+
height: 30,
|
|
44
|
+
paddingLeft: 5,
|
|
45
|
+
// margin: 0,
|
|
46
|
+
borderWidth: 1,
|
|
47
|
+
borderRadius: 3
|
|
48
|
+
},
|
|
49
|
+
title: {
|
|
50
|
+
fontFamily: 'Roboto',
|
|
51
|
+
fontWeight: 700,
|
|
52
|
+
fontSize: 12
|
|
53
|
+
},
|
|
54
|
+
warningTitle: {
|
|
55
|
+
fontFamily: 'Roboto',
|
|
56
|
+
fontWeight: 700,
|
|
57
|
+
fontSize: 12
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
export default CommonInput;
|
|
61
|
+
//# sourceMappingURL=commonInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["StyleSheet","TextInput","View","CommonText","useTheme","jsx","_jsx","jsxs","_jsxs","CommonInput","title","warningText","type","props","theme","style","styles","container","children","textInput","backgroundColor","colors","background","borderColor","warning","color","text","autoCapitalize","warningTitle","create","flex","padding","height","paddingLeft","borderWidth","borderRadius","fontFamily","fontWeight","fontSize"],"sourceRoot":"../../../../src","sources":["components/input/commonInput.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,SAAS,EAAEC,IAAI,QAAQ,cAAc;AAC1D,SAASC,UAAU,QAAQ,kBAAS;AAEpC,SAASC,QAAQ,QAAQ,yBAAsB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEhD,MAAMC,WAAW,GAAGA,CAAC;EACnBC,KAAK;EACLC,WAAW;EACXC,IAAI,GAAG,SAAS;EAChB,GAAGC;AACO,CAAC,KAAK;EAChB,MAAM;IAAEC;EAAM,CAAC,GAAGV,QAAQ,CAAC,CAAC;EAC5B,oBACEI,KAAA,CAACN,IAAI;IAACa,KAAK,EAAEC,MAAM,CAACC,SAAU;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AW","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CommonInput"],"sourceRoot":"../../../../src","sources":["components/input/index.tsx"],"mappings":";;AAAA,OAAOA,WAAW,MAAM,kBAAe;AAEvC,SAASA,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["fontSizeType","s","fontSize","m","l"],"sourceRoot":"../../../../src","sources":["components/input/types.ts"],"mappings":";;AASA,OAAO,MAAMA,YAA4C,GAAG;EAC1DC,CAAC,EAAE;IAAEC,QAAQ,EAAE;EAAG,CAAC;EACnBC,CAAC,EAAE;IAAED,QAAQ,EAAE;EAAG,CAAC;EACnBE,CAAC,EAAE;IAAEF,QAAQ,EAAE;EAAG;AACpB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { StyleSheet, View } from 'react-native';
|
|
4
|
+
import { CommonText } from "../text/index.js";
|
|
5
|
+
import { useTheme } from "../../hooks/useTheme.js";
|
|
6
|
+
|
|
7
|
+
// TODO: Pop Over의 위치에 대한 옵션 추가가 필요함.
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
const CommonPopOver = ({
|
|
10
|
+
type = 'primary',
|
|
11
|
+
visible,
|
|
12
|
+
content
|
|
13
|
+
}) => {
|
|
14
|
+
const {
|
|
15
|
+
theme
|
|
16
|
+
} = useTheme();
|
|
17
|
+
return /*#__PURE__*/_jsx(View, {
|
|
18
|
+
style: styles.container,
|
|
19
|
+
children: visible && /*#__PURE__*/_jsxs(View, {
|
|
20
|
+
style: [styles.popOverContainer],
|
|
21
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
22
|
+
style: [styles.arrow, {
|
|
23
|
+
borderBottomColor: theme.colors[type]
|
|
24
|
+
}]
|
|
25
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
26
|
+
style: [styles.popOver, {
|
|
27
|
+
backgroundColor: theme.colors[type]
|
|
28
|
+
}],
|
|
29
|
+
children: /*#__PURE__*/_jsx(CommonText, {
|
|
30
|
+
style: {
|
|
31
|
+
color: theme.colors.white
|
|
32
|
+
},
|
|
33
|
+
size: "s",
|
|
34
|
+
children: content
|
|
35
|
+
})
|
|
36
|
+
})]
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const styles = StyleSheet.create({
|
|
41
|
+
container: {
|
|
42
|
+
zIndex: 1
|
|
43
|
+
},
|
|
44
|
+
popOverContainer: {
|
|
45
|
+
position: 'absolute'
|
|
46
|
+
},
|
|
47
|
+
overlay: {
|
|
48
|
+
flex: 1
|
|
49
|
+
},
|
|
50
|
+
arrow: {
|
|
51
|
+
left: 10,
|
|
52
|
+
width: 0,
|
|
53
|
+
height: 0,
|
|
54
|
+
borderLeftWidth: 8,
|
|
55
|
+
borderRightWidth: 8,
|
|
56
|
+
borderBottomWidth: 8,
|
|
57
|
+
borderLeftColor: 'transparent',
|
|
58
|
+
borderRightColor: 'transparent',
|
|
59
|
+
borderBottomColor: 'white'
|
|
60
|
+
},
|
|
61
|
+
popOver: {
|
|
62
|
+
padding: 10,
|
|
63
|
+
borderRadius: 10
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
export default CommonPopOver;
|
|
67
|
+
//# sourceMappingURL=commonPopOver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["StyleSheet","View","CommonText","useTheme","jsx","_jsx","jsxs","_jsxs","CommonPopOver","type","visible","content","theme","style","styles","container","children","popOverContainer","arrow","borderBottomColor","colors","popOver","backgroundColor","color","white","size","create","zIndex","position","overlay","flex","left","width","height","borderLeftWidth","borderRightWidth","borderBottomWidth","borderLeftColor","borderRightColor","padding","borderRadius"],"sourceRoot":"../../../../src","sources":["components/popOver/commonPopOver.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAE/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EAAE;IACRC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE,CAAC;IACTC,eAAe,EAAE,CAAC;IAClBC,gBAAgB,EAAE,CAAC;IACnBC,iBAAiB,EAAE,CAAC;IACpBC,eAAe,EAAE,aAAa;IAC9BC,gBAAgB,EAAE,aAAa;IAC/BnB,iBAAiB,EAAE;EACrB,CAAC;EACDE,OAAO,EAAE;IACPkB,OAAO,EAAE,EAAE;IACXC,YAAY,EAAE;EAChB;AACF,CAAC,CAAC;AAEF,eAAehC,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CommonPopOver"],"sourceRoot":"../../../../src","sources":["components/popOver/index.ts"],"mappings":";;AAAA,OAAOA,aAAa,MAAM,oBAAiB;AAE3C,SAASA,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["fontSizeType","s","fontSize","m","l"],"sourceRoot":"../../../../src","sources":["components/popOver/types.tsx"],"mappings":";;AAKA,OAAO,MAAMA,YAA4C,GAAG;EAC1DC,CAAC,EAAE;IAAEC,QAAQ,EAAE;EAAG,CAAC;EACnBC,CAAC,EAAE;IAAED,QAAQ,EAAE;EAAG,CAAC;EACnBE,CAAC,EAAE;IAAEF,QAAQ,EAAE;EAAG;AACpB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/spinner/index.tsx"],"mappings":"AAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/spinner/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef } from 'react';
|
|
4
|
+
import { Animated, Pressable, StyleSheet } from 'react-native';
|
|
5
|
+
import { sizeType } from "./types.js";
|
|
6
|
+
import { useTheme } from "../../hooks/useTheme.js";
|
|
7
|
+
|
|
8
|
+
//TODO: react-native-reanimated로 수정필요
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
export default function CommonSwitch({
|
|
11
|
+
type = 'primary',
|
|
12
|
+
size = 'm',
|
|
13
|
+
value,
|
|
14
|
+
onChange,
|
|
15
|
+
disabled = false,
|
|
16
|
+
...props
|
|
17
|
+
}) {
|
|
18
|
+
const {
|
|
19
|
+
theme
|
|
20
|
+
} = useTheme();
|
|
21
|
+
const animValue = useRef(new Animated.Value(value ? 1 : 0)).current;
|
|
22
|
+
const sizeValue = sizeType[size];
|
|
23
|
+
const containerWidth = (sizeValue + 2) * 2;
|
|
24
|
+
const thumbSize = sizeValue;
|
|
25
|
+
const translateX = containerWidth - thumbSize - 2;
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
Animated.timing(animValue, {
|
|
28
|
+
toValue: value ? translateX : 0,
|
|
29
|
+
duration: 200,
|
|
30
|
+
useNativeDriver: true
|
|
31
|
+
}).start();
|
|
32
|
+
}, [value, translateX, animValue]);
|
|
33
|
+
const toggleValue = () => {
|
|
34
|
+
if (disabled) return;
|
|
35
|
+
onChange?.(!value);
|
|
36
|
+
};
|
|
37
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
38
|
+
style: [styles.container, {
|
|
39
|
+
width: containerWidth,
|
|
40
|
+
height: sizeValue + 2,
|
|
41
|
+
borderRadius: sizeValue / 2 + 1,
|
|
42
|
+
borderColor: disabled ? theme.colors.disabled : theme.colors.border
|
|
43
|
+
}, disabled && styles.disabled],
|
|
44
|
+
onPress: toggleValue,
|
|
45
|
+
disabled: disabled,
|
|
46
|
+
...props,
|
|
47
|
+
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
48
|
+
style: [{
|
|
49
|
+
width: thumbSize,
|
|
50
|
+
height: thumbSize,
|
|
51
|
+
borderRadius: thumbSize / 2,
|
|
52
|
+
backgroundColor: value ? theme.colors[type] : theme.colors.disabled,
|
|
53
|
+
transform: [{
|
|
54
|
+
translateX: animValue
|
|
55
|
+
}]
|
|
56
|
+
}]
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
const styles = StyleSheet.create({
|
|
61
|
+
container: {
|
|
62
|
+
padding: 1,
|
|
63
|
+
justifyContent: 'center',
|
|
64
|
+
borderWidth: 1
|
|
65
|
+
},
|
|
66
|
+
disabled: {
|
|
67
|
+
opacity: 0.5
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=commonSwitch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","Animated","Pressable","StyleSheet","sizeType","useTheme","jsx","_jsx","CommonSwitch","type","size","value","onChange","disabled","props","theme","animValue","Value","current","sizeValue","containerWidth","thumbSize","translateX","timing","toValue","duration","useNativeDriver","start","toggleValue","style","styles","container","width","height","borderRadius","borderColor","colors","border","onPress","children","View","backgroundColor","transform","create","padding","justifyContent","borderWidth","opacity"],"sourceRoot":"../../../../src","sources":["components/switch/commonSwitch.tsx"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SAASC,QAAQ,EAAEC,SAAS,EAAEC,UAAU,QAAQ,cAAc;AAC9D,SAA2BC,QAAQ,QAAQ,YAAS;AACpD,SAASC,QAAQ,QAAQ,yBAAsB;;AAE/C;AAAA,SAAAC,GAAA,IAAAC,IAAA;AACA,eAAe,SAASC,YAAYA,CAAC;EACnCC,IAAI,GAAG,SAAS;EAChBC,IAAI,GAAG,GAAG;EACVC,KAAK;EACLC,QAAQ;EACRC,QAAQ,GAAG,KAAK;EAChB,GAAGC;AACQ,CAAC,EAAE;EACd,MAAM;IAAEC;EAAM,CAAC,GAAGV,QAAQ,CAAC,CAAC;EAE5B,MAAMW,SAAS,GAAGhB,MAAM,CAAC,IAAIC,QAAQ,CAACgB,KAAK,CAACN,KAAK,GAAG,CAAC,GAA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G,CAAC;QAC3BoB,eAAe,EAAE9B,KAAK,GAAGI,KAAK,CAACqB,MAAM,CAAC3B,IAAI,CAAC,GAAGM,KAAK,CAACqB,MAAM,CAACvB,QAAQ;QACnE6B,SAAS,EAAE,CAAC;UAAEpB,UAAU,EAAEN;QAAU,CAAC;MACvC,CAAC;IACD,CACH;EAAC,CACO,CAAC;AAEhB;AAEA,MAAMc,MAAM,GAAG3B,UAAU,CAACwC,MAAM,CAAC;EAC/BZ,SAAS,EAAE;IACTa,OAAO,EAAE,CAAC;IACVC,cAAc,EAAE,QAAQ;IACxBC,WAAW,EAAE;EACf,CAAC;EACDjC,QAAQ,EAAE;IACRkC,OAAO,EAAE;EACX;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/switch/index.
|
|
1
|
+
{"version":3,"names":["CommonSwitch"],"sourceRoot":"../../../../src","sources":["components/switch/index.ts"],"mappings":";;AAAA,OAAOA,YAAY,MAAM,mBAAgB;AAEzC,SAASA,YAAY","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/switch/types.ts"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["sizeType","s","m","l"],"sourceRoot":"../../../../src","sources":["components/switch/types.ts"],"mappings":";;AAKA,OAAO,MAAMA,QAAqC,GAAG;EACnDC,CAAC,EAAE,EAAE;EACLC,CAAC,EAAE,EAAE;EACLC,CAAC,EAAE;AACL,CAAC","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
export { CommonText, CommonButton, CommonBadge, SafeAreaContainer, ScrollViewContainer, CommonIcon, CommonRating, CommonAvatar, CommonImage, CheckBox, CommonHeader, CommonCard, FoldableCard, LinearProgressBar, CircularProgressBar } from "./components/index.js";
|
|
3
|
+
export { CommonText, CommonButton, CommonBadge, SafeAreaContainer, ScrollViewContainer, CommonIcon, CommonRating, CommonAvatar, CommonImage, CheckBox, CommonHeader, CommonCard, FoldableCard, LinearProgressBar, CircularProgressBar, CommonInput, CommonPopOver, CommonSwitch } from "./components/index.js";
|
|
4
4
|
export { ThemeProvider } from "./theme/themeProvider.js";
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CommonText","CommonButton","CommonBadge","SafeAreaContainer","ScrollViewContainer","CommonIcon","CommonRating","CommonAvatar","CommonImage","CheckBox","CommonHeader","CommonCard","FoldableCard","LinearProgressBar","CircularProgressBar","ThemeProvider"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SACEA,UAAU,EACVC,YAAY,EACZC,WAAW,EACXC,iBAAiB,EACjBC,mBAAmB,EACnBC,UAAU,EACVC,YAAY,EACZC,YAAY,EACZC,WAAW,EACXC,QAAQ,EACRC,YAAY,EACZC,UAAU,EACVC,YAAY,EACZC,iBAAiB,EACjBC,mBAAmB,
|
|
1
|
+
{"version":3,"names":["CommonText","CommonButton","CommonBadge","SafeAreaContainer","ScrollViewContainer","CommonIcon","CommonRating","CommonAvatar","CommonImage","CheckBox","CommonHeader","CommonCard","FoldableCard","LinearProgressBar","CircularProgressBar","CommonInput","CommonPopOver","CommonSwitch","ThemeProvider"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SACEA,UAAU,EACVC,YAAY,EACZC,WAAW,EACXC,iBAAiB,EACjBC,mBAAmB,EACnBC,UAAU,EACVC,YAAY,EACZC,YAAY,EACZC,WAAW,EACXC,QAAQ,EACRC,YAAY,EACZC,UAAU,EACVC,YAAY,EACZC,iBAAiB,EACjBC,mBAAmB,EACnBC,WAAW,EACXC,aAAa,EACbC,YAAY,QACP,uBAAc;AACrB,SAASC,aAAa,QAAQ,0BAAuB","ignoreList":[]}
|
|
@@ -10,4 +10,7 @@ export { CheckBox } from './checkBox/index.js';
|
|
|
10
10
|
export { CommonHeader } from './header/index.js';
|
|
11
11
|
export { CommonCard, FoldableCard } from './card/index.js';
|
|
12
12
|
export { LinearProgressBar, CircularProgressBar } from './progressBar/index.js';
|
|
13
|
+
export { CommonInput } from './input/index.js';
|
|
14
|
+
export { CommonPopOver } from './popOver/index.js';
|
|
15
|
+
export { CommonSwitch } from './switch/index.js';
|
|
13
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAQ,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAU,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAS,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,4BAAmB,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAQ,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAU,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAU,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAS,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAU,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAQ,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,wBAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAQ,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAU,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAS,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,4BAAmB,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAQ,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAU,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAU,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAS,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAU,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAQ,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,wBAAe,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAS,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commonInput.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/commonInput.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,YAAS,CAAC;AAG1C,QAAA,MAAM,WAAW,GAAI,wCAKlB,UAAU,gCA4BZ,CAAC;AA0BF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/index.tsx"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,kBAAe,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type TextInputProps, type TextStyle, type ViewStyle } from 'react-native';
|
|
2
|
+
type Variant = 'primary' | 'secondary';
|
|
3
|
+
type SizeVariant = 's' | 'm' | 'l';
|
|
4
|
+
export declare const fontSizeType: Record<SizeVariant, TextStyle>;
|
|
5
|
+
export interface InputProps extends TextInputProps {
|
|
6
|
+
title?: string;
|
|
7
|
+
type?: Variant;
|
|
8
|
+
size?: SizeVariant;
|
|
9
|
+
textStyle?: TextStyle;
|
|
10
|
+
containerStyle?: ViewStyle;
|
|
11
|
+
warningText?: string;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAEtB,KAAK,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC;AACvC,KAAK,WAAW,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAEnC,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,CAIvD,CAAC;AAEF,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commonPopOver.d.ts","sourceRoot":"","sources":["../../../../../src/components/popOver/commonPopOver.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,YAAS,CAAC;AAKlD,QAAA,MAAM,aAAa,GAAI,6BAIpB,kBAAkB,gCA+BpB,CAAC;AA6BF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/popOver/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,oBAAiB,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type TextStyle, type ViewProps } from 'react-native';
|
|
2
|
+
type Variant = 'primary' | 'secondary';
|
|
3
|
+
type SizeVariant = 's' | 'm' | 'l';
|
|
4
|
+
export declare const fontSizeType: Record<SizeVariant, TextStyle>;
|
|
5
|
+
export interface CommonPopOverProps extends ViewProps {
|
|
6
|
+
type?: Variant;
|
|
7
|
+
size?: SizeVariant;
|
|
8
|
+
visible: boolean;
|
|
9
|
+
content: string;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/popOver/types.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9D,KAAK,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC;AACvC,KAAK,WAAW,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAEnC,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,CAIvD,CAAC;AAEF,MAAM,WAAW,kBAAmB,SAAQ,SAAS;IACnD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/spinner/index.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/spinner/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commonSwitch.d.ts","sourceRoot":"","sources":["../../../../../src/components/switch/commonSwitch.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAAY,MAAM,YAAS,CAAC;AAIrD,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,IAAgB,EAChB,IAAU,EACV,KAAK,EACL,QAAQ,EACR,QAAgB,EAChB,GAAG,KAAK,EACT,EAAE,WAAW,+BAoDb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/switch/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/switch/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,mBAAgB,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1 +1,12 @@
|
|
|
1
|
+
import { type PressableProps } from 'react-native';
|
|
2
|
+
type Variant = 'primary' | 'secondary';
|
|
3
|
+
type SizeVariant = 's' | 'm' | 'l';
|
|
4
|
+
export declare const sizeType: Record<SizeVariant, number>;
|
|
5
|
+
export interface SwitchProps extends PressableProps {
|
|
6
|
+
type?: Variant;
|
|
7
|
+
size?: SizeVariant;
|
|
8
|
+
value: boolean;
|
|
9
|
+
onChange?: (value: boolean) => void;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
1
12
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/switch/types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/switch/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,KAAK,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC;AACvC,KAAK,WAAW,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAEnC,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAIhD,CAAC;AAEF,MAAM,WAAW,WAAY,SAAQ,cAAc;IACjD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACrC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { CommonText, CommonButton, CommonBadge, SafeAreaContainer, ScrollViewContainer, CommonIcon, CommonRating, CommonAvatar, CommonImage, CheckBox, CommonHeader, CommonCard, FoldableCard, LinearProgressBar, CircularProgressBar, } from './components/index.js';
|
|
1
|
+
export { CommonText, CommonButton, CommonBadge, SafeAreaContainer, ScrollViewContainer, CommonIcon, CommonRating, CommonAvatar, CommonImage, CheckBox, CommonHeader, CommonCard, FoldableCard, LinearProgressBar, CircularProgressBar, CommonInput, CommonPopOver, CommonSwitch, } from './components/index.js';
|
|
2
2
|
export { ThemeProvider } from './theme/themeProvider.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACX,aAAa,EACb,YAAY,GACb,MAAM,uBAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,0BAAuB,CAAC"}
|
package/package.json
CHANGED
package/src/components/index.ts
CHANGED
|
@@ -10,3 +10,6 @@ export { CheckBox } from './checkBox';
|
|
|
10
10
|
export { CommonHeader } from './header';
|
|
11
11
|
export { CommonCard, FoldableCard } from './card';
|
|
12
12
|
export { LinearProgressBar, CircularProgressBar } from './progressBar';
|
|
13
|
+
export { CommonInput } from './input';
|
|
14
|
+
export { CommonPopOver } from './popOver';
|
|
15
|
+
export { CommonSwitch } from './switch';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { StyleSheet, TextInput, View } from 'react-native';
|
|
2
|
+
import { CommonText } from '../text';
|
|
3
|
+
import { type InputProps } from './types';
|
|
4
|
+
import { useTheme } from '../../hooks/useTheme';
|
|
5
|
+
|
|
6
|
+
const CommonInput = ({
|
|
7
|
+
title,
|
|
8
|
+
warningText,
|
|
9
|
+
type = 'primary',
|
|
10
|
+
...props
|
|
11
|
+
}: InputProps) => {
|
|
12
|
+
const { theme } = useTheme();
|
|
13
|
+
return (
|
|
14
|
+
<View style={styles.container}>
|
|
15
|
+
{title && <CommonText style={styles.title}>{title}</CommonText>}
|
|
16
|
+
<TextInput
|
|
17
|
+
style={[
|
|
18
|
+
styles.textInput,
|
|
19
|
+
{
|
|
20
|
+
backgroundColor: theme.colors.background,
|
|
21
|
+
borderColor: warningText
|
|
22
|
+
? theme.colors.warning
|
|
23
|
+
: theme.colors[type],
|
|
24
|
+
color: warningText ? theme.colors.warning : theme.colors.text,
|
|
25
|
+
},
|
|
26
|
+
]}
|
|
27
|
+
autoCapitalize="none"
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
{warningText && (
|
|
31
|
+
<CommonText
|
|
32
|
+
style={[styles.warningTitle, { color: theme.colors.warning }]}
|
|
33
|
+
>
|
|
34
|
+
{warningText}
|
|
35
|
+
</CommonText>
|
|
36
|
+
)}
|
|
37
|
+
</View>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const styles = StyleSheet.create({
|
|
42
|
+
container: {
|
|
43
|
+
flex: 1,
|
|
44
|
+
padding: 5,
|
|
45
|
+
},
|
|
46
|
+
textInput: {
|
|
47
|
+
height: 30,
|
|
48
|
+
paddingLeft: 5,
|
|
49
|
+
// margin: 0,
|
|
50
|
+
borderWidth: 1,
|
|
51
|
+
borderRadius: 3,
|
|
52
|
+
},
|
|
53
|
+
title: {
|
|
54
|
+
fontFamily: 'Roboto',
|
|
55
|
+
fontWeight: 700,
|
|
56
|
+
fontSize: 12,
|
|
57
|
+
},
|
|
58
|
+
warningTitle: {
|
|
59
|
+
fontFamily: 'Roboto',
|
|
60
|
+
fontWeight: 700,
|
|
61
|
+
fontSize: 12,
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export default CommonInput;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type TextInputProps,
|
|
3
|
+
type TextStyle,
|
|
4
|
+
type ViewStyle,
|
|
5
|
+
} from 'react-native';
|
|
6
|
+
|
|
7
|
+
type Variant = 'primary' | 'secondary';
|
|
8
|
+
type SizeVariant = 's' | 'm' | 'l';
|
|
9
|
+
|
|
10
|
+
export const fontSizeType: Record<SizeVariant, TextStyle> = {
|
|
11
|
+
s: { fontSize: 10 },
|
|
12
|
+
m: { fontSize: 12 },
|
|
13
|
+
l: { fontSize: 14 },
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export interface InputProps extends TextInputProps {
|
|
17
|
+
title?: string;
|
|
18
|
+
type?: Variant;
|
|
19
|
+
size?: SizeVariant;
|
|
20
|
+
textStyle?: TextStyle;
|
|
21
|
+
containerStyle?: ViewStyle;
|
|
22
|
+
warningText?: string;
|
|
23
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { StyleSheet, View } from 'react-native';
|
|
2
|
+
import { type CommonPopOverProps } from './types';
|
|
3
|
+
import { CommonText } from '../text';
|
|
4
|
+
import { useTheme } from '../../hooks/useTheme';
|
|
5
|
+
|
|
6
|
+
// TODO: Pop Over의 위치에 대한 옵션 추가가 필요함.
|
|
7
|
+
const CommonPopOver = ({
|
|
8
|
+
type = 'primary',
|
|
9
|
+
visible,
|
|
10
|
+
content,
|
|
11
|
+
}: CommonPopOverProps) => {
|
|
12
|
+
const { theme } = useTheme();
|
|
13
|
+
return (
|
|
14
|
+
<View style={styles.container}>
|
|
15
|
+
{visible && (
|
|
16
|
+
<View style={[styles.popOverContainer]}>
|
|
17
|
+
<View
|
|
18
|
+
style={[
|
|
19
|
+
styles.arrow,
|
|
20
|
+
{
|
|
21
|
+
borderBottomColor: theme.colors[type],
|
|
22
|
+
},
|
|
23
|
+
]}
|
|
24
|
+
/>
|
|
25
|
+
|
|
26
|
+
<View
|
|
27
|
+
style={[
|
|
28
|
+
styles.popOver,
|
|
29
|
+
{
|
|
30
|
+
backgroundColor: theme.colors[type],
|
|
31
|
+
},
|
|
32
|
+
]}
|
|
33
|
+
>
|
|
34
|
+
<CommonText style={{ color: theme.colors.white }} size="s">
|
|
35
|
+
{content}
|
|
36
|
+
</CommonText>
|
|
37
|
+
</View>
|
|
38
|
+
</View>
|
|
39
|
+
)}
|
|
40
|
+
</View>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const styles = StyleSheet.create({
|
|
45
|
+
container: {
|
|
46
|
+
zIndex: 1,
|
|
47
|
+
},
|
|
48
|
+
popOverContainer: {
|
|
49
|
+
position: 'absolute',
|
|
50
|
+
},
|
|
51
|
+
overlay: {
|
|
52
|
+
flex: 1,
|
|
53
|
+
},
|
|
54
|
+
arrow: {
|
|
55
|
+
left: 10,
|
|
56
|
+
width: 0,
|
|
57
|
+
height: 0,
|
|
58
|
+
borderLeftWidth: 8,
|
|
59
|
+
borderRightWidth: 8,
|
|
60
|
+
borderBottomWidth: 8,
|
|
61
|
+
borderLeftColor: 'transparent',
|
|
62
|
+
borderRightColor: 'transparent',
|
|
63
|
+
borderBottomColor: 'white',
|
|
64
|
+
},
|
|
65
|
+
popOver: {
|
|
66
|
+
padding: 10,
|
|
67
|
+
borderRadius: 10,
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
export default CommonPopOver;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type TextStyle, type ViewProps } from 'react-native';
|
|
2
|
+
|
|
3
|
+
type Variant = 'primary' | 'secondary';
|
|
4
|
+
type SizeVariant = 's' | 'm' | 'l';
|
|
5
|
+
|
|
6
|
+
export const fontSizeType: Record<SizeVariant, TextStyle> = {
|
|
7
|
+
s: { fontSize: 10 },
|
|
8
|
+
m: { fontSize: 12 },
|
|
9
|
+
l: { fontSize: 14 },
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export interface CommonPopOverProps extends ViewProps {
|
|
13
|
+
type?: Variant;
|
|
14
|
+
size?: SizeVariant;
|
|
15
|
+
visible: boolean;
|
|
16
|
+
content: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// TODO: spinner 구현 필요
|
|
File without changes
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { Animated, Pressable, StyleSheet } from 'react-native';
|
|
3
|
+
import { type SwitchProps, sizeType } from './types';
|
|
4
|
+
import { useTheme } from '../../hooks/useTheme';
|
|
5
|
+
|
|
6
|
+
//TODO: react-native-reanimated로 수정필요
|
|
7
|
+
export default function CommonSwitch({
|
|
8
|
+
type = 'primary',
|
|
9
|
+
size = 'm',
|
|
10
|
+
value,
|
|
11
|
+
onChange,
|
|
12
|
+
disabled = false,
|
|
13
|
+
...props
|
|
14
|
+
}: SwitchProps) {
|
|
15
|
+
const { theme } = useTheme();
|
|
16
|
+
|
|
17
|
+
const animValue = useRef(new Animated.Value(value ? 1 : 0)).current;
|
|
18
|
+
|
|
19
|
+
const sizeValue = sizeType[size];
|
|
20
|
+
const containerWidth = (sizeValue + 2) * 2;
|
|
21
|
+
const thumbSize = sizeValue;
|
|
22
|
+
const translateX = containerWidth - thumbSize - 2;
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
Animated.timing(animValue, {
|
|
26
|
+
toValue: value ? translateX : 0,
|
|
27
|
+
duration: 200,
|
|
28
|
+
useNativeDriver: true,
|
|
29
|
+
}).start();
|
|
30
|
+
}, [value, translateX, animValue]);
|
|
31
|
+
|
|
32
|
+
const toggleValue = () => {
|
|
33
|
+
if (disabled) return;
|
|
34
|
+
onChange?.(!value);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Pressable
|
|
39
|
+
style={[
|
|
40
|
+
styles.container,
|
|
41
|
+
{
|
|
42
|
+
width: containerWidth,
|
|
43
|
+
height: sizeValue + 2,
|
|
44
|
+
borderRadius: sizeValue / 2 + 1,
|
|
45
|
+
borderColor: disabled ? theme.colors.disabled : theme.colors.border,
|
|
46
|
+
},
|
|
47
|
+
disabled && styles.disabled,
|
|
48
|
+
]}
|
|
49
|
+
onPress={toggleValue}
|
|
50
|
+
disabled={disabled}
|
|
51
|
+
{...props}
|
|
52
|
+
>
|
|
53
|
+
<Animated.View
|
|
54
|
+
style={[
|
|
55
|
+
{
|
|
56
|
+
width: thumbSize,
|
|
57
|
+
height: thumbSize,
|
|
58
|
+
borderRadius: thumbSize / 2,
|
|
59
|
+
backgroundColor: value ? theme.colors[type] : theme.colors.disabled,
|
|
60
|
+
transform: [{ translateX: animValue }],
|
|
61
|
+
},
|
|
62
|
+
]}
|
|
63
|
+
/>
|
|
64
|
+
</Pressable>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const styles = StyleSheet.create({
|
|
69
|
+
container: {
|
|
70
|
+
padding: 1,
|
|
71
|
+
justifyContent: 'center',
|
|
72
|
+
borderWidth: 1,
|
|
73
|
+
},
|
|
74
|
+
disabled: {
|
|
75
|
+
opacity: 0.5,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type PressableProps } from 'react-native';
|
|
2
|
+
|
|
3
|
+
type Variant = 'primary' | 'secondary';
|
|
4
|
+
type SizeVariant = 's' | 'm' | 'l';
|
|
5
|
+
|
|
6
|
+
export const sizeType: Record<SizeVariant, number> = {
|
|
7
|
+
s: 16,
|
|
8
|
+
m: 20,
|
|
9
|
+
l: 24,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export interface SwitchProps extends PressableProps {
|
|
13
|
+
type?: Variant;
|
|
14
|
+
size?: SizeVariant;
|
|
15
|
+
value: boolean;
|
|
16
|
+
onChange?: (value: boolean) => void;
|
|
17
|
+
}
|
package/src/index.tsx
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// TODO: switch 구현 필요
|