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/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "am-shared-assets",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"author": "Matt Pocock <team@totaltypescript.com> (https://totaltypescript.com)",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"description": "",
|
|
7
|
+
"module": "./dist/am-shared-assets.js",
|
|
8
|
+
"files": ["dist"],
|
|
10
9
|
"scripts": {
|
|
11
10
|
"dev": "vite",
|
|
12
11
|
"build": "tsc -b && vite build",
|
package/.gitlab-ci.yml
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
stages:
|
|
2
|
-
- build
|
|
3
|
-
- deploy
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
before_script:
|
|
7
|
-
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
|
8
|
-
|
|
9
|
-
build:
|
|
10
|
-
stage: build
|
|
11
|
-
environment: production
|
|
12
|
-
script:
|
|
13
|
-
- docker compose build
|
|
14
|
-
- docker compose push
|
|
15
|
-
only:
|
|
16
|
-
- main
|
|
17
|
-
tags:
|
|
18
|
-
- build
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
deploy:
|
|
22
|
-
stage: deploy
|
|
23
|
-
environment: production
|
|
24
|
-
script:
|
|
25
|
-
- docker compose pull
|
|
26
|
-
- docker compose up -d --force-recreate
|
|
27
|
-
only:
|
|
28
|
-
- main
|
|
29
|
-
when: manual
|
|
30
|
-
tags:
|
|
31
|
-
- prod
|
package/.storybook/main.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { StorybookConfig } from '@storybook/react-vite';
|
|
2
|
-
|
|
3
|
-
const config: StorybookConfig = {
|
|
4
|
-
"stories": [
|
|
5
|
-
"../src/**/*.mdx",
|
|
6
|
-
"../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"
|
|
7
|
-
],
|
|
8
|
-
"addons": [
|
|
9
|
-
"@chromatic-com/storybook",
|
|
10
|
-
"@storybook/addon-vitest",
|
|
11
|
-
"@storybook/addon-a11y",
|
|
12
|
-
"@storybook/addon-docs",
|
|
13
|
-
"@storybook/addon-onboarding"
|
|
14
|
-
],
|
|
15
|
-
"framework": "@storybook/react-vite"
|
|
16
|
-
};
|
|
17
|
-
export default config;
|
package/.storybook/preview.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Preview } from '@storybook/react-vite'
|
|
2
|
-
import "./../src/index.css"
|
|
3
|
-
|
|
4
|
-
const preview: Preview = {
|
|
5
|
-
parameters: {
|
|
6
|
-
controls: {
|
|
7
|
-
matchers: {
|
|
8
|
-
color: /(background|color)$/i,
|
|
9
|
-
date: /Date$/i,
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
a11y: {
|
|
14
|
-
// 'todo' - show a11y violations in the test UI only
|
|
15
|
-
// 'error' - fail CI on a11y violations
|
|
16
|
-
// 'off' - skip a11y checks entirely
|
|
17
|
-
test: 'todo'
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export default preview;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as a11yAddonAnnotations from "@storybook/addon-a11y/preview";
|
|
2
|
-
import { setProjectAnnotations } from '@storybook/react-vite';
|
|
3
|
-
import * as projectAnnotations from './preview';
|
|
4
|
-
|
|
5
|
-
// This is an important step to apply the right configuration when testing your stories.
|
|
6
|
-
// More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations
|
|
7
|
-
setProjectAnnotations([a11yAddonAnnotations, projectAnnotations]);
|
package/Dockerfile
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
FROM node:24-alpine AS base
|
|
2
|
-
|
|
3
|
-
ENV NEXT_TELEMETRY_DISABLED=1
|
|
4
|
-
ENV PNPM_HOME="/pnpm"
|
|
5
|
-
ENV PATH="$PNPM_HOME:$PATH"
|
|
6
|
-
|
|
7
|
-
#RUN npm config set registry https://repository.aghsatmarket.com/repository/npm-proxy/
|
|
8
|
-
RUN npm install -g corepack@latest serve
|
|
9
|
-
RUN corepack enable
|
|
10
|
-
|
|
11
|
-
WORKDIR /app
|
|
12
|
-
|
|
13
|
-
# Dependencies
|
|
14
|
-
FROM base AS dependencies
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
COPY package.json package-lock.json ./
|
|
18
|
-
RUN npm install
|
|
19
|
-
# install lightweight static file server
|
|
20
|
-
|
|
21
|
-
# Build Storybook
|
|
22
|
-
FROM base AS build
|
|
23
|
-
|
|
24
|
-
COPY --from=dependencies /app/node_modules ./node_modules
|
|
25
|
-
COPY . .
|
|
26
|
-
|
|
27
|
-
RUN npm run build-storybook
|
|
28
|
-
|
|
29
|
-
# Production runtime
|
|
30
|
-
FROM nginx:latest AS run
|
|
31
|
-
|
|
32
|
-
COPY --from=build /app/storybook-static /usr/share/nginx/html
|
|
33
|
-
|
|
34
|
-
EXPOSE 80
|
|
35
|
-
|
|
36
|
-
CMD ["nginx", "-g", "daemon off;"]
|
package/docker-compose.yml
DELETED
package/eslint.config.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format
|
|
2
|
-
import storybook from "eslint-plugin-storybook";
|
|
3
|
-
|
|
4
|
-
import js from '@eslint/js'
|
|
5
|
-
import globals from 'globals'
|
|
6
|
-
import reactHooks from 'eslint-plugin-react-hooks'
|
|
7
|
-
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
8
|
-
import tseslint from 'typescript-eslint'
|
|
9
|
-
import { defineConfig, globalIgnores } from 'eslint/config'
|
|
10
|
-
|
|
11
|
-
export default defineConfig([globalIgnores(['dist']), {
|
|
12
|
-
files: ['**/*.{ts,tsx}'],
|
|
13
|
-
extends: [
|
|
14
|
-
js.configs.recommended,
|
|
15
|
-
tseslint.configs.recommended,
|
|
16
|
-
reactHooks.configs.flat.recommended,
|
|
17
|
-
reactRefresh.configs.vite,
|
|
18
|
-
],
|
|
19
|
-
languageOptions: {
|
|
20
|
-
ecmaVersion: 2020,
|
|
21
|
-
globals: globals.browser,
|
|
22
|
-
},
|
|
23
|
-
}, ...storybook.configs["flat/recommended"]])
|
package/index.html
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>shared-assets</title>
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<div id="root"></div>
|
|
11
|
-
<script type="module" src="/src/main.tsx"></script>
|
|
12
|
-
</body>
|
|
13
|
-
</html>
|
package/postcss.config.js
DELETED
package/src/App.tsx
DELETED
package/src/components/Alert.tsx
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
import {
|
|
3
|
-
CloseIcon,
|
|
4
|
-
InfoIcon,
|
|
5
|
-
CloseCircleIcon,
|
|
6
|
-
TickCircleIcon,
|
|
7
|
-
WarningIcon,
|
|
8
|
-
} from "../icons";
|
|
9
|
-
import clsx from "clsx";
|
|
10
|
-
|
|
11
|
-
const sizes: { [key: string]: string } = {
|
|
12
|
-
sm: "text-xs",
|
|
13
|
-
md: "text-sm",
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const widths: { [key: string]: string } = {
|
|
17
|
-
default: "w-[342px] min-w-[342px]",
|
|
18
|
-
full: "w-full",
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const bgColors: { [key: string]: string } = {
|
|
22
|
-
default: "bg-default-100",
|
|
23
|
-
primary: "bg-primary-50",
|
|
24
|
-
secondary: "bg-secondary-50",
|
|
25
|
-
success: "bg-success-50",
|
|
26
|
-
warning: "bg-warning-50",
|
|
27
|
-
danger: "bg-danger-50",
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const titleColors: { [key: string]: string } = {
|
|
31
|
-
default: "text-default-900",
|
|
32
|
-
primary: "text-base-primary",
|
|
33
|
-
secondary: "text-base-secondary",
|
|
34
|
-
success: "text-base-success",
|
|
35
|
-
warning: "text-default-900",
|
|
36
|
-
danger: "text-base-danger",
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const descriptionColors: { [key: string]: string } = {
|
|
40
|
-
default: "text-default-600",
|
|
41
|
-
primary: "text-base-primary",
|
|
42
|
-
secondary: "text-base-secondary",
|
|
43
|
-
success: "text-base-success",
|
|
44
|
-
warning: "text-default-600",
|
|
45
|
-
danger: "text-base-danger",
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const buttonBgColors: { [key: string]: string } = {
|
|
49
|
-
default: "bg-default-300",
|
|
50
|
-
primary: "bg-base-primary",
|
|
51
|
-
secondary: "bg-base-secondary",
|
|
52
|
-
success: "bg-base-success",
|
|
53
|
-
warning: "bg-base-warning",
|
|
54
|
-
danger: "bg-base-danger",
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const buttonTextColors: { [key: string]: string } = {
|
|
58
|
-
white: "text-white",
|
|
59
|
-
black: "text-default-900",
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const closeButtonColors: { [key: string]: string } = {
|
|
63
|
-
default: "#a1a1aa",
|
|
64
|
-
primary: "#A9BCE3",
|
|
65
|
-
secondary: "#E2CDA6",
|
|
66
|
-
success: "#a2e9c1",
|
|
67
|
-
warning: "#fbdba7",
|
|
68
|
-
danger: "#faa0bf",
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const infoIconAlignments: { [key: string]: string } = {
|
|
72
|
-
start: "items-start",
|
|
73
|
-
center: "items-center",
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const infoIconColors: { [key: string]: string } = {
|
|
77
|
-
default: "#000",
|
|
78
|
-
primary: "#112E62",
|
|
79
|
-
secondary: "#C59C4E",
|
|
80
|
-
success: "#17c964",
|
|
81
|
-
warning: "#f5a524",
|
|
82
|
-
danger: "#f31260",
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
const alertIcons: { [key: string]: ReactNode } = {
|
|
86
|
-
success: <TickCircleIcon color="#17C964" />,
|
|
87
|
-
warning: <WarningIcon color="#F5A524" />,
|
|
88
|
-
danger: <CloseCircleIcon color="#F31260" />,
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const radiuses: { [key: string]: string } = {
|
|
92
|
-
none: "rounded-none",
|
|
93
|
-
sm: "rounded-md",
|
|
94
|
-
md: "rounded-xl",
|
|
95
|
-
lg: "rounded-[22px]",
|
|
96
|
-
full: "rounded-full",
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
interface AlertProps {
|
|
100
|
-
title?: string;
|
|
101
|
-
description?: string;
|
|
102
|
-
color?:
|
|
103
|
-
| "default"
|
|
104
|
-
| "primary"
|
|
105
|
-
| "secondary"
|
|
106
|
-
| "success"
|
|
107
|
-
| "warning"
|
|
108
|
-
| "danger";
|
|
109
|
-
size?: "sm" | "md";
|
|
110
|
-
width?: "default" | "full";
|
|
111
|
-
rounded?: "none" | "sm" | "md" | "lg" | "full";
|
|
112
|
-
infoIconAlignment?: "start" | "center";
|
|
113
|
-
isInfoIcon?: boolean;
|
|
114
|
-
hasCloseButton?: boolean;
|
|
115
|
-
hasButton?: boolean;
|
|
116
|
-
buttonTitle?: string;
|
|
117
|
-
buttonTextColor?: "black" | "white";
|
|
118
|
-
buttonClickHandler?: () => void;
|
|
119
|
-
closeAlertHandler?: () => void;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export const Alert = ({
|
|
123
|
-
title,
|
|
124
|
-
description,
|
|
125
|
-
color = "default",
|
|
126
|
-
size = "md",
|
|
127
|
-
width = "default",
|
|
128
|
-
rounded = "none",
|
|
129
|
-
infoIconAlignment,
|
|
130
|
-
isInfoIcon = true,
|
|
131
|
-
hasCloseButton = true,
|
|
132
|
-
hasButton = false,
|
|
133
|
-
buttonTitle,
|
|
134
|
-
buttonTextColor = "black",
|
|
135
|
-
buttonClickHandler,
|
|
136
|
-
closeAlertHandler,
|
|
137
|
-
}: AlertProps) => {
|
|
138
|
-
const cls = clsx(
|
|
139
|
-
widths[width],
|
|
140
|
-
sizes[size],
|
|
141
|
-
radiuses[rounded],
|
|
142
|
-
bgColors[color],
|
|
143
|
-
);
|
|
144
|
-
|
|
145
|
-
return (
|
|
146
|
-
<div className={`relative flex justify-between p-3 ${cls}`}>
|
|
147
|
-
<div
|
|
148
|
-
className={`flex ${infoIconAlignment ? infoIconAlignments[infoIconAlignment] : hasButton ? "items-center" : title && description ? "items-start" : "items-center"} gap-3`}
|
|
149
|
-
>
|
|
150
|
-
<div className="mt-[1px]">
|
|
151
|
-
{isInfoIcon || !alertIcons[color] ? (
|
|
152
|
-
<InfoIcon color={infoIconColors[color]} />
|
|
153
|
-
) : (
|
|
154
|
-
alertIcons[color]
|
|
155
|
-
)}
|
|
156
|
-
</div>
|
|
157
|
-
<div>
|
|
158
|
-
{title && (
|
|
159
|
-
<h2 className={`font-semibold ${titleColors[color]}`}>{title}</h2>
|
|
160
|
-
)}
|
|
161
|
-
{description && (
|
|
162
|
-
<p className={descriptionColors[color]}>{description}</p>
|
|
163
|
-
)}
|
|
164
|
-
</div>
|
|
165
|
-
</div>
|
|
166
|
-
{hasButton ? (
|
|
167
|
-
<div className="flex items-center">
|
|
168
|
-
<button
|
|
169
|
-
onClick={buttonClickHandler}
|
|
170
|
-
className={`h-8 px-3 rounded-md ${buttonBgColors[color]} ${buttonTextColors[buttonTextColor]}`}
|
|
171
|
-
>
|
|
172
|
-
{buttonTitle}
|
|
173
|
-
</button>
|
|
174
|
-
{hasCloseButton && (
|
|
175
|
-
<button
|
|
176
|
-
onClick={closeAlertHandler}
|
|
177
|
-
className="absolute -top-1 -left-1 border border-default-300 bg-default-100 rounded-full"
|
|
178
|
-
>
|
|
179
|
-
<CloseIcon color={closeButtonColors["default"]} size={14} />
|
|
180
|
-
</button>
|
|
181
|
-
)}
|
|
182
|
-
</div>
|
|
183
|
-
) : (
|
|
184
|
-
hasCloseButton && (
|
|
185
|
-
<div>
|
|
186
|
-
<button onClick={closeAlertHandler}>
|
|
187
|
-
<CloseIcon color={closeButtonColors[color]} />
|
|
188
|
-
</button>
|
|
189
|
-
</div>
|
|
190
|
-
)
|
|
191
|
-
)}
|
|
192
|
-
</div>
|
|
193
|
-
);
|
|
194
|
-
};
|
package/src/components/Badge.tsx
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import clsx from "clsx";
|
|
2
|
-
|
|
3
|
-
const sizes = {
|
|
4
|
-
sm: "h-5 text-xs px-2",
|
|
5
|
-
md: "h-6 text-sm px-2.5",
|
|
6
|
-
lg: "h-7 text-sm px-3",
|
|
7
|
-
};
|
|
8
|
-
const colors = {
|
|
9
|
-
neutral: "bg-default-500",
|
|
10
|
-
default: "bg-default-200",
|
|
11
|
-
primary: "bg-layout-focus",
|
|
12
|
-
danger: "bg-base-danger",
|
|
13
|
-
success: "bg-base-success",
|
|
14
|
-
};
|
|
15
|
-
const textColors = {
|
|
16
|
-
white: "text-content-1",
|
|
17
|
-
black: "text-layout-fg",
|
|
18
|
-
};
|
|
19
|
-
const types = {
|
|
20
|
-
pill: "rounded-full",
|
|
21
|
-
Rectangle: "rounded-xxs",
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
interface IBadgeProps {
|
|
25
|
-
label: string;
|
|
26
|
-
size?: "sm" | "md" | "lg";
|
|
27
|
-
color?: "neutral" | "default" | "primary" | "danger" | "success";
|
|
28
|
-
textColor?: "white" | "black";
|
|
29
|
-
type?: "pill" | "Rectangle";
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const Badge = ({
|
|
33
|
-
label,
|
|
34
|
-
color = "default",
|
|
35
|
-
type = "pill",
|
|
36
|
-
size = "md",
|
|
37
|
-
textColor = "black",
|
|
38
|
-
}: IBadgeProps) => {
|
|
39
|
-
const cls = clsx(
|
|
40
|
-
colors[color],
|
|
41
|
-
textColors[textColor],
|
|
42
|
-
sizes[size],
|
|
43
|
-
types[type],
|
|
44
|
-
);
|
|
45
|
-
return <div className={`flex justify-center items-center ${cls}`}>{label}</div>;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export default Badge;
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import clsx from "clsx";
|
|
2
|
-
import type { ReactNode } from "react";
|
|
3
|
-
|
|
4
|
-
const sizes = {
|
|
5
|
-
sm: "h-8 text-xs px-3",
|
|
6
|
-
md: "h-10 text-sm px-4",
|
|
7
|
-
lg: "h-12 text-base px-6",
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const textColors: { [key: string]: string } = {
|
|
11
|
-
white: "text-white",
|
|
12
|
-
black: "text-default-900",
|
|
13
|
-
default: "text-default-900",
|
|
14
|
-
primary: "text-base-primary",
|
|
15
|
-
secondary: "text-base-secondary",
|
|
16
|
-
success: "text-base-success",
|
|
17
|
-
warning: "text-base-warning",
|
|
18
|
-
danger: "text-base-danger",
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const bgColors: { [key: string]: string } = {
|
|
22
|
-
default: "bg-default-300",
|
|
23
|
-
primary: "bg-base-primary",
|
|
24
|
-
secondary: "bg-base-secondary",
|
|
25
|
-
success: "bg-base-success",
|
|
26
|
-
warning: "bg-base-warning",
|
|
27
|
-
danger: "bg-base-danger",
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const borderColors: { [key: string]: string } = {
|
|
31
|
-
default: "border-default-300",
|
|
32
|
-
primary: "border-base-primary",
|
|
33
|
-
secondary: "border-base-secondary",
|
|
34
|
-
success: "border-base-success",
|
|
35
|
-
warning: "border-base-warning",
|
|
36
|
-
danger: "border-base-danger",
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const bgFlatColors: { [key: string]: string } = {
|
|
40
|
-
default: "bg-default-100",
|
|
41
|
-
primary: "bg-primary-100",
|
|
42
|
-
secondary: "bg-secondary-100",
|
|
43
|
-
success: "bg-success-100",
|
|
44
|
-
warning: "bg-warning-100",
|
|
45
|
-
danger: "bg-danger-100",
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const radiuses = {
|
|
49
|
-
none: "rounded-none",
|
|
50
|
-
sm: "rounded-sm",
|
|
51
|
-
md: "rounded-md",
|
|
52
|
-
lg: "rounded-lg",
|
|
53
|
-
full: "rounded-full",
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const variantFunc = (variant: string, color: string, textColor: string) => {
|
|
57
|
-
let style = "";
|
|
58
|
-
|
|
59
|
-
switch (variant) {
|
|
60
|
-
case "solid":
|
|
61
|
-
style = `${bgColors[color]} ${textColors[textColor]}`;
|
|
62
|
-
break;
|
|
63
|
-
case "bordered":
|
|
64
|
-
style = `border-2 ${borderColors[color]} ${textColors[color]}`;
|
|
65
|
-
break;
|
|
66
|
-
case "light":
|
|
67
|
-
style = textColors[color];
|
|
68
|
-
break;
|
|
69
|
-
case "flat":
|
|
70
|
-
style = `${bgFlatColors[color]} ${textColors[color]}`;
|
|
71
|
-
break;
|
|
72
|
-
case "faded":
|
|
73
|
-
style = `border-2 ${borderColors["default"]} ${bgFlatColors["default"]} ${textColors[color]}`;
|
|
74
|
-
break;
|
|
75
|
-
case "shadow":
|
|
76
|
-
style = `shadow-lg ${bgColors[color]} ${textColors[textColor]}`;
|
|
77
|
-
break;
|
|
78
|
-
default:
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return style;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export interface ButtonProps {
|
|
86
|
-
variant?: "solid" | "bordered" | "light" | "flat" | "faded" | "shadow";
|
|
87
|
-
color?:
|
|
88
|
-
| "default"
|
|
89
|
-
| "primary"
|
|
90
|
-
| "secondary"
|
|
91
|
-
| "success"
|
|
92
|
-
| "warning"
|
|
93
|
-
| "danger";
|
|
94
|
-
textColor?: "black" | "white";
|
|
95
|
-
size?: "sm" | "md" | "lg";
|
|
96
|
-
rounded?: "none" | "sm" | "md" | "lg" | "full";
|
|
97
|
-
label?: string;
|
|
98
|
-
icon?: ReactNode;
|
|
99
|
-
iconPosition?: "right" | "left";
|
|
100
|
-
width?: "full" | "auto";
|
|
101
|
-
onClick?: () => void;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export const Button = ({
|
|
105
|
-
variant = "solid",
|
|
106
|
-
color = "default",
|
|
107
|
-
textColor = "black",
|
|
108
|
-
size = "md",
|
|
109
|
-
rounded = "none",
|
|
110
|
-
label,
|
|
111
|
-
icon,
|
|
112
|
-
iconPosition = "left",
|
|
113
|
-
width = "auto",
|
|
114
|
-
onClick,
|
|
115
|
-
}: ButtonProps) => {
|
|
116
|
-
const cls = clsx(
|
|
117
|
-
width === "full" ? "w-full" : "w-auto",
|
|
118
|
-
iconPosition === "right" ? "flex-row" : "flex-row-reverse",
|
|
119
|
-
radiuses[rounded],
|
|
120
|
-
sizes[size],
|
|
121
|
-
variantFunc(variant, color, textColor),
|
|
122
|
-
);
|
|
123
|
-
|
|
124
|
-
return (
|
|
125
|
-
<button
|
|
126
|
-
type="button"
|
|
127
|
-
className={
|
|
128
|
-
"flex items-center justify-center gap-2 font-semibold transition-all duration-300 " +
|
|
129
|
-
cls
|
|
130
|
-
}
|
|
131
|
-
onClick={onClick}
|
|
132
|
-
>
|
|
133
|
-
{icon}
|
|
134
|
-
{label && <p>{label}</p>}
|
|
135
|
-
</button>
|
|
136
|
-
);
|
|
137
|
-
};
|