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 @@
|
|
|
1
|
+
{"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../../src/interfaces/Badge.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface ChatProps {
|
|
3
|
+
name: string;
|
|
4
|
+
message: string;
|
|
5
|
+
emotion?: React.ReactNode;
|
|
6
|
+
emotionReplay?: React.ReactNode;
|
|
7
|
+
time: string;
|
|
8
|
+
send: "me" | "replay";
|
|
9
|
+
}
|
|
10
|
+
export interface ChatMessageProps {
|
|
11
|
+
data: ChatProps[];
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatMessage.js","sourceRoot":"","sources":["../../../src/interfaces/ChatMessage.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SxProps } from "@mui/material";
|
|
3
|
+
import { Theme } from "@emotion/react";
|
|
4
|
+
import { DatePickVariant } from "../types";
|
|
5
|
+
export interface DatePickerBaseProps {
|
|
6
|
+
sx?: SxProps<Theme>;
|
|
7
|
+
label?: string;
|
|
8
|
+
format?: string;
|
|
9
|
+
language?: string;
|
|
10
|
+
onChange?: React.ChangeEvent<HTMLInputElement>;
|
|
11
|
+
variant?: DatePickVariant;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../../src/interfaces/DatePicker.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SxProps } from "@mui/material";
|
|
3
|
+
import { Theme } from "@emotion/react";
|
|
4
|
+
import { ColorVariant, DataTimeLine, MuiTimeLineBaseProps, PositionVariant } from "../types";
|
|
5
|
+
export interface TimeLineBaseProps extends MuiTimeLineBaseProps {
|
|
6
|
+
position?: PositionVariant;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
sx?: SxProps<Theme>;
|
|
9
|
+
color: ColorVariant;
|
|
10
|
+
data: DataTimeLine[];
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimeLine.js","sourceRoot":"","sources":["../../../src/interfaces/TimeLine.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SxProps } from "@mui/material";
|
|
3
|
+
import { Theme } from "@emotion/react";
|
|
4
|
+
import { DatePickVariant } from "../types";
|
|
5
|
+
export interface TimePickerBaseProps {
|
|
6
|
+
sx?: SxProps<Theme>;
|
|
7
|
+
label?: string;
|
|
8
|
+
timezone?: string;
|
|
9
|
+
language?: string;
|
|
10
|
+
onChange?: React.ChangeEvent<HTMLInputElement>;
|
|
11
|
+
variant?: DatePickVariant;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimePicker.js","sourceRoot":"","sources":["../../../src/interfaces/TimePicker.ts"],"names":[],"mappings":""}
|
|
@@ -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";
|
|
@@ -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,10 +12,12 @@ 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";
|
|
18
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ButtonProps as MuiButtonProps, IconButtonProps as MuiIconButtonProps, TextFieldProps as MuiTextFieldProps, CheckboxProps as MuiCheckBoxProps, MenuProps as MuiDropDownProps, ChipProps as MuiChipProps, LinearProgressProps as MuiLinearProgressProps, SliderProps as MuiSliderProps, AccordionProps as MuiAccordionProps, TabsProps as MuiTabsProps, SelectProps as MuiSelectProps, PaperProps as MuiPaperProps, SvgIconProps, ModalProps, CardProps as MuiCardProps } from "@mui/material";
|
|
2
|
+
import { AvatarProps as MuiAvatarProps, ButtonProps as MuiButtonProps, BadgeProps as MuiBadgeProps, IconButtonProps as MuiIconButtonProps, TextFieldProps as MuiTextFieldProps, CheckboxProps as MuiCheckBoxProps, MenuProps as MuiDropDownProps, ChipProps as MuiChipProps, LinearProgressProps as MuiLinearProgressProps, SliderProps as MuiSliderProps, AccordionProps as MuiAccordionProps, TabsProps as MuiTabsProps, SelectProps as MuiSelectProps, PaperProps as MuiPaperProps, SvgIconProps, ModalProps, CardProps as MuiCardProps } from "@mui/material";
|
|
3
|
+
import { TimelineProps as MuiTimeLineProps } from "@mui/lab";
|
|
3
4
|
import { SwitchBaseProps as MuiSwitchBaseProps } from "@mui/material/internal/SwitchBase";
|
|
4
5
|
import { iconsSVG } from "../components/Svgs";
|
|
5
6
|
export type ColorVariant = "inherit" | "primary" | "secondary" | "success" | "error" | "info" | "warning";
|
|
@@ -10,6 +11,7 @@ export type ButtonVariant = "text" | "outlined" | "contained";
|
|
|
10
11
|
export type DropVariant = "menu" | "selectedMenu";
|
|
11
12
|
export type TagVariant = "outlined" | "contained";
|
|
12
13
|
export type TabsVariant = "standard" | "scrollable" | "fullWidth";
|
|
14
|
+
export type DatePickVariant = "responsive" | "desktop" | "mobile";
|
|
13
15
|
export type ProgressVariant = "determinate" | "indeterminate" | "buffer" | "query";
|
|
14
16
|
export type MuiButtonBaseProps = Omit<MuiButtonProps, "sx" | "color" | "size" | "variant">;
|
|
15
17
|
export type MuiIconButtonBaseProps = Omit<MuiIconButtonProps, "sx" | "color" | "size" | "variant">;
|
|
@@ -18,6 +20,7 @@ export type TextFieldVariant = "standard" | "outlined" | "filled";
|
|
|
18
20
|
export type TextFieldSizeVariant = "small" | "medium";
|
|
19
21
|
export type DirectionVariant = "vertical" | "horizontal";
|
|
20
22
|
export type PaperVariant = "elevation" | "outlined";
|
|
23
|
+
export type PositionVariant = "left" | "right" | "alternate" | "alternate-reverse";
|
|
21
24
|
export type MuiTextFieldBaseProps = Omit<MuiTextFieldProps, "onChange" | "onBlur" | "onFocus" | "defaultValue" | "size" | "value" | "id" | "fullWidth" | "helperText" | "type" | "InputProps" | "InputLabelProps" | "autoComplete" | "label" | "helperText" | "InputLabelProps" | "margin" | "maxRows" | "minRows" | "multiline" | "name" | "placeholder" | "rows" | "select" | "SelectProps" | "sx" | "autoFocus" | "error" | "classes" | "children" | "color" | "variant">;
|
|
22
25
|
export interface CheckboxPropsSizeOverrides {
|
|
23
26
|
}
|
|
@@ -29,11 +32,15 @@ export type MuiCardBaseProps = Omit<MuiCardProps, "sx">;
|
|
|
29
32
|
export type MuiDropDownBaseProps = Omit<MuiDropDownProps, "sx" | "variant">;
|
|
30
33
|
export type MuiTagBaseProps = Omit<MuiChipProps, "sx" | "color">;
|
|
31
34
|
export type MuiRangerSliderBaseProps = Omit<MuiSliderProps, "sx" | "color">;
|
|
32
|
-
export type MuiProgressBarBaseProps = Omit<MuiLinearProgressProps, "sx">;
|
|
35
|
+
export type MuiProgressBarBaseProps = Omit<MuiLinearProgressProps, "sx" | "ref">;
|
|
33
36
|
export type MuiTabsBaseProps = Omit<MuiTabsProps, "sx" | "children" | "onChange" | "variant" | "value">;
|
|
34
37
|
export type MuiAccordionBaseProps = Omit<MuiAccordionProps, "sx" | "children" | "defaultExpanded" | "onChange">;
|
|
35
38
|
export type MuiSelectBaseProps = Omit<MuiSelectProps, "sx" | "value" | "onClose" | "onOpen" | "input" | "label">;
|
|
36
39
|
export type MuiPaperBaseProps = Omit<MuiPaperProps, "sx">;
|
|
40
|
+
export type MuiDatePickerBaseProps = Omit<MuiTextFieldProps, "sx">;
|
|
41
|
+
export type MuiAvatarBaseProps = Omit<MuiAvatarProps, "sx" | "src" | "children" | "variant" | "sizes">;
|
|
42
|
+
export type MuiTimeLineBaseProps = Omit<MuiTimeLineProps, "sx" | "position" | "children" | "ref">;
|
|
43
|
+
export type MuiBadgeBaseProps = Omit<MuiBadgeProps, "sx" | "color" | "children" | "invisible" | "variant" | "className" | "badgeContent">;
|
|
37
44
|
export type IconScale = "xsmall" | "small" | "medium" | "large" | "xlarge" | "2xlarge" | "3xlarge";
|
|
38
45
|
export type IconColors = "inherit" | "primary" | "secondary" | "error" | "info" | "success" | "warning" | "white" | "black";
|
|
39
46
|
export declare const scaleSize: Record<IconScale, number>;
|
|
@@ -69,6 +76,12 @@ export type DataSelect = {
|
|
|
69
76
|
label: string;
|
|
70
77
|
value: string | number;
|
|
71
78
|
};
|
|
79
|
+
export type DataTimeLine = {
|
|
80
|
+
id?: string;
|
|
81
|
+
title: string;
|
|
82
|
+
data: string;
|
|
83
|
+
by: string;
|
|
84
|
+
};
|
|
72
85
|
export type RenderProps<E extends HTMLElement = HTMLElement> = {
|
|
73
86
|
focusRef?: React.MutableRefObject<E | null>;
|
|
74
87
|
id?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAmMA,MAAM,CAAC,IAAM,SAAS,GAA8B;IAClD,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;IACV,SAAS,EAAE,EAAE;IACb,SAAS,EAAE,EAAE;CACd,CAAC"}
|
package/norma-library.tar
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "norma-library",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Norma Library. A React UI kit.",
|
|
6
6
|
"scripts": {
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"@babel/preset-env": "^7.22.15",
|
|
19
19
|
"@babel/preset-react": "^7.22.15",
|
|
20
20
|
"@babel/preset-typescript": "^7.22.15",
|
|
21
|
+
"@mui/lab": "^5.0.0-alpha.145",
|
|
21
22
|
"@storybook/addon-essentials": "^7.5.0-alpha.1",
|
|
22
23
|
"@storybook/addon-interactions": "^7.5.0-alpha.1",
|
|
23
24
|
"@storybook/addon-links": "^7.5.0-alpha.1",
|
|
@@ -44,6 +45,8 @@
|
|
|
44
45
|
"@material-tailwind/react": "^2.1.1",
|
|
45
46
|
"@mui/icons-material": "^5.14.8",
|
|
46
47
|
"@mui/material": "^5.14.8",
|
|
48
|
+
"@mui/x-date-pickers": "^6.14.0",
|
|
49
|
+
"dayjs": "^1.11.9",
|
|
47
50
|
"react-i18next": "^13.2.2",
|
|
48
51
|
"react-scripts": "^5.0.1",
|
|
49
52
|
"tslib": "^2.6.2"
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
ThemeProvider,
|
|
5
|
+
useMediaQuery,
|
|
6
|
+
Avatar as MuiVatar,
|
|
7
|
+
} from "@mui/material";
|
|
8
|
+
|
|
9
|
+
import { AvatarBaseProps } from "../interfaces";
|
|
10
|
+
import { styled } from "@mui/material/styles";
|
|
11
|
+
import { themes } from "../helpers";
|
|
12
|
+
|
|
13
|
+
const AvatarStyled = styled(MuiVatar)({
|
|
14
|
+
textTransform: "none",
|
|
15
|
+
color: "currentcolor",
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const Avatar: React.FC<AvatarBaseProps> = ({ src, ...props }) => {
|
|
19
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
20
|
+
const theme = useMemo(
|
|
21
|
+
() => (prefersDarkMode ? themes.light : themes.dark),
|
|
22
|
+
[prefersDarkMode]
|
|
23
|
+
);
|
|
24
|
+
return (
|
|
25
|
+
<ThemeProvider theme={theme}>
|
|
26
|
+
<AvatarStyled src={src} {...props} />
|
|
27
|
+
</ThemeProvider>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
|
|
3
|
+
import { ThemeProvider, useMediaQuery, Badge as MuiBadge } from "@mui/material";
|
|
4
|
+
|
|
5
|
+
import { BadgeBaseProps } from "../interfaces";
|
|
6
|
+
import { styled } from "@mui/material/styles";
|
|
7
|
+
import { themes } from "../helpers";
|
|
8
|
+
|
|
9
|
+
const BadgeStyled = styled(MuiBadge)({});
|
|
10
|
+
|
|
11
|
+
export const Badge: React.FC<BadgeBaseProps> = ({ ...props }) => {
|
|
12
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
13
|
+
const theme = useMemo(
|
|
14
|
+
() => (prefersDarkMode ? themes.dark : themes.light),
|
|
15
|
+
[prefersDarkMode]
|
|
16
|
+
);
|
|
17
|
+
return (
|
|
18
|
+
<ThemeProvider theme={theme}>
|
|
19
|
+
<BadgeStyled {...props} />
|
|
20
|
+
</ThemeProvider>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Box, Typography } from "@mui/material";
|
|
3
|
+
import { styled } from "@mui/material/styles";
|
|
4
|
+
import { ChatMessageProps } from "@/interfaces";
|
|
5
|
+
|
|
6
|
+
const Item = styled(Box)<{
|
|
7
|
+
orient?: string;
|
|
8
|
+
}>(({ orient }) => ({
|
|
9
|
+
borderColor: "#ccc",
|
|
10
|
+
display: "flex",
|
|
11
|
+
position: "relative",
|
|
12
|
+
width: "100%",
|
|
13
|
+
justifyContent: orient === "replay" ? "flex-end" : "flex-start",
|
|
14
|
+
marginBottom: "10px",
|
|
15
|
+
alignItems: "center",
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
const ContainerStyled = styled(Box)({
|
|
19
|
+
display: "flex",
|
|
20
|
+
flexDirection: "column",
|
|
21
|
+
alignItems: "center",
|
|
22
|
+
minWidth: "640px",
|
|
23
|
+
backgroundColor: "#F0F0F0",
|
|
24
|
+
padding: "10px",
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const BoxStyled = styled(Box)<{
|
|
28
|
+
orient?: string;
|
|
29
|
+
}>(({ orient }) => ({
|
|
30
|
+
width: "70%",
|
|
31
|
+
backgroundColor: orient === "replay" ? "#E18B50" : "#FFF",
|
|
32
|
+
color: orient === "replay" ? "#FFF" : "#4D4F5C",
|
|
33
|
+
borderTopLeftRadius: 30,
|
|
34
|
+
borderTopRightRadius: 30,
|
|
35
|
+
borderBottomLeftRadius: orient === "me" ? 2 : 30,
|
|
36
|
+
borderBottomRightRadius: orient === "me" ? 30 : 2,
|
|
37
|
+
marginLeft: orient === "replay" ? "10px" : 0,
|
|
38
|
+
marginRight: orient === "me" ? "10px" : 0,
|
|
39
|
+
padding: 20,
|
|
40
|
+
}));
|
|
41
|
+
|
|
42
|
+
export const ChatMessage: React.FC<ChatMessageProps> = ({ data }) => {
|
|
43
|
+
return (
|
|
44
|
+
<ContainerStyled>
|
|
45
|
+
{data.map((item, key) => (
|
|
46
|
+
<Item key={key} orient={item.send}>
|
|
47
|
+
{item.emotion && item.send === "replay" && <>{item.emotion}</>}
|
|
48
|
+
<BoxStyled orient={item.send}>
|
|
49
|
+
<Typography
|
|
50
|
+
variant="subtitle2"
|
|
51
|
+
style={{
|
|
52
|
+
marginBottom: "5px",
|
|
53
|
+
font: "normal normal 600 16px/20px Source Sans Pro",
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
{item.name}
|
|
57
|
+
</Typography>
|
|
58
|
+
<Typography
|
|
59
|
+
variant="body1"
|
|
60
|
+
style={{
|
|
61
|
+
font: "normal normal normal 16px/20px Source Sans Pro",
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
{item.message}
|
|
65
|
+
</Typography>
|
|
66
|
+
<Typography
|
|
67
|
+
variant="caption"
|
|
68
|
+
style={{
|
|
69
|
+
position: "absolute",
|
|
70
|
+
bottom: "-18px",
|
|
71
|
+
left: item.send === "me" ? 0 : "auto",
|
|
72
|
+
right: item.send === "me" ? "auto" : 0,
|
|
73
|
+
font: "normal normal normal 11px/13px Source Sans Pro",
|
|
74
|
+
opacity: 0.5,
|
|
75
|
+
color: "#4D4F5C",
|
|
76
|
+
}}
|
|
77
|
+
>
|
|
78
|
+
{item.time}
|
|
79
|
+
</Typography>
|
|
80
|
+
</BoxStyled>
|
|
81
|
+
{item.emotion && item.send === "me" && <>{item.emotion}</>}
|
|
82
|
+
{item.emotionReplay && item.send === "me" && (
|
|
83
|
+
<>{item.emotionReplay}</>
|
|
84
|
+
)}
|
|
85
|
+
</Item>
|
|
86
|
+
))}
|
|
87
|
+
</ContainerStyled>
|
|
88
|
+
);
|
|
89
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
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 { DatePicker as MuiDatePicker } from "@mui/x-date-pickers/DatePicker";
|
|
7
|
+
import { MobileDatePicker as MuiMobileDatePicker } from "@mui/x-date-pickers/MobileDatePicker";
|
|
8
|
+
import { DesktopDatePicker as MuiDesktopDatePicker } from "@mui/x-date-pickers/DesktopDatePicker";
|
|
9
|
+
import { DatePickerBaseProps } from "../interfaces";
|
|
10
|
+
import { themes } from "../helpers";
|
|
11
|
+
import { styled } from "@mui/material/styles";
|
|
12
|
+
|
|
13
|
+
import "dayjs/locale/pt-br";
|
|
14
|
+
import "dayjs/locale/en";
|
|
15
|
+
import "dayjs/locale/es";
|
|
16
|
+
|
|
17
|
+
const MuiDatePickerStyled = styled(MuiDatePicker)({
|
|
18
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
|
19
|
+
border: "none",
|
|
20
|
+
borderRadius: 0,
|
|
21
|
+
borderBottom: "1px solid #666666",
|
|
22
|
+
},
|
|
23
|
+
"& .MuiFormLabel-root": {
|
|
24
|
+
backgroundColor: "#fff",
|
|
25
|
+
padding: "0 5px",
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const MuiMobileDatePickerStyled = styled(MuiMobileDatePicker)({
|
|
30
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
|
31
|
+
border: "none",
|
|
32
|
+
borderRadius: 0,
|
|
33
|
+
borderBottom: "1px solid #666666",
|
|
34
|
+
},
|
|
35
|
+
"& .MuiFormLabel-root": {
|
|
36
|
+
backgroundColor: "#fff",
|
|
37
|
+
padding: "0 5px",
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const MuiDesktopDatePickerStyled = styled(MuiDesktopDatePicker)({
|
|
42
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
|
43
|
+
border: "none",
|
|
44
|
+
borderRadius: 0,
|
|
45
|
+
borderBottom: "1px solid #666666",
|
|
46
|
+
},
|
|
47
|
+
"& .MuiFormLabel-root": {
|
|
48
|
+
backgroundColor: "#fff",
|
|
49
|
+
padding: "0 5px",
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export const DatePicker = ({
|
|
54
|
+
label,
|
|
55
|
+
format = "DD/MM/YYYY",
|
|
56
|
+
language = "pt-br",
|
|
57
|
+
variant = "desktop",
|
|
58
|
+
}: DatePickerBaseProps) => {
|
|
59
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
60
|
+
const theme = useMemo(
|
|
61
|
+
() => (prefersDarkMode ? themes.light : themes.dark),
|
|
62
|
+
[prefersDarkMode]
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<ThemeProvider theme={theme}>
|
|
67
|
+
<LocalizationProvider dateAdapter={AdapterDayjs} adapterLocale={language}>
|
|
68
|
+
<DemoContainer
|
|
69
|
+
components={["TimePicker", "MobileTimePicker", "DesktopTimePicker"]}
|
|
70
|
+
>
|
|
71
|
+
{variant === "responsive" && (
|
|
72
|
+
<MuiDatePickerStyled label={label} format={format} />
|
|
73
|
+
)}
|
|
74
|
+
{variant === "mobile" && (
|
|
75
|
+
<MuiMobileDatePickerStyled label={label} format={format} />
|
|
76
|
+
)}
|
|
77
|
+
{variant === "desktop" && (
|
|
78
|
+
<MuiDesktopDatePickerStyled label={label} format={format} />
|
|
79
|
+
)}
|
|
80
|
+
</DemoContainer>
|
|
81
|
+
</LocalizationProvider>
|
|
82
|
+
</ThemeProvider>
|
|
83
|
+
);
|
|
84
|
+
};
|
package/src/components/Icons.tsx
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
useMediaQuery,
|
|
7
7
|
Typography,
|
|
8
8
|
} from "@mui/material";
|
|
9
|
+
|
|
9
10
|
import { ProgressBarBaseProps } from "../interfaces";
|
|
10
11
|
import { themes } from "../helpers";
|
|
11
12
|
import { styled } from "@mui/material/styles";
|
|
@@ -20,7 +21,7 @@ const ProgressBarStyled = styled(MuiProgressBar)({
|
|
|
20
21
|
}`,
|
|
21
22
|
});
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
const ProgressBarLabelStyled = styled(Typography)`
|
|
24
25
|
display: flex;
|
|
25
26
|
justify-content: space-between;
|
|
26
27
|
align-items: center;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import { ThemeProvider, useMediaQuery, Typography } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
Timeline as MuiTimeLine,
|
|
6
|
+
TimelineItem,
|
|
7
|
+
timelineItemClasses,
|
|
8
|
+
TimelineSeparator,
|
|
9
|
+
TimelineConnector,
|
|
10
|
+
TimelineContent,
|
|
11
|
+
TimelineDot,
|
|
12
|
+
} from "@mui/lab";
|
|
13
|
+
|
|
14
|
+
import { TimeLineBaseProps } from "@/interfaces/TimeLine";
|
|
15
|
+
|
|
16
|
+
import { styled } from "@mui/material/styles";
|
|
17
|
+
import { palette, lightenRGB, themes } from "../helpers";
|
|
18
|
+
import { ColorVariant, DataTimeLine } from "@/types";
|
|
19
|
+
|
|
20
|
+
const colorMap: Record<ColorVariant, string> = {
|
|
21
|
+
inherit: palette.inherit,
|
|
22
|
+
primary: palette.primary,
|
|
23
|
+
secondary: palette.secondary,
|
|
24
|
+
error: palette.error,
|
|
25
|
+
warning: palette.warning,
|
|
26
|
+
info: palette.info,
|
|
27
|
+
success: palette.success,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const sampleData: Array<DataTimeLine> = [
|
|
31
|
+
{
|
|
32
|
+
title: "imported register",
|
|
33
|
+
data: "01/04/2023 at 07h00",
|
|
34
|
+
by: "By IEM",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
title: "80% score applied on register",
|
|
38
|
+
data: "01/04/2023 at 07h05",
|
|
39
|
+
by: "By IEM",
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
title: "Registers transfered to campaign ID 10",
|
|
43
|
+
data: "",
|
|
44
|
+
by: "",
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
const TimeLineStyled = styled(MuiTimeLine)({
|
|
49
|
+
[`& .${timelineItemClasses.root}:before`]: {
|
|
50
|
+
flex: 0,
|
|
51
|
+
padding: 0,
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export const TimeLine: React.FC<TimeLineBaseProps> = ({
|
|
56
|
+
data = sampleData,
|
|
57
|
+
color = "primary",
|
|
58
|
+
position = "left",
|
|
59
|
+
...props
|
|
60
|
+
}) => {
|
|
61
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
62
|
+
const theme = useMemo(
|
|
63
|
+
() => (prefersDarkMode ? themes.light : themes.light),
|
|
64
|
+
[prefersDarkMode]
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const renderList = data.map((item, key) => (
|
|
68
|
+
<TimelineItem key={key}>
|
|
69
|
+
<TimelineSeparator>
|
|
70
|
+
<TimelineDot
|
|
71
|
+
sx={{
|
|
72
|
+
bgcolor: colorMap[color],
|
|
73
|
+
p: "6px",
|
|
74
|
+
border: `4px solid ${lightenRGB(colorMap[color], 50)}`,
|
|
75
|
+
}}
|
|
76
|
+
/>
|
|
77
|
+
{key !== data.length - 1 && (
|
|
78
|
+
<TimelineConnector
|
|
79
|
+
sx={{ bgcolor: colorMap[color], pt: "55px", pl: "3px" }}
|
|
80
|
+
/>
|
|
81
|
+
)}
|
|
82
|
+
</TimelineSeparator>
|
|
83
|
+
<TimelineContent>
|
|
84
|
+
{item.title}
|
|
85
|
+
<Typography sx={{ m: "auto 0" }} variant="body2" color="text.secondary">
|
|
86
|
+
{item.data}
|
|
87
|
+
</Typography>
|
|
88
|
+
<Typography
|
|
89
|
+
sx={{ m: "auto 0", color: colorMap[color] }}
|
|
90
|
+
variant="body2"
|
|
91
|
+
>
|
|
92
|
+
{item.by}
|
|
93
|
+
</Typography>
|
|
94
|
+
</TimelineContent>
|
|
95
|
+
</TimelineItem>
|
|
96
|
+
));
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<ThemeProvider theme={theme}>
|
|
100
|
+
<TimeLineStyled {...props}>{renderList}</TimeLineStyled>
|
|
101
|
+
</ThemeProvider>
|
|
102
|
+
);
|
|
103
|
+
};
|