@dropi/react-native-design-system 0.1.14 → 0.1.16

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 CHANGED
@@ -326,4 +326,82 @@ import { TextButton } from "@dropi/react-native-design-system";
326
326
  onPress={() => console.log("Eliminar presionado")}
327
327
  />
328
328
 
329
+ ```
330
+ # Moléculas
331
+ ## 🚨 Alert
332
+
333
+ El componente Alert muestra un mensaje contextual acompañado de un ícono y colores que representan su nivel de severidad. Está diseñado para comunicar información relevante al usuario: advertencias, errores, confirmaciones o simples avisos informativos.
334
+
335
+ Cada variante (info, warning, error, success) aplica automáticamente colores de fondo, borde e ícono usando el sistema de tokens (colors, sizes, radius, spacing). Además, permite incluir un botón de acción secundaria y un botón de cierre opcional.
336
+
337
+ ## 📦 Importación:
338
+ ```
339
+ import { Alert } from "@dropi/react-native-design-system";
340
+
341
+ ```
342
+ ## ⚙️ Props:
343
+ ```
344
+ | Prop | Tipo | Descripción |
345
+ |---------------- |--------------------------------------------------- |---------------------------------------------------------------------|
346
+ | `message` | `string` | Texto principal que describe la alerta. |
347
+ | `variant` | `'info' \| 'warning' \| 'error' \| 'success'` | Define los colores, ícono y estilo visual general. |
348
+ | `buttonLabel` | `string` | Texto del botón opcional dentro de la alerta. |
349
+ | `onButtonPress` | `() => void` | Acción ejecutada al presionar el botón opcional. |
350
+ | `onClosePress` | `() => void` | Acción ejecutada al presionar el botón de cierre (`close-small`). |
351
+
352
+ ```
353
+
354
+ ## 🧩 Ejemplos de uso:
355
+ ```Typescript
356
+ <Alert
357
+ message="Tu información ha sido guardada correctamente."
358
+ variant="success"
359
+ onClosePress={() => console.log("Cerrar alerta")}
360
+ />
361
+
362
+ <Alert
363
+ message="No pudimos procesar tu solicitud."
364
+ variant="error"
365
+ buttonLabel="Reintentar"
366
+ onButtonPress={() => console.log("Reintentar")}
367
+ onClosePress={() => console.log("Cerrar")}
368
+ />
369
+
370
+ ```
371
+
372
+ ## Empty State
373
+
374
+ El EmptyState es un componente visual diseñado para mostrar pantallas vacías en escenarios donde no hay datos disponibles, ocurrió un estado inicial o se requiere una primera acción del usuario. Puede incluir una imagen, un título opcional, un mensaje descriptivo y un botón configurable. Mantiene una composición centrada y un diseño minimalista, usando automáticamente tamaños distintos para tablet gracias a isTablet.
375
+
376
+ ## 📦 Importación:
377
+ ```
378
+ import { EmptyState } from "@dropi/react-native-design-system";
379
+ ```
380
+
381
+ ## ⚙️ Props:
382
+ ```
383
+ | Prop | Tipo | Descripción |
384
+ | ---------------- | ------------------------ | ------------------------------------------------------------- |
385
+ | `imageSource` | `string \| number` | Imagen opcional (URL o require local) mostrada en la parte superior. |
386
+ | `title` | `string` | Título corto que introduce el estado vacío. |
387
+ | `message` | `string` (obligatorio) | Texto principal explicando el estado. |
388
+ | `buttonLabel` | `string` | Texto del botón opcional. |
389
+ | `onButtonPress` | `() => void` | Callback del botón. Si existe, el botón se muestra. |
390
+ ```
391
+
392
+ ## 🧩 Ejemplos de uso:
393
+
394
+ ```
395
+ <EmptyState
396
+ imageSource={require("../../assets/empty-orders.png")}
397
+ title="Sin pedidos todavía"
398
+ message="Cuando tengas pedidos activos aparecerán aquí."
399
+ />
400
+
401
+ <EmptyState
402
+ imageSource="https://example.com/empty.png"
403
+ message="Aún no has guardado favoritos."
404
+ buttonLabel="Explorar productos"
405
+ onButtonPress={() => console.log("Ir a explorar")}
406
+ />
329
407
  ```
@@ -19,7 +19,7 @@ const baseSizes = {
19
19
  xxxl: 28,
20
20
  xxxxl: 32
21
21
  };
22
- const BASE_WIDTH = 360;
22
+ const BASE_WIDTH = 414;
23
23
  const rawScaleFactor = width / BASE_WIDTH;
24
24
  const multiplier = rawScaleFactor > 1 ? 1 + (rawScaleFactor - 1) * 0.2 : rawScaleFactor;
25
25
  const fontScale = _reactNative.PixelRatio.getFontScale();
@@ -8,6 +8,7 @@ var _reactNative = require("react-native");
8
8
  var _expoImage = require("expo-image");
9
9
  var _constants = require("../../constants");
10
10
  var _atoms = require("../../atoms");
11
+ var _utils = require("../../utils");
11
12
  var _jsxRuntime = require("react/jsx-runtime");
12
13
  const EmptyState = ({
13
14
  imageSource,
@@ -17,40 +18,21 @@ const EmptyState = ({
17
18
  onButtonPress
18
19
  }) => {
19
20
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
20
- style: {
21
- paddingVertical: _constants.spacing['size-4']
22
- },
21
+ style: styles.container,
23
22
  children: [imageSource && /*#__PURE__*/(0, _jsxRuntime.jsx)(_expoImage.Image, {
24
- source: imageSource
25
- //TODO: change hardcoded sizes
26
- ,
27
- style: {
28
- width: 51,
29
- height: 48,
30
- alignSelf: 'center',
31
- marginBottom: _constants.spacing['size-4']
32
- },
23
+ source: imageSource,
24
+ style: styles.image,
33
25
  contentFit: "contain"
34
26
  }), title && /*#__PURE__*/(0, _jsxRuntime.jsx)(_atoms.Body, {
35
27
  type: "l-medium",
36
- style: {
37
- color: _constants.colors['Gray-700'].light,
38
- textAlign: 'center',
39
- marginBottom: _constants.spacing['size-2']
40
- },
28
+ style: styles.title,
41
29
  children: title
42
30
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_atoms.Body, {
43
31
  type: "m-regular",
44
- style: {
45
- color: _constants.colors['Gray-500'].light,
46
- textAlign: 'center'
47
- },
32
+ style: styles.message,
48
33
  children: message
49
34
  }), buttonLabel && onButtonPress && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
50
- style: {
51
- marginTop: 24,
52
- alignItems: 'center'
53
- },
35
+ style: styles.buttonContainer,
54
36
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_atoms.DefaultButton, {
55
37
  label: buttonLabel,
56
38
  onPress: onButtonPress,
@@ -60,4 +42,28 @@ const EmptyState = ({
60
42
  })]
61
43
  });
62
44
  };
63
- exports.EmptyState = EmptyState;
45
+ exports.EmptyState = EmptyState;
46
+ const styles = _reactNative.StyleSheet.create({
47
+ container: {
48
+ paddingVertical: _constants.spacing['size-4']
49
+ },
50
+ image: {
51
+ width: !_utils.isTablet ? 51 : 72,
52
+ height: !_utils.isTablet ? 48 : 68,
53
+ alignSelf: 'center',
54
+ marginBottom: _constants.spacing['size-4']
55
+ },
56
+ title: {
57
+ color: _constants.colors['Gray-700'].light,
58
+ textAlign: 'center',
59
+ marginBottom: _constants.spacing['size-2']
60
+ },
61
+ message: {
62
+ color: _constants.colors['Gray-500'].light,
63
+ textAlign: 'center'
64
+ },
65
+ buttonContainer: {
66
+ marginTop: _constants.spacing['size-5'],
67
+ alignItems: 'center'
68
+ }
69
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dropi/react-native-design-system",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "A React Native package built from scratch",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",