@skyscanner/backpack-web 3.3.0 → 4.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.
Files changed (88) hide show
  1. package/bpk-animate-height/package.json +2 -2
  2. package/bpk-component-accordion/package.json +6 -6
  3. package/bpk-component-aria-live/package.json +7 -7
  4. package/bpk-component-autosuggest/package.json +4 -4
  5. package/bpk-component-badge/package.json +4 -4
  6. package/bpk-component-banner-alert/package.json +8 -8
  7. package/bpk-component-barchart/package.json +7 -7
  8. package/bpk-component-blockquote/package.json +2 -2
  9. package/bpk-component-breadcrumb/package.json +5 -5
  10. package/bpk-component-breakpoint/package.json +2 -2
  11. package/bpk-component-button/package.json +2 -2
  12. package/bpk-component-calendar/package.json +8 -8
  13. package/bpk-component-card/package.json +4 -4
  14. package/bpk-component-checkbox/package.json +4 -4
  15. package/bpk-component-chip/package.json +5 -5
  16. package/bpk-component-close-button/package.json +4 -4
  17. package/bpk-component-code/package.json +2 -2
  18. package/bpk-component-content-container/package.json +2 -2
  19. package/bpk-component-datatable/package.json +3 -3
  20. package/bpk-component-datepicker/package.json +8 -8
  21. package/bpk-component-description-list/package.json +2 -2
  22. package/bpk-component-dialog/package.json +8 -8
  23. package/bpk-component-drawer/package.json +8 -8
  24. package/bpk-component-fieldset/package.json +12 -12
  25. package/bpk-component-flare/package.json +4 -4
  26. package/bpk-component-floating-notification/package.json +4 -4
  27. package/bpk-component-form-validation/package.json +9 -9
  28. package/bpk-component-graphic-promotion/package.json +4 -5
  29. package/bpk-component-graphic-promotion/src/BpkGraphicPromo.js +22 -6
  30. package/bpk-component-graphic-promotion/src/BpkGraphicPromo.module.scss +4 -0
  31. package/bpk-component-grid/package.json +2 -2
  32. package/bpk-component-grid-toggle/package.json +3 -3
  33. package/bpk-component-horizontal-nav/package.json +5 -5
  34. package/bpk-component-icon/package.json +5 -5
  35. package/bpk-component-image/package.json +5 -5
  36. package/bpk-component-infinite-scroll/package.json +6 -6
  37. package/bpk-component-input/package.json +6 -6
  38. package/bpk-component-label/package.json +2 -2
  39. package/bpk-component-link/package.json +3 -3
  40. package/bpk-component-list/package.json +2 -2
  41. package/bpk-component-loading-button/package.json +6 -6
  42. package/bpk-component-map/package.json +6 -6
  43. package/bpk-component-mobile-scroll-container/package.json +2 -2
  44. package/bpk-component-modal/package.json +9 -9
  45. package/bpk-component-modal/src/BpkModal.js +3 -3
  46. package/bpk-component-navigation-bar/package.json +7 -7
  47. package/bpk-component-navigation-stack/package.json +6 -6
  48. package/bpk-component-nudger/package.json +6 -6
  49. package/bpk-component-overlay/package.json +4 -4
  50. package/bpk-component-pagination/package.json +4 -4
  51. package/bpk-component-panel/package.json +2 -2
  52. package/bpk-component-phone-input/package.json +8 -8
  53. package/bpk-component-popover/package.json +8 -8
  54. package/bpk-component-popover/src/BpkPopoverPortal.js +3 -3
  55. package/bpk-component-price/package.json +3 -3
  56. package/bpk-component-progress/package.json +4 -4
  57. package/bpk-component-radio/package.json +3 -3
  58. package/bpk-component-rating/package.json +3 -3
  59. package/bpk-component-rtl-toggle/package.json +3 -3
  60. package/bpk-component-scrollable-calendar/package.json +5 -5
  61. package/bpk-component-section-list/package.json +5 -5
  62. package/bpk-component-select/package.json +3 -3
  63. package/bpk-component-skip-link/package.json +2 -2
  64. package/bpk-component-slider/package.json +3 -3
  65. package/bpk-component-spinner/package.json +2 -2
  66. package/bpk-component-split-input/README.md +42 -0
  67. package/bpk-component-split-input/index.js +27 -0
  68. package/bpk-component-split-input/package.json +24 -0
  69. package/bpk-component-split-input/src/BpkInputField.js +71 -0
  70. package/bpk-component-split-input/src/BpkInputField.module.scss +34 -0
  71. package/bpk-component-split-input/src/BpkSplitInput.js +243 -0
  72. package/bpk-component-split-input/src/BpkSplitInput.module.css +18 -0
  73. package/bpk-component-split-input/src/BpkSplitInput.module.scss +36 -0
  74. package/bpk-component-star-rating/package.json +5 -5
  75. package/bpk-component-switch/package.json +2 -2
  76. package/bpk-component-table/package.json +2 -2
  77. package/bpk-component-text/package.json +2 -2
  78. package/bpk-component-textarea/package.json +4 -4
  79. package/bpk-component-theme-toggle/package.json +4 -4
  80. package/bpk-component-ticket/package.json +4 -4
  81. package/bpk-component-tooltip/package.json +3 -3
  82. package/bpk-component-tooltip/src/BpkTooltipPortal.js +3 -3
  83. package/bpk-react-utils/index.js +3 -0
  84. package/bpk-react-utils/package.json +1 -1
  85. package/bpk-react-utils/src/Portal-v1.js +310 -0
  86. package/bpk-react-utils/src/Portal.js +42 -54
  87. package/bpk-scrim-utils/package.json +2 -2
  88. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-nudger",
3
- "version": "7.0.4",
3
+ "version": "7.0.5",
4
4
  "description": "Backpack nudger component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -15,10 +15,10 @@
15
15
  "gitHead": "f9f94f86d7cfc75e43bc6ad5eb01b23e62a89cc8",
16
16
  "dependencies": {
17
17
  "@skyscanner/bpk-foundations-web": "^8.0.0",
18
- "bpk-component-button": "^6.2.5",
19
- "bpk-component-icon": "^9.2.11",
18
+ "bpk-component-button": "^6.2.6",
19
+ "bpk-component-icon": "^9.2.12",
20
20
  "bpk-mixins": "^31.1.1",
21
- "bpk-react-utils": "^4.1.2",
21
+ "bpk-react-utils": "^5.0.0",
22
22
  "lodash.clamp": "^4.0.3",
23
23
  "prop-types": "^15.7.2"
24
24
  },
@@ -26,7 +26,7 @@
26
26
  "react": "^16.3.0 || ^17.0.0"
27
27
  },
28
28
  "devDependencies": {
29
- "bpk-component-label": "^5.1.10",
30
- "bpk-storybook-utils": "^1.1.9"
29
+ "bpk-component-label": "^5.1.11",
30
+ "bpk-storybook-utils": "^1.1.10"
31
31
  }
32
32
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-overlay",
3
- "version": "2.1.12",
3
+ "version": "2.1.13",
4
4
  "description": "Backpack overlay component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -14,15 +14,15 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "bpk-mixins": "^31.1.1",
17
- "bpk-react-utils": "^4.1.2",
17
+ "bpk-react-utils": "^5.0.0",
18
18
  "prop-types": "^15.5.8"
19
19
  },
20
20
  "peerDependencies": {
21
21
  "react": "^16.3.0 || ^17.0.0"
22
22
  },
23
23
  "devDependencies": {
24
- "bpk-component-image": "^5.1.12",
25
- "bpk-component-text": "^7.0.4"
24
+ "bpk-component-image": "^5.1.13",
25
+ "bpk-component-text": "^7.0.5"
26
26
  },
27
27
  "gitHead": "f9f94f86d7cfc75e43bc6ad5eb01b23e62a89cc8"
28
28
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-pagination",
3
- "version": "4.0.9",
3
+ "version": "4.0.10",
4
4
  "description": "Backpack pagination component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -14,15 +14,15 @@
14
14
  },
15
15
  "gitHead": "f9f94f86d7cfc75e43bc6ad5eb01b23e62a89cc8",
16
16
  "dependencies": {
17
- "bpk-component-button": "^6.2.5",
17
+ "bpk-component-button": "^6.2.6",
18
18
  "bpk-mixins": "^31.1.1",
19
- "bpk-react-utils": "^4.1.2",
19
+ "bpk-react-utils": "^5.0.0",
20
20
  "prop-types": "^15.7.2"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "react": "^16.3.0 || ^17.0.0"
24
24
  },
25
25
  "devDependencies": {
26
- "bpk-component-icon": "^9.2.11"
26
+ "bpk-component-icon": "^9.2.12"
27
27
  }
28
28
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-panel",
3
- "version": "3.1.10",
3
+ "version": "3.1.11",
4
4
  "description": "Backpack panel component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -15,7 +15,7 @@
15
15
  "gitHead": "5c156b97cb0ba5e75851d3c763334578714c895e",
16
16
  "dependencies": {
17
17
  "bpk-mixins": "^31.1.1",
18
- "bpk-react-utils": "^4.1.2",
18
+ "bpk-react-utils": "^5.0.0",
19
19
  "prop-types": "^15.7.2"
20
20
  },
21
21
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-phone-input",
3
- "version": "7.1.16",
3
+ "version": "7.1.18",
4
4
  "description": "Backpack phone input component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -15,19 +15,19 @@
15
15
  "gitHead": "f9f94f86d7cfc75e43bc6ad5eb01b23e62a89cc8",
16
16
  "dependencies": {
17
17
  "@skyscanner/bpk-foundations-web": "^8.0.0",
18
- "bpk-component-input": "^6.1.14",
19
- "bpk-component-label": "^5.1.10",
20
- "bpk-component-select": "^5.1.10",
21
- "bpk-component-text": "^7.0.4",
18
+ "bpk-component-input": "^6.1.16",
19
+ "bpk-component-label": "^5.1.11",
20
+ "bpk-component-select": "^5.1.11",
21
+ "bpk-component-text": "^7.0.5",
22
22
  "bpk-mixins": "^31.1.1",
23
- "bpk-react-utils": "^4.1.2",
23
+ "bpk-react-utils": "^5.0.0",
24
24
  "prop-types": "^15.7.2"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "react": "^16.3.0 || ^17.0.0"
28
28
  },
29
29
  "devDependencies": {
30
- "bpk-component-fieldset": "^4.1.16",
31
- "bpk-component-image": "^5.1.12"
30
+ "bpk-component-fieldset": "^4.1.18",
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.1",
3
+ "version": "5.0.3",
4
4
  "description": "Backpack popover component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -17,19 +17,19 @@
17
17
  "@popperjs/core": "^2.11.5",
18
18
  "a11y-focus-scope": "^1.1.3",
19
19
  "a11y-focus-store": "^1.0.0",
20
- "bpk-component-close-button": "^3.1.11",
21
- "bpk-component-link": "^3.1.10",
22
- "bpk-component-text": "^7.0.4",
20
+ "bpk-component-close-button": "^3.1.12",
21
+ "bpk-component-link": "^3.1.11",
22
+ "bpk-component-text": "^7.0.5",
23
23
  "bpk-mixins": "^31.1.1",
24
- "bpk-react-utils": "^4.1.2",
24
+ "bpk-react-utils": "^5.0.0",
25
25
  "prop-types": "^15.7.2"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "react": "^16.3.0 || ^17.0.0"
29
29
  },
30
30
  "devDependencies": {
31
- "bpk-component-button": "^6.2.5",
32
- "bpk-component-content-container": "^5.0.4",
33
- "bpk-component-input": "^6.1.14"
31
+ "bpk-component-button": "^6.2.6",
32
+ "bpk-component-content-container": "^5.0.5",
33
+ "bpk-component-input": "^6.1.16"
34
34
  }
35
35
  }
@@ -23,7 +23,7 @@ import PropTypes from 'prop-types';
23
23
  import React, { Component, type Node } from 'react';
24
24
  import focusStore from 'a11y-focus-store';
25
25
 
26
- import { Portal, cssModules } from '../../bpk-react-utils';
26
+ import { PortalV1, cssModules } from '../../bpk-react-utils';
27
27
 
28
28
  import keyboardFocusScope from './keyboardFocusScope';
29
29
  import STYLES from './BpkPopover.module.scss';
@@ -217,7 +217,7 @@ class BpkPopoverPortal extends Component<Props> {
217
217
  }
218
218
 
219
219
  return (
220
- <Portal
220
+ <PortalV1
221
221
  beforeClose={this.beforeClose}
222
222
  className={classNames.join(' ')}
223
223
  isOpen={isOpen}
@@ -229,7 +229,7 @@ class BpkPopoverPortal extends Component<Props> {
229
229
  >
230
230
  {/* $FlowFixMe[cannot-spread-inexact] - inexact rest. See 'decisions/flowfixme.md'. */}
231
231
  <BpkPopover onClose={this.onClose} {...rest} />
232
- </Portal>
232
+ </PortalV1>
233
233
  );
234
234
  }
235
235
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-price",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Backpack price component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -13,9 +13,9 @@
13
13
  "registry": "https://registry.npmjs.org/"
14
14
  },
15
15
  "dependencies": {
16
- "bpk-component-text": "^7.0.4",
16
+ "bpk-component-text": "^7.0.5",
17
17
  "bpk-mixins": "^31.1.1",
18
- "bpk-react-utils": "^4.1.2",
18
+ "bpk-react-utils": "^5.0.0",
19
19
  "prop-types": "^15.5.8"
20
20
  },
21
21
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-progress",
3
- "version": "3.1.10",
3
+ "version": "3.1.11",
4
4
  "description": "Backpack progress bar component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -16,7 +16,7 @@
16
16
  "dependencies": {
17
17
  "@skyscanner/bpk-foundations-web": "^8.0.0",
18
18
  "bpk-mixins": "^31.1.1",
19
- "bpk-react-utils": "^4.1.2",
19
+ "bpk-react-utils": "^5.0.0",
20
20
  "lodash.clamp": "^4.0.3",
21
21
  "prop-types": "^15.7.2"
22
22
  },
@@ -24,7 +24,7 @@
24
24
  "react": "^16.3.0 || ^17.0.0"
25
25
  },
26
26
  "devDependencies": {
27
- "bpk-component-button": "^6.2.5",
28
- "bpk-storybook-utils": "^1.1.9"
27
+ "bpk-component-button": "^6.2.6",
28
+ "bpk-storybook-utils": "^1.1.10"
29
29
  }
30
30
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-radio",
3
- "version": "3.1.11",
3
+ "version": "3.1.12",
4
4
  "description": "Backpack radio button component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -15,7 +15,7 @@
15
15
  "gitHead": "5c156b97cb0ba5e75851d3c763334578714c895e",
16
16
  "dependencies": {
17
17
  "bpk-mixins": "^31.1.1",
18
- "bpk-react-utils": "^4.1.2",
18
+ "bpk-react-utils": "^5.0.0",
19
19
  "prop-types": "^15.7.2"
20
20
  },
21
21
  "peerDependencies": {
@@ -23,6 +23,6 @@
23
23
  },
24
24
  "devDependencies": {
25
25
  "@skyscanner/bpk-foundations-web": "^8.0.0",
26
- "bpk-storybook-utils": "^1.1.9"
26
+ "bpk-storybook-utils": "^1.1.10"
27
27
  }
28
28
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-rating",
3
- "version": "5.0.1",
3
+ "version": "5.0.2",
4
4
  "description": "Backpack rating component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -15,7 +15,7 @@
15
15
  "gitHead": "f9f94f86d7cfc75e43bc6ad5eb01b23e62a89cc8",
16
16
  "dependencies": {
17
17
  "bpk-mixins": "^31.1.1",
18
- "bpk-react-utils": "^4.1.2",
18
+ "bpk-react-utils": "^5.0.0",
19
19
  "lodash.clamp": "^4.0.3",
20
20
  "prop-types": "^15.5.8"
21
21
  },
@@ -24,6 +24,6 @@
24
24
  },
25
25
  "devDependencies": {
26
26
  "@skyscanner/bpk-foundations-web": "^8.0.0",
27
- "bpk-component-text": "^7.0.4"
27
+ "bpk-component-text": "^7.0.5"
28
28
  }
29
29
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-rtl-toggle",
3
- "version": "3.1.10",
3
+ "version": "3.1.11",
4
4
  "description": "Backpack RTL toggle component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -14,8 +14,8 @@
14
14
  },
15
15
  "gitHead": "5c156b97cb0ba5e75851d3c763334578714c895e",
16
16
  "dependencies": {
17
- "bpk-component-link": "^3.1.10",
18
- "bpk-react-utils": "^4.1.2",
17
+ "bpk-component-link": "^3.1.11",
18
+ "bpk-react-utils": "^5.0.0",
19
19
  "prop-types": "^15.7.2"
20
20
  },
21
21
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-scrollable-calendar",
3
- "version": "6.1.17",
3
+ "version": "6.1.19",
4
4
  "description": "Backpack scrollable calendar component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -15,16 +15,16 @@
15
15
  "gitHead": "4e4ec9add28e1db54d6a38a10c331bbd163f2926",
16
16
  "dependencies": {
17
17
  "@skyscanner/bpk-foundations-web": "^8.0.0",
18
- "bpk-component-calendar": "^11.1.16",
19
- "bpk-component-text": "^7.0.4",
18
+ "bpk-component-calendar": "^11.1.18",
19
+ "bpk-component-text": "^7.0.5",
20
20
  "bpk-mixins": "^31.1.1",
21
- "bpk-react-utils": "^4.1.2",
21
+ "bpk-react-utils": "^5.0.0",
22
22
  "date-fns": "^2.21.1",
23
23
  "prop-types": "^15.5.8",
24
24
  "react-virtualized": "^9.22.3"
25
25
  },
26
26
  "devDependencies": {
27
- "bpk-storybook-utils": "^1.1.9"
27
+ "bpk-storybook-utils": "^1.1.10"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "react": "^16.3.0 || ^17.0.0"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-section-list",
3
- "version": "3.2.11",
3
+ "version": "3.2.12",
4
4
  "description": "Backpack section list component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -15,14 +15,14 @@
15
15
  "gitHead": "f9f94f86d7cfc75e43bc6ad5eb01b23e62a89cc8",
16
16
  "dependencies": {
17
17
  "@skyscanner/bpk-foundations-web": "^8.0.0",
18
- "bpk-component-icon": "^9.2.11",
19
- "bpk-component-text": "^7.0.4",
18
+ "bpk-component-icon": "^9.2.12",
19
+ "bpk-component-text": "^7.0.5",
20
20
  "bpk-mixins": "^31.1.1",
21
- "bpk-react-utils": "^4.1.2",
21
+ "bpk-react-utils": "^5.0.0",
22
22
  "prop-types": "^15.7.2"
23
23
  },
24
24
  "devDependencies": {
25
- "bpk-storybook-utils": "^1.1.9"
25
+ "bpk-storybook-utils": "^1.1.10"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "react": "^16.3.0 || ^17.0.0"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-select",
3
- "version": "5.1.10",
3
+ "version": "5.1.11",
4
4
  "description": "Backpack select component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -15,11 +15,11 @@
15
15
  "gitHead": "5c156b97cb0ba5e75851d3c763334578714c895e",
16
16
  "dependencies": {
17
17
  "bpk-mixins": "^31.1.1",
18
- "bpk-react-utils": "^4.1.2",
18
+ "bpk-react-utils": "^5.0.0",
19
19
  "prop-types": "^15.7.2"
20
20
  },
21
21
  "devDependencies": {
22
- "bpk-storybook-utils": "^1.1.9"
22
+ "bpk-storybook-utils": "^1.1.10"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "react": "^16.3.0 || ^17.0.0"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-skip-link",
3
- "version": "2.1.10",
3
+ "version": "2.1.11",
4
4
  "description": "Backpack skip-link component.",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "bpk-mixins": "^31.1.1",
17
- "bpk-react-utils": "^4.1.2",
17
+ "bpk-react-utils": "^5.0.0",
18
18
  "prop-types": "^15.5.8"
19
19
  },
20
20
  "publishConfig": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-slider",
3
- "version": "3.1.10",
3
+ "version": "3.1.11",
4
4
  "description": "Backpack slider component.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -16,7 +16,7 @@
16
16
  "dependencies": {
17
17
  "@skyscanner/bpk-foundations-web": "^8.0.0",
18
18
  "bpk-mixins": "^31.1.1",
19
- "bpk-react-utils": "^4.1.2",
19
+ "bpk-react-utils": "^5.0.0",
20
20
  "prop-types": "^15.7.2",
21
21
  "react-slider": "^1.3.1"
22
22
  },
@@ -24,6 +24,6 @@
24
24
  "react": "^16.3.0 || ^17.0.0"
25
25
  },
26
26
  "devDependencies": {
27
- "bpk-component-rtl-toggle": "^3.1.10"
27
+ "bpk-component-rtl-toggle": "^3.1.11"
28
28
  }
29
29
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpk-component-spinner",
3
- "version": "5.1.10",
3
+ "version": "5.1.11",
4
4
  "description": "Backpack spinner components.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -16,7 +16,7 @@
16
16
  "dependencies": {
17
17
  "@skyscanner/bpk-svgs": "^14.1.9",
18
18
  "bpk-mixins": "^31.1.1",
19
- "bpk-react-utils": "^4.1.2",
19
+ "bpk-react-utils": "^5.0.0",
20
20
  "prop-types": "^15.7.2"
21
21
  },
22
22
  "peerDependencies": {
@@ -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;
@@ -0,0 +1,34 @@
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
+ /* stylelint-disable */
19
+ @import '~bpk-mixins';
20
+
21
+ .BpkInputField {
22
+ display: flex;
23
+ max-width: 3*bpk-spacing-xxl();
24
+ margin-right: bpk-spacing-xs();
25
+ align-items: center;
26
+
27
+ input {
28
+ text-align: center;
29
+ }
30
+ }
31
+
32
+ .BpkInputField:last-child {
33
+ margin-right: $bpk-spacing-none;
34
+ }