@skyscanner/backpack-web 41.15.2 → 41.17.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/bpk-animate-height/index.d.ts +3 -0
- package/bpk-animate-height/src/AnimateHeight.d.ts +25 -0
- package/bpk-animate-height/src/AnimateHeight.js +16 -31
- package/bpk-component-accordion/src/BpkAccordionItem.js +0 -1
- package/bpk-component-banner-alert/src/AnimateAndFade.js +0 -2
- package/bpk-component-banner-alert/src/BpkBannerAlertInner.js +0 -2
- package/bpk-component-card-list/src/BpkCardList.module.css +1 -1
- package/bpk-component-info-banner/src/AnimateAndFade.js +0 -2
- package/bpk-component-info-banner/src/BpkInfoBannerInner.js +0 -2
- package/bpk-component-layout/src/BpkProvider.js +6 -1
- package/bpk-component-layout/src/theme.js +4 -0
- package/bpk-component-skip-link/index.d.ts +5 -0
- package/bpk-component-skip-link/index.js +2 -1
- package/bpk-component-skip-link/src/BpkSkipLink.d.ts +10 -0
- package/bpk-component-skip-link/src/BpkSkipLink.js +3 -10
- package/bpk-component-skip-link/src/themeAttributes.d.ts +2 -0
- package/package.json +2 -2
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { Component } from 'react';
|
|
3
|
+
export type Props = HTMLAttributes<HTMLDivElement> & {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
duration: number;
|
|
6
|
+
height: number | string;
|
|
7
|
+
easing?: string;
|
|
8
|
+
transitionOverflow?: string;
|
|
9
|
+
onAnimationComplete?: (() => void) | null;
|
|
10
|
+
};
|
|
11
|
+
type State = {
|
|
12
|
+
height: number | string;
|
|
13
|
+
overflow: string;
|
|
14
|
+
};
|
|
15
|
+
declare class AnimateHeight extends Component<Props, State> {
|
|
16
|
+
constructor(props: Props);
|
|
17
|
+
componentDidMount(): void;
|
|
18
|
+
componentDidUpdate(prevProps: Props, prevState: State): void;
|
|
19
|
+
componentWillUnmount(): void;
|
|
20
|
+
onTransitionEnd: () => void;
|
|
21
|
+
timeoutID: ReturnType<typeof setTimeout> | null;
|
|
22
|
+
contentElement: HTMLDivElement | null;
|
|
23
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
}
|
|
25
|
+
export default AnimateHeight;
|
|
@@ -16,14 +16,12 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import PropTypes from 'prop-types';
|
|
20
19
|
import { Component } from 'react';
|
|
21
|
-
|
|
22
|
-
// IE11 doesn't support `Number.isNaN` so we must use the global.
|
|
23
|
-
// When IE11 support drops we can migrate.
|
|
24
|
-
// eslint-disable-next-line no-restricted-globals
|
|
25
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
|
-
const isNumber = n =>
|
|
21
|
+
const isNumber = n => {
|
|
22
|
+
const parsed = typeof n === 'number' ? n : parseFloat(n);
|
|
23
|
+
return !Number.isNaN(parsed) && Number.isFinite(parsed);
|
|
24
|
+
};
|
|
27
25
|
const isTransitionEndSupported = () => !!(typeof window !== 'undefined' && 'TransitionEvent' in window);
|
|
28
26
|
class AnimateHeight extends Component {
|
|
29
27
|
constructor(props) {
|
|
@@ -32,7 +30,7 @@ class AnimateHeight extends Component {
|
|
|
32
30
|
let overflow = 'visible';
|
|
33
31
|
if (isNumber(this.props.height)) {
|
|
34
32
|
height = this.props.height < 0 ? 0 : this.props.height;
|
|
35
|
-
overflow = this.props.transitionOverflow;
|
|
33
|
+
overflow = this.props.transitionOverflow ?? 'hidden';
|
|
36
34
|
}
|
|
37
35
|
this.state = {
|
|
38
36
|
height,
|
|
@@ -64,9 +62,9 @@ class AnimateHeight extends Component {
|
|
|
64
62
|
let newHeight = null;
|
|
65
63
|
let shouldSetTimeout = false;
|
|
66
64
|
let timeoutHeight = null;
|
|
67
|
-
let timeoutOverflow = prevTransitionOverflow;
|
|
65
|
+
let timeoutOverflow = prevTransitionOverflow ?? 'hidden';
|
|
68
66
|
let timeoutDuration = duration;
|
|
69
|
-
clearTimeout(this.timeoutID);
|
|
67
|
+
clearTimeout(this.timeoutID ?? undefined);
|
|
70
68
|
if (isNumber(height)) {
|
|
71
69
|
// If new height is a number
|
|
72
70
|
newHeight = height < 0 ? 0 : height;
|
|
@@ -88,12 +86,12 @@ class AnimateHeight extends Component {
|
|
|
88
86
|
}
|
|
89
87
|
this.setState({
|
|
90
88
|
height: newHeight,
|
|
91
|
-
overflow: transitionOverflow
|
|
89
|
+
overflow: transitionOverflow ?? 'hidden'
|
|
92
90
|
});
|
|
93
91
|
if (shouldSetTimeout) {
|
|
94
92
|
this.timeoutID = setTimeout(() => {
|
|
95
93
|
this.setState({
|
|
96
|
-
height: timeoutHeight,
|
|
94
|
+
height: timeoutHeight ?? 0,
|
|
97
95
|
overflow: timeoutOverflow
|
|
98
96
|
});
|
|
99
97
|
if (!isTransitionEndSupported()) {
|
|
@@ -104,7 +102,7 @@ class AnimateHeight extends Component {
|
|
|
104
102
|
}
|
|
105
103
|
}
|
|
106
104
|
componentWillUnmount() {
|
|
107
|
-
clearTimeout(this.timeoutID);
|
|
105
|
+
clearTimeout(this.timeoutID ?? undefined);
|
|
108
106
|
this.timeoutID = null;
|
|
109
107
|
}
|
|
110
108
|
onTransitionEnd = () => {
|
|
@@ -115,13 +113,17 @@ class AnimateHeight extends Component {
|
|
|
115
113
|
this.props.onAnimationComplete();
|
|
116
114
|
}
|
|
117
115
|
};
|
|
116
|
+
timeoutID = null;
|
|
117
|
+
contentElement = null;
|
|
118
118
|
render() {
|
|
119
119
|
const {
|
|
120
120
|
children,
|
|
121
121
|
duration,
|
|
122
|
-
easing,
|
|
123
|
-
|
|
122
|
+
easing = 'ease',
|
|
123
|
+
height: _height,
|
|
124
|
+
onAnimationComplete: _onAnimationComplete,
|
|
124
125
|
style,
|
|
126
|
+
transitionOverflow: _transitionOverflow,
|
|
125
127
|
...rest
|
|
126
128
|
} = this.props;
|
|
127
129
|
const {
|
|
@@ -138,8 +140,6 @@ class AnimateHeight extends Component {
|
|
|
138
140
|
msTransition: `height ${duration}ms ${easing} `,
|
|
139
141
|
transition: `height ${duration}ms ${easing} `
|
|
140
142
|
};
|
|
141
|
-
delete rest.height;
|
|
142
|
-
delete rest.transitionOverflow;
|
|
143
143
|
return /*#__PURE__*/_jsx("div", {
|
|
144
144
|
style: componentStyle,
|
|
145
145
|
onTransitionEnd: this.onTransitionEnd,
|
|
@@ -153,19 +153,4 @@ class AnimateHeight extends Component {
|
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
-
AnimateHeight.propTypes = {
|
|
157
|
-
children: PropTypes.node.isRequired,
|
|
158
|
-
duration: PropTypes.number.isRequired,
|
|
159
|
-
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
|
160
|
-
easing: PropTypes.string,
|
|
161
|
-
transitionOverflow: PropTypes.string,
|
|
162
|
-
onAnimationComplete: PropTypes.func,
|
|
163
|
-
style: PropTypes.object // eslint-disable-line react/forbid-prop-types
|
|
164
|
-
};
|
|
165
|
-
AnimateHeight.defaultProps = {
|
|
166
|
-
easing: 'ease',
|
|
167
|
-
transitionOverflow: 'hidden',
|
|
168
|
-
onAnimationComplete: null,
|
|
169
|
-
style: {}
|
|
170
|
-
};
|
|
171
156
|
export default AnimateHeight;
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { useContext, cloneElement } from 'react';
|
|
20
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
21
20
|
import AnimateHeight from "../../bpk-animate-height";
|
|
22
21
|
import { withButtonAlignment } from "../../bpk-component-icon";
|
|
23
22
|
import ChevronDownIcon from "../../bpk-component-icon/sm/chevron-down";
|
|
@@ -19,8 +19,6 @@
|
|
|
19
19
|
import { Component } from 'react';
|
|
20
20
|
import { TransitionGroup, CSSTransition } from 'react-transition-group';
|
|
21
21
|
import { durationSm } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
22
|
-
|
|
23
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
24
22
|
import BpkAnimateHeight from "../../bpk-animate-height";
|
|
25
23
|
import { cssModules } from "../../bpk-react-utils";
|
|
26
24
|
import STYLES from "./BpkAnimateAndFade.module.css";
|
|
@@ -21,8 +21,6 @@
|
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
import { durationSm } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
24
|
-
|
|
25
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
26
24
|
import BpkAnimateHeight from "../../bpk-animate-height";
|
|
27
25
|
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
28
26
|
import BpkCloseButton from "../../bpk-component-close-button";
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
.bpk-card-list{display:flex;flex-direction:column;gap:1.5rem}@media(max-width: 32rem){.bpk-card-list{gap:1rem}}.bpk-card-list--card-list{display:flex;flex-direction:column}
|
|
18
|
+
.bpk-card-list{display:flex;flex-direction:column;overflow:clip;gap:1.5rem}@media(max-width: 32rem){.bpk-card-list{gap:1rem}}.bpk-card-list--card-list{display:flex;flex-direction:column}
|
|
@@ -19,8 +19,6 @@
|
|
|
19
19
|
import { Component } from 'react';
|
|
20
20
|
import { TransitionGroup, CSSTransition } from 'react-transition-group';
|
|
21
21
|
import { durationSm } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
22
|
-
|
|
23
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
24
22
|
import BpkAnimateHeight from "../../bpk-animate-height";
|
|
25
23
|
import { cssModules } from "../../bpk-react-utils";
|
|
26
24
|
import STYLES from "./BpkAnimateAndFade.module.css";
|
|
@@ -21,8 +21,6 @@
|
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
import { durationSm } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
24
|
-
|
|
25
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
26
24
|
import BpkAnimateHeight from "../../bpk-animate-height";
|
|
27
25
|
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
28
26
|
import BpkCloseButton from "../../bpk-component-close-button";
|
|
@@ -23,7 +23,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
23
23
|
* Creates a Chakra UI system with Backpack token mappings
|
|
24
24
|
* Chakra UI 3.0 uses `createSystem` with `defaultConfig` and custom config
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
// Remove Chakra's global CSS to prevent style conflicts with Backpack components
|
|
27
|
+
const {
|
|
28
|
+
globalCss: _chakraGlobalCss,
|
|
29
|
+
...defaultConfigWithoutGlobalCss
|
|
30
|
+
} = defaultConfig;
|
|
31
|
+
const bpkSystem = createSystem(defaultConfigWithoutGlobalCss, createBpkConfig());
|
|
27
32
|
|
|
28
33
|
/**
|
|
29
34
|
* BpkProvider - Provides Chakra UI context for Backpack layout components
|
|
@@ -218,6 +218,10 @@ export function createBpkConfig() {
|
|
|
218
218
|
chakraBreakpoints[token] = value;
|
|
219
219
|
});
|
|
220
220
|
return defineConfig({
|
|
221
|
+
// Disable Chakra's preflight (CSS reset) so it does not override Backpack's
|
|
222
|
+
// global font styles, in particular the `-webkit-font-smoothing: antialiased`
|
|
223
|
+
// setting applied by Backpack.
|
|
224
|
+
preflight: false,
|
|
221
225
|
cssVarsPrefix: 'bpk',
|
|
222
226
|
theme: {
|
|
223
227
|
tokens: {
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
import BpkSkipLink from "./src/BpkSkipLink";
|
|
18
19
|
import themeAttributes from "./src/themeAttributes";
|
|
19
20
|
export { themeAttributes };
|
|
20
21
|
export default BpkSkipLink;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
type NativeAnchorProps = Omit<ComponentPropsWithoutRef<'a'>, 'href' | 'className' | 'children'>;
|
|
3
|
+
export type Props = NativeAnchorProps & {
|
|
4
|
+
label: string;
|
|
5
|
+
href: string;
|
|
6
|
+
className?: string | null;
|
|
7
|
+
[rest: string]: any;
|
|
8
|
+
};
|
|
9
|
+
declare const BpkSkipLink: ({ className, href, label, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default BpkSkipLink;
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
|
|
18
19
|
import { cssModules } from "../../bpk-react-utils";
|
|
19
20
|
import STYLES from "./BpkSkipLink.module.css";
|
|
20
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -24,18 +25,10 @@ const BpkSkipLink = ({
|
|
|
24
25
|
href,
|
|
25
26
|
label,
|
|
26
27
|
...rest
|
|
27
|
-
}) =>
|
|
28
|
-
/*#__PURE__*/
|
|
29
|
-
// $FlowFixMe[cannot-spread-inexact] - inexact rest. See 'decisions/flowfixme.md'.
|
|
30
|
-
_jsx("a", {
|
|
28
|
+
}) => /*#__PURE__*/_jsx("a", {
|
|
31
29
|
href: href,
|
|
32
30
|
className: getClassName('bpk-skip-link', className),
|
|
33
31
|
...rest,
|
|
34
32
|
children: label
|
|
35
33
|
});
|
|
36
|
-
BpkSkipLink.propTypes = {
|
|
37
|
-
label: PropTypes.string.isRequired,
|
|
38
|
-
href: PropTypes.string.isRequired,
|
|
39
|
-
className: PropTypes.string
|
|
40
|
-
};
|
|
41
34
|
export default BpkSkipLink;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyscanner/backpack-web",
|
|
3
|
-
"version": "41.
|
|
3
|
+
"version": "41.17.0",
|
|
4
4
|
"description": "Backpack Design System web library",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@chakra-ui/react": "^3.
|
|
25
|
+
"@chakra-ui/react": "^3.33.0",
|
|
26
26
|
"@floating-ui/react": "^0.26.12",
|
|
27
27
|
"@popperjs/core": "^2.11.8",
|
|
28
28
|
"@radix-ui/react-compose-refs": "^1.1.1",
|