ripal-ui 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/babel.config.js +3 -0
- package/components/Circle.jsx +24 -0
- package/components/DatePicker.jsx +181 -0
- package/components/Tab.jsx +71 -0
- package/components/Table.jsx +73 -0
- package/components/index.js +4 -0
- package/dist/Button.js +109 -0
- package/dist/Circle.js +42 -0
- package/dist/DatePicker.js +199 -0
- package/dist/Dialog.js +81 -0
- package/dist/Dropdown.js +97 -0
- package/dist/Inline.js +38 -0
- package/dist/Input.js +88 -0
- package/dist/ProgressBar.js +64 -0
- package/dist/Separator.js +47 -0
- package/dist/Skeleton.js +62 -0
- package/dist/Switch.js +74 -0
- package/dist/Tab.js +85 -0
- package/dist/Table.js +96 -0
- package/dist/Text.js +78 -0
- package/dist/Toggle.js +54 -0
- package/dist/index.js +34 -0
- package/elements/Button.jsx +91 -0
- package/elements/Dialog.jsx +64 -0
- package/elements/Dropdown.jsx +66 -0
- package/elements/Inline.jsx +16 -0
- package/elements/Input.jsx +48 -0
- package/elements/ProgressBar.jsx +29 -0
- package/elements/Separator.jsx +32 -0
- package/elements/Skeleton.jsx +50 -0
- package/elements/Switch.jsx +49 -0
- package/elements/Text.jsx +42 -0
- package/elements/Toggle.jsx +48 -0
- package/elements/index.js +11 -0
- package/index.js +2 -0
- package/package.json +19 -0
package/babel.config.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Pressable, StyleSheet } from "react-native";
|
|
3
|
+
import config from "../config";
|
|
4
|
+
|
|
5
|
+
const Circle = ({size = 24, color = config.colors.primary, children, onPress, rounded = 999}) => {
|
|
6
|
+
return (
|
|
7
|
+
<Pressable onPress={onPress} style={{
|
|
8
|
+
...styles.area,
|
|
9
|
+
backgroundColor: color,
|
|
10
|
+
height: size,
|
|
11
|
+
borderRadius: rounded
|
|
12
|
+
}}>{children}</Pressable>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const styles = StyleSheet.create({
|
|
17
|
+
area: {
|
|
18
|
+
aspectRatio: 1,
|
|
19
|
+
alignItems: 'center',
|
|
20
|
+
justifyContent: 'center',
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
export default Circle;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { View, TouchableOpacity, StyleSheet } from 'react-native';
|
|
3
|
+
import moment from 'moment';
|
|
4
|
+
import config from '../config';
|
|
5
|
+
import Text from '../elements/Text';
|
|
6
|
+
import Circle from './Circle';
|
|
7
|
+
import { Ionicons } from '@expo/vector-icons';
|
|
8
|
+
|
|
9
|
+
// Calendar component
|
|
10
|
+
const CalendarView = () => {
|
|
11
|
+
const [selectedDate, setSelectedDate] = useState(moment());
|
|
12
|
+
|
|
13
|
+
// Get the start of the current month
|
|
14
|
+
const startOfMonth = selectedDate.clone().startOf('month');
|
|
15
|
+
|
|
16
|
+
// Get the days to display in the calendar
|
|
17
|
+
const daysInMonth = selectedDate.daysInMonth();
|
|
18
|
+
const startDayOfWeek = startOfMonth.day(); // Get the day of the week (0-6)
|
|
19
|
+
|
|
20
|
+
// Get current day (to highlight it)
|
|
21
|
+
const currentDay = moment();
|
|
22
|
+
|
|
23
|
+
// Function to handle month navigation
|
|
24
|
+
const changeMonth = (direction) => {
|
|
25
|
+
const newDate = selectedDate.clone().add(direction, 'month');
|
|
26
|
+
setSelectedDate(newDate);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// Function to handle date selection
|
|
30
|
+
const selectDate = (day) => {
|
|
31
|
+
const newSelectedDate = selectedDate.clone().date(day);
|
|
32
|
+
setSelectedDate(newSelectedDate);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// Render the day headers (Sun, Mon, etc.)
|
|
36
|
+
const renderDayHeaders = () => {
|
|
37
|
+
const dayNames = moment.weekdaysShort(); // ['Sun', 'Mon', ...]
|
|
38
|
+
return (
|
|
39
|
+
<View style={styles.dayHeaderRow}>
|
|
40
|
+
{dayNames.map((day, index) => (
|
|
41
|
+
<Text weight='600SemiBold' color={config.colors.slate[600]} key={index}>{day}</Text>
|
|
42
|
+
))}
|
|
43
|
+
</View>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// Generate the list of days for the calendar (including blank days for padding)
|
|
48
|
+
const renderCalendarDays = () => {
|
|
49
|
+
const days = [];
|
|
50
|
+
// Add blank spaces for the days before the start of the month
|
|
51
|
+
for (let i = 0; i < startDayOfWeek; i++) {
|
|
52
|
+
days.push(null);
|
|
53
|
+
}
|
|
54
|
+
// Add actual days of the month
|
|
55
|
+
for (let i = 1; i <= daysInMonth; i++) {
|
|
56
|
+
days.push(i);
|
|
57
|
+
}
|
|
58
|
+
return days;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<View style={styles.container}>
|
|
63
|
+
{/* Month Navigation */}
|
|
64
|
+
<View style={styles.monthContainer}>
|
|
65
|
+
<Circle color='#fff' onPress={() => changeMonth(-1)}>
|
|
66
|
+
<Ionicons name="chevron-back-outline" />
|
|
67
|
+
</Circle>
|
|
68
|
+
<Text style={{flexGrow: 1}} align='center' color={config.colors.primary} weight='600SemiBold'>
|
|
69
|
+
{selectedDate.format('MMMM YYYY')}
|
|
70
|
+
</Text>
|
|
71
|
+
<Circle color='#fff' onPress={() => changeMonth(1)}>
|
|
72
|
+
<Ionicons name="chevron-forward-outline" />
|
|
73
|
+
</Circle>
|
|
74
|
+
</View>
|
|
75
|
+
|
|
76
|
+
<Text>{selectedDate.format('Y-mm-DD')}</Text>
|
|
77
|
+
|
|
78
|
+
{/* Day Headers */}
|
|
79
|
+
{renderDayHeaders()}
|
|
80
|
+
|
|
81
|
+
{/* Calendar Days */}
|
|
82
|
+
<View style={styles.daysGrid}>
|
|
83
|
+
{renderCalendarDays().map((day, index) => {
|
|
84
|
+
let isActive = day === selectedDate.date() && selectedDate.isSame(currentDay, 'month');
|
|
85
|
+
return (
|
|
86
|
+
(
|
|
87
|
+
<TouchableOpacity
|
|
88
|
+
key={index}
|
|
89
|
+
style={{
|
|
90
|
+
...styles.dayContainer,
|
|
91
|
+
backgroundColor: isActive ? config.colors.primary : '#fff'
|
|
92
|
+
}}
|
|
93
|
+
onPress={() => day && selectDate(day)}
|
|
94
|
+
>
|
|
95
|
+
{day ? (
|
|
96
|
+
<Text color={isActive ? '#fff' : config.colors.slate[500]} style={[
|
|
97
|
+
styles.dayText,
|
|
98
|
+
// Highlight current day in bold
|
|
99
|
+
day === currentDay.date() && selectedDate.isSame(currentDay, 'month') ? styles.currentDayText : null,
|
|
100
|
+
]}>
|
|
101
|
+
{day}
|
|
102
|
+
</Text>
|
|
103
|
+
) : (
|
|
104
|
+
<Text style={styles.blankDay}></Text>
|
|
105
|
+
)}
|
|
106
|
+
</TouchableOpacity>
|
|
107
|
+
)
|
|
108
|
+
)
|
|
109
|
+
})}
|
|
110
|
+
</View>
|
|
111
|
+
</View>
|
|
112
|
+
);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const styles = StyleSheet.create({
|
|
116
|
+
container: {
|
|
117
|
+
padding: 16,
|
|
118
|
+
backgroundColor: '#fff',
|
|
119
|
+
flex: 1,
|
|
120
|
+
},
|
|
121
|
+
monthContainer: {
|
|
122
|
+
flexDirection: 'row',
|
|
123
|
+
justifyContent: 'space-between',
|
|
124
|
+
alignItems: 'center',
|
|
125
|
+
marginBottom: 16,
|
|
126
|
+
},
|
|
127
|
+
monthText: {
|
|
128
|
+
fontSize: 20,
|
|
129
|
+
fontWeight: 'bold',
|
|
130
|
+
},
|
|
131
|
+
navButton: {
|
|
132
|
+
fontSize: 16,
|
|
133
|
+
color: '#007bff',
|
|
134
|
+
},
|
|
135
|
+
dayHeaderRow: {
|
|
136
|
+
flexDirection: 'row',
|
|
137
|
+
justifyContent: 'space-between',
|
|
138
|
+
marginBottom: 10,
|
|
139
|
+
},
|
|
140
|
+
dayHeaderText: {
|
|
141
|
+
width: '14%', // Ensure each day header takes up 1/7 of the row
|
|
142
|
+
textAlign: 'center',
|
|
143
|
+
fontWeight: 'bold',
|
|
144
|
+
},
|
|
145
|
+
daysGrid: {
|
|
146
|
+
flexDirection: 'row',
|
|
147
|
+
flexWrap: 'wrap',
|
|
148
|
+
},
|
|
149
|
+
dayContainer: {
|
|
150
|
+
width: '14.28%', // Ensures 7 items per row (100 / 7 = 14.28)
|
|
151
|
+
height: 46,
|
|
152
|
+
justifyContent: 'center',
|
|
153
|
+
alignItems: 'center',
|
|
154
|
+
borderRadius: 999,
|
|
155
|
+
},
|
|
156
|
+
dayText: {
|
|
157
|
+
fontSize: 16,
|
|
158
|
+
},
|
|
159
|
+
selectedDayText: {
|
|
160
|
+
backgroundColor: '#007bff',
|
|
161
|
+
color: '#fff',
|
|
162
|
+
borderRadius: 20,
|
|
163
|
+
// paddingHorizontal: 10,
|
|
164
|
+
// paddingVertical: 5,
|
|
165
|
+
},
|
|
166
|
+
selectedDayHighlight: {
|
|
167
|
+
backgroundColor: '#007bff',
|
|
168
|
+
color: '#fff',
|
|
169
|
+
borderRadius: 20,
|
|
170
|
+
paddingHorizontal: 10,
|
|
171
|
+
paddingVertical: 5,
|
|
172
|
+
},
|
|
173
|
+
currentDayText: {
|
|
174
|
+
fontWeight: 'bold', // Bold the current day
|
|
175
|
+
},
|
|
176
|
+
blankDay: {
|
|
177
|
+
height: 0,
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
export default CalendarView;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { Pressable, ScrollView, StyleSheet, View } from "react-native";
|
|
3
|
+
import Text from "../elements/Text";
|
|
4
|
+
import Inline from "../elements/Inline";
|
|
5
|
+
import config from "../config";
|
|
6
|
+
|
|
7
|
+
const TabScreen = ({children}) => {
|
|
8
|
+
return children;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const Tab = ({children}) => {
|
|
12
|
+
const [index, setIndex] = useState(0);
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<View>
|
|
16
|
+
{
|
|
17
|
+
children.length > 3 ?
|
|
18
|
+
<ScrollView horizontal showsHorizontalScrollIndicator={false} contentContainerStyle={styles.tab_area}>
|
|
19
|
+
{ children.map((child, c) => {
|
|
20
|
+
let isActive = c === index;
|
|
21
|
+
return (
|
|
22
|
+
<Pressable key={c} style={{
|
|
23
|
+
...styles.tab_item,
|
|
24
|
+
borderBottomColor: isActive ? config.colors.primary : config.colors.slate[200],
|
|
25
|
+
}} onPress={() => setIndex(c)}>
|
|
26
|
+
<Text
|
|
27
|
+
color={isActive ? config.colors.primary : config.colors.slate[500]}
|
|
28
|
+
weight={isActive ? "600SemiBold" : "400Regular"}
|
|
29
|
+
>{child.props.title}</Text>
|
|
30
|
+
</Pressable>
|
|
31
|
+
)
|
|
32
|
+
})}
|
|
33
|
+
</ScrollView>
|
|
34
|
+
:
|
|
35
|
+
<Inline style={styles.tab_area} gap={0}>
|
|
36
|
+
{ children.map((child, c) => {
|
|
37
|
+
let isActive = c === index;
|
|
38
|
+
return (
|
|
39
|
+
<Inline justifyContent="center" key={c} style={{
|
|
40
|
+
...styles.tab_item,
|
|
41
|
+
borderBottomColor: isActive ? config.colors.primary : config.colors.slate[200],
|
|
42
|
+
}} onPress={() => setIndex(c)}>
|
|
43
|
+
<Text
|
|
44
|
+
color={isActive ? config.colors.primary : config.colors.slate[500]}
|
|
45
|
+
weight={isActive ? "600SemiBold" : "400Regular"}
|
|
46
|
+
>{child.props.title}</Text>
|
|
47
|
+
</Inline>
|
|
48
|
+
)
|
|
49
|
+
})}
|
|
50
|
+
</Inline>
|
|
51
|
+
}
|
|
52
|
+
{
|
|
53
|
+
children[index]
|
|
54
|
+
}
|
|
55
|
+
</View>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const styles = StyleSheet.create({
|
|
60
|
+
tab_area: {
|
|
61
|
+
marginBottom: 10,
|
|
62
|
+
},
|
|
63
|
+
tab_item: {
|
|
64
|
+
paddingHorizontal: 20,
|
|
65
|
+
paddingVertical: 12,
|
|
66
|
+
flexGrow: 1,
|
|
67
|
+
borderBottomWidth: 1,
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
export { Tab, TabScreen }
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, ScrollView, StyleSheet } from 'react-native';
|
|
3
|
+
import Text from '../elements/Text';
|
|
4
|
+
import config from '../config';
|
|
5
|
+
|
|
6
|
+
// Cell component
|
|
7
|
+
const Cell = ({ children, isHeader, width, flexible }) => {
|
|
8
|
+
return (
|
|
9
|
+
<View style={[styles.cell, { width: flexible ? 'auto' : width, flex: flexible ? 1 : undefined }]}>
|
|
10
|
+
<Text weight={isHeader ? '600SemiBold' : '400Regular'}>
|
|
11
|
+
{children}
|
|
12
|
+
</Text>
|
|
13
|
+
</View>
|
|
14
|
+
);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// Row component
|
|
18
|
+
const Row = ({ children, isHeader, cellWidth, flexible }) => {
|
|
19
|
+
return (
|
|
20
|
+
<View style={styles.row}>
|
|
21
|
+
{React.Children.map(children, (child) =>
|
|
22
|
+
React.cloneElement(child, { isHeader, width: cellWidth, flexible })
|
|
23
|
+
)}
|
|
24
|
+
</View>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// Table component with dynamic width adjustment and scroll if more than 3 cells
|
|
29
|
+
const Table = ({ children, cellWidth = 100 }) => {
|
|
30
|
+
// Determine if any row has more than 3 cells
|
|
31
|
+
const hasManyCells = React.Children.toArray(children).some(child => {
|
|
32
|
+
return React.Children.count(child.props.children) > 3;
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
return hasManyCells ? (
|
|
36
|
+
<ScrollView horizontal>
|
|
37
|
+
<View style={styles.table}>
|
|
38
|
+
{React.Children.map(children, (child, index) => (
|
|
39
|
+
// Automatically pass `isHeader` for the first row (index 0)
|
|
40
|
+
React.cloneElement(child, { isHeader: index === 0, cellWidth, flexible: false })
|
|
41
|
+
))}
|
|
42
|
+
</View>
|
|
43
|
+
</ScrollView>
|
|
44
|
+
) : (
|
|
45
|
+
<View style={styles.table}>
|
|
46
|
+
{React.Children.map(children, (child, index) => (
|
|
47
|
+
React.cloneElement(child, { isHeader: index === 0, cellWidth, flexible: true })
|
|
48
|
+
))}
|
|
49
|
+
</View>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export { Table, Row, Cell };
|
|
54
|
+
|
|
55
|
+
const styles = StyleSheet.create({
|
|
56
|
+
row: {
|
|
57
|
+
flexDirection: 'row',
|
|
58
|
+
borderBottomWidth: 1,
|
|
59
|
+
borderColor: config.colors.slate[200],
|
|
60
|
+
},
|
|
61
|
+
cell: {
|
|
62
|
+
padding: 10,
|
|
63
|
+
borderColor: config.colors.slate[200],
|
|
64
|
+
justifyContent: 'center',
|
|
65
|
+
},
|
|
66
|
+
cellText: {
|
|
67
|
+
fontSize: 16,
|
|
68
|
+
},
|
|
69
|
+
headerText: {
|
|
70
|
+
fontSize: 16,
|
|
71
|
+
fontWeight: 'bold',
|
|
72
|
+
}
|
|
73
|
+
});
|
package/dist/Button.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _config = _interopRequireDefault(require("../config"));
|
|
10
|
+
var _Text = _interopRequireDefault(require("./Text"));
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
12
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
13
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
14
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
17
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
18
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
19
|
+
var Button = function Button(_ref) {
|
|
20
|
+
var children = _ref.children,
|
|
21
|
+
_ref$accent = _ref.accent,
|
|
22
|
+
accent = _ref$accent === void 0 ? 'primary' : _ref$accent,
|
|
23
|
+
onPress = _ref.onPress,
|
|
24
|
+
onLongPress = _ref.onLongPress,
|
|
25
|
+
_ref$color = _ref.color,
|
|
26
|
+
color = _ref$color === void 0 ? _config["default"].colors.primary : _ref$color,
|
|
27
|
+
_ref$height = _ref.height,
|
|
28
|
+
height = _ref$height === void 0 ? 50 : _ref$height,
|
|
29
|
+
_ref$circle = _ref.circle,
|
|
30
|
+
circle = _ref$circle === void 0 ? false : _ref$circle,
|
|
31
|
+
_ref$justifyContent = _ref.justifyContent,
|
|
32
|
+
justifyContent = _ref$justifyContent === void 0 ? 'center' : _ref$justifyContent,
|
|
33
|
+
style = _ref.style,
|
|
34
|
+
textProps = _ref.textProps;
|
|
35
|
+
var getAccentStyle = function getAccentStyle() {
|
|
36
|
+
switch (accent) {
|
|
37
|
+
case 'primary':
|
|
38
|
+
return {
|
|
39
|
+
backgroundColor: color,
|
|
40
|
+
borderColor: color,
|
|
41
|
+
color: '#fff'
|
|
42
|
+
};
|
|
43
|
+
case 'secondary':
|
|
44
|
+
return {
|
|
45
|
+
backgroundColor: '#fff',
|
|
46
|
+
borderColor: color,
|
|
47
|
+
color: color
|
|
48
|
+
};
|
|
49
|
+
case 'tertiary':
|
|
50
|
+
return {
|
|
51
|
+
backgroundColor: '#fff',
|
|
52
|
+
color: color,
|
|
53
|
+
borderColor: _config["default"].colors.transparent
|
|
54
|
+
};
|
|
55
|
+
default:
|
|
56
|
+
return {};
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
var getColorStyle = function getColorStyle() {
|
|
60
|
+
switch (color) {
|
|
61
|
+
case 'red':
|
|
62
|
+
return {
|
|
63
|
+
backgroundColor: '#e74c3c',
|
|
64
|
+
borderColor: '#e74c3c'
|
|
65
|
+
};
|
|
66
|
+
case 'green':
|
|
67
|
+
return {
|
|
68
|
+
backgroundColor: '#2ecc71',
|
|
69
|
+
borderColor: '#2ecc71'
|
|
70
|
+
};
|
|
71
|
+
case 'white':
|
|
72
|
+
return {
|
|
73
|
+
backgroundColor: '#fff',
|
|
74
|
+
borderColor: '#fff'
|
|
75
|
+
};
|
|
76
|
+
default:
|
|
77
|
+
return {};
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
return /*#__PURE__*/_react["default"].createElement(_reactNative.TouchableOpacity, {
|
|
81
|
+
onPress: onPress,
|
|
82
|
+
onLongPress: onLongPress,
|
|
83
|
+
style: [styles.button, getAccentStyle(), getColorStyle(), _objectSpread({
|
|
84
|
+
height: height,
|
|
85
|
+
aspectRatio: circle ? 1 : 'auto',
|
|
86
|
+
borderRadius: circle ? 999 : 12,
|
|
87
|
+
justifyContent: justifyContent
|
|
88
|
+
}, style)]
|
|
89
|
+
}, /*#__PURE__*/_react["default"].createElement(_Text["default"], _extends({}, textProps, {
|
|
90
|
+
color: accent === "primary" ? "#fff" : color,
|
|
91
|
+
style: styles.text,
|
|
92
|
+
weight: "600SemiBold"
|
|
93
|
+
}), children));
|
|
94
|
+
};
|
|
95
|
+
var styles = _reactNative.StyleSheet.create({
|
|
96
|
+
button: {
|
|
97
|
+
paddingHorizontal: 20,
|
|
98
|
+
height: 50,
|
|
99
|
+
borderRadius: 8,
|
|
100
|
+
fontWeight: '600',
|
|
101
|
+
fontSize: 14,
|
|
102
|
+
display: 'flex',
|
|
103
|
+
flexDirection: 'row',
|
|
104
|
+
alignItems: 'center',
|
|
105
|
+
justifyContent: 'center',
|
|
106
|
+
borderWidth: 1
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
var _default = exports["default"] = Button;
|
package/dist/Circle.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _config = _interopRequireDefault(require("../config"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
16
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
|
+
var Circle = function Circle(_ref) {
|
|
18
|
+
var _ref$size = _ref.size,
|
|
19
|
+
size = _ref$size === void 0 ? 24 : _ref$size,
|
|
20
|
+
_ref$color = _ref.color,
|
|
21
|
+
color = _ref$color === void 0 ? _config["default"].colors.primary : _ref$color,
|
|
22
|
+
children = _ref.children,
|
|
23
|
+
onPress = _ref.onPress,
|
|
24
|
+
_ref$rounded = _ref.rounded,
|
|
25
|
+
rounded = _ref$rounded === void 0 ? 999 : _ref$rounded;
|
|
26
|
+
return /*#__PURE__*/_react["default"].createElement(_reactNative.Pressable, {
|
|
27
|
+
onPress: onPress,
|
|
28
|
+
style: _objectSpread(_objectSpread({}, styles.area), {}, {
|
|
29
|
+
backgroundColor: color,
|
|
30
|
+
height: size,
|
|
31
|
+
borderRadius: rounded
|
|
32
|
+
})
|
|
33
|
+
}, children);
|
|
34
|
+
};
|
|
35
|
+
var styles = _reactNative.StyleSheet.create({
|
|
36
|
+
area: {
|
|
37
|
+
aspectRatio: 1,
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
justifyContent: 'center'
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
var _default = exports["default"] = Circle;
|