@sakura-ui/sakura-ui 0.1.17 → 0.1.20
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 -28
- package/packages/config/src/index.ts +58 -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 -45
- package/packages/core/src/components/Card.tsx +27 -12
- package/packages/core/src/components/Icon.tsx +13 -4
- package/packages/core/src/components/Link.tsx +4 -13
- package/packages/core/src/components/Table.tsx +3 -2
- package/packages/core/src/components/buttonStyle.ts +2 -1
- package/packages/core/src/components/index.ts +2 -1
- package/packages/core/src/index.ts +2 -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 +1 -1
- package/packages/forms/dist/components/Checkbox.js.map +1 -1
- package/packages/forms/dist/components/FileInput.js +6 -2
- package/packages/forms/dist/components/FileInput.js.map +1 -1
- package/packages/forms/dist/components/Input.js +15 -14
- package/packages/forms/dist/components/Input.js.map +1 -1
- package/packages/forms/dist/components/Radio.js +1 -1
- package/packages/forms/dist/components/Radio.js.map +1 -1
- package/packages/forms/dist/components/Select.js +27 -26
- package/packages/forms/dist/components/Select.js.map +1 -1
- package/packages/forms/dist/components/Textarea.js +15 -14
- package/packages/forms/dist/components/Textarea.js.map +1 -1
- package/packages/forms/dist/index.cjs.js +73 -63
- package/packages/forms/dist/index.es.js +270 -261
- 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.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.map +1 -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 -32
- package/packages/forms/src/components/Checkbox.tsx +1 -0
- package/packages/forms/src/components/FileInput.tsx +7 -10
- package/packages/forms/src/components/Input.tsx +16 -15
- package/packages/forms/src/components/Radio.tsx +1 -0
- package/packages/forms/src/components/Select.tsx +28 -27
- package/packages/forms/src/components/Textarea.tsx +16 -14
- 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/FileInput.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.map +0 -1
- package/packages/forms/dist/index.cjs.js.map +0 -1
- 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/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}/FileInput.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/{components → types/components}/index.d.ts +0 -0
- /package/packages/forms/dist/{index.d.ts → types/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.20",
|
|
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,11 +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
|
".": {
|
|
8
|
-
"types": "./dist/index.d.ts",
|
|
19
|
+
"types": "./dist/types/index.d.ts",
|
|
9
20
|
"require": "./dist/index.cjs.js",
|
|
10
21
|
"import": "./dist/index.es.js"
|
|
11
22
|
}
|
|
@@ -14,38 +25,22 @@
|
|
|
14
25
|
"files": [
|
|
15
26
|
"dist"
|
|
16
27
|
],
|
|
17
|
-
"publishConfig": {
|
|
18
|
-
"access": "public"
|
|
19
|
-
},
|
|
20
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",
|
|
21
33
|
"build": "run-p build:*",
|
|
22
34
|
"build:scripts": "vite build",
|
|
23
|
-
"build:types": "tsc",
|
|
24
|
-
"test": "
|
|
35
|
+
"build:types": "tsc && tsc-alias",
|
|
36
|
+
"test": "vitest"
|
|
25
37
|
},
|
|
26
|
-
"keywords": [],
|
|
27
|
-
"author": "glassonion1",
|
|
28
|
-
"homepage": "https://github.com/glassonion1/sakura-ui",
|
|
29
|
-
"repository": {
|
|
30
|
-
"type": "git",
|
|
31
|
-
"url": "git+ssh://git@github.com:glassonion1/sakura-ui.git",
|
|
32
|
-
"directory": "packages/config"
|
|
33
|
-
},
|
|
34
|
-
"license": "MIT",
|
|
35
38
|
"peerDependencies": {
|
|
36
39
|
"tailwindcss": "^3.2.7"
|
|
37
40
|
},
|
|
38
41
|
"devDependencies": {
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"jest": "^29.6.1",
|
|
43
|
-
"npm-run-all": "^4.1.5",
|
|
44
|
-
"postcss": "^8.4.25",
|
|
45
|
-
"tailwindcss": "^3.3.2",
|
|
46
|
-
"ts-jest": "^29.1.1",
|
|
47
|
-
"ts-node": "^10.9.1",
|
|
48
|
-
"typescript": "^5.1.6",
|
|
49
|
-
"vite": "^4.4.2"
|
|
42
|
+
"autoprefixer": "^10.4.17",
|
|
43
|
+
"postcss": "^8.4.35",
|
|
44
|
+
"tailwindcss": "^3.4.1"
|
|
50
45
|
}
|
|
51
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: {
|
|
@@ -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,12 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sakura-ui/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.36",
|
|
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
|
".": {
|
|
9
|
-
"types": "./dist/index.d.ts",
|
|
19
|
+
"types": "./dist/types/index.d.ts",
|
|
10
20
|
"require": "./dist/index.cjs.js",
|
|
11
21
|
"import": "./dist/index.es.js"
|
|
12
22
|
}
|
|
@@ -15,61 +25,33 @@
|
|
|
15
25
|
"files": [
|
|
16
26
|
"dist"
|
|
17
27
|
],
|
|
18
|
-
"publishConfig": {
|
|
19
|
-
"access": "public"
|
|
20
|
-
},
|
|
21
28
|
"scripts": {
|
|
22
|
-
"
|
|
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",
|
|
23
33
|
"build": "run-p build:*",
|
|
24
34
|
"build:scripts": "vite build",
|
|
25
35
|
"build:types": "tsc && tsc-alias",
|
|
26
|
-
"test": "
|
|
27
|
-
"lint": "run-p lint:*",
|
|
28
|
-
"lint:prettier": "prettier --write .",
|
|
29
|
-
"lint:eslint": "eslint --ext \".ts,.tsx\" --fix src"
|
|
36
|
+
"test": "vitest"
|
|
30
37
|
},
|
|
31
|
-
"keywords": [],
|
|
32
|
-
"author": "glassonion1",
|
|
33
|
-
"homepage": "https://github.com/glassonion1/sakura-ui",
|
|
34
|
-
"repository": {
|
|
35
|
-
"type": "git",
|
|
36
|
-
"url": "git+ssh://git@github.com:glassonion1/sakura-ui.git",
|
|
37
|
-
"directory": "packages/core"
|
|
38
|
-
},
|
|
39
|
-
"license": "MIT",
|
|
40
38
|
"peerDependencies": {
|
|
41
39
|
"react": "^18.2.0",
|
|
42
40
|
"react-dom": "^18.2.0",
|
|
43
41
|
"tailwindcss": "^3.2.7"
|
|
44
42
|
},
|
|
45
43
|
"devDependencies": {
|
|
46
|
-
"@jest
|
|
47
|
-
"@testing-library/
|
|
48
|
-
"@
|
|
49
|
-
"@types/
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"@types/react-dom": "^18.2.6",
|
|
53
|
-
"@types/testing-library__jest-dom": "^5.14.7",
|
|
54
|
-
"@typescript-eslint/eslint-plugin": "^6.4.1",
|
|
55
|
-
"@typescript-eslint/parser": "^6.4.1",
|
|
56
|
-
"@vitejs/plugin-react-swc": "^3.3.2",
|
|
57
|
-
"autoprefixer": "^10.4.14",
|
|
58
|
-
"eslint": "^8.47.0",
|
|
59
|
-
"eslint-config-prettier": "^9.0.0",
|
|
60
|
-
"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",
|
|
61
50
|
"eslint-plugin-react": "^7.33.2",
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"postcss": "^8.4.25",
|
|
65
|
-
"prettier": "^3.0.2",
|
|
51
|
+
"jsdom": "^24.0.0",
|
|
52
|
+
"postcss": "^8.4.35",
|
|
66
53
|
"react": "^18.2.0",
|
|
67
54
|
"react-dom": "^18.2.0",
|
|
68
|
-
"tailwindcss": "^3.
|
|
69
|
-
"ts-jest": "^29.1.1",
|
|
70
|
-
"ts-node": "^10.9.1",
|
|
71
|
-
"tsc-alias": "^1.8.7",
|
|
72
|
-
"typescript": "^5.1.6",
|
|
73
|
-
"vite": "^4.4.2"
|
|
55
|
+
"tailwindcss": "^3.4.1"
|
|
74
56
|
}
|
|
75
57
|
}
|
|
@@ -23,6 +23,8 @@ export const Card = (props: CardProps) => {
|
|
|
23
23
|
sm:rounded-3xl
|
|
24
24
|
text-sumi-900
|
|
25
25
|
overflow-hidden
|
|
26
|
+
flex flex-col
|
|
27
|
+
gap-2
|
|
26
28
|
`
|
|
27
29
|
|
|
28
30
|
return (
|
|
@@ -38,7 +40,22 @@ export const Card = (props: CardProps) => {
|
|
|
38
40
|
)
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
export interface
|
|
43
|
+
export interface CardImgProps extends React.ComponentPropsWithoutRef<'img'> {}
|
|
44
|
+
|
|
45
|
+
export const CardImg = (props: CardImgProps) => {
|
|
46
|
+
const { className, children, ...restProps } = props
|
|
47
|
+
|
|
48
|
+
const ctx = React.useContext(IdContext)
|
|
49
|
+
|
|
50
|
+
const style = `
|
|
51
|
+
object-cover
|
|
52
|
+
`
|
|
53
|
+
|
|
54
|
+
return <img id={ctx.id} className={cx(style, className)} {...restProps} />
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface CardHeaderProps
|
|
58
|
+
extends React.ComponentPropsWithoutRef<'div'> {}
|
|
42
59
|
|
|
43
60
|
export const CardHeader = (props: CardHeaderProps) => {
|
|
44
61
|
const { className, children, ...restProps } = props
|
|
@@ -46,12 +63,11 @@ export const CardHeader = (props: CardHeaderProps) => {
|
|
|
46
63
|
const ctx = React.useContext(IdContext)
|
|
47
64
|
|
|
48
65
|
const style = `
|
|
49
|
-
px-6
|
|
50
|
-
first:pt-6
|
|
51
|
-
last:pb-6
|
|
52
|
-
py-3
|
|
53
66
|
text-base
|
|
54
67
|
font-medium
|
|
68
|
+
first:pt-4
|
|
69
|
+
last:pb-4
|
|
70
|
+
px-6
|
|
55
71
|
`
|
|
56
72
|
|
|
57
73
|
return (
|
|
@@ -67,11 +83,10 @@ export const CardBody = (props: CardBodyProps) => {
|
|
|
67
83
|
const { className, children, ...restProps } = props
|
|
68
84
|
|
|
69
85
|
const style = `
|
|
70
|
-
px-6
|
|
71
|
-
first:pt-6
|
|
72
|
-
last:pb-6
|
|
73
|
-
pb-3
|
|
74
86
|
text-base-sm
|
|
87
|
+
first:pt-4
|
|
88
|
+
last:pb-4
|
|
89
|
+
px-6
|
|
75
90
|
`
|
|
76
91
|
|
|
77
92
|
return (
|
|
@@ -88,10 +103,10 @@ export const CardFooter = (props: CardFooterProps) => {
|
|
|
88
103
|
const { className, children, ...restProps } = props
|
|
89
104
|
|
|
90
105
|
const style = `
|
|
91
|
-
px-6
|
|
92
|
-
first:pt-6
|
|
93
|
-
last:pb-6
|
|
94
106
|
text-base-sm
|
|
107
|
+
first:pt-4
|
|
108
|
+
last:pb-4
|
|
109
|
+
px-6
|
|
95
110
|
`
|
|
96
111
|
|
|
97
112
|
return (
|
|
@@ -3,10 +3,11 @@ 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
13
|
inline
|
|
@@ -16,9 +17,17 @@ export const Icon = React.forwardRef<HTMLElement, IconProps>((props, ref) => {
|
|
|
16
17
|
`
|
|
17
18
|
|
|
18
19
|
return (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
+
</>
|
|
22
31
|
)
|
|
23
32
|
})
|
|
24
33
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react'
|
|
2
1
|
import { cx } from '../libs/cx'
|
|
3
2
|
import { ComponentWithAs } from '../types/component'
|
|
4
3
|
import { forwardRef } from '../libs/forward-ref'
|
|
@@ -20,6 +19,7 @@ export const Link: ComponentWithAs<'a', LinkProps> = forwardRef(
|
|
|
20
19
|
underline-offset-[0.125em]
|
|
21
20
|
`
|
|
22
21
|
|
|
22
|
+
// Make lines break at each word
|
|
23
23
|
const style = `
|
|
24
24
|
rounded-sm
|
|
25
25
|
cursor-pointer
|
|
@@ -31,6 +31,7 @@ export const Link: ComponentWithAs<'a', LinkProps> = forwardRef(
|
|
|
31
31
|
focus:outline-2
|
|
32
32
|
focus:outline-wood-500
|
|
33
33
|
disabled:border-sumi-500
|
|
34
|
+
[overflow-wrap:anywhere]
|
|
34
35
|
`
|
|
35
36
|
|
|
36
37
|
const styleIcon = `
|
|
@@ -43,17 +44,6 @@ export const Link: ComponentWithAs<'a', LinkProps> = forwardRef(
|
|
|
43
44
|
antialiased
|
|
44
45
|
`
|
|
45
46
|
|
|
46
|
-
const [iconLabel, setIconLabel] = useState('')
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
const language =
|
|
49
|
-
(window.navigator.languages && window.navigator.languages[0]) ||
|
|
50
|
-
window.navigator.language
|
|
51
|
-
if (language === 'ja') {
|
|
52
|
-
setIconLabel('新規タブで開きます')
|
|
53
|
-
}
|
|
54
|
-
setIconLabel('Opens in new tab')
|
|
55
|
-
}, [])
|
|
56
|
-
|
|
57
47
|
if (href?.startsWith('http')) {
|
|
58
48
|
return (
|
|
59
49
|
<Component
|
|
@@ -65,9 +55,10 @@ export const Link: ComponentWithAs<'a', LinkProps> = forwardRef(
|
|
|
65
55
|
ref={ref}
|
|
66
56
|
>
|
|
67
57
|
<span className={styleUnderLine}>{children}</span>
|
|
68
|
-
<span className={cx(styleIcon)} aria-
|
|
58
|
+
<span className={cx(styleIcon)} aria-hidden="true">
|
|
69
59
|
open_in_new
|
|
70
60
|
</span>
|
|
61
|
+
<span className="sr-only">Opens in new tab</span>
|
|
71
62
|
</Component>
|
|
72
63
|
)
|
|
73
64
|
}
|
|
@@ -6,7 +6,7 @@ export interface TableProps extends React.ComponentPropsWithoutRef<'table'> {}
|
|
|
6
6
|
const styleBorder = `
|
|
7
7
|
border
|
|
8
8
|
border-collapse
|
|
9
|
-
border-
|
|
9
|
+
border-[#cccccc]
|
|
10
10
|
`
|
|
11
11
|
|
|
12
12
|
export const Table = (props: TableProps) => {
|
|
@@ -71,7 +71,8 @@ export const Th = (props: ThProps) => {
|
|
|
71
71
|
|
|
72
72
|
const style = `
|
|
73
73
|
p-2
|
|
74
|
-
bg-
|
|
74
|
+
bg-[#f8f8fb]
|
|
75
|
+
text-base
|
|
75
76
|
text-left
|
|
76
77
|
`
|
|
77
78
|
return (
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { Button, type ButtonProps } from './Button'
|
|
2
|
-
export { Card, CardHeader, CardBody, CardFooter } from './Card'
|
|
2
|
+
export { Card, CardImg, CardHeader, CardBody, CardFooter } from './Card'
|
|
3
3
|
export type {
|
|
4
4
|
CardProps,
|
|
5
|
+
CardImgProps,
|
|
5
6
|
CardHeaderProps,
|
|
6
7
|
CardBodyProps,
|
|
7
8
|
CardFooterProps
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="vitest" />
|
|
1
2
|
import { resolve } from 'path'
|
|
2
3
|
import { defineConfig } from 'vite'
|
|
3
4
|
import react from '@vitejs/plugin-react-swc'
|
|
@@ -19,8 +20,10 @@ export default defineConfig({
|
|
|
19
20
|
},
|
|
20
21
|
rollupOptions: {
|
|
21
22
|
external: [...Object.keys(peerDependencies)]
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
test: {
|
|
26
|
+
globals: true,
|
|
27
|
+
environment: 'jsdom'
|
|
25
28
|
}
|
|
26
29
|
})
|
|
@@ -40,7 +40,7 @@ export const Checkbox = React.forwardRef((props, ref) => {
|
|
|
40
40
|
peer-focus-visible:ring-offset-2
|
|
41
41
|
peer-focus-visible:ring-wood-500
|
|
42
42
|
`;
|
|
43
|
-
return (_jsx("label", { htmlFor: restProps.id, className: cx(style, className), children: _jsxs("span", { className: "flex items-center", children: [_jsx("input", { className: styleInput, type: "checkbox", "aria-describedby": ctx.helperTextId, "aria-errormessage": ctx.errorMessageId, "aria-invalid": ctx.isInvalid ?? false, ...restProps, ref: ref }), _jsx("span", { className: styleCheck, children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", children: _jsx("path", { d: "m9.55 17.65-5.325-5.325 1.05-1.075 4.275 4.275 9.175-9.175 1.05 1.075Z" }) }) }), _jsx("span", { className: "peer-disabled:text-sumi-500", children: children })] }) }));
|
|
43
|
+
return (_jsx("label", { htmlFor: restProps.id, className: cx(style, className), children: _jsxs("span", { className: "flex items-center", children: [_jsx("input", { className: styleInput, type: "checkbox", "aria-describedby": ctx.helperTextId, "aria-errormessage": ctx.errorMessageId, "aria-invalid": ctx.isInvalid ?? false, "aria-required": ctx.isRequired ?? false, ...restProps, ref: ref }), _jsx("span", { className: styleCheck, children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", children: _jsx("path", { d: "m9.55 17.65-5.325-5.325 1.05-1.075 4.275 4.275 9.175-9.175 1.05 1.075Z" }) }) }), _jsx("span", { className: "peer-disabled:text-sumi-500", children: children })] }) }));
|
|
44
44
|
});
|
|
45
45
|
Checkbox.displayName = 'Checkbox';
|
|
46
46
|
//# sourceMappingURL=Checkbox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../src/components/Checkbox.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAA;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAI7C,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CACtC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACb,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAA;IACnD,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAA;IAC/C,IAAI,GAAG,CAAC,UAAU,EAAE;QAClB,SAAS,CAAC,QAAQ,GAAG,IAAI,CAAA;KAC1B;IACD,IAAI,GAAG,CAAC,SAAS,EAAE;QACjB,SAAS,CAAC,IAAI,GAAG,GAAG,CAAC,SAAS,CAAA;KAC/B;IAED,MAAM,KAAK,GAAG;;;;;;KAMb,CAAA;IAED,MAAM,UAAU,GAAG;;;KAGlB,CAAA;IAED,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;KAiBlB,CAAA;IAED,OAAO,CACL,gBAAO,OAAO,EAAE,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,YAC3D,gBAAM,SAAS,EAAC,mBAAmB,aACjC,gBACE,SAAS,EAAE,UAAU,EACrB,IAAI,EAAC,UAAU,sBACG,GAAG,CAAC,YAAY,uBACf,GAAG,CAAC,cAAc,kBACvB,GAAG,CAAC,SAAS,IAAI,KAAK,
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../src/components/Checkbox.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAA;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAI7C,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CACtC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACb,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAA;IACnD,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAA;IAC/C,IAAI,GAAG,CAAC,UAAU,EAAE;QAClB,SAAS,CAAC,QAAQ,GAAG,IAAI,CAAA;KAC1B;IACD,IAAI,GAAG,CAAC,SAAS,EAAE;QACjB,SAAS,CAAC,IAAI,GAAG,GAAG,CAAC,SAAS,CAAA;KAC/B;IAED,MAAM,KAAK,GAAG;;;;;;KAMb,CAAA;IAED,MAAM,UAAU,GAAG;;;KAGlB,CAAA;IAED,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;KAiBlB,CAAA;IAED,OAAO,CACL,gBAAO,OAAO,EAAE,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,YAC3D,gBAAM,SAAS,EAAC,mBAAmB,aACjC,gBACE,SAAS,EAAE,UAAU,EACrB,IAAI,EAAC,UAAU,sBACG,GAAG,CAAC,YAAY,uBACf,GAAG,CAAC,cAAc,kBACvB,GAAG,CAAC,SAAS,IAAI,KAAK,mBACrB,GAAG,CAAC,UAAU,IAAI,KAAK,KAClC,SAAS,EACb,GAAG,EAAE,GAAG,GACR,EACF,eAAM,SAAS,EAAE,UAAU,YACzB,cAAK,KAAK,EAAC,4BAA4B,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,YAC5D,eAAM,CAAC,EAAC,wEAAwE,GAAG,GAC/E,GACD,EACP,eAAM,SAAS,EAAC,6BAA6B,YAAE,QAAQ,GAAQ,IAC1D,GACD,CACT,CAAA;AACH,CAAC,CACF,CAAA;AAED,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAA"}
|
|
@@ -8,12 +8,14 @@ export const FileInput = React.forwardRef((props, ref) => {
|
|
|
8
8
|
if (ctx.isRequired) {
|
|
9
9
|
restProps.required = true;
|
|
10
10
|
}
|
|
11
|
-
const invalidStyle = ctx.isInvalid ? 'text-sun-800' : 'text-sumi-900';
|
|
12
11
|
const base = `
|
|
12
|
+
file:mr-2
|
|
13
13
|
file:inline-block
|
|
14
14
|
file:text-button
|
|
15
15
|
file:text-center
|
|
16
16
|
file:cursor-pointer
|
|
17
|
+
file:select-none
|
|
18
|
+
file:touch-manipulation
|
|
17
19
|
file:whitespace-nowrap
|
|
18
20
|
file:border
|
|
19
21
|
file:border-solid
|
|
@@ -41,11 +43,13 @@ export const FileInput = React.forwardRef((props, ref) => {
|
|
|
41
43
|
const styleInput = `
|
|
42
44
|
rounded-lg
|
|
43
45
|
outline-offset-2
|
|
46
|
+
text-sumi-900
|
|
44
47
|
focus:outline
|
|
45
48
|
focus:outline-2
|
|
46
49
|
focus:outline-wood-600
|
|
50
|
+
aria-invalid:text-sun-800
|
|
47
51
|
`;
|
|
48
|
-
return (_jsx("input", { type: "file", id: restProps.id ?? ctx.id, className: cx(base, secondary, styleLg, styleInput,
|
|
52
|
+
return (_jsx("input", { type: "file", id: restProps.id ?? ctx.id, className: cx(base, secondary, styleLg, styleInput, className), "aria-describedby": ctx.helperTextId, "aria-errormessage": ctx.errorMessageId, "aria-invalid": ctx.isInvalid ?? false, "aria-required": ctx.isRequired ?? false, ref: ref, ...restProps }));
|
|
49
53
|
});
|
|
50
54
|
FileInput.displayName = 'FileInput';
|
|
51
55
|
//# sourceMappingURL=FileInput.js.map
|