norma-library 0.5.50 → 0.5.51
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/.storybook/main.ts +20 -0
- package/.storybook/preview.ts +15 -0
- package/README.md +13 -11
- package/package.json +22 -21
- package/src/components/Card.tsx +2 -12
- package/src/helpers/colors.ts +0 -1
- package/src/stories/Card.stories.tsx +3 -4
- package/src/types/index.ts +3 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { StorybookConfig } from '@storybook/react-vite';
|
|
2
|
+
|
|
3
|
+
const config: StorybookConfig = {
|
|
4
|
+
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
|
|
5
|
+
addons: [
|
|
6
|
+
'@storybook/addon-links',
|
|
7
|
+
'@storybook/addon-essentials',
|
|
8
|
+
'@storybook/addon-onboarding',
|
|
9
|
+
'@storybook/addon-interactions',
|
|
10
|
+
'@storybook/addon-mdx-gfm'
|
|
11
|
+
],
|
|
12
|
+
framework: {
|
|
13
|
+
name: '@storybook/react-vite',
|
|
14
|
+
options: {},
|
|
15
|
+
},
|
|
16
|
+
docs: {
|
|
17
|
+
autodocs: 'tag',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
export default config;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Preview } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
const preview: Preview = {
|
|
4
|
+
parameters: {
|
|
5
|
+
actions: { argTypesRegex: '^on[A-Z].*' },
|
|
6
|
+
controls: {
|
|
7
|
+
matchers: {
|
|
8
|
+
color: /(background|color)$/i,
|
|
9
|
+
date: /Date$/i,
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default preview;
|
package/README.md
CHANGED
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
<p align="center">
|
|
3
3
|
<img width="120" height="120" src="https://www.olos.com.br/wp-content/uploads/2023/03/cropped-selo-olos-1-180x180.png" alt="Olos logo">
|
|
4
4
|
</p>
|
|
5
|
-
|
|
6
5
|
<h1 align="center">Norma DS </h1>
|
|
7
|
-
|
|
8
6
|
<div align="center">
|
|
9
|
-
|
|
10
7
|
Olos/Norma-DS. Design System based on Material UI, developed with TypeScript and Styled Components to create reusable and consistent components in web applications.
|
|
11
8
|
|
|
12
9
|
[](https://github.com/mui/material-ui/blob/HEAD/LICENSE)
|
|
@@ -22,7 +19,7 @@ Olos/Norma-DS. Design System based on Material UI, developed with TypeScript and
|
|
|
22
19
|
|
|
23
20
|
</div>
|
|
24
21
|
|
|
25
|
-
##
|
|
22
|
+
## Configurações
|
|
26
23
|
|
|
27
24
|
- [React v18](https://react.dev/)
|
|
28
25
|
- [TypeScript](https://www.typescriptlang.org/)
|
|
@@ -33,10 +30,15 @@ Olos/Norma-DS. Design System based on Material UI, developed with TypeScript and
|
|
|
33
30
|
- Build the library with [Rollup][rollup-url]
|
|
34
31
|
- Automated release with [changesets][changesets-url]
|
|
35
32
|
|
|
36
|
-
#
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
# Documentação
|
|
34
|
+
|
|
35
|
+
### Instalação
|
|
36
|
+
Para instalação das dependencias:
|
|
37
|
+
```
|
|
38
|
+
npm install
|
|
39
|
+
```
|
|
40
|
+
### Execução do projeto
|
|
41
|
+
Para utilizar o Storybook:
|
|
42
|
+
```
|
|
43
|
+
npm run storybook
|
|
44
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "norma-library",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.51",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Olos/Norma-DS. Design System based on Material UI, developed with TypeScript and Styled Components to create reusable and consistent components in web applications.",
|
|
6
6
|
"scripts": {
|
|
@@ -12,11 +12,9 @@
|
|
|
12
12
|
"build-docz": "docz build",
|
|
13
13
|
"serve-docz": "docz build && docz serve",
|
|
14
14
|
"clean-docz": "npx rimraf .docz && npx rimraf build/docz",
|
|
15
|
-
"pre-commit": "npx lint-staged",
|
|
16
15
|
"prepare": "husky install",
|
|
17
16
|
"prettier": "npx prettier \"./**/*.{js,json,ts,tsx}\" --write",
|
|
18
|
-
"tar": "tar -cvf norma-library.tar ./storybook-static"
|
|
19
|
-
"commit": "git-cz"
|
|
17
|
+
"tar": "tar -cvf norma-library.tar ./storybook-static"
|
|
20
18
|
},
|
|
21
19
|
"author": "José Roberto Miguel Filho",
|
|
22
20
|
"module": "dist/esm/index.js",
|
|
@@ -38,16 +36,8 @@
|
|
|
38
36
|
"@emotion/styled-base": "^11.0.0",
|
|
39
37
|
"@mdx-js/loader": "^2.3.0",
|
|
40
38
|
"@mui/lab": "^5.0.0-alpha.145",
|
|
41
|
-
"@storybook/addon-essentials": "^7.5.0-alpha.1",
|
|
42
|
-
"@storybook/addon-interactions": "^7.5.0-alpha.1",
|
|
43
|
-
"@storybook/addon-links": "^7.5.0-alpha.1",
|
|
44
|
-
"@storybook/addon-onboarding": "^1.0.8",
|
|
45
39
|
"@storybook/addon-styling": "^1.3.7",
|
|
46
|
-
"@storybook/blocks": "^7.4.1",
|
|
47
|
-
"@storybook/react": "^7.4.0",
|
|
48
40
|
"@storybook/react-webpack5": "^7.5.0-alpha.1",
|
|
49
|
-
"@storybook/testing-library": "^0.2.1-next.0",
|
|
50
|
-
"@types/react": "^18.2.21",
|
|
51
41
|
"autoprefixer": "^10.4.15",
|
|
52
42
|
"camelcase": "^8.0.0",
|
|
53
43
|
"chalk": "^5.3.0",
|
|
@@ -64,19 +54,30 @@
|
|
|
64
54
|
"react": "^18.2.0",
|
|
65
55
|
"react-dom": "^18.2.0",
|
|
66
56
|
"rimraf": "^5.0.5",
|
|
67
|
-
"storybook": "^7.5.0-alpha.1",
|
|
68
57
|
"storybook-addon-dark-mode-toggle": "^0.0.6",
|
|
69
58
|
"storybook-dark-mode": "^3.0.1",
|
|
70
59
|
"style-loader": "^3.3.3",
|
|
71
60
|
"tsconfig-paths-webpack-plugin": "^4.1.0",
|
|
72
|
-
"
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
61
|
+
"@storybook/addon-essentials": "^7.5.0",
|
|
62
|
+
"@storybook/addon-interactions": "^7.5.0",
|
|
63
|
+
"@storybook/addon-links": "^7.5.0",
|
|
64
|
+
"@storybook/addon-onboarding": "^1.0.8",
|
|
65
|
+
"@storybook/blocks": "^7.5.0",
|
|
66
|
+
"@storybook/react": "^7.5.0",
|
|
67
|
+
"@storybook/react-vite": "^7.5.0",
|
|
68
|
+
"@storybook/testing-library": "^0.2.2",
|
|
69
|
+
"@types/react": "^18.2.15",
|
|
70
|
+
"@types/react-dom": "^18.2.7",
|
|
71
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
72
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
73
|
+
"@vitejs/plugin-react": "^4.0.3",
|
|
74
|
+
"eslint": "^8.45.0",
|
|
75
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
76
|
+
"eslint-plugin-react-refresh": "^0.4.3",
|
|
77
|
+
"eslint-plugin-storybook": "^0.6.15",
|
|
78
|
+
"storybook": "^7.5.0",
|
|
79
|
+
"typescript": "^5.0.2",
|
|
80
|
+
"vite": "^4.4.5"
|
|
80
81
|
},
|
|
81
82
|
"lint-staged": {
|
|
82
83
|
"*.{md,mdx}": [
|
package/src/components/Card.tsx
CHANGED
|
@@ -5,23 +5,13 @@ import { palette } from '../helpers';
|
|
|
5
5
|
import { styled } from '@mui/material/styles';
|
|
6
6
|
import { ColorVariant } from '@/types';
|
|
7
7
|
|
|
8
|
-
const colorMap: Record<ColorVariant, string> = {
|
|
9
|
-
inherit: palette.inherit,
|
|
10
|
-
primary: palette.primary,
|
|
11
|
-
secondary: palette.secondary,
|
|
12
|
-
error: palette.error,
|
|
13
|
-
warning: palette.warning,
|
|
14
|
-
info: palette.info,
|
|
15
|
-
success: palette.success,
|
|
16
|
-
};
|
|
17
|
-
|
|
18
8
|
const CardStyled = styled(MuiCard)<{
|
|
19
9
|
borderColor?: ColorVariant;
|
|
20
10
|
}>(({ borderColor }) => ({
|
|
21
11
|
padding: 16,
|
|
22
12
|
borderRadius: 5,
|
|
23
13
|
boxShadow: '0px 2px 8px #00000053',
|
|
24
|
-
borderLeft: borderColor ? `7px solid ${
|
|
14
|
+
borderLeft: borderColor ? `7px solid ${palette[borderColor]}` : 'none',
|
|
25
15
|
}));
|
|
26
16
|
|
|
27
17
|
export const Card = ({
|
|
@@ -29,7 +19,7 @@ export const Card = ({
|
|
|
29
19
|
border,
|
|
30
20
|
color = 'inherit',
|
|
31
21
|
...props
|
|
32
|
-
}: CardBaseProps & { border?: boolean;
|
|
22
|
+
}: CardBaseProps & { border?: boolean; }) => {
|
|
33
23
|
|
|
34
24
|
return (
|
|
35
25
|
<CardStyled borderColor={border ? color : undefined} {...props}>
|
package/src/helpers/colors.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Card } from '../components/Card';
|
|
3
3
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
4
|
+
import { palette } from '../helpers';
|
|
4
5
|
import { ColorVariant } from '../types';
|
|
5
6
|
|
|
6
|
-
const colors: ColorVariant[] = ['inherit', 'primary', 'secondary', 'success', 'error', 'info', 'warning'];
|
|
7
|
-
|
|
8
7
|
const meta = {
|
|
9
8
|
title: 'Layout/Card',
|
|
10
9
|
component: Card,
|
|
@@ -31,8 +30,8 @@ export const BasicBordered = () => (
|
|
|
31
30
|
|
|
32
31
|
export const BasicBorderedColors = () => (
|
|
33
32
|
<>
|
|
34
|
-
{
|
|
35
|
-
<Card sx={{ minWidth: 275, marginBottom: 2 }} border={true} color={color} key={key}>
|
|
33
|
+
{Object.keys(palette).map((color, key) => (
|
|
34
|
+
<Card sx={{ minWidth: 275, marginBottom: 2 }} border={true} color={color as ColorVariant} key={key}>
|
|
36
35
|
Card with border {color}
|
|
37
36
|
</Card>
|
|
38
37
|
))}
|
package/src/types/index.ts
CHANGED
|
@@ -19,13 +19,15 @@ import {
|
|
|
19
19
|
TableProps as MuiTableProps,
|
|
20
20
|
} from '@mui/material';
|
|
21
21
|
|
|
22
|
+
import { palette } from '../helpers';
|
|
23
|
+
|
|
22
24
|
import { TimelineProps as MuiTimeLineProps } from '@mui/lab';
|
|
23
25
|
|
|
24
26
|
import { SwitchBaseProps as MuiSwitchBaseProps } from '@mui/material/internal/SwitchBase';
|
|
25
27
|
|
|
26
28
|
import { iconsSVG } from '../components/Svgs';
|
|
27
29
|
|
|
28
|
-
export type ColorVariant =
|
|
30
|
+
export type ColorVariant = keyof typeof palette;
|
|
29
31
|
|
|
30
32
|
export type TextFieldColorVariant = 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning';
|
|
31
33
|
|