react-simple-initials 1.0.1 → 1.0.2
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 +1 -1
- package/package.json +4 -2
- package/src/{index.jsx → index.tsx} +8 -1
- package/tsconfig.json +11 -0
- package/.github/workflows/publish.yml +0 -32
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/react-simple-initials)
|
|
4
4
|
[](https://bundlephobia.com/package/react-simple-initials)
|
|
5
5
|
|
|
6
|
-
Um componente React minimalista, elegante e ultraleve
|
|
6
|
+
Um componente React minimalista, elegante e ultraleve para gerar avatares coloridos baseados nas iniciais do usuário. Perfeito para painéis, listas de contatos e comentários onde o usuário ainda não enviou uma foto de perfil.
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-simple-initials",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Um componente React minimalista para avatares com iniciais do nome.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
7
8
|
"scripts": {
|
|
8
|
-
"build": "tsup src/index.
|
|
9
|
+
"build": "tsup src/index.tsx --format cjs,esm --dts"
|
|
9
10
|
},
|
|
10
11
|
"keywords": [
|
|
11
12
|
"react",
|
|
@@ -19,6 +20,7 @@
|
|
|
19
20
|
"react": ">=16.8.0"
|
|
20
21
|
},
|
|
21
22
|
"devDependencies": {
|
|
23
|
+
"@types/react": "^19.2.14",
|
|
22
24
|
"tsup": "^8.5.1",
|
|
23
25
|
"typescript": "^5.9.3"
|
|
24
26
|
}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
interface InitialsAvatarProps {
|
|
2
|
+
nome?: string;
|
|
3
|
+
tamanho?: number;
|
|
4
|
+
fonte?: string;
|
|
5
|
+
corTexto?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
1
8
|
const FUNDOS = [
|
|
2
9
|
"#EF4444",
|
|
3
10
|
"#F97316",
|
|
@@ -14,7 +21,7 @@ export default function InitialsAvatar({
|
|
|
14
21
|
tamanho = 40,
|
|
15
22
|
fonte = "inherit",
|
|
16
23
|
corTexto = "#FFFFFF",
|
|
17
|
-
}) {
|
|
24
|
+
}: InitialsAvatarProps) {
|
|
18
25
|
const tamanhoNome = nome.length;
|
|
19
26
|
const FundoEscolhido = FUNDOS[tamanhoNome % FUNDOS.length];
|
|
20
27
|
const inicial = nome.trim().charAt(0).toUpperCase();
|
package/tsconfig.json
ADDED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
name: Publicar no NPM
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
workflow_dispatch:
|
|
5
|
-
|
|
6
|
-
jobs:
|
|
7
|
-
publish:
|
|
8
|
-
runs-on: ubuntu-latest
|
|
9
|
-
permissions:
|
|
10
|
-
contents: read
|
|
11
|
-
id-token: write
|
|
12
|
-
|
|
13
|
-
steps:
|
|
14
|
-
- name: Baixar o código
|
|
15
|
-
uses: actions/checkout@v4
|
|
16
|
-
|
|
17
|
-
- name: Configurar o Node.js
|
|
18
|
-
uses: actions/setup-node@v4
|
|
19
|
-
with:
|
|
20
|
-
node-version: "20"
|
|
21
|
-
registry-url: "https://registry.npmjs.org"
|
|
22
|
-
|
|
23
|
-
- name: Instalar dependências
|
|
24
|
-
run: npm install
|
|
25
|
-
|
|
26
|
-
- name: Construir o projeto
|
|
27
|
-
run: npm run build
|
|
28
|
-
|
|
29
|
-
- name: Publicar no NPM
|
|
30
|
-
run: npm publish --provenance --access public
|
|
31
|
-
env:
|
|
32
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|