aport-tools 4.3.6 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! aport-tools v4.3.6 | ISC */
1
+ /*! aport-tools v4.4.0 | ISC */
2
2
  'use strict';
3
3
 
4
4
  var React = require('react');
@@ -118,6 +118,66 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
118
118
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
119
119
  };
120
120
 
121
+ var Stepper = function Stepper(_a) {
122
+ var steps = _a.steps,
123
+ currentStep = _a.currentStep,
124
+ _b = _a.presseable,
125
+ presseable = _b === void 0 ? false : _b,
126
+ _onPress = _a.onPress;
127
+ return /*#__PURE__*/React.createElement(reactNative.View, {
128
+ style: styles$9.container
129
+ }, steps.map(function (label, index) {
130
+ return /*#__PURE__*/React.createElement(reactNative.TouchableOpacity, {
131
+ key: index,
132
+ style: [styles$9.stepContainer, index <= currentStep ? styles$9.activeStep : styles$9.inactiveStep],
133
+ disabled: !presseable,
134
+ onPress: function onPress() {
135
+ return _onPress && _onPress(index);
136
+ }
137
+ }, /*#__PURE__*/React.createElement(reactNative.View, {
138
+ style: styles$9.stepCircle
139
+ }, /*#__PURE__*/React.createElement(reactNative.Text, {
140
+ style: styles$9.stepLabel
141
+ }, index + 1)), /*#__PURE__*/React.createElement(reactNative.Text, {
142
+ style: styles$9.stepText
143
+ }, label));
144
+ }));
145
+ };
146
+ var styles$9 = reactNative.StyleSheet.create({
147
+ container: {
148
+ flexDirection: "row",
149
+ alignItems: "center",
150
+ justifyContent: "space-between",
151
+ marginBottom: 16
152
+ },
153
+ stepContainer: {
154
+ alignItems: "center",
155
+ flex: 1
156
+ },
157
+ stepCircle: {
158
+ width: 30,
159
+ height: 30,
160
+ borderRadius: 15,
161
+ alignItems: "center",
162
+ justifyContent: "center",
163
+ marginBottom: 4
164
+ },
165
+ activeStep: {
166
+ backgroundColor: "#3498db"
167
+ },
168
+ inactiveStep: {
169
+ backgroundColor: "#aaaaaa"
170
+ },
171
+ stepLabel: {
172
+ color: "#ffffff",
173
+ fontWeight: "bold"
174
+ },
175
+ stepText: {
176
+ fontSize: 12,
177
+ textAlign: "center"
178
+ }
179
+ });
180
+
121
181
  // src/forms/FormContext.tsx
122
182
  var FormContext = /*#__PURE__*/React.createContext(undefined);
123
183
  var useFormContext = function useFormContext() {
@@ -129,7 +189,8 @@ var useFormContext = function useFormContext() {
129
189
  };
130
190
  var Form = function Form(_a) {
131
191
  var children = _a.children,
132
- onSubmit = _a.onSubmit;
192
+ onSubmit = _a.onSubmit,
193
+ stepper = _a.stepper;
133
194
  var _b = React.useState({}),
134
195
  formValues = _b[0],
135
196
  setFormValues = _b[1];
@@ -170,7 +231,12 @@ var Form = function Form(_a) {
170
231
  setErrors: setErrors,
171
232
  handleSubmit: handleSubmit
172
233
  }
173
- }, children);
234
+ }, stepper && (/*#__PURE__*/React.createElement(Stepper, {
235
+ steps: stepper.steps,
236
+ currentStep: stepper.step,
237
+ presseable: stepper.presseable,
238
+ onPress: stepper.onPress
239
+ })), children);
174
240
  };
175
241
 
176
242
  // src/fonts/Text.tsx