playbook_ui 13.28.0.pre.alpha.PLAY1338alpha3001 → 13.28.0.pre.alpha.PLAY1343fixTooltiprunwayissue2984
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +8 -14
- data/app/pb_kits/playbook/pb_collapsible/collapsible.test.js +0 -24
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +1 -1
- data/dist/playbook-rails.js +2 -2
- data/lib/playbook/version.rb +1 -1
- metadata +2 -3
- data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +0 -53
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7a4f103f5608db8ea9e25be909bbd042e40da83e7999805870268dd24447a47
|
4
|
+
data.tar.gz: ec863a877604c9113f98886ef6932ad97632b722b9b2b3797cc1e1791a11228e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f67c5d57ecf837628d8de841fdb279ca873e957fa7de4149c9d4fee2d5c4e73fa0877bc8e864fa31402ff02bfa46c2b6a68b50d3b8d425bd57b511230faba36
|
7
|
+
data.tar.gz: 89a64b35561cf140d06e663ff65bc3b7ee5e26062ca59549b063b2c9b29f29021a0b47491c1a99d01b5e2812cbbddc365fb1c1991de0d42efb5e9e2a561ad1b7
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { useEffect
|
1
|
+
import React, { useEffect } from 'react'
|
2
2
|
import classnames from 'classnames'
|
3
3
|
import useCollapsible from './useCollapsible'
|
4
4
|
|
@@ -11,16 +11,9 @@ import CollapsibleContext from './context'
|
|
11
11
|
import { IconSizes } from "../pb_icon/_icon"
|
12
12
|
import CollapsibleIcon from './child_kits/CollapsibleIcon'
|
13
13
|
|
14
|
-
type CollapsibleMainProps = {
|
15
|
-
children: React.ReactNode
|
16
|
-
}
|
17
|
-
|
18
|
-
type CollapsibleContentProps = {
|
19
|
-
children: React.ReactNode
|
20
|
-
}
|
21
14
|
|
22
15
|
type CollapsibleProps = {
|
23
|
-
children?:
|
16
|
+
children?: React.ReactElement | [] | any,
|
24
17
|
aria?: {[key: string]: string},
|
25
18
|
className?: string,
|
26
19
|
collapsed?: boolean,
|
@@ -37,7 +30,7 @@ type CollapsibleProps = {
|
|
37
30
|
const Collapsible = ({
|
38
31
|
aria = {},
|
39
32
|
className,
|
40
|
-
children,
|
33
|
+
children = [],
|
41
34
|
collapsed = true,
|
42
35
|
data = {},
|
43
36
|
htmlOptions = {},
|
@@ -55,12 +48,13 @@ const Collapsible = ({
|
|
55
48
|
setIsCollapsed(collapsed)
|
56
49
|
},[collapsed])
|
57
50
|
|
58
|
-
|
51
|
+
const CollapsibleParent = React.Children.toArray(children) as React.ReactElement[]
|
52
|
+
|
53
|
+
if (CollapsibleParent.length !== 2) {
|
59
54
|
throw new Error('Collapsible requires <CollapsibleMain> and <CollapsibleContent> to function properly.')
|
60
55
|
}
|
61
|
-
|
62
|
-
const
|
63
|
-
const SecondChild = children[1]
|
56
|
+
const FirstChild = CollapsibleParent[0]
|
57
|
+
const SecondChild = CollapsibleParent[1]
|
64
58
|
|
65
59
|
const Main = FirstChild.type === CollapsibleMain ? FirstChild : null
|
66
60
|
const Content = SecondChild.type === CollapsibleContent ? SecondChild : null
|
@@ -48,27 +48,3 @@ test('returns namespaced additional_class class name', () => {
|
|
48
48
|
const kit = screen.getByTestId(testId)
|
49
49
|
expect(kit).toHaveClass(`${kitClass} additional_class`)
|
50
50
|
})
|
51
|
-
|
52
|
-
test('html structure is correct', () => {
|
53
|
-
const { container } = render(
|
54
|
-
<Collapsible
|
55
|
-
className="additional_class"
|
56
|
-
data={{ testid: testId }}
|
57
|
-
iconColor='lighter'
|
58
|
-
iconSize="lg"
|
59
|
-
>
|
60
|
-
<Collapsible.Main>
|
61
|
-
<div>{'Main Section'}</div>
|
62
|
-
</Collapsible.Main>
|
63
|
-
<Collapsible.Content>
|
64
|
-
<div>
|
65
|
-
{
|
66
|
-
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. In vel erat sed purus hendrerit viverra. Duis et vestibulum metus. Sed consequat ut ante non vehicula. Etiam nunc massa, pharetra vel quam id, posuere rhoncus quam. Quisque imperdiet arcu enim, nec aliquet justo auctor eget. Curabitur in metus nec nunc rhoncus faucibus vitae ac elit. Nulla facilisi. Vestibulum quis pretium nulla. Nulla ut accumsan velit. Duis varius urna sed sem tempor, sit amet fermentum nibh auctor. Praesent lorem arcu, egestas non ante quis, placerat pellentesque lectus.Vestibulum lacinia ipsum quis venenatis tristique. Vivamus suscipit, libero eu fringilla egestas, orci urna commodo arcu, vel gravida turpis ipsum molestie nibh. Donec cursus eu ante sagittis ultrices. Phasellus id sagittis risus. Mauris dapibus neque faucibus, tempor ligula vel, cursus ante. Donec faucibus gravida porta. Nullam egestas est quis aliquam feugiat. Sed eget metus diam. Cras eget placerat libero.'
|
67
|
-
}
|
68
|
-
</div>
|
69
|
-
</Collapsible.Content>
|
70
|
-
</Collapsible>
|
71
|
-
)
|
72
|
-
|
73
|
-
expect(container).toMatchSnapshot()
|
74
|
-
})
|
@@ -127,7 +127,7 @@ const Tooltip = forwardRef((props: TooltipProps, ref: ForwardedRef<unknown>): Re
|
|
127
127
|
}
|
128
128
|
}}
|
129
129
|
role="tooltip_trigger"
|
130
|
-
style={{ display: "inline-
|
130
|
+
style={{ display: "inline-flex" }}
|
131
131
|
{...ariaProps}
|
132
132
|
{...dataProps}
|
133
133
|
{...htmlProps}
|