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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 59f7a06cc3253a684d61eee73c1c5fd45554d2cc4cd6122bba7607637e973c38
4
- data.tar.gz: 534985876808d4307fc906213268c98ab6df9092ed5a6bb4e739c937b2ef301d
3
+ metadata.gz: b7a4f103f5608db8ea9e25be909bbd042e40da83e7999805870268dd24447a47
4
+ data.tar.gz: ec863a877604c9113f98886ef6932ad97632b722b9b2b3797cc1e1791a11228e
5
5
  SHA512:
6
- metadata.gz: f3e85a9f4bb0f4b46e22897b9ccd19134eafd2f90b826b84e446d37e07c5a776190a7d1f227eeafe082a004418fd2718ecd43dd2edce2cd8584383149052de76
7
- data.tar.gz: df402be0fb3068a1b1f139f80c433b07a92f791265133b8480baf159893cbe12bf260c24e88fc10023bacf30d0f8c23da818c583b16b047430021375c892614a
6
+ metadata.gz: 1f67c5d57ecf837628d8de841fdb279ca873e957fa7de4149c9d4fee2d5c4e73fa0877bc8e864fa31402ff02bfa46c2b6a68b50d3b8d425bd57b511230faba36
7
+ data.tar.gz: 89a64b35561cf140d06e663ff65bc3b7ee5e26062ca59549b063b2c9b29f29021a0b47491c1a99d01b5e2812cbbddc365fb1c1991de0d42efb5e9e2a561ad1b7
@@ -1,4 +1,4 @@
1
- import React, { useEffect, ReactElement } from 'react'
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?: [ReactElement<CollapsibleMainProps>, ReactElement<CollapsibleContentProps>],
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
- if (children.length !== 2) {
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 FirstChild = children[0]
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-block" }}
130
+ style={{ display: "inline-flex" }}
131
131
  {...ariaProps}
132
132
  {...dataProps}
133
133
  {...htmlProps}