norma-library 0.6.86 → 0.6.88

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.
Files changed (67) hide show
  1. package/.storybook/main.ts +7 -0
  2. package/dist/esm/components/Box/interfaces.d.ts +1 -0
  3. package/dist/esm/components/Breadcrumb/index.d.ts +2 -2
  4. package/dist/esm/components/Breadcrumb/index.js +13 -9
  5. package/dist/esm/components/Breadcrumb/index.js.map +1 -1
  6. package/dist/esm/components/Breadcrumb/interface.d.ts +11 -6
  7. package/dist/esm/components/Breadcrumb/styles.d.ts +3 -3
  8. package/dist/esm/components/Breadcrumb/styles.js +3 -3
  9. package/dist/esm/components/Breadcrumb/styles.js.map +1 -1
  10. package/dist/esm/components/ProductCard/ProductCard.js +7 -5
  11. package/dist/esm/components/ProductCard/ProductCard.js.map +1 -1
  12. package/dist/esm/components/ProductCard/ProductCard.style.js +1 -1
  13. package/dist/esm/components/ProductCard/ProductCard.style.js.map +1 -1
  14. package/dist/esm/components/Typography/Text/interfaces.d.ts +1 -0
  15. package/dist/esm/components/Typography/Title/interfaces.d.ts +1 -0
  16. package/dist/esm/hooks/useClickOutside.d.ts +1 -1
  17. package/dist/esm/hooks/useClickOutside.js.map +1 -1
  18. package/dist/esm/interfaces/ProductCard.d.ts +1 -1
  19. package/package.json +24 -24
  20. package/src/components/Box/interfaces.ts +2 -0
  21. package/src/components/Breadcrumb/index.tsx +16 -11
  22. package/src/components/Breadcrumb/interface.ts +12 -6
  23. package/src/components/Breadcrumb/styles.tsx +10 -11
  24. package/src/components/ProductCard/ProductCard.style.ts +0 -1
  25. package/src/components/ProductCard/ProductCard.tsx +6 -5
  26. package/src/components/Typography/Text/interfaces.ts +3 -1
  27. package/src/components/Typography/Title/interfaces.ts +2 -0
  28. package/src/hooks/useClickOutside.tsx +1 -1
  29. package/src/interfaces/ProductCard.ts +1 -1
  30. package/src/stories/Accordion.stories.tsx +19 -19
  31. package/src/stories/Avatar.stories.tsx +32 -28
  32. package/src/stories/Badge.stories.tsx +17 -15
  33. package/src/stories/Box.stories.tsx +16 -12
  34. package/src/stories/Breadcrumb.stories.tsx +62 -18
  35. package/src/stories/Button.stories.tsx +24 -16
  36. package/src/stories/Card.stories.tsx +21 -13
  37. package/src/stories/ChatMessage.stories.tsx +10 -9
  38. package/src/stories/ChatMessageBalloon.stories.tsx +83 -66
  39. package/src/stories/CheckBox.stories.tsx +23 -23
  40. package/src/stories/DateInput.stories.tsx +15 -16
  41. package/src/stories/DatePicker.stories.tsx +17 -12
  42. package/src/stories/DropDown.stories.tsx +16 -16
  43. package/src/stories/IconButton.stories.tsx +45 -21
  44. package/src/stories/Modal.stories.tsx +49 -49
  45. package/src/stories/ModalStatus.stories.tsx +34 -18
  46. package/src/stories/MultiSelectInput.stories.tsx +30 -28
  47. package/src/stories/NormaChatMessageBalloon.stories.tsx +119 -82
  48. package/src/stories/Paper.stories.tsx +14 -14
  49. package/src/stories/ProductCard.stories.tsx +123 -51
  50. package/src/stories/ProgressBar.stories.tsx +27 -19
  51. package/src/stories/RadioGroup.stories.tsx +28 -21
  52. package/src/stories/RangerSlider.stories.tsx +43 -35
  53. package/src/stories/Select.stories.tsx +61 -33
  54. package/src/stories/SelectInput.stories.tsx +27 -25
  55. package/src/stories/ServiceCard.stories.tsx +36 -27
  56. package/src/stories/Table.stories.tsx +211 -276
  57. package/src/stories/Tabs.stories.tsx +17 -17
  58. package/src/stories/Tag.stories.tsx +22 -14
  59. package/src/stories/Text.stories.tsx +9 -9
  60. package/src/stories/TextField.stories.tsx +116 -35
  61. package/src/stories/TextInput.stories.tsx +14 -15
  62. package/src/stories/TimeLine.stories.tsx +22 -20
  63. package/src/stories/TimePicker.stories.tsx +54 -30
  64. package/src/stories/Title.stories.tsx +9 -9
  65. package/src/stories/UncontrolledTable.stories.tsx +196 -66
  66. package/src/stories/UncontrolledTabs.stories.tsx +28 -23
  67. /package/src/stories/{Colors.stories.mdx → Colors.mdx} +0 -0
@@ -1,9 +1,9 @@
1
- import React from 'react';
1
+ import React from 'react'
2
2
 
3
- import type { Meta } from '@storybook/react';
4
- import { Avatar, Icons } from '../components';
5
- import { AvatarGroup, Stack } from '@mui/material';
6
- import { green, pink } from '@mui/material/colors';
3
+ import type { Meta } from '@storybook/react'
4
+ import { Avatar, Icons } from '../components'
5
+ import { AvatarGroup, Stack } from '@mui/material'
6
+ import { green, pink } from '@mui/material/colors'
7
7
 
8
8
  const meta = {
9
9
  title: 'Display/Avatar',
@@ -13,28 +13,28 @@ const meta = {
13
13
  },
14
14
  tags: ['autodocs'],
15
15
  argTypes: {},
16
- } satisfies Meta<typeof Avatar>;
16
+ } satisfies Meta<typeof Avatar>
17
17
 
18
- export default meta;
18
+ export default meta
19
19
 
20
20
  function stringToColor(string: string) {
21
- let hash = 0;
22
- let i;
21
+ let hash = 0
22
+ let i
23
23
 
24
24
  /* eslint-disable no-bitwise */
25
25
  for (i = 0; i < string.length; i += 1) {
26
- hash = string.charCodeAt(i) + ((hash << 5) - hash);
26
+ hash = string.charCodeAt(i) + ((hash << 5) - hash)
27
27
  }
28
28
 
29
- let color = '#';
29
+ let color = '#'
30
30
 
31
31
  for (i = 0; i < 3; i += 1) {
32
- const value = (hash >> (i * 8)) & 0xff;
33
- color += `00${value.toString(16)}`.slice(-2);
32
+ const value = (hash >> (i * 8)) & 0xff
33
+ color += `00${value.toString(16)}`.slice(-2)
34
34
  }
35
35
  /* eslint-enable no-bitwise */
36
36
 
37
- return color;
37
+ return color
38
38
  }
39
39
 
40
40
  function stringAvatar(name: string) {
@@ -43,7 +43,7 @@ function stringAvatar(name: string) {
43
43
  bgcolor: stringToColor(name),
44
44
  },
45
45
  children: `${name.split(' ')[0][0]}${name.split(' ')[1][0]}`,
46
- };
46
+ }
47
47
  }
48
48
 
49
49
  export const AvatarBasic = () => {
@@ -51,8 +51,8 @@ export const AvatarBasic = () => {
51
51
  <>
52
52
  <Avatar src="https://mui.com/static/images/avatar/2.jpg" />
53
53
  </>
54
- );
55
- };
54
+ )
55
+ }
56
56
 
57
57
  export const AvatarVariants = () => {
58
58
  return (
@@ -61,8 +61,8 @@ export const AvatarVariants = () => {
61
61
  <Avatar src="https://mui.com/static/images/avatar/2.jpg" variant="rounded" />
62
62
  <Avatar src="https://mui.com/static/images/avatar/3.jpg" />
63
63
  </Stack>
64
- );
65
- };
64
+ )
65
+ }
66
66
 
67
67
  export const AvatarLetters = () => {
68
68
  return (
@@ -73,20 +73,24 @@ export const AvatarLetters = () => {
73
73
  <Avatar {...stringAvatar('Tim Neutkens')} />
74
74
  </Stack>
75
75
  </>
76
- );
77
- };
76
+ )
77
+ }
78
78
 
79
79
  export const AvatarSizes = () => {
80
80
  return (
81
81
  <>
82
82
  <Stack direction="row" spacing={2}>
83
- <Avatar src="https://mui.com/static/images/avatar/1.jpg" variant="square" sx={{ width: 24, height: 24 }} />
83
+ <Avatar
84
+ src="https://mui.com/static/images/avatar/1.jpg"
85
+ variant="square"
86
+ sx={{ width: 24, height: 24 }}
87
+ />
84
88
  <Avatar src="https://mui.com/static/images/avatar/2.jpg" variant="rounded" />
85
89
  <Avatar src="https://mui.com/static/images/avatar/3.jpg" sx={{ width: 56, height: 56 }} />
86
90
  </Stack>
87
91
  </>
88
- );
89
- };
92
+ )
93
+ }
90
94
 
91
95
  export const AvatarWidthIcons = () => {
92
96
  return (
@@ -103,8 +107,8 @@ export const AvatarWidthIcons = () => {
103
107
  </Avatar>
104
108
  </Stack>
105
109
  </>
106
- );
107
- };
110
+ )
111
+ }
108
112
 
109
113
  export const AvatarGrouped = () => {
110
114
  return (
@@ -119,5 +123,5 @@ export const AvatarGrouped = () => {
119
123
  </AvatarGroup>
120
124
  </Stack>
121
125
  </>
122
- );
123
- };
126
+ )
127
+ }
@@ -1,8 +1,8 @@
1
- import React from 'react';
1
+ import React from 'react'
2
2
 
3
- import type { Meta } from '@storybook/react';
4
- import { Avatar, Badge, Icons } from '../components';
5
- import { AvatarGroup, Stack } from '@mui/material';
3
+ import type { Meta } from '@storybook/react'
4
+ import { Avatar, Badge, Icons } from '../components'
5
+ import { AvatarGroup, Stack } from '@mui/material'
6
6
 
7
7
  const meta = {
8
8
  title: 'Display/Badge',
@@ -12,9 +12,9 @@ const meta = {
12
12
  },
13
13
  tags: ['autodocs'],
14
14
  argTypes: {},
15
- } satisfies Meta<typeof Badge>;
15
+ } satisfies Meta<typeof Badge>
16
16
 
17
- export default meta;
17
+ export default meta
18
18
 
19
19
  export const BadgeBasic = () => {
20
20
  return (
@@ -23,17 +23,19 @@ export const BadgeBasic = () => {
23
23
  <Icons icon="user" />
24
24
  </Badge>
25
25
  </>
26
- );
27
- };
26
+ )
27
+ }
28
28
 
29
29
  export const BadgeColors = () => {
30
30
  return (
31
31
  <Stack direction="row" spacing={2}>
32
- {['primary', 'secondary', 'default', 'error', 'info', 'success', 'warning'].map((color, key) => (
33
- <Badge badgeContent={4} color={color} key={key}>
34
- <Icons icon="user" />
35
- </Badge>
36
- ))}
32
+ {['primary', 'secondary', 'default', 'error', 'info', 'success', 'warning'].map(
33
+ (color, key) => (
34
+ <Badge badgeContent={4} color={color} key={key}>
35
+ <Icons icon="user" />
36
+ </Badge>
37
+ ),
38
+ )}
37
39
  </Stack>
38
- );
39
- };
40
+ )
41
+ }
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import Box from '../components/Box';
1
+ import React from 'react'
2
+ import Box from '../components/Box'
3
3
 
4
4
  export default {
5
5
  title: 'Layout/Box',
@@ -10,27 +10,31 @@ export default {
10
10
  backgrounds: {
11
11
  default: 'gray',
12
12
  values: [
13
- {
14
- name: 'gray',
15
- value: '#f8f8f8'
16
- }
13
+ {
14
+ name: 'gray',
15
+ value: '#f8f8f8',
16
+ },
17
17
  ],
18
18
  },
19
19
  },
20
20
  argTypes: {
21
21
  children: {
22
- description: 'Adiciona um children.'
22
+ description: 'Adiciona um children.',
23
23
  },
24
24
  size: {
25
25
  description: 'Definir o tamanho do componente.',
26
26
  options: ['small', 'medium', 'large'],
27
- control: { type: 'radio' }
27
+ control: { type: 'radio' },
28
28
  },
29
29
  },
30
30
  }
31
31
 
32
- export const Default = (args) => <Box {...args}><p>Conteudo</p></Box>
32
+ export const Default = (args) => (
33
+ <Box {...args}>
34
+ <p>Conteudo</p>
35
+ </Box>
36
+ )
33
37
 
34
- Default.args = {
35
- size: 'medium'
36
- }
38
+ Default.args = {
39
+ size: 'medium',
40
+ }
@@ -1,18 +1,55 @@
1
1
  import React from 'react';
2
2
  import Breadcrumb from '../components/Breadcrumb';
3
+ import { BreadCrumbProps } from '../components/Breadcrumb/interface';
4
+ import { ApartmentRounded, DoNotStepOutlined, Home } from '@mui/icons-material';
3
5
 
4
- const routes = [
6
+ const routes: BreadCrumbProps['items'] = [
5
7
  {
6
- name: 'Pagina 1',
7
- route: '/pagina-1'
8
+ id: '1',
9
+ label: 'Home',
10
+ href: '/home',
11
+ icon: Home,
8
12
  },
9
13
  {
10
- name: 'Pagina 2',
11
- route: '/pagina-2'
14
+ id: '2',
15
+ label: 'Products',
16
+ href: '/products',
17
+ icon: ApartmentRounded,
12
18
  },
13
19
  {
14
- name: 'Pagina 3',
15
- route: '/pagina-3'
20
+ id: '3',
21
+ label: 'Shoes',
22
+ href: '/shoes',
23
+ icon: DoNotStepOutlined,
24
+ },
25
+ {
26
+ id: '4',
27
+ label: 'Sneakers',
28
+ href: '/sneakers',
29
+ icon: "faceAngry",
30
+ }
31
+ ]
32
+
33
+ const routesWithoutIcons: BreadCrumbProps['items'] = [
34
+ {
35
+ id: '1',
36
+ label: 'Home',
37
+ href: '/home',
38
+ },
39
+ {
40
+ id: '2',
41
+ label: 'Products',
42
+ href: '/products',
43
+ },
44
+ {
45
+ id: '3',
46
+ label: 'Shoes',
47
+ href: '/shoes',
48
+ },
49
+ {
50
+ id: '4',
51
+ label: 'Sneakers',
52
+ href: '/sneakers',
16
53
  }
17
54
  ]
18
55
 
@@ -24,22 +61,29 @@ export default {
24
61
  layout: 'centered',
25
62
  },
26
63
  argTypes: {
27
- links: {
28
- description: 'Adicione as rotas que irão aparecer.',
64
+ items: {
65
+ description: 'Adicione as rotas que irão aparecer, com as propriedades id, label, href e icon.',
29
66
  },
30
- className: {
31
- description: 'Adicione uma classe.',
67
+ onHomeClick: {
68
+ description: 'Função que será chamada ao clicar no botão de Home.',
69
+ },
70
+ onPathClick: {
71
+ description: 'Função que será chamada ao clicar em uma rota.',
32
72
  },
33
- onChange: {
34
- description: 'Função para capturar o valor quando clicado.'
35
- }
36
73
  }
37
74
  }
38
75
 
39
- export const Default = (args) => <Breadcrumb {...args} />
76
+ export const Default = (args: BreadCrumbProps) => <Breadcrumb {...args} />
77
+ export const WithoutIcons = (args: BreadCrumbProps) => <Breadcrumb {...args} />
40
78
 
41
79
  Default.args = {
42
- links: routes,
43
- className: '',
44
- onChange: '',
80
+ items: routes,
81
+ onHomeClick: () => console.log('Home clicked', routes[0]),
82
+ onPathClick: (item) => console.log('Path clicked', item),
83
+ }
84
+
85
+ WithoutIcons.args = {
86
+ items: routesWithoutIcons.map(({ id, label, href }) => ({ id, label, href })),
87
+ onHomeClick: () => console.log('Home clicked', routes[0]),
88
+ onPathClick: (item) => console.log('Path clicked', item),
45
89
  }
@@ -1,12 +1,20 @@
1
- import React from 'react';
2
- import { Button } from '../components/Button';
3
- import type { Meta, StoryObj } from '@storybook/react';
4
- import { ButtonVariant, SizeVariant, ColorVariant, DisabledVariant } from '../types';
1
+ import React from 'react'
2
+ import { Button } from '../components/Button'
3
+ import type { Meta, StoryObj } from '@storybook/react'
4
+ import { ButtonVariant, SizeVariant, ColorVariant, DisabledVariant } from '../types'
5
5
 
6
- const sizes: SizeVariant[] = ['small', 'medium', 'large'];
7
- const disableds: DisabledVariant[] = ['true', 'false'];
8
- const variants: ButtonVariant[] = ['text', 'outlined', 'contained'];
9
- const colors: ColorVariant[] = ['inherit', 'primary', 'secondary', 'success', 'error', 'info', 'warning'];
6
+ const sizes: SizeVariant[] = ['small', 'medium', 'large']
7
+ const disableds: DisabledVariant[] = ['true', 'false']
8
+ const variants: ButtonVariant[] = ['text', 'outlined', 'contained']
9
+ const colors: ColorVariant[] = [
10
+ 'inherit',
11
+ 'primary',
12
+ 'secondary',
13
+ 'success',
14
+ 'error',
15
+ 'info',
16
+ 'warning',
17
+ ]
10
18
 
11
19
  const meta = {
12
20
  title: 'Layout/Button',
@@ -16,15 +24,15 @@ const meta = {
16
24
  },
17
25
  tags: ['autodocs'],
18
26
  argTypes: {},
19
- } satisfies Meta<typeof Button>;
27
+ } satisfies Meta<typeof Button>
20
28
 
21
- export default meta;
29
+ export default meta
22
30
 
23
- type Story = StoryObj<typeof meta>;
31
+ type Story = StoryObj<typeof meta>
24
32
 
25
33
  const defaultArgs = {
26
34
  disabled: false,
27
- };
35
+ }
28
36
 
29
37
  export const Playground: Story = {
30
38
  args: {
@@ -34,7 +42,7 @@ export const Playground: Story = {
34
42
  color: 'primary',
35
43
  variant: 'contained',
36
44
  },
37
- };
45
+ }
38
46
 
39
47
  export const ButtonSizes = () => (
40
48
  <>
@@ -49,7 +57,7 @@ export const ButtonSizes = () => (
49
57
  />
50
58
  ))}
51
59
  </>
52
- );
60
+ )
53
61
 
54
62
  export const ButtonVariants = () => (
55
63
  <>
@@ -63,7 +71,7 @@ export const ButtonVariants = () => (
63
71
  />
64
72
  ))}
65
73
  </>
66
- );
74
+ )
67
75
 
68
76
  export const ButtonColorsDefault = () => (
69
77
  <>
@@ -90,4 +98,4 @@ export const ButtonColorsDefault = () => (
90
98
  ))}
91
99
  </div>
92
100
  </>
93
- );
101
+ )
@@ -1,9 +1,17 @@
1
- import React from 'react';
2
- import { Card } from '../components/Card';
3
- import type { Meta, StoryObj } from '@storybook/react';
4
- import { ColorVariant } from '../types';
5
-
6
- const colors: ColorVariant[] = ['inherit', 'primary', 'secondary', 'success', 'error', 'info', 'warning'];
1
+ import React from 'react'
2
+ import { Card } from '../components/Card'
3
+ import type { Meta, StoryObj } from '@storybook/react'
4
+ import { ColorVariant } from '../types'
5
+
6
+ const colors: ColorVariant[] = [
7
+ 'inherit',
8
+ 'primary',
9
+ 'secondary',
10
+ 'success',
11
+ 'error',
12
+ 'info',
13
+ 'warning',
14
+ ]
7
15
 
8
16
  const meta = {
9
17
  title: 'Layout/Card',
@@ -13,21 +21,21 @@ const meta = {
13
21
  },
14
22
  tags: ['autodocs'],
15
23
  argTypes: {},
16
- } satisfies Meta<typeof Card>;
24
+ } satisfies Meta<typeof Card>
17
25
 
18
- export default meta;
26
+ export default meta
19
27
 
20
- type Story = StoryObj<typeof meta>;
28
+ type Story = StoryObj<typeof meta>
21
29
 
22
- const defaultArgs = {};
30
+ const defaultArgs = {}
23
31
 
24
- export const BasicCard = () => <Card sx={{ minWidth: 275 }}>Content children card</Card>;
32
+ export const BasicCard = () => <Card sx={{ minWidth: 275 }}>Content children card</Card>
25
33
 
26
34
  export const BasicBordered = () => (
27
35
  <Card sx={{ minWidth: 275 }} border={true} color="primary">
28
36
  Card with border
29
37
  </Card>
30
- );
38
+ )
31
39
 
32
40
  export const BasicBorderedColors = () => (
33
41
  <>
@@ -37,4 +45,4 @@ export const BasicBorderedColors = () => (
37
45
  </Card>
38
46
  ))}
39
47
  </>
40
- );
48
+ )
@@ -1,7 +1,7 @@
1
- import React from 'react';
1
+ import React from 'react'
2
2
 
3
- import type { Meta } from '@storybook/react';
4
- import { ChatMessage, Icons, Avatar } from '../components';
3
+ import type { Meta } from '@storybook/react'
4
+ import { ChatMessage, Icons, Avatar } from '../components'
5
5
 
6
6
  const meta = {
7
7
  title: 'Display/ChatMessage',
@@ -11,15 +11,16 @@ const meta = {
11
11
  },
12
12
  tags: ['autodocs'],
13
13
  argTypes: {},
14
- } satisfies Meta<typeof ChatMessage>;
14
+ } satisfies Meta<typeof ChatMessage>
15
15
 
16
- export default meta;
16
+ export default meta
17
17
 
18
18
  const chat = [
19
19
  {
20
20
  send: 'me',
21
21
  name: 'Alice',
22
- message: 'Olá, tudo bem? Meu nome é Alice e falo em nome do banco Bradesco. Eu gostaria de falar com Bob',
22
+ message:
23
+ 'Olá, tudo bem? Meu nome é Alice e falo em nome do banco Bradesco. Eu gostaria de falar com Bob',
23
24
  time: '09:50',
24
25
  emotion: (
25
26
  <Avatar
@@ -73,12 +74,12 @@ const chat = [
73
74
  </Avatar>
74
75
  ),
75
76
  },
76
- ];
77
+ ]
77
78
 
78
79
  export const ChatMessageBasic = () => {
79
80
  return (
80
81
  <>
81
82
  <ChatMessage data={chat} />
82
83
  </>
83
- );
84
- };
84
+ )
85
+ }