@sakura-ui/sakura-ui 0.1.16 → 0.1.19
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/package.json +16 -1
- package/packages/config/package.json +23 -27
- package/packages/config/src/index.ts +66 -1
- package/packages/config/tests/index.test.ts +1 -1
- package/packages/config/tsconfig.json +9 -17
- package/packages/config/tsconfig.node.json +6 -0
- package/packages/config/vite.config.ts +5 -3
- package/packages/core/package.json +27 -44
- package/packages/core/src/components/Button.tsx +23 -56
- package/packages/core/src/components/Card.tsx +30 -20
- package/packages/core/src/components/Code.tsx +1 -1
- package/packages/core/src/components/Faq.tsx +3 -5
- package/packages/core/src/components/Heading.tsx +1 -1
- package/packages/core/src/components/Icon.tsx +15 -10
- package/packages/core/src/components/IconButton.tsx +47 -76
- package/packages/core/src/components/InfoCard.tsx +1 -1
- package/packages/core/src/components/Link.tsx +44 -44
- package/packages/core/src/components/List.tsx +1 -1
- package/packages/core/src/components/Pre.tsx +1 -1
- package/packages/core/src/components/Table.tsx +4 -3
- package/packages/core/src/components/buttonStyle.ts +84 -0
- package/packages/core/src/components/index.ts +24 -7
- package/packages/core/src/index.ts +26 -0
- package/packages/core/src/libs/forward-ref.ts +41 -0
- package/packages/core/src/types/component.ts +82 -0
- package/packages/core/tsconfig.json +2 -1
- package/packages/core/tsconfig.node.json +1 -4
- package/packages/core/vite.config.ts +6 -3
- package/packages/forms/dist/components/Checkbox.js +27 -24
- package/packages/forms/dist/components/Checkbox.js.map +1 -1
- package/packages/forms/dist/components/FileInput.js +55 -0
- package/packages/forms/dist/components/FileInput.js.map +1 -0
- package/packages/forms/dist/components/Input.js +15 -13
- package/packages/forms/dist/components/Input.js.map +1 -1
- package/packages/forms/dist/components/LabelControl.js +7 -1
- package/packages/forms/dist/components/LabelControl.js.map +1 -1
- package/packages/forms/dist/components/Radio.js +26 -24
- package/packages/forms/dist/components/Radio.js.map +1 -1
- package/packages/forms/dist/components/Select.js +27 -25
- package/packages/forms/dist/components/Select.js.map +1 -1
- package/packages/forms/dist/components/Textarea.js +15 -13
- package/packages/forms/dist/components/Textarea.js.map +1 -1
- package/packages/forms/dist/components/index.js +1 -0
- package/packages/forms/dist/components/index.js.map +1 -1
- package/packages/forms/dist/index.cjs.js +155 -101
- package/packages/forms/dist/index.es.js +490 -411
- package/packages/forms/dist/index.js +1 -1
- package/packages/forms/dist/index.js.map +1 -1
- package/packages/forms/dist/types/components/Checkbox.d.ts.map +1 -0
- package/packages/forms/dist/types/components/FieldsetControl.d.ts.map +1 -0
- package/packages/forms/dist/types/components/FileInput.d.ts +5 -0
- package/packages/forms/dist/types/components/FileInput.d.ts.map +1 -0
- package/packages/forms/dist/types/components/Input.d.ts.map +1 -0
- package/packages/forms/dist/types/components/LabelControl.d.ts.map +1 -0
- package/packages/forms/dist/types/components/Radio.d.ts.map +1 -0
- package/packages/forms/dist/types/components/Select.d.ts.map +1 -0
- package/packages/forms/dist/types/components/Textarea.d.ts.map +1 -0
- package/packages/forms/dist/types/components/context.d.ts.map +1 -0
- package/packages/forms/dist/types/components/controlled/CheckboxGroup.d.ts.map +1 -0
- package/packages/forms/dist/types/components/controlled/InputItem.d.ts.map +1 -0
- package/packages/forms/dist/types/components/controlled/RadioGroup.d.ts.map +1 -0
- package/packages/forms/dist/types/components/controlled/SelectControl.d.ts.map +1 -0
- package/packages/forms/dist/types/components/controlled/TextareaControl.d.ts.map +1 -0
- package/packages/forms/dist/types/components/controlled/index.d.ts.map +1 -0
- package/packages/forms/dist/types/components/index.d.ts +9 -0
- package/packages/forms/dist/types/components/index.d.ts.map +1 -0
- package/packages/forms/dist/types/index.d.ts +4 -0
- package/packages/forms/dist/types/index.d.ts.map +1 -0
- package/packages/forms/dist/types/utils/class.d.ts.map +1 -0
- package/packages/forms/node_modules/.bin/eslint +17 -0
- package/packages/forms/node_modules/.bin/tailwind +2 -2
- package/packages/forms/node_modules/.bin/tailwindcss +2 -2
- package/packages/forms/node_modules/.bin/ts-node +4 -4
- package/packages/forms/node_modules/.bin/ts-node-cwd +4 -4
- package/packages/forms/node_modules/.bin/ts-node-esm +4 -4
- package/packages/forms/node_modules/.bin/ts-node-script +4 -4
- package/packages/forms/node_modules/.bin/ts-node-transpile-only +4 -4
- package/packages/forms/node_modules/.bin/ts-script +4 -4
- package/packages/forms/node_modules/.bin/vitest +17 -0
- package/packages/forms/node_modules/.vitest/results.json +1 -0
- package/packages/forms/package.json +23 -31
- package/packages/forms/src/components/Checkbox.tsx +27 -23
- package/packages/forms/src/components/FileInput.tsx +74 -0
- package/packages/forms/src/components/Input.tsx +16 -14
- package/packages/forms/src/components/LabelControl.tsx +13 -6
- package/packages/forms/src/components/Radio.tsx +28 -23
- package/packages/forms/src/components/Select.tsx +28 -26
- package/packages/forms/src/components/Textarea.tsx +16 -13
- package/packages/forms/src/components/index.ts +8 -7
- package/packages/forms/src/index.ts +12 -0
- package/packages/forms/tsconfig.json +4 -3
- package/packages/forms/tsconfig.node.json +1 -4
- package/packages/forms/vite.config.ts +6 -3
- package/packages/config/jest.config.ts +0 -10
- package/packages/core/coverage/clover.xml +0 -258
- package/packages/core/coverage/coverage-final.json +0 -2700
- package/packages/core/coverage/lcov-report/base.css +0 -362
- package/packages/core/coverage/lcov-report/block-navigation.js +0 -85
- package/packages/core/coverage/lcov-report/favicon.png +0 -0
- package/packages/core/coverage/lcov-report/index.html +0 -216
- package/packages/core/coverage/lcov-report/prettify.css +0 -101
- package/packages/core/coverage/lcov-report/prettify.js +0 -1004
- package/packages/core/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/packages/core/coverage/lcov-report/sorter.js +0 -191
- package/packages/core/coverage/lcov-report/src/components/Button.tsx.html +0 -303
- package/packages/core/coverage/lcov-report/src/components/Card.tsx.html +0 -399
- package/packages/core/coverage/lcov-report/src/components/Code.tsx.html +0 -144
- package/packages/core/coverage/lcov-report/src/components/Heading.tsx.html +0 -405
- package/packages/core/coverage/lcov-report/src/components/Icon.tsx.html +0 -183
- package/packages/core/coverage/lcov-report/src/components/IconButton.tsx.html +0 -378
- package/packages/core/coverage/lcov-report/src/components/InfoCard.tsx.html +0 -240
- package/packages/core/coverage/lcov-report/src/components/Link.tsx.html +0 -324
- package/packages/core/coverage/lcov-report/src/components/List.tsx.html +0 -204
- package/packages/core/coverage/lcov-report/src/components/Pre.tsx.html +0 -153
- package/packages/core/coverage/lcov-report/src/components/Table.tsx.html +0 -429
- package/packages/core/coverage/lcov-report/src/components/index.html +0 -396
- package/packages/core/coverage/lcov-report/src/components/index.ts.html +0 -126
- package/packages/core/coverage/lcov-report/src/index.html +0 -176
- package/packages/core/coverage/lcov-report/src/index.ts.html +0 -171
- package/packages/core/coverage/lcov-report/src/utils/class.ts.html +0 -90
- package/packages/core/coverage/lcov-report/src/utils/index.html +0 -176
- package/packages/core/coverage/lcov.info +0 -523
- package/packages/core/jest.config.ts +0 -11
- package/packages/forms/dist/components/Checkbox.d.ts.map +0 -1
- package/packages/forms/dist/components/FieldsetControl.d.ts.map +0 -1
- package/packages/forms/dist/components/Input.d.ts.map +0 -1
- package/packages/forms/dist/components/LabelControl.d.ts.map +0 -1
- package/packages/forms/dist/components/Radio.d.ts.map +0 -1
- package/packages/forms/dist/components/Select.d.ts.map +0 -1
- package/packages/forms/dist/components/Textarea.d.ts.map +0 -1
- package/packages/forms/dist/components/context.d.ts.map +0 -1
- package/packages/forms/dist/components/controlled/CheckboxGroup.d.ts.map +0 -1
- package/packages/forms/dist/components/controlled/InputItem.d.ts.map +0 -1
- package/packages/forms/dist/components/controlled/RadioGroup.d.ts.map +0 -1
- package/packages/forms/dist/components/controlled/SelectControl.d.ts.map +0 -1
- package/packages/forms/dist/components/controlled/TextareaControl.d.ts.map +0 -1
- package/packages/forms/dist/components/controlled/index.d.ts.map +0 -1
- package/packages/forms/dist/components/index.d.ts +0 -8
- package/packages/forms/dist/components/index.d.ts.map +0 -1
- package/packages/forms/dist/index.cjs.js.map +0 -1
- package/packages/forms/dist/index.d.ts +0 -3
- package/packages/forms/dist/index.d.ts.map +0 -1
- package/packages/forms/dist/index.es.js.map +0 -1
- package/packages/forms/dist/utils/class.d.ts.map +0 -1
- package/packages/forms/node_modules/.bin/jest +0 -17
- package/packages/forms/node_modules/.bin/npm-run-all +0 -17
- package/packages/forms/node_modules/.bin/run-p +0 -17
- package/packages/forms/node_modules/.bin/run-s +0 -17
- package/packages/forms/node_modules/.bin/ts-jest +0 -17
- package/packages/forms/node_modules/.bin/tsc +0 -17
- package/packages/forms/node_modules/.bin/tsc-alias +0 -17
- package/packages/forms/node_modules/.bin/tsserver +0 -17
- package/packages/forms/node_modules/.bin/vite +0 -17
- /package/packages/core/src/{utils/class.ts → libs/cx.ts} +0 -0
- /package/packages/forms/dist/{components → types/components}/Checkbox.d.ts +0 -0
- /package/packages/forms/dist/{components → types/components}/FieldsetControl.d.ts +0 -0
- /package/packages/forms/dist/{components → types/components}/Input.d.ts +0 -0
- /package/packages/forms/dist/{components → types/components}/LabelControl.d.ts +0 -0
- /package/packages/forms/dist/{components → types/components}/Radio.d.ts +0 -0
- /package/packages/forms/dist/{components → types/components}/Select.d.ts +0 -0
- /package/packages/forms/dist/{components → types/components}/Textarea.d.ts +0 -0
- /package/packages/forms/dist/{components → types/components}/context.d.ts +0 -0
- /package/packages/forms/dist/{components → types/components}/controlled/CheckboxGroup.d.ts +0 -0
- /package/packages/forms/dist/{components → types/components}/controlled/InputItem.d.ts +0 -0
- /package/packages/forms/dist/{components → types/components}/controlled/RadioGroup.d.ts +0 -0
- /package/packages/forms/dist/{components → types/components}/controlled/SelectControl.d.ts +0 -0
- /package/packages/forms/dist/{components → types/components}/controlled/TextareaControl.d.ts +0 -0
- /package/packages/forms/dist/{components → types/components}/controlled/index.d.ts +0 -0
- /package/packages/forms/dist/{utils → types/utils}/class.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sakura-ui/sakura-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": "glassonion1",
|
|
6
6
|
"homepage": "https://github.com/glassonion1/sakura-ui",
|
|
@@ -24,5 +24,20 @@
|
|
|
24
24
|
"react": "^18.2.0",
|
|
25
25
|
"react-dom": "^18.2.0",
|
|
26
26
|
"tailwindcss": "^3.2.7"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/node": "^18.16.19",
|
|
30
|
+
"@typescript-eslint/eslint-plugin": "^6.4.1",
|
|
31
|
+
"@typescript-eslint/parser": "^6.4.1",
|
|
32
|
+
"@vitejs/plugin-react-swc": "^3.3.2",
|
|
33
|
+
"eslint": "^8.47.0",
|
|
34
|
+
"eslint-config-prettier": "^9.0.0",
|
|
35
|
+
"npm-run-all2": "^6.1.2",
|
|
36
|
+
"rimraf": "^5.0.5",
|
|
37
|
+
"ts-node": "^10.9.1",
|
|
38
|
+
"tsc-alias": "^1.8.7",
|
|
39
|
+
"typescript": "^5.1.6",
|
|
40
|
+
"vite": "^4.4.2",
|
|
41
|
+
"vitest": "^1.3.1"
|
|
27
42
|
}
|
|
28
43
|
}
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sakura-ui/config",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
|
+
"description": "",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"author": "glassonion1",
|
|
7
|
+
"homepage": "https://github.com/glassonion1/sakura-ui",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+ssh://git@github.com:glassonion1/sakura-ui.git",
|
|
11
|
+
"directory": "packages/config"
|
|
12
|
+
},
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"type": "module",
|
|
4
15
|
"main": "dist/index.cjs.js",
|
|
5
|
-
"types": "dist/index.d.ts",
|
|
16
|
+
"types": "dist/types/index.d.ts",
|
|
6
17
|
"exports": {
|
|
7
18
|
".": {
|
|
19
|
+
"types": "./dist/types/index.d.ts",
|
|
8
20
|
"require": "./dist/index.cjs.js",
|
|
9
21
|
"import": "./dist/index.es.js"
|
|
10
22
|
}
|
|
@@ -13,38 +25,22 @@
|
|
|
13
25
|
"files": [
|
|
14
26
|
"dist"
|
|
15
27
|
],
|
|
16
|
-
"publishConfig": {
|
|
17
|
-
"access": "public"
|
|
18
|
-
},
|
|
19
28
|
"scripts": {
|
|
29
|
+
"lint": "run-s lint:*",
|
|
30
|
+
"lint:eslint": "eslint . --ext .ts,.tsx --fix",
|
|
31
|
+
"lint:prettier": "prettier --write --ignore-path .gitignore './src/*.ts'",
|
|
32
|
+
"prebuild": "rimraf dist",
|
|
20
33
|
"build": "run-p build:*",
|
|
21
34
|
"build:scripts": "vite build",
|
|
22
|
-
"build:types": "tsc",
|
|
23
|
-
"test": "
|
|
35
|
+
"build:types": "tsc && tsc-alias",
|
|
36
|
+
"test": "vitest"
|
|
24
37
|
},
|
|
25
|
-
"keywords": [],
|
|
26
|
-
"author": "glassonion1",
|
|
27
|
-
"homepage": "https://github.com/glassonion1/sakura-ui",
|
|
28
|
-
"repository": {
|
|
29
|
-
"type": "git",
|
|
30
|
-
"url": "git+ssh://git@github.com:glassonion1/sakura-ui.git",
|
|
31
|
-
"directory": "packages/config"
|
|
32
|
-
},
|
|
33
|
-
"license": "MIT",
|
|
34
38
|
"peerDependencies": {
|
|
35
39
|
"tailwindcss": "^3.2.7"
|
|
36
40
|
},
|
|
37
41
|
"devDependencies": {
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"jest": "^29.6.1",
|
|
42
|
-
"npm-run-all": "^4.1.5",
|
|
43
|
-
"postcss": "^8.4.25",
|
|
44
|
-
"tailwindcss": "^3.3.2",
|
|
45
|
-
"ts-jest": "^29.1.1",
|
|
46
|
-
"ts-node": "^10.9.1",
|
|
47
|
-
"typescript": "^5.1.6",
|
|
48
|
-
"vite": "^4.4.2"
|
|
42
|
+
"autoprefixer": "^10.4.17",
|
|
43
|
+
"postcss": "^8.4.35",
|
|
44
|
+
"tailwindcss": "^3.4.1"
|
|
49
45
|
}
|
|
50
46
|
}
|
|
@@ -1,7 +1,38 @@
|
|
|
1
1
|
import plugin from 'tailwindcss/plugin'
|
|
2
2
|
|
|
3
|
+
const booleans = [
|
|
4
|
+
'atomic',
|
|
5
|
+
'busy',
|
|
6
|
+
'checked',
|
|
7
|
+
'current',
|
|
8
|
+
'disabled',
|
|
9
|
+
'expanded',
|
|
10
|
+
'grabbed',
|
|
11
|
+
'haspopup',
|
|
12
|
+
'hidden',
|
|
13
|
+
'invalid',
|
|
14
|
+
'live',
|
|
15
|
+
'modal',
|
|
16
|
+
'multiline',
|
|
17
|
+
'multiselectable',
|
|
18
|
+
'pressed',
|
|
19
|
+
'readonly',
|
|
20
|
+
'required',
|
|
21
|
+
'selected'
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
const enumerables = {
|
|
25
|
+
autocomplete: ['both', 'inline', 'list', 'none'],
|
|
26
|
+
current: ['date', 'location', 'page', 'step', 'time'],
|
|
27
|
+
dropeffect: ['copy', 'execute', 'link', 'move', 'none', 'popup'],
|
|
28
|
+
haspopup: ['dialog', 'grid', 'listbox', 'menu', 'tree'],
|
|
29
|
+
orientation: ['horizontal', 'undefined', 'vertial'],
|
|
30
|
+
relevant: ['additions', 'all', 'removals', 'text'],
|
|
31
|
+
sort: ['ascending', 'descending', 'none', 'other']
|
|
32
|
+
}
|
|
33
|
+
|
|
3
34
|
const sakuraPlugin = plugin(
|
|
4
|
-
({ addBase }) => {
|
|
35
|
+
({ addBase, addVariant }) => {
|
|
5
36
|
addBase({
|
|
6
37
|
'@font-face': {
|
|
7
38
|
fontFamily: 'Material Symbols Outlined',
|
|
@@ -9,6 +40,32 @@ const sakuraPlugin = plugin(
|
|
|
9
40
|
fontStyle: 'normal'
|
|
10
41
|
}
|
|
11
42
|
})
|
|
43
|
+
const addAriaVariant = (name: string, value: string) => {
|
|
44
|
+
addVariant(name, `[${name}="${value}"]&`)
|
|
45
|
+
addVariant(`peer-${name}`, `:merge(.peer)[${name}="${value}"] ~ &`)
|
|
46
|
+
addVariant(`group-${name}`, `:merge(.group)[${name}="${value}"] &`)
|
|
47
|
+
}
|
|
48
|
+
const addAriaEnumVariant = (name: string, value: string) => {
|
|
49
|
+
addVariant(`${name}-${value}`, `[${name}="${value}"]&`)
|
|
50
|
+
addVariant(
|
|
51
|
+
`peer-${name}-${value}`,
|
|
52
|
+
`:merge(.peer)[${name}="${value}"] ~ &`
|
|
53
|
+
)
|
|
54
|
+
addVariant(
|
|
55
|
+
`group-${name}-${value}`,
|
|
56
|
+
`:merge(.group)[${name}="${value}"] &`
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
for (const attribute of booleans) {
|
|
61
|
+
addAriaVariant(`aria-${attribute}`, 'true')
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
for (const [attribute, values] of Object.entries(enumerables)) {
|
|
65
|
+
for (const value of values) {
|
|
66
|
+
addAriaEnumVariant(`aria-${attribute}`, value)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
12
69
|
},
|
|
13
70
|
{
|
|
14
71
|
theme: {
|
|
@@ -155,6 +212,14 @@ const sakuraPlugin = plugin(
|
|
|
155
212
|
fontWeight: '700'
|
|
156
213
|
}
|
|
157
214
|
],
|
|
215
|
+
'button-sm': [
|
|
216
|
+
'14px',
|
|
217
|
+
{
|
|
218
|
+
lineHeight: '14px',
|
|
219
|
+
letterSpacing: '0.04em',
|
|
220
|
+
fontWeight: '700'
|
|
221
|
+
}
|
|
222
|
+
],
|
|
158
223
|
label: [
|
|
159
224
|
'14px',
|
|
160
225
|
{
|
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
+
"extends": "../../tsconfig.json",
|
|
2
3
|
"compilerOptions": {
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"resolveJsonModule": true,
|
|
10
|
-
"isolatedModules": true,
|
|
11
|
-
"esModuleInterop": true,
|
|
12
|
-
"noUnusedLocals": true,
|
|
13
|
-
"noUnusedParameters": true,
|
|
14
|
-
"noImplicitReturns": true,
|
|
15
|
-
"skipLibCheck": true,
|
|
16
|
-
"outDir": "dist",
|
|
17
|
-
"declaration": true,
|
|
18
|
-
"declarationMap": true
|
|
4
|
+
"declarationDir": "./dist/types",
|
|
5
|
+
"outDir": "./dist",
|
|
6
|
+
"baseUrl": ".",
|
|
7
|
+
"paths": {
|
|
8
|
+
"@/*": ["src/*"]
|
|
9
|
+
}
|
|
19
10
|
},
|
|
20
|
-
"include": ["src"]
|
|
11
|
+
"include": ["src"],
|
|
12
|
+
"references": [{ "path": "./tsconfig.node.json" }]
|
|
21
13
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="vitest" />
|
|
1
2
|
import { resolve } from 'path'
|
|
2
3
|
import { defineConfig } from 'vite'
|
|
3
4
|
import { peerDependencies } from './package.json'
|
|
@@ -17,8 +18,9 @@ export default defineConfig({
|
|
|
17
18
|
},
|
|
18
19
|
rollupOptions: {
|
|
19
20
|
external: [...Object.keys(peerDependencies)]
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
test: {
|
|
24
|
+
globals: true
|
|
23
25
|
}
|
|
24
26
|
})
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sakura-ui/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.33",
|
|
4
|
+
"description": "",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"author": "glassonion1",
|
|
7
|
+
"homepage": "https://github.com/glassonion1/sakura-ui",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+ssh://git@github.com:glassonion1/sakura-ui.git",
|
|
11
|
+
"directory": "packages/core"
|
|
12
|
+
},
|
|
13
|
+
"license": "MIT",
|
|
4
14
|
"type": "module",
|
|
5
15
|
"main": "dist/index.cjs.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
16
|
+
"types": "dist/types/index.d.ts",
|
|
7
17
|
"exports": {
|
|
8
18
|
".": {
|
|
19
|
+
"types": "./dist/types/index.d.ts",
|
|
9
20
|
"require": "./dist/index.cjs.js",
|
|
10
21
|
"import": "./dist/index.es.js"
|
|
11
22
|
}
|
|
@@ -14,61 +25,33 @@
|
|
|
14
25
|
"files": [
|
|
15
26
|
"dist"
|
|
16
27
|
],
|
|
17
|
-
"publishConfig": {
|
|
18
|
-
"access": "public"
|
|
19
|
-
},
|
|
20
28
|
"scripts": {
|
|
21
|
-
"
|
|
29
|
+
"lint": "run-s lint:*",
|
|
30
|
+
"lint:eslint": "eslint . --ext .ts,.tsx --fix",
|
|
31
|
+
"lint:prettier": "prettier --write --ignore-path .gitignore './src/*.ts'",
|
|
32
|
+
"prebuild": "rimraf dist",
|
|
22
33
|
"build": "run-p build:*",
|
|
23
34
|
"build:scripts": "vite build",
|
|
24
35
|
"build:types": "tsc && tsc-alias",
|
|
25
|
-
"test": "
|
|
26
|
-
"lint": "run-p lint:*",
|
|
27
|
-
"lint:prettier": "prettier --write .",
|
|
28
|
-
"lint:eslint": "eslint --ext \".ts,.tsx\" --fix src"
|
|
36
|
+
"test": "vitest"
|
|
29
37
|
},
|
|
30
|
-
"keywords": [],
|
|
31
|
-
"author": "glassonion1",
|
|
32
|
-
"homepage": "https://github.com/glassonion1/sakura-ui",
|
|
33
|
-
"repository": {
|
|
34
|
-
"type": "git",
|
|
35
|
-
"url": "git+ssh://git@github.com:glassonion1/sakura-ui.git",
|
|
36
|
-
"directory": "packages/core"
|
|
37
|
-
},
|
|
38
|
-
"license": "MIT",
|
|
39
38
|
"peerDependencies": {
|
|
40
39
|
"react": "^18.2.0",
|
|
41
40
|
"react-dom": "^18.2.0",
|
|
42
41
|
"tailwindcss": "^3.2.7"
|
|
43
42
|
},
|
|
44
43
|
"devDependencies": {
|
|
45
|
-
"@jest
|
|
46
|
-
"@testing-library/
|
|
47
|
-
"@
|
|
48
|
-
"@types/
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"@types/react-dom": "^18.2.6",
|
|
52
|
-
"@types/testing-library__jest-dom": "^5.14.7",
|
|
53
|
-
"@typescript-eslint/eslint-plugin": "^6.4.1",
|
|
54
|
-
"@typescript-eslint/parser": "^6.4.1",
|
|
55
|
-
"@vitejs/plugin-react-swc": "^3.3.2",
|
|
56
|
-
"autoprefixer": "^10.4.14",
|
|
57
|
-
"eslint": "^8.47.0",
|
|
58
|
-
"eslint-config-prettier": "^9.0.0",
|
|
59
|
-
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
44
|
+
"@testing-library/jest-dom": "^6.4.2",
|
|
45
|
+
"@testing-library/react": "^14.2.1",
|
|
46
|
+
"@types/react": "^18.2.60",
|
|
47
|
+
"@types/react-dom": "^18.2.19",
|
|
48
|
+
"autoprefixer": "^10.4.17",
|
|
49
|
+
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
60
50
|
"eslint-plugin-react": "^7.33.2",
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"postcss": "^8.4.25",
|
|
64
|
-
"prettier": "^3.0.2",
|
|
51
|
+
"jsdom": "^24.0.0",
|
|
52
|
+
"postcss": "^8.4.35",
|
|
65
53
|
"react": "^18.2.0",
|
|
66
54
|
"react-dom": "^18.2.0",
|
|
67
|
-
"tailwindcss": "^3.
|
|
68
|
-
"ts-jest": "^29.1.1",
|
|
69
|
-
"ts-node": "^10.9.1",
|
|
70
|
-
"tsc-alias": "^1.8.7",
|
|
71
|
-
"typescript": "^5.1.6",
|
|
72
|
-
"vite": "^4.4.2"
|
|
55
|
+
"tailwindcss": "^3.4.1"
|
|
73
56
|
}
|
|
74
57
|
}
|
|
@@ -1,70 +1,37 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { cx } from '../libs/cx'
|
|
2
|
+
import { ComponentWithAs } from '../types/component'
|
|
3
|
+
import { forwardRef } from '../libs/forward-ref'
|
|
4
|
+
import { base, getVariantStyle, getSizeStyle } from './buttonStyle'
|
|
3
5
|
|
|
4
|
-
export interface ButtonProps
|
|
6
|
+
export interface ButtonProps {
|
|
5
7
|
variant?: 'primary' | 'secondary'
|
|
6
|
-
|
|
8
|
+
size?: 'lg' | 'md' | 'sm' | 'xs'
|
|
7
9
|
}
|
|
8
10
|
|
|
9
|
-
export const Button
|
|
11
|
+
export const Button: ComponentWithAs<'button', ButtonProps> = forwardRef(
|
|
10
12
|
(props, ref) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
p-4
|
|
20
|
-
text-button
|
|
21
|
-
text-${align}
|
|
22
|
-
rounded-lg
|
|
23
|
-
cursor-pointer
|
|
24
|
-
whitespace-nowrap
|
|
25
|
-
border
|
|
26
|
-
border-solid
|
|
27
|
-
border-sea-800
|
|
28
|
-
active:enabled:border-sea-800/[.8]
|
|
29
|
-
hover:enabled:border-sea-800/[.85]
|
|
30
|
-
focus:outline
|
|
31
|
-
focus:outline-2
|
|
32
|
-
focus:outline-wood-600
|
|
33
|
-
disabled:border-sumi-500
|
|
34
|
-
disabled:cursor-not-allowed
|
|
35
|
-
`
|
|
36
|
-
|
|
37
|
-
const primary = `
|
|
38
|
-
text-white-1000
|
|
39
|
-
bg-sea-800
|
|
40
|
-
active:enabled:bg-sea-800/[.8]
|
|
41
|
-
hover:enabled:bg-sea-800/[.85]
|
|
42
|
-
disabled:bg-sumi-500
|
|
43
|
-
disabled:text-white-1000
|
|
44
|
-
`
|
|
45
|
-
const secondary = `
|
|
46
|
-
text-sea-800
|
|
47
|
-
bg-transparent
|
|
48
|
-
active:enabled:bg-sea-50/[.60]
|
|
49
|
-
hover:enabled:bg-sea-50
|
|
50
|
-
active:enabled:text-sea-800/[.85]
|
|
51
|
-
hover:enabled:text-sea-800/[.85]
|
|
52
|
-
disabled:text-sumi-500
|
|
53
|
-
`
|
|
54
|
-
|
|
55
|
-
const styles = {
|
|
56
|
-
primary: primary,
|
|
57
|
-
secondary: secondary
|
|
58
|
-
}
|
|
13
|
+
const {
|
|
14
|
+
as: Component = 'button',
|
|
15
|
+
variant = 'primary',
|
|
16
|
+
size = 'lg',
|
|
17
|
+
className,
|
|
18
|
+
children,
|
|
19
|
+
...restProps
|
|
20
|
+
} = props
|
|
59
21
|
|
|
60
22
|
return (
|
|
61
|
-
<
|
|
62
|
-
className={cx(
|
|
23
|
+
<Component
|
|
24
|
+
className={cx(
|
|
25
|
+
base,
|
|
26
|
+
getVariantStyle(variant),
|
|
27
|
+
getSizeStyle(size),
|
|
28
|
+
className
|
|
29
|
+
)}
|
|
63
30
|
{...restProps}
|
|
64
31
|
ref={ref}
|
|
65
32
|
>
|
|
66
33
|
{children}
|
|
67
|
-
</
|
|
34
|
+
</Component>
|
|
68
35
|
)
|
|
69
36
|
}
|
|
70
37
|
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { cx } from '../
|
|
2
|
+
import { cx } from '../libs/cx'
|
|
3
3
|
|
|
4
4
|
interface IdContextType {
|
|
5
5
|
id: string
|
|
@@ -23,8 +23,10 @@ export const Card = (props: CardProps) => {
|
|
|
23
23
|
sm:rounded-3xl
|
|
24
24
|
text-sumi-900
|
|
25
25
|
overflow-hidden
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
px-6
|
|
27
|
+
py-4
|
|
28
|
+
flex flex-col
|
|
29
|
+
gap-2
|
|
28
30
|
`
|
|
29
31
|
|
|
30
32
|
return (
|
|
@@ -40,7 +42,24 @@ export const Card = (props: CardProps) => {
|
|
|
40
42
|
)
|
|
41
43
|
}
|
|
42
44
|
|
|
43
|
-
export interface
|
|
45
|
+
export interface CardImgProps extends React.ComponentPropsWithoutRef<'img'> {}
|
|
46
|
+
|
|
47
|
+
export const CardImg = (props: CardImgProps) => {
|
|
48
|
+
const { className, children, ...restProps } = props
|
|
49
|
+
|
|
50
|
+
const ctx = React.useContext(IdContext)
|
|
51
|
+
|
|
52
|
+
const style = `
|
|
53
|
+
object-cover
|
|
54
|
+
-px-6
|
|
55
|
+
-py-4
|
|
56
|
+
`
|
|
57
|
+
|
|
58
|
+
return <img id={ctx.id} className={cx(style, className)} {...restProps} />
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface CardHeaderProps
|
|
62
|
+
extends React.ComponentPropsWithoutRef<'div'> {}
|
|
44
63
|
|
|
45
64
|
export const CardHeader = (props: CardHeaderProps) => {
|
|
46
65
|
const { className, children, ...restProps } = props
|
|
@@ -48,30 +67,24 @@ export const CardHeader = (props: CardHeaderProps) => {
|
|
|
48
67
|
const ctx = React.useContext(IdContext)
|
|
49
68
|
|
|
50
69
|
const style = `
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
text-h-xxs-m
|
|
54
|
-
sm:text-h-xxs
|
|
55
|
-
leading-none
|
|
70
|
+
text-base
|
|
71
|
+
font-medium
|
|
56
72
|
`
|
|
57
73
|
|
|
58
74
|
return (
|
|
59
|
-
<
|
|
75
|
+
<div id={ctx.id} className={cx(style, className)} {...restProps}>
|
|
60
76
|
{children}
|
|
61
|
-
</
|
|
77
|
+
</div>
|
|
62
78
|
)
|
|
63
79
|
}
|
|
64
80
|
|
|
65
|
-
export interface CardBodyProps extends React.ComponentPropsWithoutRef<'
|
|
81
|
+
export interface CardBodyProps extends React.ComponentPropsWithoutRef<'div'> {}
|
|
66
82
|
|
|
67
83
|
export const CardBody = (props: CardBodyProps) => {
|
|
68
84
|
const { className, children, ...restProps } = props
|
|
69
85
|
|
|
70
86
|
const style = `
|
|
71
|
-
|
|
72
|
-
first:pt-6
|
|
73
|
-
pb-6
|
|
74
|
-
text-base
|
|
87
|
+
text-base-sm
|
|
75
88
|
`
|
|
76
89
|
|
|
77
90
|
return (
|
|
@@ -88,10 +101,7 @@ export const CardFooter = (props: CardFooterProps) => {
|
|
|
88
101
|
const { className, children, ...restProps } = props
|
|
89
102
|
|
|
90
103
|
const style = `
|
|
91
|
-
|
|
92
|
-
px-6
|
|
93
|
-
first:pt-6
|
|
94
|
-
pb-6
|
|
104
|
+
text-base-sm
|
|
95
105
|
`
|
|
96
106
|
|
|
97
107
|
return (
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { cx } from '../
|
|
2
|
+
import { cx } from '../libs/cx'
|
|
3
3
|
|
|
4
4
|
export interface FaqProps extends React.ComponentPropsWithoutRef<'dl'> {}
|
|
5
5
|
|
|
6
6
|
const headingStyle = `
|
|
7
7
|
text-h-med-m
|
|
8
8
|
sm:text-h-med
|
|
9
|
-
!leading-none
|
|
10
9
|
`
|
|
11
10
|
|
|
12
11
|
export const Faq = (props: FaqProps) => {
|
|
@@ -41,8 +40,7 @@ export const Question = (props: QuestionProps) => {
|
|
|
41
40
|
flex
|
|
42
41
|
flex-row
|
|
43
42
|
gap-8
|
|
44
|
-
mt-
|
|
45
|
-
first:mt-0
|
|
43
|
+
mt-8
|
|
46
44
|
`
|
|
47
45
|
return (
|
|
48
46
|
<dt
|
|
@@ -75,7 +73,7 @@ export const Answer = (props: AnswerProps) => {
|
|
|
75
73
|
itemType="https://schema.org/Answer"
|
|
76
74
|
{...restProps}
|
|
77
75
|
>
|
|
78
|
-
<span className={headingStyle} aria-hidden="true">
|
|
76
|
+
<span className={cx(headingStyle, '!leading-none')} aria-hidden="true">
|
|
79
77
|
A
|
|
80
78
|
</span>
|
|
81
79
|
<span itemProp="text">{children}</span>
|
|
@@ -1,28 +1,33 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { cx } from '../
|
|
2
|
+
import { cx } from '../libs/cx'
|
|
3
3
|
|
|
4
4
|
export interface IconProps extends React.ComponentPropsWithRef<'span'> {
|
|
5
5
|
icon: string
|
|
6
|
+
srText?: string
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
export const Icon = React.forwardRef<HTMLElement, IconProps>((props, ref) => {
|
|
9
|
-
const { className, icon, ...restProps } = props
|
|
10
|
+
const { className, icon, srText, ...restProps } = props
|
|
10
11
|
|
|
11
12
|
const style = `
|
|
12
|
-
inline
|
|
13
|
+
inline
|
|
13
14
|
align-middle
|
|
14
15
|
font-icon
|
|
15
|
-
text-2xl
|
|
16
|
-
font-light
|
|
17
|
-
leading-none
|
|
18
16
|
antialiased
|
|
19
|
-
mb-1
|
|
20
17
|
`
|
|
21
18
|
|
|
22
19
|
return (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
<>
|
|
21
|
+
<span
|
|
22
|
+
aria-hidden="true"
|
|
23
|
+
className={cx(style, className)}
|
|
24
|
+
{...restProps}
|
|
25
|
+
ref={ref}
|
|
26
|
+
>
|
|
27
|
+
{icon}
|
|
28
|
+
</span>
|
|
29
|
+
<span className="sr-only">{srText}</span>
|
|
30
|
+
</>
|
|
26
31
|
)
|
|
27
32
|
})
|
|
28
33
|
|