@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.
- package/README.md +77 -6
- package/package.json +28 -21
- package/packages/core/package.json +30 -17
- package/packages/core/src/components/Button.tsx +33 -32
- package/packages/core/src/components/Card.tsx +37 -20
- package/packages/core/src/components/Code.tsx +6 -4
- package/packages/core/src/components/Faq.tsx +13 -7
- package/packages/core/src/components/Heading.tsx +42 -32
- package/packages/core/src/components/Icon.tsx +43 -13
- package/packages/core/src/components/IconButton.tsx +54 -43
- package/packages/core/src/components/LangSelector.tsx +135 -0
- package/packages/core/src/components/Link.tsx +37 -66
- package/packages/core/src/components/LinkCard.tsx +126 -0
- package/packages/core/src/components/List.tsx +14 -12
- package/packages/core/src/components/MenuButton.tsx +112 -0
- package/packages/core/src/components/NavigationItem.tsx +41 -0
- package/packages/core/src/components/NotificationBanner.tsx +20 -0
- package/packages/core/src/components/OverflowContainer.tsx +24 -0
- package/packages/core/src/components/PopoverMenu.tsx +82 -0
- package/packages/core/src/components/Pre.tsx +6 -4
- package/packages/core/src/components/Table.tsx +31 -25
- package/packages/core/src/components/buttonStyle.ts +43 -32
- package/packages/core/src/components/index.ts +13 -25
- package/packages/core/src/icons/Close.tsx +21 -0
- package/packages/core/src/icons/CloseMobile.tsx +43 -0
- package/packages/core/src/icons/KeyboardArrowDown.tsx +24 -0
- package/packages/core/src/icons/Language.tsx +25 -0
- package/packages/core/src/icons/LanguageMobile.tsx +40 -0
- package/packages/core/src/icons/Menu.tsx +24 -0
- package/packages/core/src/icons/MenuMobile.tsx +40 -0
- package/packages/core/src/icons/index.ts +8 -0
- package/packages/core/src/icons/props.ts +5 -0
- package/packages/core/src/index.ts +10 -28
- package/packages/core/src/type.d.ts +1 -0
- package/packages/core/tests/Button.test.tsx +20 -10
- package/packages/core/tests/Card.test.tsx +16 -11
- package/packages/core/tests/IconButton.test.tsx +57 -0
- package/packages/core/tests/Link.test.tsx +60 -0
- package/packages/core/tests/vitest.setup.ts +1 -0
- package/packages/core/tsconfig.node.json +3 -2
- package/packages/core/vite.config.ts +2 -1
- package/packages/forms/.turbo/turbo-build.log +12 -0
- package/packages/forms/dist/index.cjs.js +183 -131
- package/packages/forms/dist/index.es.js +750 -1062
- package/packages/forms/dist/types/components/Checkbox.d.ts +9 -4
- package/packages/forms/dist/types/components/Checkbox.d.ts.map +1 -1
- package/packages/forms/dist/types/components/FieldsetControl.d.ts +14 -9
- package/packages/forms/dist/types/components/FieldsetControl.d.ts.map +1 -1
- package/packages/forms/dist/types/components/FileInput.d.ts +10 -3
- package/packages/forms/dist/types/components/FileInput.d.ts.map +1 -1
- package/packages/forms/dist/types/components/Input.d.ts +9 -4
- package/packages/forms/dist/types/components/Input.d.ts.map +1 -1
- package/packages/forms/dist/types/components/LabelControl.d.ts +13 -8
- package/packages/forms/dist/types/components/LabelControl.d.ts.map +1 -1
- package/packages/forms/dist/types/components/Radio.d.ts +9 -4
- package/packages/forms/dist/types/components/Radio.d.ts.map +1 -1
- package/packages/forms/dist/types/components/Select.d.ts +9 -4
- package/packages/forms/dist/types/components/Select.d.ts.map +1 -1
- package/packages/forms/dist/types/components/Textarea.d.ts +8 -3
- package/packages/forms/dist/types/components/Textarea.d.ts.map +1 -1
- package/packages/forms/dist/types/components/controlled/CheckboxGroup.d.ts +16 -11
- package/packages/forms/dist/types/components/controlled/CheckboxGroup.d.ts.map +1 -1
- package/packages/forms/dist/types/components/controlled/RadioGroup.d.ts +17 -12
- package/packages/forms/dist/types/components/controlled/RadioGroup.d.ts.map +1 -1
- package/packages/forms/dist/types/components/index.d.ts +8 -8
- package/packages/forms/dist/types/components/index.d.ts.map +1 -1
- package/packages/forms/dist/types/components/inputStyle.d.ts +1 -1
- package/packages/forms/dist/types/components/inputStyle.d.ts.map +1 -1
- package/packages/forms/dist/types/index.d.ts +0 -1
- package/packages/forms/dist/types/index.d.ts.map +1 -1
- package/packages/forms/node_modules/.bin/autoprefixer +44 -6
- package/packages/forms/package.json +21 -16
- package/packages/forms/src/components/Checkbox.tsx +76 -80
- package/packages/forms/src/components/FieldsetControl.tsx +21 -28
- package/packages/forms/src/components/FileInput.tsx +92 -63
- package/packages/forms/src/components/Input.tsx +29 -31
- package/packages/forms/src/components/LabelControl.tsx +19 -25
- package/packages/forms/src/components/Radio.tsx +68 -69
- package/packages/forms/src/components/Select.tsx +65 -65
- package/packages/forms/src/components/Textarea.tsx +49 -54
- package/packages/forms/src/components/controlled/CheckboxGroup.tsx +15 -17
- package/packages/forms/src/components/controlled/RadioGroup.tsx +16 -18
- package/packages/forms/src/components/index.ts +8 -8
- package/packages/forms/src/components/inputStyle.ts +7 -8
- package/packages/forms/src/index.ts +0 -11
- package/packages/forms/tests/Checkbox.test.tsx +44 -0
- package/packages/forms/tests/FieldsetControl.test.tsx +68 -11
- package/packages/forms/tests/FileInput.test.tsx +25 -0
- package/packages/forms/tests/Input.test.tsx +12 -83
- package/packages/forms/tests/LabelControl.test.tsx +88 -20
- package/packages/forms/tests/Radio.test.tsx +23 -78
- package/packages/forms/tests/Select.test.tsx +30 -0
- package/packages/forms/tests/Textarea.test.tsx +25 -0
- package/packages/forms/tests/vitest.setup.ts +1 -0
- package/packages/forms/tsconfig.node.json +3 -2
- package/packages/forms/vite.config.ts +2 -1
- package/packages/helper/.turbo/turbo-build.log +12 -0
- package/packages/helper/dist/index.cjs.js +76 -0
- package/packages/helper/dist/index.es.js +119 -0
- package/packages/helper/dist/types/calc.d.ts +2 -0
- package/packages/helper/dist/types/calc.d.ts.map +1 -0
- package/packages/{forms/dist/types/utils/class.d.ts → helper/dist/types/cx.d.ts} +1 -1
- package/packages/helper/dist/types/cx.d.ts.map +1 -0
- package/packages/helper/dist/types/index.d.ts +6 -0
- package/packages/helper/dist/types/index.d.ts.map +1 -0
- package/packages/helper/dist/types/querySelector.d.ts +2 -0
- package/packages/helper/dist/types/querySelector.d.ts.map +1 -0
- package/packages/helper/dist/types/styles.d.ts +22 -0
- package/packages/helper/dist/types/styles.d.ts.map +1 -0
- package/packages/helper/dist/types/treefy.d.ts +8 -0
- package/packages/helper/dist/types/treefy.d.ts.map +1 -0
- package/packages/helper/node_modules/.bin/vitest +55 -0
- package/packages/helper/package.json +50 -0
- package/packages/helper/src/calc.ts +1 -0
- package/packages/helper/src/cx.ts +2 -0
- package/packages/helper/src/index.ts +5 -0
- package/packages/helper/src/querySelector.ts +20 -0
- package/packages/helper/src/styles.ts +114 -0
- package/packages/helper/src/treefy.ts +24 -0
- package/packages/helper/tests/calc.test.ts +22 -0
- package/packages/helper/tests/cx.test.ts +30 -0
- package/packages/helper/tests/querySelector.test.ts +24 -0
- package/packages/helper/tests/treefy.test.ts +111 -0
- package/packages/helper/tests/vitest.setup.ts +2 -0
- package/packages/helper/tsconfig.json +13 -0
- package/packages/helper/tsconfig.node.json +6 -0
- package/packages/helper/vite.config.ts +26 -0
- package/packages/markdown/.turbo/turbo-build.log +12 -0
- package/packages/markdown/README.md +129 -0
- package/packages/markdown/dist/index.cjs.js +149 -0
- package/packages/markdown/dist/index.es.js +16960 -0
- package/packages/markdown/dist/types/components/Markdown.d.ts +15 -0
- package/packages/markdown/dist/types/components/Markdown.d.ts.map +1 -0
- package/packages/markdown/dist/types/components/index.d.ts +2 -0
- package/packages/markdown/dist/types/components/index.d.ts.map +1 -0
- package/packages/markdown/dist/types/index.d.ts +2 -0
- package/packages/markdown/dist/types/index.d.ts.map +1 -0
- package/packages/markdown/dist/types/plugins/attr.d.ts +3 -0
- package/packages/markdown/dist/types/plugins/attr.d.ts.map +1 -0
- package/packages/markdown/dist/types/plugins/card.d.ts +3 -0
- package/packages/markdown/dist/types/plugins/card.d.ts.map +1 -0
- package/packages/markdown/dist/types/plugins/cell.d.ts +3 -0
- package/packages/markdown/dist/types/plugins/cell.d.ts.map +1 -0
- package/packages/markdown/dist/types/plugins/faq.d.ts +3 -0
- package/packages/markdown/dist/types/plugins/faq.d.ts.map +1 -0
- package/packages/markdown/dist/types/plugins/grid.d.ts +3 -0
- package/packages/markdown/dist/types/plugins/grid.d.ts.map +1 -0
- package/packages/markdown/dist/types/plugins/headings.d.ts +11 -0
- package/packages/markdown/dist/types/plugins/headings.d.ts.map +1 -0
- package/packages/markdown/dist/types/plugins/helper.d.ts +9 -0
- package/packages/markdown/dist/types/plugins/helper.d.ts.map +1 -0
- package/packages/markdown/dist/types/plugins/index.d.ts +9 -0
- package/packages/markdown/dist/types/plugins/index.d.ts.map +1 -0
- package/packages/markdown/dist/types/plugins/linkButton.d.ts +3 -0
- package/packages/markdown/dist/types/plugins/linkButton.d.ts.map +1 -0
- package/packages/markdown/dist/types/plugins/youtube.d.ts +3 -0
- package/packages/markdown/dist/types/plugins/youtube.d.ts.map +1 -0
- package/packages/markdown/node_modules/.bin/autoprefixer +55 -0
- package/packages/markdown/package.json +84 -0
- package/packages/markdown/src/components/Markdown.tsx +365 -0
- package/packages/markdown/src/components/index.ts +1 -0
- package/packages/markdown/src/global.d.ts +9 -0
- package/packages/markdown/src/index.ts +1 -0
- package/packages/markdown/src/plugins/attr.ts +19 -0
- package/packages/markdown/src/plugins/card.ts +57 -0
- package/packages/markdown/src/plugins/cell.ts +47 -0
- package/packages/markdown/src/plugins/faq.ts +40 -0
- package/packages/markdown/src/plugins/grid.ts +54 -0
- package/packages/markdown/src/plugins/headings.ts +38 -0
- package/packages/markdown/src/plugins/helper.ts +27 -0
- package/packages/markdown/src/plugins/index.ts +8 -0
- package/packages/markdown/src/plugins/linkButton.ts +26 -0
- package/packages/markdown/src/plugins/youtube.ts +49 -0
- package/packages/markdown/tsconfig.json +13 -0
- package/packages/markdown/tsconfig.node.json +7 -0
- package/packages/markdown/vite.config.ts +30 -0
- package/packages/tailwind-theme-plugin/#package.json# +51 -0
- package/packages/tailwind-theme-plugin/.turbo/turbo-build.log +12 -0
- package/packages/tailwind-theme-plugin/dist/index.cjs.js +1 -1
- package/packages/tailwind-theme-plugin/dist/index.es.js +4970 -6093
- package/packages/tailwind-theme-plugin/dist/types/index.d.ts +1 -4
- package/packages/tailwind-theme-plugin/dist/types/index.d.ts.map +1 -1
- package/packages/tailwind-theme-plugin/node_modules/.bin/autoprefixer +44 -6
- package/packages/tailwind-theme-plugin/package.json +11 -9
- package/packages/tailwind-theme-plugin/src/index.ts +241 -349
- package/packages/tailwind-theme-plugin/vite.config.ts +2 -0
- package/packages/core/src/libs/cx.ts +0 -2
- package/packages/core/src/libs/forward-ref.ts +0 -44
- package/packages/core/src/types/component.ts +0 -83
- package/packages/forms/dist/types/utils/class.d.ts.map +0 -1
- package/packages/forms/node_modules/.bin/acorn +0 -17
- package/packages/forms/node_modules/.bin/browserslist +0 -17
- package/packages/forms/node_modules/.bin/eslint +0 -17
- package/packages/forms/node_modules/.bin/tailwind +0 -17
- package/packages/forms/node_modules/.bin/tailwindcss +0 -17
- package/packages/forms/node_modules/.bin/ts-node +0 -17
- package/packages/forms/node_modules/.bin/ts-node-cwd +0 -17
- package/packages/forms/node_modules/.bin/ts-node-esm +0 -17
- package/packages/forms/node_modules/.bin/ts-node-script +0 -17
- package/packages/forms/node_modules/.bin/ts-node-transpile-only +0 -17
- package/packages/forms/node_modules/.bin/ts-script +0 -17
- package/packages/forms/node_modules/.bin/vitest +0 -17
- package/packages/forms/src/utils/class.ts +0 -2
- package/packages/tailwind-theme-plugin/node_modules/.bin/browserslist +0 -17
- package/packages/tailwind-theme-plugin/node_modules/.bin/tailwind +0 -17
- package/packages/tailwind-theme-plugin/node_modules/.bin/tailwindcss +0 -17
- package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node +0 -17
- package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node-cwd +0 -17
- package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node-esm +0 -17
- package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node-script +0 -17
- package/packages/tailwind-theme-plugin/node_modules/.bin/ts-node-transpile-only +0 -17
- 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/
|
|
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/
|
|
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
|
-
-
|
|
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.
|
|
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+
|
|
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
|
-
"
|
|
19
|
-
"
|
|
18
|
+
"engines": {
|
|
19
|
+
"pnpm": ">=9.15.1"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@sakura-ui/
|
|
23
|
-
"@sakura-ui/
|
|
24
|
-
"@sakura-ui/forms": "
|
|
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": "^
|
|
28
|
-
"react-dom": "^
|
|
29
|
-
"tailwindcss": "^
|
|
28
|
+
"react": "^19.2.1",
|
|
29
|
+
"react-dom": "^19.2.1",
|
|
30
|
+
"tailwindcss": "^4.1.17"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
|
-
"@biomejs/biome": "^
|
|
33
|
-
"@types/node": "^
|
|
34
|
-
"@vitejs/plugin-react-swc": "^3.
|
|
35
|
-
"npm-run-all2": "^
|
|
36
|
-
"rimraf": "^
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"typescript": "^5.
|
|
40
|
-
"vite": "^
|
|
41
|
-
"vitest": "^1.
|
|
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.
|
|
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+
|
|
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": "^
|
|
43
|
-
"react-dom": "^
|
|
44
|
-
"tailwindcss": "^
|
|
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": "
|
|
48
|
-
"@testing-library/react": "
|
|
49
|
-
"@types/react": "
|
|
50
|
-
"@types/react-dom": "
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"react
|
|
56
|
-
"
|
|
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 {
|
|
2
|
-
import
|
|
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
|
|
13
|
-
|
|
14
|
-
|
|
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
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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 '
|
|
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
|
|
10
|
+
export namespace Card {
|
|
11
|
+
export interface Props extends React.ComponentPropsWithoutRef<'article'> {}
|
|
12
|
+
}
|
|
11
13
|
|
|
12
|
-
export const Card = (props:
|
|
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-
|
|
23
|
+
border-solid-gray-500
|
|
22
24
|
rounded-2xl
|
|
23
25
|
sm:rounded-3xl
|
|
24
|
-
text-
|
|
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
|
|
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
|
|
40
|
+
</IdContext>
|
|
41
41
|
)
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
export
|
|
44
|
+
export namespace CardImg {
|
|
45
|
+
export interface Props extends React.ComponentPropsWithoutRef<'img'> {}
|
|
46
|
+
}
|
|
45
47
|
|
|
46
|
-
export const CardImg = (props:
|
|
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
|
|
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:
|
|
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
|
|
86
|
+
export namespace CardBody {
|
|
87
|
+
export interface Props extends React.ComponentPropsWithoutRef<'div'> {}
|
|
88
|
+
}
|
|
82
89
|
|
|
83
|
-
export const CardBody = (props:
|
|
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
|
|
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:
|
|
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 '
|
|
2
|
+
import { cx } from '@sakura-ui/helper'
|
|
3
3
|
|
|
4
|
-
export
|
|
4
|
+
export namespace Code {
|
|
5
|
+
export interface Props extends React.ComponentPropsWithoutRef<'code'> {}
|
|
6
|
+
}
|
|
5
7
|
|
|
6
|
-
export const Code = (props:
|
|
8
|
+
export const Code = (props: Code.Props) => {
|
|
7
9
|
const { className, children, ...restProps } = props
|
|
8
10
|
|
|
9
11
|
const style = `
|
|
10
|
-
bg-
|
|
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 '
|
|
2
|
+
import { cx } from '@sakura-ui/helper'
|
|
3
3
|
|
|
4
|
-
export
|
|
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:
|
|
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
|
|
36
|
+
export namespace Question {
|
|
37
|
+
export interface Props extends React.ComponentPropsWithoutRef<'dt'> {}
|
|
38
|
+
}
|
|
35
39
|
|
|
36
|
-
export const Question = (props:
|
|
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
|
|
61
|
+
export namespace Answer {
|
|
62
|
+
export interface Props extends React.ComponentPropsWithoutRef<'dd'> {}
|
|
63
|
+
}
|
|
58
64
|
|
|
59
|
-
export const Answer = (props:
|
|
65
|
+
export const Answer = (props: Answer.Props) => {
|
|
60
66
|
const { className, children, ...restProps } = props
|
|
61
67
|
|
|
62
68
|
const style = `
|