dst-rg 1.0.0
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/.gitlab-ci.yml +43 -0
- package/.storybook/main.ts +15 -0
- package/.storybook/preview.ts +15 -0
- package/README.md +254 -0
- package/components.json +21 -0
- package/dist/Avatar.png +0 -0
- package/dist/assets/index-CCq7hmG3.js +186 -0
- package/dist/assets/index-Mg-hjQGu.css +1 -0
- package/dist/index.html +15 -0
- package/dist/test.png +0 -0
- package/dist/vite.svg +1 -0
- package/eslint.config.js +29 -0
- package/index.html +14 -0
- package/package.json +102 -0
- package/postcss.config.mjs +11 -0
- package/rollup.config.mjs +55 -0
- package/src/assets/react.svg +1 -0
- package/src/assets/style/animation.css +27 -0
- package/src/assets/style/box-shadow.css +25 -0
- package/src/assets/style/colors.css +402 -0
- package/src/assets/style/dark-theme.css +288 -0
- package/src/assets/style/font-size.css +14 -0
- package/src/assets/style/gradient.css +3 -0
- package/src/assets/style/index.css +12 -0
- package/src/assets/style/light-theme.css +148 -0
- package/src/assets/style/line-height.css +13 -0
- package/src/assets/style/max-width.css +5 -0
- package/src/assets/style/radius.css +13 -0
- package/src/assets/style/utility-colors.css +166 -0
- package/src/components/Accordion/_.stories.tsx +75 -0
- package/src/components/Accordion/_.test.tsx +77 -0
- package/src/components/Accordion/index.tsx +47 -0
- package/src/components/Accordion/type.ts +24 -0
- package/src/components/Avatar/_.stories.tsx +179 -0
- package/src/components/Avatar/_.style.ts +40 -0
- package/src/components/Avatar/_.test.tsx +150 -0
- package/src/components/Avatar/_.types.ts +66 -0
- package/src/components/Avatar/index.tsx +63 -0
- package/src/components/Badge/_.stories.tsx +75 -0
- package/src/components/Badge/_.style.ts +53 -0
- package/src/components/Badge/_.test.tsx +27 -0
- package/src/components/Badge/_.types.ts +11 -0
- package/src/components/Badge/index.tsx +42 -0
- package/src/components/Breadcrumbs/_.stories.tsx +95 -0
- package/src/components/Breadcrumbs/_.test.tsx +29 -0
- package/src/components/Breadcrumbs/_.type.ts +15 -0
- package/src/components/Breadcrumbs/index.tsx +103 -0
- package/src/components/Button/_.stories.tsx +85 -0
- package/src/components/Button/_.style.ts +56 -0
- package/src/components/Button/_.test.tsx +103 -0
- package/src/components/Button/_.types.ts +14 -0
- package/src/components/Button/index.tsx +70 -0
- package/src/components/Checkbox/_.stories.tsx +96 -0
- package/src/components/Checkbox/_.style.ts +24 -0
- package/src/components/Checkbox/_.test.tsx +85 -0
- package/src/components/Checkbox/_.types.ts +23 -0
- package/src/components/Checkbox/index.tsx +93 -0
- package/src/components/CheckboxGroup/PaymentCard/_.stories.tsx +104 -0
- package/src/components/CheckboxGroup/PaymentCard/_.style.ts +28 -0
- package/src/components/CheckboxGroup/PaymentCard/_.test.tsx +58 -0
- package/src/components/CheckboxGroup/PaymentCard/_.types.ts +28 -0
- package/src/components/CheckboxGroup/PaymentCard/index.tsx +71 -0
- package/src/components/CheckboxGroup/PlanCard/_.stories.tsx +165 -0
- package/src/components/CheckboxGroup/PlanCard/_.style.ts +32 -0
- package/src/components/CheckboxGroup/PlanCard/_.test.tsx +54 -0
- package/src/components/CheckboxGroup/PlanCard/_.types.ts +35 -0
- package/src/components/CheckboxGroup/PlanCard/index.tsx +53 -0
- package/src/components/CheckboxGroup/UserCard/_.stories.tsx +89 -0
- package/src/components/CheckboxGroup/UserCard/_.style.ts +42 -0
- package/src/components/CheckboxGroup/UserCard/_.test.tsx +66 -0
- package/src/components/CheckboxGroup/UserCard/_.types.ts +26 -0
- package/src/components/CheckboxGroup/UserCard/index.tsx +75 -0
- package/src/components/Dropdown/_.stories.tsx +180 -0
- package/src/components/Dropdown/_.style.ts +108 -0
- package/src/components/Dropdown/_.test.tsx +334 -0
- package/src/components/Dropdown/_.types.ts +12 -0
- package/src/components/Dropdown/index.tsx +130 -0
- package/src/components/FileUpload/_.stories.tsx +74 -0
- package/src/components/FileUpload/_.style.ts +0 -0
- package/src/components/FileUpload/_.test.tsx +222 -0
- package/src/components/FileUpload/_.types.ts +53 -0
- package/src/components/FileUpload/index.tsx +44 -0
- package/src/components/ImageMagnify/_.stories.tsx +226 -0
- package/src/components/ImageMagnify/_.style.ts +109 -0
- package/src/components/ImageMagnify/_.types.ts +44 -0
- package/src/components/ImageMagnify/index.tsx +204 -0
- package/src/components/Input/_.stories.tsx +177 -0
- package/src/components/Input/_.style.ts +79 -0
- package/src/components/Input/_.test.tsx +146 -0
- package/src/components/Input/_.types.ts +66 -0
- package/src/components/Input/index.tsx +231 -0
- package/src/components/InputTags/_.stories.tsx +51 -0
- package/src/components/InputTags/_.style.ts +28 -0
- package/src/components/InputTags/_.test.tsx +123 -0
- package/src/components/InputTags/_.types.ts +26 -0
- package/src/components/InputTags/index.tsx +140 -0
- package/src/components/Message/_.stories.tsx +79 -0
- package/src/components/Message/_.style.ts +87 -0
- package/src/components/Message/_.test.tsx +73 -0
- package/src/components/Message/_.types.ts +13 -0
- package/src/components/Message/index.tsx +57 -0
- package/src/components/Metric/_.stories.tsx +142 -0
- package/src/components/Metric/_.style.ts +14 -0
- package/src/components/Metric/_.test.tsx +166 -0
- package/src/components/Metric/_.types.ts +18 -0
- package/src/components/Metric/index.tsx +100 -0
- package/src/components/Modal/_.stories.tsx +93 -0
- package/src/components/Modal/_.style.ts +31 -0
- package/src/components/Modal/_.test.tsx +90 -0
- package/src/components/Modal/_.types.ts +14 -0
- package/src/components/Modal/index.tsx +82 -0
- package/src/components/Pagination/_.stories.tsx +118 -0
- package/src/components/Pagination/_.test.tsx +51 -0
- package/src/components/Pagination/index.tsx +256 -0
- package/src/components/Pagination/type.ts +48 -0
- package/src/components/PriceSlider/_.stories.tsx +107 -0
- package/src/components/PriceSlider/_.test.tsx +63 -0
- package/src/components/PriceSlider/_.type.tsx +19 -0
- package/src/components/PriceSlider/index.tsx +86 -0
- package/src/components/Progress/_.stories.tsx +93 -0
- package/src/components/Progress/_.style.ts +15 -0
- package/src/components/Progress/_.test.tsx +34 -0
- package/src/components/Progress/_.types.ts +17 -0
- package/src/components/Progress/index.tsx +173 -0
- package/src/components/Radio/_.stories.tsx +391 -0
- package/src/components/Radio/_.style.ts +33 -0
- package/src/components/Radio/_.test.tsx +77 -0
- package/src/components/Radio/_.types.ts +14 -0
- package/src/components/Radio/index.tsx +59 -0
- package/src/components/Select/_.stories.tsx +308 -0
- package/src/components/Select/_.style.ts +5 -0
- package/src/components/Select/_.types.ts +24 -0
- package/src/components/Select/index.tsx +172 -0
- package/src/components/Switch/_.stories.tsx +61 -0
- package/src/components/Switch/_.test.tsx +69 -0
- package/src/components/Switch/_.type.ts +12 -0
- package/src/components/Switch/index.tsx +70 -0
- package/src/components/Tabs/_.stories.tsx +508 -0
- package/src/components/Tabs/_.style.ts +63 -0
- package/src/components/Tabs/_.test.tsx +174 -0
- package/src/components/Tabs/_.type.ts +19 -0
- package/src/components/Tabs/index.tsx +35 -0
- package/src/components/Tag/_.stories.tsx +78 -0
- package/src/components/Tag/_.style.ts +71 -0
- package/src/components/Tag/_.test.tsx +44 -0
- package/src/components/Tag/_.types.ts +27 -0
- package/src/components/Tag/index.tsx +46 -0
- package/src/components/TextArea/_.stories.tsx +62 -0
- package/src/components/TextArea/_.style.ts +11 -0
- package/src/components/TextArea/_.test.tsx +43 -0
- package/src/components/TextArea/_.types.ts +29 -0
- package/src/components/TextArea/index.tsx +83 -0
- package/src/components/Toast/_.style.tsx +27 -0
- package/src/components/Toast/_.type.ts +30 -0
- package/src/components/Toast/_.utils.ts +23 -0
- package/src/components/Toast/container.tsx +171 -0
- package/src/components/Toast/index.tsx +29 -0
- package/src/components/Tooltip/_.stories.tsx +106 -0
- package/src/components/Tooltip/_.style.ts +27 -0
- package/src/components/Tooltip/_.test.tsx +54 -0
- package/src/components/Tooltip/_.types.ts +31 -0
- package/src/components/Tooltip/index.tsx +80 -0
- package/src/components/developers/AmirHossein.tsx +149 -0
- package/src/components/developers/Fardin.tsx +130 -0
- package/src/components/developers/Maryam.tsx +260 -0
- package/src/components/developers/Milad.tsx +431 -0
- package/src/components/developers/Rasoul.tsx +198 -0
- package/src/components/index.ts +28 -0
- package/src/components/ui/accordion.tsx +162 -0
- package/src/components/ui/avatars-component/avatar-description.tsx +30 -0
- package/src/components/ui/avatars-component/avatar-groups.tsx +68 -0
- package/src/components/ui/avatars-component/avatar-single.tsx +50 -0
- package/src/components/ui/card.tsx +92 -0
- package/src/components/ui/checkbox-group/plan-card/basic/_.test.tsx +66 -0
- package/src/components/ui/checkbox-group/plan-card/basic/index.tsx +70 -0
- package/src/components/ui/checkbox-group/plan-card/with-header/_.test.tsx +110 -0
- package/src/components/ui/checkbox-group/plan-card/with-header/header.test.tsx +96 -0
- package/src/components/ui/checkbox-group/plan-card/with-header/header.tsx +74 -0
- package/src/components/ui/checkbox-group/plan-card/with-header/index.tsx +65 -0
- package/src/components/ui/file-content/File-content.tsx +43 -0
- package/src/components/ui/file-uploader-components/file-uploader-box.tsx +76 -0
- package/src/components/ui/file-uploader-components/file-uploader-item.tsx +64 -0
- package/src/components/ui/icon-wrapper/_.test.tsx +60 -0
- package/src/components/ui/icon-wrapper/index.tsx +19 -0
- package/src/components/ui/input-component/input-label.tsx +11 -0
- package/src/components/ui/number.tsx +18 -0
- package/src/components/ui/pagination/card-minimal-center-align.tsx +96 -0
- package/src/components/ui/pagination/card-minimal-right-aligne.tsx +90 -0
- package/src/components/ui/pagination/default-pagination.tsx +128 -0
- package/src/components/ui/pagination/get-pagination-item.tsx +36 -0
- package/src/components/ui/pagination/pagination-card-button-group-aligned.tsx +94 -0
- package/src/components/ui/pagination/pagination-card-minimal-left-aligned.tsx +90 -0
- package/src/components/ui/pagination/pagination-content.tsx +15 -0
- package/src/components/ui/pagination/pagination-item.tsx +11 -0
- package/src/components/ui/pagination/pagination-link.tsx +42 -0
- package/src/components/ui/tab-components/tabs-content.tsx +15 -0
- package/src/components/ui/tab-components/tabs-list.tsx +27 -0
- package/src/components/ui/tab-components/tabs-trigger.tsx +25 -0
- package/src/components/ui/text-content-wrapper.tsx +36 -0
- package/src/hooks/useClickOutside.ts +23 -0
- package/src/icons/general/ArrowLeft.tsx +31 -0
- package/src/icons/general/ArrowRight.tsx +31 -0
- package/src/icons/general/activity-heart.tsx +31 -0
- package/src/icons/general/activity.tsx +31 -0
- package/src/icons/general/anchor.tsx +31 -0
- package/src/icons/general/archive.tsx +31 -0
- package/src/icons/general/arrow-left.tsx +25 -0
- package/src/icons/general/arrow-right.tsx +25 -0
- package/src/icons/general/asterisk-01.tsx +31 -0
- package/src/icons/general/asterisk-02.tsx +31 -0
- package/src/icons/general/at-sign.tsx +31 -0
- package/src/icons/general/attention-mark.tsx +43 -0
- package/src/icons/general/bookmark-add.tsx +31 -0
- package/src/icons/general/bookmark.tsx +31 -0
- package/src/icons/general/chevron-left.tsx +25 -0
- package/src/icons/general/chevron-right.tsx +25 -0
- package/src/icons/general/circle-minues.tsx +25 -0
- package/src/icons/general/circle-plus.tsx +25 -0
- package/src/icons/general/circle-question-mark.tsx +32 -0
- package/src/icons/general/circle.tsx +32 -0
- package/src/icons/general/copy.tsx +43 -0
- package/src/icons/general/email.tsx +32 -0
- package/src/icons/general/home.tsx +25 -0
- package/src/icons/general/layer.tsx +36 -0
- package/src/icons/general/leading.tsx +19 -0
- package/src/icons/general/master-card.tsx +37 -0
- package/src/icons/general/minus.tsx +36 -0
- package/src/icons/general/plus.tsx +19 -0
- package/src/icons/general/remove.tsx +32 -0
- package/src/icons/general/slash-divider.tsx +26 -0
- package/src/icons/general/tick-box.tsx +37 -0
- package/src/icons/general/trailing.tsx +19 -0
- package/src/icons/general/unkown-format.tsx +25 -0
- package/src/icons/general/visa-card.tsx +38 -0
- package/src/icons/general/x-close.tsx +35 -0
- package/src/icons/icons.type.ts +7 -0
- package/src/index.css +21 -0
- package/src/index.ts +3 -0
- package/src/lib/utils.ts +6 -0
- package/src/lib/zIndexUtils.ts +2 -0
- package/src/main.tsx +50 -0
- package/src/vite-env.d.ts +1 -0
- package/tests/setup.ts +8 -0
- package/tsconfig.app.json +31 -0
- package/tsconfig.json +7 -0
- package/tsconfig.node.json +24 -0
- package/tsconfig.rollup.json +12 -0
- package/vite.config.ts +20 -0
- package/vitest.config.ts +47 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { cn } from "@/lib/utils";
|
|
2
|
+
import { PaginationProps } from "../../Pagination/type";
|
|
3
|
+
import { PaginationContent } from "./pagination-content";
|
|
4
|
+
import { PaginationItem } from "./pagination-item";
|
|
5
|
+
import { PaginationLink } from "./pagination-link";
|
|
6
|
+
|
|
7
|
+
const PaginationCardMinimalLeftAligned = ({
|
|
8
|
+
currentPage,
|
|
9
|
+
totalPages,
|
|
10
|
+
onPageChange,
|
|
11
|
+
dir = "rtl",
|
|
12
|
+
labels,
|
|
13
|
+
previousClassName,
|
|
14
|
+
nextClassName,
|
|
15
|
+
className,
|
|
16
|
+
...props
|
|
17
|
+
}: PaginationProps) => {
|
|
18
|
+
const isRtl = dir === "rtl";
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<nav
|
|
22
|
+
role="navigation"
|
|
23
|
+
aria-label="pagination"
|
|
24
|
+
className={cn(
|
|
25
|
+
"flex w-full items-center justify-between text-sm text-muted-foreground",
|
|
26
|
+
className
|
|
27
|
+
)}
|
|
28
|
+
{...props}
|
|
29
|
+
>
|
|
30
|
+
<span>
|
|
31
|
+
{labels?.page} {currentPage} {labels?.of} {totalPages}
|
|
32
|
+
</span>
|
|
33
|
+
<PaginationContent className="flex items-center gap-2">
|
|
34
|
+
<PaginationItem>
|
|
35
|
+
<PaginationLink
|
|
36
|
+
aria-label="Go to first page"
|
|
37
|
+
size="default"
|
|
38
|
+
className="gap-1 px-2.5"
|
|
39
|
+
onClick={() => onPageChange?.(1)}
|
|
40
|
+
disabled={currentPage === 1 || totalPages < 2}
|
|
41
|
+
>
|
|
42
|
+
<span>{labels?.first}</span>
|
|
43
|
+
</PaginationLink>
|
|
44
|
+
</PaginationItem>
|
|
45
|
+
|
|
46
|
+
<PaginationItem>
|
|
47
|
+
<PaginationLink
|
|
48
|
+
aria-label="Go to previous page"
|
|
49
|
+
size="default"
|
|
50
|
+
className={cn("gap-1", previousClassName)}
|
|
51
|
+
onClick={() =>
|
|
52
|
+
onPageChange?.(isRtl ? currentPage + 1 : currentPage - 1)
|
|
53
|
+
}
|
|
54
|
+
disabled={isRtl ? currentPage === totalPages : currentPage === 1}
|
|
55
|
+
>
|
|
56
|
+
<span>{isRtl ? labels?.next : labels?.prev}</span>
|
|
57
|
+
</PaginationLink>
|
|
58
|
+
</PaginationItem>
|
|
59
|
+
|
|
60
|
+
<PaginationItem>
|
|
61
|
+
<PaginationLink
|
|
62
|
+
aria-label="Go to next page"
|
|
63
|
+
size="default"
|
|
64
|
+
className={cn("gap-1", nextClassName)}
|
|
65
|
+
onClick={() =>
|
|
66
|
+
onPageChange?.(isRtl ? currentPage - 1 : currentPage + 1)
|
|
67
|
+
}
|
|
68
|
+
disabled={isRtl ? currentPage === 1 : currentPage === totalPages}
|
|
69
|
+
>
|
|
70
|
+
<span>{isRtl ? labels?.prev : labels?.next}</span>
|
|
71
|
+
</PaginationLink>
|
|
72
|
+
</PaginationItem>
|
|
73
|
+
|
|
74
|
+
<PaginationItem>
|
|
75
|
+
<PaginationLink
|
|
76
|
+
aria-label="Go to last page"
|
|
77
|
+
size="default"
|
|
78
|
+
className="gap-1 px-2.5"
|
|
79
|
+
onClick={() => onPageChange?.(totalPages)}
|
|
80
|
+
disabled={currentPage === totalPages}
|
|
81
|
+
>
|
|
82
|
+
<span>{labels?.last}</span>
|
|
83
|
+
</PaginationLink>
|
|
84
|
+
</PaginationItem>
|
|
85
|
+
</PaginationContent>
|
|
86
|
+
</nav>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export default PaginationCardMinimalLeftAligned;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { cn } from "@/lib/utils";
|
|
2
|
+
import { ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight } from "lucide-react";
|
|
3
|
+
import { twMerge } from "tailwind-merge";
|
|
4
|
+
import { PaginationProps } from "../../Pagination/type";
|
|
5
|
+
import { getPaginationItems } from "./get-pagination-item";
|
|
6
|
+
import { PaginationContent } from "./pagination-content";
|
|
7
|
+
import { PaginationItem } from "./pagination-item";
|
|
8
|
+
import { PaginationLink } from "./pagination-link";
|
|
9
|
+
|
|
10
|
+
const DefaultPagination = ({
|
|
11
|
+
currentPage,
|
|
12
|
+
totalPages,
|
|
13
|
+
onPageChange,
|
|
14
|
+
labels,
|
|
15
|
+
previousClassName,
|
|
16
|
+
className,
|
|
17
|
+
activeClassName,
|
|
18
|
+
nextClassName,
|
|
19
|
+
dir = "rtl",
|
|
20
|
+
prevIcon,
|
|
21
|
+
nextIcon,
|
|
22
|
+
firstIcon,
|
|
23
|
+
lastIcon,
|
|
24
|
+
showFirstLast = true,
|
|
25
|
+
hasText = true,
|
|
26
|
+
}: PaginationProps) => {
|
|
27
|
+
const paginationItems = getPaginationItems(currentPage, totalPages, dir);
|
|
28
|
+
const isRtl = dir === "rtl";
|
|
29
|
+
const itemsToRender = isRtl
|
|
30
|
+
? [...paginationItems].reverse()
|
|
31
|
+
: paginationItems;
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<nav
|
|
35
|
+
role="navigation"
|
|
36
|
+
aria-label="pagination"
|
|
37
|
+
className={cn(
|
|
38
|
+
"mx-auto flex w-full justify-center",
|
|
39
|
+
dir === "rtl" ? "rtl" : "ltr",
|
|
40
|
+
className
|
|
41
|
+
)}
|
|
42
|
+
>
|
|
43
|
+
<div className={cn("flex gap-2", isRtl ? "ml-auto" : "mr-auto")}>
|
|
44
|
+
{showFirstLast && (
|
|
45
|
+
<PaginationLink
|
|
46
|
+
aria-label="Go to first page"
|
|
47
|
+
size="default"
|
|
48
|
+
className="gap-1 px-2.5"
|
|
49
|
+
onClick={() => onPageChange?.(1)}
|
|
50
|
+
disabled={currentPage === 1}
|
|
51
|
+
>
|
|
52
|
+
{isRtl ? firstIcon || <ChevronsRight /> : lastIcon || <ChevronsLeft />}
|
|
53
|
+
{
|
|
54
|
+
hasText &&
|
|
55
|
+
<span>{labels?.first}</span>
|
|
56
|
+
}
|
|
57
|
+
</PaginationLink>
|
|
58
|
+
)}
|
|
59
|
+
|
|
60
|
+
<PaginationLink
|
|
61
|
+
aria-label="Go to previous page"
|
|
62
|
+
size="default"
|
|
63
|
+
className={cn("flex items-center", previousClassName)}
|
|
64
|
+
onClick={() => onPageChange?.(currentPage - 1)}
|
|
65
|
+
disabled={currentPage === 1}
|
|
66
|
+
>
|
|
67
|
+
{isRtl ? nextIcon || <ChevronRight /> : prevIcon || <ChevronLeft />}
|
|
68
|
+
{
|
|
69
|
+
hasText &&
|
|
70
|
+
<span>{labels?.prev}</span>
|
|
71
|
+
}
|
|
72
|
+
</PaginationLink>
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
<PaginationContent>
|
|
76
|
+
{itemsToRender.map((item, index) => (
|
|
77
|
+
<PaginationItem key={index}>
|
|
78
|
+
{item === "..." ? (
|
|
79
|
+
<span className="px-2">...</span>
|
|
80
|
+
) : (
|
|
81
|
+
<PaginationLink
|
|
82
|
+
isActive={item === currentPage}
|
|
83
|
+
onClick={() => onPageChange?.(Number(item))}
|
|
84
|
+
activeClassName={twMerge(activeClassName, "rounded-md")}
|
|
85
|
+
>
|
|
86
|
+
{item}
|
|
87
|
+
</PaginationLink>
|
|
88
|
+
)}
|
|
89
|
+
</PaginationItem>
|
|
90
|
+
))}
|
|
91
|
+
</PaginationContent>
|
|
92
|
+
|
|
93
|
+
<div className={cn("flex gap-2", isRtl ? "mr-auto" : "ml-auto")}>
|
|
94
|
+
<PaginationLink
|
|
95
|
+
aria-label="Go to next page"
|
|
96
|
+
size="default"
|
|
97
|
+
className={cn("flex items-center", nextClassName)}
|
|
98
|
+
onClick={() => onPageChange?.(currentPage + 1)}
|
|
99
|
+
disabled={currentPage === totalPages}
|
|
100
|
+
>
|
|
101
|
+
{
|
|
102
|
+
hasText &&
|
|
103
|
+
<span>{labels?.next}</span>
|
|
104
|
+
}
|
|
105
|
+
{isRtl ? prevIcon || <ChevronLeft /> : nextIcon || <ChevronRight />}
|
|
106
|
+
</PaginationLink>
|
|
107
|
+
|
|
108
|
+
{showFirstLast && (
|
|
109
|
+
<PaginationLink
|
|
110
|
+
aria-label="Go to last page"
|
|
111
|
+
size="default"
|
|
112
|
+
className="gap-1 px-2.5"
|
|
113
|
+
onClick={() => onPageChange?.(totalPages)}
|
|
114
|
+
disabled={currentPage === totalPages}
|
|
115
|
+
>
|
|
116
|
+
{
|
|
117
|
+
hasText &&
|
|
118
|
+
<span>{labels?.last}</span>
|
|
119
|
+
}
|
|
120
|
+
{isRtl ? lastIcon || <ChevronsLeft /> : firstIcon || <ChevronsRight />}
|
|
121
|
+
</PaginationLink>
|
|
122
|
+
)}
|
|
123
|
+
</div>
|
|
124
|
+
</nav>
|
|
125
|
+
);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export default DefaultPagination;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export const getPaginationItems = (
|
|
2
|
+
currentPage: number,
|
|
3
|
+
totalPages: number,
|
|
4
|
+
dir: string
|
|
5
|
+
): (number | string)[] => {
|
|
6
|
+
const pages: (number | string)[] = [];
|
|
7
|
+
const isRTL = dir === "rtl";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
if (totalPages <= 6) {
|
|
11
|
+
for (let i = 1; i <= totalPages; i++) pages.push(i);
|
|
12
|
+
} else {
|
|
13
|
+
const showLeftDots = currentPage > 3;
|
|
14
|
+
const showRightDots = currentPage < totalPages - 2;
|
|
15
|
+
|
|
16
|
+
if (!showLeftDots) {
|
|
17
|
+
for (let i = 1; i <= 3; i++) pages.push(i);
|
|
18
|
+
pages.push("...", totalPages - 2, totalPages - 1, totalPages);
|
|
19
|
+
} else if (!showRightDots) {
|
|
20
|
+
pages.push(1, 2, 3, "...");
|
|
21
|
+
for (let i = totalPages - 2; i <= totalPages; i++) pages.push(i);
|
|
22
|
+
} else {
|
|
23
|
+
pages.push(
|
|
24
|
+
1,
|
|
25
|
+
"...",
|
|
26
|
+
currentPage - 1,
|
|
27
|
+
currentPage,
|
|
28
|
+
currentPage + 1,
|
|
29
|
+
"...",
|
|
30
|
+
totalPages
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return isRTL ? [...pages].reverse() : pages;
|
|
36
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
|
|
2
|
+
import { cn } from "@/lib/utils";
|
|
3
|
+
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
4
|
+
import { PaginationCardButtonGroupAlignedProps } from "../../Pagination/type";
|
|
5
|
+
import { PaginationContent } from "./pagination-content";
|
|
6
|
+
import { PaginationItem } from "./pagination-item";
|
|
7
|
+
import { PaginationLink } from "./pagination-link";
|
|
8
|
+
|
|
9
|
+
const PaginationCardButtonGroupAligned = ({
|
|
10
|
+
currentPage,
|
|
11
|
+
totalPages,
|
|
12
|
+
onPageChange,
|
|
13
|
+
dir = "rtl",
|
|
14
|
+
labels,
|
|
15
|
+
renderPageNumbers,
|
|
16
|
+
justifyClassName,
|
|
17
|
+
prevIcon,
|
|
18
|
+
nextIcon,
|
|
19
|
+
hasText
|
|
20
|
+
}: PaginationCardButtonGroupAlignedProps) => {
|
|
21
|
+
const isRTL = dir === "rtl";
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<nav
|
|
25
|
+
role="navigation"
|
|
26
|
+
aria-label="pagination"
|
|
27
|
+
className={cn("w-full flex", justifyClassName)}
|
|
28
|
+
>
|
|
29
|
+
<PaginationContent className="border border-gray-200 rounded-md">
|
|
30
|
+
<PaginationItem>
|
|
31
|
+
<PaginationLink
|
|
32
|
+
size="default"
|
|
33
|
+
className="px-3 py-1 text-sm disabled:opacity-50 flex items-center"
|
|
34
|
+
onClick={() => onPageChange?.(currentPage - 1)}
|
|
35
|
+
disabled={currentPage === 1}
|
|
36
|
+
>
|
|
37
|
+
<div className="flex items-center gap-1">
|
|
38
|
+
{isRTL ? (
|
|
39
|
+
<>
|
|
40
|
+
{prevIcon || <ChevronRight size={16} />}
|
|
41
|
+
{
|
|
42
|
+
hasText &&
|
|
43
|
+
<span className="hidden md:block">{labels?.prev}</span>
|
|
44
|
+
}
|
|
45
|
+
</>
|
|
46
|
+
) : (
|
|
47
|
+
<>
|
|
48
|
+
{nextIcon || <ChevronLeft size={16} />}
|
|
49
|
+
{
|
|
50
|
+
hasText &&
|
|
51
|
+
<span className="hidden md:block">{labels?.prev}</span>
|
|
52
|
+
}
|
|
53
|
+
</>
|
|
54
|
+
)}
|
|
55
|
+
</div>
|
|
56
|
+
</PaginationLink>
|
|
57
|
+
</PaginationItem>
|
|
58
|
+
|
|
59
|
+
{renderPageNumbers()}
|
|
60
|
+
|
|
61
|
+
<PaginationItem>
|
|
62
|
+
<PaginationLink
|
|
63
|
+
size="default"
|
|
64
|
+
className="px-3 py-1 text-sm disabled:opacity-50 flex items-center"
|
|
65
|
+
onClick={() => onPageChange?.(currentPage + 1)}
|
|
66
|
+
disabled={currentPage === totalPages}
|
|
67
|
+
>
|
|
68
|
+
<div className="flex items-center gap-1">
|
|
69
|
+
{isRTL ? (
|
|
70
|
+
<>
|
|
71
|
+
{
|
|
72
|
+
hasText &&
|
|
73
|
+
<span className="hidden md:block">{labels?.next}</span>
|
|
74
|
+
}
|
|
75
|
+
{nextIcon || <ChevronLeft size={16} />}
|
|
76
|
+
</>
|
|
77
|
+
) : (
|
|
78
|
+
<>
|
|
79
|
+
{
|
|
80
|
+
hasText &&
|
|
81
|
+
<span className="hidden md:block">{labels?.next}</span>
|
|
82
|
+
}
|
|
83
|
+
{prevIcon || <ChevronRight size={16} />}
|
|
84
|
+
</>
|
|
85
|
+
)}
|
|
86
|
+
</div>
|
|
87
|
+
</PaginationLink>
|
|
88
|
+
</PaginationItem>
|
|
89
|
+
</PaginationContent>
|
|
90
|
+
</nav>
|
|
91
|
+
);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export default PaginationCardButtonGroupAligned;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { cn } from "@/lib/utils";
|
|
2
|
+
import { PaginationProps } from "../../Pagination/type";
|
|
3
|
+
import { PaginationContent } from "./pagination-content";
|
|
4
|
+
import { PaginationItem } from "./pagination-item";
|
|
5
|
+
import { PaginationLink } from "./pagination-link";
|
|
6
|
+
|
|
7
|
+
const PaginationCardMinimalLeftAligned = ({
|
|
8
|
+
currentPage,
|
|
9
|
+
totalPages,
|
|
10
|
+
onPageChange,
|
|
11
|
+
dir = "rtl",
|
|
12
|
+
labels,
|
|
13
|
+
previousClassName,
|
|
14
|
+
nextClassName,
|
|
15
|
+
className,
|
|
16
|
+
...props
|
|
17
|
+
}: PaginationProps) => {
|
|
18
|
+
const isRtl = dir === "rtl";
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<nav
|
|
22
|
+
role="navigation"
|
|
23
|
+
aria-label="pagination"
|
|
24
|
+
className={cn(
|
|
25
|
+
"flex w-full items-center justify-between text-sm text-muted-foreground",
|
|
26
|
+
className
|
|
27
|
+
)}
|
|
28
|
+
{...props}
|
|
29
|
+
>
|
|
30
|
+
<PaginationContent className="flex gap-2 items-center">
|
|
31
|
+
<PaginationItem>
|
|
32
|
+
<PaginationLink
|
|
33
|
+
aria-label="Go to first page"
|
|
34
|
+
size="default"
|
|
35
|
+
className="gap-1 px-2.5"
|
|
36
|
+
onClick={() => onPageChange?.(1)}
|
|
37
|
+
disabled={currentPage === 1}
|
|
38
|
+
>
|
|
39
|
+
<span>{labels?.first}</span>
|
|
40
|
+
</PaginationLink>
|
|
41
|
+
</PaginationItem>
|
|
42
|
+
|
|
43
|
+
<PaginationItem>
|
|
44
|
+
<PaginationLink
|
|
45
|
+
aria-label="Go to previous page"
|
|
46
|
+
size="default"
|
|
47
|
+
className={cn("gap-1", previousClassName)}
|
|
48
|
+
onClick={() =>
|
|
49
|
+
onPageChange?.(isRtl ? currentPage + 1 : currentPage - 1)
|
|
50
|
+
}
|
|
51
|
+
disabled={isRtl ? currentPage === totalPages : currentPage === 1}
|
|
52
|
+
>
|
|
53
|
+
<span>{isRtl ? labels?.next : labels?.prev}</span>
|
|
54
|
+
</PaginationLink>
|
|
55
|
+
</PaginationItem>
|
|
56
|
+
|
|
57
|
+
<PaginationItem>
|
|
58
|
+
<PaginationLink
|
|
59
|
+
aria-label="Go to next page"
|
|
60
|
+
size="default"
|
|
61
|
+
className={cn("gap-1", nextClassName)}
|
|
62
|
+
onClick={() =>
|
|
63
|
+
onPageChange?.(isRtl ? currentPage - 1 : currentPage + 1)
|
|
64
|
+
}
|
|
65
|
+
disabled={isRtl ? currentPage === 1 : currentPage === totalPages}
|
|
66
|
+
>
|
|
67
|
+
<span>{isRtl ? labels?.prev : labels?.next}</span>
|
|
68
|
+
</PaginationLink>
|
|
69
|
+
</PaginationItem>
|
|
70
|
+
|
|
71
|
+
<PaginationItem>
|
|
72
|
+
<PaginationLink
|
|
73
|
+
aria-label="Go to last page"
|
|
74
|
+
size="default"
|
|
75
|
+
className="gap-1 px-2.5"
|
|
76
|
+
onClick={() => onPageChange?.(totalPages)}
|
|
77
|
+
disabled={currentPage === totalPages}
|
|
78
|
+
>
|
|
79
|
+
<span>{labels?.last}</span>
|
|
80
|
+
</PaginationLink>
|
|
81
|
+
</PaginationItem>
|
|
82
|
+
</PaginationContent>
|
|
83
|
+
<span>
|
|
84
|
+
{labels?.page} {currentPage} {labels?.of} {totalPages}
|
|
85
|
+
</span>
|
|
86
|
+
</nav>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export default PaginationCardMinimalLeftAligned;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { cn } from "@/lib/utils";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export const PaginationContent = React.forwardRef<
|
|
6
|
+
HTMLUListElement,
|
|
7
|
+
React.ComponentProps<"ul">
|
|
8
|
+
>(({ className, ...props }, ref) => (
|
|
9
|
+
<ul
|
|
10
|
+
ref={ref}
|
|
11
|
+
className={cn("flex flex-row items-center cursor-pointer", className)}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
));
|
|
15
|
+
PaginationContent.displayName = "PaginationContent";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { cn } from "@/lib/utils";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export const PaginationItem = React.forwardRef<
|
|
6
|
+
HTMLLIElement,
|
|
7
|
+
React.ComponentProps<"li">
|
|
8
|
+
>(({ className, ...props }, ref) => (
|
|
9
|
+
<li ref={ref} className={cn("flex items-center ", className)} {...props} />
|
|
10
|
+
));
|
|
11
|
+
PaginationItem.displayName = "PaginationItem";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { cn } from "@/lib/utils";
|
|
2
|
+
import { PaginationLinkProps } from "../../Pagination/type";
|
|
3
|
+
|
|
4
|
+
export const PaginationLink = ({
|
|
5
|
+
className,
|
|
6
|
+
isActive,
|
|
7
|
+
activeClassName,
|
|
8
|
+
disabled,
|
|
9
|
+
...props
|
|
10
|
+
}: PaginationLinkProps) => {
|
|
11
|
+
const defaultActiveClassName =
|
|
12
|
+
"rounded-md border bg-[#F9FAFB] text-[#182230] border-[#F9FAFB]";
|
|
13
|
+
const baseStyle =
|
|
14
|
+
"cursor-pointer inline-flex items-center gap-1.5 px-4 py-1.5 justify-center transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50";
|
|
15
|
+
|
|
16
|
+
const activeStyle = isActive ? activeClassName || defaultActiveClassName : "";
|
|
17
|
+
const disabledStyle = disabled ? "pointer-events-none opacity-50" : "";
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<a
|
|
21
|
+
aria-current={isActive ? "page" : undefined}
|
|
22
|
+
className={cn(
|
|
23
|
+
baseStyle,
|
|
24
|
+
isActive
|
|
25
|
+
? "border border-primary text-primary"
|
|
26
|
+
: "hover:bg-accent hover:text-accent-foreground",
|
|
27
|
+
activeStyle,
|
|
28
|
+
disabledStyle,
|
|
29
|
+
className
|
|
30
|
+
)}
|
|
31
|
+
{...props}
|
|
32
|
+
aria-disabled={disabled}
|
|
33
|
+
onClick={(e) => {
|
|
34
|
+
if (disabled) {
|
|
35
|
+
e.preventDefault();
|
|
36
|
+
} else {
|
|
37
|
+
props.onClick?.(e);
|
|
38
|
+
}
|
|
39
|
+
}}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { cn } from "@/lib/utils";
|
|
2
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
3
|
+
|
|
4
|
+
export function TabsContentComp({
|
|
5
|
+
className,
|
|
6
|
+
...props
|
|
7
|
+
}: React.ComponentProps<typeof TabsPrimitive.Content>) {
|
|
8
|
+
return (
|
|
9
|
+
<TabsPrimitive.Content
|
|
10
|
+
data-slot="tabs-content"
|
|
11
|
+
className={cn("flex-1 outline-none", className)}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { tabListVariants } from "@/components/Tabs/_.style";
|
|
2
|
+
import { TabsListProps } from "@/components/Tabs/_.type";
|
|
3
|
+
import { cn } from "@/lib/utils";
|
|
4
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
5
|
+
|
|
6
|
+
export function TabsListComp({
|
|
7
|
+
className,
|
|
8
|
+
listVariant,
|
|
9
|
+
direction = "horizontal",
|
|
10
|
+
fullWidth = false,
|
|
11
|
+
...props
|
|
12
|
+
}: Readonly<TabsListProps>) {
|
|
13
|
+
return (
|
|
14
|
+
<TabsPrimitive.List
|
|
15
|
+
data-slot="tabs-list"
|
|
16
|
+
className={cn(
|
|
17
|
+
tabListVariants({
|
|
18
|
+
fullWidth,
|
|
19
|
+
listVariant,
|
|
20
|
+
direction,
|
|
21
|
+
}),
|
|
22
|
+
className
|
|
23
|
+
)}
|
|
24
|
+
{...props}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { tabTriggerVariants } from "@/components/Tabs/_.style";
|
|
2
|
+
import { TabsTriggerProps } from "@/components/Tabs/_.type";
|
|
3
|
+
import { cn } from "@/lib/utils";
|
|
4
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
5
|
+
|
|
6
|
+
export function TabsTriggerComp({
|
|
7
|
+
className,
|
|
8
|
+
triggerVariant,
|
|
9
|
+
fullWidth,
|
|
10
|
+
...props
|
|
11
|
+
}: Readonly<TabsTriggerProps>) {
|
|
12
|
+
return (
|
|
13
|
+
<TabsPrimitive.Trigger
|
|
14
|
+
data-slot="tabs-trigger"
|
|
15
|
+
className={cn(
|
|
16
|
+
tabTriggerVariants({
|
|
17
|
+
triggerVariant,
|
|
18
|
+
fullWidth,
|
|
19
|
+
}),
|
|
20
|
+
className
|
|
21
|
+
)}
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { cn } from "@/lib/utils";
|
|
2
|
+
import { Button } from "../Button";
|
|
3
|
+
|
|
4
|
+
export default function TextContentWrapper({
|
|
5
|
+
label,
|
|
6
|
+
labelClassName,
|
|
7
|
+
handleClick,
|
|
8
|
+
description,
|
|
9
|
+
descriptionClassName,
|
|
10
|
+
}: {
|
|
11
|
+
label?: string;
|
|
12
|
+
labelClassName?: string;
|
|
13
|
+
handleClick: () => void;
|
|
14
|
+
description?: string;
|
|
15
|
+
descriptionClassName?: string;
|
|
16
|
+
}) {
|
|
17
|
+
return (
|
|
18
|
+
<div className="flex flex-col gap-1">
|
|
19
|
+
{label && (
|
|
20
|
+
<Button
|
|
21
|
+
type="button"
|
|
22
|
+
variant="linkGray"
|
|
23
|
+
className={cn("text-sm", labelClassName)}
|
|
24
|
+
onClick={handleClick}
|
|
25
|
+
>
|
|
26
|
+
{label}
|
|
27
|
+
</Button>
|
|
28
|
+
)}
|
|
29
|
+
{description && (
|
|
30
|
+
<span className={cn("text-xs text-gray-500", descriptionClassName)}>
|
|
31
|
+
{description}
|
|
32
|
+
</span>
|
|
33
|
+
)}
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
|
|
3
|
+
export const useClickOutside = (
|
|
4
|
+
ref: React.RefObject<HTMLElement | null>,
|
|
5
|
+
handler: () => void,
|
|
6
|
+
) => {
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
const listener = (event: MouseEvent | TouchEvent) => {
|
|
9
|
+
if (!ref.current || ref.current.contains(event.target as Node)) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
handler();
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
document.addEventListener("mousedown", listener);
|
|
16
|
+
document.addEventListener("touchstart", listener);
|
|
17
|
+
|
|
18
|
+
return () => {
|
|
19
|
+
document.removeEventListener("mousedown", listener);
|
|
20
|
+
document.removeEventListener("touchstart", listener);
|
|
21
|
+
};
|
|
22
|
+
}, [ref, handler]);
|
|
23
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { memo } from "react";
|
|
2
|
+
import { IconPropsType } from "../icons.type";
|
|
3
|
+
|
|
4
|
+
const MemoArrowLeft = ({
|
|
5
|
+
stroke = "#344054",
|
|
6
|
+
fill = "none",
|
|
7
|
+
width = "14",
|
|
8
|
+
height = "14",
|
|
9
|
+
}: IconPropsType) => {
|
|
10
|
+
return (
|
|
11
|
+
<svg
|
|
12
|
+
width={width}
|
|
13
|
+
height={height}
|
|
14
|
+
viewBox="0 0 14 14"
|
|
15
|
+
fill={fill}
|
|
16
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
17
|
+
>
|
|
18
|
+
<path
|
|
19
|
+
d="M12.8333 7.00002H1.16663M1.16663 7.00002L6.99996 12.8334M1.16663 7.00002L6.99996 1.16669"
|
|
20
|
+
stroke={stroke}
|
|
21
|
+
strokeWidth="1.66667"
|
|
22
|
+
strokeLinecap="round"
|
|
23
|
+
strokeLinejoin="round"
|
|
24
|
+
/>
|
|
25
|
+
</svg>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const ArrowLeft = memo(MemoArrowLeft);
|
|
30
|
+
|
|
31
|
+
export default ArrowLeft;
|