@sakura-ui/sakura-ui 0.1.12 → 0.1.14
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 +3 -3
- package/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/config/src/index.ts +68 -53
- package/packages/core/.eslintrc.json +25 -0
- package/packages/core/coverage/clover.xml +258 -0
- package/packages/core/coverage/coverage-final.json +2700 -0
- package/packages/core/coverage/lcov-report/base.css +362 -0
- package/packages/core/coverage/lcov-report/block-navigation.js +85 -0
- package/packages/core/coverage/lcov-report/favicon.png +0 -0
- package/packages/core/coverage/lcov-report/index.html +216 -0
- package/packages/core/coverage/lcov-report/prettify.css +101 -0
- package/packages/core/coverage/lcov-report/prettify.js +1004 -0
- package/packages/core/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/packages/core/coverage/lcov-report/sorter.js +191 -0
- package/packages/core/coverage/lcov-report/src/components/Button.tsx.html +303 -0
- package/packages/core/coverage/lcov-report/src/components/Card.tsx.html +399 -0
- package/packages/core/coverage/lcov-report/src/components/Code.tsx.html +144 -0
- package/packages/core/coverage/lcov-report/src/components/Heading.tsx.html +405 -0
- package/packages/core/coverage/lcov-report/src/components/Icon.tsx.html +183 -0
- package/packages/core/coverage/lcov-report/src/components/IconButton.tsx.html +378 -0
- package/packages/core/coverage/lcov-report/src/components/InfoCard.tsx.html +240 -0
- package/packages/core/coverage/lcov-report/src/components/Link.tsx.html +324 -0
- package/packages/core/coverage/lcov-report/src/components/List.tsx.html +204 -0
- package/packages/core/coverage/lcov-report/src/components/Pre.tsx.html +153 -0
- package/packages/core/coverage/lcov-report/src/components/Table.tsx.html +429 -0
- package/packages/core/coverage/lcov-report/src/components/index.html +396 -0
- package/packages/core/coverage/lcov-report/src/components/index.ts.html +126 -0
- package/packages/core/coverage/lcov-report/src/index.html +176 -0
- package/packages/core/coverage/lcov-report/src/index.ts.html +171 -0
- package/packages/core/coverage/lcov-report/src/utils/class.ts.html +90 -0
- package/packages/core/coverage/lcov-report/src/utils/index.html +176 -0
- package/packages/core/coverage/lcov.info +523 -0
- package/packages/core/jest.config.ts +11 -0
- package/packages/core/package.json +16 -2
- package/packages/core/src/components/Button.tsx +57 -53
- package/packages/core/src/components/Card.tsx +86 -7
- package/packages/core/src/components/Code.tsx +1 -1
- package/packages/core/src/components/Faq.tsx +82 -0
- package/packages/core/src/components/Heading.tsx +42 -30
- package/packages/core/src/components/Icon.tsx +1 -4
- package/packages/core/src/components/IconButton.tsx +88 -73
- package/packages/core/src/components/InfoCard.tsx +13 -13
- package/packages/core/src/components/Link.tsx +23 -24
- package/packages/core/src/components/List.tsx +3 -3
- package/packages/core/src/components/Pre.tsx +1 -1
- package/packages/core/src/components/Table.tsx +7 -9
- package/packages/core/src/components/index.ts +5 -2
- package/packages/core/src/index.ts +6 -0
- package/packages/core/tests/Card.test.tsx +19 -0
- package/packages/forms/dist/components/Checkbox.d.ts +1 -1
- package/packages/forms/dist/components/Checkbox.d.ts.map +1 -1
- package/packages/forms/dist/components/Checkbox.js.map +1 -1
- package/packages/forms/dist/components/FieldsetControl.d.ts +1 -1
- package/packages/forms/dist/components/FieldsetControl.d.ts.map +1 -1
- package/packages/forms/dist/components/FieldsetControl.js +1 -1
- package/packages/forms/dist/components/FieldsetControl.js.map +1 -1
- package/packages/forms/dist/components/Input.d.ts +1 -1
- package/packages/forms/dist/components/Input.d.ts.map +1 -1
- package/packages/forms/dist/components/Input.js.map +1 -1
- package/packages/forms/dist/components/LabelControl.d.ts +1 -1
- package/packages/forms/dist/components/LabelControl.d.ts.map +1 -1
- package/packages/forms/dist/components/LabelControl.js +1 -1
- package/packages/forms/dist/components/LabelControl.js.map +1 -1
- package/packages/forms/dist/components/Radio.d.ts +1 -1
- package/packages/forms/dist/components/Radio.d.ts.map +1 -1
- package/packages/forms/dist/components/Radio.js.map +1 -1
- package/packages/forms/dist/components/Select.d.ts +1 -1
- package/packages/forms/dist/components/Select.d.ts.map +1 -1
- package/packages/forms/dist/components/Select.js.map +1 -1
- package/packages/forms/dist/components/Textarea.d.ts +1 -1
- package/packages/forms/dist/components/Textarea.d.ts.map +1 -1
- package/packages/forms/dist/components/Textarea.js +1 -1
- package/packages/forms/dist/components/Textarea.js.map +1 -1
- package/packages/forms/dist/components/controlled/CheckboxGroup.d.ts +1 -1
- package/packages/forms/dist/components/controlled/CheckboxGroup.d.ts.map +1 -1
- package/packages/forms/dist/components/controlled/CheckboxGroup.js.map +1 -1
- package/packages/forms/dist/components/controlled/RadioGroup.d.ts +1 -1
- package/packages/forms/dist/components/controlled/RadioGroup.d.ts.map +1 -1
- package/packages/forms/dist/components/controlled/RadioGroup.js.map +1 -1
- package/packages/forms/dist/components/controlled/SelectControl.d.ts +1 -1
- package/packages/forms/dist/components/controlled/SelectControl.d.ts.map +1 -1
- package/packages/forms/dist/components/controlled/SelectControl.js.map +1 -1
- package/packages/forms/dist/components/controlled/TextareaControl.d.ts +1 -1
- package/packages/forms/dist/components/controlled/TextareaControl.d.ts.map +1 -1
- package/packages/forms/dist/components/controlled/TextareaControl.js.map +1 -1
- package/packages/forms/dist/index.cjs.js +1 -1
- package/packages/forms/dist/index.cjs.js.map +1 -1
- package/packages/forms/dist/index.es.js +123 -116
- package/packages/forms/dist/index.es.js.map +1 -1
- package/packages/forms/jest.config.ts +0 -3
- package/packages/forms/node_modules/.bin/browserslist +17 -0
- package/packages/forms/package.json +1 -1
- package/packages/forms/src/components/Checkbox.tsx +35 -36
- package/packages/forms/src/components/FieldsetControl.tsx +57 -58
- package/packages/forms/src/components/Input.tsx +23 -24
- package/packages/forms/src/components/LabelControl.tsx +54 -52
- package/packages/forms/src/components/Radio.tsx +32 -33
- package/packages/forms/src/components/Select.tsx +32 -33
- package/packages/forms/src/components/Textarea.tsx +42 -43
- package/packages/forms/src/components/controlled/CheckboxGroup.tsx +36 -34
- package/packages/forms/src/components/controlled/RadioGroup.tsx +1 -1
- package/packages/forms/src/components/controlled/SelectControl.tsx +26 -24
- package/packages/forms/src/components/controlled/TextareaControl.tsx +26 -24
|
@@ -1,23 +1,102 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { cx } from '../utils/class'
|
|
3
3
|
|
|
4
|
+
interface IdContextType {
|
|
5
|
+
id: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const IdContext = React.createContext<IdContextType>({ id: '' })
|
|
9
|
+
|
|
4
10
|
export interface CardProps extends React.ComponentPropsWithoutRef<'section'> {}
|
|
5
11
|
|
|
6
|
-
export const Card
|
|
12
|
+
export const Card = (props: CardProps) => {
|
|
7
13
|
const { className, children, ...restProps } = props
|
|
8
14
|
|
|
15
|
+
const id = React.useId()
|
|
16
|
+
const ctx: IdContextType = { id: id }
|
|
17
|
+
|
|
9
18
|
const style = `
|
|
10
|
-
bg-sumi-50
|
|
11
19
|
border
|
|
12
20
|
border-solid
|
|
13
21
|
border-sumi-300
|
|
14
|
-
rounded-
|
|
15
|
-
|
|
22
|
+
rounded-2xl
|
|
23
|
+
sm:rounded-3xl
|
|
16
24
|
text-sumi-900
|
|
25
|
+
overflow-hidden
|
|
26
|
+
flex
|
|
27
|
+
flex-col
|
|
28
|
+
`
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<IdContext.Provider value={ctx}>
|
|
32
|
+
<section
|
|
33
|
+
aria-labelledby={ctx.id}
|
|
34
|
+
className={cx(style, className)}
|
|
35
|
+
{...restProps}
|
|
36
|
+
>
|
|
37
|
+
{children}
|
|
38
|
+
</section>
|
|
39
|
+
</IdContext.Provider>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface CardHeaderProps extends React.ComponentPropsWithoutRef<'h2'> {}
|
|
44
|
+
|
|
45
|
+
export const CardHeader = (props: CardHeaderProps) => {
|
|
46
|
+
const { className, children, ...restProps } = props
|
|
47
|
+
|
|
48
|
+
const ctx = React.useContext(IdContext)
|
|
49
|
+
|
|
50
|
+
const style = `
|
|
51
|
+
py-6
|
|
52
|
+
px-6
|
|
53
|
+
text-h-xxs-m
|
|
54
|
+
sm:text-h-xxs
|
|
55
|
+
leading-none
|
|
56
|
+
`
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<h2 id={ctx.id} className={cx(style, className)} {...restProps}>
|
|
60
|
+
{children}
|
|
61
|
+
</h2>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface CardBodyProps extends React.ComponentPropsWithoutRef<'p'> {}
|
|
66
|
+
|
|
67
|
+
export const CardBody = (props: CardBodyProps) => {
|
|
68
|
+
const { className, children, ...restProps } = props
|
|
69
|
+
|
|
70
|
+
const style = `
|
|
71
|
+
px-6
|
|
72
|
+
first:pt-6
|
|
73
|
+
pb-6
|
|
74
|
+
text-base
|
|
75
|
+
`
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<div className={cx(style, className)} {...restProps}>
|
|
79
|
+
{children}
|
|
80
|
+
</div>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface CardFooterProps
|
|
85
|
+
extends React.ComponentPropsWithoutRef<'div'> {}
|
|
86
|
+
|
|
87
|
+
export const CardFooter = (props: CardFooterProps) => {
|
|
88
|
+
const { className, children, ...restProps } = props
|
|
89
|
+
|
|
90
|
+
const style = `
|
|
91
|
+
mt-auto
|
|
92
|
+
px-6
|
|
93
|
+
first:pt-6
|
|
94
|
+
pb-6
|
|
17
95
|
`
|
|
96
|
+
|
|
18
97
|
return (
|
|
19
|
-
<
|
|
20
|
-
{
|
|
21
|
-
</
|
|
98
|
+
<div className={cx(style, className)} {...restProps}>
|
|
99
|
+
{children}
|
|
100
|
+
</div>
|
|
22
101
|
)
|
|
23
102
|
}
|
|
@@ -3,7 +3,7 @@ import { cx } from '../utils/class'
|
|
|
3
3
|
|
|
4
4
|
export interface CodeProps extends React.ComponentPropsWithoutRef<'code'> {}
|
|
5
5
|
|
|
6
|
-
export const Code
|
|
6
|
+
export const Code = (props: CodeProps) => {
|
|
7
7
|
const { className, children, ...restProps } = props
|
|
8
8
|
|
|
9
9
|
const style = `
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { cx } from '../utils/class'
|
|
3
|
+
|
|
4
|
+
export interface FaqProps extends React.ComponentPropsWithoutRef<'dl'> {}
|
|
5
|
+
|
|
6
|
+
const headingStyle = `
|
|
7
|
+
text-h-med-m
|
|
8
|
+
sm:text-h-med
|
|
9
|
+
!leading-none
|
|
10
|
+
`
|
|
11
|
+
|
|
12
|
+
export const Faq = (props: FaqProps) => {
|
|
13
|
+
const { className, children, ...restProps } = props
|
|
14
|
+
|
|
15
|
+
const style = `
|
|
16
|
+
flex
|
|
17
|
+
flex-col
|
|
18
|
+
gap-8
|
|
19
|
+
`
|
|
20
|
+
return (
|
|
21
|
+
<article itemScope itemType="https://schema.org/FAQPage">
|
|
22
|
+
<dl
|
|
23
|
+
className={cx(style, className)}
|
|
24
|
+
itemScope
|
|
25
|
+
itemProp="mainEntity"
|
|
26
|
+
itemType="https://schema.org/Question"
|
|
27
|
+
{...restProps}
|
|
28
|
+
>
|
|
29
|
+
{children}
|
|
30
|
+
</dl>
|
|
31
|
+
</article>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface QuestionProps extends React.ComponentPropsWithoutRef<'dt'> {}
|
|
36
|
+
|
|
37
|
+
export const Question = (props: QuestionProps) => {
|
|
38
|
+
const { className, children, ...restProps } = props
|
|
39
|
+
|
|
40
|
+
const style = `
|
|
41
|
+
flex
|
|
42
|
+
flex-row
|
|
43
|
+
gap-8
|
|
44
|
+
`
|
|
45
|
+
return (
|
|
46
|
+
<dl
|
|
47
|
+
className={cx(style, headingStyle, className)}
|
|
48
|
+
itemProp="name"
|
|
49
|
+
{...restProps}
|
|
50
|
+
>
|
|
51
|
+
<span aria-hidden="true">Q</span>
|
|
52
|
+
<span>{children}</span>
|
|
53
|
+
</dl>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface AnswerProps extends React.ComponentPropsWithoutRef<'dd'> {}
|
|
58
|
+
|
|
59
|
+
export const Answer = (props: AnswerProps) => {
|
|
60
|
+
const { className, children, ...restProps } = props
|
|
61
|
+
|
|
62
|
+
const style = `
|
|
63
|
+
flex
|
|
64
|
+
flex-row
|
|
65
|
+
items-start
|
|
66
|
+
gap-8
|
|
67
|
+
`
|
|
68
|
+
return (
|
|
69
|
+
<dd
|
|
70
|
+
className={cx(style, className)}
|
|
71
|
+
itemScope
|
|
72
|
+
itemProp="acceptedAnswer"
|
|
73
|
+
itemType="https://schema.org/Answer"
|
|
74
|
+
{...restProps}
|
|
75
|
+
>
|
|
76
|
+
<span className={headingStyle} aria-hidden="true">
|
|
77
|
+
A
|
|
78
|
+
</span>
|
|
79
|
+
<span itemProp="text">{children}</span>
|
|
80
|
+
</dd>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
@@ -3,14 +3,16 @@ import { cx } from '../utils/class'
|
|
|
3
3
|
|
|
4
4
|
export interface HeadingProps extends React.ComponentPropsWithoutRef<'h1'> {}
|
|
5
5
|
|
|
6
|
-
export const H1
|
|
6
|
+
export const H1 = (props: HeadingProps) => {
|
|
7
7
|
const { className, children, ...restProps } = props
|
|
8
8
|
|
|
9
9
|
const style = `
|
|
10
|
-
text-
|
|
11
|
-
sm:text-
|
|
12
|
-
mt-
|
|
13
|
-
mb-
|
|
10
|
+
text-h-lg-m
|
|
11
|
+
sm:text-h-lg
|
|
12
|
+
mt-8
|
|
13
|
+
mb-3
|
|
14
|
+
sm:mt-16
|
|
15
|
+
sm:mb-6
|
|
14
16
|
`
|
|
15
17
|
|
|
16
18
|
return (
|
|
@@ -20,14 +22,16 @@ export const H1: React.ElementType<HeadingProps> = (props: HeadingProps) => {
|
|
|
20
22
|
)
|
|
21
23
|
}
|
|
22
24
|
|
|
23
|
-
export const H2
|
|
25
|
+
export const H2 = (props: HeadingProps) => {
|
|
24
26
|
const { className, children, ...restProps } = props
|
|
25
27
|
|
|
26
28
|
const style = `
|
|
27
|
-
text-
|
|
28
|
-
sm:text-
|
|
29
|
-
mt-
|
|
30
|
-
mb-
|
|
29
|
+
text-h-med-m
|
|
30
|
+
sm:text-h-med
|
|
31
|
+
mt-8
|
|
32
|
+
mb-3
|
|
33
|
+
sm:mt-16
|
|
34
|
+
sm:mb-6
|
|
31
35
|
`
|
|
32
36
|
|
|
33
37
|
return (
|
|
@@ -37,14 +41,16 @@ export const H2: React.ElementType<HeadingProps> = (props: HeadingProps) => {
|
|
|
37
41
|
)
|
|
38
42
|
}
|
|
39
43
|
|
|
40
|
-
export const H3
|
|
44
|
+
export const H3 = (props: HeadingProps) => {
|
|
41
45
|
const { className, children, ...restProps } = props
|
|
42
46
|
|
|
43
47
|
const style = `
|
|
44
|
-
text-
|
|
45
|
-
sm:text-
|
|
46
|
-
mt-
|
|
47
|
-
mb-
|
|
48
|
+
text-h-sm-m
|
|
49
|
+
sm:text-h-sm
|
|
50
|
+
mt-5
|
|
51
|
+
mb-3
|
|
52
|
+
sm:mt-10
|
|
53
|
+
sm:mb-6
|
|
48
54
|
`
|
|
49
55
|
|
|
50
56
|
return (
|
|
@@ -54,14 +60,16 @@ export const H3: React.ElementType<HeadingProps> = (props: HeadingProps) => {
|
|
|
54
60
|
)
|
|
55
61
|
}
|
|
56
62
|
|
|
57
|
-
export const H4
|
|
63
|
+
export const H4 = (props: HeadingProps) => {
|
|
58
64
|
const { className, children, ...restProps } = props
|
|
59
65
|
|
|
60
66
|
const style = `
|
|
61
|
-
text-
|
|
62
|
-
sm:text-
|
|
63
|
-
mt-
|
|
64
|
-
mb-
|
|
67
|
+
text-h-xs-m
|
|
68
|
+
sm:text-h-xs
|
|
69
|
+
mt-5
|
|
70
|
+
mb-2
|
|
71
|
+
sm:mt-10
|
|
72
|
+
sm:mb-4
|
|
65
73
|
`
|
|
66
74
|
|
|
67
75
|
return (
|
|
@@ -71,14 +79,16 @@ export const H4: React.ElementType<HeadingProps> = (props: HeadingProps) => {
|
|
|
71
79
|
)
|
|
72
80
|
}
|
|
73
81
|
|
|
74
|
-
export const H5
|
|
82
|
+
export const H5 = (props: HeadingProps) => {
|
|
75
83
|
const { className, children, ...restProps } = props
|
|
76
84
|
|
|
77
85
|
const style = `
|
|
78
|
-
text-
|
|
79
|
-
sm:text-
|
|
80
|
-
mt-
|
|
81
|
-
mb-
|
|
86
|
+
text-h-xxs-m
|
|
87
|
+
sm:text-h-xxs
|
|
88
|
+
mt-5
|
|
89
|
+
mb-2
|
|
90
|
+
sm:mt-10
|
|
91
|
+
sm:mb-4
|
|
82
92
|
`
|
|
83
93
|
|
|
84
94
|
return (
|
|
@@ -88,14 +98,16 @@ export const H5: React.ElementType<HeadingProps> = (props: HeadingProps) => {
|
|
|
88
98
|
)
|
|
89
99
|
}
|
|
90
100
|
|
|
91
|
-
export const H6
|
|
101
|
+
export const H6 = (props: HeadingProps) => {
|
|
92
102
|
const { className, children, ...restProps } = props
|
|
93
103
|
|
|
94
104
|
const style = `
|
|
95
|
-
text-
|
|
96
|
-
sm:text-
|
|
97
|
-
mt-
|
|
98
|
-
mb-
|
|
105
|
+
text-h-xxs-m
|
|
106
|
+
sm:text-h-xxs
|
|
107
|
+
mt-3
|
|
108
|
+
mb-2
|
|
109
|
+
sm:mt-6
|
|
110
|
+
sm:mb-4
|
|
99
111
|
`
|
|
100
112
|
|
|
101
113
|
return (
|
|
@@ -5,10 +5,7 @@ export interface IconProps extends React.ComponentPropsWithRef<'span'> {
|
|
|
5
5
|
icon: string
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export const Icon
|
|
9
|
-
HTMLElement,
|
|
10
|
-
IconProps
|
|
11
|
-
>((props, ref) => {
|
|
8
|
+
export const Icon = React.forwardRef<HTMLElement, IconProps>((props, ref) => {
|
|
12
9
|
const { className, icon, ...restProps } = props
|
|
13
10
|
|
|
14
11
|
const style = `
|
|
@@ -8,85 +8,100 @@ export interface IconButtonProps extends React.ComponentPropsWithRef<'button'> {
|
|
|
8
8
|
icon: string
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export const IconButton
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
...restProps
|
|
23
|
-
} = props
|
|
11
|
+
export const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(
|
|
12
|
+
(props, ref) => {
|
|
13
|
+
const {
|
|
14
|
+
className,
|
|
15
|
+
children,
|
|
16
|
+
variant,
|
|
17
|
+
icon,
|
|
18
|
+
iconLayout,
|
|
19
|
+
rounded,
|
|
20
|
+
...restProps
|
|
21
|
+
} = props
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
const layout = iconLayout ?? 'left'
|
|
26
24
|
|
|
27
|
-
|
|
25
|
+
const align = 'center'
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
27
|
+
const style = `
|
|
28
|
+
${rounded === 'full' ? 'aspect-square' : ''}
|
|
29
|
+
inline-block
|
|
30
|
+
p-4
|
|
31
|
+
text-button
|
|
32
|
+
text-${align}
|
|
33
|
+
rounded-${rounded ? rounded : 'lg'}
|
|
34
|
+
cursor-pointer
|
|
35
|
+
whitespace-nowrap
|
|
36
|
+
border
|
|
37
|
+
border-solid
|
|
38
|
+
border-sea-800
|
|
39
|
+
active:enabled:border-sea-800/[.8]
|
|
40
|
+
hover:enabled:border-sea-800/[.85]
|
|
41
|
+
focus:outline
|
|
42
|
+
focus:outline-2
|
|
43
|
+
focus:outline-wood-600
|
|
44
|
+
disabled:border-sumi-500
|
|
45
|
+
disabled:cursor-not-allowed
|
|
46
|
+
`
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
48
|
+
const primary = `
|
|
49
|
+
text-white-1000
|
|
50
|
+
bg-sea-800
|
|
51
|
+
active:enabled:bg-sea-800/[.8]
|
|
52
|
+
hover:enabled:bg-sea-800/[.85]
|
|
53
|
+
disabled:bg-sumi-500
|
|
54
|
+
disabled:text-white-1000
|
|
55
|
+
`
|
|
56
|
+
const secondary = `
|
|
57
|
+
text-sea-800
|
|
58
|
+
bg-transparent
|
|
59
|
+
active:enabled:bg-sea-50/[.60]
|
|
60
|
+
hover:enabled:bg-sea-50
|
|
61
|
+
active:enabled:text-sea-800/[.85]
|
|
62
|
+
hover:enabled:text-sea-800/[.85]
|
|
63
|
+
disabled:text-sumi-500
|
|
64
|
+
`
|
|
62
65
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
const styles = {
|
|
67
|
+
primary: primary,
|
|
68
|
+
secondary: secondary
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const iconStyle = `
|
|
72
|
+
inline-block
|
|
73
|
+
align-middle
|
|
74
|
+
font-icon
|
|
75
|
+
text-2xl
|
|
76
|
+
font-light
|
|
77
|
+
leading-4
|
|
78
|
+
antialiased
|
|
79
|
+
mb-1
|
|
80
|
+
`
|
|
67
81
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
align-middle
|
|
71
|
-
font-icon
|
|
72
|
-
text-2xl
|
|
73
|
-
font-light
|
|
74
|
-
leading-4
|
|
75
|
-
antialiased
|
|
76
|
-
mb-1
|
|
77
|
-
`
|
|
82
|
+
// When text is specified on a button, set the 'aria-hidden' attribute of the icon to true.
|
|
83
|
+
const ariaHidden = children ? true : false
|
|
78
84
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
85
|
+
return (
|
|
86
|
+
<button
|
|
87
|
+
className={cx(style, styles[variant ?? 'primary'], className)}
|
|
88
|
+
{...restProps}
|
|
89
|
+
ref={ref}
|
|
90
|
+
>
|
|
91
|
+
{layout == 'left' && (
|
|
92
|
+
<span className={cx(iconStyle)} aria-hidden={ariaHidden}>
|
|
93
|
+
{icon}
|
|
94
|
+
</span>
|
|
95
|
+
)}
|
|
96
|
+
{children && <span className="mx-1 inline-block">{children}</span>}
|
|
97
|
+
{layout == 'right' && (
|
|
98
|
+
<span className={cx(iconStyle)} aria-hidden={ariaHidden}>
|
|
99
|
+
{icon}
|
|
100
|
+
</span>
|
|
101
|
+
)}
|
|
102
|
+
</button>
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
)
|
|
91
106
|
|
|
92
107
|
IconButton.displayName = 'IconButton'
|
|
@@ -6,31 +6,31 @@ export interface InfoCardProps
|
|
|
6
6
|
title?: string
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export const InfoCard:
|
|
10
|
-
props: InfoCardProps
|
|
11
|
-
) => {
|
|
9
|
+
export const InfoCard = (props: InfoCardProps) => {
|
|
12
10
|
const { className, children, title, ...restProps } = props
|
|
13
11
|
|
|
14
12
|
const style = `
|
|
15
|
-
bg-sumi-50
|
|
16
|
-
border-sumi-300
|
|
17
13
|
border
|
|
18
14
|
border-solid
|
|
19
|
-
|
|
15
|
+
border-sumi-300
|
|
16
|
+
rounded-2xl
|
|
17
|
+
sm:rounded-3xl
|
|
20
18
|
text-sumi-900
|
|
21
19
|
`
|
|
22
20
|
|
|
23
21
|
const topStyle = `
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
text-
|
|
28
|
-
|
|
22
|
+
pt-6
|
|
23
|
+
px-6
|
|
24
|
+
text-h-xxs-m
|
|
25
|
+
sm:text-h-xxs
|
|
26
|
+
leading-none
|
|
27
|
+
mb-2
|
|
29
28
|
`
|
|
30
29
|
|
|
31
30
|
const bottmStyle = `
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
pb-6
|
|
32
|
+
px-6
|
|
33
|
+
text-base
|
|
34
34
|
`
|
|
35
35
|
|
|
36
36
|
const headingId = React.useId()
|
|
@@ -30,15 +30,13 @@ const getFileType = (url: string) => {
|
|
|
30
30
|
|
|
31
31
|
export interface LinkProps extends React.ComponentPropsWithRef<'a'> {}
|
|
32
32
|
|
|
33
|
-
export const Link
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const href = props.href ?? ''
|
|
39
|
-
const fileType = getFileType(href)
|
|
33
|
+
export const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(
|
|
34
|
+
(props, ref) => {
|
|
35
|
+
const { className, children, ...restProps } = props
|
|
36
|
+
const href = props.href ?? ''
|
|
37
|
+
const fileType = getFileType(href)
|
|
40
38
|
|
|
41
|
-
|
|
39
|
+
const style = `
|
|
42
40
|
rounded-sm
|
|
43
41
|
cursor-pointer
|
|
44
42
|
text-sea-600
|
|
@@ -53,27 +51,28 @@ export const Link: React.ElementType<LinkProps> = React.forwardRef<
|
|
|
53
51
|
disabled:border-sumi-500
|
|
54
52
|
`
|
|
55
53
|
|
|
56
|
-
|
|
54
|
+
if (href.startsWith('http')) {
|
|
55
|
+
return (
|
|
56
|
+
<a
|
|
57
|
+
className={cx(style, className)}
|
|
58
|
+
href={href}
|
|
59
|
+
target="_blank"
|
|
60
|
+
rel="noopener noreferrer"
|
|
61
|
+
{...restProps}
|
|
62
|
+
ref={ref}
|
|
63
|
+
>
|
|
64
|
+
{children}
|
|
65
|
+
{fileType ? `(${fileType})` : null}
|
|
66
|
+
</a>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
57
69
|
return (
|
|
58
|
-
<a
|
|
59
|
-
className={cx(style, className)}
|
|
60
|
-
href={href}
|
|
61
|
-
target="_blank"
|
|
62
|
-
rel="noopener noreferrer"
|
|
63
|
-
{...restProps}
|
|
64
|
-
ref={ref}
|
|
65
|
-
>
|
|
70
|
+
<a className={cx(style, className)} href={href} {...restProps} ref={ref}>
|
|
66
71
|
{children}
|
|
67
72
|
{fileType ? `(${fileType})` : null}
|
|
68
73
|
</a>
|
|
69
74
|
)
|
|
70
75
|
}
|
|
71
|
-
|
|
72
|
-
<a className={cx(style, className)} href={href} {...restProps} ref={ref}>
|
|
73
|
-
{children}
|
|
74
|
-
{fileType ? `(${fileType})` : null}
|
|
75
|
-
</a>
|
|
76
|
-
)
|
|
77
|
-
})
|
|
76
|
+
)
|
|
78
77
|
|
|
79
78
|
Link.displayName = 'Link'
|
|
@@ -3,7 +3,7 @@ import { cx } from '../utils/class'
|
|
|
3
3
|
|
|
4
4
|
export interface UlProps extends React.ComponentPropsWithoutRef<'ul'> {}
|
|
5
5
|
|
|
6
|
-
export const Ul
|
|
6
|
+
export const Ul = (props: UlProps) => {
|
|
7
7
|
const { className, children, ...restProps } = props
|
|
8
8
|
|
|
9
9
|
const style = `
|
|
@@ -11,7 +11,7 @@ export const Ul: React.ElementType<UlProps> = (props: UlProps) => {
|
|
|
11
11
|
list-inside
|
|
12
12
|
-indent-4
|
|
13
13
|
pl-4
|
|
14
|
-
marker:text-
|
|
14
|
+
marker:text-base-sm
|
|
15
15
|
`
|
|
16
16
|
return (
|
|
17
17
|
<ul className={cx(style, className)} {...restProps}>
|
|
@@ -22,7 +22,7 @@ export const Ul: React.ElementType<UlProps> = (props: UlProps) => {
|
|
|
22
22
|
|
|
23
23
|
export interface OlProps extends React.ComponentPropsWithoutRef<'ol'> {}
|
|
24
24
|
|
|
25
|
-
export const Ol
|
|
25
|
+
export const Ol = (props: OlProps) => {
|
|
26
26
|
const { className, children, ...restProps } = props
|
|
27
27
|
|
|
28
28
|
const style = `
|
|
@@ -3,7 +3,7 @@ import { cx } from '../utils/class'
|
|
|
3
3
|
|
|
4
4
|
export interface PreProps extends React.ComponentPropsWithoutRef<'pre'> {}
|
|
5
5
|
|
|
6
|
-
export const Pre
|
|
6
|
+
export const Pre = (props: PreProps) => {
|
|
7
7
|
const { className, children, ...restProps } = props
|
|
8
8
|
|
|
9
9
|
const style = `
|