@charcoal-ui/react 3.6.0 → 3.7.0
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/dist/_lib/compat.d.ts +1 -0
- package/dist/_lib/compat.d.ts.map +1 -1
- package/dist/components/Button/StyledButton.d.ts +12 -0
- package/dist/components/Button/StyledButton.d.ts.map +1 -0
- package/dist/components/Button/index.d.ts +2 -2
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/lib/variantToBackground.d.ts +3 -0
- package/dist/components/Button/lib/variantToBackground.d.ts.map +1 -0
- package/dist/components/Button/lib/variantToFont.d.ts +3 -0
- package/dist/components/Button/lib/variantToFont.d.ts.map +1 -0
- package/dist/components/Checkbox/index.story.d.ts +6 -16
- package/dist/components/Checkbox/index.story.d.ts.map +1 -1
- package/dist/components/Clickable/index.story.d.ts +4 -6
- package/dist/components/Clickable/index.story.d.ts.map +1 -1
- package/dist/components/DropdownSelector/index.story.d.ts +1 -0
- package/dist/components/DropdownSelector/index.story.d.ts.map +1 -1
- package/dist/components/Icon/index.story.d.ts +1 -1
- package/dist/components/SegmentedControl/RadioGroupContext.d.ts +1 -1
- package/dist/components/SegmentedControl/RadioGroupContext.d.ts.map +1 -1
- package/dist/index.cjs.js +341 -123
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +310 -92
- package/dist/index.esm.js.map +1 -1
- package/package.json +17 -20
- package/src/_lib/compat.ts +8 -0
- package/src/components/Button/StyledButton.tsx +66 -0
- package/src/components/Button/index.tsx +12 -104
- package/src/components/Button/lib/variantToBackground.tsx +19 -0
- package/src/components/Button/lib/variantToFont.tsx +19 -0
- package/src/components/Checkbox/index.story.tsx +82 -88
- package/src/components/Clickable/index.story.tsx +12 -9
- package/src/components/DropdownSelector/DropdownMenuItem.tsx +1 -14
- package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +173 -109
- package/src/components/DropdownSelector/index.story.tsx +33 -0
- package/src/components/DropdownSelector/index.tsx +8 -15
- package/src/components/Modal/__snapshots__/index.story.storyshot +19 -23
- package/src/components/SegmentedControl/RadioGroupContext.tsx +1 -1
- package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +9 -9
- package/src/components/SegmentedControl/index.tsx +1 -1
- package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +17 -15
- package/src/components/TextField/__snapshots__/TextField.story.storyshot +21 -20
- package/dist/components/Checkbox/performance.test.d.ts +0 -4
- package/dist/components/Checkbox/performance.test.d.ts.map +0 -1
- package/dist/components/Checkbox/snapshot.test.d.ts +0 -2
- package/dist/components/Checkbox/snapshot.test.d.ts.map +0 -1
- package/src/components/Checkbox/__snapshots__/snapshot.test.tsx.snap +0 -1093
- package/src/components/Checkbox/performance.test.tsx +0 -30
- package/src/components/Checkbox/snapshot.test.tsx +0 -66
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@charcoal-ui/react",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -51,24 +51,21 @@
|
|
|
51
51
|
"typescript": "^4.9.5"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@charcoal-ui/icons": "^3.
|
|
55
|
-
"@charcoal-ui/styled": "^3.
|
|
56
|
-
"@charcoal-ui/theme": "^3.
|
|
57
|
-
"@charcoal-ui/utils": "^3.
|
|
58
|
-
"@react-aria/button": "^3.
|
|
59
|
-
"@react-aria/checkbox": "^3.
|
|
60
|
-
"@react-aria/dialog": "^3.5.
|
|
61
|
-
"@react-aria/focus": "^3.
|
|
62
|
-
"@react-aria/
|
|
63
|
-
"@react-aria/
|
|
64
|
-
"@react-aria/
|
|
65
|
-
"@react-aria/
|
|
66
|
-
"@react-aria/
|
|
67
|
-
"@react-aria/
|
|
68
|
-
"@react-aria/
|
|
69
|
-
"@react-aria/textfield": "^3.9.0",
|
|
70
|
-
"@react-aria/utils": "^3.15.0",
|
|
71
|
-
"@react-aria/visually-hidden": "^3.7.0",
|
|
54
|
+
"@charcoal-ui/icons": "^3.7.0",
|
|
55
|
+
"@charcoal-ui/styled": "^3.7.0",
|
|
56
|
+
"@charcoal-ui/theme": "^3.7.0",
|
|
57
|
+
"@charcoal-ui/utils": "^3.7.0",
|
|
58
|
+
"@react-aria/button": "^3.9.1",
|
|
59
|
+
"@react-aria/checkbox": "^3.13.0",
|
|
60
|
+
"@react-aria/dialog": "^3.5.10",
|
|
61
|
+
"@react-aria/focus": "^3.16.0",
|
|
62
|
+
"@react-aria/overlays": "^3.20.0",
|
|
63
|
+
"@react-aria/radio": "^3.10.0",
|
|
64
|
+
"@react-aria/ssr": "^3.9.1",
|
|
65
|
+
"@react-aria/switch": "^3.6.0",
|
|
66
|
+
"@react-aria/textfield": "^3.14.1",
|
|
67
|
+
"@react-aria/utils": "^3.23.0",
|
|
68
|
+
"@react-aria/visually-hidden": "^3.8.8",
|
|
72
69
|
"polished": "^4.1.4",
|
|
73
70
|
"react-spring": "^9.0.0",
|
|
74
71
|
"react-stately": "^3.26.0",
|
|
@@ -90,5 +87,5 @@
|
|
|
90
87
|
"url": "https://github.com/pixiv/charcoal.git",
|
|
91
88
|
"directory": "packages/react"
|
|
92
89
|
},
|
|
93
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "ebb9480045faf2418cb5a2f95f69848f946e14ed"
|
|
94
91
|
}
|
package/src/_lib/compat.ts
CHANGED
|
@@ -28,4 +28,12 @@ export interface ReactAreaUseTextFieldCompat<E = Element> {
|
|
|
28
28
|
readonly onSelect?: React.ReactEventHandler<E>
|
|
29
29
|
readonly onBeforeInput?: React.FormEventHandler<E>
|
|
30
30
|
readonly onInput?: React.FormEventHandler<E>
|
|
31
|
+
readonly autoCapitalize?:
|
|
32
|
+
| 'none'
|
|
33
|
+
| 'on'
|
|
34
|
+
| 'off'
|
|
35
|
+
| 'sentences'
|
|
36
|
+
| 'words'
|
|
37
|
+
| 'characters'
|
|
38
|
+
| undefined
|
|
31
39
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components'
|
|
2
|
+
import Clickable from '../Clickable'
|
|
3
|
+
import { variantToFont } from './lib/variantToFont'
|
|
4
|
+
import { variantToBackground } from './lib/variantToBackground'
|
|
5
|
+
import type { Size } from '.'
|
|
6
|
+
|
|
7
|
+
const horizontalPaddingSmall = css`
|
|
8
|
+
padding-right: 16px;
|
|
9
|
+
padding-left: 16px;
|
|
10
|
+
`
|
|
11
|
+
|
|
12
|
+
const horizontalPaddingMedium = css`
|
|
13
|
+
padding-right: 24px;
|
|
14
|
+
padding-left: 24px;
|
|
15
|
+
`
|
|
16
|
+
|
|
17
|
+
type StyledButtonProps = {
|
|
18
|
+
$fullWidth: boolean
|
|
19
|
+
$size: Size
|
|
20
|
+
$background: ReturnType<typeof variantToBackground>
|
|
21
|
+
$color: ReturnType<typeof variantToFont>
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const StyledButton = styled(Clickable)<StyledButtonProps>`
|
|
25
|
+
width: ${(p) => (p.$fullWidth ? 'stretch' : 'min-content')};
|
|
26
|
+
display: inline-grid;
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
user-select: none;
|
|
31
|
+
white-space: nowrap;
|
|
32
|
+
border-radius: 999999px;
|
|
33
|
+
font-size: 14px;
|
|
34
|
+
line-height: 22px;
|
|
35
|
+
font-weight: bold;
|
|
36
|
+
|
|
37
|
+
${(p) => (p.$size === 'M' ? horizontalPaddingMedium : horizontalPaddingSmall)}
|
|
38
|
+
color: var(--charcoal-${(p) => p.$color});
|
|
39
|
+
background-color: var(--charcoal-${(p) => p.$background});
|
|
40
|
+
transition: 0.2s color, 0.2s background-color, 0.2s box-shadow;
|
|
41
|
+
|
|
42
|
+
&:not(:disabled):not([aria-disabled]),
|
|
43
|
+
&[aria-disabled='false'] {
|
|
44
|
+
&:active,
|
|
45
|
+
&:focus,
|
|
46
|
+
&:focus-visible {
|
|
47
|
+
outline: none;
|
|
48
|
+
box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&:hover {
|
|
52
|
+
color: var(--charcoal-${(p) => p.$color}-hover);
|
|
53
|
+
background-color: var(--charcoal-${(p) => p.$background}-hover);
|
|
54
|
+
}
|
|
55
|
+
&:active {
|
|
56
|
+
color: var(--charcoal-${(p) => p.$color}-press);
|
|
57
|
+
background-color: var(--charcoal-${(p) => p.$background}-press);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&:disabled,
|
|
62
|
+
&[aria-disabled]:not([aria-disabled='false']) {
|
|
63
|
+
opacity: 0.32;
|
|
64
|
+
}
|
|
65
|
+
height: ${(p) => (p.$size === 'M' ? 40 : 32)}px;
|
|
66
|
+
`
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { forwardRef } from 'react'
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
2
|
+
import { ClickableElement, ClickableProps } from '../Clickable'
|
|
3
|
+
import { variantToFont } from './lib/variantToFont'
|
|
4
|
+
import { variantToBackground } from './lib/variantToBackground'
|
|
5
|
+
import { StyledButton } from './StyledButton'
|
|
5
6
|
|
|
6
|
-
type Variant =
|
|
7
|
-
|
|
7
|
+
export type Variant =
|
|
8
|
+
| 'Primary'
|
|
9
|
+
| 'Default'
|
|
10
|
+
| 'Overlay'
|
|
11
|
+
| 'Danger'
|
|
12
|
+
| 'Navigation'
|
|
8
13
|
|
|
9
|
-
|
|
10
|
-
$variant: Variant
|
|
11
|
-
$fullWidth: boolean
|
|
12
|
-
$size: Size
|
|
13
|
-
}
|
|
14
|
+
export type Size = 'S' | 'M'
|
|
14
15
|
|
|
15
16
|
export type ButtonProps = Partial<{
|
|
16
17
|
variant: Variant
|
|
@@ -44,98 +45,5 @@ const Button = forwardRef<ClickableElement, ButtonProps>(function Button(
|
|
|
44
45
|
</StyledButton>
|
|
45
46
|
)
|
|
46
47
|
})
|
|
47
|
-
export default Button
|
|
48
|
-
|
|
49
|
-
const horizontalPaddingSmall = css`
|
|
50
|
-
padding-right: 16px;
|
|
51
|
-
padding-left: 16px;
|
|
52
|
-
`
|
|
53
|
-
const horizontalPaddingMedium = css`
|
|
54
|
-
padding-right: 24px;
|
|
55
|
-
padding-left: 24px;
|
|
56
|
-
`
|
|
57
|
-
|
|
58
|
-
type StyledButtonProps = Omit<StyledProps, '$variant'> & {
|
|
59
|
-
$background: ReturnType<typeof variantToBackground>
|
|
60
|
-
$color: ReturnType<typeof variantToFont>
|
|
61
|
-
}
|
|
62
|
-
const StyledButton = styled(Clickable)<StyledButtonProps>`
|
|
63
|
-
width: ${(p) => (p.$fullWidth ? 'stretch' : 'min-content')};
|
|
64
|
-
display: inline-grid;
|
|
65
|
-
align-items: center;
|
|
66
|
-
justify-content: center;
|
|
67
|
-
cursor: pointer;
|
|
68
|
-
user-select: none;
|
|
69
|
-
white-space: nowrap;
|
|
70
|
-
border-radius: 999999px;
|
|
71
|
-
font-size: 14px;
|
|
72
|
-
line-height: 22px;
|
|
73
|
-
font-weight: bold;
|
|
74
|
-
|
|
75
|
-
${(p) => (p.$size === 'M' ? horizontalPaddingMedium : horizontalPaddingSmall)}
|
|
76
|
-
|
|
77
|
-
color: var(--charcoal-${(p) => p.$color});
|
|
78
|
-
background-color: var(--charcoal-${(p) => p.$background});
|
|
79
|
-
transition: 0.2s color, 0.2s background-color, 0.2s box-shadow;
|
|
80
|
-
|
|
81
|
-
&:not(:disabled):not([aria-disabled]),
|
|
82
|
-
&[aria-disabled='false'] {
|
|
83
|
-
&:active,
|
|
84
|
-
&:focus,
|
|
85
|
-
&:focus-visible {
|
|
86
|
-
outline: none;
|
|
87
|
-
box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
|
|
88
|
-
}
|
|
89
48
|
|
|
90
|
-
|
|
91
|
-
color: var(--charcoal-${(p) => p.$color}-hover);
|
|
92
|
-
background-color: var(--charcoal-${(p) => p.$background}-hover);
|
|
93
|
-
}
|
|
94
|
-
&:active {
|
|
95
|
-
color: var(--charcoal-${(p) => p.$color}-press);
|
|
96
|
-
background-color: var(--charcoal-${(p) => p.$background}-press);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
&:disabled,
|
|
101
|
-
&[aria-disabled]:not([aria-disabled='false']) {
|
|
102
|
-
opacity: 0.32;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/* よく考えたらheight=32って定義が存在しないな... */
|
|
106
|
-
height: ${(p) => (p.$size === 'M' ? 40 : 32)}px;
|
|
107
|
-
`
|
|
108
|
-
|
|
109
|
-
function variantToBackground(variant: Variant) {
|
|
110
|
-
switch (variant) {
|
|
111
|
-
case 'Overlay':
|
|
112
|
-
return 'surface4'
|
|
113
|
-
case 'Default':
|
|
114
|
-
return 'surface3'
|
|
115
|
-
case 'Primary':
|
|
116
|
-
return 'brand'
|
|
117
|
-
case 'Navigation':
|
|
118
|
-
return 'surface6'
|
|
119
|
-
case 'Danger':
|
|
120
|
-
return 'assertive'
|
|
121
|
-
default:
|
|
122
|
-
return unreachable(variant)
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function variantToFont(variant: Variant) {
|
|
127
|
-
switch (variant) {
|
|
128
|
-
case 'Overlay':
|
|
129
|
-
return 'text5'
|
|
130
|
-
case 'Default':
|
|
131
|
-
return 'text2'
|
|
132
|
-
case 'Primary':
|
|
133
|
-
return 'text5'
|
|
134
|
-
case 'Navigation':
|
|
135
|
-
return 'text5'
|
|
136
|
-
case 'Danger':
|
|
137
|
-
return 'text5'
|
|
138
|
-
default:
|
|
139
|
-
return unreachable(variant)
|
|
140
|
-
}
|
|
141
|
-
}
|
|
49
|
+
export default Button
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { unreachable } from '../../../_lib'
|
|
2
|
+
import type { Variant } from '..'
|
|
3
|
+
|
|
4
|
+
export function variantToBackground(variant: Variant) {
|
|
5
|
+
switch (variant) {
|
|
6
|
+
case 'Overlay':
|
|
7
|
+
return 'surface4'
|
|
8
|
+
case 'Default':
|
|
9
|
+
return 'surface3'
|
|
10
|
+
case 'Primary':
|
|
11
|
+
return 'brand'
|
|
12
|
+
case 'Navigation':
|
|
13
|
+
return 'surface6'
|
|
14
|
+
case 'Danger':
|
|
15
|
+
return 'assertive'
|
|
16
|
+
default:
|
|
17
|
+
return unreachable(variant)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { unreachable } from '../../../_lib'
|
|
2
|
+
import type { Variant } from '..'
|
|
3
|
+
|
|
4
|
+
export function variantToFont(variant: Variant) {
|
|
5
|
+
switch (variant) {
|
|
6
|
+
case 'Overlay':
|
|
7
|
+
return 'text5'
|
|
8
|
+
case 'Default':
|
|
9
|
+
return 'text2'
|
|
10
|
+
case 'Primary':
|
|
11
|
+
return 'text5'
|
|
12
|
+
case 'Navigation':
|
|
13
|
+
return 'text5'
|
|
14
|
+
case 'Danger':
|
|
15
|
+
return 'text5'
|
|
16
|
+
default:
|
|
17
|
+
return unreachable(variant)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -1,109 +1,103 @@
|
|
|
1
1
|
import { action } from '@storybook/addon-actions'
|
|
2
2
|
import Checkbox from '.'
|
|
3
|
-
import {
|
|
3
|
+
import { Meta, StoryObj } from '@storybook/react'
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
title: 'Checkbox',
|
|
7
7
|
component: Checkbox,
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
type Props = {
|
|
11
|
-
checked: boolean
|
|
12
|
-
defaultChecked: boolean
|
|
13
|
-
disabled: boolean
|
|
14
|
-
readonly: boolean
|
|
15
|
-
className?: string
|
|
16
|
-
invalid: boolean
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const Labelled: Story<Props> = (props) => {
|
|
20
|
-
return (
|
|
21
|
-
<div>
|
|
22
|
-
<div style={{ marginBottom: '1em' }}>
|
|
23
|
-
<Checkbox
|
|
24
|
-
{...props}
|
|
25
|
-
name="labelled"
|
|
26
|
-
label="label"
|
|
27
|
-
onBlur={action('blur')}
|
|
28
|
-
onClick={action('click')}
|
|
29
|
-
onChange={action('change')}
|
|
30
|
-
onFocus={action('focus')}
|
|
31
|
-
>
|
|
32
|
-
同意する
|
|
33
|
-
</Checkbox>
|
|
34
|
-
</div>
|
|
8
|
+
} as Meta<typeof Checkbox>
|
|
35
9
|
|
|
10
|
+
export const Labelled: StoryObj<typeof Checkbox> = {
|
|
11
|
+
args: {
|
|
12
|
+
checked: false,
|
|
13
|
+
defaultChecked: false,
|
|
14
|
+
disabled: false,
|
|
15
|
+
readonly: false,
|
|
16
|
+
invalid: false,
|
|
17
|
+
},
|
|
18
|
+
render: (props) => {
|
|
19
|
+
return (
|
|
36
20
|
<div>
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
</
|
|
49
|
-
</
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
Labelled.args = {
|
|
56
|
-
checked: false,
|
|
57
|
-
defaultChecked: false,
|
|
58
|
-
disabled: false,
|
|
59
|
-
readonly: false,
|
|
60
|
-
invalid: false,
|
|
61
|
-
}
|
|
21
|
+
<div style={{ marginBottom: '1em' }}>
|
|
22
|
+
<Checkbox
|
|
23
|
+
{...props}
|
|
24
|
+
name="labelled"
|
|
25
|
+
label="label"
|
|
26
|
+
onBlur={action('blur')}
|
|
27
|
+
onClick={action('click')}
|
|
28
|
+
onChange={action('change')}
|
|
29
|
+
onFocus={action('focus')}
|
|
30
|
+
>
|
|
31
|
+
同意する
|
|
32
|
+
</Checkbox>
|
|
33
|
+
</div>
|
|
62
34
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
checked: false,
|
|
82
|
-
defaultChecked: false,
|
|
83
|
-
disabled: false,
|
|
84
|
-
readonly: false,
|
|
35
|
+
<div>
|
|
36
|
+
<Checkbox
|
|
37
|
+
{...props}
|
|
38
|
+
name="labelled"
|
|
39
|
+
label="label"
|
|
40
|
+
onBlur={action('blur')}
|
|
41
|
+
onClick={action('click')}
|
|
42
|
+
onChange={action('change')}
|
|
43
|
+
onFocus={action('focus')}
|
|
44
|
+
>
|
|
45
|
+
<span style={{ width: 200, display: 'block' }}>
|
|
46
|
+
同意する同意する同意する同意する同意する同意する同意する同意する同意する同意する同意する同意する同意する
|
|
47
|
+
</span>
|
|
48
|
+
</Checkbox>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
)
|
|
52
|
+
},
|
|
85
53
|
}
|
|
86
54
|
|
|
87
|
-
export const
|
|
88
|
-
|
|
89
|
-
|
|
55
|
+
export const Invalid: StoryObj<typeof Checkbox> = {
|
|
56
|
+
args: {
|
|
57
|
+
checked: false,
|
|
58
|
+
defaultChecked: false,
|
|
59
|
+
disabled: false,
|
|
60
|
+
readonly: false,
|
|
61
|
+
},
|
|
62
|
+
render: (props) => {
|
|
63
|
+
return (
|
|
90
64
|
<Checkbox
|
|
91
65
|
{...props}
|
|
92
|
-
name="
|
|
66
|
+
name="labelled"
|
|
93
67
|
label="label"
|
|
68
|
+
invalid
|
|
94
69
|
onBlur={action('blur')}
|
|
95
70
|
onClick={action('click')}
|
|
96
71
|
onChange={action('change')}
|
|
97
72
|
onFocus={action('focus')}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
73
|
+
>
|
|
74
|
+
同意する
|
|
75
|
+
</Checkbox>
|
|
76
|
+
)
|
|
77
|
+
},
|
|
101
78
|
}
|
|
102
79
|
|
|
103
|
-
Unlabelled
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
80
|
+
export const Unlabelled: StoryObj<typeof Checkbox> = {
|
|
81
|
+
args: {
|
|
82
|
+
checked: false,
|
|
83
|
+
defaultChecked: false,
|
|
84
|
+
disabled: false,
|
|
85
|
+
readonly: false,
|
|
86
|
+
invalid: false,
|
|
87
|
+
},
|
|
88
|
+
render: (props) => {
|
|
89
|
+
return (
|
|
90
|
+
<div>
|
|
91
|
+
<Checkbox
|
|
92
|
+
{...props}
|
|
93
|
+
name="unlabelled"
|
|
94
|
+
label="label"
|
|
95
|
+
onBlur={action('blur')}
|
|
96
|
+
onClick={action('click')}
|
|
97
|
+
onChange={action('change')}
|
|
98
|
+
onFocus={action('focus')}
|
|
99
|
+
/>
|
|
100
|
+
</div>
|
|
101
|
+
)
|
|
102
|
+
},
|
|
109
103
|
}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { action } from '@storybook/addon-actions'
|
|
2
2
|
import Clickable from '.'
|
|
3
|
+
import { Meta, StoryObj } from '@storybook/react'
|
|
3
4
|
|
|
4
5
|
export default {
|
|
5
6
|
title: 'Clickable',
|
|
6
7
|
component: Clickable,
|
|
7
|
-
}
|
|
8
|
+
} as Meta<typeof Clickable>
|
|
8
9
|
|
|
9
|
-
export const Button =
|
|
10
|
-
<Clickable onClick={action('click')}>button</Clickable
|
|
11
|
-
|
|
10
|
+
export const Button: StoryObj = {
|
|
11
|
+
render: () => <Clickable onClick={action('click')}>button</Clickable>,
|
|
12
|
+
}
|
|
12
13
|
|
|
13
|
-
export const Link =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
export const Link: StoryObj = {
|
|
15
|
+
render: () => (
|
|
16
|
+
<Clickable to="#" onClick={action('click')}>
|
|
17
|
+
link
|
|
18
|
+
</Clickable>
|
|
19
|
+
),
|
|
20
|
+
}
|
|
@@ -29,20 +29,7 @@ const StyledSpan = styled.span<{ isSelected?: boolean }>`
|
|
|
29
29
|
font-size: 14px;
|
|
30
30
|
line-height: 22px;
|
|
31
31
|
color: var(--charcoal-text2);
|
|
32
|
-
|
|
33
|
-
display: block;
|
|
34
|
-
width: 0;
|
|
35
|
-
height: 0;
|
|
36
|
-
content: '';
|
|
37
|
-
margin-top: -4px;
|
|
38
|
-
}
|
|
39
|
-
&::after {
|
|
40
|
-
display: block;
|
|
41
|
-
width: 0;
|
|
42
|
-
height: 0;
|
|
43
|
-
content: '';
|
|
44
|
-
margin-bottom: -4px;
|
|
45
|
-
}
|
|
32
|
+
padding: 9px 0;
|
|
46
33
|
|
|
47
34
|
display: flex;
|
|
48
35
|
align-items: center;
|