@skyscanner/backpack-web 0.0.1 → 0.0.2

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 (84) hide show
  1. package/README.md +100 -0
  2. package/bpk-component-accordion/package.json +4 -4
  3. package/bpk-component-accordion/src/BpkAccordionItem.js +1 -1
  4. package/bpk-component-aria-live/package.json +3 -3
  5. package/bpk-component-autosuggest/package.json +3 -3
  6. package/bpk-component-badge/package.json +2 -2
  7. package/bpk-component-banner-alert/package.json +4 -4
  8. package/bpk-component-barchart/examples.js +2 -2
  9. package/bpk-component-barchart/package.json +2 -2
  10. package/bpk-component-breadcrumb/package.json +3 -3
  11. package/bpk-component-calendar/package.json +4 -4
  12. package/bpk-component-card/examples.js +1 -1
  13. package/bpk-component-card/package.json +2 -2
  14. package/bpk-component-checkbox/package.json +2 -2
  15. package/bpk-component-chip/examples.js +4 -5
  16. package/bpk-component-chip/package.json +4 -4
  17. package/bpk-component-chip/src/BpkSelectableChip.js +1 -1
  18. package/bpk-component-close-button/package.json +2 -2
  19. package/bpk-component-datatable/package.json +2 -2
  20. package/bpk-component-datepicker/package.json +5 -5
  21. package/bpk-component-dialog/examples.js +2 -2
  22. package/bpk-component-dialog/package.json +5 -5
  23. package/bpk-component-drawer/examples.js +2 -2
  24. package/bpk-component-drawer/package.json +4 -4
  25. package/bpk-component-fieldset/package.json +7 -7
  26. package/bpk-component-flare/examples.js +3 -3
  27. package/bpk-component-flare/package.json +2 -2
  28. package/bpk-component-form-validation/package.json +4 -4
  29. package/bpk-component-horizontal-nav/package.json +2 -2
  30. package/bpk-component-icon/examples.js +5 -5
  31. package/bpk-component-icon/package.json +2 -2
  32. package/bpk-component-image/examples.js +4 -4
  33. package/bpk-component-image/package.json +2 -2
  34. package/bpk-component-input/package.json +3 -3
  35. package/bpk-component-loading-button/package.json +2 -2
  36. package/bpk-component-map/package.json +3 -3
  37. package/bpk-component-map/src/BpkPriceMarker.js +3 -7
  38. package/bpk-component-modal/examples.js +2 -2
  39. package/bpk-component-modal/package.json +5 -5
  40. package/bpk-component-navigation-bar/package.json +4 -4
  41. package/bpk-component-navigation-bar/src/BpkNavigationBar.js +2 -2
  42. package/bpk-component-navigation-stack/package.json +3 -3
  43. package/bpk-component-nudger/package.json +2 -2
  44. package/bpk-component-overlay/package.json +3 -3
  45. package/bpk-component-pagination/package.json +2 -2
  46. package/bpk-component-phone-input/package.json +5 -5
  47. package/bpk-component-popover/examples.js +2 -2
  48. package/bpk-component-popover/package.json +4 -4
  49. package/bpk-component-popover/src/BpkPopover.js +2 -2
  50. package/bpk-component-rating/package.json +2 -2
  51. package/bpk-component-rating/src/BpkRating.js +14 -8
  52. package/bpk-component-scrollable-calendar/package.json +3 -3
  53. package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarGrid.js +2 -3
  54. package/bpk-component-section-list/package.json +3 -3
  55. package/bpk-component-section-list/src/BpkSectionListSection.js +2 -4
  56. package/bpk-component-star-rating/package.json +2 -2
  57. package/bpk-component-text/examples.js +17 -17
  58. package/bpk-component-text/package.json +1 -1
  59. package/bpk-component-text/src/BpkText.js +1 -1
  60. package/bpk-component-ticket/package.json +2 -2
  61. package/bpk-component-tooltip/examples.js +2 -2
  62. package/bpk-component-tooltip/package.json +2 -2
  63. package/package.json +2 -2
  64. package/bpk-component-heading/README.md +0 -31
  65. package/bpk-component-heading/examples.js +0 -36
  66. package/bpk-component-heading/index.js +0 -23
  67. package/bpk-component-heading/package.json +0 -25
  68. package/bpk-component-heading/src/BpkHeading.js +0 -70
  69. package/bpk-component-heading/src/BpkHeading.module.css +0 -18
  70. package/bpk-component-heading/src/BpkHeading.module.scss +0 -49
  71. package/bpk-component-paragraph/README.md +0 -28
  72. package/bpk-component-paragraph/examples.js +0 -46
  73. package/bpk-component-paragraph/index.js +0 -23
  74. package/bpk-component-paragraph/package.json +0 -25
  75. package/bpk-component-paragraph/src/BpkParagraph.js +0 -55
  76. package/bpk-component-paragraph/src/BpkParagraph.module.css +0 -18
  77. package/bpk-component-paragraph/src/BpkParagraph.module.scss +0 -25
  78. package/bpk-tether/.eslintrc +0 -6
  79. package/bpk-tether/README.md +0 -52
  80. package/bpk-tether/index.js +0 -24
  81. package/bpk-tether/package.json +0 -19
  82. package/bpk-tether/src/TetherWrapper.js +0 -30
  83. package/bpk-tether/src/applyRTLTransforms.js +0 -49
  84. package/bpk-tether/src/getArrowPositionCallback.js +0 -65
@@ -1,55 +0,0 @@
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
- import PropTypes from 'prop-types';
22
- import React, { type Node } from 'react';
23
- import { cssModules } from 'bpk-react-utils';
24
-
25
- import STYLES from './BpkParagraph.module.scss';
26
-
27
- const getClassName = cssModules(STYLES);
28
-
29
- type Props = {
30
- children: Node,
31
- className: ?string,
32
- };
33
-
34
- const BpkParagraph = (props: Props) => {
35
- const classNames = [getClassName('bpk-paragraph')];
36
- const { className, ...rest } = props;
37
-
38
- if (className) {
39
- classNames.push(className);
40
- }
41
-
42
- // $FlowFixMe[cannot-spread-inexact] - inexact rest. See decisions/flowfixme.md
43
- return <p className={classNames.join(' ')} {...rest} />;
44
- };
45
-
46
- BpkParagraph.propTypes = {
47
- children: PropTypes.node.isRequired,
48
- className: PropTypes.string,
49
- };
50
-
51
- BpkParagraph.defaultProps = {
52
- className: null,
53
- };
54
-
55
- export default BpkParagraph;
@@ -1,18 +0,0 @@
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-paragraph{margin-top:0;margin-bottom:1rem}
@@ -1,25 +0,0 @@
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
- @import '~bpk-mixins/index';
20
-
21
- $bpk-spacing-v2: true;
22
-
23
- .bpk-paragraph {
24
- @include bpk-paragraph;
25
- }
@@ -1,6 +0,0 @@
1
- {
2
- "rules": {
3
- "import/no-unresolved": "off",
4
- "import/extensions": "off"
5
- }
6
- }
@@ -1,52 +0,0 @@
1
- # bpk-tether
2
-
3
- > Wrapper around the Tether library, along with related utilities
4
-
5
- ## Installation
6
-
7
- ```sh
8
- npm install bpk-tether --save-dev
9
- ```
10
-
11
- ## Tether Wrapper
12
-
13
- A wrapper around the [Tether](http://tether.io/) library which extends the `Tether` object to emit a `position` event.
14
-
15
- ### Usage
16
-
17
- ```js
18
- import { Tether } from 'bpk-tether';
19
-
20
- this.tether = new Tether({
21
- classPrefix: 'bpk-popover-tether',
22
- element: popoverElement,
23
- target: targetElement,
24
- tetherOptions: tetherOptions,
25
- });
26
-
27
- this.tether.on('position', position => console.log('Tether was repositioned', position));
28
- ```
29
-
30
- ## getArrowPositionCallback
31
-
32
- When using Tether to create a popover or tooltip with an arrow pointing towards the target element, we want to have
33
- this arrow point to the target element at all times. To achieve this, the `getArrowPositionCallback` function returns
34
- a callback to be used on the `position` event. When invoked, it repositions the arrow element to stick to the target
35
- element.
36
-
37
- ### Usage
38
-
39
- ```js
40
- import { Tether } from 'bpk-tether';
41
-
42
- const classPrefix = 'bpk-popover-tether';
43
-
44
- this.tether = new Tether({
45
- classPrefix,
46
- element: tetherElement,
47
- target: targetElement,
48
- tetherOptions: tetherOptions,
49
- });
50
-
51
- this.tether.on('position', getArrowPositionCallback(tetherElement, 'arrow-id', classPrefix));
52
- ```
@@ -1,24 +0,0 @@
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
- import TetherWrapper from './src/TetherWrapper';
20
- import getArrowPositionCallback from './src/getArrowPositionCallback';
21
- import applyRTLTransforms from './src/applyRTLTransforms';
22
-
23
- export default TetherWrapper;
24
- export { getArrowPositionCallback, applyRTLTransforms };
@@ -1,19 +0,0 @@
1
- {
2
- "name": "bpk-tether",
3
- "version": "1.1.2",
4
- "description": "Wrapper and utils for Tether.",
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
- "gitHead": "09fc99e4e67a5b71dc15f41a5409ad412bc139d4",
16
- "dependencies": {
17
- "tether": "^2.0.0"
18
- }
19
- }
@@ -1,30 +0,0 @@
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
- import Tether from 'tether';
20
-
21
- // We extend tether to hook into the position function in order to expose
22
- // a `position` event on the tether object. Useful for repositioning arrows
23
- // etc. See http://tether.io/advanced/extending_tether/.
24
- Tether.modules.push({
25
- position(props) {
26
- this.trigger('position', props);
27
- },
28
- });
29
-
30
- export default Tether;
@@ -1,49 +0,0 @@
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
- import { isRTL } from 'bpk-react-utils';
20
-
21
- const tryFlipAttachmentString = (value) => {
22
- if (value.indexOf('right') !== -1) {
23
- return value.replace('right', 'left');
24
- }
25
-
26
- return value.replace('left', 'right');
27
- };
28
-
29
- const transform = (tetherOptions) => {
30
- const { attachment, targetAttachment, ...rest } = tetherOptions;
31
-
32
- const options = {};
33
-
34
- if (attachment) {
35
- options.attachment = isRTL()
36
- ? tryFlipAttachmentString(attachment)
37
- : attachment;
38
- }
39
-
40
- if (targetAttachment) {
41
- options.targetAttachment = isRTL()
42
- ? tryFlipAttachmentString(targetAttachment)
43
- : targetAttachment;
44
- }
45
-
46
- return { ...options, ...rest };
47
- };
48
-
49
- export default transform;
@@ -1,65 +0,0 @@
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
- // For compat with various IE browsers who haven't implemented classList yet.
20
- // See http://youmightnotneedjquery.com/#has_class.
21
- const hasClass = (el, className) => {
22
- if (el.classList) {
23
- return el.classList.contains(className);
24
- }
25
-
26
- return new RegExp(`(^| )${className}( |$)`, 'gi').test(el.className);
27
- };
28
-
29
- const getArrowPositionCallback = (
30
- popoverElement = {},
31
- arrowId,
32
- classNamePrefix = 'bpk-popover-tether',
33
- ) => {
34
- let arrowElement = null;
35
-
36
- if (popoverElement.querySelector) {
37
- arrowElement = popoverElement.querySelector(`#${arrowId}`);
38
- }
39
-
40
- if (arrowElement === null) {
41
- return () => null;
42
- }
43
-
44
- return (props) => {
45
- const { left, targetPos, top } = props;
46
-
47
- const shouldApplyLeftOffset =
48
- hasClass(popoverElement, `${classNamePrefix}-element-attached-top`) ||
49
- hasClass(popoverElement, `${classNamePrefix}-element-attached-bottom`);
50
-
51
- if (shouldApplyLeftOffset) {
52
- const leftOffset = targetPos.left + targetPos.width / 2 - left;
53
-
54
- arrowElement.style.top = '';
55
- arrowElement.style.left = `${leftOffset}px`;
56
- } else {
57
- const topOffset = targetPos.top + targetPos.height / 2 - top;
58
-
59
- arrowElement.style.top = `${topOffset}px`;
60
- arrowElement.style.left = '';
61
- }
62
- };
63
- };
64
-
65
- export default getArrowPositionCallback;