@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
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { light } from '@charcoal-ui/theme'
|
|
2
|
-
import 'jest-styled-components'
|
|
3
|
-
|
|
4
|
-
import React from 'react'
|
|
5
|
-
import renderer from 'react-test-renderer'
|
|
6
|
-
import { ThemeProvider } from 'styled-components'
|
|
7
|
-
import Checkbox from '.'
|
|
8
|
-
|
|
9
|
-
export function render(children: JSX.Element) {
|
|
10
|
-
return renderer
|
|
11
|
-
.create(<ThemeProvider theme={light}>{children}</ThemeProvider>)
|
|
12
|
-
.toJSON()
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const array = [...Array<undefined>(1000)].map((_, i) => i)
|
|
16
|
-
|
|
17
|
-
describe('Checkbox', () => {
|
|
18
|
-
test('<Checkbox />', () => {
|
|
19
|
-
function ManyCheckbox() {
|
|
20
|
-
return (
|
|
21
|
-
<>
|
|
22
|
-
{array.map((i) => (
|
|
23
|
-
<Checkbox key={i} label="test" />
|
|
24
|
-
))}
|
|
25
|
-
</>
|
|
26
|
-
)
|
|
27
|
-
}
|
|
28
|
-
render(<ManyCheckbox />)
|
|
29
|
-
})
|
|
30
|
-
})
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { dark, light } from '@charcoal-ui/theme'
|
|
2
|
-
import renderer from 'react-test-renderer'
|
|
3
|
-
import { ThemeProvider } from 'styled-components'
|
|
4
|
-
import { Story } from '../../_lib/compat'
|
|
5
|
-
import path from 'path'
|
|
6
|
-
import glob from 'glob'
|
|
7
|
-
|
|
8
|
-
import 'jest-styled-components'
|
|
9
|
-
|
|
10
|
-
function render(children: JSX.Element) {
|
|
11
|
-
return renderer.create(children).toJSON()
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const themes = Object.entries({
|
|
15
|
-
light,
|
|
16
|
-
dark,
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
-
interface StoryWithMetadata<ArgsType = any> {
|
|
21
|
-
filename: string
|
|
22
|
-
name: string
|
|
23
|
-
story: Story<ArgsType>
|
|
24
|
-
args: ArgsType
|
|
25
|
-
}
|
|
26
|
-
const stories: StoryWithMetadata[] = glob
|
|
27
|
-
.sync(path.resolve(__dirname, '*.story.tsx'))
|
|
28
|
-
.flatMap((filePath) => {
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
30
|
-
const exports = require(`./${path.relative(
|
|
31
|
-
__dirname,
|
|
32
|
-
filePath
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
|
-
)}`) as Record<string, any>
|
|
35
|
-
|
|
36
|
-
return Object.entries(exports)
|
|
37
|
-
.filter(
|
|
38
|
-
([exportName, exportValue]) =>
|
|
39
|
-
exportName !== 'default' && typeof exportValue === 'function'
|
|
40
|
-
)
|
|
41
|
-
.map(([exportName, exportValue]) => ({
|
|
42
|
-
filename: path.relative(__dirname, filePath),
|
|
43
|
-
name: exportName,
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
45
|
-
story: exportValue as Story<any>,
|
|
46
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
47
|
-
args: { ...exports.default.args, ...exportValue.args },
|
|
48
|
-
}))
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
describe.each(themes)('using %s theme', (_name, theme) => {
|
|
52
|
-
describe.each(stories)(
|
|
53
|
-
'storiesOf($filename).add($name)',
|
|
54
|
-
({ story: Story, args }) => {
|
|
55
|
-
it('snapshot', () => {
|
|
56
|
-
expect(
|
|
57
|
-
render(
|
|
58
|
-
<ThemeProvider theme={theme}>
|
|
59
|
-
<Story {...args} />
|
|
60
|
-
</ThemeProvider>
|
|
61
|
-
)
|
|
62
|
-
).toMatchSnapshot()
|
|
63
|
-
})
|
|
64
|
-
}
|
|
65
|
-
)
|
|
66
|
-
})
|