@skyscanner/backpack-web 4.0.0 → 5.0.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-component-aria-live/package.json +3 -3
- package/bpk-component-autosuggest/package.json +2 -2
- package/bpk-component-banner-alert/package.json +2 -2
- package/bpk-component-calendar/package.json +2 -2
- package/bpk-component-chip/package.json +2 -2
- package/bpk-component-datepicker/package.json +5 -5
- package/bpk-component-fieldset/package.json +6 -6
- package/bpk-component-form-validation/package.json +2 -2
- package/bpk-component-input/package.json +2 -2
- package/bpk-component-modal/package.json +1 -1
- package/bpk-component-modal/src/BpkModal.js +3 -3
- package/bpk-component-phone-input/package.json +3 -3
- package/bpk-component-popover/package.json +2 -2
- package/bpk-component-price/README.md +4 -2
- package/bpk-component-price/index.js +3 -2
- package/bpk-component-price/package.json +1 -1
- package/bpk-component-price/src/BpkPrice.js +16 -12
- package/bpk-component-price/src/BpkPrice.module.scss +16 -10
- package/bpk-component-price/src/common-types.js +29 -0
- package/bpk-component-scrollable-calendar/package.json +2 -2
- package/bpk-component-split-input/README.md +42 -0
- package/bpk-component-split-input/index.js +27 -0
- package/bpk-component-split-input/package.json +24 -0
- package/bpk-component-split-input/src/BpkInputField.js +71 -0
- package/bpk-component-split-input/src/BpkInputField.module.scss +34 -0
- package/bpk-component-split-input/src/BpkSplitInput.js +243 -0
- package/bpk-component-split-input/src/BpkSplitInput.module.css +18 -0
- package/bpk-component-split-input/src/BpkSplitInput.module.scss +36 -0
- package/bpk-component-star-rating/package.json +1 -1
- package/bpk-component-ticket/README.md +0 -1
- package/bpk-component-ticket/package.json +1 -1
- package/bpk-component-ticket/src/BpkTicket.js +0 -40
- package/bpk-component-ticket/src/BpkTicket.module.scss +13 -165
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpk-component-aria-live",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.18",
|
|
4
4
|
"description": "Backpack aria-live component.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"prop-types": "^15.5.8"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"bpk-component-chip": "^5.2.
|
|
21
|
+
"bpk-component-chip": "^5.2.16",
|
|
22
22
|
"bpk-component-code": "^3.1.11",
|
|
23
|
-
"bpk-component-fieldset": "^4.1.
|
|
23
|
+
"bpk-component-fieldset": "^4.1.18",
|
|
24
24
|
"bpk-component-select": "^5.1.11",
|
|
25
25
|
"bpk-component-switch": "^2.1.12"
|
|
26
26
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpk-component-autosuggest",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.16",
|
|
4
4
|
"description": "Backpack autosuggest component.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"gitHead": "4e4ec9add28e1db54d6a38a10c331bbd163f2926",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"bpk-component-input": "^6.1.
|
|
17
|
+
"bpk-component-input": "^6.1.16",
|
|
18
18
|
"bpk-mixins": "^31.1.1",
|
|
19
19
|
"bpk-react-utils": "^5.0.0",
|
|
20
20
|
"prop-types": "^15.7.2",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpk-component-banner-alert",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.16",
|
|
4
4
|
"description": "Backpack banner alert component.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"react-transition-group": "^2.5.3"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"bpk-component-aria-live": "^2.1.
|
|
27
|
+
"bpk-component-aria-live": "^2.1.18",
|
|
28
28
|
"bpk-component-button": "^6.2.6",
|
|
29
29
|
"bpk-storybook-utils": "^1.1.10"
|
|
30
30
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpk-component-calendar",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.18",
|
|
4
4
|
"description": "Backpack calendar component.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"gitHead": "4e4ec9add28e1db54d6a38a10c331bbd163f2926",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@skyscanner/bpk-foundations-web": "^8.0.0",
|
|
18
|
-
"bpk-component-aria-live": "^2.1.
|
|
18
|
+
"bpk-component-aria-live": "^2.1.18",
|
|
19
19
|
"bpk-component-icon": "^9.2.12",
|
|
20
20
|
"bpk-component-select": "^5.1.11",
|
|
21
21
|
"bpk-mixins": "^31.1.1",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpk-component-chip",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.16",
|
|
4
4
|
"description": "Backpack chip component.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"react": "^16.3.0 || ^17.0.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"bpk-component-aria-live": "^2.1.
|
|
26
|
+
"bpk-component-aria-live": "^2.1.18",
|
|
27
27
|
"bpk-component-text": "^7.0.5"
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpk-component-datepicker",
|
|
3
|
-
"version": "15.2.
|
|
3
|
+
"version": "15.2.18",
|
|
4
4
|
"description": "Backpack datepicker component.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"gitHead": "f9f94f86d7cfc75e43bc6ad5eb01b23e62a89cc8",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"bpk-component-breakpoint": "^4.0.3",
|
|
18
|
-
"bpk-component-calendar": "^11.1.
|
|
19
|
-
"bpk-component-input": "^6.1.
|
|
20
|
-
"bpk-component-modal": "^4.0.
|
|
21
|
-
"bpk-component-popover": "^5.0.
|
|
18
|
+
"bpk-component-calendar": "^11.1.18",
|
|
19
|
+
"bpk-component-input": "^6.1.16",
|
|
20
|
+
"bpk-component-modal": "^4.0.1",
|
|
21
|
+
"bpk-component-popover": "^5.0.3",
|
|
22
22
|
"bpk-mixins": "^31.1.1",
|
|
23
23
|
"bpk-react-utils": "^5.0.0",
|
|
24
24
|
"prop-types": "^15.7.2"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpk-component-fieldset",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.18",
|
|
4
4
|
"description": "Backpack fieldset component.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"gitHead": "4e4ec9add28e1db54d6a38a10c331bbd163f2926",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"bpk-component-form-validation": "^4.2.
|
|
17
|
+
"bpk-component-form-validation": "^4.2.16",
|
|
18
18
|
"bpk-component-label": "^5.1.11",
|
|
19
19
|
"bpk-mixins": "^31.1.1",
|
|
20
20
|
"bpk-react-utils": "^5.0.0",
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"react": "^16.3.0 || ^17.0.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"bpk-component-autosuggest": "^6.1.
|
|
27
|
+
"bpk-component-autosuggest": "^6.1.16",
|
|
28
28
|
"bpk-component-button": "^6.2.6",
|
|
29
|
-
"bpk-component-calendar": "^11.1.
|
|
29
|
+
"bpk-component-calendar": "^11.1.18",
|
|
30
30
|
"bpk-component-checkbox": "^4.1.13",
|
|
31
|
-
"bpk-component-datepicker": "^15.2.
|
|
32
|
-
"bpk-component-input": "^6.1.
|
|
31
|
+
"bpk-component-datepicker": "^15.2.18",
|
|
32
|
+
"bpk-component-input": "^6.1.16",
|
|
33
33
|
"bpk-component-select": "^5.1.11",
|
|
34
34
|
"bpk-component-textarea": "^4.2.11"
|
|
35
35
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpk-component-form-validation",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.16",
|
|
4
4
|
"description": "Backpack form-validation component.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"bpk-component-button": "^6.2.6",
|
|
28
28
|
"bpk-component-checkbox": "^4.1.13",
|
|
29
29
|
"bpk-component-icon": "^9.2.12",
|
|
30
|
-
"bpk-component-input": "^6.1.
|
|
30
|
+
"bpk-component-input": "^6.1.16",
|
|
31
31
|
"bpk-component-select": "^5.1.11",
|
|
32
32
|
"bpk-component-textarea": "^4.2.11"
|
|
33
33
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpk-component-input",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.16",
|
|
4
4
|
"description": "Backpack input component.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"react": "^16.3.0 || ^17.0.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"bpk-component-banner-alert": "^6.1.
|
|
26
|
+
"bpk-component-banner-alert": "^6.1.16",
|
|
27
27
|
"bpk-component-label": "^5.1.11",
|
|
28
28
|
"bpk-storybook-utils": "^1.1.10"
|
|
29
29
|
}
|
|
@@ -22,7 +22,7 @@ import PropTypes from 'prop-types';
|
|
|
22
22
|
import React, { type Element } from 'react';
|
|
23
23
|
|
|
24
24
|
import { withScrim } from '../../bpk-scrim-utils';
|
|
25
|
-
import {
|
|
25
|
+
import { PortalV1, cssModules, isDeviceIphone } from '../../bpk-react-utils';
|
|
26
26
|
|
|
27
27
|
import STYLES from './BpkModal.module.scss';
|
|
28
28
|
import BpkModalInner, {
|
|
@@ -79,7 +79,7 @@ const BpkModal = (props: Props) => {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
return (
|
|
82
|
-
<
|
|
82
|
+
<PortalV1
|
|
83
83
|
isOpen={isOpen}
|
|
84
84
|
onClose={onClose}
|
|
85
85
|
target={target}
|
|
@@ -96,7 +96,7 @@ const BpkModal = (props: Props) => {
|
|
|
96
96
|
isIphone={isIphone}
|
|
97
97
|
{...rest}
|
|
98
98
|
/>
|
|
99
|
-
</
|
|
99
|
+
</PortalV1>
|
|
100
100
|
);
|
|
101
101
|
};
|
|
102
102
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpk-component-phone-input",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.18",
|
|
4
4
|
"description": "Backpack phone input component.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"gitHead": "f9f94f86d7cfc75e43bc6ad5eb01b23e62a89cc8",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@skyscanner/bpk-foundations-web": "^8.0.0",
|
|
18
|
-
"bpk-component-input": "^6.1.
|
|
18
|
+
"bpk-component-input": "^6.1.16",
|
|
19
19
|
"bpk-component-label": "^5.1.11",
|
|
20
20
|
"bpk-component-select": "^5.1.11",
|
|
21
21
|
"bpk-component-text": "^7.0.5",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"react": "^16.3.0 || ^17.0.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"bpk-component-fieldset": "^4.1.
|
|
30
|
+
"bpk-component-fieldset": "^4.1.18",
|
|
31
31
|
"bpk-component-image": "^5.1.13"
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpk-component-popover",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.3",
|
|
4
4
|
"description": "Backpack popover component.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -30,6 +30,6 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"bpk-component-button": "^6.2.6",
|
|
32
32
|
"bpk-component-content-container": "^5.0.5",
|
|
33
|
-
"bpk-component-input": "^6.1.
|
|
33
|
+
"bpk-component-input": "^6.1.16"
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -12,14 +12,15 @@ npm install bpk-component-price --save-dev
|
|
|
12
12
|
|
|
13
13
|
```js
|
|
14
14
|
import React from 'react';
|
|
15
|
-
import BpkPrice, { SIZES } from 'bpk-component-price';
|
|
15
|
+
import BpkPrice, { SIZES, ALIGNS } from 'bpk-component-price';
|
|
16
16
|
|
|
17
17
|
export default () => (
|
|
18
18
|
<BpkPrice
|
|
19
19
|
size={SIZES.large}
|
|
20
|
+
align={ALIGNS.left}
|
|
20
21
|
subtitle="£209"
|
|
21
22
|
title="£1,830"
|
|
22
|
-
description="
|
|
23
|
+
description="a night"
|
|
23
24
|
/>
|
|
24
25
|
);
|
|
25
26
|
```
|
|
@@ -30,6 +31,7 @@ export default () => (
|
|
|
30
31
|
| --------- | -------- | -------- | ------------- |
|
|
31
32
|
| title | string | true | - |
|
|
32
33
|
| size | oneOf(SIZES) | false | SIZES.small |
|
|
34
|
+
| align | oneOf(ALIGNS) | false | ALIGNS.left |
|
|
33
35
|
| subtitle | string | false | null |
|
|
34
36
|
| description | string | false | null |
|
|
35
37
|
| className | string | false | null |
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
*/
|
|
18
18
|
/* @flow strict */
|
|
19
19
|
|
|
20
|
-
import BpkPrice
|
|
20
|
+
import BpkPrice from './src/BpkPrice';
|
|
21
|
+
import { SIZES, ALIGNS } from './src/common-types';
|
|
21
22
|
|
|
22
23
|
export default BpkPrice;
|
|
23
|
-
export { SIZES };
|
|
24
|
+
export { SIZES, ALIGNS };
|
|
@@ -24,15 +24,12 @@ import { cssModules } from '../../bpk-react-utils';
|
|
|
24
24
|
import BpkText, { TEXT_STYLES } from '../../bpk-component-text';
|
|
25
25
|
|
|
26
26
|
import STYLES from './BpkPrice.module.scss';
|
|
27
|
-
|
|
28
|
-
export const SIZES = {
|
|
29
|
-
small: 'small',
|
|
30
|
-
large: 'large',
|
|
31
|
-
};
|
|
27
|
+
import { SIZES, ALIGNS } from './common-types';
|
|
32
28
|
|
|
33
29
|
type Props = {
|
|
34
30
|
title: string,
|
|
35
31
|
size: $Values<typeof SIZES>,
|
|
32
|
+
align: $Values<typeof ALIGNS>,
|
|
36
33
|
className: ?string,
|
|
37
34
|
subtitle: ?string,
|
|
38
35
|
description: ?string,
|
|
@@ -41,15 +38,17 @@ type Props = {
|
|
|
41
38
|
const getClassName = cssModules(STYLES);
|
|
42
39
|
|
|
43
40
|
const BpkPrice = (props: Props) => {
|
|
44
|
-
const { className, description, size, subtitle, title, ...rest } =
|
|
41
|
+
const { align, className, description, size, subtitle, title, ...rest } =
|
|
42
|
+
props;
|
|
45
43
|
|
|
46
44
|
const isSmall = size === SIZES.small;
|
|
45
|
+
const isAlignRight = align === ALIGNS.right;
|
|
47
46
|
|
|
48
47
|
return (
|
|
49
48
|
<div
|
|
50
49
|
className={getClassName(
|
|
51
50
|
'bpk-price',
|
|
52
|
-
|
|
51
|
+
isAlignRight && 'bpk-price--right',
|
|
53
52
|
className,
|
|
54
53
|
)}
|
|
55
54
|
// $FlowFixMe[cannot-spread-inexact] - inexact rest. See 'decisions/flowfixme.md'.
|
|
@@ -64,9 +63,15 @@ const BpkPrice = (props: Props) => {
|
|
|
64
63
|
{subtitle}
|
|
65
64
|
</BpkText>
|
|
66
65
|
)}
|
|
67
|
-
<div
|
|
66
|
+
<div
|
|
67
|
+
className={isAlignRight && getClassName('bpk-price__column-container')}
|
|
68
|
+
>
|
|
68
69
|
<BpkText
|
|
69
70
|
textStyle={isSmall ? TEXT_STYLES.heading4 : TEXT_STYLES.xxl}
|
|
71
|
+
className={getClassName(
|
|
72
|
+
'bpk-price__title',
|
|
73
|
+
!isAlignRight && 'bpk-price__spacing',
|
|
74
|
+
)}
|
|
70
75
|
tagName="span"
|
|
71
76
|
>
|
|
72
77
|
{title}
|
|
@@ -75,10 +80,7 @@ const BpkPrice = (props: Props) => {
|
|
|
75
80
|
<BpkText
|
|
76
81
|
textStyle={isSmall ? TEXT_STYLES.xs : TEXT_STYLES.sm}
|
|
77
82
|
tagName="span"
|
|
78
|
-
className={getClassName(
|
|
79
|
-
'bpk-price__description',
|
|
80
|
-
!isSmall && 'bpk-price__descriptionSpacing',
|
|
81
|
-
)}
|
|
83
|
+
className={getClassName('bpk-price__description')}
|
|
82
84
|
>
|
|
83
85
|
{description}
|
|
84
86
|
</BpkText>
|
|
@@ -91,6 +93,7 @@ const BpkPrice = (props: Props) => {
|
|
|
91
93
|
BpkPrice.propTypes = {
|
|
92
94
|
title: PropTypes.string.isRequired,
|
|
93
95
|
size: PropTypes.oneOf(Object.keys(SIZES)),
|
|
96
|
+
align: PropTypes.oneOf(Object.keys(ALIGNS)),
|
|
94
97
|
className: PropTypes.string,
|
|
95
98
|
subtitle: PropTypes.string,
|
|
96
99
|
description: PropTypes.string,
|
|
@@ -98,6 +101,7 @@ BpkPrice.propTypes = {
|
|
|
98
101
|
|
|
99
102
|
BpkPrice.defaultProps = {
|
|
100
103
|
size: SIZES.small,
|
|
104
|
+
align: ALIGNS.left,
|
|
101
105
|
className: null,
|
|
102
106
|
subtitle: null,
|
|
103
107
|
description: null,
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
display: flex;
|
|
23
23
|
flex-direction: column;
|
|
24
24
|
|
|
25
|
-
&--
|
|
25
|
+
&--right {
|
|
26
26
|
text-align: right;
|
|
27
27
|
|
|
28
28
|
@include bpk-rtl {
|
|
@@ -35,21 +35,27 @@
|
|
|
35
35
|
text-decoration-line: line-through;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
&
|
|
38
|
+
&__column-container {
|
|
39
39
|
display: flex;
|
|
40
40
|
flex-direction: column;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
&
|
|
44
|
-
|
|
43
|
+
&__title {
|
|
44
|
+
word-break: break-all;
|
|
45
|
+
}
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
&__spacing::after {
|
|
48
|
+
content: '';
|
|
49
|
+
margin-right: bpk-spacing-sm();
|
|
48
50
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
51
|
+
@include bpk-rtl {
|
|
52
|
+
margin-right: unset;
|
|
53
|
+
margin-left: bpk-spacing-sm();
|
|
53
54
|
}
|
|
54
55
|
}
|
|
56
|
+
|
|
57
|
+
&__description {
|
|
58
|
+
color: $bpk-color-sky-gray-tint-02;
|
|
59
|
+
white-space: nowrap;
|
|
60
|
+
}
|
|
55
61
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
|
|
19
|
+
/* @flow strict */
|
|
20
|
+
|
|
21
|
+
export const SIZES = {
|
|
22
|
+
small: 'small',
|
|
23
|
+
large: 'large',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const ALIGNS = {
|
|
27
|
+
left: 'left',
|
|
28
|
+
right: 'right',
|
|
29
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bpk-component-scrollable-calendar",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.19",
|
|
4
4
|
"description": "Backpack scrollable calendar component.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"gitHead": "4e4ec9add28e1db54d6a38a10c331bbd163f2926",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@skyscanner/bpk-foundations-web": "^8.0.0",
|
|
18
|
-
"bpk-component-calendar": "^11.1.
|
|
18
|
+
"bpk-component-calendar": "^11.1.18",
|
|
19
19
|
"bpk-component-text": "^7.0.5",
|
|
20
20
|
"bpk-mixins": "^31.1.1",
|
|
21
21
|
"bpk-react-utils": "^5.0.0",
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# bpk-component-split-input
|
|
2
|
+
|
|
3
|
+
> Backpack split-input component.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install bpk-component-split-input --save-dev
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
import React from 'react';
|
|
15
|
+
import BpkSplitInput, { INPUT_TYPES } from 'bpk-component-split-input';
|
|
16
|
+
|
|
17
|
+
export default () => (
|
|
18
|
+
<BpkSplitInput
|
|
19
|
+
type={INPUT_TYPES.number}
|
|
20
|
+
name="otpInput"
|
|
21
|
+
id="otpInput"
|
|
22
|
+
label="otp input"
|
|
23
|
+
onChange={(e) => console.log('On Input Change')}
|
|
24
|
+
onSubmit={(e) => console.log('On Submit')}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Props
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
| Property | PropType | Required | Default Value |
|
|
33
|
+
| ---------------- | -------------------------- | ------------------- | ------------------------ |
|
|
34
|
+
| id | string | true | - |
|
|
35
|
+
| name | string | true | - |
|
|
36
|
+
| type | INPUT_TYPES (one of) | false | INPUT_TYPES.number |
|
|
37
|
+
| inputLength | number | false | 4 |
|
|
38
|
+
| placeholder | string | false | - |
|
|
39
|
+
| label | string | true | - |
|
|
40
|
+
| large | bool | false | true |
|
|
41
|
+
| onChange | bool | true | - |
|
|
42
|
+
| onSubmit | bool | true | - |
|
|
@@ -0,0 +1,27 @@
|
|
|
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 BpkSplitInput, {
|
|
21
|
+
type Props as BpkSplitInputProps,
|
|
22
|
+
INPUT_TYPES,
|
|
23
|
+
} from './src/BpkSplitInput';
|
|
24
|
+
|
|
25
|
+
export type { BpkSplitInputProps };
|
|
26
|
+
export { INPUT_TYPES };
|
|
27
|
+
export default BpkSplitInput;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "bpk-component-split-input",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Backpack split-input component.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git@github.com:Skyscanner/backpack.git"
|
|
9
|
+
},
|
|
10
|
+
"author": "Backpack Design System <backpack@skyscanner.net>",
|
|
11
|
+
"main": "index.js",
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"registry": "https://registry.npmjs.org/"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"bpk-component-input": "^6.1.16",
|
|
17
|
+
"bpk-mixins": "^31.1.1",
|
|
18
|
+
"bpk-react-utils": "^5.0.0",
|
|
19
|
+
"prop-types": "^15.5.8"
|
|
20
|
+
},
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"react": "^16.3.0 || ^17.0.0"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
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, { Component } from 'react';
|
|
21
|
+
import PropTypes from 'prop-types';
|
|
22
|
+
|
|
23
|
+
import BpkInput from '../../bpk-component-input';
|
|
24
|
+
import { cssModules } from '../../bpk-react-utils';
|
|
25
|
+
|
|
26
|
+
import STYLES from './BpkInputField.module.scss';
|
|
27
|
+
|
|
28
|
+
const getClassName = cssModules(STYLES);
|
|
29
|
+
|
|
30
|
+
class BpkInputField extends Component {
|
|
31
|
+
componentDidUpdate(prevProps) {
|
|
32
|
+
const { focus } = this.props;
|
|
33
|
+
if (prevProps.focus !== focus && this.input && focus) {
|
|
34
|
+
this.input.focus();
|
|
35
|
+
this.input.select();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
render() {
|
|
40
|
+
const { focus, id, index, label, value, ...rest } = this.props;
|
|
41
|
+
return (
|
|
42
|
+
<div key={index} className={getClassName('BpkInputField')}>
|
|
43
|
+
<BpkInput
|
|
44
|
+
id={id}
|
|
45
|
+
autoComplete="off"
|
|
46
|
+
maxLength="1"
|
|
47
|
+
aria-label={`${label} ${index}`}
|
|
48
|
+
inputRef={(input) => {
|
|
49
|
+
this.input = input;
|
|
50
|
+
}}
|
|
51
|
+
value={value || ''}
|
|
52
|
+
{...rest}
|
|
53
|
+
/>
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
BpkInputField.propTypes = {
|
|
60
|
+
id: PropTypes.string.isRequired,
|
|
61
|
+
label: PropTypes.string.isRequired,
|
|
62
|
+
value: PropTypes.string,
|
|
63
|
+
focus: PropTypes.bool.isRequired,
|
|
64
|
+
index: PropTypes.number.isRequired,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
BpkInputField.defaultProps = {
|
|
68
|
+
value: '',
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export default BpkInputField;
|