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,70 @@
|
|
|
1
|
+
import { cn } from "@/lib/utils";
|
|
2
|
+
import * as SwitchPrimitives from "@radix-ui/react-switch";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import TextContentWrapper from "../ui/text-content-wrapper";
|
|
5
|
+
import { SwitchProps } from "./_.type";
|
|
6
|
+
|
|
7
|
+
const Switch = React.forwardRef<
|
|
8
|
+
React.ComponentRef<typeof SwitchPrimitives.Root>,
|
|
9
|
+
SwitchProps
|
|
10
|
+
>(
|
|
11
|
+
(
|
|
12
|
+
{
|
|
13
|
+
className,
|
|
14
|
+
thumbClassName,
|
|
15
|
+
label,
|
|
16
|
+
labelClassName,
|
|
17
|
+
descriptionClassName,
|
|
18
|
+
description,
|
|
19
|
+
onToggle,
|
|
20
|
+
...props
|
|
21
|
+
},
|
|
22
|
+
ref
|
|
23
|
+
) => {
|
|
24
|
+
const [checked, setChecked] = React.useState(false);
|
|
25
|
+
const handleToggle = () => {
|
|
26
|
+
setChecked((prev) => !prev);
|
|
27
|
+
onToggle();
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<div
|
|
32
|
+
className={cn(
|
|
33
|
+
"flex gap-1",
|
|
34
|
+
description ? "items-start" : "items-center"
|
|
35
|
+
)}
|
|
36
|
+
>
|
|
37
|
+
<SwitchPrimitives.Root
|
|
38
|
+
ref={ref}
|
|
39
|
+
className={cn(
|
|
40
|
+
"peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-start rounded-full border-2 border-transparent transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-brand-600 data-[state=unchecked]:bg-gray-light-100",
|
|
41
|
+
className,
|
|
42
|
+
description ? "mt-0.5" : "mt-0"
|
|
43
|
+
)}
|
|
44
|
+
onCheckedChange={handleToggle}
|
|
45
|
+
checked={checked}
|
|
46
|
+
{...props}
|
|
47
|
+
>
|
|
48
|
+
<SwitchPrimitives.Thumb
|
|
49
|
+
className={cn(
|
|
50
|
+
"pointer-events-none block h-5 w-5 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:-translate-x-5 data-[state=checked]:ltr:translate-x-5 data-[state=unchecked]:-translate-x-0",
|
|
51
|
+
thumbClassName
|
|
52
|
+
)}
|
|
53
|
+
/>
|
|
54
|
+
</SwitchPrimitives.Root>
|
|
55
|
+
|
|
56
|
+
<TextContentWrapper
|
|
57
|
+
label={label}
|
|
58
|
+
labelClassName={labelClassName}
|
|
59
|
+
handleClick={handleToggle}
|
|
60
|
+
description={description}
|
|
61
|
+
descriptionClassName={descriptionClassName}
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
Switch.displayName = "Switch";
|
|
69
|
+
|
|
70
|
+
export { Switch };
|
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { TabsListProps, TabsProps, TabsTriggerProps } from "./_.type";
|
|
3
|
+
import { Tabs } from ".";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Tabs> = {
|
|
6
|
+
title: "Components/Tabs",
|
|
7
|
+
component: Tabs,
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
parameters: {
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component:
|
|
13
|
+
"Custom Tabs component built using Radix UI and styled via CVA. Supports direction, RTL, list and trigger variants, and fullWidth layout.",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
// ✅ Only include Tabs-specific props here
|
|
18
|
+
argTypes: {
|
|
19
|
+
direction: {
|
|
20
|
+
control: "inline-radio",
|
|
21
|
+
options: ["horizontal", "vertical"],
|
|
22
|
+
description:
|
|
23
|
+
"Layout direction of the Tabs (applies to root Tabs component)",
|
|
24
|
+
},
|
|
25
|
+
dir: {
|
|
26
|
+
control: "inline-radio",
|
|
27
|
+
options: ["ltr", "rtl"],
|
|
28
|
+
description: "Text direction for Tabs",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
export default meta;
|
|
33
|
+
|
|
34
|
+
// ✅ Shared content
|
|
35
|
+
const Content = (
|
|
36
|
+
<>
|
|
37
|
+
<Tabs.Content value="tab1">
|
|
38
|
+
<div className="p-4 border rounded bg-white text-black">
|
|
39
|
+
Content for Tab 1
|
|
40
|
+
</div>
|
|
41
|
+
</Tabs.Content>
|
|
42
|
+
<Tabs.Content value="tab2">
|
|
43
|
+
<div className="p-4 border rounded bg-white text-black">
|
|
44
|
+
Content for Tab 2
|
|
45
|
+
</div>
|
|
46
|
+
</Tabs.Content>
|
|
47
|
+
</>
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
export const Default: StoryObj<TabsProps> = {
|
|
51
|
+
args: {
|
|
52
|
+
defaultValue: "tab1",
|
|
53
|
+
direction: "horizontal",
|
|
54
|
+
dir: "rtl",
|
|
55
|
+
},
|
|
56
|
+
render: (args) => (
|
|
57
|
+
<Tabs {...args}>
|
|
58
|
+
<Tabs.List>
|
|
59
|
+
<Tabs.Trigger value="tab1">Tab One</Tabs.Trigger>
|
|
60
|
+
<Tabs.Trigger value="tab2">Tab Two</Tabs.Trigger>
|
|
61
|
+
</Tabs.List>
|
|
62
|
+
{Content}
|
|
63
|
+
</Tabs>
|
|
64
|
+
),
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// ✅ Story with Tabs.List variant controls
|
|
68
|
+
export const WithListVariants: StoryObj<
|
|
69
|
+
TabsProps & {
|
|
70
|
+
listVariant: TabsListProps["listVariant"];
|
|
71
|
+
fullWidth: boolean;
|
|
72
|
+
} & { triggerVariant: TabsTriggerProps["triggerVariant"]; fullWidth: boolean }
|
|
73
|
+
> = {
|
|
74
|
+
args: {
|
|
75
|
+
defaultValue: "tab1",
|
|
76
|
+
direction: "horizontal",
|
|
77
|
+
dir: "rtl",
|
|
78
|
+
listVariant: "bordered",
|
|
79
|
+
fullWidth: true,
|
|
80
|
+
},
|
|
81
|
+
argTypes: {
|
|
82
|
+
listVariant: {
|
|
83
|
+
control: "select",
|
|
84
|
+
options: ["brand", "gray", "outlined", "bordered", "minimal"],
|
|
85
|
+
description: "Visual style for the Tabs list",
|
|
86
|
+
},
|
|
87
|
+
triggerVariant: {
|
|
88
|
+
control: "select",
|
|
89
|
+
options: ["brand", "gray", "outlined", "bordered", "minimal"],
|
|
90
|
+
description: "Visual style for the Tabs list",
|
|
91
|
+
},
|
|
92
|
+
fullWidth: {
|
|
93
|
+
control: "boolean",
|
|
94
|
+
description: "Stretch list items to fill container",
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
render: ({
|
|
98
|
+
defaultValue,
|
|
99
|
+
direction,
|
|
100
|
+
dir,
|
|
101
|
+
listVariant,
|
|
102
|
+
fullWidth,
|
|
103
|
+
triggerVariant,
|
|
104
|
+
}) => (
|
|
105
|
+
<Tabs defaultValue={defaultValue} direction={direction} dir={dir}>
|
|
106
|
+
<Tabs.List
|
|
107
|
+
listVariant={listVariant}
|
|
108
|
+
direction={direction}
|
|
109
|
+
fullWidth={fullWidth}
|
|
110
|
+
>
|
|
111
|
+
<Tabs.Trigger
|
|
112
|
+
triggerVariant={triggerVariant}
|
|
113
|
+
fullWidth={fullWidth}
|
|
114
|
+
value="tab1"
|
|
115
|
+
>
|
|
116
|
+
Tab One
|
|
117
|
+
</Tabs.Trigger>
|
|
118
|
+
<Tabs.Trigger
|
|
119
|
+
triggerVariant={triggerVariant}
|
|
120
|
+
fullWidth={fullWidth}
|
|
121
|
+
value="tab2"
|
|
122
|
+
>
|
|
123
|
+
Tab Two
|
|
124
|
+
</Tabs.Trigger>
|
|
125
|
+
</Tabs.List>
|
|
126
|
+
{Content}
|
|
127
|
+
</Tabs>
|
|
128
|
+
),
|
|
129
|
+
};
|
|
130
|
+
export const WithListVariantsVertical: StoryObj<
|
|
131
|
+
TabsProps & {
|
|
132
|
+
listVariant: TabsListProps["listVariant"];
|
|
133
|
+
fullWidth: boolean;
|
|
134
|
+
} & { triggerVariant: TabsTriggerProps["triggerVariant"]; fullWidth: boolean }
|
|
135
|
+
> = {
|
|
136
|
+
args: {
|
|
137
|
+
defaultValue: "tab1",
|
|
138
|
+
direction: "vertical",
|
|
139
|
+
dir: "rtl",
|
|
140
|
+
listVariant: "bordered",
|
|
141
|
+
triggerVariant: "bordered",
|
|
142
|
+
fullWidth: true,
|
|
143
|
+
},
|
|
144
|
+
argTypes: {
|
|
145
|
+
listVariant: {
|
|
146
|
+
control: "select",
|
|
147
|
+
options: ["brand", "gray", "outlined", "bordered", "minimal"],
|
|
148
|
+
description: "Visual style for the Tabs list",
|
|
149
|
+
},
|
|
150
|
+
triggerVariant: {
|
|
151
|
+
control: "select",
|
|
152
|
+
options: ["brand", "gray", "outlined", "bordered", "minimal"],
|
|
153
|
+
description: "Visual style for the Tabs list",
|
|
154
|
+
},
|
|
155
|
+
fullWidth: {
|
|
156
|
+
control: "boolean",
|
|
157
|
+
description: "Stretch list items to fill container",
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
render: ({
|
|
161
|
+
defaultValue,
|
|
162
|
+
direction,
|
|
163
|
+
dir,
|
|
164
|
+
listVariant,
|
|
165
|
+
fullWidth,
|
|
166
|
+
triggerVariant,
|
|
167
|
+
}) => (
|
|
168
|
+
<Tabs defaultValue={defaultValue} direction={direction} dir={dir}>
|
|
169
|
+
<Tabs.List
|
|
170
|
+
listVariant={listVariant}
|
|
171
|
+
direction={direction}
|
|
172
|
+
fullWidth={fullWidth}
|
|
173
|
+
>
|
|
174
|
+
<Tabs.Trigger
|
|
175
|
+
triggerVariant={triggerVariant}
|
|
176
|
+
fullWidth={fullWidth}
|
|
177
|
+
value="tab1"
|
|
178
|
+
>
|
|
179
|
+
Tab One
|
|
180
|
+
</Tabs.Trigger>
|
|
181
|
+
<Tabs.Trigger
|
|
182
|
+
triggerVariant={triggerVariant}
|
|
183
|
+
fullWidth={fullWidth}
|
|
184
|
+
value="tab2"
|
|
185
|
+
>
|
|
186
|
+
Tab Two
|
|
187
|
+
</Tabs.Trigger>
|
|
188
|
+
</Tabs.List>
|
|
189
|
+
{Content}
|
|
190
|
+
</Tabs>
|
|
191
|
+
),
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
export const WithListVariantsminimal: StoryObj<
|
|
195
|
+
TabsProps & {
|
|
196
|
+
listVariant: TabsListProps["listVariant"];
|
|
197
|
+
fullWidth: boolean;
|
|
198
|
+
} & { triggerVariant: TabsTriggerProps["triggerVariant"]; fullWidth: boolean }
|
|
199
|
+
> = {
|
|
200
|
+
args: {
|
|
201
|
+
defaultValue: "tab1",
|
|
202
|
+
direction: "horizontal",
|
|
203
|
+
dir: "rtl",
|
|
204
|
+
listVariant: "minimal",
|
|
205
|
+
triggerVariant: "minimal",
|
|
206
|
+
fullWidth: true,
|
|
207
|
+
},
|
|
208
|
+
argTypes: {
|
|
209
|
+
listVariant: {
|
|
210
|
+
control: "select",
|
|
211
|
+
options: ["brand", "gray", "outlined", "bordered", "minimal"],
|
|
212
|
+
description: "Visual style for the Tabs list",
|
|
213
|
+
},
|
|
214
|
+
triggerVariant: {
|
|
215
|
+
control: "select",
|
|
216
|
+
options: ["brand", "gray", "outlined", "bordered", "minimal"],
|
|
217
|
+
description: "Visual style for the Tabs list",
|
|
218
|
+
},
|
|
219
|
+
fullWidth: {
|
|
220
|
+
control: "boolean",
|
|
221
|
+
description: "Stretch list items to fill container",
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
render: ({
|
|
225
|
+
defaultValue,
|
|
226
|
+
direction,
|
|
227
|
+
dir,
|
|
228
|
+
listVariant,
|
|
229
|
+
fullWidth,
|
|
230
|
+
triggerVariant,
|
|
231
|
+
}) => (
|
|
232
|
+
<Tabs defaultValue={defaultValue} direction={direction} dir={dir}>
|
|
233
|
+
<Tabs.List
|
|
234
|
+
listVariant={listVariant}
|
|
235
|
+
direction={direction}
|
|
236
|
+
fullWidth={fullWidth}
|
|
237
|
+
>
|
|
238
|
+
<Tabs.Trigger
|
|
239
|
+
triggerVariant={triggerVariant}
|
|
240
|
+
fullWidth={fullWidth}
|
|
241
|
+
value="tab1"
|
|
242
|
+
>
|
|
243
|
+
Tab One
|
|
244
|
+
</Tabs.Trigger>
|
|
245
|
+
<Tabs.Trigger
|
|
246
|
+
triggerVariant={triggerVariant}
|
|
247
|
+
fullWidth={fullWidth}
|
|
248
|
+
value="tab2"
|
|
249
|
+
>
|
|
250
|
+
Tab Two
|
|
251
|
+
</Tabs.Trigger>
|
|
252
|
+
</Tabs.List>
|
|
253
|
+
{Content}
|
|
254
|
+
</Tabs>
|
|
255
|
+
),
|
|
256
|
+
};
|
|
257
|
+
export const WithListVariantsOutlined: StoryObj<
|
|
258
|
+
TabsProps & {
|
|
259
|
+
listVariant: TabsListProps["listVariant"];
|
|
260
|
+
fullWidth: boolean;
|
|
261
|
+
} & { triggerVariant: TabsTriggerProps["triggerVariant"]; fullWidth: boolean }
|
|
262
|
+
> = {
|
|
263
|
+
args: {
|
|
264
|
+
defaultValue: "tab1",
|
|
265
|
+
direction: "horizontal",
|
|
266
|
+
dir: "rtl",
|
|
267
|
+
listVariant: "outlined",
|
|
268
|
+
triggerVariant: "outlined",
|
|
269
|
+
fullWidth: true,
|
|
270
|
+
},
|
|
271
|
+
argTypes: {
|
|
272
|
+
listVariant: {
|
|
273
|
+
control: "select",
|
|
274
|
+
options: ["brand", "gray", "outlined", "bordered", "minimal"],
|
|
275
|
+
description: "Visual style for the Tabs list",
|
|
276
|
+
},
|
|
277
|
+
triggerVariant: {
|
|
278
|
+
control: "select",
|
|
279
|
+
options: ["brand", "gray", "outlined", "bordered", "minimal"],
|
|
280
|
+
description: "Visual style for the Tabs list",
|
|
281
|
+
},
|
|
282
|
+
fullWidth: {
|
|
283
|
+
control: "boolean",
|
|
284
|
+
description: "Stretch list items to fill container",
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
render: ({
|
|
288
|
+
defaultValue,
|
|
289
|
+
direction,
|
|
290
|
+
dir,
|
|
291
|
+
listVariant,
|
|
292
|
+
fullWidth,
|
|
293
|
+
triggerVariant,
|
|
294
|
+
}) => (
|
|
295
|
+
<Tabs defaultValue={defaultValue} direction={direction} dir={dir}>
|
|
296
|
+
<Tabs.List
|
|
297
|
+
listVariant={listVariant}
|
|
298
|
+
direction={direction}
|
|
299
|
+
fullWidth={fullWidth}
|
|
300
|
+
>
|
|
301
|
+
<Tabs.Trigger
|
|
302
|
+
triggerVariant={triggerVariant}
|
|
303
|
+
fullWidth={fullWidth}
|
|
304
|
+
value="tab1"
|
|
305
|
+
>
|
|
306
|
+
Tab One
|
|
307
|
+
</Tabs.Trigger>
|
|
308
|
+
<Tabs.Trigger
|
|
309
|
+
triggerVariant={triggerVariant}
|
|
310
|
+
fullWidth={fullWidth}
|
|
311
|
+
value="tab2"
|
|
312
|
+
>
|
|
313
|
+
Tab Two
|
|
314
|
+
</Tabs.Trigger>
|
|
315
|
+
</Tabs.List>
|
|
316
|
+
{Content}
|
|
317
|
+
</Tabs>
|
|
318
|
+
),
|
|
319
|
+
};
|
|
320
|
+
export const WithListVariantsBordered: StoryObj<
|
|
321
|
+
TabsProps & {
|
|
322
|
+
listVariant: TabsListProps["listVariant"];
|
|
323
|
+
fullWidth: boolean;
|
|
324
|
+
} & { triggerVariant: TabsTriggerProps["triggerVariant"]; fullWidth: boolean }
|
|
325
|
+
> = {
|
|
326
|
+
args: {
|
|
327
|
+
defaultValue: "tab1",
|
|
328
|
+
direction: "horizontal",
|
|
329
|
+
dir: "rtl",
|
|
330
|
+
listVariant: "bordered",
|
|
331
|
+
triggerVariant: "bordered",
|
|
332
|
+
fullWidth: true,
|
|
333
|
+
},
|
|
334
|
+
argTypes: {
|
|
335
|
+
listVariant: {
|
|
336
|
+
control: "select",
|
|
337
|
+
options: ["brand", "gray", "outlined", "bordered", "minimal"],
|
|
338
|
+
description: "Visual style for the Tabs list",
|
|
339
|
+
},
|
|
340
|
+
triggerVariant: {
|
|
341
|
+
control: "select",
|
|
342
|
+
options: ["brand", "gray", "outlined", "bordered", "minimal"],
|
|
343
|
+
description: "Visual style for the Tabs list",
|
|
344
|
+
},
|
|
345
|
+
fullWidth: {
|
|
346
|
+
control: "boolean",
|
|
347
|
+
description: "Stretch list items to fill container",
|
|
348
|
+
},
|
|
349
|
+
},
|
|
350
|
+
render: ({
|
|
351
|
+
defaultValue,
|
|
352
|
+
direction,
|
|
353
|
+
dir,
|
|
354
|
+
listVariant,
|
|
355
|
+
fullWidth,
|
|
356
|
+
triggerVariant,
|
|
357
|
+
}) => (
|
|
358
|
+
<Tabs defaultValue={defaultValue} direction={direction} dir={dir}>
|
|
359
|
+
<Tabs.List
|
|
360
|
+
listVariant={listVariant}
|
|
361
|
+
direction={direction}
|
|
362
|
+
fullWidth={fullWidth}
|
|
363
|
+
>
|
|
364
|
+
<Tabs.Trigger
|
|
365
|
+
triggerVariant={triggerVariant}
|
|
366
|
+
fullWidth={fullWidth}
|
|
367
|
+
value="tab1"
|
|
368
|
+
>
|
|
369
|
+
Tab One
|
|
370
|
+
</Tabs.Trigger>
|
|
371
|
+
<Tabs.Trigger
|
|
372
|
+
triggerVariant={triggerVariant}
|
|
373
|
+
fullWidth={fullWidth}
|
|
374
|
+
value="tab2"
|
|
375
|
+
>
|
|
376
|
+
Tab Two
|
|
377
|
+
</Tabs.Trigger>
|
|
378
|
+
</Tabs.List>
|
|
379
|
+
{Content}
|
|
380
|
+
</Tabs>
|
|
381
|
+
),
|
|
382
|
+
};
|
|
383
|
+
export const WithListVariantsBrand: StoryObj<
|
|
384
|
+
TabsProps & {
|
|
385
|
+
listVariant: TabsListProps["listVariant"];
|
|
386
|
+
fullWidth: boolean;
|
|
387
|
+
} & { triggerVariant: TabsTriggerProps["triggerVariant"]; fullWidth: boolean }
|
|
388
|
+
> = {
|
|
389
|
+
args: {
|
|
390
|
+
defaultValue: "tab1",
|
|
391
|
+
direction: "horizontal",
|
|
392
|
+
dir: "rtl",
|
|
393
|
+
listVariant: "brand",
|
|
394
|
+
triggerVariant: "brand",
|
|
395
|
+
fullWidth: true,
|
|
396
|
+
},
|
|
397
|
+
argTypes: {
|
|
398
|
+
listVariant: {
|
|
399
|
+
control: "select",
|
|
400
|
+
options: ["brand", "gray", "outlined", "bordered", "minimal"],
|
|
401
|
+
description: "Visual style for the Tabs list",
|
|
402
|
+
},
|
|
403
|
+
triggerVariant: {
|
|
404
|
+
control: "select",
|
|
405
|
+
options: ["brand", "gray", "outlined", "bordered", "minimal"],
|
|
406
|
+
description: "Visual style for the Tabs list",
|
|
407
|
+
},
|
|
408
|
+
fullWidth: {
|
|
409
|
+
control: "boolean",
|
|
410
|
+
description: "Stretch list items to fill container",
|
|
411
|
+
},
|
|
412
|
+
},
|
|
413
|
+
render: ({
|
|
414
|
+
defaultValue,
|
|
415
|
+
direction,
|
|
416
|
+
dir,
|
|
417
|
+
listVariant,
|
|
418
|
+
fullWidth,
|
|
419
|
+
triggerVariant,
|
|
420
|
+
}) => (
|
|
421
|
+
<Tabs defaultValue={defaultValue} direction={direction} dir={dir}>
|
|
422
|
+
<Tabs.List
|
|
423
|
+
listVariant={listVariant}
|
|
424
|
+
direction={direction}
|
|
425
|
+
fullWidth={fullWidth}
|
|
426
|
+
>
|
|
427
|
+
<Tabs.Trigger
|
|
428
|
+
triggerVariant={triggerVariant}
|
|
429
|
+
fullWidth={fullWidth}
|
|
430
|
+
value="tab1"
|
|
431
|
+
>
|
|
432
|
+
Tab One
|
|
433
|
+
</Tabs.Trigger>
|
|
434
|
+
<Tabs.Trigger
|
|
435
|
+
triggerVariant={triggerVariant}
|
|
436
|
+
fullWidth={fullWidth}
|
|
437
|
+
value="tab2"
|
|
438
|
+
>
|
|
439
|
+
Tab Two
|
|
440
|
+
</Tabs.Trigger>
|
|
441
|
+
</Tabs.List>
|
|
442
|
+
{Content}
|
|
443
|
+
</Tabs>
|
|
444
|
+
),
|
|
445
|
+
};
|
|
446
|
+
export const WithListVariantsGray: StoryObj<
|
|
447
|
+
TabsProps & {
|
|
448
|
+
listVariant: TabsListProps["listVariant"];
|
|
449
|
+
fullWidth: boolean;
|
|
450
|
+
} & { triggerVariant: TabsTriggerProps["triggerVariant"]; fullWidth: boolean }
|
|
451
|
+
> = {
|
|
452
|
+
args: {
|
|
453
|
+
defaultValue: "tab1",
|
|
454
|
+
direction: "horizontal",
|
|
455
|
+
dir: "rtl",
|
|
456
|
+
listVariant: "gray",
|
|
457
|
+
triggerVariant: "gray",
|
|
458
|
+
fullWidth: true,
|
|
459
|
+
},
|
|
460
|
+
argTypes: {
|
|
461
|
+
listVariant: {
|
|
462
|
+
control: "select",
|
|
463
|
+
options: ["brand", "gray", "outlined", "bordered", "minimal"],
|
|
464
|
+
description: "Visual style for the Tabs list",
|
|
465
|
+
},
|
|
466
|
+
triggerVariant: {
|
|
467
|
+
control: "select",
|
|
468
|
+
options: ["brand", "gray", "outlined", "bordered", "minimal"],
|
|
469
|
+
description: "Visual style for the Tabs list",
|
|
470
|
+
},
|
|
471
|
+
fullWidth: {
|
|
472
|
+
control: "boolean",
|
|
473
|
+
description: "Stretch list items to fill container",
|
|
474
|
+
},
|
|
475
|
+
},
|
|
476
|
+
render: ({
|
|
477
|
+
defaultValue,
|
|
478
|
+
direction,
|
|
479
|
+
dir,
|
|
480
|
+
listVariant,
|
|
481
|
+
fullWidth,
|
|
482
|
+
triggerVariant,
|
|
483
|
+
}) => (
|
|
484
|
+
<Tabs defaultValue={defaultValue} direction={direction} dir={dir}>
|
|
485
|
+
<Tabs.List
|
|
486
|
+
listVariant={listVariant}
|
|
487
|
+
direction={direction}
|
|
488
|
+
fullWidth={fullWidth}
|
|
489
|
+
>
|
|
490
|
+
<Tabs.Trigger
|
|
491
|
+
triggerVariant={triggerVariant}
|
|
492
|
+
fullWidth={fullWidth}
|
|
493
|
+
value="tab1"
|
|
494
|
+
>
|
|
495
|
+
Tab One
|
|
496
|
+
</Tabs.Trigger>
|
|
497
|
+
<Tabs.Trigger
|
|
498
|
+
triggerVariant={triggerVariant}
|
|
499
|
+
fullWidth={fullWidth}
|
|
500
|
+
value="tab2"
|
|
501
|
+
>
|
|
502
|
+
Tab Two
|
|
503
|
+
</Tabs.Trigger>
|
|
504
|
+
</Tabs.List>
|
|
505
|
+
{Content}
|
|
506
|
+
</Tabs>
|
|
507
|
+
),
|
|
508
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
|
|
3
|
+
const basetabListStyles =
|
|
4
|
+
" text-muted-foreground inline-flex flex-row h-9 items-center";
|
|
5
|
+
|
|
6
|
+
const listVariantStyle = {
|
|
7
|
+
brand: "",
|
|
8
|
+
gray: "",
|
|
9
|
+
outlined: "border-b border-rborder-secondary gap-2",
|
|
10
|
+
bordered:
|
|
11
|
+
"rounded-lg border border-rborder-secondary bg-rbg-secondary-alt p-1",
|
|
12
|
+
minimal:
|
|
13
|
+
" rounded-md border border-rborder-secondary bg-rbg-secondary-alt !gap-0.5",
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const tabListVariants = cva(basetabListStyles, {
|
|
17
|
+
variants: {
|
|
18
|
+
listVariant: listVariantStyle,
|
|
19
|
+
fullWidth: {
|
|
20
|
+
true: "justify-between",
|
|
21
|
+
false: "justify-start gap-1",
|
|
22
|
+
},
|
|
23
|
+
direction: {
|
|
24
|
+
vertical: "flex-col min-h-fit max-w-fit ",
|
|
25
|
+
horizontal: "flex-row w-full",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
defaultVariants: {
|
|
29
|
+
listVariant: "brand",
|
|
30
|
+
fullWidth: true,
|
|
31
|
+
direction: "horizontal",
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const basetabTriggerStyles =
|
|
36
|
+
" h-full py-2 px-3 cursor-pointer inline-flex items-center justify-center gap-2 text-sm font-normal whitespace-nowrap transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4";
|
|
37
|
+
|
|
38
|
+
const TriggerVariantStyle = {
|
|
39
|
+
brand:
|
|
40
|
+
"text-rtext-quaternary-500 data-[state=active]:rounded-sm data-[state=active]:bg-rbg-brand-primary-alt data-[state=active]:text-rtext-brand-secondary-700 ",
|
|
41
|
+
gray: "text-rtext-quaternary-500 data-[state=active]:rounded-sm data-[state=active]:bg-rbg-active data-[state=active]:text-rtext-secondary-700 ",
|
|
42
|
+
outlined:
|
|
43
|
+
"text-rtext-quaternary-500 data-[state=active]:text-rtext-brand-secondary-700 pb-2.5 data-[state=active]:pb-2 data-[state=active]:border-b-2 data-[state=active]:border-rgf-brand-primary-alt",
|
|
44
|
+
bordered:
|
|
45
|
+
"text-rtext-quaternary-500 data-[state=active]:rounded-sm data-[state=active]:text-rtext-secondary-700 data-[state=active]:bg-rbg-primary-alt data-[state=active]:shadow-sm",
|
|
46
|
+
|
|
47
|
+
minimal:
|
|
48
|
+
"text-rtext-quaternary-500 data-[state=active]:rounded-md data-[state=active]:text-rtext-secondary-700 data-[state=active]:bg-rbg-primary-alt data-[state=active]:border data-[state=active]:border-rborder-primary data-[state=active]:shadow-xs",
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const tabTriggerVariants = cva(basetabTriggerStyles, {
|
|
52
|
+
variants: {
|
|
53
|
+
triggerVariant: TriggerVariantStyle,
|
|
54
|
+
fullWidth: {
|
|
55
|
+
true: "w-full",
|
|
56
|
+
false: "w-fit justify-start gap-1 items-center",
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
defaultVariants: {
|
|
60
|
+
triggerVariant: "gray",
|
|
61
|
+
fullWidth: true,
|
|
62
|
+
},
|
|
63
|
+
});
|