norma-library 0.4.6 → 0.4.8
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/dist/esm/components/Avatar.d.ts +3 -0
- package/dist/esm/components/Avatar.js +17 -0
- package/dist/esm/components/Avatar.js.map +1 -0
- package/dist/esm/components/Badge.d.ts +3 -0
- package/dist/esm/components/Badge.js +14 -0
- package/dist/esm/components/Badge.js.map +1 -0
- package/dist/esm/components/ChatMessage.d.ts +3 -0
- package/dist/esm/components/ChatMessage.js +63 -0
- package/dist/esm/components/ChatMessage.js.map +1 -0
- package/dist/esm/components/DatePicker.d.ts +6 -0
- package/dist/esm/components/DatePicker.js +58 -0
- package/dist/esm/components/DatePicker.js.map +1 -0
- package/dist/esm/components/Icons.js +1 -1
- package/dist/esm/components/ProgressBar.d.ts +0 -3
- package/dist/esm/components/ProgressBar.js +1 -1
- package/dist/esm/components/ProgressBar.js.map +1 -1
- package/dist/esm/components/TimeLine.d.ts +3 -0
- package/dist/esm/components/TimeLine.js +59 -0
- package/dist/esm/components/TimeLine.js.map +1 -0
- package/dist/esm/components/TimePicker.d.ts +9 -0
- package/dist/esm/components/TimePicker.js +66 -0
- package/dist/esm/components/TimePicker.js.map +1 -0
- package/dist/esm/components/index.d.ts +6 -0
- package/dist/esm/components/index.js +6 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/helpers/colors.d.ts +3 -1
- package/dist/esm/helpers/colors.js +39 -10
- package/dist/esm/helpers/colors.js.map +1 -1
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interfaces/Avatar.d.ts +12 -0
- package/dist/esm/interfaces/Avatar.js +2 -0
- package/dist/esm/interfaces/Avatar.js.map +1 -0
- package/dist/esm/interfaces/Badge.d.ts +14 -0
- package/dist/esm/interfaces/Badge.js +2 -0
- package/dist/esm/interfaces/Badge.js.map +1 -0
- package/dist/esm/interfaces/ChatMessage.d.ts +12 -0
- package/dist/esm/interfaces/ChatMessage.js +2 -0
- package/dist/esm/interfaces/ChatMessage.js.map +1 -0
- package/dist/esm/interfaces/DatePicker.d.ts +12 -0
- package/dist/esm/interfaces/DatePicker.js +2 -0
- package/dist/esm/interfaces/DatePicker.js.map +1 -0
- package/dist/esm/interfaces/TimeLine.d.ts +11 -0
- package/dist/esm/interfaces/TimeLine.js +2 -0
- package/dist/esm/interfaces/TimeLine.js.map +1 -0
- package/dist/esm/interfaces/TimePicker.d.ts +12 -0
- package/dist/esm/interfaces/TimePicker.js +2 -0
- package/dist/esm/interfaces/TimePicker.js.map +1 -0
- package/dist/esm/interfaces/index.d.ts +6 -1
- package/dist/esm/interfaces/index.js +6 -1
- package/dist/esm/interfaces/index.js.map +1 -1
- package/dist/esm/types/index.d.ts +15 -2
- package/dist/esm/types/index.js.map +1 -1
- package/norma-library.tar +0 -0
- package/package.json +4 -1
- package/src/components/Avatar.tsx +29 -0
- package/src/components/Badge.tsx +22 -0
- package/src/components/ChatMessage.tsx +89 -0
- package/src/components/DatePicker.tsx +84 -0
- package/src/components/Icons.tsx +1 -1
- package/src/components/ProgressBar.tsx +2 -1
- package/src/components/TimeLine.tsx +103 -0
- package/src/components/TimePicker.tsx +95 -0
- package/src/components/index.ts +6 -0
- package/src/helpers/colors.ts +44 -10
- package/src/index.ts +2 -0
- package/src/interfaces/Avatar.tsx +18 -0
- package/src/interfaces/Badge.ts +32 -0
- package/src/interfaces/ChatMessage.ts +12 -0
- package/src/interfaces/DatePicker.ts +13 -0
- package/src/interfaces/TimeLine.ts +16 -0
- package/src/interfaces/TimePicker.ts +13 -0
- package/src/interfaces/index.ts +6 -1
- package/src/stories/Avatar.stories.tsx +139 -0
- package/src/stories/Badge.stories.tsx +47 -0
- package/src/stories/ChatMessage.stories.tsx +85 -0
- package/src/stories/DatePicker.stories.tsx +77 -0
- package/src/stories/Tag.stories.tsx +2 -4
- package/src/stories/TimeLine.stories.tsx +43 -0
- package/src/stories/TimePicker.stories.tsx +113 -0
- package/src/types/index.ts +44 -1
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import { ThemeProvider, useMediaQuery } from "@mui/material";
|
|
3
|
+
import { DemoContainer } from "@mui/x-date-pickers/internals/demo";
|
|
4
|
+
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
|
|
5
|
+
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
|
|
6
|
+
import { TimePicker as MuiTimePicker } from "@mui/x-date-pickers/TimePicker";
|
|
7
|
+
import { MobileTimePicker as MuiMobileTimePicker } from "@mui/x-date-pickers/MobileTimePicker";
|
|
8
|
+
import { DesktopTimePicker as MuiDesktopTimePicker } from "@mui/x-date-pickers/DesktopTimePicker";
|
|
9
|
+
import { themes } from "../helpers";
|
|
10
|
+
import { styled } from "@mui/material/styles";
|
|
11
|
+
|
|
12
|
+
import "dayjs/locale/pt-br";
|
|
13
|
+
import "dayjs/locale/en";
|
|
14
|
+
import "dayjs/locale/es";
|
|
15
|
+
|
|
16
|
+
import dayjs from "dayjs";
|
|
17
|
+
import utc from "dayjs/plugin/utc";
|
|
18
|
+
import timezone from "dayjs/plugin/timezone";
|
|
19
|
+
|
|
20
|
+
import "dayjs/locale/pt-br";
|
|
21
|
+
import "dayjs/locale/en";
|
|
22
|
+
import "dayjs/locale/es";
|
|
23
|
+
import { TimePickerBaseProps } from "@/interfaces/TimePicker";
|
|
24
|
+
|
|
25
|
+
dayjs.extend(utc);
|
|
26
|
+
dayjs.extend(timezone);
|
|
27
|
+
|
|
28
|
+
const MuiTimePickerStyled = styled(MuiTimePicker)({
|
|
29
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
|
30
|
+
border: "none",
|
|
31
|
+
borderRadius: 0,
|
|
32
|
+
borderBottom: "1px solid #666666",
|
|
33
|
+
},
|
|
34
|
+
"& .MuiFormLabel-root": {
|
|
35
|
+
backgroundColor: "#fff",
|
|
36
|
+
padding: "0 5px",
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const MuiMobileTimePickerStyled = styled(MuiMobileTimePicker)({
|
|
41
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
|
42
|
+
border: "none",
|
|
43
|
+
borderRadius: 0,
|
|
44
|
+
borderBottom: "1px solid #666666",
|
|
45
|
+
},
|
|
46
|
+
"& .MuiFormLabel-root": {
|
|
47
|
+
backgroundColor: "#fff",
|
|
48
|
+
padding: "0 5px",
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const MuiDesktopTimePickerStyled = styled(MuiDesktopTimePicker)({
|
|
53
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
|
54
|
+
border: "none",
|
|
55
|
+
borderRadius: 0,
|
|
56
|
+
borderBottom: "1px solid #666666",
|
|
57
|
+
},
|
|
58
|
+
"& .MuiFormLabel-root": {
|
|
59
|
+
backgroundColor: "#fff",
|
|
60
|
+
padding: "0 5px",
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export const TimePicker = ({
|
|
65
|
+
label,
|
|
66
|
+
timezone = "America/Sao_Paulo",
|
|
67
|
+
language = "pt-br",
|
|
68
|
+
variant = "desktop",
|
|
69
|
+
}: TimePickerBaseProps) => {
|
|
70
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
71
|
+
const theme = useMemo(
|
|
72
|
+
() => (prefersDarkMode ? themes.light : themes.dark),
|
|
73
|
+
[prefersDarkMode]
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<ThemeProvider theme={theme}>
|
|
78
|
+
<LocalizationProvider dateAdapter={AdapterDayjs} adapterLocale={language}>
|
|
79
|
+
<DemoContainer
|
|
80
|
+
components={["TimePicker", "MobileTimePicker", "DesktopTimePicker"]}
|
|
81
|
+
>
|
|
82
|
+
{variant === "responsive" && (
|
|
83
|
+
<MuiTimePickerStyled label={label} timezone={timezone} />
|
|
84
|
+
)}
|
|
85
|
+
{variant === "mobile" && (
|
|
86
|
+
<MuiMobileTimePickerStyled label={label} timezone={timezone} />
|
|
87
|
+
)}
|
|
88
|
+
{variant === "desktop" && (
|
|
89
|
+
<MuiDesktopTimePickerStyled label={label} timezone={timezone} />
|
|
90
|
+
)}
|
|
91
|
+
</DemoContainer>
|
|
92
|
+
</LocalizationProvider>
|
|
93
|
+
</ThemeProvider>
|
|
94
|
+
);
|
|
95
|
+
};
|
package/src/components/index.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export * from "./Accordion";
|
|
2
|
+
export * from "./Avatar";
|
|
3
|
+
export * from "./Badge";
|
|
2
4
|
export * from "./Button";
|
|
3
5
|
export * from "./Card";
|
|
4
6
|
export * from "./CheckBox";
|
|
7
|
+
export * from "./DatePicker";
|
|
5
8
|
export * from "./DropDown";
|
|
6
9
|
export * from "./IconButton";
|
|
7
10
|
export * from "./Icons";
|
|
@@ -14,3 +17,6 @@ export * from "./Select";
|
|
|
14
17
|
export * from "./Tabs";
|
|
15
18
|
export * from "./Tag";
|
|
16
19
|
export * from "./TextField";
|
|
20
|
+
export * from "./TimeLine";
|
|
21
|
+
export * from "./TimePicker";
|
|
22
|
+
export * from "./ChatMessage";
|
package/src/helpers/colors.ts
CHANGED
|
@@ -2,20 +2,20 @@ import { createTheme } from "@mui/material/styles";
|
|
|
2
2
|
|
|
3
3
|
export const getPalette = () => {
|
|
4
4
|
return {
|
|
5
|
-
primary: "
|
|
5
|
+
primary: "rgb(219, 102, 25)",
|
|
6
6
|
primaryLight: "#FFDB9F",
|
|
7
7
|
primaryMedium: "#FFA84C",
|
|
8
8
|
primaryDark: "#B74608",
|
|
9
9
|
|
|
10
|
-
inherit: "
|
|
11
|
-
secondary: "
|
|
12
|
-
error: "
|
|
13
|
-
warning: "
|
|
14
|
-
info: "
|
|
15
|
-
success: "
|
|
10
|
+
inherit: "rgb(102, 102, 102)",
|
|
11
|
+
secondary: "rgb(67, 187, 242)",
|
|
12
|
+
error: "rgb(214, 54, 67)",
|
|
13
|
+
warning: "rgb(255, 195, 0)",
|
|
14
|
+
info: "rgb(113, 213, 247)",
|
|
15
|
+
success: "rgb(107, 194, 53)",
|
|
16
16
|
white: "#ffffff",
|
|
17
|
-
black: "
|
|
18
|
-
helper: "
|
|
17
|
+
black: "rgb(0, 0, 0)",
|
|
18
|
+
helper: "rgb(90, 42, 121)",
|
|
19
19
|
secondaryLight: "#D9FCFE",
|
|
20
20
|
secondaryMedium: "#71D5F7",
|
|
21
21
|
secondaryDark: "#154F8C",
|
|
@@ -170,4 +170,38 @@ const getColor = (key: PaletteKey) => {
|
|
|
170
170
|
}
|
|
171
171
|
};
|
|
172
172
|
|
|
173
|
-
|
|
173
|
+
const extractRGB = (rgbString: string) => {
|
|
174
|
+
if (typeof rgbString === "string") {
|
|
175
|
+
const match = rgbString.match(/\((\d+), (\d+), (\d+)\)/);
|
|
176
|
+
|
|
177
|
+
if (match) {
|
|
178
|
+
const r = match[1];
|
|
179
|
+
const g = match[2];
|
|
180
|
+
const b = match[3];
|
|
181
|
+
return `${r},${g},${b}`;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return null;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
const lightenRGB = (rgbString: string, amount = 20) => {
|
|
188
|
+
console.log("RGB ==> ", rgbString);
|
|
189
|
+
if (typeof rgbString === "string") {
|
|
190
|
+
const match = rgbString.match(/\((\d+), (\d+), (\d+)\)/);
|
|
191
|
+
|
|
192
|
+
if (match) {
|
|
193
|
+
const r = parseInt(match[1]);
|
|
194
|
+
const g = parseInt(match[2]);
|
|
195
|
+
const b = parseInt(match[3]);
|
|
196
|
+
|
|
197
|
+
const newR = Math.min(255, r + amount);
|
|
198
|
+
const newG = Math.min(255, g + amount);
|
|
199
|
+
const newB = Math.min(255, b + amount);
|
|
200
|
+
|
|
201
|
+
return `rgb(${newR},${newG},${newB})`;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return null;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
export { getColor, extractRGB, lightenRGB };
|
package/src/index.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { Select } from "./components/Select";
|
|
|
13
13
|
import { Tabs } from "./components/Tabs";
|
|
14
14
|
import { Tag } from "./components/Tag";
|
|
15
15
|
import { TextField } from "./components/TextField";
|
|
16
|
+
import { DatePicker } from "./components/DatePicker";
|
|
16
17
|
import { themes, getPalette } from "./helpers";
|
|
17
18
|
|
|
18
19
|
export {
|
|
@@ -20,6 +21,7 @@ export {
|
|
|
20
21
|
Button,
|
|
21
22
|
Card,
|
|
22
23
|
CheckBox,
|
|
24
|
+
DatePicker,
|
|
23
25
|
getPalette,
|
|
24
26
|
IconButton,
|
|
25
27
|
Icons,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { Theme } from "@emotion/react";
|
|
3
|
+
|
|
4
|
+
import { AvatarPropsVariantOverrides, SxProps } from "@mui/material";
|
|
5
|
+
|
|
6
|
+
import { MuiAvatarBaseProps } from "../types";
|
|
7
|
+
import { OverridableStringUnion } from "@mui/types";
|
|
8
|
+
|
|
9
|
+
export interface AvatarBaseProps extends MuiAvatarBaseProps {
|
|
10
|
+
sx?: SxProps<Theme>;
|
|
11
|
+
src?: string;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
variant?: OverridableStringUnion<
|
|
14
|
+
"circular" | "rounded" | "square",
|
|
15
|
+
AvatarPropsVariantOverrides
|
|
16
|
+
>;
|
|
17
|
+
sizes?: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { Theme } from "@emotion/react";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
BadgePropsColorOverrides,
|
|
6
|
+
BadgePropsVariantOverrides,
|
|
7
|
+
SxProps,
|
|
8
|
+
} from "@mui/material";
|
|
9
|
+
import { MuiBadgeBaseProps } from "@/types";
|
|
10
|
+
import { OverridableStringUnion } from "@mui/types";
|
|
11
|
+
|
|
12
|
+
export interface BadgeBaseProps extends MuiBadgeBaseProps {
|
|
13
|
+
sx?: SxProps<Theme>;
|
|
14
|
+
className?: string;
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
badgeContent?: ReactNode;
|
|
17
|
+
invisible?: boolean;
|
|
18
|
+
color?: OverridableStringUnion<
|
|
19
|
+
| "primary"
|
|
20
|
+
| "secondary"
|
|
21
|
+
| "default"
|
|
22
|
+
| "error"
|
|
23
|
+
| "info"
|
|
24
|
+
| "success"
|
|
25
|
+
| "warning",
|
|
26
|
+
BadgePropsColorOverrides
|
|
27
|
+
>;
|
|
28
|
+
variant?: OverridableStringUnion<
|
|
29
|
+
"standard" | "dot",
|
|
30
|
+
BadgePropsVariantOverrides
|
|
31
|
+
>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SxProps } from "@mui/material";
|
|
2
|
+
import { Theme } from "@emotion/react";
|
|
3
|
+
|
|
4
|
+
import { DatePickVariant } from "../types";
|
|
5
|
+
|
|
6
|
+
export interface DatePickerBaseProps {
|
|
7
|
+
sx?: SxProps<Theme>;
|
|
8
|
+
label?: string;
|
|
9
|
+
format?: string;
|
|
10
|
+
language?: string;
|
|
11
|
+
onChange?: React.ChangeEvent<HTMLInputElement>;
|
|
12
|
+
variant?: DatePickVariant;
|
|
13
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SxProps } from "@mui/material";
|
|
2
|
+
import { Theme } from "@emotion/react";
|
|
3
|
+
|
|
4
|
+
import { DatePickVariant } from "../types";
|
|
5
|
+
|
|
6
|
+
export interface TimePickerBaseProps {
|
|
7
|
+
sx?: SxProps<Theme>;
|
|
8
|
+
label?: string;
|
|
9
|
+
timezone?: string;
|
|
10
|
+
language?: string;
|
|
11
|
+
onChange?: React.ChangeEvent<HTMLInputElement>;
|
|
12
|
+
variant?: DatePickVariant;
|
|
13
|
+
}
|
package/src/interfaces/index.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export * from "./Accordion";
|
|
2
|
+
export * from "./Avatar";
|
|
3
|
+
export * from "./Badge";
|
|
2
4
|
export * from "./Button";
|
|
3
5
|
export * from "./Card";
|
|
4
6
|
export * from "./CheckBox";
|
|
7
|
+
export * from "./DatePicker";
|
|
5
8
|
export * from "./DropDown";
|
|
6
9
|
export * from "./IconButton";
|
|
7
10
|
export * from "./Icons";
|
|
@@ -9,9 +12,11 @@ export * from "./Modal";
|
|
|
9
12
|
export * from "./Paper";
|
|
10
13
|
export * from "./ProgressBar";
|
|
11
14
|
export * from "./RadioGroup";
|
|
12
|
-
export * from "./RadioGroup";
|
|
13
15
|
export * from "./RangerSlider";
|
|
14
16
|
export * from "./Select";
|
|
15
17
|
export * from "./Tabs";
|
|
16
18
|
export * from "./Tag";
|
|
17
19
|
export * from "./TextField";
|
|
20
|
+
export * from "./TimeLine";
|
|
21
|
+
export * from "./TimePicker";
|
|
22
|
+
export * from "./ChatMessage";
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import React from "react";
|
|
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";
|
|
7
|
+
|
|
8
|
+
const meta = {
|
|
9
|
+
title: "Display/Avatar",
|
|
10
|
+
component: Avatar,
|
|
11
|
+
parameters: {
|
|
12
|
+
layout: "centered",
|
|
13
|
+
},
|
|
14
|
+
tags: ["autodocs"],
|
|
15
|
+
argTypes: {},
|
|
16
|
+
} satisfies Meta<typeof Avatar>;
|
|
17
|
+
|
|
18
|
+
export default meta;
|
|
19
|
+
|
|
20
|
+
function stringToColor(string: string) {
|
|
21
|
+
let hash = 0;
|
|
22
|
+
let i;
|
|
23
|
+
|
|
24
|
+
/* eslint-disable no-bitwise */
|
|
25
|
+
for (i = 0; i < string.length; i += 1) {
|
|
26
|
+
hash = string.charCodeAt(i) + ((hash << 5) - hash);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let color = "#";
|
|
30
|
+
|
|
31
|
+
for (i = 0; i < 3; i += 1) {
|
|
32
|
+
const value = (hash >> (i * 8)) & 0xff;
|
|
33
|
+
color += `00${value.toString(16)}`.slice(-2);
|
|
34
|
+
}
|
|
35
|
+
/* eslint-enable no-bitwise */
|
|
36
|
+
|
|
37
|
+
return color;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function stringAvatar(name: string) {
|
|
41
|
+
return {
|
|
42
|
+
sx: {
|
|
43
|
+
bgcolor: stringToColor(name),
|
|
44
|
+
},
|
|
45
|
+
children: `${name.split(" ")[0][0]}${name.split(" ")[1][0]}`,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const AvatarBasic = () => {
|
|
50
|
+
return (
|
|
51
|
+
<>
|
|
52
|
+
<Avatar src="https://mui.com/static/images/avatar/2.jpg" />
|
|
53
|
+
</>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const AvatarVariants = () => {
|
|
58
|
+
return (
|
|
59
|
+
<Stack direction="row" spacing={2}>
|
|
60
|
+
<Avatar
|
|
61
|
+
src="https://mui.com/static/images/avatar/1.jpg"
|
|
62
|
+
variant="square"
|
|
63
|
+
/>
|
|
64
|
+
<Avatar
|
|
65
|
+
src="https://mui.com/static/images/avatar/2.jpg"
|
|
66
|
+
variant="rounded"
|
|
67
|
+
/>
|
|
68
|
+
<Avatar src="https://mui.com/static/images/avatar/3.jpg" />
|
|
69
|
+
</Stack>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const AvatarLetters = () => {
|
|
74
|
+
return (
|
|
75
|
+
<>
|
|
76
|
+
<Stack direction="row" spacing={2}>
|
|
77
|
+
<Avatar {...stringAvatar("Kent Dodds")} />
|
|
78
|
+
<Avatar {...stringAvatar("Jed Watson")} />
|
|
79
|
+
<Avatar {...stringAvatar("Tim Neutkens")} />
|
|
80
|
+
</Stack>
|
|
81
|
+
</>
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const AvatarSizes = () => {
|
|
86
|
+
return (
|
|
87
|
+
<>
|
|
88
|
+
<Stack direction="row" spacing={2}>
|
|
89
|
+
<Avatar
|
|
90
|
+
src="https://mui.com/static/images/avatar/1.jpg"
|
|
91
|
+
variant="square"
|
|
92
|
+
sx={{ width: 24, height: 24 }}
|
|
93
|
+
/>
|
|
94
|
+
<Avatar
|
|
95
|
+
src="https://mui.com/static/images/avatar/2.jpg"
|
|
96
|
+
variant="rounded"
|
|
97
|
+
/>
|
|
98
|
+
<Avatar
|
|
99
|
+
src="https://mui.com/static/images/avatar/3.jpg"
|
|
100
|
+
sx={{ width: 56, height: 56 }}
|
|
101
|
+
/>
|
|
102
|
+
</Stack>
|
|
103
|
+
</>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export const AvatarWidthIcons = () => {
|
|
108
|
+
return (
|
|
109
|
+
<>
|
|
110
|
+
<Stack direction="row" spacing={2}>
|
|
111
|
+
<Avatar>
|
|
112
|
+
<Icons icon="user" color="white" />
|
|
113
|
+
</Avatar>
|
|
114
|
+
<Avatar sx={{ bgcolor: pink[500] }}>
|
|
115
|
+
<Icons icon="starOutlined" color="white" />
|
|
116
|
+
</Avatar>
|
|
117
|
+
<Avatar sx={{ bgcolor: green[500] }}>
|
|
118
|
+
<Icons icon="chartBar" color="white" />
|
|
119
|
+
</Avatar>
|
|
120
|
+
</Stack>
|
|
121
|
+
</>
|
|
122
|
+
);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export const AvatarGrouped = () => {
|
|
126
|
+
return (
|
|
127
|
+
<>
|
|
128
|
+
<Stack direction="row" spacing={2}>
|
|
129
|
+
<AvatarGroup max={4}>
|
|
130
|
+
<Avatar src="https://mui.com/static/images/avatar/1.jpg" />
|
|
131
|
+
<Avatar src="https://mui.com/static/images/avatar/2.jpg" />
|
|
132
|
+
<Avatar src="https://mui.com/static/images/avatar/3.jpg" />
|
|
133
|
+
<Avatar src="https://mui.com/static/images/avatar/4.jpg" />
|
|
134
|
+
<Avatar src="https://mui.com/static/images/avatar/5.jpg" />
|
|
135
|
+
</AvatarGroup>
|
|
136
|
+
</Stack>
|
|
137
|
+
</>
|
|
138
|
+
);
|
|
139
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import type { Meta } from "@storybook/react";
|
|
4
|
+
import { Avatar, Badge, Icons } from "../components";
|
|
5
|
+
import { AvatarGroup, Stack } from "@mui/material";
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: "Display/Badge",
|
|
9
|
+
component: Badge,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: "centered",
|
|
12
|
+
},
|
|
13
|
+
tags: ["autodocs"],
|
|
14
|
+
argTypes: {},
|
|
15
|
+
} satisfies Meta<typeof Badge>;
|
|
16
|
+
|
|
17
|
+
export default meta;
|
|
18
|
+
|
|
19
|
+
export const BadgeBasic = () => {
|
|
20
|
+
return (
|
|
21
|
+
<>
|
|
22
|
+
<Badge badgeContent={4} color="primary">
|
|
23
|
+
<Icons icon="user" />
|
|
24
|
+
</Badge>
|
|
25
|
+
</>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const BadgeColors = () => {
|
|
30
|
+
return (
|
|
31
|
+
<Stack direction="row" spacing={2}>
|
|
32
|
+
{[
|
|
33
|
+
"primary",
|
|
34
|
+
"secondary",
|
|
35
|
+
"default",
|
|
36
|
+
"error",
|
|
37
|
+
"info",
|
|
38
|
+
"success",
|
|
39
|
+
"warning",
|
|
40
|
+
].map((color, key) => (
|
|
41
|
+
<Badge badgeContent={4} color={color} key={key}>
|
|
42
|
+
<Icons icon="user" />
|
|
43
|
+
</Badge>
|
|
44
|
+
))}
|
|
45
|
+
</Stack>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
@@ -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,77 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DatePicker } from "../components";
|
|
3
|
+
import type { Meta } from "@storybook/react";
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: "Form/DatePicker",
|
|
7
|
+
component: DatePicker,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: "centered",
|
|
10
|
+
},
|
|
11
|
+
tags: ["autodocs"],
|
|
12
|
+
argTypes: {},
|
|
13
|
+
} satisfies Meta<typeof DatePicker>;
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
|
|
17
|
+
export const BasicDatePicker = () => (
|
|
18
|
+
<DatePicker sx={{ minWidth: 275 }} label="DatePicker" />
|
|
19
|
+
);
|
|
20
|
+
BasicDatePicker.storyName = "DatePicker Basic";
|
|
21
|
+
|
|
22
|
+
export const DatePickerVariants = () => (
|
|
23
|
+
<>
|
|
24
|
+
<div style={{ width: "480px", marginBottom: 30 }}>
|
|
25
|
+
<DatePicker
|
|
26
|
+
sx={{ minWidth: 275 }}
|
|
27
|
+
label="DatePicker Responsive"
|
|
28
|
+
variant="responsive"
|
|
29
|
+
/>
|
|
30
|
+
</div>
|
|
31
|
+
<div style={{ width: "480px", marginBottom: 30 }}>
|
|
32
|
+
<DatePicker
|
|
33
|
+
sx={{ minWidth: 275 }}
|
|
34
|
+
label="DatePicker Mobile"
|
|
35
|
+
variant="mobile"
|
|
36
|
+
/>
|
|
37
|
+
</div>
|
|
38
|
+
<div style={{ width: "480px", marginBottom: 30 }}>
|
|
39
|
+
<DatePicker
|
|
40
|
+
sx={{ minWidth: 275 }}
|
|
41
|
+
label="DatePicker Desktop"
|
|
42
|
+
variant="desktop"
|
|
43
|
+
/>
|
|
44
|
+
</div>
|
|
45
|
+
</>
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
DatePickerVariants.storyName = "DatePicker Variants";
|
|
49
|
+
|
|
50
|
+
export const DatePickerLanguage = () => (
|
|
51
|
+
<>
|
|
52
|
+
<div style={{ width: "480px", marginBottom: 30 }}>
|
|
53
|
+
<DatePicker
|
|
54
|
+
sx={{ minWidth: 275 }}
|
|
55
|
+
label="DatePicker Brazil"
|
|
56
|
+
language="pt-br"
|
|
57
|
+
/>
|
|
58
|
+
</div>
|
|
59
|
+
<div style={{ width: "480px", marginBottom: 30 }}>
|
|
60
|
+
<DatePicker
|
|
61
|
+
sx={{ minWidth: 275 }}
|
|
62
|
+
label="DatePicker English"
|
|
63
|
+
language="en"
|
|
64
|
+
format="YYYY-MM-DD"
|
|
65
|
+
/>
|
|
66
|
+
</div>
|
|
67
|
+
<div style={{ width: "480px", marginBottom: 30 }}>
|
|
68
|
+
<DatePicker
|
|
69
|
+
sx={{ minWidth: 275 }}
|
|
70
|
+
label="DatePicker Spain"
|
|
71
|
+
language="es"
|
|
72
|
+
/>
|
|
73
|
+
</div>
|
|
74
|
+
</>
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
DatePickerLanguage.storyName = "DatePicker Languages";
|