@charcoal-ui/react 2.7.0 → 3.0.0-beta.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/components/Button/index.d.ts +1 -1
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/index.cjs.js +4 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +4 -4
- package/dist/index.esm.js.map +1 -1
- package/package.json +6 -6
- package/src/components/Button/index.story.tsx +6 -6
- package/src/components/Button/index.tsx +5 -5
- package/src/components/Modal/index.story.tsx +5 -5
- package/src/components/Modal/index.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@charcoal-ui/react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-beta.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"typescript": "^4.9.5"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@charcoal-ui/icons": "^
|
|
53
|
-
"@charcoal-ui/styled": "^
|
|
54
|
-
"@charcoal-ui/theme": "^
|
|
55
|
-
"@charcoal-ui/utils": "^
|
|
52
|
+
"@charcoal-ui/icons": "^3.0.0-beta.0",
|
|
53
|
+
"@charcoal-ui/styled": "^3.0.0-beta.0",
|
|
54
|
+
"@charcoal-ui/theme": "^3.0.0-beta.0",
|
|
55
|
+
"@charcoal-ui/utils": "^3.0.0-beta.0",
|
|
56
56
|
"@react-aria/button": "^3.7.0",
|
|
57
57
|
"@react-aria/checkbox": "^3.8.0",
|
|
58
58
|
"@react-aria/dialog": "^3.5.0",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"url": "https://github.com/pixiv/charcoal.git",
|
|
89
89
|
"directory": "packages/react"
|
|
90
90
|
},
|
|
91
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "e3522bffb7136b259f31cef88920aebc7637a5b6"
|
|
92
92
|
}
|
|
@@ -58,7 +58,7 @@ Small.args = {
|
|
|
58
58
|
|
|
59
59
|
export const Fixed: Story<ButtonProps> = DefaultStory.bind({})
|
|
60
60
|
Fixed.args = {
|
|
61
|
-
|
|
61
|
+
fullWidth: true,
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
export const Disabled: Story<ButtonProps> = DefaultStory.bind({})
|
|
@@ -121,10 +121,10 @@ const LayoutExampleStory = (args: ButtonProps) => (
|
|
|
121
121
|
gap: 8px;
|
|
122
122
|
`}
|
|
123
123
|
>
|
|
124
|
-
<Button {...args} variant="Primary"
|
|
124
|
+
<Button {...args} variant="Primary" fullWidth>
|
|
125
125
|
Submit
|
|
126
126
|
</Button>
|
|
127
|
-
<Button {...args} variant="Default"
|
|
127
|
+
<Button {...args} variant="Default" fullWidth>
|
|
128
128
|
Cancel
|
|
129
129
|
</Button>
|
|
130
130
|
</div>
|
|
@@ -156,10 +156,10 @@ const LayoutExampleStory = (args: ButtonProps) => (
|
|
|
156
156
|
}
|
|
157
157
|
`}
|
|
158
158
|
>
|
|
159
|
-
<Button {...args} variant="Primary"
|
|
159
|
+
<Button {...args} variant="Primary" fullWidth>
|
|
160
160
|
Submit
|
|
161
161
|
</Button>
|
|
162
|
-
<Button {...args} variant="Default"
|
|
162
|
+
<Button {...args} variant="Default" fullWidth>
|
|
163
163
|
Cancel
|
|
164
164
|
</Button>
|
|
165
165
|
</div>
|
|
@@ -174,7 +174,7 @@ const LayoutExampleStory = (args: ButtonProps) => (
|
|
|
174
174
|
}
|
|
175
175
|
`}
|
|
176
176
|
>
|
|
177
|
-
<Button {...args} variant="Primary"
|
|
177
|
+
<Button {...args} variant="Primary" fullWidth>
|
|
178
178
|
すべて見る
|
|
179
179
|
</Button>
|
|
180
180
|
<Button {...args} variant="Default">
|
|
@@ -19,7 +19,7 @@ interface StyledProps {
|
|
|
19
19
|
/**
|
|
20
20
|
* 幅を最大まで広げて描画
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
fullWidth: boolean
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export type ButtonProps = Partial<StyledProps> & ClickableProps
|
|
@@ -29,7 +29,7 @@ const Button = React.forwardRef<ClickableElement, ButtonProps>(function Button(
|
|
|
29
29
|
children,
|
|
30
30
|
variant = 'Default',
|
|
31
31
|
size = 'M',
|
|
32
|
-
fixed = false,
|
|
32
|
+
fullWidth: fixed = false,
|
|
33
33
|
disabled = false,
|
|
34
34
|
...rest
|
|
35
35
|
},
|
|
@@ -41,7 +41,7 @@ const Button = React.forwardRef<ClickableElement, ButtonProps>(function Button(
|
|
|
41
41
|
disabled={disabled}
|
|
42
42
|
variant={variant}
|
|
43
43
|
size={size}
|
|
44
|
-
|
|
44
|
+
fullWidth={fixed}
|
|
45
45
|
ref={ref}
|
|
46
46
|
>
|
|
47
47
|
{children}
|
|
@@ -54,11 +54,11 @@ const StyledButton = styled(Clickable)
|
|
|
54
54
|
.withConfig<StyledProps>({
|
|
55
55
|
shouldForwardProp(prop) {
|
|
56
56
|
// fixed は <button> 要素に渡ってはいけない
|
|
57
|
-
return prop !== '
|
|
57
|
+
return prop !== 'fullWidth'
|
|
58
58
|
},
|
|
59
59
|
})
|
|
60
60
|
.attrs<StyledProps, ReturnType<typeof styledProps>>(styledProps)`
|
|
61
|
-
width: ${(p) => (p.
|
|
61
|
+
width: ${(p) => (p.fullWidth ? 'stretch' : 'min-content')};
|
|
62
62
|
display: inline-grid;
|
|
63
63
|
align-items: center;
|
|
64
64
|
justify-content: center;
|
|
@@ -76,10 +76,10 @@ const DefaultStory = (args: ModalProps) => {
|
|
|
76
76
|
</ModalAlign>
|
|
77
77
|
</ModalVStack>
|
|
78
78
|
<ModalButtons>
|
|
79
|
-
<Button variant="Primary" onClick={() => state.close()}
|
|
79
|
+
<Button variant="Primary" onClick={() => state.close()} fullWidth>
|
|
80
80
|
Apply
|
|
81
81
|
</Button>
|
|
82
|
-
<Button onClick={() => state.close()}
|
|
82
|
+
<Button onClick={() => state.close()} fullWidth>
|
|
83
83
|
Cancel
|
|
84
84
|
</Button>
|
|
85
85
|
</ModalButtons>
|
|
@@ -140,10 +140,10 @@ const FullBottomSheetStory = (args: ModalProps) => {
|
|
|
140
140
|
</ModalAlign>
|
|
141
141
|
</ModalVStack>
|
|
142
142
|
<ModalButtons>
|
|
143
|
-
<Button variant="Primary" onClick={() => state.close()}
|
|
143
|
+
<Button variant="Primary" onClick={() => state.close()} fullWidth>
|
|
144
144
|
Apply
|
|
145
145
|
</Button>
|
|
146
|
-
<Button onClick={() => state.close()}
|
|
146
|
+
<Button onClick={() => state.close()} fullWidth>
|
|
147
147
|
Cancel
|
|
148
148
|
</Button>
|
|
149
149
|
</ModalButtons>
|
|
@@ -181,7 +181,7 @@ const BottomSheetStory = (args: ModalProps) => {
|
|
|
181
181
|
</StyledModalText>
|
|
182
182
|
</ModalVStack>
|
|
183
183
|
<ModalButtons>
|
|
184
|
-
<Button variant="Danger" onClick={() => state.close()}
|
|
184
|
+
<Button variant="Danger" onClick={() => state.close()} fullWidth>
|
|
185
185
|
削除する
|
|
186
186
|
</Button>
|
|
187
187
|
<ModalDismissButton>キャンセル</ModalDismissButton>
|