fluent-styles 1.56.0 → 1.58.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/lib/commonjs/index.js +49 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/spinner/index.js +279 -0
- package/lib/commonjs/spinner/index.js.map +1 -0
- package/lib/commonjs/utiles/validators.js +70 -1
- package/lib/commonjs/utiles/validators.js.map +1 -1
- package/lib/module/index.js +4 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/spinner/index.js +275 -0
- package/lib/module/spinner/index.js.map +1 -0
- package/lib/module/utiles/validators.js +70 -0
- package/lib/module/utiles/validators.js.map +1 -1
- package/lib/typescript/index.d.ts +4 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/spinner/index.d.ts +75 -0
- package/lib/typescript/spinner/index.d.ts.map +1 -0
- package/lib/typescript/utiles/validators.d.ts +28 -0
- package/lib/typescript/utiles/validators.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +4 -1
- package/src/spinner/index.tsx +369 -0
- package/src/utiles/validators.ts +88 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { ActivityIndicator } from 'react-native';
|
|
5
|
+
import { theme } from "../utiles/theme.js";
|
|
6
|
+
import { styled } from "../utiles/styled.js";
|
|
7
|
+
import { YStack, XStack } from "../stack/index.js";
|
|
8
|
+
import { StyledText } from "../text/index.js";
|
|
9
|
+
import { StyledButton } from "../button/index.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Props for Spinner component
|
|
13
|
+
*/
|
|
14
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
/**
|
|
16
|
+
* Size configuration for Spinner
|
|
17
|
+
*/
|
|
18
|
+
const sizeConfig = {
|
|
19
|
+
small: 30,
|
|
20
|
+
medium: 50,
|
|
21
|
+
large: 80
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Variant configuration for Spinner
|
|
26
|
+
*/
|
|
27
|
+
const variantConfig = {
|
|
28
|
+
default: {
|
|
29
|
+
color: theme.colors.gray[400],
|
|
30
|
+
label: 'default'
|
|
31
|
+
},
|
|
32
|
+
primary: {
|
|
33
|
+
color: theme.colors.blue[500],
|
|
34
|
+
label: 'primary'
|
|
35
|
+
},
|
|
36
|
+
success: {
|
|
37
|
+
color: theme.colors.green[500],
|
|
38
|
+
label: 'success'
|
|
39
|
+
},
|
|
40
|
+
warning: {
|
|
41
|
+
color: theme.colors.amber[500],
|
|
42
|
+
label: 'warning'
|
|
43
|
+
},
|
|
44
|
+
danger: {
|
|
45
|
+
color: theme.colors.red[500],
|
|
46
|
+
label: 'danger'
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Base styled ActivityIndicator
|
|
52
|
+
*/
|
|
53
|
+
const StyledActivityIndicator = styled(ActivityIndicator, {
|
|
54
|
+
base: {
|
|
55
|
+
color: theme.colors.gray[400]
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Spinner: Professional loading indicator component
|
|
61
|
+
*
|
|
62
|
+
* Features:
|
|
63
|
+
* - Multiple size options (small, medium, large, custom)
|
|
64
|
+
* - 5 color variants (default, primary, success, warning, danger)
|
|
65
|
+
* - Custom color support
|
|
66
|
+
* - Overlay mode for full-screen loading
|
|
67
|
+
* - Optional label text
|
|
68
|
+
* - Theme integration
|
|
69
|
+
* - Accessibility support
|
|
70
|
+
*/
|
|
71
|
+
const StyledSpinner = /*#__PURE__*/forwardRef(({
|
|
72
|
+
size = 'medium',
|
|
73
|
+
variant = 'primary',
|
|
74
|
+
color,
|
|
75
|
+
overlay = false,
|
|
76
|
+
overlayColor = 'rgba(0, 0, 0, 0.3)',
|
|
77
|
+
label,
|
|
78
|
+
labelColor,
|
|
79
|
+
labelSize = 14,
|
|
80
|
+
accessibilityLabel = 'Loading',
|
|
81
|
+
...rest
|
|
82
|
+
}, ref) => {
|
|
83
|
+
// Determine size
|
|
84
|
+
const finalSize = typeof size === 'number' ? size : sizeConfig[size];
|
|
85
|
+
|
|
86
|
+
// Determine color
|
|
87
|
+
const variantConfig_value = variantConfig[variant];
|
|
88
|
+
const finalColor = color || variantConfig_value.color;
|
|
89
|
+
const spinnerElement = /*#__PURE__*/_jsx(StyledActivityIndicator, {
|
|
90
|
+
ref: ref,
|
|
91
|
+
size: finalSize,
|
|
92
|
+
color: finalColor,
|
|
93
|
+
accessibilityLabel: accessibilityLabel,
|
|
94
|
+
accessible: true,
|
|
95
|
+
...rest
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// If no overlay, return basic spinner
|
|
99
|
+
if (!overlay) {
|
|
100
|
+
if (!label) {
|
|
101
|
+
return spinnerElement;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Spinner with label
|
|
105
|
+
return /*#__PURE__*/_jsxs(YStack, {
|
|
106
|
+
alignItems: "center",
|
|
107
|
+
gap: 12,
|
|
108
|
+
children: [spinnerElement, label && /*#__PURE__*/_jsx(StyledText, {
|
|
109
|
+
fontSize: labelSize,
|
|
110
|
+
color: labelColor || theme.colors.gray[600],
|
|
111
|
+
numberOfLines: 1,
|
|
112
|
+
children: label
|
|
113
|
+
})]
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Overlay mode
|
|
118
|
+
return /*#__PURE__*/_jsx(YStack, {
|
|
119
|
+
position: "absolute",
|
|
120
|
+
top: 0,
|
|
121
|
+
left: 0,
|
|
122
|
+
right: 0,
|
|
123
|
+
bottom: 0,
|
|
124
|
+
backgroundColor: overlayColor,
|
|
125
|
+
justifyContent: "center",
|
|
126
|
+
alignItems: "center",
|
|
127
|
+
zIndex: 9999,
|
|
128
|
+
children: /*#__PURE__*/_jsxs(YStack, {
|
|
129
|
+
alignItems: "center",
|
|
130
|
+
gap: 12,
|
|
131
|
+
children: [spinnerElement, label && /*#__PURE__*/_jsx(StyledText, {
|
|
132
|
+
fontSize: labelSize,
|
|
133
|
+
color: labelColor || theme.colors.white[500],
|
|
134
|
+
numberOfLines: 1,
|
|
135
|
+
children: label
|
|
136
|
+
})]
|
|
137
|
+
})
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
StyledSpinner.displayName = 'StyledSpinner';
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Props for SpinnerContainer - Full-screen loading overlay with backdrop
|
|
144
|
+
*/
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* SpinnerContainer: Full-screen loading container with backdrop
|
|
148
|
+
*
|
|
149
|
+
* Use for: Page loading, data fetching, async operations
|
|
150
|
+
*/
|
|
151
|
+
const SpinnerContainer = /*#__PURE__*/forwardRef(({
|
|
152
|
+
isVisible = true,
|
|
153
|
+
size = 'large',
|
|
154
|
+
variant = 'primary',
|
|
155
|
+
color,
|
|
156
|
+
backdropColor = 'rgba(0, 0, 0, 0.5)',
|
|
157
|
+
message,
|
|
158
|
+
labelColor,
|
|
159
|
+
labelSize = 14,
|
|
160
|
+
onBackdropPress,
|
|
161
|
+
...rest
|
|
162
|
+
}, ref) => {
|
|
163
|
+
if (!isVisible) return null;
|
|
164
|
+
|
|
165
|
+
// Determine size
|
|
166
|
+
const finalSize = typeof size === 'number' ? size : sizeConfig[size];
|
|
167
|
+
|
|
168
|
+
// Determine color
|
|
169
|
+
const variantConfig_value = variantConfig[variant];
|
|
170
|
+
const finalColor = color || variantConfig_value.color;
|
|
171
|
+
const spinnerContent = /*#__PURE__*/_jsxs(YStack, {
|
|
172
|
+
alignItems: "center",
|
|
173
|
+
gap: 20,
|
|
174
|
+
children: [/*#__PURE__*/_jsx(StyledActivityIndicator, {
|
|
175
|
+
ref: ref,
|
|
176
|
+
size: finalSize,
|
|
177
|
+
color: finalColor,
|
|
178
|
+
accessible: true,
|
|
179
|
+
accessibilityLabel: "Loading",
|
|
180
|
+
...rest
|
|
181
|
+
}), message && /*#__PURE__*/_jsx(StyledText, {
|
|
182
|
+
fontSize: labelSize,
|
|
183
|
+
color: labelColor || theme.colors.white[500],
|
|
184
|
+
numberOfLines: 2,
|
|
185
|
+
textAlign: "center",
|
|
186
|
+
children: message
|
|
187
|
+
})]
|
|
188
|
+
});
|
|
189
|
+
if (!onBackdropPress) {
|
|
190
|
+
return /*#__PURE__*/_jsx(YStack, {
|
|
191
|
+
position: "absolute",
|
|
192
|
+
top: 0,
|
|
193
|
+
left: 0,
|
|
194
|
+
right: 0,
|
|
195
|
+
bottom: 0,
|
|
196
|
+
backgroundColor: backdropColor,
|
|
197
|
+
justifyContent: "center",
|
|
198
|
+
alignItems: "center",
|
|
199
|
+
zIndex: 9999,
|
|
200
|
+
children: spinnerContent
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
return /*#__PURE__*/_jsx(StyledButton, {
|
|
204
|
+
link: true,
|
|
205
|
+
onPress: onBackdropPress,
|
|
206
|
+
position: "absolute",
|
|
207
|
+
top: 0,
|
|
208
|
+
left: 0,
|
|
209
|
+
right: 0,
|
|
210
|
+
bottom: 0,
|
|
211
|
+
backgroundColor: backdropColor,
|
|
212
|
+
justifyContent: "center",
|
|
213
|
+
alignItems: "center",
|
|
214
|
+
zIndex: 9999,
|
|
215
|
+
borderRadius: 0,
|
|
216
|
+
borderWidth: 0,
|
|
217
|
+
children: spinnerContent
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
SpinnerContainer.displayName = 'SpinnerContainer';
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Props for InlineSpinner - Spinner with text in a row
|
|
224
|
+
*/
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* InlineSpinner: Spinner with text in flexible direction
|
|
228
|
+
*
|
|
229
|
+
* Use for: Button loading states, inline operations, compact loading indicators
|
|
230
|
+
*/
|
|
231
|
+
const InlineSpinner = /*#__PURE__*/forwardRef(({
|
|
232
|
+
size = 'small',
|
|
233
|
+
variant = 'primary',
|
|
234
|
+
color,
|
|
235
|
+
text,
|
|
236
|
+
labelColor,
|
|
237
|
+
labelSize = 12,
|
|
238
|
+
direction = 'row',
|
|
239
|
+
gap = 8,
|
|
240
|
+
accessibilityLabel = 'Loading',
|
|
241
|
+
...rest
|
|
242
|
+
}, ref) => {
|
|
243
|
+
// Determine size
|
|
244
|
+
const finalSize = typeof size === 'number' ? size : sizeConfig[size];
|
|
245
|
+
|
|
246
|
+
// Determine color
|
|
247
|
+
const variantConfig_value = variantConfig[variant];
|
|
248
|
+
const finalColor = color || variantConfig_value.color;
|
|
249
|
+
const StackComponent = direction === 'row' ? XStack : YStack;
|
|
250
|
+
return /*#__PURE__*/_jsxs(StackComponent, {
|
|
251
|
+
gap: gap,
|
|
252
|
+
alignItems: "center",
|
|
253
|
+
children: [/*#__PURE__*/_jsx(StyledActivityIndicator, {
|
|
254
|
+
ref: ref,
|
|
255
|
+
size: finalSize,
|
|
256
|
+
color: finalColor,
|
|
257
|
+
accessible: true,
|
|
258
|
+
accessibilityLabel: accessibilityLabel,
|
|
259
|
+
...rest
|
|
260
|
+
}), text && /*#__PURE__*/_jsx(StyledText, {
|
|
261
|
+
fontSize: labelSize,
|
|
262
|
+
color: labelColor || theme.colors.gray[600],
|
|
263
|
+
numberOfLines: 1,
|
|
264
|
+
children: text
|
|
265
|
+
})]
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
InlineSpinner.displayName = 'InlineSpinner';
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Exports
|
|
272
|
+
*/
|
|
273
|
+
export { StyledSpinner, SpinnerContainer, InlineSpinner, sizeConfig, variantConfig };
|
|
274
|
+
export default StyledSpinner;
|
|
275
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","forwardRef","ActivityIndicator","theme","styled","YStack","XStack","StyledText","StyledButton","jsx","_jsx","jsxs","_jsxs","sizeConfig","small","medium","large","variantConfig","default","color","colors","gray","label","primary","blue","success","green","warning","amber","danger","red","StyledActivityIndicator","base","StyledSpinner","size","variant","overlay","overlayColor","labelColor","labelSize","accessibilityLabel","rest","ref","finalSize","variantConfig_value","finalColor","spinnerElement","accessible","alignItems","gap","children","fontSize","numberOfLines","position","top","left","right","bottom","backgroundColor","justifyContent","zIndex","white","displayName","SpinnerContainer","isVisible","backdropColor","message","onBackdropPress","spinnerContent","textAlign","link","onPress","borderRadius","borderWidth","InlineSpinner","text","direction","StackComponent"],"sourceRoot":"../../../src","sources":["spinner/index.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SACEC,iBAAiB,QAEZ,cAAc;AACrB,SAASC,KAAK,QAAQ,oBAAiB;AACvC,SAASC,MAAM,QAAQ,qBAAkB;AACzC,SAASC,MAAM,EAAEC,MAAM,QAAQ,mBAAU;AACzC,SAASC,UAAU,QAAQ,kBAAS;AACpC,SAASC,YAAY,QAAQ,oBAAW;;AAExC;AACA;AACA;AAFA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AA0BA;AACA;AACA;AACA,MAAMC,UAAwD,GAAG;EAC/DC,KAAK,EAAE,EAAE;EACTC,MAAM,EAAE,EAAE;EACVC,KAAK,EAAE;AACT,CAAC;;AAED;AACA;AACA;AACA,MAAMC,aAGL,GAAG;EACFC,OAAO,EAAE;IACPC,KAAK,EAAEhB,KAAK,CAACiB,MAAM,CAACC,IAAI,CAAC,GAAG,CAAC;IAC7BC,KAAK,EAAE;EACT,CAAC;EACDC,OAAO,EAAE;IACPJ,KAAK,EAAEhB,KAAK,CAACiB,MAAM,CAACI,IAAI,CAAC,GAAG,CAAC;IAC7BF,KAAK,EAAE;EACT,CAAC;EACDG,OAAO,EAAE;IACPN,KAAK,EAAEhB,KAAK,CAACiB,MAAM,CAACM,KAAK,C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,cAAc,GAAGD,SAAS,KAAK,KAAK,GAAGtE,MAAM,GAAGD,MAAM;EAE5D,oBACEO,KAAA,CAACiE,cAAc;IAAC5B,GAAG,EAAEA,GAAI;IAACD,UAAU,EAAC,QAAQ;IAAAE,QAAA,gBAC3CxC,IAAA,CAACqB,uBAAuB;MACtBW,GAAG,EAAEA,GAAI;MACTR,IAAI,EAAES,SAAU;MAChBxB,KAAK,EAAE0B,UAAW;MAClBE,UAAU,EAAE,IAAK;MACjBP,kBAAkB,EAAEA,kBAAmB;MAAA,GACnCC;IAAI,CACT,CAAC,EACDkC,IAAI,iBACHjE,IAAA,CAACH,UAAU;MACT4C,QAAQ,EAAEZ,SAAU;MACpBpB,KAAK,EAAEmB,UAAU,IAAInC,KAAK,CAACiB,MAAM,CAACC,IAAI,CAAC,GAAG,CAAE;MAC5C+B,aAAa,EAAE,CAAE;MAAAF,QAAA,EAEhByB;IAAI,CACK,CACb;EAAA,CACa,CAAC;AAErB,CACF,CAAC;AAEDD,aAAa,CAACZ,WAAW,GAAG,eAAe;;AAE3C;AACA;AACA;AACA,SACE7B,aAAa,EACb8B,gBAAgB,EAChBW,aAAa,EAIb7D,UAAU,EACVI,aAAa;AAEf,eAAegB,aAAa","ignoreList":[]}
|
|
@@ -21,4 +21,74 @@ export const isValidNumber = value => {
|
|
|
21
21
|
export const isValidString = value => {
|
|
22
22
|
return typeof value === "string" && value.trim().length > 0;
|
|
23
23
|
};
|
|
24
|
+
|
|
25
|
+
// Define the structure for a single rule
|
|
26
|
+
|
|
27
|
+
// Define the structure for the rules object used in validation
|
|
28
|
+
|
|
29
|
+
// Define the structure for the values object used in validation
|
|
30
|
+
|
|
31
|
+
// Define the structure for the errors object in the validation response
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Validates a value against provided rules.
|
|
35
|
+
* @param value - The value to validate.
|
|
36
|
+
* @param rules - The array of validation rules.
|
|
37
|
+
* @returns The error message if the value is invalid, otherwise undefined.
|
|
38
|
+
*/
|
|
39
|
+
const validateField = (value, rules, fields = {}) => {
|
|
40
|
+
for (const rule of rules) {
|
|
41
|
+
// Explicit null or undefined check
|
|
42
|
+
if (value === null || value === undefined) {
|
|
43
|
+
return rule.message; // Null/undefined fails required validation
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Array validation
|
|
47
|
+
if (rule.array && Array.isArray(value) && value.length === 0) {
|
|
48
|
+
return rule.message;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Pattern validation
|
|
52
|
+
if (rule.pattern && !rule.pattern.test(value)) {
|
|
53
|
+
return rule.message;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Custom validation logic
|
|
57
|
+
if (rule.validate) {
|
|
58
|
+
const customMessage = rule.validate(value, fields);
|
|
59
|
+
if (customMessage) {
|
|
60
|
+
return customMessage;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return undefined; // No errors found
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Validates a set of values against a set of field rules.
|
|
69
|
+
* @param values - The object of field values.
|
|
70
|
+
* @param rules - The object of field rules.
|
|
71
|
+
* @returns An object containing a boolean indicating if there are errors, and an object of errors.
|
|
72
|
+
*/
|
|
73
|
+
const validate = (values, rules) => {
|
|
74
|
+
const errors = {};
|
|
75
|
+
let hasError = false;
|
|
76
|
+
for (const field in rules) {
|
|
77
|
+
const fieldRules = rules[field];
|
|
78
|
+
const value = values[field] ?? null; // Safely access values[field]
|
|
79
|
+
const error = validateField(value, fieldRules, values); // Pass `values` for cross-field validation
|
|
80
|
+
|
|
81
|
+
if (error) {
|
|
82
|
+
hasError = true;
|
|
83
|
+
errors[field] = {
|
|
84
|
+
message: error
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
hasError,
|
|
90
|
+
errors
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
export { validate };
|
|
24
94
|
//# sourceMappingURL=validators.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isValidColor","value","test","isValidNumber","isFinite","isValidString","trim","length"],"sourceRoot":"../../../src","sources":["utiles/validators.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA,OAAO,MAAMA,YAAY,GAAIC,KAAa,IAAc;EACtD,OAAO,2CAA2C,CAACC,IAAI,CAACD,KAAK,CAAC;AAChE,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAME,aAAa,GAAIF,KAAc,IAAsB;EAChE,OAAO,OAAOA,KAAK,KAAK,QAAQ,IAAIG,QAAQ,CAACH,KAAK,CAAC;AACrD,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMI,aAAa,GAAIJ,KAAc,IAAsB;EAChE,OAAO,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,CAACK,IAAI,CAAC,CAAC,CAACC,MAAM,GAAG,CAAC;AAC7D,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["isValidColor","value","test","isValidNumber","isFinite","isValidString","trim","length","validateField","rules","fields","rule","undefined","message","array","Array","isArray","pattern","validate","customMessage","values","errors","hasError","field","fieldRules","error"],"sourceRoot":"../../../src","sources":["utiles/validators.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA,OAAO,MAAMA,YAAY,GAAIC,KAAa,IAAc;EACtD,OAAO,2CAA2C,CAACC,IAAI,CAACD,KAAK,CAAC;AAChE,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAME,aAAa,GAAIF,KAAc,IAAsB;EAChE,OAAO,OAAOA,KAAK,KAAK,QAAQ,IAAIG,QAAQ,CAACH,KAAK,CAAC;AACrD,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMI,aAAa,GAAIJ,KAAc,IAAsB;EAChE,OAAO,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,CAACK,IAAI,CAAC,CAAC,CAACC,MAAM,GAAG,CAAC;AAC7D,CAAC;;AAED;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EJ,MAAM,CAAC,CAAC,CAAC;;IAExD,IAAIK,KAAK,EAAE;MACTH,QAAQ,GAAG,IAAI;MACfD,MAAM,CAACE,KAAK,CAAC,GAAG;QAAEV,OAAO,EAAEY;MAAM,CAAC;IACpC;EACF;EAEA,OAAO;IACLH,QAAQ;IACRD;EACF,CAAC;AACH,CAAC;AAED,SAASH,QAAQ","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { PopoverMode, PopoverPlacement } from 'react-native-popover-view';
|
|
2
2
|
export { theme, lightColors, darkColors, palettes, fontStyles, } from './utiles/theme';
|
|
3
3
|
export { styled } from './utiles/styled';
|
|
4
|
-
export { Stack, type StackProps } from './stack';
|
|
4
|
+
export { Stack, XStack, YStack, type StackProps } from './stack';
|
|
5
5
|
export { StyledText, type StyledTextProps } from './text';
|
|
6
6
|
export { StyledSafeAreaProvider, type StyledSafeAreaProviderProps } from './safeAreaProvider';
|
|
7
7
|
export { StyledSafeAreaView, type StyledSafeAreaViewProps } from './safeAreaView';
|
|
@@ -53,4 +53,7 @@ export * from './datePicker';
|
|
|
53
53
|
export * from './skeleton';
|
|
54
54
|
export * from './emptyState';
|
|
55
55
|
export * from './searchBar';
|
|
56
|
+
export * from './dialog';
|
|
57
|
+
export * from './utiles/validators';
|
|
58
|
+
export * from './spinner';
|
|
56
59
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AACzE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,GAAG,MAAM,gBAAgB,CAAA;AACtF,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CA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AAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACvF,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAE7D,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,kBAAkB,GACnB,MAAM,YAAY,CAAA;AAEnB,YAAY,EACV,YAAY,EACZ,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,kBAAkB,GACnB,MAAM,YAAY,CAAA;AAEnB,cAAc,eAAe,CAAA;AAC7B,OAAO,EAAE,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAA;AAClE,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA;AACxB,cAAc,qBAAqB,CAAA;AACnC,cAAc,WAAW,CAAA"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ActivityIndicatorProps } from 'react-native';
|
|
3
|
+
/**
|
|
4
|
+
* Props for Spinner component
|
|
5
|
+
*/
|
|
6
|
+
interface SpinnerProps extends Omit<ActivityIndicatorProps, 'ref' | 'size'> {
|
|
7
|
+
size?: 'small' | 'medium' | 'large' | number;
|
|
8
|
+
variant?: 'default' | 'primary' | 'success' | 'warning' | 'danger';
|
|
9
|
+
color?: string;
|
|
10
|
+
overlay?: boolean;
|
|
11
|
+
overlayColor?: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
labelColor?: string;
|
|
14
|
+
labelSize?: number;
|
|
15
|
+
accessibilityLabel?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Size configuration for Spinner
|
|
19
|
+
*/
|
|
20
|
+
declare const sizeConfig: Record<'small' | 'medium' | 'large', number>;
|
|
21
|
+
/**
|
|
22
|
+
* Variant configuration for Spinner
|
|
23
|
+
*/
|
|
24
|
+
declare const variantConfig: Record<'default' | 'primary' | 'success' | 'warning' | 'danger', {
|
|
25
|
+
color: string;
|
|
26
|
+
label: string;
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* Spinner: Professional loading indicator component
|
|
30
|
+
*
|
|
31
|
+
* Features:
|
|
32
|
+
* - Multiple size options (small, medium, large, custom)
|
|
33
|
+
* - 5 color variants (default, primary, success, warning, danger)
|
|
34
|
+
* - Custom color support
|
|
35
|
+
* - Overlay mode for full-screen loading
|
|
36
|
+
* - Optional label text
|
|
37
|
+
* - Theme integration
|
|
38
|
+
* - Accessibility support
|
|
39
|
+
*/
|
|
40
|
+
declare const StyledSpinner: React.ForwardRefExoticComponent<SpinnerProps & React.RefAttributes<any>>;
|
|
41
|
+
/**
|
|
42
|
+
* Props for SpinnerContainer - Full-screen loading overlay with backdrop
|
|
43
|
+
*/
|
|
44
|
+
interface SpinnerContainerProps extends Omit<SpinnerProps, 'ref' | 'overlay'> {
|
|
45
|
+
isVisible?: boolean;
|
|
46
|
+
backdropColor?: string;
|
|
47
|
+
message?: string;
|
|
48
|
+
onBackdropPress?: () => void;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* SpinnerContainer: Full-screen loading container with backdrop
|
|
52
|
+
*
|
|
53
|
+
* Use for: Page loading, data fetching, async operations
|
|
54
|
+
*/
|
|
55
|
+
declare const SpinnerContainer: React.ForwardRefExoticComponent<SpinnerContainerProps & React.RefAttributes<any>>;
|
|
56
|
+
/**
|
|
57
|
+
* Props for InlineSpinner - Spinner with text in a row
|
|
58
|
+
*/
|
|
59
|
+
interface InlineSpinnerProps extends Omit<SpinnerProps, 'overlay'> {
|
|
60
|
+
text?: string;
|
|
61
|
+
direction?: 'row' | 'column';
|
|
62
|
+
gap?: number;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* InlineSpinner: Spinner with text in flexible direction
|
|
66
|
+
*
|
|
67
|
+
* Use for: Button loading states, inline operations, compact loading indicators
|
|
68
|
+
*/
|
|
69
|
+
declare const InlineSpinner: React.ForwardRefExoticComponent<InlineSpinnerProps & React.RefAttributes<any>>;
|
|
70
|
+
/**
|
|
71
|
+
* Exports
|
|
72
|
+
*/
|
|
73
|
+
export { StyledSpinner, SpinnerContainer, InlineSpinner, type SpinnerProps, type SpinnerContainerProps, type InlineSpinnerProps, sizeConfig, variantConfig, };
|
|
74
|
+
export default StyledSpinner;
|
|
75
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/spinner/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,EAEL,sBAAsB,EACvB,MAAM,cAAc,CAAC;AAOtB;;GAEG;AACH,UAAU,YAAa,SAAQ,IAAI,CAAC,sBAAsB,EAAE,KAAK,GAAG,MAAM,CAAC;IAEzE,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;IAG7C,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IAGnE,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAA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AC;AACF,eAAe,aAAa,CAAC"}
|
|
@@ -11,4 +11,32 @@ export declare const isValidNumber: (value: unknown) => value is number;
|
|
|
11
11
|
* Validates if a value is a non-empty string
|
|
12
12
|
*/
|
|
13
13
|
export declare const isValidString: (value: unknown) => value is string;
|
|
14
|
+
interface Rule {
|
|
15
|
+
array?: boolean;
|
|
16
|
+
pattern?: RegExp;
|
|
17
|
+
message: string;
|
|
18
|
+
validate?: (value: any, fields: Record<string, any>) => string | undefined;
|
|
19
|
+
}
|
|
20
|
+
interface Rules {
|
|
21
|
+
[key: string]: Rule[];
|
|
22
|
+
}
|
|
23
|
+
interface Values {
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
}
|
|
26
|
+
export interface Errors {
|
|
27
|
+
[key: string]: {
|
|
28
|
+
message: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Validates a set of values against a set of field rules.
|
|
33
|
+
* @param values - The object of field values.
|
|
34
|
+
* @param rules - The object of field rules.
|
|
35
|
+
* @returns An object containing a boolean indicating if there are errors, and an object of errors.
|
|
36
|
+
*/
|
|
37
|
+
declare const validate: (values: Values, rules: Rules) => {
|
|
38
|
+
hasError: boolean;
|
|
39
|
+
errors: Errors;
|
|
40
|
+
};
|
|
41
|
+
export { validate };
|
|
14
42
|
//# sourceMappingURL=validators.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../src/utiles/validators.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,YAAY,UAAW,MAAM,KAAG,OAE5C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,UAAW,OAAO,oBAE3C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,UAAW,OAAO,oBAE3C,CAAC"}
|
|
1
|
+
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../src/utiles/validators.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,YAAY,UAAW,MAAM,KAAG,OAE5C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,UAAW,OAAO,oBAE3C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,UAAW,OAAO,oBAE3C,CAAC;AAGF,UAAU,IAAI;IACV,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,MAAM,GAAG,SAAS,CAAC;CAC5E;AAGD,UAAU,KAAK;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,CAAC;CACvB;AAGD,UAAU,MAAM;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAGD,MAAM,WAAW,MAAM;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CACpC;AAsCD;;;;;GAKG;AACH,QAAA,MAAM,QAAQ,WAAY,MAAM,SAAS,KAAK;cAAe,OAAO;YAAU,MAAM;CAmBnF,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { PopoverMode, PopoverPlacement } from 'react-native-popover-view'
|
|
2
2
|
export { theme, lightColors, darkColors, palettes, fontStyles, } from './utiles/theme'
|
|
3
3
|
export { styled } from './utiles/styled'
|
|
4
|
-
export { Stack, type StackProps } from './stack'
|
|
4
|
+
export { Stack, XStack, YStack, type StackProps } from './stack'
|
|
5
5
|
export { StyledText, type StyledTextProps } from './text'
|
|
6
6
|
export { StyledSafeAreaProvider, type StyledSafeAreaProviderProps } from './safeAreaProvider'
|
|
7
7
|
export { StyledSafeAreaView, type StyledSafeAreaViewProps } from './safeAreaView'
|
|
@@ -69,4 +69,7 @@ export * from './datePicker'
|
|
|
69
69
|
export * from './skeleton'
|
|
70
70
|
export * from './emptyState'
|
|
71
71
|
export * from './searchBar'
|
|
72
|
+
export * from './dialog'
|
|
73
|
+
export * from './utiles/validators'
|
|
74
|
+
export * from './spinner'
|
|
72
75
|
|