fluent-styles 1.0.0
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/README.md +77 -0
- package/lib/commonjs/assets/img/doctor.png +0 -0
- package/lib/commonjs/index.js +248 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package/badge/index.js +159 -0
- package/lib/commonjs/package/badge/index.js.map +1 -0
- package/lib/commonjs/package/button/index.js +96 -0
- package/lib/commonjs/package/button/index.js.map +1 -0
- package/lib/commonjs/package/card/index.js +32 -0
- package/lib/commonjs/package/card/index.js.map +1 -0
- package/lib/commonjs/package/checkBox/index.js +84 -0
- package/lib/commonjs/package/checkBox/index.js.map +1 -0
- package/lib/commonjs/package/cycle/index.js +28 -0
- package/lib/commonjs/package/cycle/index.js.map +1 -0
- package/lib/commonjs/package/dialog/index.js +192 -0
- package/lib/commonjs/package/dialog/index.js.map +1 -0
- package/lib/commonjs/package/dropdown/index.js +116 -0
- package/lib/commonjs/package/dropdown/index.js.map +1 -0
- package/lib/commonjs/package/form/index.js +184 -0
- package/lib/commonjs/package/form/index.js.map +1 -0
- package/lib/commonjs/package/header/index.js +89 -0
- package/lib/commonjs/package/header/index.js.map +1 -0
- package/lib/commonjs/package/image/index.js +123 -0
- package/lib/commonjs/package/image/index.js.map +1 -0
- package/lib/commonjs/package/radioButton/index.js +84 -0
- package/lib/commonjs/package/radioButton/index.js.map +1 -0
- package/lib/commonjs/package/safeAreaView/index.js +16 -0
- package/lib/commonjs/package/safeAreaView/index.js.map +1 -0
- package/lib/commonjs/package/scrollView/index.js +16 -0
- package/lib/commonjs/package/scrollView/index.js.map +1 -0
- package/lib/commonjs/package/separator/index.js +33 -0
- package/lib/commonjs/package/separator/index.js.map +1 -0
- package/lib/commonjs/package/spacer/index.js +18 -0
- package/lib/commonjs/package/spacer/index.js.map +1 -0
- package/lib/commonjs/package/spinner/index.js +43 -0
- package/lib/commonjs/package/spinner/index.js.map +1 -0
- package/lib/commonjs/package/stack/__test__/index.test.js +91 -0
- package/lib/commonjs/package/stack/__test__/index.test.js.map +1 -0
- package/lib/commonjs/package/stack/index.js +41 -0
- package/lib/commonjs/package/stack/index.js.map +1 -0
- package/lib/commonjs/package/styled/__test__/index.test.js +161 -0
- package/lib/commonjs/package/styled/__test__/index.test.js.map +1 -0
- package/lib/commonjs/package/styled/index.js +42 -0
- package/lib/commonjs/package/styled/index.js.map +1 -0
- package/lib/commonjs/package/switch/index.js +43 -0
- package/lib/commonjs/package/switch/index.js.map +1 -0
- package/lib/commonjs/package/text/index.js +73 -0
- package/lib/commonjs/package/text/index.js.map +1 -0
- package/lib/commonjs/package/theme.js +384 -0
- package/lib/commonjs/package/theme.js.map +1 -0
- package/lib/commonjs/package/utils/index.js +130 -0
- package/lib/commonjs/package/utils/index.js.map +1 -0
- package/lib/commonjs/styled.code-workspace +9 -0
- package/lib/module/assets/img/doctor.png +0 -0
- package/lib/module/index.js +23 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package/badge/index.js +151 -0
- package/lib/module/package/badge/index.js.map +1 -0
- package/lib/module/package/button/index.js +89 -0
- package/lib/module/package/button/index.js.map +1 -0
- package/lib/module/package/card/index.js +25 -0
- package/lib/module/package/card/index.js.map +1 -0
- package/lib/module/package/checkBox/index.js +75 -0
- package/lib/module/package/checkBox/index.js.map +1 -0
- package/lib/module/package/cycle/index.js +21 -0
- package/lib/module/package/cycle/index.js.map +1 -0
- package/lib/module/package/dialog/index.js +182 -0
- package/lib/module/package/dialog/index.js.map +1 -0
- package/lib/module/package/dropdown/index.js +106 -0
- package/lib/module/package/dropdown/index.js.map +1 -0
- package/lib/module/package/form/index.js +176 -0
- package/lib/module/package/form/index.js.map +1 -0
- package/lib/module/package/header/index.js +83 -0
- package/lib/module/package/header/index.js.map +1 -0
- package/lib/module/package/image/index.js +115 -0
- package/lib/module/package/image/index.js.map +1 -0
- package/lib/module/package/radioButton/index.js +75 -0
- package/lib/module/package/radioButton/index.js.map +1 -0
- package/lib/module/package/safeAreaView/index.js +11 -0
- package/lib/module/package/safeAreaView/index.js.map +1 -0
- package/lib/module/package/scrollView/index.js +11 -0
- package/lib/module/package/scrollView/index.js.map +1 -0
- package/lib/module/package/separator/index.js +26 -0
- package/lib/module/package/separator/index.js.map +1 -0
- package/lib/module/package/spacer/index.js +11 -0
- package/lib/module/package/spacer/index.js.map +1 -0
- package/lib/module/package/spinner/index.js +36 -0
- package/lib/module/package/spinner/index.js.map +1 -0
- package/lib/module/package/stack/__test__/index.test.js +89 -0
- package/lib/module/package/stack/__test__/index.test.js.map +1 -0
- package/lib/module/package/stack/index.js +36 -0
- package/lib/module/package/stack/index.js.map +1 -0
- package/lib/module/package/styled/__test__/index.test.js +158 -0
- package/lib/module/package/styled/__test__/index.test.js.map +1 -0
- package/lib/module/package/styled/index.js +35 -0
- package/lib/module/package/styled/index.js.map +1 -0
- package/lib/module/package/switch/index.js +36 -0
- package/lib/module/package/switch/index.js.map +1 -0
- package/lib/module/package/text/index.js +68 -0
- package/lib/module/package/text/index.js.map +1 -0
- package/lib/module/package/theme.js +379 -0
- package/lib/module/package/theme.js.map +1 -0
- package/lib/module/package/utils/index.js +120 -0
- package/lib/module/package/utils/index.js.map +1 -0
- package/lib/module/styled.code-workspace +9 -0
- package/package.json +85 -0
- package/src/assets/img/doctor.png +0 -0
- package/src/index.js +23 -0
- package/src/package/badge/index.jsx +133 -0
- package/src/package/button/index.jsx +80 -0
- package/src/package/card/index.jsx +38 -0
- package/src/package/checkBox/index.jsx +80 -0
- package/src/package/cycle/index.jsx +23 -0
- package/src/package/dialog/index.jsx +214 -0
- package/src/package/dropdown/index.jsx +102 -0
- package/src/package/form/index.jsx +145 -0
- package/src/package/header/index.jsx +92 -0
- package/src/package/image/index.jsx +93 -0
- package/src/package/radioButton/index.jsx +81 -0
- package/src/package/safeAreaView/index.jsx +12 -0
- package/src/package/scrollView/index.jsx +12 -0
- package/src/package/separator/index.jsx +26 -0
- package/src/package/spacer/index.jsx +13 -0
- package/src/package/spinner/index.jsx +33 -0
- package/src/package/stack/__test__/index.test.js +68 -0
- package/src/package/stack/index.jsx +37 -0
- package/src/package/styled/__test__/index.test.js +132 -0
- package/src/package/styled/index.js +32 -0
- package/src/package/switch/index.jsx +33 -0
- package/src/package/text/index.jsx +61 -0
- package/src/package/theme.js +376 -0
- package/src/package/utils/index.js +108 -0
- package/src/styled.code-workspace +9 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Platform, Dimensions } from 'react-native'
|
|
2
|
+
import { theme } from '../theme'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
|
|
5
|
+
export const isValidColor = value =>
|
|
6
|
+
/^#[0-9A-F]{6}$/i.test(value) || typeof value === 'string' // Simple hex color validation, expand as needed
|
|
7
|
+
export const isValidNumber = value => typeof value === 'number' && isFinite(value)
|
|
8
|
+
export const isValidString = value =>
|
|
9
|
+
typeof value === 'string' && value.trim().length > 0
|
|
10
|
+
|
|
11
|
+
const shadow = {
|
|
12
|
+
light: Platform.select({
|
|
13
|
+
ios: {
|
|
14
|
+
shadowColor: theme.colors.gray[900],
|
|
15
|
+
shadowOffset: { width: 0, height: 1 },
|
|
16
|
+
shadowOpacity: 0.22,
|
|
17
|
+
shadowRadius: 2.22
|
|
18
|
+
},
|
|
19
|
+
android: {
|
|
20
|
+
elevation: 1
|
|
21
|
+
}
|
|
22
|
+
}),
|
|
23
|
+
lightMedium: Platform.select({
|
|
24
|
+
ios: {
|
|
25
|
+
shadowColor: theme.colors.gray[900],
|
|
26
|
+
shadowOffset: { width: 0, height: 2 },
|
|
27
|
+
shadowOpacity: 0.24,
|
|
28
|
+
shadowRadius: 2.84
|
|
29
|
+
},
|
|
30
|
+
android: {
|
|
31
|
+
elevation: 3
|
|
32
|
+
}
|
|
33
|
+
}),
|
|
34
|
+
medium: Platform.select({
|
|
35
|
+
ios: {
|
|
36
|
+
shadowColor: theme.colors.gray[900],
|
|
37
|
+
shadowOffset: { width: 0, height: 3 },
|
|
38
|
+
shadowOpacity: 0.29,
|
|
39
|
+
shadowRadius: 4.65
|
|
40
|
+
},
|
|
41
|
+
android: {
|
|
42
|
+
elevation: 7
|
|
43
|
+
}
|
|
44
|
+
}),
|
|
45
|
+
mediumDark: Platform.select({
|
|
46
|
+
ios: {
|
|
47
|
+
shadowColor: theme.colors.gray[900],
|
|
48
|
+
shadowOffset: { width: 0, height: 5 },
|
|
49
|
+
shadowOpacity: 0.36,
|
|
50
|
+
shadowRadius: 6.68
|
|
51
|
+
},
|
|
52
|
+
android: {
|
|
53
|
+
elevation: 10
|
|
54
|
+
}
|
|
55
|
+
}),
|
|
56
|
+
dark: Platform.select({
|
|
57
|
+
ios: {
|
|
58
|
+
shadowColor: theme.colors.gray[900],
|
|
59
|
+
shadowOffset: { width: 0, height: 7 },
|
|
60
|
+
shadowOpacity: 0.41,
|
|
61
|
+
shadowRadius: 9.11
|
|
62
|
+
},
|
|
63
|
+
android: {
|
|
64
|
+
elevation: 14
|
|
65
|
+
}
|
|
66
|
+
}),
|
|
67
|
+
veryDark: Platform.select({
|
|
68
|
+
ios: {
|
|
69
|
+
shadowColor: theme.colors.gray[900],
|
|
70
|
+
shadowOffset: { width: 0, height: 10 },
|
|
71
|
+
shadowOpacity: 0.5,
|
|
72
|
+
shadowRadius: 13.34
|
|
73
|
+
},
|
|
74
|
+
android: {
|
|
75
|
+
elevation: 20
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
class ErrorBoundary extends React.Component {
|
|
81
|
+
constructor (props) {
|
|
82
|
+
super(props)
|
|
83
|
+
this.state = { hasError: false }
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
static getDerivedStateFromError (error) {
|
|
87
|
+
return { hasError: true }
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
componentDidCatch (error, info) {
|
|
91
|
+
console.log(error, info.componentStack)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
render () {
|
|
95
|
+
if (this.state.hasError) {
|
|
96
|
+
return this.props.fallback
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return this.props.children
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export const isIOS = Platform.OS === 'ios'
|
|
104
|
+
export const isAndroid = !isIOS
|
|
105
|
+
export const windowWidth = Dimensions.get('window').width
|
|
106
|
+
export const windowHeight = Dimensions.get('window').height
|
|
107
|
+
|
|
108
|
+
export { shadow, ErrorBoundary }
|