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.
Files changed (249) hide show
  1. package/.gitlab-ci.yml +43 -0
  2. package/.storybook/main.ts +15 -0
  3. package/.storybook/preview.ts +15 -0
  4. package/README.md +254 -0
  5. package/components.json +21 -0
  6. package/dist/Avatar.png +0 -0
  7. package/dist/assets/index-CCq7hmG3.js +186 -0
  8. package/dist/assets/index-Mg-hjQGu.css +1 -0
  9. package/dist/index.html +15 -0
  10. package/dist/test.png +0 -0
  11. package/dist/vite.svg +1 -0
  12. package/eslint.config.js +29 -0
  13. package/index.html +14 -0
  14. package/package.json +102 -0
  15. package/postcss.config.mjs +11 -0
  16. package/rollup.config.mjs +55 -0
  17. package/src/assets/react.svg +1 -0
  18. package/src/assets/style/animation.css +27 -0
  19. package/src/assets/style/box-shadow.css +25 -0
  20. package/src/assets/style/colors.css +402 -0
  21. package/src/assets/style/dark-theme.css +288 -0
  22. package/src/assets/style/font-size.css +14 -0
  23. package/src/assets/style/gradient.css +3 -0
  24. package/src/assets/style/index.css +12 -0
  25. package/src/assets/style/light-theme.css +148 -0
  26. package/src/assets/style/line-height.css +13 -0
  27. package/src/assets/style/max-width.css +5 -0
  28. package/src/assets/style/radius.css +13 -0
  29. package/src/assets/style/utility-colors.css +166 -0
  30. package/src/components/Accordion/_.stories.tsx +75 -0
  31. package/src/components/Accordion/_.test.tsx +77 -0
  32. package/src/components/Accordion/index.tsx +47 -0
  33. package/src/components/Accordion/type.ts +24 -0
  34. package/src/components/Avatar/_.stories.tsx +179 -0
  35. package/src/components/Avatar/_.style.ts +40 -0
  36. package/src/components/Avatar/_.test.tsx +150 -0
  37. package/src/components/Avatar/_.types.ts +66 -0
  38. package/src/components/Avatar/index.tsx +63 -0
  39. package/src/components/Badge/_.stories.tsx +75 -0
  40. package/src/components/Badge/_.style.ts +53 -0
  41. package/src/components/Badge/_.test.tsx +27 -0
  42. package/src/components/Badge/_.types.ts +11 -0
  43. package/src/components/Badge/index.tsx +42 -0
  44. package/src/components/Breadcrumbs/_.stories.tsx +95 -0
  45. package/src/components/Breadcrumbs/_.test.tsx +29 -0
  46. package/src/components/Breadcrumbs/_.type.ts +15 -0
  47. package/src/components/Breadcrumbs/index.tsx +103 -0
  48. package/src/components/Button/_.stories.tsx +85 -0
  49. package/src/components/Button/_.style.ts +56 -0
  50. package/src/components/Button/_.test.tsx +103 -0
  51. package/src/components/Button/_.types.ts +14 -0
  52. package/src/components/Button/index.tsx +70 -0
  53. package/src/components/Checkbox/_.stories.tsx +96 -0
  54. package/src/components/Checkbox/_.style.ts +24 -0
  55. package/src/components/Checkbox/_.test.tsx +85 -0
  56. package/src/components/Checkbox/_.types.ts +23 -0
  57. package/src/components/Checkbox/index.tsx +93 -0
  58. package/src/components/CheckboxGroup/PaymentCard/_.stories.tsx +104 -0
  59. package/src/components/CheckboxGroup/PaymentCard/_.style.ts +28 -0
  60. package/src/components/CheckboxGroup/PaymentCard/_.test.tsx +58 -0
  61. package/src/components/CheckboxGroup/PaymentCard/_.types.ts +28 -0
  62. package/src/components/CheckboxGroup/PaymentCard/index.tsx +71 -0
  63. package/src/components/CheckboxGroup/PlanCard/_.stories.tsx +165 -0
  64. package/src/components/CheckboxGroup/PlanCard/_.style.ts +32 -0
  65. package/src/components/CheckboxGroup/PlanCard/_.test.tsx +54 -0
  66. package/src/components/CheckboxGroup/PlanCard/_.types.ts +35 -0
  67. package/src/components/CheckboxGroup/PlanCard/index.tsx +53 -0
  68. package/src/components/CheckboxGroup/UserCard/_.stories.tsx +89 -0
  69. package/src/components/CheckboxGroup/UserCard/_.style.ts +42 -0
  70. package/src/components/CheckboxGroup/UserCard/_.test.tsx +66 -0
  71. package/src/components/CheckboxGroup/UserCard/_.types.ts +26 -0
  72. package/src/components/CheckboxGroup/UserCard/index.tsx +75 -0
  73. package/src/components/Dropdown/_.stories.tsx +180 -0
  74. package/src/components/Dropdown/_.style.ts +108 -0
  75. package/src/components/Dropdown/_.test.tsx +334 -0
  76. package/src/components/Dropdown/_.types.ts +12 -0
  77. package/src/components/Dropdown/index.tsx +130 -0
  78. package/src/components/FileUpload/_.stories.tsx +74 -0
  79. package/src/components/FileUpload/_.style.ts +0 -0
  80. package/src/components/FileUpload/_.test.tsx +222 -0
  81. package/src/components/FileUpload/_.types.ts +53 -0
  82. package/src/components/FileUpload/index.tsx +44 -0
  83. package/src/components/ImageMagnify/_.stories.tsx +226 -0
  84. package/src/components/ImageMagnify/_.style.ts +109 -0
  85. package/src/components/ImageMagnify/_.types.ts +44 -0
  86. package/src/components/ImageMagnify/index.tsx +204 -0
  87. package/src/components/Input/_.stories.tsx +177 -0
  88. package/src/components/Input/_.style.ts +79 -0
  89. package/src/components/Input/_.test.tsx +146 -0
  90. package/src/components/Input/_.types.ts +66 -0
  91. package/src/components/Input/index.tsx +231 -0
  92. package/src/components/InputTags/_.stories.tsx +51 -0
  93. package/src/components/InputTags/_.style.ts +28 -0
  94. package/src/components/InputTags/_.test.tsx +123 -0
  95. package/src/components/InputTags/_.types.ts +26 -0
  96. package/src/components/InputTags/index.tsx +140 -0
  97. package/src/components/Message/_.stories.tsx +79 -0
  98. package/src/components/Message/_.style.ts +87 -0
  99. package/src/components/Message/_.test.tsx +73 -0
  100. package/src/components/Message/_.types.ts +13 -0
  101. package/src/components/Message/index.tsx +57 -0
  102. package/src/components/Metric/_.stories.tsx +142 -0
  103. package/src/components/Metric/_.style.ts +14 -0
  104. package/src/components/Metric/_.test.tsx +166 -0
  105. package/src/components/Metric/_.types.ts +18 -0
  106. package/src/components/Metric/index.tsx +100 -0
  107. package/src/components/Modal/_.stories.tsx +93 -0
  108. package/src/components/Modal/_.style.ts +31 -0
  109. package/src/components/Modal/_.test.tsx +90 -0
  110. package/src/components/Modal/_.types.ts +14 -0
  111. package/src/components/Modal/index.tsx +82 -0
  112. package/src/components/Pagination/_.stories.tsx +118 -0
  113. package/src/components/Pagination/_.test.tsx +51 -0
  114. package/src/components/Pagination/index.tsx +256 -0
  115. package/src/components/Pagination/type.ts +48 -0
  116. package/src/components/PriceSlider/_.stories.tsx +107 -0
  117. package/src/components/PriceSlider/_.test.tsx +63 -0
  118. package/src/components/PriceSlider/_.type.tsx +19 -0
  119. package/src/components/PriceSlider/index.tsx +86 -0
  120. package/src/components/Progress/_.stories.tsx +93 -0
  121. package/src/components/Progress/_.style.ts +15 -0
  122. package/src/components/Progress/_.test.tsx +34 -0
  123. package/src/components/Progress/_.types.ts +17 -0
  124. package/src/components/Progress/index.tsx +173 -0
  125. package/src/components/Radio/_.stories.tsx +391 -0
  126. package/src/components/Radio/_.style.ts +33 -0
  127. package/src/components/Radio/_.test.tsx +77 -0
  128. package/src/components/Radio/_.types.ts +14 -0
  129. package/src/components/Radio/index.tsx +59 -0
  130. package/src/components/Select/_.stories.tsx +308 -0
  131. package/src/components/Select/_.style.ts +5 -0
  132. package/src/components/Select/_.types.ts +24 -0
  133. package/src/components/Select/index.tsx +172 -0
  134. package/src/components/Switch/_.stories.tsx +61 -0
  135. package/src/components/Switch/_.test.tsx +69 -0
  136. package/src/components/Switch/_.type.ts +12 -0
  137. package/src/components/Switch/index.tsx +70 -0
  138. package/src/components/Tabs/_.stories.tsx +508 -0
  139. package/src/components/Tabs/_.style.ts +63 -0
  140. package/src/components/Tabs/_.test.tsx +174 -0
  141. package/src/components/Tabs/_.type.ts +19 -0
  142. package/src/components/Tabs/index.tsx +35 -0
  143. package/src/components/Tag/_.stories.tsx +78 -0
  144. package/src/components/Tag/_.style.ts +71 -0
  145. package/src/components/Tag/_.test.tsx +44 -0
  146. package/src/components/Tag/_.types.ts +27 -0
  147. package/src/components/Tag/index.tsx +46 -0
  148. package/src/components/TextArea/_.stories.tsx +62 -0
  149. package/src/components/TextArea/_.style.ts +11 -0
  150. package/src/components/TextArea/_.test.tsx +43 -0
  151. package/src/components/TextArea/_.types.ts +29 -0
  152. package/src/components/TextArea/index.tsx +83 -0
  153. package/src/components/Toast/_.style.tsx +27 -0
  154. package/src/components/Toast/_.type.ts +30 -0
  155. package/src/components/Toast/_.utils.ts +23 -0
  156. package/src/components/Toast/container.tsx +171 -0
  157. package/src/components/Toast/index.tsx +29 -0
  158. package/src/components/Tooltip/_.stories.tsx +106 -0
  159. package/src/components/Tooltip/_.style.ts +27 -0
  160. package/src/components/Tooltip/_.test.tsx +54 -0
  161. package/src/components/Tooltip/_.types.ts +31 -0
  162. package/src/components/Tooltip/index.tsx +80 -0
  163. package/src/components/developers/AmirHossein.tsx +149 -0
  164. package/src/components/developers/Fardin.tsx +130 -0
  165. package/src/components/developers/Maryam.tsx +260 -0
  166. package/src/components/developers/Milad.tsx +431 -0
  167. package/src/components/developers/Rasoul.tsx +198 -0
  168. package/src/components/index.ts +28 -0
  169. package/src/components/ui/accordion.tsx +162 -0
  170. package/src/components/ui/avatars-component/avatar-description.tsx +30 -0
  171. package/src/components/ui/avatars-component/avatar-groups.tsx +68 -0
  172. package/src/components/ui/avatars-component/avatar-single.tsx +50 -0
  173. package/src/components/ui/card.tsx +92 -0
  174. package/src/components/ui/checkbox-group/plan-card/basic/_.test.tsx +66 -0
  175. package/src/components/ui/checkbox-group/plan-card/basic/index.tsx +70 -0
  176. package/src/components/ui/checkbox-group/plan-card/with-header/_.test.tsx +110 -0
  177. package/src/components/ui/checkbox-group/plan-card/with-header/header.test.tsx +96 -0
  178. package/src/components/ui/checkbox-group/plan-card/with-header/header.tsx +74 -0
  179. package/src/components/ui/checkbox-group/plan-card/with-header/index.tsx +65 -0
  180. package/src/components/ui/file-content/File-content.tsx +43 -0
  181. package/src/components/ui/file-uploader-components/file-uploader-box.tsx +76 -0
  182. package/src/components/ui/file-uploader-components/file-uploader-item.tsx +64 -0
  183. package/src/components/ui/icon-wrapper/_.test.tsx +60 -0
  184. package/src/components/ui/icon-wrapper/index.tsx +19 -0
  185. package/src/components/ui/input-component/input-label.tsx +11 -0
  186. package/src/components/ui/number.tsx +18 -0
  187. package/src/components/ui/pagination/card-minimal-center-align.tsx +96 -0
  188. package/src/components/ui/pagination/card-minimal-right-aligne.tsx +90 -0
  189. package/src/components/ui/pagination/default-pagination.tsx +128 -0
  190. package/src/components/ui/pagination/get-pagination-item.tsx +36 -0
  191. package/src/components/ui/pagination/pagination-card-button-group-aligned.tsx +94 -0
  192. package/src/components/ui/pagination/pagination-card-minimal-left-aligned.tsx +90 -0
  193. package/src/components/ui/pagination/pagination-content.tsx +15 -0
  194. package/src/components/ui/pagination/pagination-item.tsx +11 -0
  195. package/src/components/ui/pagination/pagination-link.tsx +42 -0
  196. package/src/components/ui/tab-components/tabs-content.tsx +15 -0
  197. package/src/components/ui/tab-components/tabs-list.tsx +27 -0
  198. package/src/components/ui/tab-components/tabs-trigger.tsx +25 -0
  199. package/src/components/ui/text-content-wrapper.tsx +36 -0
  200. package/src/hooks/useClickOutside.ts +23 -0
  201. package/src/icons/general/ArrowLeft.tsx +31 -0
  202. package/src/icons/general/ArrowRight.tsx +31 -0
  203. package/src/icons/general/activity-heart.tsx +31 -0
  204. package/src/icons/general/activity.tsx +31 -0
  205. package/src/icons/general/anchor.tsx +31 -0
  206. package/src/icons/general/archive.tsx +31 -0
  207. package/src/icons/general/arrow-left.tsx +25 -0
  208. package/src/icons/general/arrow-right.tsx +25 -0
  209. package/src/icons/general/asterisk-01.tsx +31 -0
  210. package/src/icons/general/asterisk-02.tsx +31 -0
  211. package/src/icons/general/at-sign.tsx +31 -0
  212. package/src/icons/general/attention-mark.tsx +43 -0
  213. package/src/icons/general/bookmark-add.tsx +31 -0
  214. package/src/icons/general/bookmark.tsx +31 -0
  215. package/src/icons/general/chevron-left.tsx +25 -0
  216. package/src/icons/general/chevron-right.tsx +25 -0
  217. package/src/icons/general/circle-minues.tsx +25 -0
  218. package/src/icons/general/circle-plus.tsx +25 -0
  219. package/src/icons/general/circle-question-mark.tsx +32 -0
  220. package/src/icons/general/circle.tsx +32 -0
  221. package/src/icons/general/copy.tsx +43 -0
  222. package/src/icons/general/email.tsx +32 -0
  223. package/src/icons/general/home.tsx +25 -0
  224. package/src/icons/general/layer.tsx +36 -0
  225. package/src/icons/general/leading.tsx +19 -0
  226. package/src/icons/general/master-card.tsx +37 -0
  227. package/src/icons/general/minus.tsx +36 -0
  228. package/src/icons/general/plus.tsx +19 -0
  229. package/src/icons/general/remove.tsx +32 -0
  230. package/src/icons/general/slash-divider.tsx +26 -0
  231. package/src/icons/general/tick-box.tsx +37 -0
  232. package/src/icons/general/trailing.tsx +19 -0
  233. package/src/icons/general/unkown-format.tsx +25 -0
  234. package/src/icons/general/visa-card.tsx +38 -0
  235. package/src/icons/general/x-close.tsx +35 -0
  236. package/src/icons/icons.type.ts +7 -0
  237. package/src/index.css +21 -0
  238. package/src/index.ts +3 -0
  239. package/src/lib/utils.ts +6 -0
  240. package/src/lib/zIndexUtils.ts +2 -0
  241. package/src/main.tsx +50 -0
  242. package/src/vite-env.d.ts +1 -0
  243. package/tests/setup.ts +8 -0
  244. package/tsconfig.app.json +31 -0
  245. package/tsconfig.json +7 -0
  246. package/tsconfig.node.json +24 -0
  247. package/tsconfig.rollup.json +12 -0
  248. package/vite.config.ts +20 -0
  249. package/vitest.config.ts +47 -0
package/.gitlab-ci.yml ADDED
@@ -0,0 +1,43 @@
1
+ # This file is a template, and might need editing before it works on your project.
2
+ # This is a sample GitLab CI/CD configuration file that should run without any modifications.
3
+ # It demonstrates a basic 3 stage CI/CD pipeline. Instead of real tests or scripts,
4
+ # it uses echo commands to simulate the pipeline execution.
5
+ #
6
+ # A pipeline is composed of independent jobs that run scripts, grouped into stages.
7
+ # Stages run in sequential order, but jobs within stages run in parallel.
8
+ #
9
+ # For more information, see: https://docs.gitlab.com/ee/ci/yaml/#stages
10
+ #
11
+ # You can copy and paste this template into a new `.gitlab-ci.yml` file.
12
+ # You should not add this template to an existing `.gitlab-ci.yml` file by using the `include:` keyword.
13
+ #
14
+ # To contribute improvements to CI/CD templates, please follow the Development guide at:
15
+ # https://docs.gitlab.com/development/cicd/templates/
16
+ # This specific template is located at:
17
+ # https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml
18
+
19
+ stages: # List of stages for jobs, and their order of execution
20
+ - test
21
+ - deploy
22
+
23
+
24
+ unit-test-job: # This job runs in the test stage.
25
+ stage: test # It only starts when the job in the build stage completes successfully.
26
+ script:
27
+ - echo "Running unit tests... This will take about 60 seconds."
28
+ - pnpm install && pnpm test && pnpm build
29
+
30
+
31
+ deploy-job: # This job runs in the deploy stage.
32
+ stage: deploy # It only runs when *both* jobs in the test stage complete successfully.
33
+ environment: production
34
+ script:
35
+ - echo "Deploying application..."
36
+ - echo $SSH_USER
37
+ - echo $SERVER_HOST
38
+ - echo $DEPLOY_PATH
39
+ - whoami
40
+ - ssh $SSH_USER@$SERVER_HOST "cd $DEPLOY_PATH && git pull && pnpm install && pm2 restart all"
41
+ - echo "Application successfully deployed."
42
+ only:
43
+ - main
@@ -0,0 +1,15 @@
1
+ import type { StorybookConfig } from "@storybook/react-vite";
2
+
3
+ const config: StorybookConfig = {
4
+ stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
5
+ addons: [
6
+ "@storybook/addon-onboarding",
7
+ "@chromatic-com/storybook",
8
+ "@storybook/addon-docs"
9
+ ],
10
+ framework: {
11
+ name: "@storybook/react-vite",
12
+ options: {},
13
+ },
14
+ };
15
+ export default config;
@@ -0,0 +1,15 @@
1
+ import "../src/index.css";
2
+ import type { Preview } from "@storybook/react-vite";
3
+
4
+ const preview: Preview = {
5
+ parameters: {
6
+ controls: {
7
+ matchers: {
8
+ color: /(background|color)$/i,
9
+ date: /Date$/i,
10
+ },
11
+ },
12
+ },
13
+ };
14
+
15
+ export default preview;
package/README.md ADDED
@@ -0,0 +1,254 @@
1
+ # RG Design System Template – Developer Guide
2
+
3
+ A scalable, reusable React + TypeScript component library with Vite, Tailwind CSS, Storybook, ESLint, and Vitest. This README helps new contributors understand the structure, conventions, and workflows to confidently add or update code and resolve issues.
4
+
5
+ ## Stack
6
+ - React 19, TypeScript 5, Vite 6
7
+ - Tailwind CSS 4 (with `@tailwindcss/vite`); PostCSS for CSS build
8
+ - Storybook 8 (React + Vite)
9
+ - Vitest 3 + Testing Library + JSDOM
10
+ - ESLint 9 (typescript-eslint, react-hooks, react-refresh)
11
+ - Rollup for library bundling (ESM + CJS + DTS)
12
+
13
+ ## Project Structure
14
+
15
+ ```
16
+ .
17
+ ├─ src/
18
+ │ ├─ assets/
19
+ │ │ └─ style/ # Base CSS tokens and utilities (compiled into dist/style.css)
20
+ │ ├─ components/
21
+ │ │ ├─ <ComponentName>/ # One folder per public component
22
+ │ │ │ ├─ index.tsx # Component implementation (export default/named)
23
+ │ │ │ ├─ _.style.ts # Styles (e.g., cva, class composition)
24
+ │ │ │ ├─ _.types.ts|type.ts # Component props/types
25
+ │ │ │ ├─ _.stories.tsx # Storybook stories
26
+ │ │ │ └─ _.test.tsx # Unit tests (Vitest + Testing Library)
27
+ │ │ ├─ developers/ # Showcase profiles (excluded from coverage)
28
+ │ │ └─ ui/ # Internal building blocks (not public API)
29
+ │ ├─ hooks/ # Reusable hooks
30
+ │ ├─ icons/ # Icon components + types (excluded from coverage)
31
+ │ ├─ lib/ # Utilities shared by components
32
+ │ ├─ index.ts # Library public exports
33
+ │ ├─ index.css # Tailwind entry (built via PostCSS)
34
+ │ └─ main.tsx # Local playground entry (not part of build output)
35
+ ├─ tests/setup.ts # Vitest setup (jsdom, matchers)
36
+ ├─ vite.config.ts # Vite + Vitest base config (alias '@' → './src')
37
+ ├─ vitest.config.ts # Test include/exclude and coverage rules
38
+ ├─ eslint.config.js # ESLint rules and TS integration
39
+ ├─ postcss.config.mjs # PostCSS pipeline (imports, autoprefixer)
40
+ ├─ rollup.config.mjs # Library bundle (esm/cjs/dts) for publish
41
+ ├─ package.json # Scripts, exports, deps, peer deps
42
+ ├─ dist/ # Build output (ignored in dev)
43
+ └─ public/ # Static assets used by Storybook/demo
44
+ ```
45
+
46
+ ### Naming and File Conventions
47
+ - Component folders are `PascalCase` and contain the standard set: `index.tsx`, `_.style.ts`, `_.types.ts` (or `type.ts`), `_.stories.tsx`, `_.test.tsx`.
48
+ - Internal-only primitives live under `src/components/ui` and should not be exported from the library root.
49
+ - The alias `@` resolves to `./src` (import like `import { cn } from '@/lib/utils'`).
50
+ - CSS tokens live in `src/assets/style/*.css`; the library bundles `dist/style.css` (see exports in `package.json`).
51
+
52
+ ## Getting Started
53
+
54
+ Prereqs: Node 18+ (or 20+), PNPM recommended.
55
+
56
+ Install dependencies:
57
+ ```bash
58
+ pnpm install
59
+ ```
60
+
61
+ Run the dev playground (Vite):
62
+ ```bash
63
+ pnpm dev
64
+ ```
65
+
66
+ Open Storybook for component docs:
67
+ ```bash
68
+ pnpm story
69
+ ```
70
+
71
+ Run tests:
72
+ ```bash
73
+ pnpm test
74
+ ```
75
+
76
+ Run tests with coverage:
77
+ ```bash
78
+ pnpm coverage
79
+ ```
80
+
81
+ Lint the repo:
82
+ ```bash
83
+ pnpm lint
84
+ ```
85
+
86
+ Build the library (types + CSS + bundles):
87
+ ```bash
88
+ pnpm build
89
+ ```
90
+
91
+ Full release build (test → vite build → rollup):
92
+ ```bash
93
+ pnpm rollup
94
+ ```
95
+
96
+ ## Exports and Consumers
97
+
98
+ `package.json` exposes:
99
+ - ESM: `dist/index.mjs`
100
+ - CJS: `dist/index.js`
101
+ - Types: `dist/index.d.ts`
102
+ - CSS: `dist/style.css` (via subpath export)
103
+
104
+ Consumers can:
105
+ ```tsx
106
+ import { Button } from 'rg-dst';
107
+ import 'rg-dst/dist/style.css';
108
+ ```
109
+
110
+ ## Adding a New Component
111
+
112
+ 1) Scaffold folder: `src/components/<ComponentName>/` with files:
113
+ - `index.tsx` – component implementation
114
+ - `_.types.ts` – define prop types; export `ComponentNameProps`
115
+ - `_.style.ts` – class builders (e.g., with `class-variance-authority`) and helpers
116
+ - `_.stories.tsx` – at least default and variants stories
117
+ - `_.test.tsx` – render, states, a11y basics
118
+
119
+ 2) Implement component:
120
+ - Keep public API small and typed. Prefer controlled props where appropriate.
121
+ - Compose classes using `clsx`/`cva`. Do not inline large style strings.
122
+ - Avoid leaking internal implementation details through props.
123
+
124
+ 3) Export from library:
125
+ - Re-export from `src/components/index.ts` or `src/index.ts` according to the existing pattern.
126
+
127
+ 4) Document in Storybook:
128
+ - Include controls for all public props.
129
+ - Add usage notes and edge cases in stories or MDX docs.
130
+
131
+ 5) Tests:
132
+ - Use `@testing-library/react` with JSDOM.
133
+ - Cover critical behaviors, keyboard interactions, and edge states.
134
+ - Place snapshots only for minimal structural assurance (avoid brittle snapshots).
135
+
136
+ 6) Styles and Tokens:
137
+ - Reuse tokens from `src/assets/style/*` when possible.
138
+ - If adding new primitive tokens, update CSS files with clear, scoped variables.
139
+
140
+ ## Updating an Existing Component
141
+
142
+ 1) Search for usages across stories, tests, and `src/components/ui` primitives before changing prop names or behavior.
143
+
144
+ 2) Maintain backward compatibility when feasible. If a breaking change is necessary:
145
+ - Adjust stories and tests.
146
+ - Update release notes and communicate migration steps in the PR description.
147
+
148
+ 3) Keep `_.types.ts` as the single source of truth for props and update stories/tests accordingly.
149
+
150
+ 4) Performance and a11y:
151
+ - Use `React.memo`/`useMemo` only when it removes real work; avoid premature optimization.
152
+ - Ensure focus management and ARIA attributes are correct (especially for interactive components).
153
+
154
+ ## Testing & Coverage
155
+
156
+ Vitest is configured with JSDOM and global test APIs. Defaults:
157
+ - Includes: `src/**/*.test.{ts,tsx}`, `src/**/*.spec.{ts,tsx}`
158
+ - Excludes: `node_modules`, `dist`, `**/*.stories.tsx`, `**/*.style.ts`, `**/*.types.ts`, `src/icons/**/*.{ts,tsx}`
159
+
160
+ Coverage includes `src/**/*.{ts,tsx}` with further excludes:
161
+ - Stories, styles, types, icons
162
+ - `src/components/developers/**`
163
+ - `tests/**`, `dist/**`, `src/main.tsx`, `src/vite-env.d.ts`
164
+
165
+ Command hints:
166
+ ```bash
167
+ pnpm test # run unit tests
168
+ pnpm coverage # generate text/json/html coverage
169
+ ```
170
+
171
+ ## Linting & Code Style
172
+
173
+ ESLint rules are defined in `eslint.config.js`:
174
+ - Typescript-eslint recommended rules
175
+ - React hooks rules enforced
176
+ - `@typescript-eslint/no-explicit-any` is disabled where pragmatic
177
+ - `react-refresh/only-export-components` warned to keep HMR-friendly exports
178
+
179
+ Guidelines:
180
+ - Prefer clear, descriptive names over abbreviations.
181
+ - Keep components focused; extract internal UI into `src/components/ui`.
182
+ - Minimal comments; only for non-obvious rationale or caveats.
183
+ - Early returns over deep nesting; avoid broad try/catch.
184
+
185
+ ## Styles & Theming
186
+
187
+ - Tailwind via Vite plugin; utility composition preferred.
188
+ - Shared tokens and utilities live in `src/assets/style/*.css`.
189
+ - Library CSS is built with `pnpm build:css` to `dist/style.css`. Consumers must import it.
190
+
191
+ ## Icons
192
+
193
+ - Add icons to `src/icons/general` as React components.
194
+ - Keep icon types in `src/icons/icons.type.ts`.
195
+ - Icons are excluded from test coverage; still add basic validation where necessary.
196
+
197
+ ## Aliases
198
+
199
+ `@` → `./src` (configured in both `vite.config.ts` and `vitest.config.ts`). Example:
200
+ ```ts
201
+ import { cn } from '@/lib/utils'
202
+ ```
203
+
204
+ ## Scripts (from package.json)
205
+
206
+ - `pnpm dev` – Start Vite dev server (with `--host` for LAN testing)
207
+ - `pnpm build:css` – Build `src/index.css` to `dist/style.css` via PostCSS
208
+ - `pnpm build` – TypeScript build + CSS build + Vite build
209
+ - `pnpm rollup` – Run tests, Vite build, and Rollup bundle (esm/cjs/dts)
210
+ - `pnpm story` – Run Storybook on port 6006
211
+ - `pnpm build-storybook` – Generate static Storybook
212
+ - `pnpm test` – Run Vitest
213
+ - `pnpm coverage` – Vitest with coverage
214
+ - `pnpm lint` – Run ESLint
215
+
216
+ ## Publishing Notes
217
+
218
+ - Ensure `peerDependencies` for `react` and `react-dom` are correct.
219
+ - Verify `exports` map and `types` in `package.json`.
220
+ - Run `pnpm rollup` and verify `dist/` contains `.mjs`, `.js`, `.d.ts`, and `style.css`.
221
+
222
+ ## Troubleshooting
223
+
224
+ - Dev server fails to start
225
+ - Delete `node_modules` and lockfile, then `pnpm install`.
226
+ - Ensure Node version ≥ 18.
227
+
228
+ - Storybook cannot resolve `@` alias
229
+ - Restart Storybook after changes to `vite.config.ts`.
230
+ - Confirm alias is set in both `vite.config.ts` and Storybook config (React-Vite preset handles this).
231
+
232
+ - Tests fail with DOM-related errors
233
+ - Ensure `jsdom` environment is set (it is in config). Check `tests/setup.ts` path.
234
+
235
+ - Coverage missing for new files
236
+ - Confirm files are within `src/` and not in an excluded pattern.
237
+
238
+ - Styles not applied in consumer app
239
+ - Remind consumers to import `'rg-dst/dist/style.css'`.
240
+
241
+ ## Contribution Workflow
242
+
243
+ 1. Create a feature branch: `git checkout -b feat/<short-name>`
244
+ 2. Implement changes with stories and tests.
245
+ 3. Run `pnpm lint && pnpm test && pnpm build` locally.
246
+ 4. Open a PR with:
247
+ - Summary of changes
248
+ - Screenshots (stories) if visual
249
+ - Breaking changes and migration notes
250
+ 5. Request review; address feedback; squash and merge.
251
+
252
+ ---
253
+
254
+ Questions or issues? Open an issue with context, repro steps, and environment details.
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema.json",
3
+ "style": "new-york",
4
+ "rsc": false,
5
+ "tsx": true,
6
+ "tailwind": {
7
+ "config": "",
8
+ "css": "src/index.css",
9
+ "baseColor": "neutral",
10
+ "cssVariables": true,
11
+ "prefix": ""
12
+ },
13
+ "aliases": {
14
+ "components": "@/components",
15
+ "utils": "@/lib/utils",
16
+ "ui": "@/components/ui",
17
+ "lib": "@/lib",
18
+ "hooks": "@/hooks"
19
+ },
20
+ "iconLibrary": "lucide"
21
+ }
Binary file