@skyscanner/backpack-web 13.0.0 → 14.1.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/README.md +67 -64
- package/bpk-animate-height/README.md +2 -4
- package/bpk-component-accordion/README.md +6 -8
- package/bpk-component-accordion/src/BpkAccordionItem.js +1 -2
- package/bpk-component-aria-live/README.md +2 -4
- package/bpk-component-autosuggest/README.md +5 -7
- package/bpk-component-badge/README.md +2 -4
- package/bpk-component-banner-alert/README.md +4 -6
- package/bpk-component-barchart/README.md +2 -4
- package/bpk-component-barchart/src/BpkBarchartBar.module.scss +4 -4
- package/bpk-component-barchart/src/BpkChartAxis.module.scss +2 -2
- package/bpk-component-barchart/src/BpkChartGridLines.module.scss +1 -1
- package/bpk-component-blockquote/README.md +2 -4
- package/bpk-component-breadcrumb/README.md +2 -4
- package/bpk-component-breakpoint/README.md +2 -4
- package/bpk-component-button/README.md +4 -6
- package/bpk-component-calendar/README.md +3 -5
- package/bpk-component-card/README.md +2 -4
- package/bpk-component-checkbox/README.md +2 -4
- package/bpk-component-checkbox/src/BpkCheckbox.js +1 -0
- package/bpk-component-checkbox/src/BpkCheckbox.module.scss +4 -0
- package/bpk-component-chip/README.md +3 -5
- package/bpk-component-close-button/README.md +2 -4
- package/bpk-component-code/README.md +3 -5
- package/bpk-component-content-cards/README.md +1 -3
- package/bpk-component-content-container/README.md +2 -4
- package/bpk-component-datatable/README.md +3 -5
- package/bpk-component-datepicker/README.md +4 -6
- package/bpk-component-description-list/README.md +2 -4
- package/bpk-component-dialog/README.md +3 -5
- package/bpk-component-drawer/README.md +3 -5
- package/bpk-component-fieldset/README.md +3 -5
- package/bpk-component-flare/README.md +2 -4
- package/bpk-component-floating-notification/README.md +2 -4
- package/bpk-component-form-validation/README.md +2 -4
- package/bpk-component-graphic-promotion/README.md +2 -4
- package/bpk-component-grid/README.md +2 -4
- package/bpk-component-grid-toggle/README.md +2 -4
- package/bpk-component-grid-toggle/src/BpkGridToggle.module.scss +1 -1
- package/bpk-component-horizontal-nav/README.md +2 -4
- package/bpk-component-icon/README.md +9 -11
- package/bpk-component-icon/lg/baggage-cabin-add.js +8 -0
- package/bpk-component-icon/lg/baggage-cabin-not-included.js +8 -0
- package/bpk-component-icon/lg/baggage-cabin.js +8 -0
- package/bpk-component-icon/lg/baggage-checked-add.js +8 -0
- package/bpk-component-icon/lg/baggage-checked-not-included.js +8 -0
- package/bpk-component-icon/lg/baggage-checked.js +8 -0
- package/bpk-component-icon/lg/baggage-generic.js +8 -0
- package/bpk-component-icon/sm/baggage-cabin-add.js +8 -0
- package/bpk-component-icon/sm/baggage-cabin-not-included.js +8 -0
- package/bpk-component-icon/sm/baggage-cabin.js +8 -0
- package/bpk-component-icon/sm/baggage-checked-add.js +8 -0
- package/bpk-component-icon/sm/baggage-checked-not-included.js +8 -0
- package/bpk-component-icon/sm/baggage-checked.js +8 -0
- package/bpk-component-icon/sm/baggage-generic.js +8 -0
- package/bpk-component-image/README.md +5 -7
- package/bpk-component-infinite-scroll/README.md +5 -7
- package/bpk-component-input/README.md +4 -6
- package/bpk-component-label/README.md +2 -4
- package/bpk-component-label/src/BpkLabel.js +9 -14
- package/bpk-component-label/src/BpkLabel.module.scss +4 -0
- package/bpk-component-link/README.md +2 -4
- package/bpk-component-list/README.md +2 -4
- package/bpk-component-loading-button/README.md +4 -6
- package/bpk-component-map/README.md +7 -9
- package/bpk-component-mobile-scroll-container/README.md +3 -5
- package/bpk-component-modal/README.md +4 -6
- package/bpk-component-navigation-bar/README.md +7 -9
- package/bpk-component-nudger/README.md +5 -7
- package/bpk-component-nudger/src/BpkNudger.module.scss +2 -1
- package/bpk-component-overlay/README.md +3 -5
- package/bpk-component-page-indicator/README.md +42 -0
- package/bpk-component-page-indicator/index.js +28 -0
- package/bpk-component-page-indicator/src/BpkPageIndicator.js +147 -0
- package/bpk-component-page-indicator/src/BpkPageIndicator.module.css +18 -0
- package/bpk-component-page-indicator/src/BpkPageIndicator.module.scss +91 -0
- package/bpk-component-page-indicator/src/NavButton.js +85 -0
- package/bpk-component-pagination/README.md +2 -4
- package/bpk-component-pagination/src/BpkPaginationNudger.module.scss +1 -22
- package/bpk-component-pagination/src/BpkPaginationPage.js +2 -1
- package/bpk-component-pagination/src/BpkPaginationPage.module.scss +5 -57
- package/bpk-component-panel/README.md +2 -4
- package/bpk-component-phone-input/README.md +3 -5
- package/bpk-component-popover/README.md +4 -6
- package/bpk-component-price/README.md +2 -4
- package/bpk-component-progress/README.md +2 -4
- package/bpk-component-radio/README.md +2 -4
- package/bpk-component-radio/src/BpkRadio.js +9 -10
- package/bpk-component-radio/src/BpkRadio.module.scss +4 -0
- package/bpk-component-rating/README.md +2 -4
- package/bpk-component-rtl-toggle/README.md +2 -4
- package/bpk-component-scrollable-calendar/README.md +3 -5
- package/bpk-component-section-list/README.md +2 -4
- package/bpk-component-select/README.md +2 -4
- package/bpk-component-skip-link/README.md +2 -4
- package/bpk-component-slider/README.md +2 -4
- package/bpk-component-spinner/README.md +2 -4
- package/bpk-component-split-input/README.md +2 -4
- package/bpk-component-star-rating/README.md +2 -4
- package/bpk-component-switch/README.md +2 -4
- package/bpk-component-table/README.md +2 -4
- package/bpk-component-text/README.md +5 -7
- package/bpk-component-textarea/README.md +2 -4
- package/bpk-component-theme-toggle/README.md +4 -6
- package/bpk-component-ticket/README.md +2 -4
- package/bpk-component-tooltip/README.md +3 -5
- package/bpk-react-utils/README.md +11 -13
- package/bpk-scrim-utils/README.md +2 -5
- package/bpk-scrim-utils/src/BpkScrim.js +1 -3
- package/bpk-scrim-utils/src/bpk-scrim.module.scss +3 -6
- package/bpk-scrim-utils/src/withScrim.js +1 -4
- package/bpk-theming/README.md +3 -5
- package/package.json +4 -4
|
@@ -4,15 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
npm install bpk-component-input --save-dev
|
|
9
|
-
```
|
|
7
|
+
Check the main [Readme](https://github.com/skyscanner/backpack#usage) for a complete installation guide.
|
|
10
8
|
|
|
11
9
|
## Usage
|
|
12
10
|
|
|
13
11
|
```js
|
|
14
12
|
import React from 'react';
|
|
15
|
-
import BpkInput, { INPUT_TYPES, CLEAR_BUTTON_MODES } from 'bpk-component-input';
|
|
13
|
+
import BpkInput, { INPUT_TYPES, CLEAR_BUTTON_MODES } from '@skyscanner/backpack-web/bpk-component-input';
|
|
16
14
|
|
|
17
15
|
export default () => (
|
|
18
16
|
<BpkInput
|
|
@@ -75,8 +73,8 @@ You can still attach custom handlers for these events as they will still be call
|
|
|
75
73
|
|
|
76
74
|
```js
|
|
77
75
|
import React from 'react';
|
|
78
|
-
import BpkInput, { withOpenEvents } from 'bpk-component-input';
|
|
79
|
-
import BpkPopover from 'bpk-component-popover';
|
|
76
|
+
import BpkInput, { withOpenEvents } from '@skyscanner/backpack-web/bpk-component-input';
|
|
77
|
+
import BpkPopover from '@skyscanner/backpack-web/bpk-component-popover';
|
|
80
78
|
|
|
81
79
|
const EnhancedInput = withOpenEvents(BpkInput);
|
|
82
80
|
|
|
@@ -4,15 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
npm install bpk-component-label --save-dev
|
|
9
|
-
```
|
|
7
|
+
Check the main [Readme](https://github.com/skyscanner/backpack#usage) for a complete installation guide.
|
|
10
8
|
|
|
11
9
|
## Usage
|
|
12
10
|
|
|
13
11
|
```js
|
|
14
12
|
import React from 'react';
|
|
15
|
-
import BpkLabel from 'bpk-component-label';
|
|
13
|
+
import BpkLabel from '@skyscanner/backpack-web/bpk-component-label';
|
|
16
14
|
|
|
17
15
|
export default () => (
|
|
18
16
|
<BpkLabel htmlFor="origin">Origin</BpkLabel>
|
|
@@ -38,25 +38,20 @@ export type Props = {
|
|
|
38
38
|
const BpkLabel = (props: Props) => {
|
|
39
39
|
const { children, className, disabled, required, valid, white, ...rest } =
|
|
40
40
|
props;
|
|
41
|
-
const classNames = [getClassName('bpk-label')];
|
|
42
41
|
const invalid = valid === false;
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
if (className) {
|
|
54
|
-
classNames.push(className);
|
|
55
|
-
}
|
|
43
|
+
const classNames = getClassName(
|
|
44
|
+
'bpk-label',
|
|
45
|
+
white && 'bpk-label--white',
|
|
46
|
+
invalid && 'bpk-label--invalid',
|
|
47
|
+
disabled && 'bpk-label--disabled',
|
|
48
|
+
white && disabled && 'bpk-label--disabled--white',
|
|
49
|
+
className,
|
|
50
|
+
);
|
|
56
51
|
|
|
57
52
|
return (
|
|
58
53
|
// $FlowFixMe[cannot-spread-inexact] - inexact rest. See 'decisions/flowfixme.md'.
|
|
59
|
-
<label className={classNames
|
|
54
|
+
<label className={classNames} {...rest}>
|
|
60
55
|
{children}
|
|
61
56
|
{!disabled && required && (
|
|
62
57
|
<span className={getClassName('bpk-label__asterisk')}>*</span>
|
|
@@ -4,15 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
npm install bpk-component-link --save-dev
|
|
9
|
-
```
|
|
7
|
+
Check the main [Readme](https://github.com/skyscanner/backpack#usage) for a complete installation guide.
|
|
10
8
|
|
|
11
9
|
## Usage
|
|
12
10
|
|
|
13
11
|
```js
|
|
14
12
|
import React from 'react';
|
|
15
|
-
import BpkLink, { BpkButtonLink } from 'bpk-component-link';
|
|
13
|
+
import BpkLink, { BpkButtonLink } from '@skyscanner/backpack-web/bpk-component-link';
|
|
16
14
|
|
|
17
15
|
export default () => (
|
|
18
16
|
<div>
|
|
@@ -4,15 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
npm install bpk-component-list --save-dev
|
|
9
|
-
```
|
|
7
|
+
Check the main [Readme](https://github.com/skyscanner/backpack#usage) for a complete installation guide.
|
|
10
8
|
|
|
11
9
|
## Usage
|
|
12
10
|
|
|
13
11
|
```js
|
|
14
12
|
import React from 'react';
|
|
15
|
-
import { BpkList, BpkListItem } from 'bpk-component-list';
|
|
13
|
+
import { BpkList, BpkListItem } from '@skyscanner/backpack-web/bpk-component-list';
|
|
16
14
|
|
|
17
15
|
export default () => (
|
|
18
16
|
<BpkList>
|
|
@@ -4,17 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
npm install bpk-component-loading-button --save-dev
|
|
9
|
-
```
|
|
7
|
+
Check the main [Readme](https://github.com/skyscanner/backpack#usage) for a complete installation guide.
|
|
10
8
|
|
|
11
9
|
## Usage
|
|
12
10
|
|
|
13
11
|
```js
|
|
14
12
|
import React from 'react';
|
|
15
|
-
import BpkLoadingButton from 'bpk-component-loading-button';
|
|
16
|
-
import BaggageIcon from 'bpk-component-icon/sm/baggage';
|
|
17
|
-
import { withButtonAlignment, withRtlSupport } from 'bpk-component-icon';
|
|
13
|
+
import BpkLoadingButton from '@skyscanner/backpack-web/bpk-component-loading-button';
|
|
14
|
+
import BaggageIcon from '@skyscanner/backpack-web/bpk-component-icon/sm/baggage';
|
|
15
|
+
import { withButtonAlignment, withRtlSupport } from '@skyscanner/backpack-web/bpk-component-icon';
|
|
18
16
|
|
|
19
17
|
const AlignedBaggageIcon = withButtonAlignment(withRtlSupport(BaggageIcon));
|
|
20
18
|
const icon = <AlignedBaggageIcon />;
|
|
@@ -6,21 +6,19 @@ Requires **React 16.8+**
|
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
npm install bpk-component-map --save-dev
|
|
11
|
-
```
|
|
9
|
+
Check the main [Readme](https://github.com/skyscanner/backpack#usage) for a complete installation guide.
|
|
12
10
|
|
|
13
11
|
## Usage
|
|
14
12
|
|
|
15
13
|
```js
|
|
16
14
|
import React from 'react';
|
|
17
|
-
import BpkText from 'bpk-component-text';
|
|
18
|
-
import { withRtlSupport } from 'bpk-component-icon';
|
|
19
|
-
import LandmarkIconSm from 'bpk-component-icon/sm/landmark';
|
|
15
|
+
import BpkText from '@skyscanner/backpack-web/bpk-component-text';
|
|
16
|
+
import { withRtlSupport } from '@skyscanner/backpack-web/bpk-component-icon';
|
|
17
|
+
import LandmarkIconSm from '@skyscanner/backpack-web/bpk-component-icon/sm/landmark';
|
|
20
18
|
import BpkMap, {
|
|
21
19
|
BpkIconMarker,
|
|
22
20
|
BpkOverlayView,
|
|
23
|
-
} from 'bpk-component-map';
|
|
21
|
+
} from '@skyscanner/backpack-web/bpk-component-map';
|
|
24
22
|
|
|
25
23
|
const AlignedLandmarkIconSm = withRtlSupport(LandmarkIconSm);
|
|
26
24
|
|
|
@@ -64,7 +62,7 @@ Price markers are used to display clickable prices on a map.
|
|
|
64
62
|
|
|
65
63
|
```js
|
|
66
64
|
import React from 'react';
|
|
67
|
-
import BpkMap, { BpkPriceMarker, PRICE_MARKER_STATUSES } from 'bpk-component-map';
|
|
65
|
+
import BpkMap, { BpkPriceMarker, PRICE_MARKER_STATUSES } from '@skyscanner/backpack-web/bpk-component-map';
|
|
68
66
|
|
|
69
67
|
export default () => (
|
|
70
68
|
<BpkMap
|
|
@@ -106,7 +104,7 @@ If you intend to include multiple maps on one page, it's better to load the Goog
|
|
|
106
104
|
|
|
107
105
|
```js
|
|
108
106
|
import React from 'react';
|
|
109
|
-
import BpkMap, { withGoogleMapsScript } from 'bpk-component-map';
|
|
107
|
+
import BpkMap, { withGoogleMapsScript } from '@skyscanner/backpack-web/bpk-component-map';
|
|
110
108
|
|
|
111
109
|
const BpkMapWithScript = withGoogleMapsScript(BpkMap);
|
|
112
110
|
|
|
@@ -4,16 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
npm install bpk-component-mobile-scroll-container --save-dev
|
|
9
|
-
```
|
|
7
|
+
Check the main [Readme](https://github.com/skyscanner/backpack#usage) for a complete installation guide.
|
|
10
8
|
|
|
11
9
|
## Usage
|
|
12
10
|
|
|
13
11
|
```js
|
|
14
12
|
import React from 'react';
|
|
15
|
-
import { cssModules } from 'bpk-react-utils';
|
|
16
|
-
import BpkMobileScrollContainer from 'bpk-component-mobile-scroll-container';
|
|
13
|
+
import { cssModules } from '@skyscanner/backpack-web/bpk-react-utils';
|
|
14
|
+
import BpkMobileScrollContainer from '@skyscanner/backpack-web/bpk-component-mobile-scroll-container';
|
|
17
15
|
|
|
18
16
|
import STYLES from './MyComponent.scss';
|
|
19
17
|
|
|
@@ -4,17 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
npm install bpk-component-modal --save-dev
|
|
9
|
-
```
|
|
7
|
+
Check the main [Readme](https://github.com/skyscanner/backpack#usage) for a complete installation guide.
|
|
10
8
|
|
|
11
9
|
## Usage
|
|
12
10
|
|
|
13
11
|
```js
|
|
14
12
|
import React, { Component } from 'react';
|
|
15
|
-
import BpkModal from 'bpk-component-modal';
|
|
16
|
-
import BpkButton from 'bpk-component-button';
|
|
17
|
-
import { BpkNavigationBarButtonLink } from 'bpk-component-navigation-bar';
|
|
13
|
+
import BpkModal from '@skyscanner/backpack-web/bpk-component-modal';
|
|
14
|
+
import BpkButton from '@skyscanner/backpack-web/bpk-component-button';
|
|
15
|
+
import { BpkNavigationBarButtonLink } from '@skyscanner/backpack-web/bpk-component-navigation-bar';
|
|
18
16
|
|
|
19
17
|
class App extends Component {
|
|
20
18
|
constructor() {
|
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
npm install bpk-component-navigation-bar --save-dev
|
|
9
|
-
```
|
|
7
|
+
Check the main [Readme](https://github.com/skyscanner/backpack#usage) for a complete installation guide.
|
|
10
8
|
|
|
11
9
|
## Usage
|
|
12
10
|
|
|
@@ -14,10 +12,10 @@ npm install bpk-component-navigation-bar --save-dev
|
|
|
14
12
|
|
|
15
13
|
```js
|
|
16
14
|
import React from 'react';
|
|
17
|
-
import ArrowIcon from 'bpk-component-icon/sm/long-arrow-left';
|
|
18
|
-
import { withRtlSupport } from 'bpk-component-icon';
|
|
15
|
+
import ArrowIcon from '@skyscanner/backpack-web/bpk-component-icon/sm/long-arrow-left';
|
|
16
|
+
import { withRtlSupport } from '@skyscanner/backpack-web/bpk-component-icon';
|
|
19
17
|
|
|
20
|
-
import BpkNavigationBar, { BpkNavigationBarIconButton, BpkNavigationBarButtonLink } from 'bpk-component-navigation-bar';
|
|
18
|
+
import BpkNavigationBar, { BpkNavigationBarIconButton, BpkNavigationBarButtonLink } from '@skyscanner/backpack-web/bpk-component-navigation-bar';
|
|
21
19
|
|
|
22
20
|
const ArrowIconWithRtl = withRtlSupport(ArrowIcon);
|
|
23
21
|
|
|
@@ -58,8 +56,8 @@ export default () => (
|
|
|
58
56
|
|
|
59
57
|
```js
|
|
60
58
|
import React from 'react';
|
|
61
|
-
import ArrowIcon from 'bpk-component-icon/sm/long-arrow-left';
|
|
62
|
-
import { BpkNavigationBarIconButton } from 'bpk-component-navigation-bar';
|
|
59
|
+
import ArrowIcon from '@skyscanner/backpack-web/bpk-component-icon/sm/long-arrow-left';
|
|
60
|
+
import { BpkNavigationBarIconButton } from '@skyscanner/backpack-web/bpk-component-navigation-bar';
|
|
63
61
|
|
|
64
62
|
export default () => (
|
|
65
63
|
<BpkNavigationBarIconButton
|
|
@@ -89,7 +87,7 @@ export default () => (
|
|
|
89
87
|
|
|
90
88
|
```js
|
|
91
89
|
import React from 'react';
|
|
92
|
-
import { BpkNavigationBarButtonLink } from 'bpk-component-navigation-bar';
|
|
90
|
+
import { BpkNavigationBarButtonLink } from '@skyscanner/backpack-web/bpk-component-navigation-bar';
|
|
93
91
|
|
|
94
92
|
export default () => (
|
|
95
93
|
<BpkNavigationBarButtonLink onClick={() => {}}>
|
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
npm install bpk-component-nudger --save-dev
|
|
9
|
-
```
|
|
7
|
+
Check the main [Readme](https://github.com/skyscanner/backpack#usage) for a complete installation guide.
|
|
10
8
|
|
|
11
9
|
## Usage
|
|
12
10
|
|
|
@@ -14,8 +12,8 @@ npm install bpk-component-nudger --save-dev
|
|
|
14
12
|
|
|
15
13
|
```js
|
|
16
14
|
import React, { Component } from 'react';
|
|
17
|
-
import BpkLabel from 'bpk-component-label';
|
|
18
|
-
import BpkNudger from 'bpk-component-nudger';
|
|
15
|
+
import BpkLabel from '@skyscanner/backpack-web/bpk-component-label';
|
|
16
|
+
import BpkNudger from '@skyscanner/backpack-web/bpk-component-nudger';
|
|
19
17
|
|
|
20
18
|
class App extends Component {
|
|
21
19
|
constructor() {
|
|
@@ -53,8 +51,8 @@ class App extends Component {
|
|
|
53
51
|
|
|
54
52
|
```js
|
|
55
53
|
import React, { Component } from 'react';
|
|
56
|
-
import BpkLabel from 'bpk-component-label';
|
|
57
|
-
import { BpkConfigurableNudger } from 'bpk-component-nudger';
|
|
54
|
+
import BpkLabel from '@skyscanner/backpack-web/bpk-component-label';
|
|
55
|
+
import { BpkConfigurableNudger } from '@skyscanner/backpack-web/bpk-component-nudger';
|
|
58
56
|
|
|
59
57
|
const options = ['economy', 'premium', 'business', 'first'];
|
|
60
58
|
|
|
@@ -29,6 +29,7 @@ $bpk-spacing-v2: true;
|
|
|
29
29
|
display: inline-block;
|
|
30
30
|
padding: bpk-spacing-md() 0;
|
|
31
31
|
border: none;
|
|
32
|
+
color: $bpk-text-primary-day;
|
|
32
33
|
text-align: center;
|
|
33
34
|
vertical-align: middle;
|
|
34
35
|
|
|
@@ -37,7 +38,7 @@ $bpk-spacing-v2: true;
|
|
|
37
38
|
|
|
38
39
|
&--secondary-on-dark {
|
|
39
40
|
background-color: transparent;
|
|
40
|
-
color: $bpk-text-
|
|
41
|
+
color: $bpk-text-on-dark-day;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
&--numeric {
|
|
@@ -4,16 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
npm install bpk-component-overlay --save-dev
|
|
9
|
-
```
|
|
7
|
+
Check the main [Readme](https://github.com/skyscanner/backpack#usage) for a complete installation guide.
|
|
10
8
|
|
|
11
9
|
## Usage
|
|
12
10
|
|
|
13
11
|
```js
|
|
14
12
|
import React from 'react';
|
|
15
|
-
import BpkText from 'bpk-component-text';
|
|
16
|
-
import BpkOverlay, { BORDER_RADIUS_STYLES, OVERLAY_TYPES } from 'bpk-component-overlay';
|
|
13
|
+
import BpkText from '@skyscanner/backpack-web/bpk-component-text';
|
|
14
|
+
import BpkOverlay, { BORDER_RADIUS_STYLES, OVERLAY_TYPES } from '@skyscanner/backpack-web/bpk-component-overlay';
|
|
17
15
|
|
|
18
16
|
export default () => (
|
|
19
17
|
<div>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# bpk-component-page-indicator
|
|
2
|
+
|
|
3
|
+
> Backpack page indicator component.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Check the main [Readme](https://github.com/skyscanner/backpack#usage) for a complete installation guide.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import BpkPageIndicator from '@skyscanner/backpack-web/bpk-component-page-indicator';
|
|
14
|
+
|
|
15
|
+
export default () =>
|
|
16
|
+
<BpkPageIndicator
|
|
17
|
+
currentIndex={0}
|
|
18
|
+
totalIndicators={7}
|
|
19
|
+
onClick={(e, newIndex, direction) => {
|
|
20
|
+
console.log('Slide to new index:', newIndex);
|
|
21
|
+
console.log('Slide direction:', direction);
|
|
22
|
+
}}
|
|
23
|
+
indicatorLabel='Go to slide'
|
|
24
|
+
prevNavLabel='Previous slide'
|
|
25
|
+
nextNavLabel='Next slide'
|
|
26
|
+
/>;
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Props
|
|
30
|
+
|
|
31
|
+
| Property | PropType | Required | Default Value |
|
|
32
|
+
|-----------------|----------------|----------|-----------------|
|
|
33
|
+
| currentIndex | number | true | - |
|
|
34
|
+
| totalIndicators | number | true | - |
|
|
35
|
+
| indicatorLabel | string | true | - |
|
|
36
|
+
| prevNavLabel | string | true | - |
|
|
37
|
+
| nextNavLabel | string | true | - |
|
|
38
|
+
| className | string | false | null |
|
|
39
|
+
| showNav | bool | false | false |
|
|
40
|
+
| variant | oneOf(VARIANT) | false | VARIANT.default |
|
|
41
|
+
| onClick | func | false | null |
|
|
42
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Backpack - Skyscanner's Design System
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2016 Skyscanner Ltd
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
/* @flow strict */
|
|
19
|
+
|
|
20
|
+
import BpkPageIndicator, {
|
|
21
|
+
type Props as BpkPageIndicatorProps,
|
|
22
|
+
VARIANT,
|
|
23
|
+
} from './src/BpkPageIndicator';
|
|
24
|
+
import { DIRECTIONS } from './src/NavButton';
|
|
25
|
+
|
|
26
|
+
export type { BpkPageIndicatorProps };
|
|
27
|
+
export { DIRECTIONS, VARIANT };
|
|
28
|
+
export default BpkPageIndicator;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Backpack - Skyscanner's Design System
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2016 Skyscanner Ltd
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
/* @flow strict */
|
|
19
|
+
|
|
20
|
+
import React from 'react';
|
|
21
|
+
import PropTypes from 'prop-types';
|
|
22
|
+
|
|
23
|
+
import { cssModules } from '../../bpk-react-utils';
|
|
24
|
+
|
|
25
|
+
import NavButton, { DIRECTIONS } from './NavButton';
|
|
26
|
+
import STYLES from './BpkPageIndicator.module.scss';
|
|
27
|
+
|
|
28
|
+
const getClassName = cssModules(STYLES);
|
|
29
|
+
|
|
30
|
+
const DISPLAYED_TOTAL = 5;
|
|
31
|
+
const START_SCROLL_INDEX = Math.floor(DISPLAYED_TOTAL / 2);
|
|
32
|
+
|
|
33
|
+
export const VARIANT = {
|
|
34
|
+
default: 'default',
|
|
35
|
+
overImage: 'overImage',
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type Props = {
|
|
39
|
+
className: ?string,
|
|
40
|
+
showNav: ?boolean,
|
|
41
|
+
currentIndex: number,
|
|
42
|
+
totalIndicators: number,
|
|
43
|
+
onClick: ?() => void,
|
|
44
|
+
indicatorLabel: string,
|
|
45
|
+
prevNavLabel: string,
|
|
46
|
+
nextNavLabel: string,
|
|
47
|
+
variant: ?$Keys<typeof VARIANT>,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const BpkPageIndicator = ({
|
|
51
|
+
className,
|
|
52
|
+
currentIndex,
|
|
53
|
+
indicatorLabel,
|
|
54
|
+
nextNavLabel,
|
|
55
|
+
onClick,
|
|
56
|
+
prevNavLabel,
|
|
57
|
+
showNav,
|
|
58
|
+
totalIndicators,
|
|
59
|
+
variant,
|
|
60
|
+
}: Props) => (
|
|
61
|
+
// $FlowFixMe[cannot-spread-inexact] - inexact rest. See 'decisions/flowfixme.md'.
|
|
62
|
+
<div className={className}>
|
|
63
|
+
<div
|
|
64
|
+
className={getClassName(
|
|
65
|
+
'bpk-page-indicator',
|
|
66
|
+
showNav && 'bpk-page-indicator__showNav',
|
|
67
|
+
)}
|
|
68
|
+
>
|
|
69
|
+
{showNav && (
|
|
70
|
+
<NavButton
|
|
71
|
+
currentIndex={currentIndex}
|
|
72
|
+
onClick={onClick}
|
|
73
|
+
disabled={currentIndex === 0}
|
|
74
|
+
direction={DIRECTIONS.PREV}
|
|
75
|
+
ariaLabel={prevNavLabel}
|
|
76
|
+
/>
|
|
77
|
+
)}
|
|
78
|
+
<div className={getClassName('bpk-page-indicator__container')}>
|
|
79
|
+
<div
|
|
80
|
+
className={getClassName('bpk-page-indicator__indicators-container')}
|
|
81
|
+
style={
|
|
82
|
+
currentIndex > START_SCROLL_INDEX
|
|
83
|
+
? {
|
|
84
|
+
'--scroll-index':
|
|
85
|
+
totalIndicators > DISPLAYED_TOTAL
|
|
86
|
+
? Math.min(
|
|
87
|
+
currentIndex - START_SCROLL_INDEX,
|
|
88
|
+
totalIndicators - DISPLAYED_TOTAL,
|
|
89
|
+
)
|
|
90
|
+
: 0,
|
|
91
|
+
}
|
|
92
|
+
: undefined
|
|
93
|
+
}
|
|
94
|
+
>
|
|
95
|
+
{[...Array(totalIndicators)].map((val, index) => (
|
|
96
|
+
<button
|
|
97
|
+
type="button"
|
|
98
|
+
onClick={(e) => {
|
|
99
|
+
onClick(e, index, DIRECTIONS.INDICATORS);
|
|
100
|
+
}}
|
|
101
|
+
className={getClassName(
|
|
102
|
+
'bpk-page-indicator__indicator',
|
|
103
|
+
`bpk-page-indicator__indicator--${variant}`,
|
|
104
|
+
index === currentIndex &&
|
|
105
|
+
`bpk-page-indicator__indicator--active-${variant}`,
|
|
106
|
+
)}
|
|
107
|
+
aria-label={`${indicatorLabel} ${index + 1}`}
|
|
108
|
+
aria-current={currentIndex === index ? 'true' : 'false'}
|
|
109
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
110
|
+
key={`indicator-${index}`}
|
|
111
|
+
/>
|
|
112
|
+
))}
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
{showNav && (
|
|
116
|
+
<NavButton
|
|
117
|
+
currentIndex={currentIndex}
|
|
118
|
+
onClick={onClick}
|
|
119
|
+
disabled={currentIndex === totalIndicators - 1}
|
|
120
|
+
ariaLabel={nextNavLabel}
|
|
121
|
+
direction={DIRECTIONS.NEXT}
|
|
122
|
+
/>
|
|
123
|
+
)}
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
BpkPageIndicator.propTypes = {
|
|
129
|
+
indicatorLabel: PropTypes.string.isRequired,
|
|
130
|
+
prevNavLabel: PropTypes.string.isRequired,
|
|
131
|
+
nextNavLabel: PropTypes.string.isRequired,
|
|
132
|
+
currentIndex: PropTypes.number.isRequired,
|
|
133
|
+
totalIndicators: PropTypes.number.isRequired,
|
|
134
|
+
variant: PropTypes.oneOf(Object.keys(VARIANT)),
|
|
135
|
+
onClick: PropTypes.func,
|
|
136
|
+
className: PropTypes.string,
|
|
137
|
+
showNav: PropTypes.bool,
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
BpkPageIndicator.defaultProps = {
|
|
141
|
+
onClick: null,
|
|
142
|
+
className: null,
|
|
143
|
+
showNav: false,
|
|
144
|
+
variant: VARIANT.default,
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export default BpkPageIndicator;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Backpack - Skyscanner's Design System
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2016 Skyscanner Ltd
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
@keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-page-indicator{display:flex}
|