@sakura-ui/sakura-ui 0.2.0 → 0.4.1

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 (212) hide show
  1. package/README.md +77 -6
  2. package/package.json +28 -21
  3. package/packages/core/package.json +30 -17
  4. package/packages/core/src/components/Button.tsx +33 -32
  5. package/packages/core/src/components/Card.tsx +37 -20
  6. package/packages/core/src/components/Code.tsx +6 -4
  7. package/packages/core/src/components/Faq.tsx +13 -7
  8. package/packages/core/src/components/Heading.tsx +42 -32
  9. package/packages/core/src/components/Icon.tsx +43 -13
  10. package/packages/core/src/components/IconButton.tsx +54 -43
  11. package/packages/core/src/components/LangSelector.tsx +135 -0
  12. package/packages/core/src/components/Link.tsx +37 -66
  13. package/packages/core/src/components/LinkCard.tsx +126 -0
  14. package/packages/core/src/components/List.tsx +14 -12
  15. package/packages/core/src/components/MenuButton.tsx +112 -0
  16. package/packages/core/src/components/NavigationItem.tsx +41 -0
  17. package/packages/core/src/components/NotificationBanner.tsx +20 -0
  18. package/packages/core/src/components/OverflowContainer.tsx +24 -0
  19. package/packages/core/src/components/PopoverMenu.tsx +82 -0
  20. package/packages/core/src/components/Pre.tsx +6 -4
  21. package/packages/core/src/components/Table.tsx +31 -25
  22. package/packages/core/src/components/buttonStyle.ts +43 -32
  23. package/packages/core/src/components/index.ts +13 -25
  24. package/packages/core/src/icons/Close.tsx +21 -0
  25. package/packages/core/src/icons/CloseMobile.tsx +43 -0
  26. package/packages/core/src/icons/KeyboardArrowDown.tsx +24 -0
  27. package/packages/core/src/icons/Language.tsx +25 -0
  28. package/packages/core/src/icons/LanguageMobile.tsx +40 -0
  29. package/packages/core/src/icons/Menu.tsx +24 -0
  30. package/packages/core/src/icons/MenuMobile.tsx +40 -0
  31. package/packages/core/src/icons/index.ts +8 -0
  32. package/packages/core/src/icons/props.ts +5 -0
  33. package/packages/core/src/index.ts +10 -28
  34. package/packages/core/src/type.d.ts +1 -0
  35. package/packages/core/tests/Button.test.tsx +20 -10
  36. package/packages/core/tests/Card.test.tsx +16 -11
  37. package/packages/core/tests/IconButton.test.tsx +57 -0
  38. package/packages/core/tests/Link.test.tsx +60 -0
  39. package/packages/core/tests/vitest.setup.ts +1 -0
  40. package/packages/core/tsconfig.node.json +3 -2
  41. package/packages/core/vite.config.ts +2 -1
  42. package/packages/forms/.turbo/turbo-build.log +12 -0
  43. package/packages/forms/dist/index.cjs.js +183 -131
  44. package/packages/forms/dist/index.es.js +750 -1062
  45. package/packages/forms/dist/types/components/Checkbox.d.ts +9 -4
  46. package/packages/forms/dist/types/components/Checkbox.d.ts.map +1 -1
  47. package/packages/forms/dist/types/components/FieldsetControl.d.ts +14 -9
  48. package/packages/forms/dist/types/components/FieldsetControl.d.ts.map +1 -1
  49. package/packages/forms/dist/types/components/FileInput.d.ts +10 -3
  50. package/packages/forms/dist/types/components/FileInput.d.ts.map +1 -1
  51. package/packages/forms/dist/types/components/Input.d.ts +9 -4
  52. package/packages/forms/dist/types/components/Input.d.ts.map +1 -1
  53. package/packages/forms/dist/types/components/LabelControl.d.ts +13 -8
  54. package/packages/forms/dist/types/components/LabelControl.d.ts.map +1 -1
  55. package/packages/forms/dist/types/components/Radio.d.ts +9 -4
  56. package/packages/forms/dist/types/components/Radio.d.ts.map +1 -1
  57. package/packages/forms/dist/types/components/Select.d.ts +9 -4
  58. package/packages/forms/dist/types/components/Select.d.ts.map +1 -1
  59. package/packages/forms/dist/types/components/Textarea.d.ts +8 -3
  60. package/packages/forms/dist/types/components/Textarea.d.ts.map +1 -1
  61. package/packages/forms/dist/types/components/controlled/CheckboxGroup.d.ts +16 -11
  62. package/packages/forms/dist/types/components/controlled/CheckboxGroup.d.ts.map +1 -1
  63. package/packages/forms/dist/types/components/controlled/RadioGroup.d.ts +17 -12
  64. package/packages/forms/dist/types/components/controlled/RadioGroup.d.ts.map +1 -1
  65. package/packages/forms/dist/types/components/index.d.ts +8 -8
  66. package/packages/forms/dist/types/components/index.d.ts.map +1 -1
  67. package/packages/forms/dist/types/components/inputStyle.d.ts +1 -1
  68. package/packages/forms/dist/types/components/inputStyle.d.ts.map +1 -1
  69. package/packages/forms/dist/types/index.d.ts +0 -1
  70. package/packages/forms/dist/types/index.d.ts.map +1 -1
  71. package/packages/forms/node_modules/.bin/autoprefixer +44 -6
  72. package/packages/forms/package.json +21 -16
  73. package/packages/forms/src/components/Checkbox.tsx +76 -80
  74. package/packages/forms/src/components/FieldsetControl.tsx +21 -28
  75. package/packages/forms/src/components/FileInput.tsx +92 -63
  76. package/packages/forms/src/components/Input.tsx +29 -31
  77. package/packages/forms/src/components/LabelControl.tsx +19 -25
  78. package/packages/forms/src/components/Radio.tsx +68 -69
  79. package/packages/forms/src/components/Select.tsx +65 -65
  80. package/packages/forms/src/components/Textarea.tsx +49 -54
  81. package/packages/forms/src/components/controlled/CheckboxGroup.tsx +15 -17
  82. package/packages/forms/src/components/controlled/RadioGroup.tsx +16 -18
  83. package/packages/forms/src/components/index.ts +8 -8
  84. package/packages/forms/src/components/inputStyle.ts +7 -8
  85. package/packages/forms/src/index.ts +0 -11
  86. package/packages/forms/tests/Checkbox.test.tsx +44 -0
  87. package/packages/forms/tests/FieldsetControl.test.tsx +68 -11
  88. package/packages/forms/tests/FileInput.test.tsx +25 -0
  89. package/packages/forms/tests/Input.test.tsx +12 -83
  90. package/packages/forms/tests/LabelControl.test.tsx +88 -20
  91. package/packages/forms/tests/Radio.test.tsx +23 -78
  92. package/packages/forms/tests/Select.test.tsx +30 -0
  93. package/packages/forms/tests/Textarea.test.tsx +25 -0
  94. package/packages/forms/tests/vitest.setup.ts +1 -0
  95. package/packages/forms/tsconfig.node.json +3 -2
  96. package/packages/forms/vite.config.ts +2 -1
  97. package/packages/helper/.turbo/turbo-build.log +12 -0
  98. package/packages/helper/dist/index.cjs.js +76 -0
  99. package/packages/helper/dist/index.es.js +119 -0
  100. package/packages/helper/dist/types/calc.d.ts +2 -0
  101. package/packages/helper/dist/types/calc.d.ts.map +1 -0
  102. package/packages/{forms/dist/types/utils/class.d.ts → helper/dist/types/cx.d.ts} +1 -1
  103. package/packages/helper/dist/types/cx.d.ts.map +1 -0
  104. package/packages/helper/dist/types/index.d.ts +6 -0
  105. package/packages/helper/dist/types/index.d.ts.map +1 -0
  106. package/packages/helper/dist/types/querySelector.d.ts +2 -0
  107. package/packages/helper/dist/types/querySelector.d.ts.map +1 -0
  108. package/packages/helper/dist/types/styles.d.ts +22 -0
  109. package/packages/helper/dist/types/styles.d.ts.map +1 -0
  110. package/packages/helper/dist/types/treefy.d.ts +8 -0
  111. package/packages/helper/dist/types/treefy.d.ts.map +1 -0
  112. package/packages/helper/node_modules/.bin/vitest +55 -0
  113. package/packages/helper/package.json +50 -0
  114. package/packages/helper/src/calc.ts +1 -0
  115. package/packages/helper/src/cx.ts +2 -0
  116. package/packages/helper/src/index.ts +5 -0
  117. package/packages/helper/src/querySelector.ts +20 -0
  118. package/packages/helper/src/styles.ts +114 -0
  119. package/packages/helper/src/treefy.ts +24 -0
  120. package/packages/helper/tests/calc.test.ts +22 -0
  121. package/packages/helper/tests/cx.test.ts +30 -0
  122. package/packages/helper/tests/querySelector.test.ts +24 -0
  123. package/packages/helper/tests/treefy.test.ts +111 -0
  124. package/packages/helper/tests/vitest.setup.ts +2 -0
  125. package/packages/helper/tsconfig.json +13 -0
  126. package/packages/helper/tsconfig.node.json +6 -0
  127. package/packages/helper/vite.config.ts +26 -0
  128. package/packages/markdown/.turbo/turbo-build.log +12 -0
  129. package/packages/markdown/README.md +129 -0
  130. package/packages/markdown/dist/index.cjs.js +149 -0
  131. package/packages/markdown/dist/index.es.js +16960 -0
  132. package/packages/markdown/dist/types/components/Markdown.d.ts +15 -0
  133. package/packages/markdown/dist/types/components/Markdown.d.ts.map +1 -0
  134. package/packages/markdown/dist/types/components/index.d.ts +2 -0
  135. package/packages/markdown/dist/types/components/index.d.ts.map +1 -0
  136. package/packages/markdown/dist/types/index.d.ts +2 -0
  137. package/packages/markdown/dist/types/index.d.ts.map +1 -0
  138. package/packages/markdown/dist/types/plugins/attr.d.ts +3 -0
  139. package/packages/markdown/dist/types/plugins/attr.d.ts.map +1 -0
  140. package/packages/markdown/dist/types/plugins/card.d.ts +3 -0
  141. package/packages/markdown/dist/types/plugins/card.d.ts.map +1 -0
  142. package/packages/markdown/dist/types/plugins/cell.d.ts +3 -0
  143. package/packages/markdown/dist/types/plugins/cell.d.ts.map +1 -0
  144. package/packages/markdown/dist/types/plugins/faq.d.ts +3 -0
  145. package/packages/markdown/dist/types/plugins/faq.d.ts.map +1 -0
  146. package/packages/markdown/dist/types/plugins/grid.d.ts +3 -0
  147. package/packages/markdown/dist/types/plugins/grid.d.ts.map +1 -0
  148. package/packages/markdown/dist/types/plugins/headings.d.ts +11 -0
  149. package/packages/markdown/dist/types/plugins/headings.d.ts.map +1 -0
  150. package/packages/markdown/dist/types/plugins/helper.d.ts +9 -0
  151. package/packages/markdown/dist/types/plugins/helper.d.ts.map +1 -0
  152. package/packages/markdown/dist/types/plugins/index.d.ts +9 -0
  153. package/packages/markdown/dist/types/plugins/index.d.ts.map +1 -0
  154. package/packages/markdown/dist/types/plugins/linkButton.d.ts +3 -0
  155. package/packages/markdown/dist/types/plugins/linkButton.d.ts.map +1 -0
  156. package/packages/markdown/dist/types/plugins/youtube.d.ts +3 -0
  157. package/packages/markdown/dist/types/plugins/youtube.d.ts.map +1 -0
  158. package/packages/markdown/node_modules/.bin/autoprefixer +55 -0
  159. package/packages/markdown/package.json +84 -0
  160. package/packages/markdown/src/components/Markdown.tsx +365 -0
  161. package/packages/markdown/src/components/index.ts +1 -0
  162. package/packages/markdown/src/global.d.ts +9 -0
  163. package/packages/markdown/src/index.ts +1 -0
  164. package/packages/markdown/src/plugins/attr.ts +19 -0
  165. package/packages/markdown/src/plugins/card.ts +57 -0
  166. package/packages/markdown/src/plugins/cell.ts +47 -0
  167. package/packages/markdown/src/plugins/faq.ts +40 -0
  168. package/packages/markdown/src/plugins/grid.ts +54 -0
  169. package/packages/markdown/src/plugins/headings.ts +38 -0
  170. package/packages/markdown/src/plugins/helper.ts +27 -0
  171. package/packages/markdown/src/plugins/index.ts +8 -0
  172. package/packages/markdown/src/plugins/linkButton.ts +26 -0
  173. package/packages/markdown/src/plugins/youtube.ts +49 -0
  174. package/packages/markdown/tsconfig.json +13 -0
  175. package/packages/markdown/tsconfig.node.json +7 -0
  176. package/packages/markdown/vite.config.ts +30 -0
  177. package/packages/tailwind-theme-plugin/#package.json# +51 -0
  178. package/packages/tailwind-theme-plugin/.turbo/turbo-build.log +12 -0
  179. package/packages/tailwind-theme-plugin/dist/index.cjs.js +1 -1
  180. package/packages/tailwind-theme-plugin/dist/index.es.js +4970 -6093
  181. package/packages/tailwind-theme-plugin/dist/types/index.d.ts +1 -4
  182. package/packages/tailwind-theme-plugin/dist/types/index.d.ts.map +1 -1
  183. package/packages/tailwind-theme-plugin/node_modules/.bin/autoprefixer +44 -6
  184. package/packages/tailwind-theme-plugin/package.json +11 -9
  185. package/packages/tailwind-theme-plugin/src/index.ts +241 -349
  186. package/packages/tailwind-theme-plugin/vite.config.ts +2 -0
  187. package/packages/core/src/libs/cx.ts +0 -2
  188. package/packages/core/src/libs/forward-ref.ts +0 -44
  189. package/packages/core/src/types/component.ts +0 -83
  190. package/packages/forms/dist/types/utils/class.d.ts.map +0 -1
  191. package/packages/forms/node_modules/.bin/acorn +0 -17
  192. package/packages/forms/node_modules/.bin/browserslist +0 -17
  193. package/packages/forms/node_modules/.bin/eslint +0 -17
  194. package/packages/forms/node_modules/.bin/tailwind +0 -17
  195. package/packages/forms/node_modules/.bin/tailwindcss +0 -17
  196. package/packages/forms/node_modules/.bin/ts-node +0 -17
  197. package/packages/forms/node_modules/.bin/ts-node-cwd +0 -17
  198. package/packages/forms/node_modules/.bin/ts-node-esm +0 -17
  199. package/packages/forms/node_modules/.bin/ts-node-script +0 -17
  200. package/packages/forms/node_modules/.bin/ts-node-transpile-only +0 -17
  201. package/packages/forms/node_modules/.bin/ts-script +0 -17
  202. package/packages/forms/node_modules/.bin/vitest +0 -17
  203. package/packages/forms/src/utils/class.ts +0 -2
  204. package/packages/tailwind-theme-plugin/node_modules/.bin/browserslist +0 -17
  205. package/packages/tailwind-theme-plugin/node_modules/.bin/tailwind +0 -17
  206. package/packages/tailwind-theme-plugin/node_modules/.bin/tailwindcss +0 -17
  207. package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node +0 -17
  208. package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node-cwd +0 -17
  209. package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node-esm +0 -17
  210. package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node-script +0 -17
  211. package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node-transpile-only +0 -17
  212. package/packages/tailwind-theme-plugin/node_modules/.bin/ts-script +0 -17
package/README.md CHANGED
@@ -9,15 +9,20 @@ Sakura UI - UI components built with Tailwind CSS for React. Sakura UI is an uno
9
9
 
10
10
  ## Install
11
11
  ```
12
- $ npm install @sakura-ui/sakura-ui
12
+ $ npm install @sakura-ui/core @sakura-ui/forms @sakura-ui/tailwind-theme-plugin @sakura-ui/markdown
13
13
  ```
14
14
  or
15
15
  ```
16
- $ yarn add @sakura-ui/sakura-ui
16
+ $ yarn add @sakura-ui/core @sakura-ui/forms @sakura-ui/tailwind-theme-plugin @sakura-ui/markdown
17
17
  ```
18
18
  or
19
19
  ```
20
- $ pnpm add @sakura-ui/core @sakura-ui/forms @sakura-ui/config
20
+ $ pnpm add @sakura-ui/core @sakura-ui/forms @sakura-ui/tailwind-theme-plugin @sakura-ui/markdown
21
+ ```
22
+
23
+ ### For React 18
24
+ ```
25
+ $ pnpm add @sakura-ui/core@0.3.1 @sakura-ui/forms@0.2.2 @sakura-ui/tailwind-theme-plugin@0.2.2 @sakura-ui/markdown@0.0.17
21
26
  ```
22
27
 
23
28
  ## Configuration
@@ -28,9 +33,10 @@ module.exports = {
28
33
  content: [
29
34
  './src/pages/**/*.{jsx,tsx}',
30
35
  './node_modules/@sakura-ui/core/**/*.{js,jsx,ts,tsx}',
31
- './node_modules/@sakura-ui/forms/**/*.{js,jsx,ts,tsx}'
36
+ './node_modules/@sakura-ui/forms/**/*.{js,jsx,ts,tsx}',
37
+ './node_modules/@sakura-ui/markdown/**/*.{js,jsx,ts,tsx}'
32
38
  ],
33
- plugins: [require('@sakura-ui/config')]
39
+ plugins: [require('@sakura-ui/tailwind-theme-plugin')]
34
40
  }
35
41
  ```
36
42
 
@@ -96,7 +102,7 @@ export default App
96
102
  - H1-H6 Headings
97
103
  - Link
98
104
  - Card
99
- - InfoCard
105
+ - LinkCard
100
106
  - Ol
101
107
  - Ul
102
108
  - Table
@@ -117,6 +123,71 @@ export default App
117
123
  - Checkbox
118
124
  - Select
119
125
  - Input
126
+ - FileInput
120
127
  - Textarea
121
128
  - LabelControl
122
129
  - FieldsetControl
130
+
131
+ ## Markdwon extension
132
+ - Markdown
133
+
134
+ ## Development
135
+
136
+ ### Setup
137
+ ```
138
+ $ pnpm install
139
+ ```
140
+
141
+ ### Run the example app
142
+ `examples` resolves each package to its `src` through Vite aliases, so **no build step is required**. Changes under `packages/*/src` are reflected through HMR.
143
+
144
+ ```
145
+ $ pnpm dev
146
+ ```
147
+
148
+ Then open http://localhost:5173/sakura-ui/
149
+
150
+ ### Build
151
+ ```
152
+ $ pnpm build
153
+ ```
154
+
155
+ Builds go through turbo, which resolves the dependency order — `@sakura-ui/helper` is built before `core` / `forms` / `markdown`. To build a single package, use a filter so that its dependencies are built as well.
156
+
157
+ ```
158
+ $ pnpm build --filter @sakura-ui/core
159
+ ```
160
+
161
+ Running `pnpm build` inside a package directory (e.g. `cd packages/core && pnpm build`) fails while `@sakura-ui/helper` has not been built yet.
162
+
163
+ ### Test
164
+ ```
165
+ $ pnpm test
166
+ ```
167
+
168
+ Runs every package through turbo. To watch a single package while working on it:
169
+
170
+ ```
171
+ $ pnpm --filter @sakura-ui/core test:watch
172
+ ```
173
+
174
+ ### Lint
175
+ ```
176
+ $ pnpm lint
177
+ ```
178
+
179
+ `pnpm lint`, `pnpm build` and `pnpm test` all run on pull requests through the `CI` workflow.
180
+
181
+ ### Publish
182
+ Releases go through npm trusted publishing (OIDC), so no npm token is stored anywhere.
183
+
184
+ 1. Bump the `version` field of the packages to release and merge that to `main`
185
+ 2. Publish a GitHub Release
186
+
187
+ The `Publish` workflow then builds the packages and runs `pnpm publish -r`, which walks the workspace in dependency order and skips versions that are already on npm — `@sakura-ui/helper` goes out before the packages that depend on it.
188
+
189
+ To rehearse without releasing anything, run the workflow manually from the Actions tab: manual runs default to a dry run.
190
+
191
+ Each package needs this repository and `.github/workflows/publish.yaml` registered as its trusted publisher on npmjs.com.
192
+
193
+ Publishing by hand is not supported. npm requires 2FA for direct publishes, and `npm publish` would upload `"@sakura-ui/helper": "workspace:*"` verbatim, since only pnpm expands the workspace protocol at publish time.
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@sakura-ui/sakura-ui",
3
- "version": "0.2.0",
3
+ "version": "0.4.1",
4
4
  "keywords": [],
5
5
  "author": "glassonion1",
6
6
  "homepage": "https://github.com/glassonion1/sakura-ui",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "git+ssh://git@github.com:glassonion1/sakura-ui.git"
9
+ "url": "git+https://github.com/glassonion1/sakura-ui.git"
10
10
  },
11
11
  "license": "MIT",
12
12
  "files": [
@@ -15,29 +15,36 @@
15
15
  "publishConfig": {
16
16
  "access": "public"
17
17
  },
18
- "scripts": {
19
- "build": "pnpm --parallel --filter=./packages/* build"
18
+ "engines": {
19
+ "pnpm": ">=9.15.1"
20
20
  },
21
21
  "dependencies": {
22
- "@sakura-ui/tailwind-theme-plugin": "workspace:*",
23
- "@sakura-ui/core": "workspace:*",
24
- "@sakura-ui/forms": "workspace:*"
22
+ "@sakura-ui/core": "0.4.1",
23
+ "@sakura-ui/helper": "0.0.9",
24
+ "@sakura-ui/forms": "0.4.1",
25
+ "@sakura-ui/tailwind-theme-plugin": "0.4.1"
25
26
  },
26
27
  "peerDependencies": {
27
- "react": "^18.2.0",
28
- "react-dom": "^18.2.0",
29
- "tailwindcss": "^3.2.7"
28
+ "react": "^19.2.1",
29
+ "react-dom": "^19.2.1",
30
+ "tailwindcss": "^4.1.17"
30
31
  },
31
32
  "devDependencies": {
32
- "@biomejs/biome": "^1.8.0",
33
- "@types/node": "^20.14.1",
34
- "@vitejs/plugin-react-swc": "^3.7.0",
35
- "npm-run-all2": "^6.2.0",
36
- "rimraf": "^5.0.7",
37
- "ts-node": "^10.9.2",
38
- "tsc-alias": "^1.8.10",
39
- "typescript": "^5.4.5",
40
- "vite": "^5.2.12",
41
- "vitest": "^1.6.0"
33
+ "@biomejs/biome": "^2.5.9",
34
+ "@types/node": "^24.13.3",
35
+ "@vitejs/plugin-react-swc": "^4.3.3",
36
+ "npm-run-all2": "^9.0.3",
37
+ "rimraf": "^6.1.3",
38
+ "tsc-alias": "^1.9.2",
39
+ "turbo": "^2.10.11",
40
+ "typescript": "^5.9.3",
41
+ "vite": "^7.3.6",
42
+ "vitest": "^4.1.11"
43
+ },
44
+ "scripts": {
45
+ "build": "turbo build",
46
+ "dev": "pnpm --filter examples dev",
47
+ "lint": "biome lint ./",
48
+ "test": "turbo test"
42
49
  }
43
- }
50
+ }
@@ -1,13 +1,20 @@
1
1
  {
2
2
  "name": "@sakura-ui/core",
3
- "version": "0.2.0",
3
+ "version": "0.4.1",
4
4
  "description": "",
5
- "keywords": [],
5
+ "keywords": [
6
+ "react",
7
+ "ui",
8
+ "design-system",
9
+ "accessible",
10
+ "components",
11
+ "library"
12
+ ],
6
13
  "author": "glassonion1",
7
14
  "homepage": "https://github.com/glassonion1/sakura-ui",
8
15
  "repository": {
9
16
  "type": "git",
10
- "url": "git+ssh://git@github.com:glassonion1/sakura-ui.git",
17
+ "url": "git+https://github.com/glassonion1/sakura-ui.git",
11
18
  "directory": "packages/core"
12
19
  },
13
20
  "license": "MIT",
@@ -36,23 +43,29 @@
36
43
  "build": "run-p build:*",
37
44
  "build:scripts": "vite build",
38
45
  "build:types": "tsc && tsc-alias",
39
- "test": "vitest"
46
+ "test": "vitest run",
47
+ "test:watch": "vitest"
40
48
  },
41
49
  "peerDependencies": {
42
- "react": "^18.2.0",
43
- "react-dom": "^18.2.0",
44
- "tailwindcss": "^3.2.7"
50
+ "react": "^19.2.1",
51
+ "react-dom": "^19.2.1",
52
+ "tailwindcss": "^4.1.17"
53
+ },
54
+ "dependencies": {
55
+ "@sakura-ui/helper": "workspace:*"
45
56
  },
46
57
  "devDependencies": {
47
- "@testing-library/jest-dom": "^6.4.5",
48
- "@testing-library/react": "^16.0.0",
49
- "@types/react": "^18.3.3",
50
- "@types/react-dom": "^18.3.0",
51
- "autoprefixer": "^10.4.19",
52
- "happy-dom": "^14.12.0",
53
- "postcss": "^8.4.38",
54
- "react": "^18.3.1",
55
- "react-dom": "^18.3.1",
56
- "tailwindcss": "^3.4.3"
58
+ "@testing-library/jest-dom": "catalog:",
59
+ "@testing-library/react": "catalog:",
60
+ "@types/react": "catalog:",
61
+ "@types/react-dom": "catalog:",
62
+ "@tailwindcss/vite": "catalog:",
63
+ "autoprefixer": "catalog:",
64
+ "happy-dom": "catalog:",
65
+ "postcss": "catalog:",
66
+ "react": "catalog:",
67
+ "react-dom": "catalog:",
68
+ "tailwindcss": "catalog:",
69
+ "vitest": "catalog:"
57
70
  }
58
71
  }
@@ -1,6 +1,5 @@
1
- import { cx } from '../libs/cx'
2
- import type { ComponentWithAs } from '../types/component'
3
- import { forwardRef } from '../libs/forward-ref'
1
+ import React, { type ComponentProps } from 'react'
2
+ import { cx } from '@sakura-ui/helper'
4
3
  import {
5
4
  type ButtonVariant,
6
5
  type ButtonSize,
@@ -9,37 +8,39 @@ import {
9
8
  getSizeStyle
10
9
  } from './buttonStyle'
11
10
 
12
- export interface ButtonProps {
13
- variant?: ButtonVariant
14
- size?: ButtonSize
11
+ export namespace Button {
12
+ export interface Props<T extends React.ElementType> {
13
+ as?: T
14
+ variant?: ButtonVariant
15
+ size?: ButtonSize
16
+ }
15
17
  }
16
18
 
17
- export const Button: ComponentWithAs<'button', ButtonProps> = forwardRef(
18
- (props, ref) => {
19
- const {
20
- as: Component = 'button',
21
- variant = 'primary',
22
- size = 'lg',
23
- className,
24
- children,
25
- ...restProps
26
- } = props
19
+ export const Button = <T extends React.ElementType = 'button'>(
20
+ props: Button.Props<T> & Omit<ComponentProps<T>, keyof Button.Props<T>>
21
+ ) => {
22
+ const {
23
+ as: Component = 'button',
24
+ variant = 'solid-fill',
25
+ size = 'lg',
26
+ className,
27
+ children,
28
+ ...restProps
29
+ } = props
27
30
 
28
- return (
29
- <Component
30
- className={cx(
31
- base,
32
- getVariantStyle(variant),
33
- getSizeStyle(size),
34
- className
35
- )}
36
- {...restProps}
37
- ref={ref}
38
- >
39
- {children}
40
- </Component>
41
- )
42
- }
43
- )
31
+ return (
32
+ <Component
33
+ className={cx(
34
+ base,
35
+ getVariantStyle(variant),
36
+ getSizeStyle(size),
37
+ className
38
+ )}
39
+ {...restProps}
40
+ >
41
+ {children}
42
+ </Component>
43
+ )
44
+ }
44
45
 
45
46
  Button.displayName = 'Button'
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { cx } from '../libs/cx'
2
+ import { cx } from '@sakura-ui/helper'
3
3
 
4
4
  interface IdContextType {
5
5
  id: string
@@ -7,9 +7,11 @@ interface IdContextType {
7
7
 
8
8
  const IdContext = React.createContext<IdContextType>({ id: '' })
9
9
 
10
- export interface CardProps extends React.ComponentPropsWithoutRef<'article'> {}
10
+ export namespace Card {
11
+ export interface Props extends React.ComponentPropsWithoutRef<'article'> {}
12
+ }
11
13
 
12
- export const Card = (props: CardProps) => {
14
+ export const Card = (props: Card.Props) => {
13
15
  const { className, children, ...restProps } = props
14
16
 
15
17
  const id = React.useId()
@@ -18,17 +20,15 @@ export const Card = (props: CardProps) => {
18
20
  const style = `
19
21
  border
20
22
  border-solid
21
- border-sumi-300
23
+ border-solid-gray-500
22
24
  rounded-2xl
23
25
  sm:rounded-3xl
24
- text-sumi-900
26
+ text-solid-gray-900
25
27
  overflow-hidden
26
- flex flex-col
27
- gap-2
28
28
  `
29
29
 
30
30
  return (
31
- <IdContext.Provider value={ctx}>
31
+ <IdContext value={ctx}>
32
32
  <article
33
33
  aria-labelledby={ctx.id}
34
34
  aria-describedby={`${ctx.id}-desc`}
@@ -37,13 +37,15 @@ export const Card = (props: CardProps) => {
37
37
  >
38
38
  {children}
39
39
  </article>
40
- </IdContext.Provider>
40
+ </IdContext>
41
41
  )
42
42
  }
43
43
 
44
- export interface CardImgProps extends React.ComponentPropsWithoutRef<'img'> {}
44
+ export namespace CardImg {
45
+ export interface Props extends React.ComponentPropsWithoutRef<'img'> {}
46
+ }
45
47
 
46
- export const CardImg = (props: CardImgProps) => {
48
+ export const CardImg = (props: CardImg.Props) => {
47
49
  const { className, ...restProps } = props
48
50
 
49
51
  const style = `
@@ -55,18 +57,21 @@ export const CardImg = (props: CardImgProps) => {
55
57
  return <img className={cx(style, className)} {...restProps} />
56
58
  }
57
59
 
58
- export interface CardHeaderProps
59
- extends React.ComponentPropsWithoutRef<'div'> {}
60
+ export namespace CardHeader {
61
+ export interface Props extends React.ComponentPropsWithoutRef<'div'> {}
62
+ }
60
63
 
61
- export const CardHeader = (props: CardHeaderProps) => {
64
+ export const CardHeader = (props: CardHeader.Props) => {
62
65
  const { className, children, ...restProps } = props
63
66
 
64
67
  const ctx = React.useContext(IdContext)
65
68
 
66
69
  const style = `
67
70
  text-base
71
+ leading-[2rem]
68
72
  font-medium
69
73
  first:pt-4
74
+ pt-2
70
75
  last:pb-4
71
76
  px-6
72
77
  `
@@ -78,16 +83,20 @@ export const CardHeader = (props: CardHeaderProps) => {
78
83
  )
79
84
  }
80
85
 
81
- export interface CardBodyProps extends React.ComponentPropsWithoutRef<'div'> {}
86
+ export namespace CardBody {
87
+ export interface Props extends React.ComponentPropsWithoutRef<'div'> {}
88
+ }
82
89
 
83
- export const CardBody = (props: CardBodyProps) => {
90
+ export const CardBody = (props: CardBody.Props) => {
84
91
  const { className, children, ...restProps } = props
85
92
 
86
93
  const ctx = React.useContext(IdContext)
87
94
 
88
95
  const style = `
89
96
  text-base-sm
97
+ leading-[1.85rem]
90
98
  first:pt-4
99
+ pt-2
91
100
  last:pb-4
92
101
  px-6
93
102
  `
@@ -99,21 +108,29 @@ export const CardBody = (props: CardBodyProps) => {
99
108
  )
100
109
  }
101
110
 
102
- export interface CardFooterProps
103
- extends React.ComponentPropsWithoutRef<'div'> {}
111
+ export namespace CardFooter {
112
+ export interface Props extends React.ComponentPropsWithoutRef<'div'> {}
113
+ }
104
114
 
105
- export const CardFooter = (props: CardFooterProps) => {
115
+ export const CardFooter = (props: CardFooter.Props) => {
106
116
  const { className, children, ...restProps } = props
107
117
 
118
+ const stylePosition = `
119
+ sticky
120
+ top-full
121
+ `
122
+
108
123
  const style = `
109
124
  text-base-sm
125
+ leading-[1.85rem]
110
126
  first:pt-4
127
+ pt-2
111
128
  last:pb-4
112
129
  px-6
113
130
  `
114
131
 
115
132
  return (
116
- <div className={cx(style, className)} {...restProps}>
133
+ <div className={cx(stylePosition, style, className)} {...restProps}>
117
134
  {children}
118
135
  </div>
119
136
  )
@@ -1,13 +1,15 @@
1
1
  import React from 'react'
2
- import { cx } from '../libs/cx'
2
+ import { cx } from '@sakura-ui/helper'
3
3
 
4
- export interface CodeProps extends React.ComponentPropsWithoutRef<'code'> {}
4
+ export namespace Code {
5
+ export interface Props extends React.ComponentPropsWithoutRef<'code'> {}
6
+ }
5
7
 
6
- export const Code = (props: CodeProps) => {
8
+ export const Code = (props: Code.Props) => {
7
9
  const { className, children, ...restProps } = props
8
10
 
9
11
  const style = `
10
- bg-sumi-50
12
+ bg-solid-gray-50
11
13
  font-mono
12
14
  `
13
15
 
@@ -1,14 +1,16 @@
1
1
  import React from 'react'
2
- import { cx } from '../libs/cx'
2
+ import { cx } from '@sakura-ui/helper'
3
3
 
4
- export interface FaqProps extends React.ComponentPropsWithoutRef<'dl'> {}
4
+ export namespace Faq {
5
+ export interface Props extends React.ComponentPropsWithoutRef<'dl'> {}
6
+ }
5
7
 
6
8
  const headingStyle = `
7
9
  text-h-med-m
8
10
  sm:text-h-med
9
11
  `
10
12
 
11
- export const Faq = (props: FaqProps) => {
13
+ export const Faq = (props: Faq.Props) => {
12
14
  const { className, children, ...restProps } = props
13
15
 
14
16
  const style = `
@@ -31,9 +33,11 @@ export const Faq = (props: FaqProps) => {
31
33
  )
32
34
  }
33
35
 
34
- export interface QuestionProps extends React.ComponentPropsWithoutRef<'dt'> {}
36
+ export namespace Question {
37
+ export interface Props extends React.ComponentPropsWithoutRef<'dt'> {}
38
+ }
35
39
 
36
- export const Question = (props: QuestionProps) => {
40
+ export const Question = (props: Question.Props) => {
37
41
  const { className, children, ...restProps } = props
38
42
 
39
43
  const style = `
@@ -54,9 +58,11 @@ export const Question = (props: QuestionProps) => {
54
58
  )
55
59
  }
56
60
 
57
- export interface AnswerProps extends React.ComponentPropsWithoutRef<'dd'> {}
61
+ export namespace Answer {
62
+ export interface Props extends React.ComponentPropsWithoutRef<'dd'> {}
63
+ }
58
64
 
59
- export const Answer = (props: AnswerProps) => {
65
+ export const Answer = (props: Answer.Props) => {
60
66
  const { className, children, ...restProps } = props
61
67
 
62
68
  const style = `