@dropi/ui-components 1.0.0 → 1.0.1
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/package.json +14 -35
- package/publish-npm.sh +81 -0
- package/src/components-source/dropi-button/dropi-button.component.ts +44 -42
- package/src/index.ts +3 -16
- package/.gitignore +0 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dropi/ui-components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Dropi UI Components - Framework-agnostic Web Components library built with Angular Elements",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
|
@@ -12,55 +12,34 @@
|
|
|
12
12
|
"author": "Dropi Team",
|
|
13
13
|
"license": "UNLICENSED",
|
|
14
14
|
"private": false,
|
|
15
|
-
"main": "index.js",
|
|
16
|
-
"module": "fesm2022/dropi-ui-elements.mjs",
|
|
17
|
-
"types": "index.d.ts",
|
|
18
|
-
"exports": {
|
|
19
|
-
".": {
|
|
20
|
-
"types": "./index.d.ts",
|
|
21
|
-
"esm2022": "./esm2022/dropi-ui-elements.mjs",
|
|
22
|
-
"esm": "./esm2022/dropi-ui-elements.mjs",
|
|
23
|
-
"default": "./fesm2022/dropi-ui-elements.mjs"
|
|
24
|
-
},
|
|
25
|
-
"./dropi-tokens.css": "./dropi-tokens.css"
|
|
26
|
-
},
|
|
27
|
-
"files": [
|
|
28
|
-
"**/*",
|
|
29
|
-
"dropi-tokens.css",
|
|
30
|
-
"README.md"
|
|
31
|
-
],
|
|
32
15
|
"scripts": {
|
|
33
16
|
"build": "ng-packagr -p ng-package.json",
|
|
34
17
|
"copy:tokens": "cp src/styles.scss ../dist/dropi-tokens.css",
|
|
35
|
-
"build:complete": "npm run build && npm run copy:tokens"
|
|
36
|
-
"watch": "ng-packagr -p ng-package.json -w",
|
|
37
|
-
"test": "echo \"Tests coming soon\"",
|
|
38
|
-
"prepublishOnly": "npm run build:complete"
|
|
18
|
+
"build:complete": "npm run build && npm run copy:tokens"
|
|
39
19
|
},
|
|
40
20
|
"peerDependencies": {
|
|
41
|
-
"@angular/common": "^
|
|
42
|
-
"@angular/core": "^
|
|
43
|
-
"@angular/elements": "^
|
|
21
|
+
"@angular/common": "^18.2.0",
|
|
22
|
+
"@angular/core": "^18.2.0",
|
|
23
|
+
"@angular/elements": "^18.2.0"
|
|
44
24
|
},
|
|
45
25
|
"devDependencies": {
|
|
46
|
-
"@angular-devkit/build-angular": "^
|
|
47
|
-
"@angular/cli": "^
|
|
48
|
-
"@angular/compiler": "^
|
|
49
|
-
"
|
|
50
|
-
"ng-packagr": "^19.0.0",
|
|
26
|
+
"@angular-devkit/build-angular": "^18.2.0",
|
|
27
|
+
"@angular/cli": "^18.2.0",
|
|
28
|
+
"@angular/compiler-cli": "^18.2.0",
|
|
29
|
+
"ng-packagr": "^18.2.1",
|
|
51
30
|
"tslib": "^2.3.0",
|
|
52
|
-
"typescript": "~5.
|
|
53
|
-
"zone.js": "~0.
|
|
31
|
+
"typescript": "~5.5.4",
|
|
32
|
+
"zone.js": "~0.14.10"
|
|
54
33
|
},
|
|
55
34
|
"dependencies": {
|
|
56
35
|
"@ngx-translate/core": "^15.0.0"
|
|
57
36
|
},
|
|
58
37
|
"repository": {
|
|
59
38
|
"type": "git",
|
|
60
|
-
"url": "https://github.com/
|
|
39
|
+
"url": "https://github.com/mauriciocarvajal-tech/ui-components.git"
|
|
61
40
|
},
|
|
62
41
|
"bugs": {
|
|
63
|
-
"url": "https://github.com/
|
|
42
|
+
"url": "https://github.com/mauriciocarvajal-tech/ui-components/issues"
|
|
64
43
|
},
|
|
65
|
-
"homepage": "https://ui
|
|
44
|
+
"homepage": "https://github.com/mauriciocarvajal-tech/ui-components#readme"
|
|
66
45
|
}
|
package/publish-npm.sh
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Script para publicar @dropi/ui-components a NPM
|
|
3
|
+
# Ubicación: ~/Desktop/dropi-ui-components/publish-npm.sh
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
echo "📦 Publicación de @dropi/ui-components a NPM"
|
|
8
|
+
echo "============================================"
|
|
9
|
+
echo ""
|
|
10
|
+
|
|
11
|
+
# Verificar login
|
|
12
|
+
if ! npm whoami &> /dev/null; then
|
|
13
|
+
echo "⚠️ No estás logueado en NPM"
|
|
14
|
+
echo ""
|
|
15
|
+
echo "Pasos para crear cuenta NPM (si no tienes):"
|
|
16
|
+
echo "1. Ir a: https://www.npmjs.com/signup"
|
|
17
|
+
echo "2. Crear cuenta gratuita"
|
|
18
|
+
echo ""
|
|
19
|
+
echo "Ejecuta: npm login"
|
|
20
|
+
echo " Username: tu_usuario_npm"
|
|
21
|
+
echo " Password: tu_contraseña"
|
|
22
|
+
echo " Email: tu_email@example.com"
|
|
23
|
+
echo ""
|
|
24
|
+
exit 1
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
echo "✅ Usuario NPM: $(npm whoami)"
|
|
28
|
+
echo ""
|
|
29
|
+
|
|
30
|
+
# Verificar directorio
|
|
31
|
+
if [ ! -f "package.json" ]; then
|
|
32
|
+
echo "❌ Error: No se encuentra package.json"
|
|
33
|
+
echo " Ejecuta desde ~/Desktop/dropi-ui-components"
|
|
34
|
+
exit 1
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
# Build
|
|
38
|
+
echo "🔨 Building package..."
|
|
39
|
+
npm run build:complete
|
|
40
|
+
|
|
41
|
+
if [ ! -d "../dist" ]; then
|
|
42
|
+
echo "❌ Error: Build falló"
|
|
43
|
+
exit 1
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
echo "✅ Build completado"
|
|
47
|
+
echo ""
|
|
48
|
+
|
|
49
|
+
# Verificar package.json en dist
|
|
50
|
+
cd ../dist
|
|
51
|
+
|
|
52
|
+
echo "📋 Información del paquete:"
|
|
53
|
+
echo " Nombre: $(node -p "require('./package.json').name")"
|
|
54
|
+
echo " Versión: $(node -p "require('./package.json').version")"
|
|
55
|
+
echo ""
|
|
56
|
+
|
|
57
|
+
read -p "¿Publicar a NPM? (y/n): " CONFIRM
|
|
58
|
+
|
|
59
|
+
if [ "$CONFIRM" != "y" ] && [ "$CONFIRM" != "Y" ]; then
|
|
60
|
+
echo "❌ Publicación cancelada"
|
|
61
|
+
exit 0
|
|
62
|
+
fi
|
|
63
|
+
|
|
64
|
+
read -p "¿Paquete público? (y/n): " PUBLIC
|
|
65
|
+
|
|
66
|
+
if [ "$PUBLIC" = "y" ] || [ "$PUBLIC" = "Y" ]; then
|
|
67
|
+
echo "📤 Publicando como paquete público..."
|
|
68
|
+
npm publish --access public
|
|
69
|
+
else
|
|
70
|
+
echo "📤 Publicando como paquete privado..."
|
|
71
|
+
npm publish
|
|
72
|
+
fi
|
|
73
|
+
|
|
74
|
+
echo ""
|
|
75
|
+
echo "✅ Paquete publicado exitosamente!"
|
|
76
|
+
echo ""
|
|
77
|
+
echo "Verificar en: https://www.npmjs.com/package/@dropi/ui-components"
|
|
78
|
+
echo ""
|
|
79
|
+
echo "Para instalar:"
|
|
80
|
+
echo " npm install @dropi/ui-components"
|
|
81
|
+
echo ""
|
|
@@ -1,73 +1,75 @@
|
|
|
1
|
-
import { Component, EventEmitter, Input, Output } from
|
|
2
|
-
import { CommonModule } from
|
|
3
|
-
import { IconComponent } from
|
|
1
|
+
import { Component, EventEmitter, Input, Output } from "@angular/core";
|
|
2
|
+
import { CommonModule } from "@angular/common";
|
|
3
|
+
import { IconComponent } from "../icon/icon.component";
|
|
4
4
|
|
|
5
5
|
export type ButtonType =
|
|
6
|
-
|
|
|
7
|
-
|
|
|
8
|
-
|
|
|
9
|
-
|
|
|
10
|
-
|
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
export type ButtonSeverity =
|
|
14
|
-
export type ButtonSize =
|
|
15
|
-
export type ButtonState =
|
|
6
|
+
| "legacy"
|
|
7
|
+
| "default"
|
|
8
|
+
| "success"
|
|
9
|
+
| "info"
|
|
10
|
+
| "error"
|
|
11
|
+
| "warning"
|
|
12
|
+
| "dropdown";
|
|
13
|
+
export type ButtonSeverity = "primary" | "secondary" | "tertiary";
|
|
14
|
+
export type ButtonSize = "large" | "normal" | "small";
|
|
15
|
+
export type ButtonState = "default" | "disabled" | "loading";
|
|
16
16
|
|
|
17
17
|
// @figma-node 2-381
|
|
18
18
|
@Component({
|
|
19
|
-
selector:
|
|
19
|
+
selector: "dropi-wc-button",
|
|
20
20
|
standalone: true,
|
|
21
21
|
imports: [CommonModule, IconComponent],
|
|
22
|
-
templateUrl:
|
|
23
|
-
styleUrls: [
|
|
24
|
-
host: {
|
|
22
|
+
templateUrl: "./dropi-button.component.html",
|
|
23
|
+
styleUrls: ["./dropi-button.component.scss"],
|
|
24
|
+
host: { "data-figma-node": "2-381" },
|
|
25
25
|
})
|
|
26
26
|
export class ButtonComponent {
|
|
27
|
-
@Input() type: ButtonType =
|
|
28
|
-
@Input() severity: ButtonSeverity =
|
|
29
|
-
@Input() size: ButtonSize =
|
|
30
|
-
@Input() state: ButtonState =
|
|
31
|
-
@Input() preIcon: string =
|
|
32
|
-
@Input() postIcon: string =
|
|
33
|
-
@Input() text: string =
|
|
27
|
+
@Input() type: ButtonType = "default";
|
|
28
|
+
@Input() severity: ButtonSeverity = "primary";
|
|
29
|
+
@Input() size: ButtonSize = "normal";
|
|
30
|
+
@Input() state: ButtonState = "default";
|
|
31
|
+
@Input() preIcon: string = "";
|
|
32
|
+
@Input() postIcon: string = "";
|
|
33
|
+
@Input() text: string = "";
|
|
34
34
|
@Output() onClick = new EventEmitter<Event>();
|
|
35
35
|
|
|
36
|
-
colorload =
|
|
36
|
+
colorload = "var(--Primary-Primary-500)";
|
|
37
37
|
|
|
38
38
|
colorMap: { [key: string]: string } = {
|
|
39
|
-
default:
|
|
40
|
-
success:
|
|
41
|
-
error:
|
|
42
|
-
info:
|
|
43
|
-
legacy:
|
|
44
|
-
warning:
|
|
39
|
+
default: "Primary-Primary-",
|
|
40
|
+
success: "Success-Success-",
|
|
41
|
+
error: "Error-Error-",
|
|
42
|
+
info: "Info-Info-",
|
|
43
|
+
legacy: "Secondary-Secondary-",
|
|
44
|
+
warning: "Warning-Warning-",
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
get iconSize(): string {
|
|
48
48
|
switch (this.size) {
|
|
49
|
-
case
|
|
50
|
-
return
|
|
51
|
-
case
|
|
52
|
-
return
|
|
49
|
+
case "large":
|
|
50
|
+
return "24px";
|
|
51
|
+
case "small":
|
|
52
|
+
return "16px";
|
|
53
53
|
default:
|
|
54
|
-
return
|
|
54
|
+
return "18px"; // Tamaño por defecto (normal)
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
get color() {
|
|
59
|
-
let intensity = this.state ===
|
|
59
|
+
let intensity = this.state === "disabled" ? "300" : "500";
|
|
60
60
|
return this.colorMap[this.type] + intensity;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
get fontColor(): string {
|
|
64
64
|
switch (this.severity) {
|
|
65
|
-
case
|
|
66
|
-
return this.type ===
|
|
67
|
-
|
|
65
|
+
case "tertiary":
|
|
66
|
+
return this.type === "default" || this.type === "legacy"
|
|
67
|
+
? "Gray-Gray-500"
|
|
68
|
+
: this.color;
|
|
69
|
+
case "secondary":
|
|
68
70
|
return this.color;
|
|
69
71
|
default:
|
|
70
|
-
return
|
|
72
|
+
return "Neutral-White";
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
75
|
|
|
@@ -75,7 +77,7 @@ export class ButtonComponent {
|
|
|
75
77
|
return `var(--${this.fontColor})`;
|
|
76
78
|
}
|
|
77
79
|
handleClick(event: Event) {
|
|
78
|
-
if (this.state !==
|
|
80
|
+
if (this.state !== "disabled" && this.state !== "loading") {
|
|
79
81
|
this.onClick.emit(event);
|
|
80
82
|
}
|
|
81
83
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Public API Surface de @dropi/ui-components
|
|
3
|
-
*
|
|
4
|
-
* Este archivo exporta la API pública de la librería para uso externo
|
|
5
3
|
*/
|
|
6
4
|
|
|
5
|
+
// Exportar componentes individuales desde components-source
|
|
6
|
+
export { ButtonComponent } from "./components-source/dropi-button/dropi-button.component";
|
|
7
|
+
|
|
7
8
|
// Exportar el módulo de elementos
|
|
8
9
|
export { DropiElementsModule } from "./lib/elements.module";
|
|
9
10
|
|
|
@@ -15,17 +16,3 @@ export {
|
|
|
15
16
|
|
|
16
17
|
// Información de versión
|
|
17
18
|
export const DROPI_ELEMENTS_VERSION = "1.0.0";
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* README: Cómo usar esta librería
|
|
21
|
-
*
|
|
22
|
-
* Los estilos CSS (dropi-tokens.css) deben importarse por separado
|
|
23
|
-
* en tu aplicación. No se pueden bundlear en el JavaScript.
|
|
24
|
-
*
|
|
25
|
-
* Ejemplo:
|
|
26
|
-
* ```typescript
|
|
27
|
-
* // En tu aplicación
|
|
28
|
-
* import '@dropi/ui-components/dropi-tokens.css'; // CSS tokens
|
|
29
|
-
* import '@dropi/ui-components'; // Web Components
|
|
30
|
-
* ```
|
|
31
|
-
*/
|