@sakura-ui/sakura-ui 0.2.0 → 0.3.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 (215) hide show
  1. package/README.md +16 -6
  2. package/package.json +21 -15
  3. package/packages/core/package.json +26 -15
  4. package/packages/core/src/components/Button.tsx +33 -32
  5. package/packages/core/src/components/Card.tsx +29 -17
  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 +38 -66
  13. package/packages/core/src/components/LinkCard.tsx +91 -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/OverflowContainer.tsx +24 -0
  18. package/packages/core/src/components/PopoverMenu.tsx +81 -0
  19. package/packages/core/src/components/Pre.tsx +6 -4
  20. package/packages/core/src/components/Table.tsx +31 -25
  21. package/packages/core/src/components/buttonStyle.ts +42 -31
  22. package/packages/core/src/components/index.ts +13 -25
  23. package/packages/core/src/icons/Close.tsx +21 -0
  24. package/packages/core/src/icons/CloseMobile.tsx +43 -0
  25. package/packages/core/src/icons/KeyboardArrowDown.tsx +24 -0
  26. package/packages/core/src/icons/Language.tsx +25 -0
  27. package/packages/core/src/icons/LanguageMobile.tsx +40 -0
  28. package/packages/core/src/icons/Menu.tsx +24 -0
  29. package/packages/core/src/icons/MenuMobile.tsx +40 -0
  30. package/packages/core/src/icons/index.ts +8 -0
  31. package/packages/core/src/icons/props.ts +5 -0
  32. package/packages/core/src/index.ts +9 -28
  33. package/packages/core/src/type.d.ts +1 -0
  34. package/packages/core/tests/Button.test.tsx +20 -10
  35. package/packages/core/tests/Card.test.tsx +16 -11
  36. package/packages/core/tests/IconButton.test.tsx +57 -0
  37. package/packages/core/tests/Link.test.tsx +60 -0
  38. package/packages/core/tests/vitest.setup.ts +1 -0
  39. package/packages/core/tsconfig.node.json +3 -2
  40. package/packages/forms/.turbo/turbo-build.log +22 -0
  41. package/packages/forms/dist/index.cjs.js +199 -120
  42. package/packages/forms/dist/index.es.js +890 -1023
  43. package/packages/forms/dist/types/components/Checkbox.d.ts +9 -4
  44. package/packages/forms/dist/types/components/Checkbox.d.ts.map +1 -1
  45. package/packages/forms/dist/types/components/FieldsetControl.d.ts +14 -9
  46. package/packages/forms/dist/types/components/FieldsetControl.d.ts.map +1 -1
  47. package/packages/forms/dist/types/components/FileInput.d.ts +10 -3
  48. package/packages/forms/dist/types/components/FileInput.d.ts.map +1 -1
  49. package/packages/forms/dist/types/components/Input.d.ts +9 -4
  50. package/packages/forms/dist/types/components/Input.d.ts.map +1 -1
  51. package/packages/forms/dist/types/components/LabelControl.d.ts +13 -8
  52. package/packages/forms/dist/types/components/LabelControl.d.ts.map +1 -1
  53. package/packages/forms/dist/types/components/Radio.d.ts +9 -4
  54. package/packages/forms/dist/types/components/Radio.d.ts.map +1 -1
  55. package/packages/forms/dist/types/components/Select.d.ts +9 -4
  56. package/packages/forms/dist/types/components/Select.d.ts.map +1 -1
  57. package/packages/forms/dist/types/components/Textarea.d.ts +8 -3
  58. package/packages/forms/dist/types/components/Textarea.d.ts.map +1 -1
  59. package/packages/forms/dist/types/components/controlled/CheckboxGroup.d.ts +16 -11
  60. package/packages/forms/dist/types/components/controlled/CheckboxGroup.d.ts.map +1 -1
  61. package/packages/forms/dist/types/components/controlled/RadioGroup.d.ts +17 -12
  62. package/packages/forms/dist/types/components/controlled/RadioGroup.d.ts.map +1 -1
  63. package/packages/forms/dist/types/components/index.d.ts +8 -8
  64. package/packages/forms/dist/types/components/index.d.ts.map +1 -1
  65. package/packages/forms/dist/types/components/inputStyle.d.ts +1 -1
  66. package/packages/forms/dist/types/components/inputStyle.d.ts.map +1 -1
  67. package/packages/forms/dist/types/index.d.ts +0 -1
  68. package/packages/forms/dist/types/index.d.ts.map +1 -1
  69. package/packages/forms/node_modules/.bin/autoprefixer +2 -2
  70. package/packages/forms/node_modules/.bin/tailwind +2 -2
  71. package/packages/forms/node_modules/.bin/tailwindcss +2 -2
  72. package/packages/forms/node_modules/.bin/ts-node +4 -4
  73. package/packages/forms/node_modules/.bin/ts-node-cwd +4 -4
  74. package/packages/forms/node_modules/.bin/ts-node-esm +4 -4
  75. package/packages/forms/node_modules/.bin/ts-node-script +4 -4
  76. package/packages/forms/node_modules/.bin/ts-node-transpile-only +4 -4
  77. package/packages/forms/node_modules/.bin/ts-script +4 -4
  78. package/packages/forms/node_modules/.bin/tsc +17 -0
  79. package/packages/forms/node_modules/.bin/tsserver +17 -0
  80. package/packages/forms/node_modules/.vite/vitest/results.json +1 -0
  81. package/packages/forms/package.json +17 -14
  82. package/packages/forms/src/components/Checkbox.tsx +76 -80
  83. package/packages/forms/src/components/FieldsetControl.tsx +21 -28
  84. package/packages/forms/src/components/FileInput.tsx +87 -63
  85. package/packages/forms/src/components/Input.tsx +29 -31
  86. package/packages/forms/src/components/LabelControl.tsx +19 -25
  87. package/packages/forms/src/components/Radio.tsx +66 -69
  88. package/packages/forms/src/components/Select.tsx +65 -65
  89. package/packages/forms/src/components/Textarea.tsx +49 -54
  90. package/packages/forms/src/components/controlled/CheckboxGroup.tsx +15 -17
  91. package/packages/forms/src/components/controlled/RadioGroup.tsx +16 -18
  92. package/packages/forms/src/components/index.ts +8 -8
  93. package/packages/forms/src/components/inputStyle.ts +7 -8
  94. package/packages/forms/src/index.ts +0 -11
  95. package/packages/forms/tests/Checkbox.test.tsx +44 -0
  96. package/packages/forms/tests/FieldsetControl.test.tsx +62 -11
  97. package/packages/forms/tests/FileInput.test.tsx +25 -0
  98. package/packages/forms/tests/Input.test.tsx +12 -83
  99. package/packages/forms/tests/LabelControl.test.tsx +82 -20
  100. package/packages/forms/tests/Radio.test.tsx +23 -78
  101. package/packages/forms/tests/Select.test.tsx +30 -0
  102. package/packages/forms/tests/Textarea.test.tsx +25 -0
  103. package/packages/forms/tests/vitest.setup.ts +1 -0
  104. package/packages/forms/tsconfig.node.json +3 -2
  105. package/packages/helper/.turbo/turbo-build.log +23 -0
  106. package/packages/helper/dist/index.cjs.js +78 -0
  107. package/packages/helper/dist/index.es.js +119 -0
  108. package/packages/helper/dist/types/calc.d.ts +2 -0
  109. package/packages/helper/dist/types/calc.d.ts.map +1 -0
  110. package/packages/{forms/dist/types/utils/class.d.ts → helper/dist/types/cx.d.ts} +1 -1
  111. package/packages/helper/dist/types/cx.d.ts.map +1 -0
  112. package/packages/helper/dist/types/index.d.ts +6 -0
  113. package/packages/helper/dist/types/index.d.ts.map +1 -0
  114. package/packages/helper/dist/types/querySelector.d.ts +2 -0
  115. package/packages/helper/dist/types/querySelector.d.ts.map +1 -0
  116. package/packages/helper/dist/types/styles.d.ts +22 -0
  117. package/packages/helper/dist/types/styles.d.ts.map +1 -0
  118. package/packages/helper/dist/types/treefy.d.ts +8 -0
  119. package/packages/helper/dist/types/treefy.d.ts.map +1 -0
  120. package/packages/helper/package.json +40 -0
  121. package/packages/helper/src/calc.ts +1 -0
  122. package/packages/helper/src/index.ts +5 -0
  123. package/packages/helper/src/querySelector.ts +20 -0
  124. package/packages/helper/src/styles.ts +116 -0
  125. package/packages/helper/src/treefy.ts +22 -0
  126. package/packages/helper/tsconfig.json +13 -0
  127. package/packages/helper/tsconfig.node.json +6 -0
  128. package/packages/helper/vite.config.ts +26 -0
  129. package/packages/markdown/.turbo/turbo-build.log +22 -0
  130. package/packages/markdown/README.md +129 -0
  131. package/packages/markdown/dist/index.cjs.js +175 -0
  132. package/packages/markdown/dist/index.es.js +17098 -0
  133. package/packages/markdown/dist/types/components/Markdown.d.ts +15 -0
  134. package/packages/markdown/dist/types/components/Markdown.d.ts.map +1 -0
  135. package/packages/markdown/dist/types/components/index.d.ts +2 -0
  136. package/packages/markdown/dist/types/components/index.d.ts.map +1 -0
  137. package/packages/markdown/dist/types/index.d.ts +2 -0
  138. package/packages/markdown/dist/types/index.d.ts.map +1 -0
  139. package/packages/markdown/dist/types/plugins/attr.d.ts +3 -0
  140. package/packages/markdown/dist/types/plugins/attr.d.ts.map +1 -0
  141. package/packages/markdown/dist/types/plugins/card.d.ts +3 -0
  142. package/packages/markdown/dist/types/plugins/card.d.ts.map +1 -0
  143. package/packages/markdown/dist/types/plugins/cell.d.ts +3 -0
  144. package/packages/markdown/dist/types/plugins/cell.d.ts.map +1 -0
  145. package/packages/markdown/dist/types/plugins/faq.d.ts +3 -0
  146. package/packages/markdown/dist/types/plugins/faq.d.ts.map +1 -0
  147. package/packages/markdown/dist/types/plugins/grid.d.ts +3 -0
  148. package/packages/markdown/dist/types/plugins/grid.d.ts.map +1 -0
  149. package/packages/markdown/dist/types/plugins/headings.d.ts +9 -0
  150. package/packages/markdown/dist/types/plugins/headings.d.ts.map +1 -0
  151. package/packages/markdown/dist/types/plugins/helper.d.ts +9 -0
  152. package/packages/markdown/dist/types/plugins/helper.d.ts.map +1 -0
  153. package/packages/markdown/dist/types/plugins/index.d.ts +9 -0
  154. package/packages/markdown/dist/types/plugins/index.d.ts.map +1 -0
  155. package/packages/markdown/dist/types/plugins/linkButton.d.ts +3 -0
  156. package/packages/markdown/dist/types/plugins/linkButton.d.ts.map +1 -0
  157. package/packages/markdown/dist/types/plugins/youtube.d.ts +3 -0
  158. package/packages/markdown/dist/types/plugins/youtube.d.ts.map +1 -0
  159. package/packages/markdown/node_modules/.bin/autoprefixer +17 -0
  160. package/packages/markdown/node_modules/.bin/tailwind +17 -0
  161. package/packages/markdown/node_modules/.bin/tailwindcss +17 -0
  162. package/packages/markdown/node_modules/.bin/ts-node +17 -0
  163. package/packages/markdown/node_modules/.bin/ts-node-cwd +17 -0
  164. package/packages/markdown/node_modules/.bin/ts-node-esm +17 -0
  165. package/packages/markdown/node_modules/.bin/ts-node-script +17 -0
  166. package/packages/markdown/node_modules/.bin/ts-node-transpile-only +17 -0
  167. package/packages/markdown/node_modules/.bin/ts-script +17 -0
  168. package/packages/markdown/node_modules/.bin/tsc +17 -0
  169. package/packages/markdown/node_modules/.bin/tsserver +17 -0
  170. package/packages/markdown/package.json +83 -0
  171. package/packages/markdown/src/components/Markdown.tsx +361 -0
  172. package/packages/markdown/src/components/index.ts +1 -0
  173. package/packages/markdown/src/global.d.ts +9 -0
  174. package/packages/markdown/src/index.ts +1 -0
  175. package/packages/markdown/src/plugins/attr.ts +19 -0
  176. package/packages/markdown/src/plugins/card.ts +57 -0
  177. package/packages/markdown/src/plugins/cell.ts +47 -0
  178. package/packages/markdown/src/plugins/faq.ts +40 -0
  179. package/packages/markdown/src/plugins/grid.ts +51 -0
  180. package/packages/markdown/src/plugins/headings.ts +35 -0
  181. package/packages/markdown/src/plugins/helper.ts +27 -0
  182. package/packages/markdown/src/plugins/index.ts +8 -0
  183. package/packages/markdown/src/plugins/linkButton.ts +25 -0
  184. package/packages/markdown/src/plugins/youtube.ts +48 -0
  185. package/packages/markdown/tsconfig.json +13 -0
  186. package/packages/markdown/tsconfig.node.json +7 -0
  187. package/packages/markdown/vite.config.ts +30 -0
  188. package/packages/tailwind-theme-plugin/.turbo/turbo-build.log +22 -0
  189. package/packages/tailwind-theme-plugin/dist/index.cjs.js +1 -1
  190. package/packages/tailwind-theme-plugin/dist/index.es.js +5354 -6111
  191. package/packages/tailwind-theme-plugin/dist/types/index.d.ts +1 -1
  192. package/packages/tailwind-theme-plugin/dist/types/index.d.ts.map +1 -1
  193. package/packages/tailwind-theme-plugin/node_modules/.bin/autoprefixer +2 -2
  194. package/packages/tailwind-theme-plugin/node_modules/.bin/tailwind +2 -2
  195. package/packages/tailwind-theme-plugin/node_modules/.bin/tailwindcss +2 -2
  196. package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node +4 -4
  197. package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node-cwd +4 -4
  198. package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node-esm +4 -4
  199. package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node-script +4 -4
  200. package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node-transpile-only +4 -4
  201. package/packages/tailwind-theme-plugin/node_modules/.bin/ts-script +4 -4
  202. package/packages/tailwind-theme-plugin/node_modules/.bin/tsc +17 -0
  203. package/packages/tailwind-theme-plugin/node_modules/.bin/tsserver +17 -0
  204. package/packages/tailwind-theme-plugin/package.json +6 -6
  205. package/packages/tailwind-theme-plugin/src/index.ts +226 -291
  206. package/packages/core/src/libs/forward-ref.ts +0 -44
  207. package/packages/core/src/types/component.ts +0 -83
  208. package/packages/forms/dist/types/utils/class.d.ts.map +0 -1
  209. package/packages/forms/node_modules/.bin/acorn +0 -17
  210. package/packages/forms/node_modules/.bin/browserslist +0 -17
  211. package/packages/forms/node_modules/.bin/eslint +0 -17
  212. package/packages/forms/node_modules/.bin/vitest +0 -17
  213. package/packages/forms/src/utils/class.ts +0 -2
  214. package/packages/tailwind-theme-plugin/node_modules/.bin/browserslist +0 -17
  215. /package/packages/{core/src/libs → helper/src}/cx.ts +0 -0
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,10 @@ 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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sakura-ui/sakura-ui",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "keywords": [],
5
5
  "author": "glassonion1",
6
6
  "homepage": "https://github.com/glassonion1/sakura-ui",
@@ -16,28 +16,34 @@
16
16
  "access": "public"
17
17
  },
18
18
  "scripts": {
19
- "build": "pnpm --parallel --filter=./packages/* build"
19
+ "build": "turbo build"
20
+ },
21
+ "packageManager": "pnpm@9.15.1",
22
+ "engines": {
23
+ "pnpm": ">=9.15.1"
20
24
  },
21
25
  "dependencies": {
22
- "@sakura-ui/tailwind-theme-plugin": "workspace:*",
23
26
  "@sakura-ui/core": "workspace:*",
24
- "@sakura-ui/forms": "workspace:*"
27
+ "@sakura-ui/forms": "workspace:*",
28
+ "@sakura-ui/helper": "workspace:*",
29
+ "@sakura-ui/tailwind-theme-plugin": "workspace:*"
25
30
  },
26
31
  "peerDependencies": {
27
- "react": "^18.2.0",
28
- "react-dom": "^18.2.0",
29
- "tailwindcss": "^3.2.7"
32
+ "react": "^19.0.0",
33
+ "react-dom": "^19.0.0",
34
+ "tailwindcss": "^3.4.5"
30
35
  },
31
36
  "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
+ "@biomejs/biome": "^1.9.4",
38
+ "@types/node": "^22.10.2",
39
+ "@vitejs/plugin-react-swc": "^3.7.2",
40
+ "npm-run-all2": "^7.0.1",
41
+ "rimraf": "^6.0.1",
37
42
  "ts-node": "^10.9.2",
38
43
  "tsc-alias": "^1.8.10",
39
- "typescript": "^5.4.5",
40
- "vite": "^5.2.12",
41
- "vitest": "^1.6.0"
44
+ "turbo": "^2.3.3",
45
+ "typescript": "^5.7.2",
46
+ "vite": "^6.0.3",
47
+ "vitest": "^2.1.8"
42
48
  }
43
49
  }
@@ -1,8 +1,15 @@
1
1
  {
2
2
  "name": "@sakura-ui/core",
3
- "version": "0.2.0",
3
+ "version": "0.3.2",
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": {
@@ -39,20 +46,24 @@
39
46
  "test": "vitest"
40
47
  },
41
48
  "peerDependencies": {
42
- "react": "^18.2.0",
43
- "react-dom": "^18.2.0",
44
- "tailwindcss": "^3.2.7"
49
+ "react": "^19.0.0",
50
+ "react-dom": "^19.0.0",
51
+ "tailwindcss": "^3.4.5"
52
+ },
53
+ "dependencies": {
54
+ "@sakura-ui/helper": "0.0.5"
45
55
  },
46
56
  "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"
57
+ "@testing-library/jest-dom": "catalog:",
58
+ "@testing-library/react": "catalog:",
59
+ "@types/react": "catalog:",
60
+ "@types/react-dom": "catalog:",
61
+ "autoprefixer": "catalog:",
62
+ "happy-dom": "^15.11.7",
63
+ "postcss": "catalog:",
64
+ "react": "catalog:",
65
+ "react-dom": "catalog:",
66
+ "tailwindcss": "catalog:",
67
+ "vitest": "catalog:"
57
68
  }
58
69
  }
@@ -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<React.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,13 +20,11 @@ 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 (
@@ -41,9 +41,11 @@ export const Card = (props: CardProps) => {
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,15 +108,18 @@ 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
 
108
118
  const style = `
109
119
  text-base-sm
120
+ leading-[1.85rem]
110
121
  first:pt-4
122
+ pt-2
111
123
  last:pb-4
112
124
  px-6
113
125
  `
@@ -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 = `
@@ -1,18 +1,18 @@
1
1
  import React from 'react'
2
- import { cx } from '../libs/cx'
2
+ import { cx } from '@sakura-ui/helper'
3
3
 
4
- export interface HeadingProps extends React.ComponentPropsWithoutRef<'h1'> {}
4
+ export namespace H1 {
5
+ export interface Props extends React.ComponentPropsWithoutRef<'h1'> {}
6
+ }
5
7
 
6
- export const H1 = (props: HeadingProps) => {
8
+ export const H1 = (props: H1.Props) => {
7
9
  const { className, children, ...restProps } = props
8
10
 
9
11
  const style = `
10
12
  text-h-lg-m
11
13
  sm:text-h-lg
12
- mt-8
13
- mb-3
14
- sm:mt-16
15
- sm:mb-6
14
+ pt-[2rem]
15
+ sm:pt-[6.5rem]
16
16
  `
17
17
 
18
18
  return (
@@ -22,16 +22,18 @@ export const H1 = (props: HeadingProps) => {
22
22
  )
23
23
  }
24
24
 
25
- export const H2 = (props: HeadingProps) => {
25
+ export namespace H2 {
26
+ export interface Props extends React.ComponentPropsWithoutRef<'h2'> {}
27
+ }
28
+
29
+ export const H2 = (props: H2.Props) => {
26
30
  const { className, children, ...restProps } = props
27
31
 
28
32
  const style = `
29
33
  text-h-med-m
30
34
  sm:text-h-med
31
- mt-8
32
- mb-3
33
- sm:mt-16
34
- sm:mb-6
35
+ pt-[4rem]
36
+ sm:pt-[4.5rem]
35
37
  `
36
38
 
37
39
  return (
@@ -41,16 +43,18 @@ export const H2 = (props: HeadingProps) => {
41
43
  )
42
44
  }
43
45
 
44
- export const H3 = (props: HeadingProps) => {
46
+ export namespace H3 {
47
+ export interface Props extends React.ComponentPropsWithoutRef<'h3'> {}
48
+ }
49
+
50
+ export const H3 = (props: H3.Props) => {
45
51
  const { className, children, ...restProps } = props
46
52
 
47
53
  const style = `
48
54
  text-h-sm-m
49
55
  sm:text-h-sm
50
- mt-5
51
- mb-3
52
- sm:mt-10
53
- sm:mb-6
56
+ pt-[4rem]
57
+ sm:pt-[4.5rem]
54
58
  `
55
59
 
56
60
  return (
@@ -60,16 +64,18 @@ export const H3 = (props: HeadingProps) => {
60
64
  )
61
65
  }
62
66
 
63
- export const H4 = (props: HeadingProps) => {
67
+ export namespace H4 {
68
+ export interface Props extends React.ComponentPropsWithoutRef<'h4'> {}
69
+ }
70
+
71
+ export const H4 = (props: H4.Props) => {
64
72
  const { className, children, ...restProps } = props
65
73
 
66
74
  const style = `
67
75
  text-h-xs-m
68
76
  sm:text-h-xs
69
- mt-5
70
- mb-2
71
- sm:mt-10
72
- sm:mb-4
77
+ pt-[3.5rem]
78
+ sm:pt-[4.5rem]
73
79
  `
74
80
 
75
81
  return (
@@ -79,16 +85,18 @@ export const H4 = (props: HeadingProps) => {
79
85
  )
80
86
  }
81
87
 
82
- export const H5 = (props: HeadingProps) => {
88
+ export namespace H5 {
89
+ export interface Props extends React.ComponentPropsWithoutRef<'h5'> {}
90
+ }
91
+
92
+ export const H5 = (props: H5.Props) => {
83
93
  const { className, children, ...restProps } = props
84
94
 
85
95
  const style = `
86
96
  text-h-xxs-m
87
97
  sm:text-h-xxs
88
- mt-5
89
- mb-2
90
- sm:mt-10
91
- sm:mb-4
98
+ pt-[3rem]
99
+ sm:pt-[4rem]
92
100
  `
93
101
 
94
102
  return (
@@ -98,16 +106,18 @@ export const H5 = (props: HeadingProps) => {
98
106
  )
99
107
  }
100
108
 
101
- export const H6 = (props: HeadingProps) => {
109
+ export namespace H6 {
110
+ export interface Props extends React.ComponentPropsWithoutRef<'h6'> {}
111
+ }
112
+
113
+ export const H6 = (props: H6.Props) => {
102
114
  const { className, children, ...restProps } = props
103
115
 
104
116
  const style = `
105
117
  text-h-xxs-m
106
118
  sm:text-h-xxs
107
- mt-3
108
- mb-2
109
- sm:mt-6
110
- sm:mb-4
119
+ pt-[2.5rem]
120
+ sm:pt-[3.5rem]
111
121
  `
112
122
 
113
123
  return (
@@ -1,32 +1,62 @@
1
1
  import React from 'react'
2
- import { cx } from '../libs/cx'
2
+ import { cx } from '@sakura-ui/helper'
3
3
 
4
- export interface IconProps extends React.ComponentPropsWithRef<'span'> {
5
- icon: string
6
- srText?: string
4
+ export namespace Icon {
5
+ export interface Props extends React.ComponentPropsWithRef<'span'> {
6
+ opticalSize?: 16 | 20 | 24 | 40 | 44 | 48
7
+ altText?: string
8
+ }
7
9
  }
8
10
 
9
- export const Icon = React.forwardRef<HTMLElement, IconProps>((props, ref) => {
10
- const { className, icon, srText, ...restProps } = props
11
+ export const Icon = React.forwardRef<HTMLElement, Icon.Props>((props, ref) => {
12
+ const { className, altText = '', opticalSize = 24, children, ...rest } = props
13
+
14
+ const size = {
15
+ 16: '!text-[16px]',
16
+ 20: '!text-[20px]',
17
+ 24: '!text-[24px]',
18
+ 40: '!text-[40px]',
19
+ 44: '!text-[44px]',
20
+ 48: '!text-[48px]'
21
+ }
22
+
23
+ const fontSize = size[opticalSize]
24
+
25
+ // @see: https://developers.google.com/fonts/docs/material_symbols
26
+ //.material-symbols-outlined {
27
+ // font-family: 'Material Symbols Outlined';
28
+ // font-weight: normal;
29
+ // font-style: normal;
30
+ // font-size: 24px; /* Preferred icon size */
31
+ // display: inline-block;
32
+ // line-height: 1;
33
+ // text-transform: none;
34
+ // letter-spacing: normal;
35
+ // word-wrap: normal;
36
+ // white-space: nowrap;
37
+ // direction: ltr;
38
+ //}
11
39
 
12
40
  const style = `
13
- inline
14
- align-middle
15
41
  font-icon
16
- antialiased
42
+ font-light
43
+ inline-block
44
+ leading-none
45
+ align-middle
46
+ whitespace-nowrap
17
47
  `
18
48
 
19
49
  return (
20
50
  <>
21
51
  <span
22
52
  aria-hidden="true"
23
- className={cx(style, className)}
24
- {...restProps}
53
+ className={cx(className, fontSize, style)}
54
+ {...rest}
25
55
  ref={ref}
26
56
  >
27
- {icon}
57
+ {children}
28
58
  </span>
29
- <span className="sr-only">{srText}</span>
59
+ <span className="sr-only">{altText}</span>
30
60
  </>
31
61
  )
32
62
  })