analytica-frontend-lib 1.0.0 → 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 +35 -2
- package/dist/index.css +22 -0
- package/dist/index.d.mts +29 -2
- package/dist/index.d.ts +29 -2
- package/dist/index.js +6 -5
- package/dist/index.mjs +6 -5
- package/package.json +66 -6
package/README.md
CHANGED
|
@@ -1,2 +1,35 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
1
|
+
# README
|
|
2
|
+
|
|
3
|
+
Repositório público dos componentes utilizados nas plataformas da Analytica Ensino.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/analytica-frontend-lib)
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Como usar?
|
|
10
|
+
|
|
11
|
+
Instale a biblioteca em seu projeto com o comando:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
yarn add analytica-frontend-lib
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Etapas para criar um novo componente
|
|
20
|
+
|
|
21
|
+
1. Crie uma nova branch a partir da `main`.
|
|
22
|
+
2. Crie o componente na pasta `/src/components`.
|
|
23
|
+
3. Adicione testes unitários, com cobertura mínima de 80%.
|
|
24
|
+
4. Adicione o componente no Storybook, contemplando todas as variações.
|
|
25
|
+
5. Atualize a versão no campo `version` do arquivo `package.json`.
|
|
26
|
+
6. Abra um Pull Request (PR) da sua branch para a `main`.
|
|
27
|
+
7. O GitHub Actions cuidará da publicação automática após o merge.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Regras
|
|
32
|
+
|
|
33
|
+
- Os componentes devem ser totalmente compatíveis com Next.js versão 15+.
|
|
34
|
+
- Testes unitários são obrigatórios, com coverage mínimo de 80%.
|
|
35
|
+
- Siga o princípio da responsabilidade única (`single responsibility`): construa componentes compostos por componentes menores.
|
package/dist/index.css
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
/* src/styles.css */
|
|
2
2
|
@layer properties;
|
|
3
|
+
.flex {
|
|
4
|
+
display: flex;
|
|
5
|
+
}
|
|
6
|
+
.transform {
|
|
7
|
+
transform: var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);
|
|
8
|
+
}
|
|
9
|
+
.flex-wrap {
|
|
10
|
+
flex-wrap: wrap;
|
|
11
|
+
}
|
|
12
|
+
.items-center {
|
|
13
|
+
align-items: center;
|
|
14
|
+
}
|
|
3
15
|
.transition {
|
|
4
16
|
transition-property:
|
|
5
17
|
color,
|
|
@@ -46,6 +58,11 @@
|
|
|
46
58
|
outline-style: none;
|
|
47
59
|
}
|
|
48
60
|
}
|
|
61
|
+
@property --tw-rotate-x { syntax: "*"; inherits: false; }
|
|
62
|
+
@property --tw-rotate-y { syntax: "*"; inherits: false; }
|
|
63
|
+
@property --tw-rotate-z { syntax: "*"; inherits: false; }
|
|
64
|
+
@property --tw-skew-x { syntax: "*"; inherits: false; }
|
|
65
|
+
@property --tw-skew-y { syntax: "*"; inherits: false; }
|
|
49
66
|
@property --tw-shadow { syntax: "*"; inherits: false; initial-value: 0 0 #0000; }
|
|
50
67
|
@property --tw-shadow-color { syntax: "*"; inherits: false; }
|
|
51
68
|
@property --tw-shadow-alpha { syntax: "<percentage>"; inherits: false; initial-value: 100%; }
|
|
@@ -66,6 +83,11 @@
|
|
|
66
83
|
::before,
|
|
67
84
|
::after,
|
|
68
85
|
::backdrop {
|
|
86
|
+
--tw-rotate-x: initial;
|
|
87
|
+
--tw-rotate-y: initial;
|
|
88
|
+
--tw-rotate-z: initial;
|
|
89
|
+
--tw-skew-x: initial;
|
|
90
|
+
--tw-skew-y: initial;
|
|
69
91
|
--tw-shadow: 0 0 #0000;
|
|
70
92
|
--tw-shadow-color: initial;
|
|
71
93
|
--tw-shadow-alpha: 100%;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,39 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode, ButtonHTMLAttributes } from 'react';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Button component props interface
|
|
6
|
+
*/
|
|
4
7
|
type ButtonProps = {
|
|
8
|
+
/** Content to be displayed inside the button */
|
|
5
9
|
children: ReactNode;
|
|
10
|
+
/** Visual variant of the button */
|
|
6
11
|
variant?: 'primary' | 'secondary' | 'danger';
|
|
12
|
+
/** Size variant of the button */
|
|
7
13
|
size?: 'sm' | 'md' | 'lg';
|
|
14
|
+
/** Additional CSS classes to apply */
|
|
8
15
|
className?: string;
|
|
9
16
|
} & ButtonHTMLAttributes<HTMLButtonElement>;
|
|
10
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Button component for Analytica Ensino platforms
|
|
19
|
+
*
|
|
20
|
+
* A flexible button component with multiple variants and sizes.
|
|
21
|
+
* Fully compatible with Next.js 15 and React 19.
|
|
22
|
+
*
|
|
23
|
+
* @param children - The content to display inside the button
|
|
24
|
+
* @param variant - The visual style variant (primary, secondary, danger)
|
|
25
|
+
* @param size - The size variant (sm, md, lg)
|
|
26
|
+
* @param className - Additional CSS classes
|
|
27
|
+
* @param props - All other standard button HTML attributes
|
|
28
|
+
* @returns A styled button element
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <Button variant="primary" size="md" onClick={() => console.log('clicked')}>
|
|
33
|
+
* Click me
|
|
34
|
+
* </Button>
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
declare const Button: ({ children, variant, size, className, ...props }: ButtonProps) => react_jsx_runtime.JSX.Element;
|
|
11
38
|
|
|
12
39
|
export { Button };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,39 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode, ButtonHTMLAttributes } from 'react';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Button component props interface
|
|
6
|
+
*/
|
|
4
7
|
type ButtonProps = {
|
|
8
|
+
/** Content to be displayed inside the button */
|
|
5
9
|
children: ReactNode;
|
|
10
|
+
/** Visual variant of the button */
|
|
6
11
|
variant?: 'primary' | 'secondary' | 'danger';
|
|
12
|
+
/** Size variant of the button */
|
|
7
13
|
size?: 'sm' | 'md' | 'lg';
|
|
14
|
+
/** Additional CSS classes to apply */
|
|
8
15
|
className?: string;
|
|
9
16
|
} & ButtonHTMLAttributes<HTMLButtonElement>;
|
|
10
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Button component for Analytica Ensino platforms
|
|
19
|
+
*
|
|
20
|
+
* A flexible button component with multiple variants and sizes.
|
|
21
|
+
* Fully compatible with Next.js 15 and React 19.
|
|
22
|
+
*
|
|
23
|
+
* @param children - The content to display inside the button
|
|
24
|
+
* @param variant - The visual style variant (primary, secondary, danger)
|
|
25
|
+
* @param size - The size variant (sm, md, lg)
|
|
26
|
+
* @param className - Additional CSS classes
|
|
27
|
+
* @param props - All other standard button HTML attributes
|
|
28
|
+
* @returns A styled button element
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <Button variant="primary" size="md" onClick={() => console.log('clicked')}>
|
|
33
|
+
* Click me
|
|
34
|
+
* </Button>
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
declare const Button: ({ children, variant, size, className, ...props }: ButtonProps) => react_jsx_runtime.JSX.Element;
|
|
11
38
|
|
|
12
39
|
export { Button };
|
package/dist/index.js
CHANGED
|
@@ -24,7 +24,8 @@ __export(index_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(index_exports);
|
|
26
26
|
|
|
27
|
-
// src/components/Button.tsx
|
|
27
|
+
// src/components/Button/Button.tsx
|
|
28
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
29
|
var Button = ({
|
|
29
30
|
children,
|
|
30
31
|
variant = "primary",
|
|
@@ -59,13 +60,13 @@ var Button = ({
|
|
|
59
60
|
break;
|
|
60
61
|
}
|
|
61
62
|
const baseClasses = "rounded font-medium focus:outline-none focus:ring transition";
|
|
62
|
-
return /* @__PURE__ */
|
|
63
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
63
64
|
"button",
|
|
64
65
|
{
|
|
65
66
|
className: `${baseClasses} ${variantClasses} ${sizeClasses} ${className}`,
|
|
66
|
-
...props
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
...props,
|
|
68
|
+
children
|
|
69
|
+
}
|
|
69
70
|
);
|
|
70
71
|
};
|
|
71
72
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
// src/components/Button.tsx
|
|
1
|
+
// src/components/Button/Button.tsx
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
3
|
var Button = ({
|
|
3
4
|
children,
|
|
4
5
|
variant = "primary",
|
|
@@ -33,13 +34,13 @@ var Button = ({
|
|
|
33
34
|
break;
|
|
34
35
|
}
|
|
35
36
|
const baseClasses = "rounded font-medium focus:outline-none focus:ring transition";
|
|
36
|
-
return /* @__PURE__ */
|
|
37
|
+
return /* @__PURE__ */ jsx(
|
|
37
38
|
"button",
|
|
38
39
|
{
|
|
39
40
|
className: `${baseClasses} ${variantClasses} ${sizeClasses} ${className}`,
|
|
40
|
-
...props
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
...props,
|
|
42
|
+
children
|
|
43
|
+
}
|
|
43
44
|
);
|
|
44
45
|
};
|
|
45
46
|
export {
|
package/package.json
CHANGED
|
@@ -1,42 +1,102 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "analytica-frontend-lib",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Repositório público dos componentes utilizados nas plataformas da Analytica Ensino",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"require": "./dist/index.cjs"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
11
17
|
"scripts": {
|
|
12
|
-
"
|
|
18
|
+
"lint": "npx eslint \"{src,app}/**/*.{js,jsx,ts,tsx}\" --fix",
|
|
19
|
+
"typecheck": "npx tsc --noEmit",
|
|
20
|
+
"prepare": "husky install",
|
|
21
|
+
"test": "jest --coverage",
|
|
22
|
+
"test:watch": "jest --watch",
|
|
23
|
+
"test:coverage": "jest --coverage",
|
|
24
|
+
"test:sonar": "jest --coverage --testResultsProcessor=jest-sonar-reporter",
|
|
25
|
+
"build": "tsup src/index.ts --dts --format esm,cjs --out-dir dist --clean",
|
|
26
|
+
"build:check": "npm run typecheck && npm run build",
|
|
27
|
+
"dev": "tsup src/index.ts --dts --format esm,cjs --out-dir dist --watch",
|
|
28
|
+
"prepack": "npm run build:check",
|
|
29
|
+
"check-nextjs-compat": "echo 'Checking Next.js 15 compatibility...' && npm run typecheck && npm run test",
|
|
30
|
+
"ladle": "ladle serve",
|
|
31
|
+
"ladle:build": "ladle build"
|
|
13
32
|
},
|
|
14
33
|
"engines": {
|
|
15
34
|
"node": "22.x"
|
|
16
35
|
},
|
|
17
36
|
"packageManager": "yarn@4.9.0",
|
|
18
37
|
"keywords": [
|
|
19
|
-
"analytica",
|
|
20
|
-
"ensino",
|
|
38
|
+
"analytica ensino",
|
|
21
39
|
"frontend",
|
|
22
|
-
"components"
|
|
40
|
+
"components",
|
|
41
|
+
"nextjs",
|
|
42
|
+
"nextjs-15",
|
|
43
|
+
"react-19",
|
|
44
|
+
"typescript",
|
|
45
|
+
"tailwindcss"
|
|
23
46
|
],
|
|
24
47
|
"publishConfig": {
|
|
25
48
|
"access": "public"
|
|
26
49
|
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"next": ">=15.0.0",
|
|
52
|
+
"react": ">=19.0.0",
|
|
53
|
+
"react-dom": ">=19.0.0"
|
|
54
|
+
},
|
|
27
55
|
"author": "Analytica Ensino LTDA",
|
|
28
56
|
"license": "MIT",
|
|
57
|
+
"repository": {
|
|
58
|
+
"type": "git",
|
|
59
|
+
"url": "git+https://github.com/analytica-ensino/analytica-frontend-lib.git"
|
|
60
|
+
},
|
|
61
|
+
"homepage": "https://github.com/analytica-ensino/analytica-frontend-lib#readme",
|
|
62
|
+
"bugs": {
|
|
63
|
+
"url": "https://github.com/analytica-ensino/analytica-frontend-lib/issues"
|
|
64
|
+
},
|
|
29
65
|
"dependencies": {
|
|
30
66
|
"react": "^19.1.0",
|
|
31
67
|
"react-dom": "^19.1.0"
|
|
32
68
|
},
|
|
33
69
|
"devDependencies": {
|
|
70
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
71
|
+
"@eslint/js": "^9.28.0",
|
|
72
|
+
"@ladle/react": "^5.0.3",
|
|
34
73
|
"@tailwindcss/postcss": "^4.1.8",
|
|
74
|
+
"@testing-library/dom": "^10.4.0",
|
|
75
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
76
|
+
"@testing-library/react": "^16.3.0",
|
|
77
|
+
"@testing-library/user-event": "^14.6.1",
|
|
78
|
+
"@types/jest": "^29.5.14",
|
|
35
79
|
"@types/react": "^19.1.6",
|
|
36
80
|
"@types/react-dom": "^19.1.6",
|
|
81
|
+
"@typescript-eslint/eslint-plugin": "^8.34.0",
|
|
82
|
+
"@typescript-eslint/parser": "^8.34.0",
|
|
37
83
|
"autoprefixer": "^10.4.21",
|
|
84
|
+
"eslint": "^9.28.0",
|
|
85
|
+
"eslint-config-prettier": "^10.1.5",
|
|
86
|
+
"eslint-plugin-jsdoc": "^50.7.1",
|
|
87
|
+
"eslint-plugin-prettier": "^5.4.1",
|
|
88
|
+
"husky": "^9.1.7",
|
|
89
|
+
"jest": "^29.7.0",
|
|
90
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
91
|
+
"jest-sonar-reporter": "^2.0.0",
|
|
92
|
+
"jsdom": "^26.1.0",
|
|
93
|
+
"next": "^15.3.3",
|
|
94
|
+
"polished": "^4.3.1",
|
|
38
95
|
"postcss": "^8.5.4",
|
|
96
|
+
"prettier": "^3.5.3",
|
|
97
|
+
"sonarqube-scanner": "^4.3.0",
|
|
39
98
|
"tailwindcss": "^4.1.8",
|
|
99
|
+
"ts-jest": "^29.3.4",
|
|
40
100
|
"tsup": "^8.5.0",
|
|
41
101
|
"typescript": "^5.8.3"
|
|
42
102
|
}
|