@charcoal-ui/react 3.6.0 → 3.8.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.
Files changed (127) hide show
  1. package/dist/_lib/compat.d.ts +1 -0
  2. package/dist/_lib/compat.d.ts.map +1 -1
  3. package/dist/components/Button/StyledButton.d.ts +13 -0
  4. package/dist/components/Button/StyledButton.d.ts.map +1 -0
  5. package/dist/components/Button/index.d.ts +3 -2
  6. package/dist/components/Button/index.d.ts.map +1 -1
  7. package/dist/components/Button/index.story.d.ts +16 -32
  8. package/dist/components/Button/index.story.d.ts.map +1 -1
  9. package/dist/components/Button/lib/variantToBackground.d.ts +3 -0
  10. package/dist/components/Button/lib/variantToBackground.d.ts.map +1 -0
  11. package/dist/components/Button/lib/variantToFont.d.ts +3 -0
  12. package/dist/components/Button/lib/variantToFont.d.ts.map +1 -0
  13. package/dist/components/Checkbox/index.d.ts.map +1 -1
  14. package/dist/components/Checkbox/index.story.d.ts +6 -16
  15. package/dist/components/Checkbox/index.story.d.ts.map +1 -1
  16. package/dist/components/Clickable/index.story.d.ts +4 -6
  17. package/dist/components/Clickable/index.story.d.ts.map +1 -1
  18. package/dist/components/DropdownSelector/ListItem/index.story.d.ts +7 -7
  19. package/dist/components/DropdownSelector/ListItem/index.story.d.ts.map +1 -1
  20. package/dist/components/DropdownSelector/MenuList/index.story.d.ts +6 -9
  21. package/dist/components/DropdownSelector/MenuList/index.story.d.ts.map +1 -1
  22. package/dist/components/DropdownSelector/Popover/index.story.d.ts +3 -7
  23. package/dist/components/DropdownSelector/Popover/index.story.d.ts.map +1 -1
  24. package/dist/components/DropdownSelector/index.d.ts.map +1 -1
  25. package/dist/components/DropdownSelector/index.story.d.ts +9 -11
  26. package/dist/components/DropdownSelector/index.story.d.ts.map +1 -1
  27. package/dist/components/Icon/index.story.d.ts +4 -26
  28. package/dist/components/Icon/index.story.d.ts.map +1 -1
  29. package/dist/components/IconButton/index.d.ts +1 -0
  30. package/dist/components/IconButton/index.d.ts.map +1 -1
  31. package/dist/components/IconButton/index.story.d.ts +6 -25
  32. package/dist/components/IconButton/index.story.d.ts.map +1 -1
  33. package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts +8 -0
  34. package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts.map +1 -0
  35. package/dist/components/LoadingSpinner/index.d.ts +2 -2
  36. package/dist/components/LoadingSpinner/index.d.ts.map +1 -1
  37. package/dist/components/LoadingSpinner/index.story.d.ts +4 -7
  38. package/dist/components/LoadingSpinner/index.story.d.ts.map +1 -1
  39. package/dist/components/Modal/index.story.d.ts +16 -41
  40. package/dist/components/Modal/index.story.d.ts.map +1 -1
  41. package/dist/components/MultiSelect/index.d.ts.map +1 -1
  42. package/dist/components/Radio/index.d.ts +0 -2
  43. package/dist/components/Radio/index.d.ts.map +1 -1
  44. package/dist/components/Radio/index.story.d.ts +12 -23
  45. package/dist/components/Radio/index.story.d.ts.map +1 -1
  46. package/dist/components/SegmentedControl/RadioGroupContext.d.ts +1 -1
  47. package/dist/components/SegmentedControl/RadioGroupContext.d.ts.map +1 -1
  48. package/dist/components/SegmentedControl/index.story.d.ts +5 -8
  49. package/dist/components/SegmentedControl/index.story.d.ts.map +1 -1
  50. package/dist/components/Switch/index.d.ts.map +1 -1
  51. package/dist/components/Switch/index.story.d.ts +7 -12
  52. package/dist/components/Switch/index.story.d.ts.map +1 -1
  53. package/dist/components/TagItem/index.d.ts.map +1 -1
  54. package/dist/components/TagItem/index.story.d.ts +14 -24
  55. package/dist/components/TagItem/index.story.d.ts.map +1 -1
  56. package/dist/components/TextArea/TextArea.story.d.ts +7 -25
  57. package/dist/components/TextArea/TextArea.story.d.ts.map +1 -1
  58. package/dist/components/TextField/TextField.story.d.ts +13 -20
  59. package/dist/components/TextField/TextField.story.d.ts.map +1 -1
  60. package/dist/components/TextField/index.d.ts.map +1 -1
  61. package/dist/index.cjs.js +418 -206
  62. package/dist/index.cjs.js.map +1 -1
  63. package/dist/index.esm.js +387 -175
  64. package/dist/index.esm.js.map +1 -1
  65. package/dist/styled.d.ts +4 -4
  66. package/package.json +17 -20
  67. package/src/_lib/compat.ts +8 -0
  68. package/src/components/Button/StyledButton.tsx +71 -0
  69. package/src/components/Button/__snapshots__/index.story.storyshot +314 -118
  70. package/src/components/Button/index.story.tsx +141 -138
  71. package/src/components/Button/index.tsx +15 -104
  72. package/src/components/Button/lib/variantToBackground.tsx +19 -0
  73. package/src/components/Button/lib/variantToFont.tsx +19 -0
  74. package/src/components/Checkbox/__snapshots__/index.story.storyshot +12 -27
  75. package/src/components/Checkbox/index.story.tsx +82 -88
  76. package/src/components/Checkbox/index.tsx +2 -12
  77. package/src/components/Clickable/__snapshots__/index.story.storyshot +2 -2
  78. package/src/components/Clickable/index.story.tsx +12 -9
  79. package/src/components/DropdownSelector/DropdownMenuItem.tsx +1 -14
  80. package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +42 -37
  81. package/src/components/DropdownSelector/ListItem/index.story.tsx +8 -4
  82. package/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot +38 -38
  83. package/src/components/DropdownSelector/MenuList/index.story.tsx +33 -27
  84. package/src/components/DropdownSelector/Popover/__snapshots__/index.story.storyshot +11 -5
  85. package/src/components/DropdownSelector/Popover/index.story.tsx +6 -6
  86. package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +313 -151
  87. package/src/components/DropdownSelector/index.story.tsx +207 -171
  88. package/src/components/DropdownSelector/index.tsx +22 -22
  89. package/src/components/Icon/__snapshots__/index.story.storyshot +1 -1
  90. package/src/components/Icon/index.story.tsx +8 -12
  91. package/src/components/IconButton/__snapshots__/index.story.storyshot +130 -13
  92. package/src/components/IconButton/index.story.tsx +30 -23
  93. package/src/components/IconButton/index.tsx +32 -20
  94. package/src/components/LoadingSpinner/LoadingSpinnerIcon.story.tsx +12 -0
  95. package/src/components/LoadingSpinner/__snapshots__/LoadingSpinnerIcon.story.storyshot +28 -0
  96. package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +1 -35
  97. package/src/components/LoadingSpinner/index.story.tsx +11 -54
  98. package/src/components/LoadingSpinner/index.tsx +1 -1
  99. package/src/components/Modal/__snapshots__/index.story.storyshot +231 -194
  100. package/src/components/Modal/index.story.tsx +139 -133
  101. package/src/components/MultiSelect/__snapshots__/index.story.storyshot +56 -4
  102. package/src/components/MultiSelect/index.tsx +3 -0
  103. package/src/components/Radio/__snapshots__/index.story.storyshot +981 -121
  104. package/src/components/Radio/index.story.tsx +128 -63
  105. package/src/components/Radio/index.tsx +10 -16
  106. package/src/components/SegmentedControl/RadioGroupContext.tsx +1 -1
  107. package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +11 -11
  108. package/src/components/SegmentedControl/index.story.tsx +24 -29
  109. package/src/components/SegmentedControl/index.tsx +1 -1
  110. package/src/components/Switch/__snapshots__/index.story.storyshot +184 -26
  111. package/src/components/Switch/index.story.tsx +72 -48
  112. package/src/components/Switch/index.tsx +2 -7
  113. package/src/components/TagItem/__snapshots__/index.story.storyshot +72 -33
  114. package/src/components/TagItem/index.story.tsx +154 -159
  115. package/src/components/TagItem/index.tsx +2 -6
  116. package/src/components/TextArea/TextArea.story.tsx +29 -32
  117. package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +139 -83
  118. package/src/components/TextField/TextField.story.tsx +67 -66
  119. package/src/components/TextField/__snapshots__/TextField.story.storyshot +198 -162
  120. package/src/components/TextField/index.tsx +0 -7
  121. package/dist/components/Checkbox/performance.test.d.ts +0 -4
  122. package/dist/components/Checkbox/performance.test.d.ts.map +0 -1
  123. package/dist/components/Checkbox/snapshot.test.d.ts +0 -2
  124. package/dist/components/Checkbox/snapshot.test.d.ts.map +0 -1
  125. package/src/components/Checkbox/__snapshots__/snapshot.test.tsx.snap +0 -1093
  126. package/src/components/Checkbox/performance.test.tsx +0 -30
  127. package/src/components/Checkbox/snapshot.test.tsx +0 -66
@@ -1,7 +1,7 @@
1
1
  import { action } from '@storybook/addon-actions'
2
2
  import styled from 'styled-components'
3
- import TagItem, { TagItemProps } from '.'
4
- import { Story } from '../../_lib/compat'
3
+ import TagItem from '.'
4
+ import { Meta, StoryObj } from '@storybook/react'
5
5
 
6
6
  export default {
7
7
  title: 'TagItem',
@@ -13,160 +13,161 @@ export default {
13
13
  },
14
14
  },
15
15
  },
16
- }
16
+ render: function Render(args) {
17
+ return <TagItem {...args} />
18
+ },
19
+ } as Meta<typeof TagItem>
17
20
 
18
- export const Default: Story<TagItemProps> = (props) => {
19
- return <TagItem {...props} onClick={action('click')} />
20
- }
21
- Default.args = {
22
- label: '#女の子',
23
- bgColor: '#7ACCB1',
24
- href: '',
25
- rel: '',
26
- target: '',
27
- className: '',
21
+ export const Default: StoryObj<typeof TagItem> = {
22
+ args: {
23
+ label: '#女の子',
24
+ bgColor: '#7ACCB1',
25
+ },
28
26
  }
29
27
 
30
- export const Playground: Story<TagItemProps> = ({
31
- bgColor,
32
- label,
33
- translatedLabel,
34
- }) => {
35
- return (
36
- <div>
37
- <Container>
38
- <div>
39
- <TagItem
40
- label={label}
41
- size="M"
42
- status="default"
43
- bgColor={bgColor}
44
- onClick={action('click')}
45
- />
46
- </div>
47
- <div />
48
- <div>
49
- <TagItem
50
- label={label}
51
- translatedLabel={translatedLabel}
52
- size="M"
53
- status="default"
54
- bgColor={bgColor}
55
- onClick={action('click')}
56
- />
57
- </div>
58
- <div />
59
- </Container>
60
- <Container>
61
- <div>
62
- <TagItem
63
- label={label}
64
- size="M"
65
- status="active"
66
- bgColor={bgColor}
67
- onClick={action('click')}
68
- />
69
- </div>
70
- <div />
71
- <div>
72
- <TagItem
73
- label={label}
74
- translatedLabel={translatedLabel}
75
- size="M"
76
- status="active"
77
- bgColor={bgColor}
78
- onClick={action('click')}
79
- />
80
- </div>
81
- <div />
82
- </Container>
83
- <Container>
84
- <div>
85
- <TagItem
86
- label={label}
87
- size="M"
88
- status="inactive"
89
- bgColor={bgColor}
90
- onClick={action('click')}
91
- />
92
- </div>
93
- <div>
94
- <TagItem
95
- label={label}
96
- size="M"
97
- status="inactive"
98
- disabled
99
- bgColor={bgColor}
100
- onClick={action('click')}
101
- />
102
- </div>
103
- <div>
104
- <TagItem
105
- label={label}
106
- translatedLabel={translatedLabel}
107
- size="M"
108
- status="inactive"
109
- bgColor={bgColor}
110
- onClick={action('click')}
111
- />
112
- </div>
113
- <div>
114
- <TagItem
115
- label={label}
116
- translatedLabel={translatedLabel}
117
- size="M"
118
- status="inactive"
119
- disabled
120
- bgColor={bgColor}
121
- onClick={action('click')}
122
- />
123
- </div>
124
- </Container>
125
- <Container>
126
- <div>
127
- <TagItem
128
- label={label}
129
- size="S"
130
- status="default"
131
- bgColor={bgColor}
132
- onClick={action('click')}
133
- />
134
- </div>
135
- </Container>
136
- <Container>
137
- <div>
138
- <TagItem
139
- label={label}
140
- size="S"
141
- status="active"
142
- bgColor={bgColor}
143
- onClick={action('click')}
144
- />
145
- </div>
146
- </Container>
147
- <Container>
148
- <div>
149
- <TagItem
150
- label={label}
151
- size="S"
152
- status="inactive"
153
- bgColor={bgColor}
154
- onClick={action('click')}
155
- />
156
- </div>
157
- <div>
158
- <TagItem
159
- label={label}
160
- size="S"
161
- status="inactive"
162
- disabled
163
- bgColor={bgColor}
164
- onClick={action('click')}
165
- />
166
- </div>
167
- </Container>
168
- </div>
169
- )
28
+ export const Playground: StoryObj<typeof TagItem> = {
29
+ render: function Render({ bgColor, label, translatedLabel }) {
30
+ return (
31
+ <div>
32
+ <Container>
33
+ <div>
34
+ <TagItem
35
+ label={label}
36
+ size="M"
37
+ status="default"
38
+ bgColor={bgColor}
39
+ onClick={action('click')}
40
+ />
41
+ </div>
42
+ <div />
43
+ <div>
44
+ <TagItem
45
+ label={label}
46
+ translatedLabel={translatedLabel}
47
+ size="M"
48
+ status="default"
49
+ bgColor={bgColor}
50
+ onClick={action('click')}
51
+ />
52
+ </div>
53
+ <div />
54
+ </Container>
55
+ <Container>
56
+ <div>
57
+ <TagItem
58
+ label={label}
59
+ size="M"
60
+ status="active"
61
+ bgColor={bgColor}
62
+ onClick={action('click')}
63
+ />
64
+ </div>
65
+ <div />
66
+ <div>
67
+ <TagItem
68
+ label={label}
69
+ translatedLabel={translatedLabel}
70
+ size="M"
71
+ status="active"
72
+ bgColor={bgColor}
73
+ onClick={action('click')}
74
+ />
75
+ </div>
76
+ <div />
77
+ </Container>
78
+ <Container>
79
+ <div>
80
+ <TagItem
81
+ label={label}
82
+ size="M"
83
+ status="inactive"
84
+ bgColor={bgColor}
85
+ onClick={action('click')}
86
+ />
87
+ </div>
88
+ <div>
89
+ <TagItem
90
+ label={label}
91
+ size="M"
92
+ status="inactive"
93
+ disabled
94
+ bgColor={bgColor}
95
+ onClick={action('click')}
96
+ />
97
+ </div>
98
+ <div>
99
+ <TagItem
100
+ label={label}
101
+ translatedLabel={translatedLabel}
102
+ size="M"
103
+ status="inactive"
104
+ bgColor={bgColor}
105
+ onClick={action('click')}
106
+ />
107
+ </div>
108
+ <div>
109
+ <TagItem
110
+ label={label}
111
+ translatedLabel={translatedLabel}
112
+ size="M"
113
+ status="inactive"
114
+ disabled
115
+ bgColor={bgColor}
116
+ onClick={action('click')}
117
+ />
118
+ </div>
119
+ </Container>
120
+ <Container>
121
+ <div>
122
+ <TagItem
123
+ label={label}
124
+ size="S"
125
+ status="default"
126
+ bgColor={bgColor}
127
+ onClick={action('click')}
128
+ />
129
+ </div>
130
+ </Container>
131
+ <Container>
132
+ <div>
133
+ <TagItem
134
+ label={label}
135
+ size="S"
136
+ status="active"
137
+ bgColor={bgColor}
138
+ onClick={action('click')}
139
+ />
140
+ </div>
141
+ </Container>
142
+ <Container>
143
+ <div>
144
+ <TagItem
145
+ label={label}
146
+ size="S"
147
+ status="inactive"
148
+ bgColor={bgColor}
149
+ onClick={action('click')}
150
+ />
151
+ </div>
152
+ <div>
153
+ <TagItem
154
+ label={label}
155
+ size="S"
156
+ status="inactive"
157
+ disabled
158
+ bgColor={bgColor}
159
+ onClick={action('click')}
160
+ />
161
+ </div>
162
+ </Container>
163
+ </div>
164
+ )
165
+ },
166
+ args: {
167
+ label: '#女の子',
168
+ translatedLabel: 'girl',
169
+ bgColor: '#7ACCB1',
170
+ },
170
171
  }
171
172
 
172
173
  const Container = styled.div`
@@ -180,9 +181,3 @@ const Container = styled.div`
180
181
  padding: 1em;
181
182
  }
182
183
  `
183
-
184
- Playground.args = {
185
- label: '#女の子',
186
- translatedLabel: 'girl',
187
- bgColor: '#7ACCB1',
188
- }
@@ -4,6 +4,7 @@ import styled, { css } from 'styled-components'
4
4
  import { px } from '@charcoal-ui/utils'
5
5
  import { AriaButtonProps, useButton } from '@react-aria/button'
6
6
  import Icon from '../Icon'
7
+ import { focusVisibleFocusRingCss } from '@charcoal-ui/styled'
7
8
 
8
9
  const sizeMap = {
9
10
  S: 32,
@@ -119,12 +120,7 @@ const TagItemRoot = styled.a<TagItemRootProps>`
119
120
 
120
121
  &:not(:disabled):not([aria-disabled]),
121
122
  &[aria-disabled='false'] {
122
- &:focus,
123
- &:active,
124
- &:focus-visible {
125
- outline: none;
126
- box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
127
- }
123
+ ${focusVisibleFocusRingCss}
128
124
  }
129
125
 
130
126
  &:disabled,
@@ -1,9 +1,9 @@
1
1
  import { action } from '@storybook/addon-actions'
2
2
  import styled from 'styled-components'
3
- import { Story } from '../../_lib/compat'
4
3
  import Clickable from '../Clickable'
5
- import TextArea, { TextAreaProps } from '.'
4
+ import TextArea from '.'
6
5
  import { px } from '@charcoal-ui/utils'
6
+ import { Meta, StoryObj } from '@storybook/react'
7
7
 
8
8
  export default {
9
9
  title: 'TextArea',
@@ -12,50 +12,47 @@ export default {
12
12
  args: {
13
13
  showLabel: false,
14
14
  label: 'Label',
15
+ requiredText: '*必須',
15
16
  assistiveText: '',
16
17
  disabled: false,
17
18
  required: false,
18
19
  invalid: false,
20
+ subLabel: <Clickable onClick={action('label-click')}>Text Link</Clickable>,
21
+ placeholder: 'Text Area',
19
22
  },
20
- }
23
+ render: function Render(args) {
24
+ return (
25
+ <Container>
26
+ <TextArea {...args} />
27
+ </Container>
28
+ )
29
+ },
30
+ } as Meta<typeof TextArea>
21
31
 
22
32
  const Container = styled.div`
23
33
  display: grid;
24
34
  gap: ${({ theme }) => px(theme.spacing[24])};
25
35
  `
26
36
 
27
- const Template: Story<Partial<TextAreaProps>> = (args) => (
28
- <Container>
29
- <TextArea
30
- label="Label"
31
- requiredText="*必須"
32
- subLabel={
33
- <Clickable onClick={action('label-click')}>Text Link</Clickable>
34
- }
35
- placeholder="Text Area"
36
- {...args}
37
- />
38
- </Container>
39
- )
40
-
41
- export const Default = Template.bind({})
37
+ export const Default: StoryObj<typeof TextArea> = {}
42
38
 
43
- export const HasLabel = Template.bind({})
44
- HasLabel.args = {
45
- showLabel: true,
46
- assistiveText: 'Assistive text',
47
- required: true,
39
+ export const HasLabel: StoryObj<typeof TextArea> = {
40
+ args: {
41
+ showLabel: true,
42
+ assistiveText: 'Assistive text',
43
+ required: true,
44
+ },
48
45
  }
49
46
 
50
- export const HasCount = Template.bind({})
51
- HasCount.args = {
52
- showCount: true,
53
- maxLength: 100,
47
+ export const HasCount: StoryObj<typeof TextArea> = {
48
+ args: {
49
+ showCount: true,
50
+ maxLength: 100,
51
+ },
54
52
  }
55
53
 
56
- export const AutoHeight: Story<Partial<TextAreaProps>> = (args) => (
57
- <TextArea label="Label" placeholder="TextArea" {...args} />
58
- )
59
- AutoHeight.args = {
60
- autoHeight: true,
54
+ export const AutoHeight: StoryObj<typeof TextArea> = {
55
+ args: {
56
+ autoHeight: true,
57
+ },
61
58
  }