@bitrise/bitkit 10.19.0 → 10.20.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.
@@ -1,26 +0,0 @@
1
- .Expand {
2
- transition-property: margin, height, opacity;
3
- transition-duration: var(--transition-duration--fast);
4
- transition-timing-function: var(--transition-timing-function);
5
- }
6
-
7
- .Expand--peeked {
8
- position: relative;
9
- }
10
-
11
- .Expand--peeked::after {
12
- content: '';
13
- position: absolute;
14
- top: 0;
15
- right: 0;
16
- bottom: 0;
17
- left: 0;
18
- background: linear-gradient(180deg, rgba(255, 255, 255, 0) 4.75%, #FFFFFF 81.95%);
19
- z-index: 1;
20
- transition: opacity var(--transition-duration--fast) var(--transition-timing-function);
21
- }
22
-
23
- .Expand--expanded.Expand--peeked::after {
24
- opacity: 0;
25
- pointer-events: none;
26
- }
@@ -1,52 +0,0 @@
1
- import { mount, shallow } from 'enzyme';
2
- import { mountToJson, shallowToJson } from 'enzyme-to-json';
3
- import { act } from 'react-dom/test-utils';
4
- import Expand from './Expand';
5
-
6
- describe('Expand', () => {
7
- describe('removing children', () => {
8
- test('does render children when initially expanded', () => {
9
- expect(
10
- shallowToJson(
11
- shallow(
12
- <Expand expanded removeChildren>
13
- I should appear in the snapshot
14
- </Expand>,
15
- ),
16
- ),
17
- ).toMatchSnapshot();
18
- });
19
-
20
- test('does not render children when not initially expanded', () => {
21
- expect(
22
- shallowToJson(
23
- shallow(
24
- <Expand expanded={false} removeChildren>
25
- I should not appear in the snapshot
26
- </Expand>,
27
- ),
28
- ),
29
- ).toMatchSnapshot();
30
- });
31
-
32
- test('does render children once expanded', () => {
33
- const wrapper = mount(
34
- <Expand expanded={false} removeChildren>
35
- I should appear in the snapshot
36
- </Expand>,
37
- );
38
-
39
- act(() => {
40
- wrapper.setProps({ expanded: true });
41
- });
42
-
43
- expect(mountToJson(wrapper)).toMatchSnapshot();
44
- });
45
-
46
- test('always renders children when removeChildren is not set', () => {
47
- expect(
48
- shallowToJson(shallow(<Expand expanded={false}>I should appear in the snapshot</Expand>)),
49
- ).toMatchSnapshot();
50
- });
51
- });
52
- });
@@ -1,133 +0,0 @@
1
- import * as React from 'react';
2
- import classnames from 'classnames';
3
- import { useEventListener } from '../hooks';
4
- import Base, { TypeSizes } from '../Base/Base';
5
- import Flex, { Props as FlexProps } from '../Flex/Flex';
6
- import './Expand.css';
7
-
8
- const { useEffect, useRef, useState } = React;
9
-
10
- export interface Props extends FlexProps {
11
- /** @Ignore */
12
- children?: React.ReactNode;
13
- /** @Ignore */
14
- className?: string;
15
- /** Flag that controls the expanded state of the area. */
16
- expanded: boolean;
17
- /** @Ignore */
18
- padding?: TypeSizes;
19
- /** @Ignore */
20
- paddingHorizontal?: TypeSizes;
21
- /** @Ignore */
22
- paddingVertical?: TypeSizes;
23
- /** A CSS measurement of how much of the child content to always display when collapsed. */
24
- peekHeight?: string;
25
- /** Flag to control whether child content is rederend when collapsed. */
26
- removeChildren?: boolean;
27
- }
28
-
29
- const Expand: React.FunctionComponent<Props> = (props: Props) => {
30
- const {
31
- children,
32
- className,
33
- padding,
34
- paddingHorizontal,
35
- paddingVertical,
36
- removeChildren,
37
- expanded,
38
- peekHeight,
39
- ...rest
40
- } = props;
41
-
42
- const refOuter = useRef<HTMLElement>(null);
43
- const refInner = useRef<HTMLElement>(null);
44
- const refIsExpanded = useRef(expanded);
45
- const frameId = useRef<number | undefined>(undefined);
46
-
47
- const [height, setHeight] = useState<number | undefined>(expanded ? undefined : 0);
48
- const [isTransitioning, setIsTransitioning] = useState(false);
49
- const [opacity, setOpacity] = useState<number | undefined>(expanded || peekHeight ? 1 : 0);
50
- const [overflow, setOverflow] = useState<string | undefined>(expanded || peekHeight ? undefined : 'hidden');
51
-
52
- useEventListener(
53
- refOuter.current,
54
- 'transitionend',
55
- () => {
56
- setIsTransitioning(false);
57
-
58
- if (expanded) {
59
- setHeight(undefined);
60
- setOpacity(undefined);
61
- setOverflow(undefined);
62
- }
63
- },
64
- [expanded],
65
- );
66
-
67
- useEffect(() => {
68
- refIsExpanded.current = expanded;
69
-
70
- if (frameId.current) {
71
- window.cancelAnimationFrame(frameId.current);
72
- frameId.current = undefined;
73
- }
74
-
75
- if (expanded) {
76
- frameId.current = window.requestAnimationFrame(() => {
77
- if (refInner.current && height === 0) {
78
- setHeight(refInner.current.offsetHeight);
79
- setOpacity(1);
80
- }
81
- });
82
- } else {
83
- setIsTransitioning(true);
84
- setOverflow('hidden');
85
- frameId.current = window.requestAnimationFrame(() => {
86
- if (refInner.current && height === undefined) {
87
- setHeight(refInner.current.offsetHeight);
88
- frameId.current = window.requestAnimationFrame(() => {
89
- setHeight(0);
90
-
91
- if (!peekHeight) {
92
- setOpacity(0);
93
- }
94
- });
95
- }
96
- });
97
- }
98
-
99
- return () => {
100
- if (frameId.current) {
101
- window.cancelAnimationFrame(frameId.current);
102
- frameId.current = undefined;
103
- }
104
- };
105
- }, [expanded]);
106
-
107
- const renderChildren = isTransitioning || peekHeight || expanded || refIsExpanded.current || !removeChildren;
108
- const style = { opacity, overflow };
109
- const innerStyle = { overflow };
110
- const classes = classnames('Expand', {
111
- 'Expand--expanded': expanded,
112
- 'Expand--peeked': peekHeight,
113
- });
114
-
115
- const classesInner = classnames(className, 'Expand__inner');
116
-
117
- return (
118
- <Flex {...rest} className={classes} height={height} innerRef={refOuter} minHeight={peekHeight} style={style}>
119
- <Base
120
- className={classesInner}
121
- innerRef={refInner}
122
- padding={padding}
123
- paddingHorizontal={paddingHorizontal}
124
- paddingVertical={paddingVertical}
125
- style={innerStyle}
126
- >
127
- {renderChildren && children}
128
- </Base>
129
- </Flex>
130
- );
131
- };
132
-
133
- export default Expand;
@@ -1,211 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Expand removing children always renders children when removeChildren is not set 1`] = `
4
- <Flex
5
- className="Expand"
6
- height={0}
7
- innerRef={
8
- Object {
9
- "current": null,
10
- }
11
- }
12
- style={
13
- Object {
14
- "opacity": 0,
15
- "overflow": "hidden",
16
- }
17
- }
18
- >
19
- <Base
20
- className="Expand__inner"
21
- innerRef={
22
- Object {
23
- "current": null,
24
- }
25
- }
26
- style={
27
- Object {
28
- "overflow": "hidden",
29
- }
30
- }
31
- >
32
- I should appear in the snapshot
33
- </Base>
34
- </Flex>
35
- `;
36
-
37
- exports[`Expand removing children does not render children when not initially expanded 1`] = `
38
- <Flex
39
- className="Expand"
40
- height={0}
41
- innerRef={
42
- Object {
43
- "current": null,
44
- }
45
- }
46
- style={
47
- Object {
48
- "opacity": 0,
49
- "overflow": "hidden",
50
- }
51
- }
52
- >
53
- <Base
54
- className="Expand__inner"
55
- innerRef={
56
- Object {
57
- "current": null,
58
- }
59
- }
60
- style={
61
- Object {
62
- "overflow": "hidden",
63
- }
64
- }
65
- />
66
- </Flex>
67
- `;
68
-
69
- exports[`Expand removing children does render children once expanded 1`] = `
70
- <Expand
71
- expanded={true}
72
- removeChildren={true}
73
- >
74
- <Flex
75
- className="Expand Expand--expanded"
76
- height={0}
77
- innerRef={
78
- Object {
79
- "current": <div
80
- class="Base Flex Expand Expand--expanded"
81
- style="opacity: 0; overflow: hidden; height: 0px;"
82
- >
83
- <div
84
- class="Base Expand__inner"
85
- style="overflow: hidden;"
86
- >
87
- I should appear in the snapshot
88
- </div>
89
- </div>,
90
- }
91
- }
92
- style={
93
- Object {
94
- "opacity": 0,
95
- "overflow": "hidden",
96
- }
97
- }
98
- >
99
- <Base
100
- className="Flex Expand Expand--expanded"
101
- height={0}
102
- innerRef={
103
- Object {
104
- "current": <div
105
- class="Base Flex Expand Expand--expanded"
106
- style="opacity: 0; overflow: hidden; height: 0px;"
107
- >
108
- <div
109
- class="Base Expand__inner"
110
- style="overflow: hidden;"
111
- >
112
- I should appear in the snapshot
113
- </div>
114
- </div>,
115
- }
116
- }
117
- style={
118
- Object {
119
- "opacity": 0,
120
- "overflow": "hidden",
121
- }
122
- }
123
- >
124
- <div
125
- className="Base Flex Expand Expand--expanded"
126
- style={
127
- Object {
128
- "height": 0,
129
- "maxHeight": undefined,
130
- "maxWidth": undefined,
131
- "minHeight": undefined,
132
- "minWidth": undefined,
133
- "opacity": 0,
134
- "overflow": "hidden",
135
- "width": undefined,
136
- }
137
- }
138
- >
139
- <Base
140
- className="Expand__inner"
141
- innerRef={
142
- Object {
143
- "current": <div
144
- class="Base Expand__inner"
145
- style="overflow: hidden;"
146
- >
147
- I should appear in the snapshot
148
- </div>,
149
- }
150
- }
151
- style={
152
- Object {
153
- "overflow": "hidden",
154
- }
155
- }
156
- >
157
- <div
158
- className="Base Expand__inner"
159
- style={
160
- Object {
161
- "height": undefined,
162
- "maxHeight": undefined,
163
- "maxWidth": undefined,
164
- "minHeight": undefined,
165
- "minWidth": undefined,
166
- "overflow": "hidden",
167
- "width": undefined,
168
- }
169
- }
170
- >
171
- I should appear in the snapshot
172
- </div>
173
- </Base>
174
- </div>
175
- </Base>
176
- </Flex>
177
- </Expand>
178
- `;
179
-
180
- exports[`Expand removing children does render children when initially expanded 1`] = `
181
- <Flex
182
- className="Expand Expand--expanded"
183
- innerRef={
184
- Object {
185
- "current": null,
186
- }
187
- }
188
- style={
189
- Object {
190
- "opacity": 1,
191
- "overflow": undefined,
192
- }
193
- }
194
- >
195
- <Base
196
- className="Expand__inner"
197
- innerRef={
198
- Object {
199
- "current": null,
200
- }
201
- }
202
- style={
203
- Object {
204
- "overflow": undefined,
205
- }
206
- }
207
- >
208
- I should appear in the snapshot
209
- </Base>
210
- </Flex>
211
- `;