@sakura-ui/sakura-ui 0.3.0 → 0.4.2
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 +71 -0
- package/package.json +26 -25
- package/packages/core/package.json +10 -8
- package/packages/core/src/components/Button.tsx +1 -1
- package/packages/core/src/components/Card.tsx +8 -3
- package/packages/core/src/components/IconButton.tsx +1 -1
- package/packages/core/src/components/LangSelector.tsx +2 -2
- package/packages/core/src/components/Link.tsx +0 -1
- package/packages/core/src/components/LinkCard.tsx +87 -52
- package/packages/core/src/components/MenuButton.tsx +2 -2
- package/packages/core/src/components/NavigationItem.tsx +1 -1
- package/packages/core/src/components/NotificationBanner.tsx +20 -0
- package/packages/core/src/components/PopoverMenu.tsx +1 -0
- package/packages/core/src/components/buttonStyle.ts +1 -1
- package/packages/core/src/components/index.ts +1 -1
- package/packages/core/src/icons/index.ts +1 -1
- package/packages/core/src/index.ts +1 -0
- package/packages/core/vite.config.ts +2 -1
- package/packages/forms/.turbo/turbo-build.log +12 -22
- package/packages/forms/dist/index.cjs.js +52 -79
- package/packages/forms/dist/index.es.js +455 -646
- package/packages/forms/dist/types/components/Checkbox.d.ts +2 -2
- package/packages/forms/dist/types/components/Checkbox.d.ts.map +1 -1
- package/packages/forms/dist/types/components/FieldsetControl.d.ts +2 -2
- package/packages/forms/dist/types/components/FieldsetControl.d.ts.map +1 -1
- package/packages/forms/dist/types/components/FileInput.d.ts +2 -2
- package/packages/forms/dist/types/components/FileInput.d.ts.map +1 -1
- package/packages/forms/dist/types/components/Input.d.ts +2 -2
- package/packages/forms/dist/types/components/Input.d.ts.map +1 -1
- package/packages/forms/dist/types/components/LabelControl.d.ts +2 -2
- package/packages/forms/dist/types/components/LabelControl.d.ts.map +1 -1
- package/packages/forms/dist/types/components/Radio.d.ts +2 -2
- package/packages/forms/dist/types/components/Radio.d.ts.map +1 -1
- package/packages/forms/dist/types/components/Select.d.ts +2 -2
- package/packages/forms/dist/types/components/Select.d.ts.map +1 -1
- package/packages/forms/dist/types/components/Textarea.d.ts +2 -2
- package/packages/forms/dist/types/components/Textarea.d.ts.map +1 -1
- package/packages/forms/dist/types/components/controlled/CheckboxGroup.d.ts +1 -1
- package/packages/forms/dist/types/components/controlled/RadioGroup.d.ts +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/node_modules/.bin/autoprefixer +44 -6
- package/packages/forms/package.json +9 -7
- package/packages/forms/src/components/Checkbox.tsx +1 -2
- package/packages/forms/src/components/FileInput.tsx +3 -3
- package/packages/forms/src/components/Input.tsx +0 -1
- package/packages/forms/src/components/Radio.tsx +0 -1
- package/packages/forms/src/components/Select.tsx +0 -1
- package/packages/forms/src/components/Textarea.tsx +0 -1
- package/packages/forms/tests/FieldsetControl.test.tsx +8 -2
- package/packages/forms/tests/FileInput.test.tsx +30 -5
- package/packages/forms/tests/LabelControl.test.tsx +8 -2
- package/packages/forms/vite.config.ts +2 -1
- package/packages/helper/.turbo/turbo-build.log +12 -23
- package/packages/helper/dist/index.cjs.js +7 -9
- package/packages/helper/dist/index.es.js +23 -23
- package/packages/helper/dist/types/calc.d.ts.map +1 -1
- package/packages/helper/dist/types/cx.d.ts.map +1 -1
- package/packages/helper/dist/types/styles.d.ts +9 -9
- package/packages/helper/dist/types/styles.d.ts.map +1 -1
- package/packages/helper/dist/types/treefy.d.ts.map +1 -1
- package/packages/helper/node_modules/.bin/vitest +55 -0
- package/packages/helper/package.json +13 -3
- package/packages/helper/src/cx.ts +1 -1
- package/packages/helper/src/styles.ts +2 -4
- package/packages/helper/src/treefy.ts +3 -1
- 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/markdown/.turbo/turbo-build.log +12 -22
- package/packages/markdown/dist/index.cjs.js +37 -63
- package/packages/markdown/dist/index.es.js +4287 -4425
- package/packages/markdown/dist/types/components/Markdown.d.ts.map +1 -1
- package/packages/markdown/dist/types/plugins/attr.d.ts.map +1 -1
- package/packages/markdown/dist/types/plugins/card.d.ts.map +1 -1
- package/packages/markdown/dist/types/plugins/cell.d.ts.map +1 -1
- package/packages/markdown/dist/types/plugins/faq.d.ts.map +1 -1
- package/packages/markdown/dist/types/plugins/grid.d.ts.map +1 -1
- package/packages/markdown/dist/types/plugins/headings.d.ts +3 -1
- package/packages/markdown/dist/types/plugins/headings.d.ts.map +1 -1
- package/packages/markdown/dist/types/plugins/helper.d.ts.map +1 -1
- package/packages/markdown/dist/types/plugins/linkButton.d.ts.map +1 -1
- package/packages/markdown/dist/types/plugins/youtube.d.ts.map +1 -1
- package/packages/markdown/node_modules/.bin/autoprefixer +44 -6
- package/packages/markdown/package.json +16 -15
- package/packages/markdown/src/components/Markdown.tsx +4 -0
- package/packages/markdown/src/plugins/grid.ts +4 -1
- package/packages/markdown/src/plugins/headings.ts +6 -3
- package/packages/markdown/src/plugins/linkButton.ts +2 -1
- package/packages/markdown/src/plugins/youtube.ts +5 -4
- package/packages/tailwind-theme-plugin/#package.json# +51 -0
- package/packages/tailwind-theme-plugin/.turbo/turbo-build.log +12 -22
- package/packages/tailwind-theme-plugin/dist/index.cjs.js +1 -1
- package/packages/tailwind-theme-plugin/dist/index.es.js +1111 -1477
- 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 +8 -6
- package/packages/tailwind-theme-plugin/src/index.ts +15 -58
- package/packages/tailwind-theme-plugin/vite.config.ts +2 -0
- 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/tsc +0 -17
- package/packages/forms/node_modules/.bin/tsserver +0 -17
- package/packages/forms/node_modules/.vite/vitest/results.json +0 -1
- package/packages/markdown/node_modules/.bin/tailwind +0 -17
- package/packages/markdown/node_modules/.bin/tailwindcss +0 -17
- package/packages/markdown/node_modules/.bin/ts-node +0 -17
- package/packages/markdown/node_modules/.bin/ts-node-cwd +0 -17
- package/packages/markdown/node_modules/.bin/ts-node-esm +0 -17
- package/packages/markdown/node_modules/.bin/ts-node-script +0 -17
- package/packages/markdown/node_modules/.bin/ts-node-transpile-only +0 -17
- package/packages/markdown/node_modules/.bin/ts-script +0 -17
- package/packages/markdown/node_modules/.bin/tsc +0 -17
- package/packages/markdown/node_modules/.bin/tsserver +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/packages/tailwind-theme-plugin/node_modules/.bin/tsc +0 -17
- package/packages/tailwind-theme-plugin/node_modules/.bin/tsserver +0 -17
package/README.md
CHANGED
|
@@ -128,5 +128,76 @@ export default App
|
|
|
128
128
|
- LabelControl
|
|
129
129
|
- FieldsetControl
|
|
130
130
|
|
|
131
|
+
Every form control takes its accessible name from the label it is associated with, so wrap it in `LabelControl` — or `FieldsetControl` for a group of radios or checkboxes. A control rendered without a label has no name for assistive technology.
|
|
132
|
+
|
|
133
|
+
```tsx
|
|
134
|
+
<LabelControl labelText="添付書類" isRequired>
|
|
135
|
+
<FileInput />
|
|
136
|
+
</LabelControl>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
If a visible label is not an option, pass `aria-label` yourself; it is forwarded to the underlying element.
|
|
140
|
+
|
|
131
141
|
## Markdwon extension
|
|
132
142
|
- Markdown
|
|
143
|
+
|
|
144
|
+
## Development
|
|
145
|
+
|
|
146
|
+
### Setup
|
|
147
|
+
```
|
|
148
|
+
$ pnpm install
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Run the example app
|
|
152
|
+
`examples` resolves each package to its `src` through Vite aliases, so **no build step is required**. Changes under `packages/*/src` are reflected through HMR.
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
$ pnpm dev
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Then open http://localhost:5173/sakura-ui/
|
|
159
|
+
|
|
160
|
+
### Build
|
|
161
|
+
```
|
|
162
|
+
$ pnpm build
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
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.
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
$ pnpm build --filter @sakura-ui/core
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Running `pnpm build` inside a package directory (e.g. `cd packages/core && pnpm build`) fails while `@sakura-ui/helper` has not been built yet.
|
|
172
|
+
|
|
173
|
+
### Test
|
|
174
|
+
```
|
|
175
|
+
$ pnpm test
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Runs every package through turbo. To watch a single package while working on it:
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
$ pnpm --filter @sakura-ui/core test:watch
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Lint
|
|
185
|
+
```
|
|
186
|
+
$ pnpm lint
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
`pnpm lint`, `pnpm build` and `pnpm test` all run on pull requests through the `CI` workflow.
|
|
190
|
+
|
|
191
|
+
### Publish
|
|
192
|
+
Releases go through npm trusted publishing (OIDC), so no npm token is stored anywhere.
|
|
193
|
+
|
|
194
|
+
1. Bump the `version` field of the packages to release and merge that to `main`
|
|
195
|
+
2. Publish a GitHub Release
|
|
196
|
+
|
|
197
|
+
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.
|
|
198
|
+
|
|
199
|
+
To rehearse without releasing anything, run the workflow manually from the Actions tab: manual runs default to a dry run.
|
|
200
|
+
|
|
201
|
+
Each package needs this repository and `.github/workflows/publish.yaml` registered as its trusted publisher on npmjs.com.
|
|
202
|
+
|
|
203
|
+
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.2",
|
|
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,35 +15,36 @@
|
|
|
15
15
|
"publishConfig": {
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
|
-
"scripts": {
|
|
19
|
-
"build": "turbo build"
|
|
20
|
-
},
|
|
21
|
-
"packageManager": "pnpm@9.15.1",
|
|
22
18
|
"engines": {
|
|
23
19
|
"pnpm": ">=9.15.1"
|
|
24
20
|
},
|
|
25
21
|
"dependencies": {
|
|
26
|
-
"@sakura-ui/
|
|
27
|
-
"@sakura-ui/
|
|
28
|
-
"@sakura-ui/
|
|
29
|
-
"@sakura-ui/tailwind-theme-plugin": "
|
|
22
|
+
"@sakura-ui/forms": "0.4.2",
|
|
23
|
+
"@sakura-ui/helper": "0.0.9",
|
|
24
|
+
"@sakura-ui/core": "0.4.1",
|
|
25
|
+
"@sakura-ui/tailwind-theme-plugin": "0.4.1"
|
|
30
26
|
},
|
|
31
27
|
"peerDependencies": {
|
|
32
|
-
"react": "^19.
|
|
33
|
-
"react-dom": "^19.
|
|
34
|
-
"tailwindcss": "^
|
|
28
|
+
"react": "^19.2.1",
|
|
29
|
+
"react-dom": "^19.2.1",
|
|
30
|
+
"tailwindcss": "^4.1.17"
|
|
35
31
|
},
|
|
36
32
|
"devDependencies": {
|
|
37
|
-
"@biomejs/biome": "^
|
|
38
|
-
"@types/node": "^
|
|
39
|
-
"@vitejs/plugin-react-swc": "^3.
|
|
40
|
-
"npm-run-all2": "^
|
|
41
|
-
"rimraf": "^6.
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
|
|
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"
|
|
48
49
|
}
|
|
49
|
-
}
|
|
50
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sakura-ui/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"homepage": "https://github.com/glassonion1/sakura-ui",
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
|
-
"url": "git+
|
|
17
|
+
"url": "git+https://github.com/glassonion1/sakura-ui.git",
|
|
18
18
|
"directory": "packages/core"
|
|
19
19
|
},
|
|
20
20
|
"license": "MIT",
|
|
@@ -43,23 +43,25 @@
|
|
|
43
43
|
"build": "run-p build:*",
|
|
44
44
|
"build:scripts": "vite build",
|
|
45
45
|
"build:types": "tsc && tsc-alias",
|
|
46
|
-
"test": "vitest"
|
|
46
|
+
"test": "vitest run",
|
|
47
|
+
"test:watch": "vitest"
|
|
47
48
|
},
|
|
48
49
|
"peerDependencies": {
|
|
49
|
-
"react": "^19.
|
|
50
|
-
"react-dom": "^19.
|
|
51
|
-
"tailwindcss": "^
|
|
50
|
+
"react": "^19.2.1",
|
|
51
|
+
"react-dom": "^19.2.1",
|
|
52
|
+
"tailwindcss": "^4.1.17"
|
|
52
53
|
},
|
|
53
54
|
"dependencies": {
|
|
54
|
-
"@sakura-ui/helper": "
|
|
55
|
+
"@sakura-ui/helper": "workspace:*"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
58
|
"@testing-library/jest-dom": "catalog:",
|
|
58
59
|
"@testing-library/react": "catalog:",
|
|
59
60
|
"@types/react": "catalog:",
|
|
60
61
|
"@types/react-dom": "catalog:",
|
|
62
|
+
"@tailwindcss/vite": "catalog:",
|
|
61
63
|
"autoprefixer": "catalog:",
|
|
62
|
-
"happy-dom": "
|
|
64
|
+
"happy-dom": "catalog:",
|
|
63
65
|
"postcss": "catalog:",
|
|
64
66
|
"react": "catalog:",
|
|
65
67
|
"react-dom": "catalog:",
|
|
@@ -17,7 +17,7 @@ export namespace Button {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export const Button = <T extends React.ElementType = 'button'>(
|
|
20
|
-
props: Button.Props<T> & Omit<
|
|
20
|
+
props: Button.Props<T> & Omit<ComponentProps<T>, keyof Button.Props<T>>
|
|
21
21
|
) => {
|
|
22
22
|
const {
|
|
23
23
|
as: Component = 'button',
|
|
@@ -28,7 +28,7 @@ export const Card = (props: Card.Props) => {
|
|
|
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,7 +37,7 @@ export const Card = (props: Card.Props) => {
|
|
|
37
37
|
>
|
|
38
38
|
{children}
|
|
39
39
|
</article>
|
|
40
|
-
</IdContext
|
|
40
|
+
</IdContext>
|
|
41
41
|
)
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -115,6 +115,11 @@ export namespace CardFooter {
|
|
|
115
115
|
export const CardFooter = (props: CardFooter.Props) => {
|
|
116
116
|
const { className, children, ...restProps } = props
|
|
117
117
|
|
|
118
|
+
const stylePosition = `
|
|
119
|
+
sticky
|
|
120
|
+
top-full
|
|
121
|
+
`
|
|
122
|
+
|
|
118
123
|
const style = `
|
|
119
124
|
text-base-sm
|
|
120
125
|
leading-[1.85rem]
|
|
@@ -125,7 +130,7 @@ export const CardFooter = (props: CardFooter.Props) => {
|
|
|
125
130
|
`
|
|
126
131
|
|
|
127
132
|
return (
|
|
128
|
-
<div className={cx(style, className)} {...restProps}>
|
|
133
|
+
<div className={cx(stylePosition, style, className)} {...restProps}>
|
|
129
134
|
{children}
|
|
130
135
|
</div>
|
|
131
136
|
)
|
|
@@ -67,8 +67,8 @@ export const LangSelector = ({
|
|
|
67
67
|
)
|
|
68
68
|
if (focusables.length === 0) return
|
|
69
69
|
|
|
70
|
-
const tabIndex = focusables.
|
|
71
|
-
|
|
70
|
+
const tabIndex = focusables.indexOf(
|
|
71
|
+
document.activeElement as HTMLElement
|
|
72
72
|
)
|
|
73
73
|
// If there is no focused element, focus the first element
|
|
74
74
|
if (tabIndex === -1) {
|
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { cx, Style } from '@sakura-ui/helper'
|
|
3
|
-
import { Card, CardHeader } from './Card'
|
|
3
|
+
import { Card, CardFooter, CardHeader } from './Card'
|
|
4
4
|
import { Icon } from './Icon'
|
|
5
5
|
|
|
6
|
-
interface LinkContextType {
|
|
7
|
-
href: string
|
|
8
|
-
}
|
|
9
|
-
const LinkContext = React.createContext<LinkContextType>({ href: '' })
|
|
10
|
-
|
|
11
6
|
export namespace LinkCard {
|
|
12
|
-
export interface Props extends React.
|
|
7
|
+
export interface Props<T extends React.ElementType>
|
|
8
|
+
extends React.ComponentProps<'article'> {
|
|
13
9
|
href: string
|
|
10
|
+
target?: string
|
|
11
|
+
linkAs?: T
|
|
14
12
|
}
|
|
15
13
|
}
|
|
16
14
|
|
|
17
|
-
export const LinkCard = (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
export const LinkCard = <T extends React.ElementType = 'a'>(
|
|
16
|
+
props: LinkCard.Props<T>
|
|
17
|
+
) => {
|
|
18
|
+
const {
|
|
19
|
+
href,
|
|
20
|
+
target,
|
|
21
|
+
linkAs: Component = 'a',
|
|
22
|
+
className,
|
|
23
|
+
children,
|
|
24
|
+
...rest
|
|
25
|
+
} = props
|
|
26
|
+
|
|
23
27
|
const styleLink = `
|
|
24
28
|
grid
|
|
25
29
|
outline-offset-4
|
|
@@ -27,65 +31,96 @@ export const LinkCard = ({
|
|
|
27
31
|
sm:rounded-3xl
|
|
28
32
|
w-full h-full
|
|
29
33
|
${Style.focusCard}
|
|
34
|
+
group
|
|
30
35
|
`
|
|
31
36
|
|
|
32
37
|
const styleHover = `
|
|
33
|
-
hover:
|
|
34
|
-
hover:
|
|
38
|
+
group-hover:outline
|
|
39
|
+
group-hover:outline-blue-900
|
|
40
|
+
group-hover:outline-4
|
|
41
|
+
group-hover:outline-offset-[-1px]
|
|
35
42
|
`
|
|
36
43
|
|
|
37
|
-
const isExternal = href?.startsWith('https://')
|
|
38
|
-
|
|
39
44
|
return (
|
|
40
|
-
<
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
>
|
|
46
|
-
<Card className={cx(styleHover, className)} {...rest}>
|
|
47
|
-
{children}
|
|
48
|
-
</Card>
|
|
49
|
-
</a>
|
|
50
|
-
</LinkContext.Provider>
|
|
45
|
+
<Component className={cx(styleLink)} href={href} target={target}>
|
|
46
|
+
<Card className={cx(styleHover, className)} {...rest}>
|
|
47
|
+
{children}
|
|
48
|
+
</Card>
|
|
49
|
+
</Component>
|
|
51
50
|
)
|
|
52
51
|
}
|
|
53
52
|
|
|
54
|
-
export
|
|
53
|
+
export namespace LinkCardHeader {
|
|
54
|
+
export interface Props extends React.ComponentProps<'div'> {
|
|
55
|
+
target?: string
|
|
56
|
+
}
|
|
57
|
+
}
|
|
55
58
|
|
|
56
59
|
export const LinkCardHeader = ({
|
|
60
|
+
target,
|
|
57
61
|
className,
|
|
58
62
|
children
|
|
59
|
-
}:
|
|
60
|
-
const { href } = React.useContext(LinkContext)
|
|
61
|
-
|
|
63
|
+
}: LinkCardHeader.Props) => {
|
|
62
64
|
const styleHeading = `
|
|
65
|
+
decoration-blue-900
|
|
66
|
+
underline
|
|
67
|
+
underline-offset-[calc(3/16*1rem)]
|
|
68
|
+
`
|
|
69
|
+
const styleHover = `
|
|
70
|
+
group-hover:text-blue-900
|
|
71
|
+
group-hover:decoration-[calc(3/16*1rem)]
|
|
72
|
+
`
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<CardHeader className={cx(className, styleHeading, styleHover)}>
|
|
76
|
+
<span>
|
|
77
|
+
{children}
|
|
78
|
+
{target === '_blank' && (
|
|
79
|
+
<Icon opticalSize={16} className="ml-1">
|
|
80
|
+
open_in_new
|
|
81
|
+
</Icon>
|
|
82
|
+
)}
|
|
83
|
+
</span>
|
|
84
|
+
</CardHeader>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export namespace LinkCardFooter {
|
|
89
|
+
export interface Props extends React.ComponentProps<'div'> {}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export const LinkCardFooter = ({
|
|
93
|
+
className,
|
|
94
|
+
children
|
|
95
|
+
}: LinkCardFooter.Props) => {
|
|
96
|
+
const style = `
|
|
63
97
|
flex
|
|
64
98
|
justify-between
|
|
65
99
|
items-center
|
|
66
100
|
`
|
|
67
101
|
|
|
68
|
-
const
|
|
102
|
+
const styleIcon = `
|
|
103
|
+
inline-flex
|
|
104
|
+
items-center
|
|
105
|
+
justify-center
|
|
106
|
+
w-6 h-6
|
|
107
|
+
text-blue-1000
|
|
108
|
+
border
|
|
109
|
+
border-blue-1000
|
|
110
|
+
rounded-full
|
|
111
|
+
`
|
|
112
|
+
|
|
113
|
+
const styleIconHover = `
|
|
114
|
+
group-hover:bg-blue-1000
|
|
115
|
+
group-hover:text-white
|
|
116
|
+
`
|
|
69
117
|
|
|
70
118
|
return (
|
|
71
|
-
<
|
|
72
|
-
{
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
{children}
|
|
78
|
-
{isExternal ? (
|
|
79
|
-
<Icon opticalSize={16} className="ml-1">
|
|
80
|
-
open_in_new
|
|
81
|
-
</Icon>
|
|
82
|
-
) : (
|
|
83
|
-
''
|
|
84
|
-
)}
|
|
85
|
-
</span>
|
|
86
|
-
{isExternal ? '' : <Icon opticalSize={16}>arrow_forward</Icon>}
|
|
87
|
-
</>
|
|
88
|
-
)}
|
|
89
|
-
</CardHeader>
|
|
119
|
+
<CardFooter className={cx(className, style)}>
|
|
120
|
+
<span>{children}</span>
|
|
121
|
+
<span className={cx(styleIcon, styleIconHover)}>
|
|
122
|
+
<Icon opticalSize={16}>arrow_forward</Icon>
|
|
123
|
+
</span>
|
|
124
|
+
</CardFooter>
|
|
90
125
|
)
|
|
91
126
|
}
|
|
@@ -48,8 +48,8 @@ export const MenuButton = ({
|
|
|
48
48
|
)
|
|
49
49
|
if (focusables.length === 0) return
|
|
50
50
|
|
|
51
|
-
const tabIndex = focusables.
|
|
52
|
-
|
|
51
|
+
const tabIndex = focusables.indexOf(
|
|
52
|
+
document.activeElement as HTMLElement
|
|
53
53
|
)
|
|
54
54
|
// If there is no focused element, focus the first element
|
|
55
55
|
if (tabIndex === -1) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { cx } from '@sakura-ui/helper'
|
|
3
|
+
import { Card } from './Card'
|
|
4
|
+
|
|
5
|
+
export namespace NotificationBanner {
|
|
6
|
+
export interface Props extends React.ComponentPropsWithoutRef<'article'> {}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const NotificationBanner = (props: NotificationBanner.Props) => {
|
|
10
|
+
const { className, children, ...restProps } = props
|
|
11
|
+
|
|
12
|
+
const style = `
|
|
13
|
+
`
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Card className={cx(style, className)} {...restProps}>
|
|
17
|
+
{children}
|
|
18
|
+
</Card>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
@@ -26,6 +26,7 @@ export const PopoverMenu = React.forwardRef<
|
|
|
26
26
|
`
|
|
27
27
|
|
|
28
28
|
return (
|
|
29
|
+
// biome-ignore lint/a11y/noNoninteractiveElementToInteractiveRole: the WAI-ARIA authoring practices build menus from a ul with role="menu"
|
|
29
30
|
<ul ref={ref} role="menu" className={cx(className, style)} {...rest}>
|
|
30
31
|
{children}
|
|
31
32
|
</ul>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { Button } from './Button'
|
|
2
2
|
export { MenuButton } from './MenuButton'
|
|
3
3
|
export { Card, CardImg, CardHeader, CardBody, CardFooter } from './Card'
|
|
4
|
-
export { LinkCard, LinkCardHeader } from './LinkCard'
|
|
4
|
+
export { LinkCard, LinkCardHeader, LinkCardFooter } from './LinkCard'
|
|
5
5
|
export { Code } from './Code'
|
|
6
6
|
export { Faq, Question, Answer } from './Faq'
|
|
7
7
|
export { H1, H2, H3, H4, H5, H6 } from './Heading'
|
|
@@ -5,4 +5,4 @@ export { MenuMobile } from './MenuMobile'
|
|
|
5
5
|
export { KeyboadArrowDown } from './KeyboardArrowDown'
|
|
6
6
|
export { Language } from './Language'
|
|
7
7
|
export { LanguageMobile } from './LanguageMobile'
|
|
8
|
-
export {
|
|
8
|
+
export type { IconProps } from './props'
|
|
@@ -3,10 +3,11 @@ import { resolve } from 'node:path'
|
|
|
3
3
|
import { defineConfig } from 'vite'
|
|
4
4
|
import react from '@vitejs/plugin-react-swc'
|
|
5
5
|
import { peerDependencies } from './package.json'
|
|
6
|
+
import tailwindcss from '@tailwindcss/vite'
|
|
6
7
|
|
|
7
8
|
// https://vitejs.dev/config/
|
|
8
9
|
export default defineConfig({
|
|
9
|
-
plugins: [react()],
|
|
10
|
+
plugins: [react(), tailwindcss()],
|
|
10
11
|
resolve: {
|
|
11
12
|
alias: {
|
|
12
13
|
'@': resolve(__dirname, 'src')
|
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
> @sakura-ui/forms@0.3.0 build:scripts /Users/t.fujita/Documents/Repos/sakura-ui/packages/forms
|
|
16
|
-
> vite build
|
|
17
|
-
|
|
18
|
-
[36mvite v6.0.3 [32mbuilding for production...[36m[39m
|
|
19
|
-
[2K[1Gtransforming (1) [2msrc/index.ts[22m[2K[1G[32m✓[39m 25 modules transformed.
|
|
20
|
-
[2K[1Grendering chunks (1)...[2K[1G[2K[1Gcomputing gzip size (0)...[2K[1Gcomputing gzip size (1)...[2K[1G[2mdist/[22m[36mindex.es.js [39m[1m[2m31.87 kB[22m[1m[22m[2m │ gzip: 8.19 kB[22m
|
|
21
|
-
[2K[1Grendering chunks (1)...[2K[1G[2K[1Gcomputing gzip size (1)...[2K[1G[2mdist/[22m[36mindex.cjs.js [39m[1m[2m21.92 kB[22m[1m[22m[2m │ gzip: 7.09 kB[22m
|
|
22
|
-
[32m✓ built in 170ms[39m
|
|
1
|
+
$ rimraf dist
|
|
2
|
+
$ run-p build:*
|
|
3
|
+
$ tsc && tsc-alias
|
|
4
|
+
$ vite build
|
|
5
|
+
[36mvite v7.3.6 [32mbuilding client environment for production...[36m[39m
|
|
6
|
+
transforming...
|
|
7
|
+
[32m✓[39m 25 modules transformed.
|
|
8
|
+
rendering chunks...
|
|
9
|
+
computing gzip size...
|
|
10
|
+
[2mdist/[22m[36mindex.es.js [39m[1m[2m24.36 kB[22m[1m[22m[2m │ gzip: 6.13 kB[22m
|
|
11
|
+
[2mdist/[22m[36mindex.cjs.js [39m[1m[2m16.94 kB[22m[1m[22m[2m │ gzip: 5.27 kB[22m
|
|
12
|
+
[32m✓ built in 582ms[39m
|