@charcoal-ui/react 4.0.0-beta.4 → 4.0.0-beta.6

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 (141) hide show
  1. package/README.md +1 -1
  2. package/dist/_lib/useClassNames.d.ts +2 -2
  3. package/dist/_lib/useClassNames.d.ts.map +1 -1
  4. package/dist/components/Checkbox/CheckboxInput/index.d.ts +11 -0
  5. package/dist/components/Checkbox/CheckboxInput/index.d.ts.map +1 -0
  6. package/dist/components/Checkbox/CheckboxWithLabel.d.ts +9 -0
  7. package/dist/components/Checkbox/CheckboxWithLabel.d.ts.map +1 -0
  8. package/dist/components/Checkbox/index.d.ts +9 -7
  9. package/dist/components/Checkbox/index.d.ts.map +1 -1
  10. package/dist/components/Clickable/index.d.ts +10 -13
  11. package/dist/components/Clickable/index.d.ts.map +1 -1
  12. package/dist/components/DropdownSelector/index.d.ts.map +1 -1
  13. package/dist/components/FieldLabel/index.d.ts +1 -0
  14. package/dist/components/FieldLabel/index.d.ts.map +1 -1
  15. package/dist/components/IconButton/index.d.ts +7 -5
  16. package/dist/components/IconButton/index.d.ts.map +1 -1
  17. package/dist/components/LoadingSpinner/index.d.ts +1 -0
  18. package/dist/components/LoadingSpinner/index.d.ts.map +1 -1
  19. package/dist/components/Modal/Dialog/index.d.ts +6 -24
  20. package/dist/components/Modal/Dialog/index.d.ts.map +1 -1
  21. package/dist/components/Modal/ModalPlumbing.d.ts +10 -3
  22. package/dist/components/Modal/ModalPlumbing.d.ts.map +1 -1
  23. package/dist/components/Modal/index.d.ts +5 -1
  24. package/dist/components/Modal/index.d.ts.map +1 -1
  25. package/dist/components/Radio/index.d.ts +3 -5
  26. package/dist/components/Radio/index.d.ts.map +1 -1
  27. package/dist/components/SegmentedControl/index.d.ts +1 -0
  28. package/dist/components/SegmentedControl/index.d.ts.map +1 -1
  29. package/dist/components/Switch/SwitchInput/index.d.ts +9 -0
  30. package/dist/components/Switch/SwitchInput/index.d.ts.map +1 -0
  31. package/dist/components/Switch/SwitchWithLabel.d.ts +9 -0
  32. package/dist/components/Switch/SwitchWithLabel.d.ts.map +1 -0
  33. package/dist/components/Switch/index.d.ts +4 -15
  34. package/dist/components/Switch/index.d.ts.map +1 -1
  35. package/dist/components/TagItem/index.d.ts +14 -15
  36. package/dist/components/TagItem/index.d.ts.map +1 -1
  37. package/dist/components/TextArea/index.d.ts +28 -18
  38. package/dist/components/TextArea/index.d.ts.map +1 -1
  39. package/dist/components/TextField/index.d.ts +32 -19
  40. package/dist/components/TextField/index.d.ts.map +1 -1
  41. package/dist/core/SSRProvider.d.ts +3 -1
  42. package/dist/core/SSRProvider.d.ts.map +1 -1
  43. package/dist/index.cjs.js +471 -845
  44. package/dist/index.cjs.js.map +1 -1
  45. package/dist/index.css +732 -28
  46. package/dist/index.css.map +1 -1
  47. package/dist/index.d.ts +2 -3
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.esm.js +427 -800
  50. package/dist/index.esm.js.map +1 -1
  51. package/dist/styled.d.ts +4 -4
  52. package/package.json +11 -10
  53. package/src/_lib/useClassNames.ts +3 -9
  54. package/src/components/Button/__snapshots__/index.story.storyshot +9 -9
  55. package/src/components/Button/index.story.tsx +1 -1
  56. package/src/components/Checkbox/CheckboxInput/__snapshots__/index.story.storyshot +77 -0
  57. package/src/components/Checkbox/CheckboxInput/index.css +111 -0
  58. package/src/components/{CheckboxInput → Checkbox/CheckboxInput}/index.story.tsx +17 -1
  59. package/src/components/Checkbox/CheckboxInput/index.tsx +47 -0
  60. package/src/components/Checkbox/CheckboxWithLabel.tsx +24 -0
  61. package/src/components/Checkbox/__snapshots__/index.story.storyshot +59 -140
  62. package/src/components/Checkbox/index.css +2 -2
  63. package/src/components/Checkbox/index.story.tsx +18 -13
  64. package/src/components/Checkbox/index.tsx +23 -15
  65. package/src/components/Clickable/__snapshots__/index.story.storyshot +4 -80
  66. package/src/components/Clickable/index.css +41 -0
  67. package/src/components/Clickable/index.story.tsx +2 -2
  68. package/src/components/Clickable/index.tsx +25 -85
  69. package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +11 -136
  70. package/src/components/DropdownSelector/ListItem/index.story.tsx +1 -1
  71. package/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot +3 -3
  72. package/src/components/DropdownSelector/MenuList/index.story.tsx +1 -1
  73. package/src/components/DropdownSelector/Popover/__snapshots__/index.story.storyshot +1 -1
  74. package/src/components/DropdownSelector/Popover/index.story.tsx +1 -1
  75. package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +184 -1435
  76. package/src/components/DropdownSelector/index.story.tsx +2 -2
  77. package/src/components/DropdownSelector/index.tsx +9 -38
  78. package/src/components/FieldLabel/index.css +35 -0
  79. package/src/components/FieldLabel/index.tsx +15 -105
  80. package/src/components/Icon/__snapshots__/index.story.storyshot +1 -1
  81. package/src/components/Icon/index.story.tsx +1 -1
  82. package/src/components/IconButton/__snapshots__/index.story.storyshot +15 -291
  83. package/src/components/IconButton/index.css +118 -0
  84. package/src/components/IconButton/index.story.tsx +3 -3
  85. package/src/components/IconButton/index.tsx +41 -118
  86. package/src/components/LoadingSpinner/__snapshots__/LoadingSpinnerIcon.story.storyshot +2 -17
  87. package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +44 -132
  88. package/src/components/LoadingSpinner/index.css +42 -0
  89. package/src/components/LoadingSpinner/index.story.tsx +1 -1
  90. package/src/components/LoadingSpinner/index.tsx +26 -52
  91. package/src/components/Modal/Dialog/index.css +44 -0
  92. package/src/components/Modal/Dialog/index.tsx +13 -57
  93. package/src/components/Modal/ModalPlumbing.css +40 -0
  94. package/src/components/Modal/ModalPlumbing.tsx +22 -61
  95. package/src/components/Modal/__snapshots__/index.story.storyshot +479 -1893
  96. package/src/components/Modal/index.css +36 -0
  97. package/src/components/Modal/index.story.tsx +2 -2
  98. package/src/components/Modal/index.tsx +37 -72
  99. package/src/components/Radio/__snapshots__/index.story.storyshot +55 -780
  100. package/src/components/Radio/index.css +97 -0
  101. package/src/components/Radio/index.story.tsx +2 -11
  102. package/src/components/Radio/index.test.tsx +0 -1
  103. package/src/components/Radio/index.tsx +50 -161
  104. package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +32 -262
  105. package/src/components/SegmentedControl/index.css +50 -0
  106. package/src/components/SegmentedControl/index.story.tsx +1 -1
  107. package/src/components/SegmentedControl/index.tsx +20 -89
  108. package/src/components/Switch/SwitchInput/index.css +82 -0
  109. package/src/components/Switch/SwitchInput/index.tsx +40 -0
  110. package/src/components/Switch/SwitchWithLabel.tsx +24 -0
  111. package/src/components/Switch/__snapshots__/index.story.storyshot +33 -536
  112. package/src/components/Switch/index.css +23 -0
  113. package/src/components/Switch/index.story.tsx +6 -1
  114. package/src/components/Switch/index.tsx +43 -140
  115. package/src/components/TagItem/__snapshots__/index.story.storyshot +161 -1138
  116. package/src/components/TagItem/index.css +140 -0
  117. package/src/components/TagItem/index.story.tsx +2 -2
  118. package/src/components/TagItem/index.tsx +76 -220
  119. package/src/components/TextArea/TextArea.story.tsx +1 -1
  120. package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +214 -1368
  121. package/src/components/TextArea/index.tsx +68 -91
  122. package/src/components/TextField/TextField.story.tsx +1 -1
  123. package/src/components/TextField/__snapshots__/TextField.story.storyshot +287 -1627
  124. package/src/components/TextField/index.tsx +77 -105
  125. package/src/core/SSRProvider.tsx +12 -1
  126. package/src/index.ts +5 -8
  127. package/src/type.d.ts +6 -0
  128. package/dist/components/CheckboxInput/index.d.ts +0 -9
  129. package/dist/components/CheckboxInput/index.d.ts.map +0 -1
  130. package/dist/components/MultiSelect/context.d.ts +0 -14
  131. package/dist/components/MultiSelect/context.d.ts.map +0 -1
  132. package/dist/components/MultiSelect/index.d.ts +0 -36
  133. package/dist/components/MultiSelect/index.d.ts.map +0 -1
  134. package/src/components/CheckboxInput/__snapshots__/index.story.storyshot +0 -109
  135. package/src/components/CheckboxInput/index.css +0 -77
  136. package/src/components/CheckboxInput/index.tsx +0 -53
  137. package/src/components/MultiSelect/__snapshots__/index.story.storyshot +0 -1054
  138. package/src/components/MultiSelect/context.ts +0 -23
  139. package/src/components/MultiSelect/index.story.tsx +0 -112
  140. package/src/components/MultiSelect/index.test.tsx +0 -263
  141. package/src/components/MultiSelect/index.tsx +0 -282
@@ -1,6 +1,6 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`Storybook Tests Checkbox Checked 1`] = `
3
+ exports[`Storybook Tests react/Checkbox Checked 1`] = `
4
4
  <div
5
5
  data-dark={false}
6
6
  >
@@ -8,66 +8,36 @@ exports[`Storybook Tests Checkbox Checked 1`] = `
8
8
  className="charcoal-checkbox__label"
9
9
  htmlFor="test-id"
10
10
  >
11
+ <input
12
+ checked={true}
13
+ className="charcoal-checkbox-input"
14
+ id="test-id"
15
+ onChange={[Function]}
16
+ type="checkbox"
17
+ />
11
18
  <div
12
- className="charcoal-checkbox-input__root"
13
- >
14
- <input
15
- checked={true}
16
- className="charcoal-checkbox-input__input"
17
- id="test-id"
18
- onChange={[Function]}
19
- type="checkbox"
20
- />
21
- <div
22
- aria-hidden={true}
23
- className="charcoal-checkbox-input__overlay"
24
- data-checked={true}
25
- >
26
- <pixiv-icon
27
- name="24/Check"
28
- unsafe-non-guideline-scale={0.6666666666666666}
29
- />
30
- </div>
31
- </div>
32
- <div
33
- className="charcoal-checkbox__text"
19
+ className="charcoal-checkbox__label_div"
34
20
  >
35
- Accelerate creativity.
21
+ Checked
36
22
  </div>
37
23
  </label>
38
24
  </div>
39
25
  `;
40
26
 
41
- exports[`Storybook Tests Checkbox Default 1`] = `
27
+ exports[`Storybook Tests react/Checkbox Default 1`] = `
42
28
  <div
43
29
  data-dark={false}
44
30
  >
45
- <div
46
- className="charcoal-checkbox-input__root"
47
- >
48
- <input
49
- className="charcoal-checkbox-input__input"
50
- id="test-id"
51
- onBlur={[Function]}
52
- onChange={[Function]}
53
- onClick={[Function]}
54
- onFocus={[Function]}
55
- type="checkbox"
56
- />
57
- <div
58
- aria-hidden={true}
59
- className="charcoal-checkbox-input__overlay"
60
- >
61
- <pixiv-icon
62
- name="24/Check"
63
- unsafe-non-guideline-scale={0.6666666666666666}
64
- />
65
- </div>
66
- </div>
31
+ <input
32
+ className="charcoal-checkbox-input"
33
+ id="test-id"
34
+ onChange={[Function]}
35
+ type="checkbox"
36
+ />
67
37
  </div>
68
38
  `;
69
39
 
70
- exports[`Storybook Tests Checkbox Disabled 1`] = `
40
+ exports[`Storybook Tests react/Checkbox Disabled 1`] = `
71
41
  <div
72
42
  data-dark={false}
73
43
  >
@@ -76,36 +46,23 @@ exports[`Storybook Tests Checkbox Disabled 1`] = `
76
46
  className="charcoal-checkbox__label"
77
47
  htmlFor="test-id"
78
48
  >
49
+ <input
50
+ className="charcoal-checkbox-input"
51
+ disabled={true}
52
+ id="test-id"
53
+ onChange={[Function]}
54
+ type="checkbox"
55
+ />
79
56
  <div
80
- className="charcoal-checkbox-input__root"
81
- >
82
- <input
83
- className="charcoal-checkbox-input__input"
84
- disabled={true}
85
- id="test-id"
86
- onChange={[Function]}
87
- type="checkbox"
88
- />
89
- <div
90
- aria-hidden={true}
91
- className="charcoal-checkbox-input__overlay"
92
- >
93
- <pixiv-icon
94
- name="24/Check"
95
- unsafe-non-guideline-scale={0.6666666666666666}
96
- />
97
- </div>
98
- </div>
99
- <div
100
- className="charcoal-checkbox__text"
57
+ className="charcoal-checkbox__label_div"
101
58
  >
102
- Accelerate creativity.
59
+ Disabled
103
60
  </div>
104
61
  </label>
105
62
  </div>
106
63
  `;
107
64
 
108
- exports[`Storybook Tests Checkbox Invalid 1`] = `
65
+ exports[`Storybook Tests react/Checkbox Invalid 1`] = `
109
66
  <div
110
67
  data-dark={false}
111
68
  >
@@ -113,37 +70,24 @@ exports[`Storybook Tests Checkbox Invalid 1`] = `
113
70
  className="charcoal-checkbox__label"
114
71
  htmlFor="test-id"
115
72
  >
73
+ <input
74
+ aria-invalid={true}
75
+ className="charcoal-checkbox-input"
76
+ id="test-id"
77
+ name="labelled"
78
+ onChange={[Function]}
79
+ type="checkbox"
80
+ />
116
81
  <div
117
- className="charcoal-checkbox-input__root"
118
- >
119
- <input
120
- aria-invalid={true}
121
- className="charcoal-checkbox-input__input"
122
- id="test-id"
123
- name="labelled"
124
- onChange={[Function]}
125
- type="checkbox"
126
- />
127
- <div
128
- aria-hidden={true}
129
- className="charcoal-checkbox-input__overlay"
130
- >
131
- <pixiv-icon
132
- name="24/Check"
133
- unsafe-non-guideline-scale={0.6666666666666666}
134
- />
135
- </div>
136
- </div>
137
- <div
138
- className="charcoal-checkbox__text"
82
+ className="charcoal-checkbox__label_div"
139
83
  >
140
- Accelerate creativity.
84
+ Invalid
141
85
  </div>
142
86
  </label>
143
87
  </div>
144
88
  `;
145
89
 
146
- exports[`Storybook Tests Checkbox Label 1`] = `
90
+ exports[`Storybook Tests react/Checkbox Label 1`] = `
147
91
  <div
148
92
  data-dark={false}
149
93
  >
@@ -151,35 +95,22 @@ exports[`Storybook Tests Checkbox Label 1`] = `
151
95
  className="charcoal-checkbox__label"
152
96
  htmlFor="test-id"
153
97
  >
98
+ <input
99
+ className="charcoal-checkbox-input"
100
+ id="test-id"
101
+ onChange={[Function]}
102
+ type="checkbox"
103
+ />
154
104
  <div
155
- className="charcoal-checkbox-input__root"
156
- >
157
- <input
158
- className="charcoal-checkbox-input__input"
159
- id="test-id"
160
- onChange={[Function]}
161
- type="checkbox"
162
- />
163
- <div
164
- aria-hidden={true}
165
- className="charcoal-checkbox-input__overlay"
166
- >
167
- <pixiv-icon
168
- name="24/Check"
169
- unsafe-non-guideline-scale={0.6666666666666666}
170
- />
171
- </div>
172
- </div>
173
- <div
174
- className="charcoal-checkbox__text"
105
+ className="charcoal-checkbox__label_div"
175
106
  >
176
- Accelerate creativity.
107
+ Checkbox
177
108
  </div>
178
109
  </label>
179
110
  </div>
180
111
  `;
181
112
 
182
- exports[`Storybook Tests Checkbox ReadOnly 1`] = `
113
+ exports[`Storybook Tests react/Checkbox ReadOnly 1`] = `
183
114
  <div
184
115
  data-dark={false}
185
116
  >
@@ -187,31 +118,19 @@ exports[`Storybook Tests Checkbox ReadOnly 1`] = `
187
118
  className="charcoal-checkbox__label"
188
119
  htmlFor="test-id"
189
120
  >
121
+ <input
122
+ checked={true}
123
+ className="charcoal-checkbox-input"
124
+ id="test-id"
125
+ name="labelled"
126
+ onChange={[Function]}
127
+ readOnly={true}
128
+ type="checkbox"
129
+ />
190
130
  <div
191
- className="charcoal-checkbox-input__root"
192
- >
193
- <input
194
- className="charcoal-checkbox-input__input"
195
- id="test-id"
196
- name="labelled"
197
- onChange={[Function]}
198
- readOnly={true}
199
- type="checkbox"
200
- />
201
- <div
202
- aria-hidden={true}
203
- className="charcoal-checkbox-input__overlay"
204
- >
205
- <pixiv-icon
206
- name="24/Check"
207
- unsafe-non-guideline-scale={0.6666666666666666}
208
- />
209
- </div>
210
- </div>
211
- <div
212
- className="charcoal-checkbox__text"
131
+ className="charcoal-checkbox__label_div"
213
132
  >
214
- Accelerate creativity.
133
+ ReadOnly
215
134
  </div>
216
135
  </label>
217
136
  </div>
@@ -2,6 +2,7 @@
2
2
  position: relative;
3
3
  cursor: pointer;
4
4
  display: flex;
5
+ gap: 4px;
5
6
  }
6
7
 
7
8
  .charcoal-checkbox__label[aria-disabled='true'] {
@@ -13,9 +14,8 @@
13
14
  opacity: 1;
14
15
  }
15
16
 
16
- .charcoal-checkbox__text {
17
+ .charcoal-checkbox__label_div {
17
18
  color: var(--charcoal-text2);
18
19
  font-size: 14px;
19
20
  line-height: 20px;
20
- margin-left: 4px;
21
21
  }
@@ -1,29 +1,34 @@
1
1
  import Checkbox from '.'
2
2
  import { Meta, StoryObj } from '@storybook/react'
3
3
  import { useCallback, useState } from 'react'
4
- import { action } from '@storybook/addon-actions'
5
4
 
6
5
  export default {
7
- title: 'Checkbox',
6
+ title: 'react/Checkbox',
8
7
  component: Checkbox,
8
+ parameters: {
9
+ layout: 'centered',
10
+ },
9
11
  } as Meta<typeof Checkbox>
10
12
 
11
13
  export const Default: StoryObj<typeof Checkbox> = {
14
+ argTypes: {
15
+ checked: { type: 'boolean' },
16
+ children: { type: 'string' },
17
+ disabled: { type: 'boolean' },
18
+ invalid: { type: 'boolean' },
19
+ readOnly: { type: 'boolean' },
20
+ },
12
21
  render: function Render(props) {
13
22
  const [checked, setChecked] = useState(props.checked)
14
23
  const handleChange = useCallback((isSelected: boolean) => {
15
24
  setChecked(isSelected)
16
- action('change')(isSelected)
17
25
  }, [])
18
26
 
19
27
  return (
20
28
  <Checkbox
21
29
  {...props}
22
- checked={checked ?? props.checked}
23
- onBlur={action('blur')}
24
- onClick={action('click')}
30
+ checked={props.checked ?? checked}
25
31
  onChange={handleChange}
26
- onFocus={action('focus')}
27
32
  />
28
33
  )
29
34
  },
@@ -31,27 +36,27 @@ export const Default: StoryObj<typeof Checkbox> = {
31
36
 
32
37
  export const Label: StoryObj<typeof Checkbox> = {
33
38
  render: () => {
34
- return <Checkbox>Accelerate creativity.</Checkbox>
39
+ return <Checkbox>Checkbox</Checkbox>
35
40
  },
36
41
  }
37
42
 
38
43
  export const Checked: StoryObj<typeof Checkbox> = {
39
44
  render: () => {
40
- return <Checkbox checked>Accelerate creativity.</Checkbox>
45
+ return <Checkbox checked>Checked</Checkbox>
41
46
  },
42
47
  }
43
48
 
44
49
  export const Disabled: StoryObj<typeof Checkbox> = {
45
50
  render: () => {
46
- return <Checkbox disabled>Accelerate creativity.</Checkbox>
51
+ return <Checkbox disabled>Disabled</Checkbox>
47
52
  },
48
53
  }
49
54
 
50
55
  export const ReadOnly: StoryObj<typeof Checkbox> = {
51
56
  render: () => {
52
57
  return (
53
- <Checkbox name="labelled" readOnly>
54
- Accelerate creativity.
58
+ <Checkbox checked name="labelled" readOnly>
59
+ ReadOnly
55
60
  </Checkbox>
56
61
  )
57
62
  },
@@ -61,7 +66,7 @@ export const Invalid: StoryObj<typeof Checkbox> = {
61
66
  render: () => {
62
67
  return (
63
68
  <Checkbox name="labelled" invalid>
64
- Accelerate creativity.
69
+ Invalid
65
70
  </Checkbox>
66
71
  )
67
72
  },
@@ -1,29 +1,37 @@
1
1
  import './index.css'
2
2
 
3
- import React, { forwardRef, memo } from 'react'
3
+ import { forwardRef, memo } from 'react'
4
4
  import { useId } from '@react-aria/utils'
5
- import CheckboxInput, { CheckboxInputProps } from '../CheckboxInput'
6
- import { useClassNames } from '../../_lib/useClassNames'
5
+ import CheckboxInput, { CheckboxInputProps } from './CheckboxInput'
6
+ import { CheckboxWithLabel } from './CheckboxWithLabel'
7
7
 
8
- export type CheckboxProps = CheckboxInputProps & {
9
- children?: React.ReactNode
10
- }
8
+ export type CheckboxProps = CheckboxInputProps
11
9
 
12
- const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
13
- function CheckboxInner({ disabled, className, id, children, ...props }, ref) {
14
- const classNames = useClassNames('charcoal-checkbox__label', className)
10
+ const Checkbox = forwardRef<HTMLInputElement, CheckboxInputProps>(
11
+ function Checkbox({ disabled, className, id, children, ...props }, ref) {
15
12
  const htmlId = useId(id)
13
+ const noChildren = children === undefined
16
14
  const input = (
17
- <CheckboxInput {...props} id={htmlId} disabled={disabled} ref={ref} />
15
+ <CheckboxInput
16
+ {...props}
17
+ className={noChildren ? className : undefined}
18
+ disabled={disabled}
19
+ id={htmlId}
20
+ ref={ref}
21
+ />
18
22
  )
19
- if (children === undefined) {
23
+ if (noChildren) {
20
24
  return input
21
25
  }
22
26
  return (
23
- <label htmlFor={htmlId} aria-disabled={disabled} className={classNames}>
24
- {input}
25
- <div className="charcoal-checkbox__text">{children}</div>
26
- </label>
27
+ <CheckboxWithLabel
28
+ className={className}
29
+ disabled={disabled}
30
+ id={htmlId}
31
+ input={input}
32
+ >
33
+ {children}
34
+ </CheckboxWithLabel>
27
35
  )
28
36
  }
29
37
  )
@@ -1,49 +1,11 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`Storybook Tests Clickable Button 1`] = `
4
- .c0 {
5
- cursor: pointer;
6
- -webkit-appearance: none;
7
- -moz-appearance: none;
8
- appearance: none;
9
- background: transparent;
10
- padding: 0;
11
- border-style: none;
12
- outline: none;
13
- color: inherit;
14
- text-rendering: inherit;
15
- -webkit-letter-spacing: inherit;
16
- -moz-letter-spacing: inherit;
17
- -ms-letter-spacing: inherit;
18
- letter-spacing: inherit;
19
- word-spacing: inherit;
20
- -webkit-text-decoration: none;
21
- text-decoration: none;
22
- font: inherit;
23
- margin: 0;
24
- overflow: visible;
25
- text-transform: none;
26
- }
27
-
28
- .c0:disabled,
29
- .c0[aria-disabled]:not([aria-disabled=false]) {
30
- cursor: default;
31
- }
32
-
33
- .c0:focus {
34
- outline: none;
35
- }
36
-
37
- .c0::-moz-focus-inner {
38
- border-style: none;
39
- padding: 0;
40
- }
41
-
3
+ exports[`Storybook Tests react/Clickable Button 1`] = `
42
4
  <div
43
5
  data-dark={false}
44
6
  >
45
7
  <button
46
- className="c0"
8
+ className="charcoal-clickable"
47
9
  onClick={[Function]}
48
10
  >
49
11
  button
@@ -51,50 +13,12 @@ exports[`Storybook Tests Clickable Button 1`] = `
51
13
  </div>
52
14
  `;
53
15
 
54
- exports[`Storybook Tests Clickable Link 1`] = `
55
- .c0 {
56
- cursor: pointer;
57
- -webkit-appearance: none;
58
- -moz-appearance: none;
59
- appearance: none;
60
- background: transparent;
61
- padding: 0;
62
- border-style: none;
63
- outline: none;
64
- color: inherit;
65
- text-rendering: inherit;
66
- -webkit-letter-spacing: inherit;
67
- -moz-letter-spacing: inherit;
68
- -ms-letter-spacing: inherit;
69
- letter-spacing: inherit;
70
- word-spacing: inherit;
71
- -webkit-text-decoration: none;
72
- text-decoration: none;
73
- font: inherit;
74
- margin: 0;
75
- overflow: visible;
76
- text-transform: none;
77
- }
78
-
79
- .c0:disabled,
80
- .c0[aria-disabled]:not([aria-disabled=false]) {
81
- cursor: default;
82
- }
83
-
84
- .c0:focus {
85
- outline: none;
86
- }
87
-
88
- .c0::-moz-focus-inner {
89
- border-style: none;
90
- padding: 0;
91
- }
92
-
16
+ exports[`Storybook Tests react/Clickable Link 1`] = `
93
17
  <div
94
18
  data-dark={false}
95
19
  >
96
20
  <a
97
- className="c0"
21
+ className="charcoal-clickable"
98
22
  href="#"
99
23
  onClick={[Function]}
100
24
  >
@@ -0,0 +1,41 @@
1
+ .charcoal-clickable {
2
+ cursor: pointer;
3
+
4
+ /* Reset button appearance */
5
+ appearance: none;
6
+ background: transparent;
7
+ padding: 0;
8
+ border-style: none;
9
+ outline: none;
10
+ color: inherit;
11
+ text-rendering: inherit;
12
+ letter-spacing: inherit;
13
+ word-spacing: inherit;
14
+ text-decoration: none;
15
+
16
+ /* Change the font styles in all browsers. */
17
+ font: inherit;
18
+
19
+ /* Remove the margin in Firefox and Safari. */
20
+ margin: 0;
21
+
22
+ /* Show the overflow in Edge. */
23
+ overflow: visible;
24
+
25
+ /* Remove the inheritance of text transform in Firefox. */
26
+ text-transform: none;
27
+ }
28
+
29
+ .charcoal-clickable:disabled,
30
+ .charcoal-clickable[aria-disabled]:not([aria-disabled='false']) {
31
+ cursor: default;
32
+ }
33
+
34
+ .charcoal-clickable:focus {
35
+ outline: none;
36
+ }
37
+
38
+ .charcoal-clickable::-moz-focus-inner {
39
+ border-style: none;
40
+ padding: 0;
41
+ }
@@ -3,7 +3,7 @@ import Clickable from '.'
3
3
  import { Meta, StoryObj } from '@storybook/react'
4
4
 
5
5
  export default {
6
- title: 'Clickable',
6
+ title: 'react/Clickable',
7
7
  component: Clickable,
8
8
  } as Meta<typeof Clickable>
9
9
 
@@ -13,7 +13,7 @@ export const Button: StoryObj = {
13
13
 
14
14
  export const Link: StoryObj = {
15
15
  render: () => (
16
- <Clickable to="#" onClick={action('click')}>
16
+ <Clickable as="a" href="#" onClick={action('click')}>
17
17
  link
18
18
  </Clickable>
19
19
  ),