norma-library 0.4.7 → 0.4.9

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 (79) hide show
  1. package/dist/esm/components/ChatMessage.d.ts +3 -0
  2. package/dist/esm/components/ChatMessage.js +63 -0
  3. package/dist/esm/components/ChatMessage.js.map +1 -0
  4. package/dist/esm/components/DataGrid/base/dropdown.d.ts +4 -0
  5. package/dist/esm/components/DataGrid/base/dropdown.js +126 -0
  6. package/dist/esm/components/DataGrid/base/dropdown.js.map +1 -0
  7. package/dist/esm/components/DataGrid/base/number-filter.d.ts +4 -0
  8. package/dist/esm/components/DataGrid/base/number-filter.js +30 -0
  9. package/dist/esm/components/DataGrid/base/number-filter.js.map +1 -0
  10. package/dist/esm/components/DataGrid/base/sorting.d.ts +5 -0
  11. package/dist/esm/components/DataGrid/base/sorting.js +15 -0
  12. package/dist/esm/components/DataGrid/base/sorting.js.map +1 -0
  13. package/dist/esm/components/DataGrid/icons.d.ts +4 -0
  14. package/dist/esm/components/DataGrid/icons.js +15 -0
  15. package/dist/esm/components/DataGrid/icons.js.map +1 -0
  16. package/dist/esm/components/DataGrid/index.d.ts +5 -0
  17. package/dist/esm/components/DataGrid/index.js +146 -0
  18. package/dist/esm/components/DataGrid/index.js.map +1 -0
  19. package/dist/esm/components/DataGrid/shared.d.ts +20 -0
  20. package/dist/esm/components/DataGrid/shared.js +141 -0
  21. package/dist/esm/components/DataGrid/shared.js.map +1 -0
  22. package/dist/esm/components/DataGrid/styled.d.ts +10 -0
  23. package/dist/esm/components/DataGrid/styled.js +73 -0
  24. package/dist/esm/components/DataGrid/styled.js.map +1 -0
  25. package/dist/esm/components/Icons.js +1 -1
  26. package/dist/esm/components/ProgressBar.d.ts +0 -3
  27. package/dist/esm/components/ProgressBar.js +1 -1
  28. package/dist/esm/components/ProgressBar.js.map +1 -1
  29. package/dist/esm/components/TimeLine.d.ts +3 -0
  30. package/dist/esm/components/TimeLine.js +59 -0
  31. package/dist/esm/components/TimeLine.js.map +1 -0
  32. package/dist/esm/components/index.d.ts +3 -0
  33. package/dist/esm/components/index.js +3 -0
  34. package/dist/esm/components/index.js.map +1 -1
  35. package/dist/esm/helpers/colors.d.ts +3 -1
  36. package/dist/esm/helpers/colors.js +39 -10
  37. package/dist/esm/helpers/colors.js.map +1 -1
  38. package/dist/esm/interfaces/ChatMessage.d.ts +12 -0
  39. package/dist/esm/interfaces/ChatMessage.js +2 -0
  40. package/dist/esm/interfaces/ChatMessage.js.map +1 -0
  41. package/dist/esm/interfaces/DataGrid.d.ts +40 -0
  42. package/dist/esm/interfaces/DataGrid.js +2 -0
  43. package/dist/esm/interfaces/DataGrid.js.map +1 -0
  44. package/dist/esm/interfaces/TimeLine.d.ts +11 -0
  45. package/dist/esm/interfaces/TimeLine.js +2 -0
  46. package/dist/esm/interfaces/TimeLine.js.map +1 -0
  47. package/dist/esm/interfaces/index.d.ts +4 -1
  48. package/dist/esm/interfaces/index.js +4 -1
  49. package/dist/esm/interfaces/index.js.map +1 -1
  50. package/dist/esm/types/index.d.ts +12 -2
  51. package/dist/esm/types/index.js.map +1 -1
  52. package/norma-library.tar +0 -0
  53. package/package.json +3 -2
  54. package/src/components/ChatMessage.tsx +89 -0
  55. package/src/components/DataGrid/allData.json +2918 -0
  56. package/src/components/DataGrid/base/dropdown.tsx +235 -0
  57. package/src/components/DataGrid/base/number-filter.tsx +43 -0
  58. package/src/components/DataGrid/base/sorting.tsx +35 -0
  59. package/src/components/DataGrid/icons.tsx +61 -0
  60. package/src/components/DataGrid/index.tsx +319 -0
  61. package/src/components/DataGrid/shared.ts +179 -0
  62. package/src/components/DataGrid/styled.ts +102 -0
  63. package/src/components/DataGrid/styles/dropdown.module.css +86 -0
  64. package/src/components/DataGrid/styles/number-filter.module.css +16 -0
  65. package/src/components/DataGrid/styles/styles.module.css +107 -0
  66. package/src/components/Icons.tsx +1 -1
  67. package/src/components/ProgressBar.tsx +2 -1
  68. package/src/components/TimeLine.tsx +103 -0
  69. package/src/components/index.ts +3 -0
  70. package/src/helpers/colors.ts +44 -10
  71. package/src/interfaces/ChatMessage.ts +12 -0
  72. package/src/interfaces/DataGrid.ts +51 -0
  73. package/src/interfaces/TimeLine.ts +16 -0
  74. package/src/interfaces/index.ts +4 -1
  75. package/src/sample-data.json +178 -0
  76. package/src/stories/ChatMessage.stories.tsx +85 -0
  77. package/src/stories/DataGrid.stories.tsx +28 -0
  78. package/src/stories/TimeLine.stories.tsx +43 -0
  79. package/src/types/index.ts +26 -1
@@ -0,0 +1,12 @@
1
+ export interface ChatProps {
2
+ name: string;
3
+ message: string;
4
+ emotion?: React.ReactNode;
5
+ emotionReplay?: React.ReactNode;
6
+ time: string;
7
+ send: "me" | "replay";
8
+ }
9
+
10
+ export interface ChatMessageProps {
11
+ data: ChatProps[];
12
+ }
@@ -0,0 +1,51 @@
1
+ import { MuiDataGridBaseProps } from "@/types";
2
+ import { SxProps, Theme } from "@mui/material";
3
+ import { OverridableStringUnion } from "@mui/types";
4
+
5
+ export interface DataGridPropsVariantOverrides {}
6
+
7
+ export interface SortingProps {
8
+ sort?: string;
9
+ active?: boolean;
10
+ }
11
+
12
+ export interface DataGridBaseProps extends MuiDataGridBaseProps {
13
+ data: { dataSource: any; columns: any }[];
14
+ sx?: SxProps<Theme>;
15
+ variant?: OverridableStringUnion<
16
+ | "standard"
17
+ | "standard-divider"
18
+ | "standard-selectable"
19
+ | "quiet"
20
+ | "quiet-divider"
21
+ | "quiet-selectable",
22
+ DataGridPropsVariantOverrides
23
+ >;
24
+ width?: string;
25
+ height?: string;
26
+ }
27
+
28
+ export interface DataSourceItem {
29
+ [key: string]: string | number;
30
+ }
31
+
32
+ export interface DropdownFilterProps {
33
+ onSelectAll: boolean;
34
+ format?: string;
35
+ data: (string | number)[];
36
+ onFilter: (item: string) => void;
37
+ onOrder: (item: string) => void;
38
+ onChecketAll: (item: boolean) => void;
39
+ onSelected: (item: (string | number)[]) => void;
40
+ itemsSelected: (string | number)[];
41
+ onFilterSelected: () => void;
42
+ }
43
+
44
+ export interface NumberFilterProps {
45
+ onClick: (selectedOption: string) => void;
46
+ }
47
+
48
+ export interface PaginationProps {
49
+ totalItems: number;
50
+ pageSize: number;
51
+ }
@@ -0,0 +1,16 @@
1
+ import { SxProps } from "@mui/material";
2
+ import { Theme } from "@emotion/react";
3
+ import {
4
+ ColorVariant,
5
+ DataTimeLine,
6
+ MuiTimeLineBaseProps,
7
+ PositionVariant,
8
+ } from "../types";
9
+
10
+ export interface TimeLineBaseProps extends MuiTimeLineBaseProps {
11
+ position?: PositionVariant;
12
+ children?: React.ReactNode;
13
+ sx?: SxProps<Theme>;
14
+ color: ColorVariant;
15
+ data: DataTimeLine[];
16
+ }
@@ -3,7 +3,9 @@ export * from "./Avatar";
3
3
  export * from "./Badge";
4
4
  export * from "./Button";
5
5
  export * from "./Card";
6
+ export * from "./ChatMessage";
6
7
  export * from "./CheckBox";
8
+ export * from "./DataGrid";
7
9
  export * from "./DatePicker";
8
10
  export * from "./DropDown";
9
11
  export * from "./IconButton";
@@ -12,9 +14,10 @@ export * from "./Modal";
12
14
  export * from "./Paper";
13
15
  export * from "./ProgressBar";
14
16
  export * from "./RadioGroup";
15
- export * from "./RadioGroup";
16
17
  export * from "./RangerSlider";
17
18
  export * from "./Select";
18
19
  export * from "./Tabs";
19
20
  export * from "./Tag";
20
21
  export * from "./TextField";
22
+ export * from "./TimeLine";
23
+ export * from "./TimePicker";
@@ -0,0 +1,178 @@
1
+ [
2
+ {
3
+ "columns": [
4
+ {
5
+ "allowFiltering": true,
6
+ "allowFiltering": true,
7
+ "allowSorting": true,
8
+ "field": "data",
9
+ "format": "date",
10
+ "headerText": "Data",
11
+ "textAlign": "left",
12
+ "width": "100%"
13
+ },
14
+ {
15
+ "allowFiltering": true,
16
+ "allowSorting": true,
17
+ "field": "duration",
18
+ "format": "time",
19
+ "headerText": "Duração",
20
+ "textAlign": "left",
21
+ "width": "100%"
22
+ },
23
+ {
24
+ "allowFiltering": true,
25
+ "allowSorting": true,
26
+ "field": "campanha",
27
+ "format": "string",
28
+ "headerText": "Campanha",
29
+ "textAlign": "left",
30
+ "width": "100%"
31
+ },
32
+ {
33
+ "allowFiltering": true,
34
+ "allowSorting": true,
35
+ "field": "agente",
36
+ "format": "string",
37
+ "headerText": "Agente",
38
+ "textAlign": "left",
39
+ "width": "100%"
40
+ },
41
+ {
42
+ "allowFiltering": true,
43
+ "allowSorting": true,
44
+ "field": "ani",
45
+ "format": "number",
46
+ "headerText": "ANI",
47
+ "textAlign": "left",
48
+ "width": "100%"
49
+ },
50
+ {
51
+ "allowFiltering": true,
52
+ "allowSorting": true,
53
+ "field": "dnis",
54
+ "format": "number",
55
+ "headerText": "DNIS",
56
+ "textAlign": "left",
57
+ "width": "100%"
58
+ },
59
+ {
60
+ "allowFiltering": true,
61
+ "allowSorting": true,
62
+ "field": "disposition",
63
+ "format": "string",
64
+ "headerText": "Tabulação",
65
+ "textAlign": "left",
66
+ "width": "100%"
67
+ },
68
+ {
69
+ "allowFiltering": true,
70
+ "allowSorting": true,
71
+ "field": "origem",
72
+ "format": "number",
73
+ "headerText": "Origem",
74
+ "textAlign": "left",
75
+ "width": "100%"
76
+ },
77
+ {
78
+ "allowFiltering": true,
79
+ "allowSorting": true,
80
+ "field": "id",
81
+ "format": "number",
82
+ "headerText": "ID",
83
+ "textAlign": "left",
84
+ "width": "100%"
85
+ }
86
+ ],
87
+ "dataSource": [
88
+ {
89
+ "data": "01/05/2022",
90
+ "duration": "08:18",
91
+ "campanha": "Campanha 1",
92
+ "agente": 16321,
93
+ "ani": 50364908,
94
+ "dnis": 123456,
95
+ "disposition": "Tabulação 1",
96
+ "origin": 12723,
97
+ "id": 1
98
+ },
99
+ {
100
+ "data": "01/05/2022",
101
+ "duration": "00:18",
102
+ "campanha": "Campanha 2",
103
+ "agente": "16322",
104
+ "ani": "50364909",
105
+ "dnis": "123457",
106
+ "disposition": "Tabulação 2",
107
+ "origin": "12721",
108
+ "id": 2
109
+ },
110
+ {
111
+ "data": "03/05/2022",
112
+ "duration": "03:13",
113
+ "campanha": "Campanha 1",
114
+ "agente": "16321",
115
+ "ani": "50364908",
116
+ "dnis": "123456",
117
+ "disposition": "Tabulação 1",
118
+ "origin": "12723",
119
+ "id": 3
120
+ },
121
+ {
122
+ "data": "01/05/2022",
123
+ "duration": "09:19",
124
+ "campanha": "Campanha 1",
125
+ "agente": "16321",
126
+ "ani": "50364908",
127
+ "dnis": "123456",
128
+ "disposition": "Tabulação 1",
129
+ "origin": "12723",
130
+ "id": 4
131
+ },
132
+ {
133
+ "data": "02/05/2022",
134
+ "duration": "02:59",
135
+ "campanha": "Campanha 1",
136
+ "agente": "16321",
137
+ "ani": "50364908",
138
+ "dnis": "123456",
139
+ "disposition": "Tabulação 1",
140
+ "origin": "12723",
141
+ "id": 5
142
+ },
143
+ {
144
+ "data": "04/05/2022",
145
+ "duration": "05:02",
146
+ "campanha": "Campanha 1",
147
+ "agente": "16321",
148
+ "ani": "50364908",
149
+ "dnis": "123456",
150
+ "disposition": "Tabulação 1",
151
+ "origin": "12723",
152
+ "id": 6
153
+ },
154
+ {
155
+ "data": "21/05/2022",
156
+ "duration": "06:02",
157
+ "campanha": "Campanha 7",
158
+ "agente": "16315",
159
+ "ani": "50364909",
160
+ "dnis": "123456",
161
+ "disposition": "Tabulação 7",
162
+ "origin": "12754",
163
+ "id": 7
164
+ },
165
+ {
166
+ "data": "23/05/2022",
167
+ "duration": "04:04",
168
+ "campanha": "Campanha 8",
169
+ "agente": "16321",
170
+ "ani": "50364908",
171
+ "dnis": "123456",
172
+ "disposition": "Tabulação 8",
173
+ "origin": "12752",
174
+ "id": 8
175
+ }
176
+ ]
177
+ }
178
+ ]
@@ -0,0 +1,85 @@
1
+ import React from "react";
2
+
3
+ import type { Meta } from "@storybook/react";
4
+ import { ChatMessage, Icons, Avatar } from "../components";
5
+
6
+ const meta = {
7
+ title: "Display/ChatMessage",
8
+ component: ChatMessage,
9
+ parameters: {
10
+ layout: "centered",
11
+ },
12
+ tags: ["autodocs"],
13
+ argTypes: {},
14
+ } satisfies Meta<typeof ChatMessage>;
15
+
16
+ export default meta;
17
+
18
+ const chat = [
19
+ {
20
+ send: "me",
21
+ name: "Alice",
22
+ message:
23
+ "Olá, tudo bem? Meu nome é Alice e falo em nome do banco Bradesco. Eu gostaria de falar com Bob",
24
+ time: "09:50",
25
+ emotion: (
26
+ <Avatar
27
+ sx={{
28
+ backgroundColor: "#FFF",
29
+ border: "1px solid rgb(255, 195, 0)",
30
+ m: "5px",
31
+ }}
32
+ >
33
+ <Icons icon="faceNeutral" scale="large" color="warning" />
34
+ </Avatar>
35
+ ),
36
+ emotionReplay: (
37
+ <Avatar
38
+ sx={{
39
+ backgroundColor: "#FFF",
40
+ border: "1px solid rgb(219, 102, 25)",
41
+ m: "5px",
42
+ }}
43
+ >
44
+ <Icons icon="faceHappy" scale="large" color="primary" />
45
+ </Avatar>
46
+ ),
47
+ },
48
+ {
49
+ send: "replay",
50
+ name: "Bob",
51
+ message: "Oi, estou bem, obrigado! E você?",
52
+ time: "10:05",
53
+ },
54
+ {
55
+ send: "me",
56
+ name: "Alice",
57
+ message: "Estou ótima, obrigada por perguntar!",
58
+ time: "10:10",
59
+ },
60
+ {
61
+ send: "replay",
62
+ name: "Bob",
63
+ message: "Que bom ouvir isso!",
64
+ time: "10:15",
65
+ emotion: (
66
+ <Avatar
67
+ sx={{
68
+ backgroundColor: "#FFF",
69
+ border: "1px solid rgb(219, 102, 25)",
70
+ m: "5px",
71
+ }}
72
+ >
73
+ <Icons icon="faceHappy" scale="large" color="primary" />
74
+ </Avatar>
75
+ ),
76
+ },
77
+ ];
78
+
79
+ export const ChatMessageBasic = () => {
80
+ return (
81
+ <>
82
+ <ChatMessage data={chat} />
83
+ </>
84
+ );
85
+ };
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+
3
+ import type { Meta } from "@storybook/react";
4
+ import { DataGrid } from "../components";
5
+ import dataSource from "../components/DataGrid/allData.json";
6
+ import data from "../sample-data.json";
7
+
8
+ const meta = {
9
+ title: "Display/DataGrid",
10
+ component: DataGrid,
11
+ parameters: {
12
+ layout: "centered",
13
+ },
14
+ tags: ["autodocs"],
15
+ argTypes: {},
16
+ } satisfies Meta<typeof DataGrid>;
17
+
18
+ export default meta;
19
+
20
+ export const DataGridBasic = () => {
21
+ return (
22
+ <>
23
+ <DataGrid data={data} />
24
+ </>
25
+ );
26
+ };
27
+
28
+ DataGridBasic.storyName = "DataGrid Basic";
@@ -0,0 +1,43 @@
1
+ import React from "react";
2
+
3
+ import type { Meta } from "@storybook/react";
4
+ import { TimeLine } from "../components";
5
+ import { Stack } from "@mui/material";
6
+
7
+ const meta = {
8
+ title: "Display/TimeLine",
9
+ component: TimeLine,
10
+ parameters: {
11
+ layout: "centered",
12
+ },
13
+ tags: ["autodocs"],
14
+ argTypes: {},
15
+ } satisfies Meta<typeof TimeLine>;
16
+
17
+ export default meta;
18
+
19
+ export const TimeLineBasic = () => {
20
+ return (
21
+ <>
22
+ <TimeLine />
23
+ </>
24
+ );
25
+ };
26
+
27
+ export const TimeLineColors = () => {
28
+ return (
29
+ <Stack direction="row" spacing={2}>
30
+ {[
31
+ "primary",
32
+ "secondary",
33
+ "inherit",
34
+ "error",
35
+ "info",
36
+ "success",
37
+ "warning",
38
+ ].map((color, key) => (
39
+ <TimeLine color={color} key={key} />
40
+ ))}
41
+ </Stack>
42
+ );
43
+ };
@@ -16,8 +16,11 @@ import {
16
16
  SvgIconProps,
17
17
  ModalProps,
18
18
  CardProps as MuiCardProps,
19
+ TableProps as MuiTableProps,
19
20
  } from "@mui/material";
20
21
 
22
+ import { TimelineProps as MuiTimeLineProps } from "@mui/lab";
23
+
21
24
  import { SwitchBaseProps as MuiSwitchBaseProps } from "@mui/material/internal/SwitchBase";
22
25
 
23
26
  import { iconsSVG } from "../components/Svgs";
@@ -75,6 +78,11 @@ export type TextFieldVariant = "standard" | "outlined" | "filled";
75
78
  export type TextFieldSizeVariant = "small" | "medium";
76
79
  export type DirectionVariant = "vertical" | "horizontal";
77
80
  export type PaperVariant = "elevation" | "outlined";
81
+ export type PositionVariant =
82
+ | "left"
83
+ | "right"
84
+ | "alternate"
85
+ | "alternate-reverse";
78
86
 
79
87
  export type MuiTextFieldBaseProps = Omit<
80
88
  MuiTextFieldProps,
@@ -124,7 +132,10 @@ export type MuiCardBaseProps = Omit<MuiCardProps, "sx">;
124
132
  export type MuiDropDownBaseProps = Omit<MuiDropDownProps, "sx" | "variant">;
125
133
  export type MuiTagBaseProps = Omit<MuiChipProps, "sx" | "color">;
126
134
  export type MuiRangerSliderBaseProps = Omit<MuiSliderProps, "sx" | "color">;
127
- export type MuiProgressBarBaseProps = Omit<MuiLinearProgressProps, "sx">;
135
+ export type MuiProgressBarBaseProps = Omit<
136
+ MuiLinearProgressProps,
137
+ "sx" | "ref"
138
+ >;
128
139
  export type MuiTabsBaseProps = Omit<
129
140
  MuiTabsProps,
130
141
  "sx" | "children" | "onChange" | "variant" | "value"
@@ -142,11 +153,18 @@ export type MuiPaperBaseProps = Omit<MuiPaperProps, "sx">;
142
153
 
143
154
  export type MuiDatePickerBaseProps = Omit<MuiTextFieldProps, "sx">;
144
155
 
156
+ export type MuiDataGridBaseProps = Omit<MuiTableProps, "sx">;
157
+
145
158
  export type MuiAvatarBaseProps = Omit<
146
159
  MuiAvatarProps,
147
160
  "sx" | "src" | "children" | "variant" | "sizes"
148
161
  >;
149
162
 
163
+ export type MuiTimeLineBaseProps = Omit<
164
+ MuiTimeLineProps,
165
+ "sx" | "position" | "children" | "ref"
166
+ >;
167
+
150
168
  export type MuiBadgeBaseProps = Omit<
151
169
  MuiBadgeProps,
152
170
  | "sx"
@@ -231,6 +249,13 @@ export type DataSelect = {
231
249
  value: string | number;
232
250
  };
233
251
 
252
+ export type DataTimeLine = {
253
+ id?: string;
254
+ title: string;
255
+ data: string;
256
+ by: string;
257
+ };
258
+
234
259
  export type RenderProps<E extends HTMLElement = HTMLElement> = {
235
260
  focusRef?: React.MutableRefObject<E | null>;
236
261
  id?: string;