@charcoal-ui/react 2.5.0 → 2.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 -1
- package/dist/_lib/compat.d.ts.map +1 -1
- package/dist/components/Button/index.d.ts +3 -3
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.d.ts +2 -2
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.story.d.ts +1 -1
- package/dist/components/Checkbox/index.story.d.ts.map +1 -1
- package/dist/components/Clickable/index.d.ts +2 -2
- package/dist/components/Clickable/index.d.ts.map +1 -1
- package/dist/components/DropdownSelector/DropdownPopover.d.ts +1 -1
- package/dist/components/DropdownSelector/DropdownPopover.d.ts.map +1 -1
- package/dist/components/DropdownSelector/Listbox.d.ts +2 -2
- package/dist/components/DropdownSelector/Listbox.d.ts.map +1 -1
- package/dist/components/DropdownSelector/Option.d.ts +1 -1
- package/dist/components/DropdownSelector/Option.d.ts.map +1 -1
- package/dist/components/DropdownSelector/index.d.ts +3 -3
- package/dist/components/DropdownSelector/index.d.ts.map +1 -1
- package/dist/components/DropdownSelector/index.story.d.ts +4 -4
- package/dist/components/DropdownSelector/index.story.d.ts.map +1 -1
- package/dist/components/Icon/index.story.d.ts +8 -3
- package/dist/components/Icon/index.story.d.ts.map +1 -1
- package/dist/components/IconButton/index.d.ts +3 -3
- package/dist/components/IconButton/index.d.ts.map +1 -1
- package/dist/components/IconButton/index.story.d.ts +1 -1
- package/dist/components/IconButton/index.story.d.ts.map +1 -1
- package/dist/components/Modal/ModalPlumbing.d.ts.map +1 -1
- package/dist/components/Modal/index.d.ts +1 -1
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/MultiSelect/context.d.ts +1 -1
- package/dist/components/MultiSelect/context.d.ts.map +1 -1
- package/dist/components/MultiSelect/index.d.ts +2 -2
- package/dist/components/MultiSelect/index.d.ts.map +1 -1
- package/dist/components/MultiSelect/index.story.d.ts +2 -2
- package/dist/components/MultiSelect/index.story.d.ts.map +1 -1
- package/dist/components/Radio/index.d.ts +2 -2
- package/dist/components/Radio/index.d.ts.map +1 -1
- package/dist/components/SegmentedControl/RadioGroupContext.d.ts +1 -1
- package/dist/components/SegmentedControl/RadioGroupContext.d.ts.map +1 -1
- package/dist/components/SegmentedControl/index.d.ts +2 -2
- package/dist/components/SegmentedControl/index.d.ts.map +1 -1
- package/dist/components/Switch/index.d.ts +1 -1
- package/dist/components/Switch/index.d.ts.map +1 -1
- package/dist/components/Switch/index.story.d.ts +1 -0
- package/dist/components/Switch/index.story.d.ts.map +1 -1
- package/dist/components/TagItem/index.d.ts +3 -1
- package/dist/components/TagItem/index.d.ts.map +1 -1
- package/dist/components/TagItem/index.story.d.ts +1 -0
- package/dist/components/TagItem/index.story.d.ts.map +1 -1
- package/dist/components/TextField/index.d.ts +2 -2
- package/dist/components/TextField/index.d.ts.map +1 -1
- package/dist/core/CharcoalProvider.d.ts +1 -1
- package/dist/core/CharcoalProvider.d.ts.map +1 -1
- package/dist/core/ComponentAbstraction.d.ts +1 -1
- package/dist/core/ComponentAbstraction.d.ts.map +1 -1
- package/dist/index.cjs.js +95 -63
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +76 -44
- package/dist/index.esm.js.map +1 -1
- package/dist/styled.d.ts +2 -2
- package/package.json +7 -7
- package/src/components/Checkbox/index.tsx +4 -0
- package/src/components/Icon/index.story.tsx +6 -2
- package/src/components/Modal/ModalPlumbing.tsx +2 -10
- package/src/components/Radio/index.tsx +3 -0
- package/src/components/Switch/index.story.tsx +20 -1
- package/src/components/Switch/index.tsx +58 -33
- package/src/components/TagItem/index.story.tsx +1 -0
- package/src/components/TagItem/index.tsx +3 -0
- package/src/components/TextField/index.tsx +7 -0
package/dist/styled.d.ts
CHANGED
|
@@ -64,13 +64,13 @@ export declare const theme: (specFn: (o: Record<string, unknown> & Readonly<{
|
|
|
64
64
|
readonly margin: import("@charcoal-ui/styled/dist/factories/lib").MethodChain<import("@charcoal-ui/styled/dist/internals").Internal, "horizontal" | "vertical" | "all" | "bottom" | "left" | "right" | "top", [0 | "auto" | 4 | 8 | 16 | 24 | 40 | 64 | 104 | 168 | 272 | 440]>;
|
|
65
65
|
readonly padding: import("@charcoal-ui/styled/dist/factories/lib").MethodChain<import("@charcoal-ui/styled/dist/internals").Internal, "horizontal" | "vertical" | "all" | "bottom" | "left" | "right" | "top", [0 | "auto" | 4 | 8 | 16 | 24 | 40 | 64 | 104 | 168 | 272 | 440]>;
|
|
66
66
|
} & {
|
|
67
|
-
readonly
|
|
67
|
+
readonly height: Readonly<{
|
|
68
68
|
px: (size: 0 | "auto" | 4 | 8 | 16 | 24 | 40 | 64 | 104 | 168 | 272 | 440) => import("@charcoal-ui/styled/dist/internals").Internal;
|
|
69
69
|
column: (span: number) => import("@charcoal-ui/styled/dist/internals").Internal;
|
|
70
70
|
auto: import("@charcoal-ui/styled/dist/internals").Internal;
|
|
71
71
|
full: import("@charcoal-ui/styled/dist/internals").Internal;
|
|
72
72
|
}>;
|
|
73
|
-
readonly
|
|
73
|
+
readonly width: Readonly<{
|
|
74
74
|
px: (size: 0 | "auto" | 4 | 8 | 16 | 24 | 40 | 64 | 104 | 168 | 272 | 440) => import("@charcoal-ui/styled/dist/internals").Internal;
|
|
75
75
|
column: (span: number) => import("@charcoal-ui/styled/dist/internals").Internal;
|
|
76
76
|
auto: import("@charcoal-ui/styled/dist/internals").Internal;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@charcoal-ui/react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
"rimraf": "^3.0.2",
|
|
47
47
|
"styled-components": "^5.3.3",
|
|
48
48
|
"tsup": "^6.5.0",
|
|
49
|
-
"typescript": "^4.
|
|
49
|
+
"typescript": "^4.9.5"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@charcoal-ui/icons": "^2.
|
|
53
|
-
"@charcoal-ui/styled": "^2.
|
|
54
|
-
"@charcoal-ui/theme": "^2.
|
|
55
|
-
"@charcoal-ui/utils": "^2.
|
|
52
|
+
"@charcoal-ui/icons": "^2.7.0",
|
|
53
|
+
"@charcoal-ui/styled": "^2.7.0",
|
|
54
|
+
"@charcoal-ui/theme": "^2.7.0",
|
|
55
|
+
"@charcoal-ui/utils": "^2.7.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": "77e32148d5a981f988e8bbc0c88aec82b0936a1a"
|
|
92
92
|
}
|
|
@@ -107,8 +107,12 @@ const CheckboxInput = styled.input`
|
|
|
107
107
|
border-color: ${({ theme }) => theme.color.text4};
|
|
108
108
|
}
|
|
109
109
|
${theme((o) => [o.outline.default.focus, o.borderRadius(4)])}
|
|
110
|
+
|
|
111
|
+
/* FIXME: o.outline.default.focus の transition に o.bg.brand の transition が打ち消されてしまう */
|
|
112
|
+
transition: all 0.2s !important;
|
|
110
113
|
}
|
|
111
114
|
`
|
|
115
|
+
|
|
112
116
|
const CheckboxInputOverlay = styled.div<{ checked?: boolean }>`
|
|
113
117
|
position: absolute;
|
|
114
118
|
top: -2px;
|
|
@@ -22,8 +22,12 @@ export default {
|
|
|
22
22
|
},
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
// NOTICE: コード生成のタイミングで不当に型エラーが出ることがあるので name を any にする
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
|
+
const Template: Story<IconProps & { name: any }> = (props) => (
|
|
28
|
+
<Icon {...props} />
|
|
29
|
+
)
|
|
26
30
|
|
|
27
|
-
export const Default
|
|
31
|
+
export const Default = Template.bind({})
|
|
28
32
|
|
|
29
33
|
Default.args = { name: KNOWN_ICON_FILES[0], scale: 1 }
|
|
@@ -2,7 +2,6 @@ import React from 'react'
|
|
|
2
2
|
import { ModalTitle } from '.'
|
|
3
3
|
import styled from 'styled-components'
|
|
4
4
|
import { theme } from '../../styled'
|
|
5
|
-
import { maxWidth } from '@charcoal-ui/utils'
|
|
6
5
|
|
|
7
6
|
export function ModalHeader() {
|
|
8
7
|
return (
|
|
@@ -24,11 +23,7 @@ const StyledModalTitle = styled(ModalTitle)`
|
|
|
24
23
|
`
|
|
25
24
|
|
|
26
25
|
export const ModalAlign = styled.div`
|
|
27
|
-
${theme((o) => [o.padding.horizontal(
|
|
28
|
-
|
|
29
|
-
@media ${({ theme }) => maxWidth(theme.breakpoint.screen1)} {
|
|
30
|
-
${theme((o) => [o.padding.horizontal(16)])}
|
|
31
|
-
}
|
|
26
|
+
${theme((o) => [o.padding.horizontal(16)])}
|
|
32
27
|
`
|
|
33
28
|
|
|
34
29
|
export const ModalBody = styled.div`
|
|
@@ -39,9 +34,6 @@ export const ModalButtons = styled.div`
|
|
|
39
34
|
display: grid;
|
|
40
35
|
grid-auto-flow: row;
|
|
41
36
|
grid-row-gap: 8px;
|
|
42
|
-
${theme((o) => [o.padding.horizontal(24).top(16)])}
|
|
43
37
|
|
|
44
|
-
|
|
45
|
-
${theme((o) => [o.padding.horizontal(16)])}
|
|
46
|
-
}
|
|
38
|
+
${theme((o) => [o.padding.horizontal(16).top(16)])}
|
|
47
39
|
`
|
|
@@ -110,6 +110,9 @@ export const RadioInput = styled.input.attrs({ type: 'radio' })<{
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
${theme((o) => o.outline.default.focus)}
|
|
113
|
+
|
|
114
|
+
/* FIXME: o.outline.default.focus の transition に o.bg.brand の transition が打ち消されてしまう */
|
|
115
|
+
transition: all 0.2s !important;
|
|
113
116
|
}
|
|
114
117
|
`
|
|
115
118
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { action } from '@storybook/addon-actions'
|
|
2
|
-
import React from 'react'
|
|
2
|
+
import React, { useState } from 'react'
|
|
3
3
|
import { Story } from '../../_lib/compat'
|
|
4
4
|
import Switch from '.'
|
|
5
5
|
|
|
@@ -13,6 +13,25 @@ interface Props {
|
|
|
13
13
|
disabled: boolean
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
export const Playground: Story<Props> = (props: Props) => {
|
|
17
|
+
const [checked, setChecked] = useState(false)
|
|
18
|
+
return (
|
|
19
|
+
<div>
|
|
20
|
+
<Switch
|
|
21
|
+
{...props}
|
|
22
|
+
name="name"
|
|
23
|
+
onChange={(v) => {
|
|
24
|
+
setChecked(v)
|
|
25
|
+
action('onChange')
|
|
26
|
+
}}
|
|
27
|
+
checked={checked}
|
|
28
|
+
>
|
|
29
|
+
選択する
|
|
30
|
+
</Switch>
|
|
31
|
+
</div>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
16
35
|
export const Labelled: Story<Props> = (props: Props) => (
|
|
17
36
|
<div>
|
|
18
37
|
<Switch {...props} name="name" onChange={action('onChange')}>
|
|
@@ -64,6 +64,10 @@ const Label = styled.label`
|
|
|
64
64
|
|
|
65
65
|
${theme((o) => o.disabled)}
|
|
66
66
|
|
|
67
|
+
:active > input {
|
|
68
|
+
box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
|
|
69
|
+
}
|
|
70
|
+
|
|
67
71
|
${disabledSelector} {
|
|
68
72
|
cursor: default;
|
|
69
73
|
}
|
|
@@ -80,42 +84,63 @@ const LabelInner = styled.div`
|
|
|
80
84
|
const SwitchInput = styled.input.attrs({
|
|
81
85
|
type: 'checkbox',
|
|
82
86
|
})`
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
border: 2px solid transparent;
|
|
90
|
-
transition: box-shadow 0.2s, background-color 0.2s;
|
|
91
|
-
cursor: inherit;
|
|
92
|
-
${theme((o) => [
|
|
93
|
-
o.borderRadius(16),
|
|
94
|
-
o.height.px(16),
|
|
95
|
-
o.bg.text4.hover.press,
|
|
96
|
-
o.outline.default.focus,
|
|
97
|
-
o.margin.all(0),
|
|
98
|
-
])}
|
|
87
|
+
appearance: none;
|
|
88
|
+
display: inline-flex;
|
|
89
|
+
position: relative;
|
|
90
|
+
box-sizing: border-box;
|
|
91
|
+
width: 28px;
|
|
92
|
+
border: 2px solid transparent;
|
|
99
93
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
94
|
+
transition-property: background-color, box-shadow;
|
|
95
|
+
transition-duration: 0.2s;
|
|
96
|
+
cursor: inherit;
|
|
97
|
+
|
|
98
|
+
outline: none;
|
|
99
|
+
border-radius: 16px;
|
|
100
|
+
height: 16px;
|
|
101
|
+
margin: 0;
|
|
102
|
+
background-color: var(--charcoal-text4);
|
|
103
|
+
:hover {
|
|
104
|
+
background-color: var(--charcoal-text4-hover);
|
|
105
|
+
}
|
|
106
|
+
:active {
|
|
107
|
+
background-color: var(--charcoal-text4-press);
|
|
108
|
+
}
|
|
109
|
+
:focus {
|
|
110
|
+
box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
|
|
111
|
+
}
|
|
112
112
|
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
&::after {
|
|
114
|
+
content: '';
|
|
115
|
+
position: absolute;
|
|
116
|
+
display: block;
|
|
117
|
+
top: 0;
|
|
118
|
+
left: 0;
|
|
119
|
+
width: 12px;
|
|
120
|
+
height: 12px;
|
|
121
|
+
transform: translateX(0);
|
|
122
|
+
transition: transform 0.2s;
|
|
123
|
+
border-radius: 1024px;
|
|
124
|
+
background-color: var(--charcoal-text5);
|
|
125
|
+
:hover {
|
|
126
|
+
background-color: var(--charcoal-text5-hover);
|
|
127
|
+
}
|
|
128
|
+
:active {
|
|
129
|
+
background-color: var(--charcoal-text5-press);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
115
132
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
133
|
+
&:checked {
|
|
134
|
+
background-color: var(--charcoal-brand);
|
|
135
|
+
:hover {
|
|
136
|
+
background-color: var(--charcoal-brand-hover);
|
|
137
|
+
}
|
|
138
|
+
:active {
|
|
139
|
+
background-color: var(--charcoal-brand-press);
|
|
140
|
+
}
|
|
141
|
+
&::after {
|
|
142
|
+
transform: translateX(12px);
|
|
143
|
+
transition: transform 0.2s;
|
|
119
144
|
}
|
|
120
145
|
}
|
|
121
146
|
`
|
|
@@ -24,6 +24,7 @@ export type TagItemProps = {
|
|
|
24
24
|
status?: 'default' | 'active' | 'inactive'
|
|
25
25
|
size?: keyof typeof sizeMap
|
|
26
26
|
disabled?: boolean
|
|
27
|
+
className?: string
|
|
27
28
|
} & Pick<ComponentPropsWithoutRef<'a'>, 'href' | 'target' | 'rel' | 'onClick'>
|
|
28
29
|
|
|
29
30
|
const TagItem = forwardRef<HTMLAnchorElement, TagItemProps>(
|
|
@@ -36,6 +37,7 @@ const TagItem = forwardRef<HTMLAnchorElement, TagItemProps>(
|
|
|
36
37
|
size = 'M',
|
|
37
38
|
disabled,
|
|
38
39
|
status = 'default',
|
|
40
|
+
className,
|
|
39
41
|
...props
|
|
40
42
|
},
|
|
41
43
|
_ref
|
|
@@ -60,6 +62,7 @@ const TagItem = forwardRef<HTMLAnchorElement, TagItemProps>(
|
|
|
60
62
|
size={hasTranslatedLabel ? 'M' : size}
|
|
61
63
|
status={status}
|
|
62
64
|
{...buttonProps}
|
|
65
|
+
className={className}
|
|
63
66
|
>
|
|
64
67
|
<Background bgColor={bgColor} bgImage={bgImage} status={status} />
|
|
65
68
|
|
|
@@ -417,6 +417,13 @@ const StyledTextareaContainer = styled.div<{ rows: number; invalid: boolean }>`
|
|
|
417
417
|
o.borderRadius(4),
|
|
418
418
|
])}
|
|
419
419
|
|
|
420
|
+
/**
|
|
421
|
+
* FIXME: o.outline.default を &:focus-within 内に書いてると、外れるときに transition が効かない
|
|
422
|
+
* 本来 o.outline.default.focus と書けば足してくれるような transition の内容を一旦明示している
|
|
423
|
+
* o.outline.default.focusWithin のようなものがあればこの行は不要になるはず
|
|
424
|
+
*/
|
|
425
|
+
transition: box-shadow 0.2s;
|
|
426
|
+
|
|
420
427
|
&:focus-within {
|
|
421
428
|
${(p) =>
|
|
422
429
|
theme((o) => (p.invalid ? o.outline.assertive : o.outline.default))}
|