norma-library 0.4.2 → 0.4.5
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/.babelrc.json +18 -0
- package/buildcache/front-end +1 -0
- package/dist/esm/components/Accordion.d.ts +3 -0
- package/dist/esm/components/Accordion.js +24 -0
- package/dist/esm/components/Accordion.js.map +1 -0
- package/dist/esm/components/Button.d.ts +3 -0
- package/dist/esm/components/Button.js +22 -0
- package/dist/esm/components/Button.js.map +1 -0
- package/dist/esm/components/Card.d.ts +7 -0
- package/dist/esm/components/Card.js +31 -0
- package/dist/esm/components/Card.js.map +1 -0
- package/dist/esm/components/CheckBox.d.ts +3 -0
- package/dist/esm/components/CheckBox.js +13 -0
- package/dist/esm/components/CheckBox.js.map +1 -0
- package/dist/esm/components/DropDown.d.ts +3 -0
- package/dist/esm/components/DropDown.js +17 -0
- package/dist/esm/components/DropDown.js.map +1 -0
- package/dist/esm/components/IconButton.d.ts +3 -0
- package/dist/esm/components/IconButton.js +31 -0
- package/dist/esm/components/IconButton.js.map +1 -0
- package/dist/esm/components/Icons.d.ts +7 -0
- package/dist/esm/components/Icons.js +49 -0
- package/dist/esm/components/Icons.js.map +1 -0
- package/dist/esm/components/Modal.d.ts +4 -0
- package/dist/esm/components/Modal.js +32 -0
- package/dist/esm/components/Modal.js.map +1 -0
- package/dist/esm/components/Paper.d.ts +3 -0
- package/dist/esm/components/Paper.js +14 -0
- package/dist/esm/components/Paper.js.map +1 -0
- package/dist/esm/components/ProgressBar.d.ts +6 -0
- package/dist/esm/components/ProgressBar.js +31 -0
- package/dist/esm/components/ProgressBar.js.map +1 -0
- package/dist/esm/components/RadioGroup.d.ts +3 -0
- package/dist/esm/components/RadioGroup.js +18 -0
- package/dist/esm/components/RadioGroup.js.map +1 -0
- package/dist/esm/components/RangerSlider.d.ts +3 -0
- package/dist/esm/components/RangerSlider.js +64 -0
- package/dist/esm/components/RangerSlider.js.map +1 -0
- package/dist/esm/components/Select.d.ts +3 -0
- package/dist/esm/components/Select.js +45 -0
- package/dist/esm/components/Select.js.map +1 -0
- package/dist/esm/components/Svgs.d.ts +29 -0
- package/dist/esm/components/Svgs.js +102 -0
- package/dist/esm/components/Svgs.js.map +1 -0
- package/dist/esm/components/Tabs.d.ts +3 -0
- package/dist/esm/components/Tabs.js +78 -0
- package/dist/esm/components/Tabs.js.map +1 -0
- package/dist/esm/components/Tag.d.ts +3 -0
- package/dist/esm/components/Tag.js +27 -0
- package/dist/esm/components/Tag.js.map +1 -0
- package/dist/esm/components/TextField.d.ts +3 -0
- package/dist/esm/components/TextField.js +18 -0
- package/dist/esm/components/TextField.js.map +1 -0
- package/dist/esm/components/button/index.d.ts +3 -0
- package/dist/esm/components/button/index.js +22 -0
- package/dist/esm/components/button/index.js.map +1 -0
- package/dist/esm/components/checkbox/index.d.ts +3 -0
- package/dist/esm/components/checkbox/index.js +13 -0
- package/dist/esm/components/checkbox/index.js.map +1 -0
- package/dist/esm/components/icons/index.d.ts +7 -0
- package/dist/esm/components/icons/index.js +49 -0
- package/dist/esm/components/icons/index.js.map +1 -0
- package/dist/esm/components/icons/svgs.d.ts +29 -0
- package/dist/esm/components/icons/svgs.js +102 -0
- package/dist/esm/components/icons/svgs.js.map +1 -0
- package/dist/esm/components/index.d.ts +16 -0
- package/dist/esm/components/index.js +17 -0
- package/dist/esm/components/index.js.map +1 -0
- package/dist/esm/components/textfield/index.d.ts +3 -0
- package/dist/esm/components/textfield/index.js +18 -0
- package/dist/esm/components/textfield/index.js.map +1 -0
- package/dist/esm/helpers/alignments.d.ts +2 -0
- package/dist/esm/helpers/alignments.js +14 -0
- package/dist/esm/helpers/alignments.js.map +1 -0
- package/dist/esm/helpers/borders.d.ts +2 -0
- package/dist/esm/helpers/borders.js +18 -0
- package/dist/esm/helpers/borders.js.map +1 -0
- package/dist/esm/helpers/colors.d.ts +172 -0
- package/dist/esm/helpers/colors.js +156 -0
- package/dist/esm/helpers/colors.js.map +1 -0
- package/dist/esm/helpers/index.d.ts +5 -0
- package/dist/esm/helpers/index.js +6 -0
- package/dist/esm/helpers/index.js.map +1 -0
- package/dist/esm/helpers/radios.d.ts +2 -0
- package/dist/esm/helpers/radios.js +24 -0
- package/dist/esm/helpers/radios.js.map +1 -0
- package/dist/esm/helpers/sizes.d.ts +11 -0
- package/dist/esm/helpers/sizes.js +67 -0
- package/dist/esm/helpers/sizes.js.map +1 -0
- package/dist/esm/index.d.ts +17 -0
- package/dist/esm/index.js +18 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/interfaces/Accordion.d.ts +12 -0
- package/dist/esm/interfaces/Accordion.js +2 -0
- package/dist/esm/interfaces/Accordion.js.map +1 -0
- package/dist/esm/interfaces/Button.d.ts +14 -0
- package/dist/esm/interfaces/Button.js +2 -0
- package/dist/esm/interfaces/Button.js.map +1 -0
- package/dist/esm/interfaces/Card.d.ts +11 -0
- package/dist/esm/interfaces/Card.js +2 -0
- package/dist/esm/interfaces/Card.js.map +1 -0
- package/dist/esm/interfaces/CheckBox.d.ts +19 -0
- package/dist/esm/interfaces/CheckBox.js +2 -0
- package/dist/esm/interfaces/CheckBox.js.map +1 -0
- package/dist/esm/interfaces/DropDown.d.ts +11 -0
- package/dist/esm/interfaces/DropDown.js +2 -0
- package/dist/esm/interfaces/DropDown.js.map +1 -0
- package/dist/esm/interfaces/Icon.d.ts +15 -0
- package/dist/esm/interfaces/Icon.js +2 -0
- package/dist/esm/interfaces/Icon.js.map +1 -0
- package/dist/esm/interfaces/IconButton.d.ts +14 -0
- package/dist/esm/interfaces/IconButton.js +2 -0
- package/dist/esm/interfaces/IconButton.js.map +1 -0
- package/dist/esm/interfaces/Icons.d.ts +15 -0
- package/dist/esm/interfaces/Icons.js +2 -0
- package/dist/esm/interfaces/Icons.js.map +1 -0
- package/dist/esm/interfaces/Modal.d.ts +15 -0
- package/dist/esm/interfaces/Modal.js +2 -0
- package/dist/esm/interfaces/Modal.js.map +1 -0
- package/dist/esm/interfaces/Paper.d.ts +12 -0
- package/dist/esm/interfaces/Paper.js +2 -0
- package/dist/esm/interfaces/Paper.js.map +1 -0
- package/dist/esm/interfaces/ProgressBar.d.ts +17 -0
- package/dist/esm/interfaces/ProgressBar.js +2 -0
- package/dist/esm/interfaces/ProgressBar.js.map +1 -0
- package/dist/esm/interfaces/RadioGroup.d.ts +15 -0
- package/dist/esm/interfaces/RadioGroup.js +2 -0
- package/dist/esm/interfaces/RadioGroup.js.map +1 -0
- package/dist/esm/interfaces/RangerSlider.d.ts +18 -0
- package/dist/esm/interfaces/RangerSlider.js +2 -0
- package/dist/esm/interfaces/RangerSlider.js.map +1 -0
- package/dist/esm/interfaces/Select.d.ts +17 -0
- package/dist/esm/interfaces/Select.js +2 -0
- package/dist/esm/interfaces/Select.js.map +1 -0
- package/dist/esm/interfaces/Tabs.d.ts +18 -0
- package/dist/esm/interfaces/Tabs.js +2 -0
- package/dist/esm/interfaces/Tabs.js.map +1 -0
- package/dist/esm/interfaces/Tag.d.ts +18 -0
- package/dist/esm/interfaces/Tag.js +2 -0
- package/dist/esm/interfaces/Tag.js.map +1 -0
- package/dist/esm/interfaces/TextField.d.ts +40 -0
- package/dist/esm/interfaces/TextField.js +2 -0
- package/dist/esm/interfaces/TextField.js.map +1 -0
- package/dist/esm/interfaces/index.d.ts +17 -0
- package/dist/esm/interfaces/index.js +18 -0
- package/dist/esm/interfaces/index.js.map +1 -0
- package/dist/esm/types/index.d.ts +78 -0
- package/dist/esm/types/index.js +10 -0
- package/dist/esm/types/index.js.map +1 -0
- package/dist/index.css +8363 -0
- package/norma-library.tar +0 -0
- package/package.json +75 -90
- package/postcss.config.js +6 -0
- package/src/components/Accordion.tsx +64 -0
- package/src/components/Button.tsx +38 -0
- package/src/components/Card.tsx +47 -0
- package/src/components/CheckBox.tsx +35 -0
- package/src/components/DropDown.tsx +38 -0
- package/src/components/IconButton.tsx +58 -0
- package/src/components/Icons.tsx +87 -0
- package/src/components/Modal.tsx +123 -0
- package/src/components/Paper.tsx +22 -0
- package/src/components/ProgressBar.tsx +62 -0
- package/src/components/RadioGroup.tsx +55 -0
- package/src/components/RangerSlider.tsx +81 -0
- package/src/components/Select.tsx +98 -0
- package/src/components/Svgs.tsx +522 -0
- package/src/components/Tabs.tsx +140 -0
- package/src/components/Tag.tsx +45 -0
- package/src/components/TextField.tsx +35 -0
- package/src/components/index.ts +16 -0
- package/src/helpers/alignments.ts +14 -0
- package/src/helpers/borders.ts +18 -0
- package/src/helpers/colors.ts +173 -0
- package/src/helpers/index.ts +5 -0
- package/src/helpers/radios.ts +24 -0
- package/src/helpers/sizes.ts +79 -0
- package/src/index.css +2 -0
- package/src/index.ts +36 -0
- package/src/interfaces/Accordion.ts +12 -0
- package/src/interfaces/Button.ts +27 -0
- package/src/interfaces/Card.ts +11 -0
- package/src/interfaces/CheckBox.ts +33 -0
- package/src/interfaces/DropDown.ts +14 -0
- package/src/interfaces/IconButton.ts +27 -0
- package/src/interfaces/Icons.ts +17 -0
- package/src/interfaces/Modal.ts +15 -0
- package/src/interfaces/Paper.ts +12 -0
- package/src/interfaces/ProgressBar.ts +25 -0
- package/src/interfaces/RadioGroup.ts +28 -0
- package/src/interfaces/RangerSlider.ts +32 -0
- package/src/interfaces/Select.ts +17 -0
- package/src/interfaces/Tabs.ts +24 -0
- package/src/interfaces/Tag.ts +17 -0
- package/src/interfaces/TextField.ts +63 -0
- package/src/interfaces/index.ts +17 -0
- package/src/stories/Accordion.stories.tsx +65 -0
- package/src/stories/Button.stories.tsx +99 -0
- package/src/stories/Card.stories.tsx +55 -0
- package/src/stories/CheckBox.stories.tsx +94 -0
- package/src/stories/Colors.stories.mdx +127 -0
- package/src/stories/DropDown.stories.tsx +57 -0
- package/src/stories/IconButton.stories.tsx +114 -0
- package/src/stories/Icons.stories.mdx +27 -0
- package/src/stories/Modal.stories.tsx +190 -0
- package/src/stories/Paper.stories.tsx +53 -0
- package/src/stories/ProgressBar.stories.tsx +139 -0
- package/src/stories/RadioGroup.stories.tsx +94 -0
- package/src/stories/RangerSlider.stories.tsx +68 -0
- package/src/stories/Select.stories.tsx +128 -0
- package/src/stories/Tabs.stories.tsx +62 -0
- package/src/stories/Tag.stories.tsx +76 -0
- package/src/stories/TextField.stories.tsx +445 -0
- package/src/styles/custom.css +5 -0
- package/src/styles/globals.css +21 -0
- package/src/types/index.ts +220 -0
- package/tailwind.config.js +58 -0
- package/tsconfig.json +32 -0
- package/README.md +0 -160
- package/dist/index.js +0 -8
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import { Chip as MuiTag, ThemeProvider, useMediaQuery } from "@mui/material";
|
|
3
|
+
import { TagBaseProps } from "../interfaces";
|
|
4
|
+
import { palette, themes } from "../helpers";
|
|
5
|
+
import { styled } from "@mui/material/styles";
|
|
6
|
+
import { ColorVariant } from "@/types";
|
|
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
|
+
const TagStyled = styled(MuiTag)({});
|
|
19
|
+
|
|
20
|
+
export const Tag = ({
|
|
21
|
+
label,
|
|
22
|
+
color = "primary",
|
|
23
|
+
outlined = false,
|
|
24
|
+
...props
|
|
25
|
+
}: TagBaseProps) => {
|
|
26
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
27
|
+
const theme = useMemo(
|
|
28
|
+
() => (prefersDarkMode ? themes.light : themes.dark),
|
|
29
|
+
[prefersDarkMode]
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<ThemeProvider theme={theme}>
|
|
34
|
+
<TagStyled
|
|
35
|
+
label={label}
|
|
36
|
+
sx={{
|
|
37
|
+
color: outlined !== true ? "#FFFF" : colorMap[color],
|
|
38
|
+
backgroundColor: outlined !== true ? colorMap[color] : "inherit",
|
|
39
|
+
border: `1px solid ${colorMap[color]}`,
|
|
40
|
+
}}
|
|
41
|
+
{...props}
|
|
42
|
+
/>
|
|
43
|
+
</ThemeProvider>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
FormControl,
|
|
5
|
+
ThemeProvider,
|
|
6
|
+
useMediaQuery,
|
|
7
|
+
TextField as MuiTextField,
|
|
8
|
+
} from "@mui/material";
|
|
9
|
+
|
|
10
|
+
import { TextFieldBaseProps } from "../interfaces";
|
|
11
|
+
import { styled } from "@mui/material/styles";
|
|
12
|
+
import { themes } from "../helpers";
|
|
13
|
+
|
|
14
|
+
const TextFieldStyled = styled(MuiTextField)({
|
|
15
|
+
textTransform: "none",
|
|
16
|
+
color: "currentcolor",
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const TextField: React.FC<TextFieldBaseProps> = ({
|
|
20
|
+
label,
|
|
21
|
+
...props
|
|
22
|
+
}) => {
|
|
23
|
+
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
|
|
24
|
+
const theme = useMemo(
|
|
25
|
+
() => (prefersDarkMode ? themes.light : themes.dark),
|
|
26
|
+
[prefersDarkMode]
|
|
27
|
+
);
|
|
28
|
+
return (
|
|
29
|
+
<ThemeProvider theme={theme}>
|
|
30
|
+
<FormControl sx={{ width: "100%" }}>
|
|
31
|
+
<TextFieldStyled {...props} label={label} />
|
|
32
|
+
</FormControl>
|
|
33
|
+
</ThemeProvider>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from "./Accordion";
|
|
2
|
+
export * from "./Button";
|
|
3
|
+
export * from "./Card";
|
|
4
|
+
export * from "./CheckBox";
|
|
5
|
+
export * from "./DropDown";
|
|
6
|
+
export * from "./IconButton";
|
|
7
|
+
export * from "./Icons";
|
|
8
|
+
export * from "./Modal";
|
|
9
|
+
export * from "./Paper";
|
|
10
|
+
export * from "./ProgressBar";
|
|
11
|
+
export * from "./RadioGroup";
|
|
12
|
+
export * from "./RangerSlider";
|
|
13
|
+
export * from "./Select";
|
|
14
|
+
export * from "./Tabs";
|
|
15
|
+
export * from "./Tag";
|
|
16
|
+
export * from "./TextField";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
function getAlign(border: string) {
|
|
2
|
+
switch (border) {
|
|
3
|
+
case "left":
|
|
4
|
+
return "text-start justify-items-start";
|
|
5
|
+
case "center":
|
|
6
|
+
return "justify-items-center";
|
|
7
|
+
case "right":
|
|
8
|
+
return "text-end justify-items-end";
|
|
9
|
+
default:
|
|
10
|
+
return "text-center inline-flex";
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { getAlign };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function getBorderSize(size: number) {
|
|
2
|
+
switch (size.toString()) {
|
|
3
|
+
case "0":
|
|
4
|
+
return "border-0";
|
|
5
|
+
case "1":
|
|
6
|
+
return "border border-[0.05rem]";
|
|
7
|
+
case "2":
|
|
8
|
+
return "border border-2";
|
|
9
|
+
case "4":
|
|
10
|
+
return "border border-4";
|
|
11
|
+
case "8":
|
|
12
|
+
return "border border-8";
|
|
13
|
+
default:
|
|
14
|
+
return "border border-2";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { getBorderSize };
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { createTheme } from "@mui/material/styles";
|
|
2
|
+
|
|
3
|
+
export const getPalette = () => {
|
|
4
|
+
return {
|
|
5
|
+
primary: "#FF7F11",
|
|
6
|
+
primaryLight: "#FFDB9F",
|
|
7
|
+
primaryMedium: "#FFA84C",
|
|
8
|
+
primaryDark: "#B74608",
|
|
9
|
+
|
|
10
|
+
inherit: "#000000",
|
|
11
|
+
secondary: "#43BBF2",
|
|
12
|
+
error: "#D63643",
|
|
13
|
+
warning: "#FFC300",
|
|
14
|
+
info: "#71D5F7",
|
|
15
|
+
success: "#6BC235",
|
|
16
|
+
white: "#ffffff",
|
|
17
|
+
black: "#666666",
|
|
18
|
+
helper: "#5A2A79",
|
|
19
|
+
secondaryLight: "#D9FCFE",
|
|
20
|
+
secondaryMedium: "#71D5F7",
|
|
21
|
+
secondaryDark: "#154F8C",
|
|
22
|
+
inheritLight: "#A3A3A3",
|
|
23
|
+
inheritMedium: "#666666",
|
|
24
|
+
inheritDark: "#292929",
|
|
25
|
+
whiteLight: "#F5F5F5",
|
|
26
|
+
whiteMedium: "#E0E0E0",
|
|
27
|
+
whiteDark: "#CCCCCC",
|
|
28
|
+
successLight: "#D9F8B0",
|
|
29
|
+
successMedium: "#B9EC85",
|
|
30
|
+
successDark: "#247010",
|
|
31
|
+
errorLight: "#FABEAF",
|
|
32
|
+
errorMedium: "#F29085",
|
|
33
|
+
errorDark: "#F29085",
|
|
34
|
+
warningLight: "#FFF7CC",
|
|
35
|
+
warningMedium: "#FFE266",
|
|
36
|
+
warningDark: "#936600",
|
|
37
|
+
helperLight: "#F3D7F8",
|
|
38
|
+
helperMedium: "#BF82D6",
|
|
39
|
+
helperDark: "#250D46",
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const palette = getPalette();
|
|
44
|
+
|
|
45
|
+
export const textColors = {
|
|
46
|
+
inherit: palette.inherit,
|
|
47
|
+
primary: palette.primary,
|
|
48
|
+
secondary: palette.secondary,
|
|
49
|
+
error: palette.error,
|
|
50
|
+
warning: palette.warning,
|
|
51
|
+
info: palette.info,
|
|
52
|
+
success: palette.success,
|
|
53
|
+
white: palette.white,
|
|
54
|
+
black: palette.black,
|
|
55
|
+
helper: palette.helper,
|
|
56
|
+
primaryLight: palette.primaryLight,
|
|
57
|
+
primaryMedium: palette.primaryMedium,
|
|
58
|
+
primaryDark: palette.primaryDark,
|
|
59
|
+
secondaryLight: palette.secondaryLight,
|
|
60
|
+
secondaryMedium: palette.secondaryMedium,
|
|
61
|
+
secondaryDark: palette.secondaryDark,
|
|
62
|
+
inheritLight: palette.inheritLight,
|
|
63
|
+
inheritMedium: palette.inheritMedium,
|
|
64
|
+
inheritDark: palette.inheritDark,
|
|
65
|
+
whiteLight: palette.whiteLight,
|
|
66
|
+
whiteMedium: palette.whiteMedium,
|
|
67
|
+
whiteDark: palette.whiteDark,
|
|
68
|
+
successLight: palette.successLight,
|
|
69
|
+
successMedium: palette.successMedium,
|
|
70
|
+
successDark: palette.successDark,
|
|
71
|
+
errorLight: palette.errorLight,
|
|
72
|
+
errorMedium: palette.errorMedium,
|
|
73
|
+
errorDark: palette.errorDark,
|
|
74
|
+
warningLight: palette.warningLight,
|
|
75
|
+
warningMedium: palette.warningMedium,
|
|
76
|
+
warningDark: palette.warningDark,
|
|
77
|
+
helperLight: palette.helperLight,
|
|
78
|
+
helperMedium: palette.helperMedium,
|
|
79
|
+
helperDark: palette.helperDark,
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const backgroundColors = {
|
|
83
|
+
inherit: palette.inherit,
|
|
84
|
+
primary: palette.primary,
|
|
85
|
+
secondary: palette.secondary,
|
|
86
|
+
error: palette.error,
|
|
87
|
+
warning: palette.warning,
|
|
88
|
+
info: palette.info,
|
|
89
|
+
success: palette.success,
|
|
90
|
+
white: palette.white,
|
|
91
|
+
black: palette.black,
|
|
92
|
+
primaryLight: palette.primaryLight,
|
|
93
|
+
primaryMedium: palette.primaryMedium,
|
|
94
|
+
primaryDark: palette.primaryDark,
|
|
95
|
+
secondaryLight: palette.secondaryLight,
|
|
96
|
+
secondaryMedium: palette.secondaryMedium,
|
|
97
|
+
secondaryDark: palette.secondaryDark,
|
|
98
|
+
inheritLight: palette.inheritLight,
|
|
99
|
+
inheritMedium: palette.inheritMedium,
|
|
100
|
+
inheritDark: palette.inheritDark,
|
|
101
|
+
whiteLight: palette.whiteLight,
|
|
102
|
+
whiteMedium: palette.whiteMedium,
|
|
103
|
+
whiteDark: palette.whiteDark,
|
|
104
|
+
successLight: palette.successLight,
|
|
105
|
+
successMedium: palette.successMedium,
|
|
106
|
+
successDark: palette.successDark,
|
|
107
|
+
errorLight: palette.errorLight,
|
|
108
|
+
errorMedium: palette.errorMedium,
|
|
109
|
+
errorDark: palette.errorDark,
|
|
110
|
+
warningLight: palette.warningLight,
|
|
111
|
+
warningMedium: palette.warningMedium,
|
|
112
|
+
warningDark: palette.warningDark,
|
|
113
|
+
helperLight: palette.helperLight,
|
|
114
|
+
helperMedium: palette.helperMedium,
|
|
115
|
+
helperDark: palette.helperDark,
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export const olosPalette = {
|
|
119
|
+
primary: {
|
|
120
|
+
main: palette.primary,
|
|
121
|
+
},
|
|
122
|
+
secondary: {
|
|
123
|
+
main: palette.secondary,
|
|
124
|
+
},
|
|
125
|
+
error: {
|
|
126
|
+
main: palette.error,
|
|
127
|
+
},
|
|
128
|
+
warning: {
|
|
129
|
+
main: palette.warning,
|
|
130
|
+
},
|
|
131
|
+
info: {
|
|
132
|
+
main: palette.info,
|
|
133
|
+
},
|
|
134
|
+
success: {
|
|
135
|
+
main: palette.success,
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export const lightTheme = createTheme({
|
|
140
|
+
palette: {
|
|
141
|
+
mode: "light",
|
|
142
|
+
...olosPalette,
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
export const darkTheme = createTheme({
|
|
147
|
+
palette: {
|
|
148
|
+
mode: "dark",
|
|
149
|
+
...olosPalette,
|
|
150
|
+
background: {
|
|
151
|
+
default: palette.inheritLight,
|
|
152
|
+
paper: palette.inheritDark,
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
export const themes = {
|
|
158
|
+
light: lightTheme,
|
|
159
|
+
dark: darkTheme,
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
type PaletteKey = keyof typeof getPalette;
|
|
163
|
+
|
|
164
|
+
const getColor = (key: PaletteKey) => {
|
|
165
|
+
const palette = getPalette();
|
|
166
|
+
if (palette.hasOwnProperty(key)) {
|
|
167
|
+
return palette[key];
|
|
168
|
+
} else {
|
|
169
|
+
return "#CCC";
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
export { getColor };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
function getRadioSize(radio: string) {
|
|
2
|
+
switch (radio) {
|
|
3
|
+
case 'none':
|
|
4
|
+
return 'rounded-none';
|
|
5
|
+
case 'xs':
|
|
6
|
+
return 'rounded-xs';
|
|
7
|
+
case 'sm':
|
|
8
|
+
return 'rounded-sm';
|
|
9
|
+
case 'md':
|
|
10
|
+
return 'rounded-md';
|
|
11
|
+
case 'lg':
|
|
12
|
+
return 'rounded-lg';
|
|
13
|
+
case 'xl':
|
|
14
|
+
return 'rounded-xl';
|
|
15
|
+
case 'xll':
|
|
16
|
+
return 'rounded-2xl';
|
|
17
|
+
case 'full':
|
|
18
|
+
return 'rounded-full';
|
|
19
|
+
default:
|
|
20
|
+
return 'rounded-none';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { getRadioSize };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
function getSize(size: string) {
|
|
2
|
+
switch (size) {
|
|
3
|
+
case "small":
|
|
4
|
+
return "text-sm";
|
|
5
|
+
case "medium":
|
|
6
|
+
return "text-lg";
|
|
7
|
+
case "large":
|
|
8
|
+
return "text-xl";
|
|
9
|
+
default:
|
|
10
|
+
return "text-base";
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function getBtnSize(size: string) {
|
|
15
|
+
switch (size) {
|
|
16
|
+
case "small":
|
|
17
|
+
return "px-3 py-2 text-xs font-medium";
|
|
18
|
+
case "medium":
|
|
19
|
+
return "px-5 py-2.5 text-sm font-medium ";
|
|
20
|
+
case "large":
|
|
21
|
+
return "px-6 py-3.5 text-base font-medium font-semibold";
|
|
22
|
+
default:
|
|
23
|
+
return "h-10 py-2 px-4 text-lg";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function getPaddingSize(size: string) {
|
|
28
|
+
switch (size) {
|
|
29
|
+
case "small":
|
|
30
|
+
return "px-4 py-2.5";
|
|
31
|
+
case "medium":
|
|
32
|
+
return "px-5 py-2.5";
|
|
33
|
+
case "large":
|
|
34
|
+
return "px-6 py-3";
|
|
35
|
+
default:
|
|
36
|
+
return "px-5 py-2.5";
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function getHeightSize(size: string) {
|
|
41
|
+
switch (size) {
|
|
42
|
+
case "small":
|
|
43
|
+
return "h-6";
|
|
44
|
+
case "medium":
|
|
45
|
+
return "h-10";
|
|
46
|
+
case "large":
|
|
47
|
+
return "10";
|
|
48
|
+
default:
|
|
49
|
+
return "h-12";
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function getIconSize(size: string) {
|
|
54
|
+
switch (size) {
|
|
55
|
+
case "small":
|
|
56
|
+
return "px-1.5 py-0 h-6 w-6";
|
|
57
|
+
case "medium":
|
|
58
|
+
return "px-1.5 py-0 h-8 w-8";
|
|
59
|
+
case "large":
|
|
60
|
+
return "px-1.5 py-0 h-10 w-10";
|
|
61
|
+
default:
|
|
62
|
+
return "px-1.5 py-0 h-8 w-8";
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const sizes = {
|
|
67
|
+
small: "small",
|
|
68
|
+
medium: "medium",
|
|
69
|
+
large: "large",
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export {
|
|
73
|
+
sizes,
|
|
74
|
+
getBtnSize,
|
|
75
|
+
getSize,
|
|
76
|
+
getPaddingSize,
|
|
77
|
+
getHeightSize,
|
|
78
|
+
getIconSize,
|
|
79
|
+
};
|
package/src/index.css
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Accordion } from "./components/Accordion";
|
|
2
|
+
import { Button } from "./components/Button";
|
|
3
|
+
import { Card } from "./components/Card";
|
|
4
|
+
import { CheckBox } from "./components/CheckBox";
|
|
5
|
+
import { IconButton } from "./components/IconButton";
|
|
6
|
+
import { Icons } from "./components/Icons";
|
|
7
|
+
import { Modal } from "./components/Modal";
|
|
8
|
+
import { Paper } from "./components/Paper";
|
|
9
|
+
import { ProgressBar } from "./components/ProgressBar";
|
|
10
|
+
import { RadioGroup } from "./components/RadioGroup";
|
|
11
|
+
import { RangerSlider } from "./components/RangerSlider";
|
|
12
|
+
import { Select } from "./components/Select";
|
|
13
|
+
import { Tabs } from "./components/Tabs";
|
|
14
|
+
import { Tag } from "./components/Tag";
|
|
15
|
+
import { TextField } from "./components/TextField";
|
|
16
|
+
import { themes, getPalette } from "./helpers";
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
Accordion,
|
|
20
|
+
Button,
|
|
21
|
+
Card,
|
|
22
|
+
CheckBox,
|
|
23
|
+
getPalette,
|
|
24
|
+
IconButton,
|
|
25
|
+
Icons,
|
|
26
|
+
Modal,
|
|
27
|
+
Paper,
|
|
28
|
+
ProgressBar,
|
|
29
|
+
RadioGroup,
|
|
30
|
+
RangerSlider,
|
|
31
|
+
Select,
|
|
32
|
+
Tabs,
|
|
33
|
+
Tag,
|
|
34
|
+
TextField,
|
|
35
|
+
themes,
|
|
36
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SxProps } from "@mui/material";
|
|
2
|
+
import { Theme } from "@emotion/react";
|
|
3
|
+
import { DataAccordion, MuiAccordionBaseProps } from "../types";
|
|
4
|
+
|
|
5
|
+
export interface AccordionBaseProps extends MuiAccordionBaseProps {
|
|
6
|
+
label?: React.ReactNode | String;
|
|
7
|
+
sx?: SxProps<Theme>;
|
|
8
|
+
onChange?: (event: React.SyntheticEvent, expanded: boolean) => void;
|
|
9
|
+
defaultExpanded?: boolean | string;
|
|
10
|
+
expanded?: boolean;
|
|
11
|
+
data?: DataAccordion[];
|
|
12
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { Theme } from "@emotion/react";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
ButtonPropsColorOverrides,
|
|
6
|
+
ButtonPropsSizeOverrides,
|
|
7
|
+
ButtonPropsVariantOverrides,
|
|
8
|
+
SxProps,
|
|
9
|
+
} from "@mui/material";
|
|
10
|
+
|
|
11
|
+
import { OverridableStringUnion } from "@mui/types";
|
|
12
|
+
import {
|
|
13
|
+
ColorVariant,
|
|
14
|
+
ButtonVariant,
|
|
15
|
+
SizeVariant,
|
|
16
|
+
MuiButtonBaseProps,
|
|
17
|
+
} from "../types";
|
|
18
|
+
|
|
19
|
+
export interface ButtonBaseProps extends MuiButtonBaseProps {
|
|
20
|
+
label?: string;
|
|
21
|
+
sx?: SxProps<Theme>;
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
fullWidth?: boolean;
|
|
24
|
+
color?: OverridableStringUnion<ColorVariant, ButtonPropsColorOverrides>;
|
|
25
|
+
size?: OverridableStringUnion<SizeVariant, ButtonPropsSizeOverrides>;
|
|
26
|
+
variant?: OverridableStringUnion<ButtonVariant, ButtonPropsVariantOverrides>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SxProps } from "@mui/material";
|
|
2
|
+
import { Theme } from "@emotion/react";
|
|
3
|
+
import { ColorVariant, MuiCardBaseProps } from "../types";
|
|
4
|
+
|
|
5
|
+
export interface CardBaseProps extends MuiCardBaseProps {
|
|
6
|
+
sx?: SxProps<Theme>;
|
|
7
|
+
raised?: boolean;
|
|
8
|
+
border?: boolean;
|
|
9
|
+
color?: ColorVariant;
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { OverridableStringUnion } from "@mui/types";
|
|
2
|
+
import { Checkbox, SxProps, Theme } from "@mui/material";
|
|
3
|
+
import { SwitchBaseProps } from "@mui/material/internal/SwitchBase";
|
|
4
|
+
import {
|
|
5
|
+
CheckBoxColorVariant,
|
|
6
|
+
CheckboxPropsColorOverrides,
|
|
7
|
+
CheckboxPropsSizeOverrides,
|
|
8
|
+
MuiCheckBoxBaseProps,
|
|
9
|
+
TextFieldSizeVariant,
|
|
10
|
+
} from "../types";
|
|
11
|
+
|
|
12
|
+
export interface CheckBoxBaseProps extends MuiCheckBoxBaseProps {
|
|
13
|
+
sx?: SxProps<Theme>;
|
|
14
|
+
name?: string;
|
|
15
|
+
label?: string;
|
|
16
|
+
checked?: SwitchBaseProps["checked"];
|
|
17
|
+
color?: OverridableStringUnion<
|
|
18
|
+
CheckBoxColorVariant,
|
|
19
|
+
CheckboxPropsColorOverrides
|
|
20
|
+
>;
|
|
21
|
+
disabled?: SwitchBaseProps["disabled"];
|
|
22
|
+
id?: SwitchBaseProps["id"];
|
|
23
|
+
onChange?: SwitchBaseProps["onChange"];
|
|
24
|
+
required?: SwitchBaseProps["required"];
|
|
25
|
+
size?: OverridableStringUnion<
|
|
26
|
+
TextFieldSizeVariant,
|
|
27
|
+
CheckboxPropsSizeOverrides
|
|
28
|
+
>;
|
|
29
|
+
value?: SwitchBaseProps["value"];
|
|
30
|
+
defaultChecked?: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type CheckboxType = keyof typeof Checkbox;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { Theme } from "@emotion/react";
|
|
3
|
+
|
|
4
|
+
import { SxProps } from "@mui/material";
|
|
5
|
+
|
|
6
|
+
import { DropVariant, MuiDropDownBaseProps } from "../types";
|
|
7
|
+
|
|
8
|
+
export interface DropDownBaseProps extends MuiDropDownBaseProps {
|
|
9
|
+
sx?: SxProps<Theme>;
|
|
10
|
+
open: boolean;
|
|
11
|
+
onClose?: React.ReactEventHandler<{}>;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
variant?: DropVariant;
|
|
14
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { Theme } from "@emotion/react";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
ButtonPropsColorOverrides,
|
|
6
|
+
ButtonPropsSizeOverrides,
|
|
7
|
+
ButtonPropsVariantOverrides,
|
|
8
|
+
SxProps,
|
|
9
|
+
} from "@mui/material";
|
|
10
|
+
|
|
11
|
+
import { OverridableStringUnion } from "@mui/types";
|
|
12
|
+
import {
|
|
13
|
+
ColorVariant,
|
|
14
|
+
ButtonVariant,
|
|
15
|
+
SizeVariant,
|
|
16
|
+
MuiIconButtonBaseProps,
|
|
17
|
+
} from "../types";
|
|
18
|
+
|
|
19
|
+
export interface IconButtonBaseProps extends MuiIconButtonBaseProps {
|
|
20
|
+
sx?: SxProps<Theme>;
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
circle?: boolean;
|
|
23
|
+
cursor?: string;
|
|
24
|
+
color?: OverridableStringUnion<ColorVariant, ButtonPropsColorOverrides>;
|
|
25
|
+
size?: OverridableStringUnion<SizeVariant, ButtonPropsSizeOverrides>;
|
|
26
|
+
variant?: OverridableStringUnion<ButtonVariant, ButtonPropsVariantOverrides>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import { IconScale, IconColors, IconType } from "../types";
|
|
3
|
+
import { Svg } from "../components/Icons";
|
|
4
|
+
|
|
5
|
+
export interface IconsProps extends ComponentProps<typeof Svg> {
|
|
6
|
+
useSymbol?: boolean;
|
|
7
|
+
scale?: IconScale;
|
|
8
|
+
color?: IconColors;
|
|
9
|
+
width?: number;
|
|
10
|
+
height?: number;
|
|
11
|
+
fill?: string;
|
|
12
|
+
icon: IconType;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface SvgProps {
|
|
16
|
+
inline?: boolean;
|
|
17
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SxProps } from "@mui/material";
|
|
2
|
+
import { Theme } from "@emotion/react";
|
|
3
|
+
import { MuiModalBaseProps, OnAction } from "@/types";
|
|
4
|
+
|
|
5
|
+
export interface ModalBaseProps extends MuiModalBaseProps {
|
|
6
|
+
sx?: SxProps<Theme>;
|
|
7
|
+
children: React.ReactElement;
|
|
8
|
+
open: boolean;
|
|
9
|
+
onClose?: React.ReactEventHandler<{}>;
|
|
10
|
+
action?: OnAction[];
|
|
11
|
+
className?: string;
|
|
12
|
+
full?: boolean;
|
|
13
|
+
title?: string;
|
|
14
|
+
id?: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PaperPropsVariantOverrides, SxProps } from "@mui/material";
|
|
2
|
+
import { Theme } from "@emotion/react";
|
|
3
|
+
import { MuiPaperBaseProps, PaperVariant } from "../types";
|
|
4
|
+
import { OverridableStringUnion } from "@mui/types";
|
|
5
|
+
|
|
6
|
+
export interface PaperBaseProps extends MuiPaperBaseProps {
|
|
7
|
+
sx?: SxProps<Theme>;
|
|
8
|
+
elevation?: number;
|
|
9
|
+
square?: boolean;
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
variant?: OverridableStringUnion<PaperVariant, PaperPropsVariantOverrides>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SxProps } from "@mui/material";
|
|
2
|
+
import { Theme } from "@emotion/react";
|
|
3
|
+
import { OverridableStringUnion } from "@mui/types";
|
|
4
|
+
import {
|
|
5
|
+
ColorVariant,
|
|
6
|
+
MuiProgressBarBaseProps,
|
|
7
|
+
ProgressVariant,
|
|
8
|
+
} from "../types";
|
|
9
|
+
import { ProgressBar } from "..";
|
|
10
|
+
export interface LinearProgressPropsColorOverrides {}
|
|
11
|
+
|
|
12
|
+
export interface ProgressBarBaseProps extends MuiProgressBarBaseProps {
|
|
13
|
+
sx?: SxProps<Theme>;
|
|
14
|
+
value?: number;
|
|
15
|
+
total?: number;
|
|
16
|
+
label?: string;
|
|
17
|
+
colorCustom?: string;
|
|
18
|
+
variant?: ProgressVariant;
|
|
19
|
+
color?: OverridableStringUnion<
|
|
20
|
+
ColorVariant,
|
|
21
|
+
LinearProgressPropsColorOverrides
|
|
22
|
+
>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type ProgressBarType = keyof typeof ProgressBar;
|