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,14 @@
|
|
|
1
|
+
@theme inline {
|
|
2
|
+
--text-xxs: 10px;
|
|
3
|
+
--text-xs: 12px;
|
|
4
|
+
--text-sm: 14px;
|
|
5
|
+
--text-md: 16px;
|
|
6
|
+
--text-lg: 18px;
|
|
7
|
+
--text-xl: 20px;
|
|
8
|
+
--text-display-xs: 24px;
|
|
9
|
+
--text-display-sm: 30px;
|
|
10
|
+
--text-display-md: 36px;
|
|
11
|
+
--text-display-lg: 48px;
|
|
12
|
+
--text-display-xl: 60px;
|
|
13
|
+
--text-display-2xl: 72px;
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
@import "./colors.css";
|
|
2
|
+
@import "./radius.css";
|
|
3
|
+
@import "./box-shadow.css";
|
|
4
|
+
@import "./font-size.css";
|
|
5
|
+
@import "./line-height.css";
|
|
6
|
+
@import "./gradient.css";
|
|
7
|
+
@import './utility-colors.css';
|
|
8
|
+
@import './max-width.css';
|
|
9
|
+
/* must be comment when package publishing */
|
|
10
|
+
@import "./light-theme.css";
|
|
11
|
+
@import "./dark-theme.css";
|
|
12
|
+
@import "./animation.css";
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
@theme {
|
|
2
|
+
/* Light theme (default) */
|
|
3
|
+
--color-rtext-primary-900: var(--color-gray-light-900);
|
|
4
|
+
--color-rtext-primary-on-brand: var(--color-base-white);
|
|
5
|
+
--color-rtext-secondary-700: var(--color-gray-light-700);
|
|
6
|
+
--color-rtext-secondary-hover: var(--color-gray-light-800);
|
|
7
|
+
--color-rtext-secondary-on-brand: var(--color-brand-200);
|
|
8
|
+
--color-rtext-tertiary-600: var(--color-gray-light-600);
|
|
9
|
+
--color-rtext-tertiary-hover: var(--color-gray-light-700);
|
|
10
|
+
--color-rtext-tertiary-on-brand: var(--color-brand-200);
|
|
11
|
+
--color-rtext-quaternary-500: var(--color-gray-light-500);
|
|
12
|
+
--color-rtext-quaternary-on-brand: var(--color-brand-300);
|
|
13
|
+
--color-rtext-white: var(--color-base-white);
|
|
14
|
+
--color-rtext-disabled: var(--color-gray-light-500);
|
|
15
|
+
--color-rtext-placeholder: var(--color-gray-light-500);
|
|
16
|
+
--color-rtext-placeholder-subtle: var(--color-gray-light-300);
|
|
17
|
+
--color-rtext-brand-primary-900: var(--color-brand-900);
|
|
18
|
+
--color-rtext-brand-secondary-700: var(--color-brand-700);
|
|
19
|
+
--color-rtext-brand-tertiary-600: var(--color-brand-600);
|
|
20
|
+
--color-rtext-brand-tertiary-alt: var(--color-brand-600);
|
|
21
|
+
--color-rtext-error-primary-600: var(--color-error-600);
|
|
22
|
+
--color-rtext-warning-primary-600: var(--color-warning-600);
|
|
23
|
+
--color-rtext-success-primary-600: var(--color-success-600);
|
|
24
|
+
|
|
25
|
+
--color-rborder-primary: var(--color-gray-light-300);
|
|
26
|
+
--color-rborder-secondary: var(--color-gray-light-200);
|
|
27
|
+
--color-rborder-tertiary: var(--color-gray-light-100);
|
|
28
|
+
--color-rborder-disabled: var(--color-gray-light-300);
|
|
29
|
+
--color-rborder-disabled-subtle: var(--color-gray-light-200);
|
|
30
|
+
--color-rborder-brand: var(--color-brand-500);
|
|
31
|
+
--color-rborder-warning: var(--color-warning-500);
|
|
32
|
+
--color-rborder-brand-alt: var(--color-brand-600);
|
|
33
|
+
--color-rborder-error: var(--color-error-500);
|
|
34
|
+
--color-rborder-error-subtle: var(--color-error-300);
|
|
35
|
+
|
|
36
|
+
--color-rfg-primary-900: var(--color-gray-light-900);
|
|
37
|
+
--color-rfg-secondary-700: var(--color-gray-light-700);
|
|
38
|
+
--color-rfg-secondary-hover: var(--color-gray-light-800);
|
|
39
|
+
--color-rfg-tertiary-600: var(--color-gray-light-600);
|
|
40
|
+
--color-rfg-tertiary-hover: var(--color-gray-light-700);
|
|
41
|
+
--color-rfg-quaternary-500: var(--color-gray-light-500);
|
|
42
|
+
--color-rfg-quaternary-hover: var(--color-gray-light-600);
|
|
43
|
+
--color-rfg-quinary-400: var(--color-gray-light-400);
|
|
44
|
+
--color-rfg-quinary-hover: var(--color-gray-light-500);
|
|
45
|
+
--color-rfg-senary-300: var(--color-gray-light-300);
|
|
46
|
+
--color-rfg-white: var(--color-base-white);
|
|
47
|
+
--color-rfg-disabled: var(--color-gray-light-400);
|
|
48
|
+
--color-rfg-disabled-subtle: var(--color-gray-light-300);
|
|
49
|
+
--color-rfg-brand-primary-600: var(--color-brand-600);
|
|
50
|
+
--color-rfg-brand-primary-alt: var(--color-brand-600);
|
|
51
|
+
--color-rfg-brand-secondary-500: var(--color-brand-500);
|
|
52
|
+
--color-rfg-error-primary: var(--color-error-600);
|
|
53
|
+
--color-rfg-error-secondary: var(--color-error-500);
|
|
54
|
+
--color-rfg-warning-primary: var(--color-warning-600);
|
|
55
|
+
--color-rfg-warning-secondary: var(--color-warning-500);
|
|
56
|
+
--color-rfg-success-primary: var(--color-success-600);
|
|
57
|
+
--color-rfg-success-secondary: var(--color-success-500);
|
|
58
|
+
|
|
59
|
+
--color-rbg-primary: var(--color-base-white);
|
|
60
|
+
--color-rbg-primary-alt: var(--color-base-white);
|
|
61
|
+
--color-rbg-primary-hover: var(--color-gray-light-50);
|
|
62
|
+
--color-rbg-primary-solid: var(--color-gray-light-950);
|
|
63
|
+
--color-rbg-secondary: var(--color-gray-light-50);
|
|
64
|
+
--color-rbg-secondary-alt: var(--color-gray-light-50);
|
|
65
|
+
--color-rbg-secondary-hover: var(--color-gray-light-100);
|
|
66
|
+
--color-rbg-secondary-subtle: var(--color-gray-light-25);
|
|
67
|
+
--color-rbg-secondary-solid: var(--color-gray-light-600);
|
|
68
|
+
--color-rbg-tertiary: var(--color-gray-light-100);
|
|
69
|
+
--color-rbg-quaternary: var(--color-gray-light-100);
|
|
70
|
+
--color-rbg-active: var(--color-gray-light-50);
|
|
71
|
+
--color-rbg-disabled: var(--color-gray-light-100);
|
|
72
|
+
--color-rbg-disabled-subtle: var(--color-gray-light-50);
|
|
73
|
+
--color-rbg-overlay: var(--color-gray-light-950);
|
|
74
|
+
--color-rbg-brand-primary: var(--color-brand-50);
|
|
75
|
+
--color-rbg-brand-primary-alt: var(--color-brand-50);
|
|
76
|
+
--color-rbg-brand-secondary: var(--color-brand-100);
|
|
77
|
+
--color-rbg-brand-solid: var(--color-brand-600);
|
|
78
|
+
--color-rbg-brand-solid-hover: var(--color-brand-700);
|
|
79
|
+
--color-rbg-brand-section: var(--color-brand-800);
|
|
80
|
+
--color-rbg-brand-section-subtle: var(--color-brand-700);
|
|
81
|
+
--color-rbg-error-primary: var(--color-error-50);
|
|
82
|
+
--color-rbg-error-secondary: var(--color-error-100);
|
|
83
|
+
--color-rbg-error-solid: var(--color-error-600);
|
|
84
|
+
--color-rbg-warning-primary: var(--color-warning-50);
|
|
85
|
+
--color-rbg-warning-secondary: var(--color-warning-100);
|
|
86
|
+
--color-rbg-warning-solid: var(--color-warning-600);
|
|
87
|
+
--color-rbg-success-primary: var(--color-success-50);
|
|
88
|
+
--color-rbg-success-secondary: var(--color-success-100);
|
|
89
|
+
--color-rbg-success-solid: var(--color-success-600);
|
|
90
|
+
|
|
91
|
+
--color-rbutton-primary-fg: var(--color-base-white);
|
|
92
|
+
--color-rbutton-primary-fg-hover: var(--color-base-white);
|
|
93
|
+
--color-rbutton-primary-bg: var(--color-brand-800);
|
|
94
|
+
--color-rbutton-primary-bg-hover: var(--color-brand-700);
|
|
95
|
+
|
|
96
|
+
--color-rbutton-secondary-fg: var(--color-gray-light-700);
|
|
97
|
+
--color-rbutton-secondary-fg-hover: var(--color-gray-light-800);
|
|
98
|
+
--color-rbutton-secondary-bg: var(--color-base-white);
|
|
99
|
+
--color-rbutton-secondary-bg-hover: var(--color-gray-light-50);
|
|
100
|
+
--color-rbutton-secondary-border: var(--color-gray-light-300);
|
|
101
|
+
--color-rbutton-secondary-border-hover: var(--color-gray-light-300);
|
|
102
|
+
|
|
103
|
+
--color-rbutton-secondary-color-fg: var(--color-brand-700);
|
|
104
|
+
--color-rbutton-secondary-color-fg-hover: var(--color-brand-800);
|
|
105
|
+
--color-rbutton-secondary-color-bg: var(--color-base-white);
|
|
106
|
+
--color-rbutton-secondary-color-bg-hover: var(--color-brand-50);
|
|
107
|
+
--color-rbutton-secondary-color-border: var(--color-brand-300);
|
|
108
|
+
--color-rbutton-secondary-color-border-hover: var(--color-brand-300);
|
|
109
|
+
|
|
110
|
+
--color-rbutton-tertiary-fg: var(--color-gray-light-600);
|
|
111
|
+
--color-rbutton-tertiary-fg-hover: var(--color-gray-light-700);
|
|
112
|
+
--color-rbutton-tertiary-bg-hover: var(--color-gray-light-50);
|
|
113
|
+
|
|
114
|
+
--color-rbutton-tertiary-color-fg: var(--color-brand-700);
|
|
115
|
+
--color-rbutton-tertiary-color-fg-hover: var(--color-brand-800);
|
|
116
|
+
--color-rbutton-tertiary-color-bg-hover: var(--color-brand-50);
|
|
117
|
+
|
|
118
|
+
--color-rbutton-primary-error-fg: var(--color-base-white);
|
|
119
|
+
--color-rbutton-primary-error-fg-hover: var(--color-base-white);
|
|
120
|
+
--color-rbutton-primary-error-bg: var(--color-error-600);
|
|
121
|
+
--color-rbutton-primary-error-bg-hover: var(--color-error-700);
|
|
122
|
+
|
|
123
|
+
--color-rbutton-secondary-error-fg: var(--color-error-700);
|
|
124
|
+
--color-rbutton-secondary-error-fg-hover: var(--color-error-800);
|
|
125
|
+
--color-rbutton-secondary-error-bg: var(--color-base-white);
|
|
126
|
+
--color-rbutton-secondary-error-bg-hover: var(--color-error-50);
|
|
127
|
+
--color-rbutton-secondary-error-border: var(--color-error-300);
|
|
128
|
+
--color-rbutton-secondary-error-border-hover: var(--color-error-300);
|
|
129
|
+
|
|
130
|
+
--color-rbutton-tertiary-error-fg: var(--color-error-700);
|
|
131
|
+
--color-rbutton-tertiary-error-fg-hover: var(--color-error-800);
|
|
132
|
+
--color-rbutton-tertiary-error-bg-hover: var(--color-error-50);
|
|
133
|
+
|
|
134
|
+
/* Box Shadows */
|
|
135
|
+
--color-rshadow-xs: rgba(16, 24, 40, 0.05);
|
|
136
|
+
--color-rshadow-sm-01: rgba(16, 24, 40, 0.1);
|
|
137
|
+
--color-rshadow-sm-02: rgba(16, 24, 40, 0.06);
|
|
138
|
+
--color-rshadow-md-01: rgba(16, 24, 40, 0.1);
|
|
139
|
+
--color-rshadow-md-02: rgba(16, 24, 40, 0.06);
|
|
140
|
+
--color-rshadow-lg-01: rgba(16, 24, 40, 0.08);
|
|
141
|
+
--color-rshadow-lg-02: rgba(16, 24, 40, 0.03);
|
|
142
|
+
--color-rshadow-xl-01: rgba(16, 24, 40, 0.08);
|
|
143
|
+
--color-rshadow-xl-02: rgba(16, 24, 40, 0.03);
|
|
144
|
+
--color-rshadow-2xl: rgba(16, 24, 40, 0.18);
|
|
145
|
+
--color-rshadow-3xl: rgba(16, 24, 40, 0.14);
|
|
146
|
+
--color-rshadow-skeumorphic-inner: rgba(16, 24, 40, 0.05);
|
|
147
|
+
--color-rshadow-skeumorphic-inner-border: rgba(16, 24, 40, 0.18);
|
|
148
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@theme inline {
|
|
2
|
+
--line-height-text-xs: 18px;
|
|
3
|
+
--line-height-text-sm: 20px;
|
|
4
|
+
--line-height-text-md: 24px;
|
|
5
|
+
--line-height-text-lg: 28px;
|
|
6
|
+
--line-height-text-xl: 30px;
|
|
7
|
+
--line-height-display-xs: 32px;
|
|
8
|
+
--line-height-display-sm: 38px;
|
|
9
|
+
--line-height-display-md: 44px;
|
|
10
|
+
--line-height-display-lg: 60px;
|
|
11
|
+
--line-height-display-xl: 72px;
|
|
12
|
+
--line-height-display-2xl: 90px;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@theme inline {
|
|
2
|
+
--radius-none: 0rem;
|
|
3
|
+
--radius-xxs: 0.125rem;
|
|
4
|
+
--radius-xs: 0.25rem;
|
|
5
|
+
--radius-sm: 0.375rem;
|
|
6
|
+
--radius-md: 0.5rem;
|
|
7
|
+
--radius-lg: 0.625rem;
|
|
8
|
+
--radius-xl: 0.75rem;
|
|
9
|
+
--radius-2xl: 1rem;
|
|
10
|
+
--radius-3xl: 1.25rem;
|
|
11
|
+
--radius-4xl: 1.5rem;
|
|
12
|
+
--radius-full: 9999px;
|
|
13
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
@theme inline {
|
|
2
|
+
/* gray light */
|
|
3
|
+
--color-utility-gray-50: var(--color-gray-light-50);
|
|
4
|
+
--color-utility-gray-100: var(--color-gray-light-100);
|
|
5
|
+
--color-utility-gray-200: var(--color-gray-light-200);
|
|
6
|
+
--color-utility-gray-300: var(--color-gray-light-300);
|
|
7
|
+
--color-utility-gray-400: var(--color-gray-light-400);
|
|
8
|
+
--color-utility-gray-500: var(--color-gray-light-500);
|
|
9
|
+
--color-utility-gray-600: var(--color-gray-light-600);
|
|
10
|
+
--color-utility-gray-700: var(--color-gray-light-700);
|
|
11
|
+
--color-utility-gray-800: var(--color-gray-light-800);
|
|
12
|
+
--color-utility-gray-900: var(--color-gray-light-900);
|
|
13
|
+
|
|
14
|
+
/* brand light*/
|
|
15
|
+
--color-utility-brand-50: var(--color-brand-50);
|
|
16
|
+
--color-utility-brand-50-alt: var(--color-brand-50);
|
|
17
|
+
--color-utility-brand-100: var(--color-brand-100);
|
|
18
|
+
--color-utility-brand-100-alt: var(--color-brand-100);
|
|
19
|
+
--color-utility-brand-200: var(--color-brand-200);
|
|
20
|
+
--color-utility-brand-200-alt: var(--color-brand-200);
|
|
21
|
+
--color-utility-brand-300: var(--color-brand-300);
|
|
22
|
+
--color-utility-brand-300-alt: var(--color-brand-300);
|
|
23
|
+
--color-utility-brand-400: var(--color-brand-400);
|
|
24
|
+
--color-utility-brand-400-alt: var(--color-brand-400);
|
|
25
|
+
--color-utility-brand-500: var(--color-brand-500);
|
|
26
|
+
--color-utility-brand-500-alt: var(--color-brand-500);
|
|
27
|
+
--color-utility-brand-600: var(--color-brand-600);
|
|
28
|
+
--color-utility-brand-600-alt: var(--color-brand-600);
|
|
29
|
+
--color-utility-brand-700: var(--color-brand-700);
|
|
30
|
+
--color-utility-brand-700-alt: var(--color-brand-700);
|
|
31
|
+
--color-utility-brand-800: var(--color-brand-800);
|
|
32
|
+
--color-utility-brand-800-alt: var(--color-brand-800);
|
|
33
|
+
--color-utility-brand-900: var(--color-brand-900);
|
|
34
|
+
--color-utility-brand-900-alt: var(--color-brand-900);
|
|
35
|
+
|
|
36
|
+
/* errror light */
|
|
37
|
+
--color-utility-error-50: var(--color-error-50);
|
|
38
|
+
--color-utility-error-100: var(--color-error-100);
|
|
39
|
+
--color-utility-error-200: var(--color-error-200);
|
|
40
|
+
--color-utility-error-300: var(--color-error-300);
|
|
41
|
+
--color-utility-error-400: var(--color-error-400);
|
|
42
|
+
--color-utility-error-500: var(--color-error-500);
|
|
43
|
+
--color-utility-error-600: var(--color-error-600);
|
|
44
|
+
--color-utility-error-700: var(--color-error-700);
|
|
45
|
+
|
|
46
|
+
/* warning */
|
|
47
|
+
--color-utility-warning-50: var(--color-warning-50);
|
|
48
|
+
--color-utility-warning-100: var(--color-warning-100);
|
|
49
|
+
--color-utility-warning-200: var(--color-warning-200);
|
|
50
|
+
--color-utility-warning-300: var(--color-warning-300);
|
|
51
|
+
--color-utility-warning-400: var(--color-warning-400);
|
|
52
|
+
--color-utility-warning-500: var(--color-warning-500);
|
|
53
|
+
--color-utility-warning-600: var(--color-warning-600);
|
|
54
|
+
--color-utility-warning-700: var(--color-warning-700);
|
|
55
|
+
|
|
56
|
+
/* success */
|
|
57
|
+
--color-utility-success-50: var(--color-success-50);
|
|
58
|
+
--color-utility-success-100: var(--color-success-100);
|
|
59
|
+
--color-utility-success-200: var(--color-success-200);
|
|
60
|
+
--color-utility-success-300: var(--color-success-300);
|
|
61
|
+
--color-utility-success-400: var(--color-success-400);
|
|
62
|
+
--color-utility-success-500: var(--color-success-500);
|
|
63
|
+
--color-utility-success-600: var(--color-success-600);
|
|
64
|
+
--color-utility-success-700: var(--color-success-700);
|
|
65
|
+
|
|
66
|
+
/* gray-blue light */
|
|
67
|
+
--color-utility-gray-blue-50: var(--color-gray-blue-50);
|
|
68
|
+
--color-utility-gray-blue-100: var(--color-gray-blue-100);
|
|
69
|
+
--color-utility-gray-blue-200: var(--color-gray-blue-200);
|
|
70
|
+
--color-utility-gray-blue-300: var(--color-gray-blue-300);
|
|
71
|
+
--color-utility-gray-blue-400: var(--color-gray-blue-400);
|
|
72
|
+
--color-utility-gray-blue-500: var(--color-gray-blue-500);
|
|
73
|
+
--color-utility-gray-blue-600: var(--color-gray-blue-600);
|
|
74
|
+
--color-utility-gray-blue-700: var(--color-gray-blue-700);
|
|
75
|
+
|
|
76
|
+
/* blue-light light*/
|
|
77
|
+
--color-utility-blue-light-50: var(--color-blue-light-50);
|
|
78
|
+
--color-utility-blue-light-100: var(--color-blue-light-100);
|
|
79
|
+
--color-utility-blue-light-200: var(--color-blue-light-200);
|
|
80
|
+
--color-utility-blue-light-300: var(--color-blue-light-300);
|
|
81
|
+
--color-utility-blue-light-400: var(--color-blue-light-400);
|
|
82
|
+
--color-utility-blue-light-500: var(--color-blue-light-500);
|
|
83
|
+
--color-utility-blue-light-600: var(--color-blue-light-600);
|
|
84
|
+
--color-utility-blue-light-700: var(--color-blue-light-700);
|
|
85
|
+
|
|
86
|
+
/* blue light*/
|
|
87
|
+
--color-utility-blue-50: var(--color-blue-50);
|
|
88
|
+
--color-utility-blue-100: var(--color-blue-100);
|
|
89
|
+
--color-utility-blue-200: var(--color-blue-200);
|
|
90
|
+
--color-utility-blue-300: var(--color-blue-300);
|
|
91
|
+
--color-utility-blue-400: var(--color-blue-400);
|
|
92
|
+
--color-utility-blue-500: var(--color-blue-500);
|
|
93
|
+
--color-utility-blue-600: var(--color-blue-600);
|
|
94
|
+
--color-utility-blue-700: var(--color-blue-700);
|
|
95
|
+
|
|
96
|
+
/* blue-dark light */
|
|
97
|
+
--color-utility-blue-dark-50: var(--color-blue-dark-50);
|
|
98
|
+
--color-utility-blue-dark-100: var(--color-blue-dark-100);
|
|
99
|
+
--color-utility-blue-dark-200: var(--color-blue-dark-200);
|
|
100
|
+
--color-utility-blue-dark-300: var(--color-blue-dark-300);
|
|
101
|
+
--color-utility-blue-dark-400: var(--color-blue-dark-400);
|
|
102
|
+
--color-utility-blue-dark-500: var(--color-blue-dark-500);
|
|
103
|
+
--color-utility-blue-dark-600: var(--color-blue-dark-600);
|
|
104
|
+
--color-utility-blue-dark-700: var(--color-blue-dark-700);
|
|
105
|
+
|
|
106
|
+
/* indigo light*/
|
|
107
|
+
--color-utility-indigo-50: var(--color-indigo-50);
|
|
108
|
+
--color-utility-indigo-100: var(--color-indigo-100);
|
|
109
|
+
--color-utility-indigo-200: var(--color-indigo-200);
|
|
110
|
+
--color-utility-indigo-300: var(--color-indigo-300);
|
|
111
|
+
--color-utility-indigo-400: var(--color-indigo-400);
|
|
112
|
+
--color-utility-indigo-500: var(--color-indigo-500);
|
|
113
|
+
--color-utility-indigo-600: var(--color-indigo-600);
|
|
114
|
+
--color-utility-indigo-700: var(--color-indigo-700);
|
|
115
|
+
|
|
116
|
+
/* purple light*/
|
|
117
|
+
--color-utility-purple-50: var(--color-purple-50);
|
|
118
|
+
--color-utility-purple-100: var(--color-purple-100);
|
|
119
|
+
--color-utility-purple-200: var(--color-purple-200);
|
|
120
|
+
--color-utility-purple-300: var(--color-purple-300);
|
|
121
|
+
--color-utility-purple-400: var(--color-purple-400);
|
|
122
|
+
--color-utility-purple-500: var(--color-purple-500);
|
|
123
|
+
--color-utility-purple-600: var(--color-purple-600);
|
|
124
|
+
--color-utility-purple-700: var(--color-purple-700);
|
|
125
|
+
|
|
126
|
+
/* fuchsia light*/
|
|
127
|
+
--color-utility-fuchsia-50: var(--color-fuchsia-50);
|
|
128
|
+
--color-utility-fuchsia-100: var(--color-fuchsia-100);
|
|
129
|
+
--color-utility-fuchsia-200: var(--color-fuchsia-200);
|
|
130
|
+
--color-utility-fuchsia-300: var(--color-fuchsia-300);
|
|
131
|
+
--color-utility-fuchsia-400: var(--color-fuchsia-400);
|
|
132
|
+
--color-utility-fuchsia-500: var(--color-fuchsia-500);
|
|
133
|
+
--color-utility-fuchsia-600: var(--color-fuchsia-600);
|
|
134
|
+
--color-utility-fuchsia-700: var(--color-fuchsia-700);
|
|
135
|
+
|
|
136
|
+
/* pink light*/
|
|
137
|
+
--color-utility-pink-50: var(--color-pink-50);
|
|
138
|
+
--color-utility-pink-100: var(--color-pink-100);
|
|
139
|
+
--color-utility-pink-200: var(--color-pink-200);
|
|
140
|
+
--color-utility-pink-300: var(--color-pink-300);
|
|
141
|
+
--color-utility-pink-400: var(--color-pink-400);
|
|
142
|
+
--color-utility-pink-500: var(--color-pink-500);
|
|
143
|
+
--color-utility-pink-600: var(--color-pink-600);
|
|
144
|
+
--color-utility-pink-700: var(--color-pink-700);
|
|
145
|
+
|
|
146
|
+
/* orange-dark light*/
|
|
147
|
+
--color-utility-orange-dark-50: var(--color-orange-dark-50);
|
|
148
|
+
--color-utility-orange-dark-100: var(--color-orange-dark-100);
|
|
149
|
+
--color-utility-orange-dark-200: var(--color-orange-dark-200);
|
|
150
|
+
--color-utility-orange-dark-300: var(--color-orange-dark-300);
|
|
151
|
+
--color-utility-orange-dark-400: var(--color-orange-dark-400);
|
|
152
|
+
--color-utility-orange-dark-500: var(--color-orange-dark-500);
|
|
153
|
+
--color-utility-orange-dark-600: var(--color-orange-dark-600);
|
|
154
|
+
--color-utility-orange-dark-700: var(--color-orange-dark-700);
|
|
155
|
+
|
|
156
|
+
/* orange-dark light*/
|
|
157
|
+
--color-utility-orange-50: var(--color-orange-50);
|
|
158
|
+
--color-utility-orange-100: var(--color-orange-100);
|
|
159
|
+
--color-utility-orange-200: var(--color-orange-200);
|
|
160
|
+
--color-utility-orange-300: var(--color-orange-300);
|
|
161
|
+
--color-utility-orange-400: var(--color-orange-400);
|
|
162
|
+
--color-utility-orange-500: var(--color-orange-500);
|
|
163
|
+
--color-utility-orange-600: var(--color-orange-600);
|
|
164
|
+
--color-utility-orange-700: var(--color-orange-700);
|
|
165
|
+
}
|
|
166
|
+
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { Meta } from "@storybook/react-vite";
|
|
3
|
+
import { AccordionDemoProps } from "./type";
|
|
4
|
+
import { AccordionDemo } from ".";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Components/AccordionDemo",
|
|
8
|
+
component: AccordionDemo,
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
argTypes: {
|
|
11
|
+
type: {
|
|
12
|
+
control: { type: "radio" },
|
|
13
|
+
options: ["single", "multiple"],
|
|
14
|
+
},
|
|
15
|
+
collapsible: {
|
|
16
|
+
control: { type: "boolean" },
|
|
17
|
+
},
|
|
18
|
+
accordionClassName: {
|
|
19
|
+
control: { type: "text" },
|
|
20
|
+
},
|
|
21
|
+
itemClassName: {
|
|
22
|
+
control: { type: "text" },
|
|
23
|
+
},
|
|
24
|
+
questionClassName: {
|
|
25
|
+
control: { type: "text" },
|
|
26
|
+
},
|
|
27
|
+
answerClassName: {
|
|
28
|
+
control: { type: "text" },
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
args: {
|
|
32
|
+
type: "single",
|
|
33
|
+
collapsible: false,
|
|
34
|
+
items: [
|
|
35
|
+
{
|
|
36
|
+
question: "What is React?",
|
|
37
|
+
answer: "React is a JavaScript library for building user interfaces.",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
question: "What is Storybook?",
|
|
41
|
+
answer:
|
|
42
|
+
"Storybook is an open-source tool for developing UI components in isolation.",
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
accordionClassName: "w-full",
|
|
46
|
+
itemClassName: "border-b last:border-b-0",
|
|
47
|
+
questionClassName: "text-lg font-bold text-blue-700",
|
|
48
|
+
answerClassName: "text-sm text-gray-600",
|
|
49
|
+
},
|
|
50
|
+
} as Meta<typeof AccordionDemo>;
|
|
51
|
+
|
|
52
|
+
type Story = StoryObj<AccordionDemoProps>;
|
|
53
|
+
|
|
54
|
+
export const Default: Story = {};
|
|
55
|
+
|
|
56
|
+
export const Collapsible: Story = {
|
|
57
|
+
args: {
|
|
58
|
+
collapsible: true,
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const MultipleType: Story = {
|
|
63
|
+
args: {
|
|
64
|
+
type: "multiple",
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const WithCustomClasses: Story = {
|
|
69
|
+
args: {
|
|
70
|
+
accordionClassName: "w-full max-w-lg mx-auto",
|
|
71
|
+
itemClassName: "border-b last:border-b-0 p-4",
|
|
72
|
+
questionClassName: "text-xl font-bold text-green-700",
|
|
73
|
+
answerClassName: "text-base text-gray-500",
|
|
74
|
+
},
|
|
75
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { render, screen } from "@testing-library/react";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import userEvent from "@testing-library/user-event";
|
|
4
|
+
import { AccordionDemo } from ".";
|
|
5
|
+
import CirclePlus from "@/icons/general/circle-plus";
|
|
6
|
+
import CircleMinues from "@/icons/general/circle-minues";
|
|
7
|
+
|
|
8
|
+
const ClosedIcon = () => <span data-testid="closed-icon"><CirclePlus /></span>;
|
|
9
|
+
const OpenIcon = () => <span data-testid="open-icon"><CircleMinues /></span>;
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
const mockItems = [
|
|
13
|
+
{ question: "What is Astronomy?", answer: "The study of celestial objects." },
|
|
14
|
+
{
|
|
15
|
+
question: "What is a black hole?",
|
|
16
|
+
answer: "A region of space with strong gravity.",
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
describe("AccordionDemo Component", () => {
|
|
21
|
+
it("renders all questions", () => {
|
|
22
|
+
render(<AccordionDemo items={mockItems} />);
|
|
23
|
+
mockItems.forEach((item) => {
|
|
24
|
+
expect(screen.getByText(item.question)).toBeInTheDocument();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("does not show answers initially", () => {
|
|
29
|
+
render(<AccordionDemo items={mockItems} />);
|
|
30
|
+
mockItems.forEach((item) => {
|
|
31
|
+
expect(screen.queryByText(item.answer)).not.toBeInTheDocument();
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("shows answer when question is clicked", async () => {
|
|
36
|
+
render(<AccordionDemo items={mockItems} />);
|
|
37
|
+
const firstQuestion = screen.getByText(mockItems[0].question);
|
|
38
|
+
await userEvent.click(firstQuestion);
|
|
39
|
+
expect(screen.getByText(mockItems[0].answer)).toBeInTheDocument();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("applies custom class names", () => {
|
|
43
|
+
render(
|
|
44
|
+
<AccordionDemo
|
|
45
|
+
items={mockItems}
|
|
46
|
+
accordionClassName="accordion-test"
|
|
47
|
+
itemClassName="item-test"
|
|
48
|
+
questionClassName="question-test"
|
|
49
|
+
answerClassName="answer-test"
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
expect(screen.getByText(mockItems[0].question)).toHaveClass(
|
|
53
|
+
"question-test"
|
|
54
|
+
);
|
|
55
|
+
const answerContent = screen.queryByText(mockItems[0].answer);
|
|
56
|
+
if (answerContent) {
|
|
57
|
+
expect(answerContent).toHaveClass("answer-test");
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("renders custom icons correctly", async () => {
|
|
62
|
+
render(
|
|
63
|
+
<AccordionDemo
|
|
64
|
+
items={mockItems}
|
|
65
|
+
iconClosed={ClosedIcon}
|
|
66
|
+
iconOpen={OpenIcon}
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
expect(screen.getAllByTestId("closed-icon")[0]).toBeInTheDocument();
|
|
71
|
+
|
|
72
|
+
const firstQuestion = screen.getByText(mockItems[0].question);
|
|
73
|
+
await userEvent.click(firstQuestion);
|
|
74
|
+
|
|
75
|
+
expect(screen.getByTestId("open-icon")).toBeInTheDocument();
|
|
76
|
+
});
|
|
77
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Accordion,
|
|
3
|
+
AccordionContent,
|
|
4
|
+
AccordionItem,
|
|
5
|
+
AccordionTrigger,
|
|
6
|
+
} from "@/components/ui/accordion";
|
|
7
|
+
import { AccordionDemoProps } from "./type";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export function AccordionDemo({
|
|
11
|
+
type = "single",
|
|
12
|
+
collapsible = false,
|
|
13
|
+
items,
|
|
14
|
+
accordionClassName = "w-full bg-white p-4",
|
|
15
|
+
itemClassName = "border-b last:border-b-0",
|
|
16
|
+
questionClassName = "text-lg font-medium",
|
|
17
|
+
answerClassName = "text-sm text-gray-600",
|
|
18
|
+
iconClosed,
|
|
19
|
+
iconOpen
|
|
20
|
+
}: Readonly<AccordionDemoProps>) {
|
|
21
|
+
return (
|
|
22
|
+
<Accordion
|
|
23
|
+
type={type}
|
|
24
|
+
collapsible={collapsible}
|
|
25
|
+
className={`${accordionClassName}`}
|
|
26
|
+
>
|
|
27
|
+
{items.map((item, index) => (
|
|
28
|
+
<AccordionItem
|
|
29
|
+
key={index}
|
|
30
|
+
value={`item-${index}`}
|
|
31
|
+
className={itemClassName}
|
|
32
|
+
>
|
|
33
|
+
<AccordionTrigger
|
|
34
|
+
className={questionClassName}
|
|
35
|
+
iconClosed={iconClosed}
|
|
36
|
+
iconOpen={iconOpen}
|
|
37
|
+
>
|
|
38
|
+
{item.question}
|
|
39
|
+
</AccordionTrigger>
|
|
40
|
+
<AccordionContent className={answerClassName}>
|
|
41
|
+
{item.answer}
|
|
42
|
+
</AccordionContent>
|
|
43
|
+
</AccordionItem>
|
|
44
|
+
))}
|
|
45
|
+
</Accordion>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
export type QAItem = {
|
|
4
|
+
question: React.ReactNode;
|
|
5
|
+
answer: React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export interface AccordionDemoProps {
|
|
9
|
+
type?: "single" | "multiple";
|
|
10
|
+
collapsible?: boolean;
|
|
11
|
+
items: QAItem[];
|
|
12
|
+
accordionClassName?: string;
|
|
13
|
+
itemClassName?: string;
|
|
14
|
+
questionClassName?: string;
|
|
15
|
+
answerClassName?: string;
|
|
16
|
+
iconOpen?: React.ComponentType<React.SVGProps<SVGSVGElement>>;
|
|
17
|
+
iconClosed?: React.ComponentType<React.SVGProps<SVGSVGElement>>;
|
|
18
|
+
}
|
|
19
|
+
export type AccordionProps = {
|
|
20
|
+
type?: "single" | "multiple";
|
|
21
|
+
collapsible?: boolean;
|
|
22
|
+
className?: string;
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
};
|