am-shared-assets 0.0.3 → 0.0.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/dist/am-shared-assets.js +1967 -0
- package/package.json +5 -6
- package/.gitlab-ci.yml +0 -31
- package/.storybook/main.ts +0 -17
- package/.storybook/preview.ts +0 -22
- package/.storybook/vitest.setup.ts +0 -7
- package/Dockerfile +0 -36
- package/docker-compose.yml +0 -12
- package/eslint.config.js +0 -23
- package/index.html +0 -13
- package/postcss.config.js +0 -6
- package/src/App.tsx +0 -8
- package/src/components/Alert.tsx +0 -194
- package/src/components/Badge.tsx +0 -48
- package/src/components/Button.tsx +0 -137
- package/src/components/Chip.tsx +0 -139
- package/src/components/Input.tsx +0 -137
- package/src/components/Radio.tsx +0 -89
- package/src/components/RangeSlider.tsx +0 -106
- package/src/components/Select.tsx +0 -13
- package/src/components/Switch.tsx +0 -76
- package/src/components/Tooltip.tsx +0 -111
- package/src/icons/components/AddIcon.tsx +0 -27
- package/src/icons/components/ArrowDownIcon.tsx +0 -25
- package/src/icons/components/ArrowRightIcon.tsx +0 -37
- package/src/icons/components/BagIcon.tsx +0 -25
- package/src/icons/components/BoxIcon.tsx +0 -43
- package/src/icons/components/BoxTimeIcon.tsx +0 -47
- package/src/icons/components/CardTickIcon.tsx +0 -54
- package/src/icons/components/CardsIcon.tsx +0 -48
- package/src/icons/components/CategoryIcon.tsx +0 -37
- package/src/icons/components/ChevronBottomIcon.tsx +0 -22
- package/src/icons/components/ChevronLeftIcon.tsx +0 -29
- package/src/icons/components/ChevronRightIcon.tsx +0 -29
- package/src/icons/components/ChevronTopIcon.tsx +0 -29
- package/src/icons/components/CloseCircleIcon.tsx +0 -25
- package/src/icons/components/CloseIcon.tsx +0 -29
- package/src/icons/components/DislikeIcon.tsx +0 -32
- package/src/icons/components/EditIcon.tsx +0 -39
- package/src/icons/components/HeartIcon.tsx +0 -28
- package/src/icons/components/HomeIcon.tsx +0 -19
- package/src/icons/components/InfoIcon.tsx +0 -25
- package/src/icons/components/LikeIcon.tsx +0 -32
- package/src/icons/components/MessageIcon.tsx +0 -50
- package/src/icons/components/MoneyIcon.tsx +0 -57
- package/src/icons/components/MoreIcon.tsx +0 -33
- package/src/icons/components/OutlineTickCircleIcon.tsx +0 -35
- package/src/icons/components/RotateBoxIcon.tsx +0 -56
- package/src/icons/components/RotateInfoIcon.tsx +0 -34
- package/src/icons/components/SearchIcon.tsx +0 -35
- package/src/icons/components/SettingIcon.tsx +0 -69
- package/src/icons/components/ShareIcon.tsx +0 -37
- package/src/icons/components/ShopIcon.tsx +0 -56
- package/src/icons/components/ShoppingCartIcon.tsx +0 -53
- package/src/icons/components/SpinnerIcon.tsx +0 -25
- package/src/icons/components/StarIcon.tsx +0 -29
- package/src/icons/components/TickCircleIcon.tsx +0 -25
- package/src/icons/components/TrashIcon.tsx +0 -56
- package/src/icons/components/TruckIcon.tsx +0 -51
- package/src/icons/components/UserIcon.tsx +0 -29
- package/src/icons/components/WalletCheckIcon.tsx +0 -52
- package/src/icons/components/WarningIcon.tsx +0 -19
- package/src/icons/index.ts +0 -83
- package/src/index.css +0 -36
- package/src/index.ts +0 -2
- package/src/main.tsx +0 -10
- package/src/stories/Alert.stories.ts +0 -22
- package/src/stories/Badge.stories.tsx +0 -20
- package/src/stories/Button.stories.tsx +0 -108
- package/src/stories/Chip.stories.ts +0 -20
- package/src/stories/Configure.mdx +0 -364
- package/src/stories/IconGallery.stories.tsx +0 -99
- package/src/stories/Input.stories.ts +0 -21
- package/src/stories/Radio.stories.tsx +0 -21
- package/src/stories/RangeSlider.stories.tsx +0 -68
- package/src/stories/Select.stories.ts +0 -21
- package/src/stories/Switch.stories.tsx +0 -21
- package/src/stories/Tooltip.stories.ts +0 -20
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +0 -1
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +0 -1
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/fonts/woff/IRANSansXFaNum-Bold.woff +0 -0
- package/src/stories/assets/fonts/woff/IRANSansXFaNum-DemiBold.woff +0 -0
- package/src/stories/assets/fonts/woff/IRANSansXFaNum-Medium.woff +0 -0
- package/src/stories/assets/fonts/woff/IRANSansXFaNum-Regular.woff +0 -0
- package/src/stories/assets/fonts/woff2/IRANSansXFaNum-Bold.woff2 +0 -0
- package/src/stories/assets/fonts/woff2/IRANSansXFaNum-DemiBold.woff2 +0 -0
- package/src/stories/assets/fonts/woff2/IRANSansXFaNum-Medium.woff2 +0 -0
- package/src/stories/assets/fonts/woff2/IRANSansXFaNum-Regular.woff2 +0 -0
- package/src/stories/assets/github.svg +0 -1
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +0 -1
- package/src/stories/assets/youtube.svg +0 -1
- package/tailwind.config.js +0 -165
- package/tsconfig.app.json +0 -28
- package/tsconfig.json +0 -7
- package/tsconfig.node.json +0 -26
- package/vite.config.ts +0 -38
- package/vitest.shims.d.ts +0 -1
- /package/{public → dist}/vite.svg +0 -0
package/src/components/Chip.tsx
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import clsx from "clsx";
|
|
2
|
-
|
|
3
|
-
const sizes = {
|
|
4
|
-
sm: "h-6 text-xs",
|
|
5
|
-
md: "h-7 text-sm",
|
|
6
|
-
lg: "h-8 text-base",
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const radiuses = {
|
|
10
|
-
none: "rounded-none",
|
|
11
|
-
sm: "rounded-sm",
|
|
12
|
-
md: "rounded-md",
|
|
13
|
-
lg: "rounded-lg",
|
|
14
|
-
full: "rounded-full",
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const bgColors: { [key: string]: string } = {
|
|
18
|
-
default: "bg-default-200",
|
|
19
|
-
primary: "bg-base-primary",
|
|
20
|
-
secondary: "bg-base-secondary",
|
|
21
|
-
success: "bg-base-success",
|
|
22
|
-
warning: "bg-base-warning",
|
|
23
|
-
danger: "bg-base-danger",
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const textColors: { [key: string]: string } = {
|
|
27
|
-
white: "text-content-1",
|
|
28
|
-
black: "text-layout-fg",
|
|
29
|
-
default: "text-layout-fg",
|
|
30
|
-
primary: "text-base-primary",
|
|
31
|
-
secondary: "text-base-secondary",
|
|
32
|
-
success: "text-base-success",
|
|
33
|
-
warning: "text-base-warning",
|
|
34
|
-
danger: "text-base-danger",
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const borderColors: { [key: string]: string } = {
|
|
38
|
-
default: "border-default-200",
|
|
39
|
-
primary: "border-base-primary",
|
|
40
|
-
secondary: "border-base-secondary",
|
|
41
|
-
success: "border-base-success",
|
|
42
|
-
warning: "border-base-warning",
|
|
43
|
-
danger: "border-base-danger",
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const bgFlatColors: { [key: string]: string } = {
|
|
47
|
-
default: "bg-default-200",
|
|
48
|
-
primary: "bg-primary-100",
|
|
49
|
-
secondary: "bg-secondary-100",
|
|
50
|
-
success: "bg-success-100",
|
|
51
|
-
warning: "bg-warning-100",
|
|
52
|
-
danger: "bg-danger-100",
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const dotColors: { [key: string]: string } = {
|
|
56
|
-
default: "bg-default-400",
|
|
57
|
-
primary: "bg-base-primary",
|
|
58
|
-
secondary: "bg-base-secondary",
|
|
59
|
-
success: "bg-base-success",
|
|
60
|
-
warning: "bg-base-warning",
|
|
61
|
-
danger: "bg-base-danger",
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const variantFunc = (variant: string, color: string, textColor: string) => {
|
|
65
|
-
let style = "";
|
|
66
|
-
|
|
67
|
-
switch (variant) {
|
|
68
|
-
case "solid":
|
|
69
|
-
style = `${bgColors[color]} ${textColors[textColor]}`;
|
|
70
|
-
break;
|
|
71
|
-
case "bordered":
|
|
72
|
-
style = `border-2 ${borderColors[color]} ${textColors[color]}`;
|
|
73
|
-
break;
|
|
74
|
-
case "light":
|
|
75
|
-
style = textColors[color];
|
|
76
|
-
break;
|
|
77
|
-
case "flat":
|
|
78
|
-
style = `${bgFlatColors[color]} ${textColors[color]}`;
|
|
79
|
-
break;
|
|
80
|
-
case "faded":
|
|
81
|
-
style = `border-2 ${borderColors["default"]} bg-default-100 ${textColors[color]}`;
|
|
82
|
-
break;
|
|
83
|
-
case "shadow":
|
|
84
|
-
style = `shadow-lg ${bgColors[color]} ${textColors[textColor]}`;
|
|
85
|
-
break;
|
|
86
|
-
case "dot":
|
|
87
|
-
style = `border-2 ${borderColors["default"]} ${textColors["black"]}`;
|
|
88
|
-
break;
|
|
89
|
-
default:
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return style;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
interface IChipProps {
|
|
97
|
-
variant?:
|
|
98
|
-
| "solid"
|
|
99
|
-
| "bordered"
|
|
100
|
-
| "light"
|
|
101
|
-
| "flat"
|
|
102
|
-
| "faded"
|
|
103
|
-
| "shadow"
|
|
104
|
-
| "dot";
|
|
105
|
-
color?:
|
|
106
|
-
| "default"
|
|
107
|
-
| "primary"
|
|
108
|
-
| "secondary"
|
|
109
|
-
| "success"
|
|
110
|
-
| "warning"
|
|
111
|
-
| "danger";
|
|
112
|
-
textColor?: "black" | "white";
|
|
113
|
-
size?: "sm" | "md" | "lg";
|
|
114
|
-
rounded?: "none" | "sm" | "md" | "lg" | "full";
|
|
115
|
-
label?: string;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const Chip = ({
|
|
119
|
-
variant = "solid",
|
|
120
|
-
color = "default",
|
|
121
|
-
textColor = "black",
|
|
122
|
-
label,
|
|
123
|
-
size = "md",
|
|
124
|
-
rounded = "none",
|
|
125
|
-
}: IChipProps) => {
|
|
126
|
-
const cls = clsx(
|
|
127
|
-
radiuses[rounded],
|
|
128
|
-
sizes[size],
|
|
129
|
-
variantFunc(variant, color, textColor)
|
|
130
|
-
);
|
|
131
|
-
return (
|
|
132
|
-
<div className={`w-fit flex items-center justify-center gap-1 px-2 ${cls}`}>
|
|
133
|
-
<p>{label}</p>
|
|
134
|
-
{variant === "dot" && <div className={`size-2 rounded-full ${dotColors[color]}`}></div>}
|
|
135
|
-
</div>
|
|
136
|
-
);
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
export default Chip;
|
package/src/components/Input.tsx
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import clsx from "clsx";
|
|
2
|
-
|
|
3
|
-
const sizes = {
|
|
4
|
-
sm: "h-8 py-1",
|
|
5
|
-
lg: "h-10 py-2",
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
const labelColors: { [key: string]: string } = {
|
|
9
|
-
default: "text-default-600",
|
|
10
|
-
primary: "text-base-primary",
|
|
11
|
-
success: "text-base-success",
|
|
12
|
-
warning: "text-base-warning",
|
|
13
|
-
danger: "text-base-danger",
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const textColors: { [key: string]: string } = {
|
|
17
|
-
primary: "text-base-primary hover:text-base-primary",
|
|
18
|
-
success: "text-base-success hover:text-base-success",
|
|
19
|
-
warning: "text-base-warning hover:text-base-warning",
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const flatBgColors: { [key: string]: string } = {
|
|
23
|
-
default: "bg-default-100 hover:bg-default-200",
|
|
24
|
-
primary: "bg-primary-100 hover:bg-primary-50",
|
|
25
|
-
success: "bg-success-100 hover:bg-success-50",
|
|
26
|
-
warning: "bg-warning-100 hover:bg-warning-50",
|
|
27
|
-
danger: "bg-danger-100 hover:bg-danger-50",
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const focusedState: { [key: string]: string } = {
|
|
31
|
-
default: "focus:bg-transparent focus:border focus:border-layout-fg",
|
|
32
|
-
primary: "focus:bg-transparent focus:border focus:border-base-primary",
|
|
33
|
-
success: "focus:bg-transparent focus:border focus:border-base-success",
|
|
34
|
-
warning: "focus:bg-transparent focus:border focus:border-base-warning",
|
|
35
|
-
danger: "focus:bg-transparent focus:border focus:border-base-danger",
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const fadedBorderColors: { [key: string]: string } = {
|
|
39
|
-
default: "hover:border-default-400",
|
|
40
|
-
primary: "hover:border-base-primary",
|
|
41
|
-
success: "hover:border-base-success",
|
|
42
|
-
warning: "hover:border-base-warning",
|
|
43
|
-
danger: "hover:border-base-danger",
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const radiuses = {
|
|
47
|
-
sm: "rounded-sm",
|
|
48
|
-
full: "rounded-full",
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
const variantFunc = (variant: string, color: string, hasError: boolean) => {
|
|
52
|
-
let style = "";
|
|
53
|
-
|
|
54
|
-
if (hasError)
|
|
55
|
-
return (style =
|
|
56
|
-
"bg-danger-100 hover:bg-danger-50 focus:bg-transparent focus:border focus:border-base-danger");
|
|
57
|
-
|
|
58
|
-
switch (variant) {
|
|
59
|
-
case "flat":
|
|
60
|
-
style = `${flatBgColors[color]} ${focusedState[color]} ${textColors[color]} focus:text-layout-fg`;
|
|
61
|
-
break;
|
|
62
|
-
case "bordered":
|
|
63
|
-
style = `bg-transparent border border-default-200 hover:border-default-400 ${focusedState[color]}`;
|
|
64
|
-
break;
|
|
65
|
-
case "faded":
|
|
66
|
-
style = `border border-default-200 bg-default-100 hover:bg-default-200 ${fadedBorderColors[color]} ${focusedState[color]}`;
|
|
67
|
-
break;
|
|
68
|
-
default:
|
|
69
|
-
break;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return style;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
interface IInputProps {
|
|
76
|
-
id: string | number;
|
|
77
|
-
label?: string;
|
|
78
|
-
required?: boolean;
|
|
79
|
-
value?: string;
|
|
80
|
-
onChange?: (value: string) => void;
|
|
81
|
-
placeHolder?: string;
|
|
82
|
-
variant?: "flat" | "bordered" | "faded";
|
|
83
|
-
color?: "default" | "primary" | "success" | "warning" | "danger";
|
|
84
|
-
size?: "sm" | "lg";
|
|
85
|
-
rounded?: "sm" | "full";
|
|
86
|
-
description?: string;
|
|
87
|
-
errorMsg?: string;
|
|
88
|
-
hasError?: boolean;
|
|
89
|
-
}
|
|
90
|
-
const Input = ({
|
|
91
|
-
id,
|
|
92
|
-
label,
|
|
93
|
-
required = false,
|
|
94
|
-
value,
|
|
95
|
-
onChange,
|
|
96
|
-
placeHolder,
|
|
97
|
-
variant = "flat",
|
|
98
|
-
color = "default",
|
|
99
|
-
size = "sm",
|
|
100
|
-
rounded = "sm",
|
|
101
|
-
description = "",
|
|
102
|
-
errorMsg = "",
|
|
103
|
-
hasError = false,
|
|
104
|
-
}: IInputProps) => {
|
|
105
|
-
const cls = clsx(
|
|
106
|
-
sizes[size],
|
|
107
|
-
radiuses[rounded],
|
|
108
|
-
variantFunc(variant, color, hasError),
|
|
109
|
-
);
|
|
110
|
-
return (
|
|
111
|
-
<div className="flex flex-col">
|
|
112
|
-
{label && (
|
|
113
|
-
<label
|
|
114
|
-
htmlFor={`${id}`}
|
|
115
|
-
className={`text-xs mb-2 ${hasError ? "text-base-danger" : labelColors[color]}`}
|
|
116
|
-
>
|
|
117
|
-
{label}
|
|
118
|
-
{required && <span className="text-base-danger text-sm">*</span>}
|
|
119
|
-
</label>
|
|
120
|
-
)}
|
|
121
|
-
<input
|
|
122
|
-
id={`${id}`}
|
|
123
|
-
type="text"
|
|
124
|
-
value={value}
|
|
125
|
-
onChange={(e) => onChange && onChange(e.target.value)}
|
|
126
|
-
placeholder={placeHolder}
|
|
127
|
-
className={`${cls} w-full px-3 text-sm transition-all duration-200 outline-none`}
|
|
128
|
-
/>
|
|
129
|
-
{description && !errorMsg && (
|
|
130
|
-
<p className="mt-1 text-xs text-default-400">{description}</p>
|
|
131
|
-
)}
|
|
132
|
-
{errorMsg && <p className="mt-1 mr-1 text-xs text-base-danger">{errorMsg}</p>}
|
|
133
|
-
</div>
|
|
134
|
-
);
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
export default Input;
|
package/src/components/Radio.tsx
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import clsx from "clsx";
|
|
2
|
-
import type { ReactNode } from "react";
|
|
3
|
-
|
|
4
|
-
const sizes = {
|
|
5
|
-
sm: "size-4 min-w-4 p-[3px]",
|
|
6
|
-
md: "size-5 min-w-5 p-1",
|
|
7
|
-
lg: "size-6 min-w-6 p-[5px]",
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const radioBorderColor = {
|
|
11
|
-
primary: "border-base-primary",
|
|
12
|
-
secondary: "border-base-secondary",
|
|
13
|
-
success: "border-base-success",
|
|
14
|
-
warning: "border-base-warning",
|
|
15
|
-
danger: "border-base-danger",
|
|
16
|
-
neutral: "border-default-500",
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const radioBgColor = {
|
|
20
|
-
primary: "bg-base-primary",
|
|
21
|
-
secondary: "bg-base-secondary",
|
|
22
|
-
success: "bg-base-success",
|
|
23
|
-
warning: "bg-base-warning",
|
|
24
|
-
danger: "bg-base-danger",
|
|
25
|
-
neutral: "bg-default-500",
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
interface IRadioProps {
|
|
29
|
-
name: string;
|
|
30
|
-
value?: string;
|
|
31
|
-
checked: boolean;
|
|
32
|
-
disabled?: boolean;
|
|
33
|
-
onChange?: (value: string) => void;
|
|
34
|
-
size?: "sm" | "md" | "lg";
|
|
35
|
-
color?:
|
|
36
|
-
| "primary"
|
|
37
|
-
| "secondary"
|
|
38
|
-
| "success"
|
|
39
|
-
| "warning"
|
|
40
|
-
| "danger"
|
|
41
|
-
| "neutral";
|
|
42
|
-
children?: ReactNode;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const Radio = ({
|
|
46
|
-
name,
|
|
47
|
-
value,
|
|
48
|
-
checked,
|
|
49
|
-
disabled = false,
|
|
50
|
-
onChange,
|
|
51
|
-
size = "md",
|
|
52
|
-
color = "primary",
|
|
53
|
-
children,
|
|
54
|
-
}: IRadioProps) => {
|
|
55
|
-
const cls = clsx(
|
|
56
|
-
sizes[size],
|
|
57
|
-
checked
|
|
58
|
-
? radioBorderColor[color]
|
|
59
|
-
: "border-base-default hover:bg-default-100 transition-all duration-200",
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
return (
|
|
63
|
-
<label
|
|
64
|
-
className={`flex items-center gap-2 ${disabled ? "opacity-50" : "cursor-pointer"}`}
|
|
65
|
-
>
|
|
66
|
-
<input
|
|
67
|
-
name={name}
|
|
68
|
-
type="radio"
|
|
69
|
-
value={value}
|
|
70
|
-
checked={checked}
|
|
71
|
-
onChange={(e) => onChange && onChange(e.target.value)}
|
|
72
|
-
disabled={disabled}
|
|
73
|
-
style={{ display: "none" }}
|
|
74
|
-
/>
|
|
75
|
-
<div
|
|
76
|
-
className={`flex justify-center items-center rounded-full border-2 ${cls}`}
|
|
77
|
-
>
|
|
78
|
-
{checked && (
|
|
79
|
-
<span
|
|
80
|
-
className={`block w-full h-full rounded-full ${radioBgColor[color]}`}
|
|
81
|
-
/>
|
|
82
|
-
)}
|
|
83
|
-
</div>
|
|
84
|
-
<div>{children}</div>
|
|
85
|
-
</label>
|
|
86
|
-
);
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
export default Radio;
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { Slider } from "@mui/material";
|
|
2
|
-
import type { Dispatch, SetStateAction } from "react";
|
|
3
|
-
import Tooltip from "./Tooltip";
|
|
4
|
-
|
|
5
|
-
const colors: { [key: string]: string } = {
|
|
6
|
-
foreground: "#000000",
|
|
7
|
-
primary: "#112E62",
|
|
8
|
-
secondary: "#C59C4E",
|
|
9
|
-
success: "#17C964",
|
|
10
|
-
warning: "#F5A524",
|
|
11
|
-
danger: "#F31260",
|
|
12
|
-
};
|
|
13
|
-
const shadowColors: { [key: string]: string } = {
|
|
14
|
-
foreground: "#A1A1AA",
|
|
15
|
-
primary: "#D6E0F3",
|
|
16
|
-
secondary: "#EEE1C9",
|
|
17
|
-
success: "#d1f4e0",
|
|
18
|
-
warning: "#fdedd3",
|
|
19
|
-
danger: "#fdd0df",
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
interface IRangeSliderProps {
|
|
23
|
-
value: number | number[];
|
|
24
|
-
setValue: Dispatch<SetStateAction<any>>;
|
|
25
|
-
min?: number;
|
|
26
|
-
max?: number;
|
|
27
|
-
step?: number;
|
|
28
|
-
color?:
|
|
29
|
-
| "foreground"
|
|
30
|
-
| "primary"
|
|
31
|
-
| "secondary"
|
|
32
|
-
| "success"
|
|
33
|
-
| "warning"
|
|
34
|
-
| "danger";
|
|
35
|
-
tooltipColor?:
|
|
36
|
-
| "default"
|
|
37
|
-
| "primary"
|
|
38
|
-
| "secondary"
|
|
39
|
-
| "success"
|
|
40
|
-
| "warning"
|
|
41
|
-
| "danger";
|
|
42
|
-
tooltipTextColor?: "white" | "black";
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export const RangeSlider = ({
|
|
46
|
-
value,
|
|
47
|
-
setValue,
|
|
48
|
-
min = 0,
|
|
49
|
-
max = 100,
|
|
50
|
-
step = 1,
|
|
51
|
-
color = "primary",
|
|
52
|
-
tooltipColor = "primary",
|
|
53
|
-
tooltipTextColor = "white",
|
|
54
|
-
}: IRangeSliderProps) => {
|
|
55
|
-
return (
|
|
56
|
-
<Slider
|
|
57
|
-
value={value}
|
|
58
|
-
min={min}
|
|
59
|
-
max={max}
|
|
60
|
-
step={step}
|
|
61
|
-
onChange={(_, newValue) => {
|
|
62
|
-
setValue(newValue);
|
|
63
|
-
// if (typeof newValue !== "number") setSliderValue(newValue);
|
|
64
|
-
}}
|
|
65
|
-
onChangeCommitted={(_, newValue) => {
|
|
66
|
-
// if (typeof newValue !== "number") handleChooseRange(newValue);
|
|
67
|
-
}}
|
|
68
|
-
valueLabelFormat={(value) => (
|
|
69
|
-
<Tooltip
|
|
70
|
-
color={tooltipColor}
|
|
71
|
-
textColor={tooltipTextColor}
|
|
72
|
-
label={`${value.toLocaleString()}`}
|
|
73
|
-
/>
|
|
74
|
-
)}
|
|
75
|
-
valueLabelDisplay="auto"
|
|
76
|
-
sx={{
|
|
77
|
-
width: "100%",
|
|
78
|
-
height: "4px",
|
|
79
|
-
borderRadius: "8px",
|
|
80
|
-
color: "#D4D4D8",
|
|
81
|
-
"& .MuiSlider-thumb": {
|
|
82
|
-
width: "16px",
|
|
83
|
-
height: "16px",
|
|
84
|
-
border: "2px solid",
|
|
85
|
-
borderColor: colors[color],
|
|
86
|
-
color: "#fff",
|
|
87
|
-
},
|
|
88
|
-
"& .MuiSlider-thumb.Mui-focusVisible": {
|
|
89
|
-
boxShadow: `0 0 0 4px ${shadowColors[color]}`,
|
|
90
|
-
},
|
|
91
|
-
"& .MuiSlider-thumb.Mui-active": {
|
|
92
|
-
boxShadow: `0 0 0 4px ${shadowColors[color]}`,
|
|
93
|
-
},
|
|
94
|
-
"& .MuiSlider-thumb:hover": {
|
|
95
|
-
boxShadow: `0 0 0 4px ${shadowColors[color]}`,
|
|
96
|
-
},
|
|
97
|
-
"& .MuiSlider-track": {
|
|
98
|
-
color: colors[color],
|
|
99
|
-
},
|
|
100
|
-
"& .MuiSlider-valueLabel": {
|
|
101
|
-
backgroundColor: "transparent",
|
|
102
|
-
},
|
|
103
|
-
}}
|
|
104
|
-
/>
|
|
105
|
-
);
|
|
106
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const Select = () => {
|
|
2
|
-
return (
|
|
3
|
-
<div className="w-[328px] p-2 rounded-sm bg-content-1 shadow-[0px_1px_2px_0px_#0000000F,0px_1px_3px_0px_#0000001A]">
|
|
4
|
-
<div className="flex flex-col gap-1">
|
|
5
|
-
{new Array(10).fill({}).map((_,i) => (
|
|
6
|
-
<div className="w-full h-8 py-1.5 px-2 text-sm rounded-sm hover:bg-content-2 cursor-pointer">متن</div>
|
|
7
|
-
))}
|
|
8
|
-
</div>
|
|
9
|
-
</div>
|
|
10
|
-
);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default Select;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import clsx from "clsx";
|
|
2
|
-
|
|
3
|
-
const sizes = {
|
|
4
|
-
sm: "min-w-10 min-h-6",
|
|
5
|
-
md: "min-w-12 min-h-7",
|
|
6
|
-
lg: "min-w-14 min-h-8",
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const colors: { [key: string]: string } = {
|
|
10
|
-
default: "bg-default-400",
|
|
11
|
-
primary: "bg-layout-focus",
|
|
12
|
-
secondary: "bg-base-secondary",
|
|
13
|
-
success: "bg-base-success",
|
|
14
|
-
warning: "bg-base-warning",
|
|
15
|
-
danger: "bg-base-danger",
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
interface ISwitchProps {
|
|
19
|
-
enabled: boolean;
|
|
20
|
-
onChange: () => void;
|
|
21
|
-
label?: string;
|
|
22
|
-
labelPosition?: "right" | "left";
|
|
23
|
-
size?: "sm" | "md" | "lg";
|
|
24
|
-
color?:
|
|
25
|
-
| "default"
|
|
26
|
-
| "primary"
|
|
27
|
-
| "secondary"
|
|
28
|
-
| "success"
|
|
29
|
-
| "warning"
|
|
30
|
-
| "danger";
|
|
31
|
-
disabled?: boolean;
|
|
32
|
-
}
|
|
33
|
-
const Switch = ({
|
|
34
|
-
enabled,
|
|
35
|
-
onChange,
|
|
36
|
-
label,
|
|
37
|
-
labelPosition = "left",
|
|
38
|
-
size = "md",
|
|
39
|
-
color = "default",
|
|
40
|
-
disabled = false,
|
|
41
|
-
}: ISwitchProps) => {
|
|
42
|
-
const cls = clsx(
|
|
43
|
-
labelPosition === "left" ? "flex-row" : "flex-row-reverse",
|
|
44
|
-
disabled && "opacity-50",
|
|
45
|
-
);
|
|
46
|
-
const buttonCls = clsx(
|
|
47
|
-
sizes[size],
|
|
48
|
-
enabled ? colors[color] : "bg-default-700",
|
|
49
|
-
disabled && "cursor-auto",
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<div className={`flex items-center gap-2 ${cls}`}>
|
|
54
|
-
<button
|
|
55
|
-
onClick={onChange}
|
|
56
|
-
className={`relative rounded-full transition-colors duration-300 p-1 ${buttonCls}`}
|
|
57
|
-
disabled={disabled}
|
|
58
|
-
>
|
|
59
|
-
<span
|
|
60
|
-
className={`
|
|
61
|
-
block h-[calc(100%-8px)] aspect-square rounded-full bg-content-1
|
|
62
|
-
transition-all duration-300 shadow-[0px_0px_1px_0px_#0000004D,0px_2px_10px_0px_#0000000F,0px_0px_5px_0px_#00000005]
|
|
63
|
-
absolute top-1 left-1 ${enabled && "translate-x-full"}
|
|
64
|
-
`}
|
|
65
|
-
/>
|
|
66
|
-
</button>
|
|
67
|
-
{label && (
|
|
68
|
-
<p className={`text-default-600 ${size === "sm" && "text-sm"}`}>
|
|
69
|
-
{label}
|
|
70
|
-
</p>
|
|
71
|
-
)}
|
|
72
|
-
</div>
|
|
73
|
-
);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export default Switch;
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import clsx from "clsx";
|
|
2
|
-
|
|
3
|
-
const sizes = {
|
|
4
|
-
sm: "min-h-6 text-xs",
|
|
5
|
-
md: "min-h-7 text-sm",
|
|
6
|
-
lg: "min-h-8 text-base",
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const bgColors: { [key: string]: string } = {
|
|
10
|
-
default: "bg-content-1",
|
|
11
|
-
primary: "bg-layout-focus",
|
|
12
|
-
secondary: "bg-base-secondary",
|
|
13
|
-
success: "bg-base-success",
|
|
14
|
-
warning: "bg-base-warning",
|
|
15
|
-
danger: "bg-base-danger",
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const textColors = {
|
|
19
|
-
white: "text-content-1",
|
|
20
|
-
black: "text-default-900",
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const radiuses = {
|
|
24
|
-
none: "rounded-none",
|
|
25
|
-
sm: "rounded-sm",
|
|
26
|
-
md: "rounded-md",
|
|
27
|
-
lg: "rounded-lg",
|
|
28
|
-
full: "rounded-full",
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const setArrowPosition = (direction: string, position: string) => {
|
|
32
|
-
let arrowPosition = "";
|
|
33
|
-
|
|
34
|
-
const horizontalSpace: { [key: string]: string } = {
|
|
35
|
-
start: "left-4",
|
|
36
|
-
center: "left-1/2 -translate-x-1/2",
|
|
37
|
-
end: "right-4",
|
|
38
|
-
};
|
|
39
|
-
const verticalSpace: { [key: string]: string } = {
|
|
40
|
-
start: "top-[5px]",
|
|
41
|
-
center: "top-1/2 -translate-y-1/2",
|
|
42
|
-
end: "bottom-[5px]",
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
switch (direction) {
|
|
46
|
-
case "top":
|
|
47
|
-
arrowPosition = "top-[-3px] " + horizontalSpace[position];
|
|
48
|
-
break;
|
|
49
|
-
case "right":
|
|
50
|
-
arrowPosition = "right-[-3px] " + verticalSpace[position];
|
|
51
|
-
break;
|
|
52
|
-
case "bottom":
|
|
53
|
-
arrowPosition = "bottom-[-3px] " + horizontalSpace[position];
|
|
54
|
-
break;
|
|
55
|
-
case "left":
|
|
56
|
-
arrowPosition = "left-[-3px] " + verticalSpace[position];
|
|
57
|
-
break;
|
|
58
|
-
default:
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return arrowPosition;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
interface ITooltipProps {
|
|
66
|
-
label?: string;
|
|
67
|
-
color?:
|
|
68
|
-
| "default"
|
|
69
|
-
| "primary"
|
|
70
|
-
| "secondary"
|
|
71
|
-
| "success"
|
|
72
|
-
| "warning"
|
|
73
|
-
| "danger";
|
|
74
|
-
textColor?: "black" | "white";
|
|
75
|
-
size?: "sm" | "md" | "lg";
|
|
76
|
-
rounded?: "none" | "sm" | "md" | "lg" | "full";
|
|
77
|
-
direction?: "top" | "right" | "left" | "bottom";
|
|
78
|
-
position?: "start" | "center" | "end";
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const Tooltip = ({
|
|
82
|
-
label,
|
|
83
|
-
color = "default",
|
|
84
|
-
textColor = "black",
|
|
85
|
-
size = "md",
|
|
86
|
-
rounded = "md",
|
|
87
|
-
direction = "bottom",
|
|
88
|
-
position = "center",
|
|
89
|
-
}: ITooltipProps) => {
|
|
90
|
-
const cls = clsx(
|
|
91
|
-
sizes[size],
|
|
92
|
-
bgColors[color],
|
|
93
|
-
textColors[textColor],
|
|
94
|
-
radiuses[rounded],
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
return (
|
|
98
|
-
<div className="relative">
|
|
99
|
-
<div
|
|
100
|
-
className={`max-w-[180px] relative z-10 py-1 px-3 shadow-[0px_1px_2px_0px_#0000000F,0px_1px_3px_0px_#0000001A] ${cls}`}
|
|
101
|
-
>
|
|
102
|
-
<p>{label}</p>
|
|
103
|
-
</div>
|
|
104
|
-
<div
|
|
105
|
-
className={`absolute size-2.5 rotate-45 rounded-[2px] shadow-[0px_0px_1px_0px_#0000004D,0px_2px_10px_0px_#0000000F,0px_0px_5px_0px_#00000005] ${setArrowPosition(direction, position)} ${bgColors[color]}`}
|
|
106
|
-
></div>
|
|
107
|
-
</div>
|
|
108
|
-
);
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
export default Tooltip;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const AddIcon = ({ color, size = 24 }: { color?: string; size?: number }) => {
|
|
2
|
-
return (
|
|
3
|
-
<svg
|
|
4
|
-
width={size}
|
|
5
|
-
height={size}
|
|
6
|
-
viewBox="0 0 16 16"
|
|
7
|
-
fill="none"
|
|
8
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
-
style={{color}}
|
|
10
|
-
>
|
|
11
|
-
<path
|
|
12
|
-
d="M4 8H12"
|
|
13
|
-
stroke="currentColor"
|
|
14
|
-
stroke-linecap="round"
|
|
15
|
-
stroke-linejoin="round"
|
|
16
|
-
/>
|
|
17
|
-
<path
|
|
18
|
-
d="M8 12V4"
|
|
19
|
-
stroke="currentColor"
|
|
20
|
-
stroke-linecap="round"
|
|
21
|
-
stroke-linejoin="round"
|
|
22
|
-
/>
|
|
23
|
-
</svg>
|
|
24
|
-
);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export default AddIcon;
|