@skyscanner/backpack-web 34.2.0 → 34.3.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-autosuggest/src/BpkAutosuggest.module.css +1 -1
- package/bpk-component-autosuggest/src/BpkAutosuggestSuggestion.js +3 -5
- package/bpk-component-banner-alert/src/BpkBannerAlertInner.js +3 -5
- package/bpk-component-button/BpkButtonDestructive.d.ts +4 -0
- package/bpk-component-button/BpkButtonDestructive.js +9 -1
- package/bpk-component-button/BpkButtonFeatured.d.ts +4 -0
- package/bpk-component-button/BpkButtonFeatured.js +9 -1
- package/bpk-component-button/BpkButtonLink.d.ts +4 -0
- package/bpk-component-button/BpkButtonLink.js +9 -1
- package/bpk-component-button/BpkButtonLinkOnDark.d.ts +4 -0
- package/bpk-component-button/BpkButtonLinkOnDark.js +8 -1
- package/bpk-component-button/BpkButtonPrimary.d.ts +4 -0
- package/bpk-component-button/BpkButtonPrimary.js +8 -1
- package/bpk-component-button/BpkButtonPrimaryOnDark.d.ts +4 -0
- package/bpk-component-button/BpkButtonPrimaryOnDark.js +9 -1
- package/bpk-component-button/BpkButtonPrimaryOnLight.d.ts +4 -0
- package/bpk-component-button/BpkButtonPrimaryOnLight.js +9 -1
- package/bpk-component-button/BpkButtonSecondary.d.ts +4 -0
- package/bpk-component-button/BpkButtonSecondary.js +9 -1
- package/bpk-component-button/BpkButtonSecondaryOnDark.d.ts +4 -0
- package/bpk-component-button/BpkButtonSecondaryOnDark.js +9 -1
- package/bpk-component-button/index.d.ts +9 -9
- package/bpk-component-button/index.js +10 -20
- package/bpk-component-button/src/BpkButton.d.ts +56 -0
- package/bpk-component-button/src/BpkButton.js +31 -24
- package/bpk-component-button/src/BpkButtonBase.d.ts +53 -0
- package/bpk-component-button/src/BpkButtonBase.js +70 -43
- package/bpk-component-button/src/BpkButtonBase.module.css +1 -1
- package/bpk-component-button/src/common-types.d.ts +37 -0
- package/bpk-component-button/src/common-types.js +16 -15
- package/bpk-component-card/src/BpkCard.d.ts +1 -1
- package/bpk-component-card/src/BpkCard.js +4 -1
- package/bpk-component-card/src/BpkCard.module.css +1 -1
- package/bpk-component-card/src/BpkCardWrapper.js +18 -12
- package/bpk-component-card/src/BpkDividedCard.d.ts +1 -1
- package/bpk-component-card/src/BpkDividedCard.js +26 -19
- package/bpk-component-card/src/BpkDividedCard.module.css +1 -1
- package/bpk-component-card/src/CardContext.d.ts +14 -0
- package/{bpk-component-button/src/BpkButtonPrimary.js → bpk-component-card/src/CardContext.js} +11 -15
- package/bpk-component-dialog/src/BpkDialogInner.js +3 -5
- package/bpk-component-dialog/src/BpkDialogInner.module.css +1 -1
- package/bpk-component-popover/src/BpkPopover.js +1 -0
- package/bpk-component-popover/src/BpkPopover.module.css +1 -1
- package/package.json +1 -1
- package/bpk-component-button/src/BpkButtonDestructive.js +0 -48
- package/bpk-component-button/src/BpkButtonDestructive.module.css +0 -18
- package/bpk-component-button/src/BpkButtonFeatured.js +0 -48
- package/bpk-component-button/src/BpkButtonFeatured.module.css +0 -18
- package/bpk-component-button/src/BpkButtonLink.js +0 -53
- package/bpk-component-button/src/BpkButtonLink.module.css +0 -18
- package/bpk-component-button/src/BpkButtonLinkOnDark.js +0 -53
- package/bpk-component-button/src/BpkButtonLinkOnDark.module.css +0 -18
- package/bpk-component-button/src/BpkButtonPrimaryOnDark.js +0 -48
- package/bpk-component-button/src/BpkButtonPrimaryOnDark.module.css +0 -18
- package/bpk-component-button/src/BpkButtonPrimaryOnLight.js +0 -48
- package/bpk-component-button/src/BpkButtonPrimaryOnLight.module.css +0 -18
- package/bpk-component-button/src/BpkButtonSecondary.js +0 -47
- package/bpk-component-button/src/BpkButtonSecondary.module.css +0 -18
- package/bpk-component-button/src/BpkButtonSecondaryOnDark.js +0 -48
- package/bpk-component-button/src/BpkButtonSecondaryOnDark.module.css +0 -18
|
@@ -14,17 +14,27 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
import { cssModules } from "../../bpk-react-utils";
|
|
19
|
+
import { propTypes, defaultProps } from "./common-types";
|
|
18
20
|
import COMMON_STYLES from "./BpkButtonBase.module.css";
|
|
19
|
-
|
|
20
|
-
// This was originally depended upon from the bpk-react-utils package, however
|
|
21
|
-
// we decided to inline it in this particular component so as not to bloat the
|
|
22
|
-
// the bundles of consumers who are not yet on webpack 2
|
|
23
|
-
// We'll revisit this again soon.
|
|
24
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
const getClassName = cssModules(COMMON_STYLES);
|
|
23
|
+
|
|
24
|
+
// This is a duplicate of BpkButtonV2
|
|
25
|
+
// Better to duplicate rather than prematurely align the abstraction between Button and ButtonV2
|
|
26
|
+
export const BUTTON_TYPES = {
|
|
27
|
+
primary: 'primary',
|
|
28
|
+
primaryOnDark: 'primary-on-dark',
|
|
29
|
+
primaryOnLight: 'primary-on-light',
|
|
30
|
+
secondary: 'secondary',
|
|
31
|
+
secondaryOnDark: 'secondary-on-dark',
|
|
32
|
+
destructive: 'destructive',
|
|
33
|
+
featured: 'featured',
|
|
34
|
+
link: 'link',
|
|
35
|
+
linkOnDark: 'link-on-dark'
|
|
36
|
+
};
|
|
37
|
+
const BpkButtonBase = props => {
|
|
28
38
|
const {
|
|
29
39
|
blank,
|
|
30
40
|
children,
|
|
@@ -36,58 +46,75 @@ const BpkButton = props => {
|
|
|
36
46
|
onClick,
|
|
37
47
|
rel: propRel,
|
|
38
48
|
submit,
|
|
49
|
+
type,
|
|
39
50
|
...rest
|
|
40
51
|
} = props;
|
|
41
|
-
const classNames = [
|
|
52
|
+
const classNames = [];
|
|
53
|
+
if (type === undefined) {
|
|
54
|
+
classNames.push('bpk-button');
|
|
55
|
+
}
|
|
56
|
+
if (type === BUTTON_TYPES.featured) {
|
|
57
|
+
classNames.push('bpk-button--featured');
|
|
58
|
+
}
|
|
59
|
+
if (type === BUTTON_TYPES.destructive) {
|
|
60
|
+
classNames.push('bpk-button--destructive');
|
|
61
|
+
}
|
|
62
|
+
if (type === BUTTON_TYPES.link) {
|
|
63
|
+
classNames.push('bpk-button--link');
|
|
64
|
+
}
|
|
65
|
+
if (type === BUTTON_TYPES.linkOnDark) {
|
|
66
|
+
classNames.push('bpk-button--linkOnDark');
|
|
67
|
+
}
|
|
68
|
+
if (type === BUTTON_TYPES.primaryOnDark) {
|
|
69
|
+
classNames.push('bpk-button--primaryOnDark');
|
|
70
|
+
}
|
|
71
|
+
if (type === BUTTON_TYPES.primaryOnLight) {
|
|
72
|
+
classNames.push('bpk-button--primaryOnLight');
|
|
73
|
+
}
|
|
74
|
+
if (type === BUTTON_TYPES.secondary) {
|
|
75
|
+
classNames.push('bpk-button--secondary');
|
|
76
|
+
}
|
|
77
|
+
if (type === BUTTON_TYPES.secondaryOnDark) {
|
|
78
|
+
classNames.push('bpk-button--secondaryOnDark');
|
|
79
|
+
}
|
|
42
80
|
if (large) {
|
|
43
|
-
classNames.push(
|
|
81
|
+
classNames.push('bpk-button--large');
|
|
44
82
|
}
|
|
45
83
|
if (iconOnly) {
|
|
46
|
-
classNames.push(
|
|
84
|
+
classNames.push(large ? 'bpk-button--large-icon-only' : 'bpk-button--icon-only');
|
|
47
85
|
}
|
|
48
86
|
if (className) {
|
|
49
87
|
classNames.push(className);
|
|
50
88
|
}
|
|
51
|
-
const classNameFinal = classNames
|
|
89
|
+
const classNameFinal = getClassName(...classNames);
|
|
52
90
|
const target = blank ? '_blank' : null;
|
|
53
91
|
const rel = blank ? propRel || 'noopener noreferrer' : propRel;
|
|
54
92
|
if (!disabled && href) {
|
|
55
|
-
return (
|
|
56
|
-
|
|
57
|
-
// $FlowFixMe[cannot-spread-inexact] - inexact rest. See 'decisions/flowfixme.md'.
|
|
58
|
-
_jsx("a", {
|
|
59
|
-
href: href,
|
|
60
|
-
className: classNameFinal,
|
|
61
|
-
onClick: onClick,
|
|
62
|
-
target: target,
|
|
63
|
-
rel: rel,
|
|
64
|
-
...rest,
|
|
65
|
-
children: children
|
|
66
|
-
})
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
const buttonType = submit ? 'submit' : 'button';
|
|
70
|
-
|
|
71
|
-
/* eslint-disable react/button-has-type */
|
|
72
|
-
return (
|
|
73
|
-
/*#__PURE__*/
|
|
74
|
-
// $FlowFixMe[cannot-spread-inexact] - inexact rest. See 'decisions/flowfixme.md'.
|
|
75
|
-
_jsx("button", {
|
|
76
|
-
type: buttonType,
|
|
77
|
-
disabled: disabled,
|
|
93
|
+
return /*#__PURE__*/_jsx("a", {
|
|
94
|
+
href: href,
|
|
78
95
|
className: classNameFinal,
|
|
79
96
|
onClick: onClick,
|
|
97
|
+
target: target || undefined,
|
|
98
|
+
rel: rel,
|
|
80
99
|
...rest,
|
|
81
100
|
children: children
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
const buttonType = submit ? 'submit' : 'button';
|
|
104
|
+
return /*#__PURE__*/_jsx("button", {
|
|
105
|
+
// eslint-disable-next-line react/button-has-type
|
|
106
|
+
type: buttonType,
|
|
107
|
+
disabled: disabled,
|
|
108
|
+
className: classNameFinal,
|
|
109
|
+
onClick: onClick,
|
|
110
|
+
...rest,
|
|
111
|
+
children: children
|
|
112
|
+
});
|
|
85
113
|
};
|
|
86
|
-
|
|
114
|
+
BpkButtonBase.propTypes = {
|
|
87
115
|
...propTypes
|
|
88
116
|
};
|
|
89
|
-
|
|
117
|
+
BpkButtonBase.defaultProps = {
|
|
90
118
|
...defaultProps
|
|
91
119
|
};
|
|
92
|
-
export default
|
|
93
|
-
export { cssModules };
|
|
120
|
+
export default BpkButtonBase;
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
.bpk-button{display:inline-block;min-height:2.25rem;margin:0;padding:.375rem 1rem;border:0;border-radius:.5rem;text-align:center;text-decoration:none;cursor:pointer;vertical-align:middle;user-select:none;font-size:1rem;line-height:1.5rem;font-weight:700;color:#fff;color:var(--bpk-button-primary-text-color, rgb(255, 255, 255));background-color:#05203c;background-color:var(--bpk-button-primary-background-color, rgb(5, 32, 60))}.bpk-no-touch-support .bpk-button:hover:not(:active):not(:disabled){color:#fff;color:var(--bpk-button-primary-hover-text-color, rgb(255, 255, 255));background-color:#154679;background-color:var(--bpk-button-primary-hover-background-color, rgb(21, 70, 121))}:global(.bpk-no-touch-support) .bpk-button:hover:not(:active):not(:disabled){color:#fff;color:var(--bpk-button-primary-hover-text-color, rgb(255, 255, 255));background-color:#154679;background-color:var(--bpk-button-primary-hover-background-color, rgb(21, 70, 121))}.bpk-button:active{color:#fff;color:var(--bpk-button-primary-active-text-color, rgb(255, 255, 255));background-color:#154679;background-color:var(--bpk-button-primary-active-background-color, rgb(21, 70, 121))}.bpk-button:disabled{background-color:#e0e4e9;color:rgba(0,0,0,.2);cursor:not-allowed}.bpk-button--large{min-height:3rem;padding:.75rem 1rem}.bpk-button--icon-only{border-radius:.5rem;padding-right:.625rem;padding-left:.625rem;border-radius:.5rem}.bpk-button--large-icon-only{border-radius:.5rem;padding-right:.75rem;padding-left:.75rem;border-radius:.5rem}.bpk-button span>svg{display:block}.bpk-button svg{fill:currentcolor}
|
|
18
|
+
.bpk-button{display:inline-block;min-height:2.25rem;margin:0;padding:.375rem 1rem;border:0;border-radius:.5rem;text-align:center;text-decoration:none;cursor:pointer;vertical-align:middle;user-select:none;font-size:1rem;line-height:1.5rem;font-weight:700;color:#fff;color:var(--bpk-button-primary-text-color, rgb(255, 255, 255));background-color:#05203c;background-color:var(--bpk-button-primary-background-color, rgb(5, 32, 60))}.bpk-no-touch-support .bpk-button:hover:not(:active):not(:disabled){color:#fff;color:var(--bpk-button-primary-hover-text-color, rgb(255, 255, 255));background-color:#154679;background-color:var(--bpk-button-primary-hover-background-color, rgb(21, 70, 121))}:global(.bpk-no-touch-support) .bpk-button:hover:not(:active):not(:disabled){color:#fff;color:var(--bpk-button-primary-hover-text-color, rgb(255, 255, 255));background-color:#154679;background-color:var(--bpk-button-primary-hover-background-color, rgb(21, 70, 121))}.bpk-button:active{color:#fff;color:var(--bpk-button-primary-active-text-color, rgb(255, 255, 255));background-color:#154679;background-color:var(--bpk-button-primary-active-background-color, rgb(21, 70, 121))}.bpk-button:disabled{background-color:#e0e4e9;color:rgba(0,0,0,.2);cursor:not-allowed}.bpk-button--large{min-height:3rem;padding:.75rem 1rem}.bpk-button--icon-only{border-radius:.5rem;padding-right:.625rem;padding-left:.625rem;border-radius:.5rem}.bpk-button--large-icon-only{border-radius:.5rem;padding-right:.75rem;padding-left:.75rem;border-radius:.5rem}.bpk-button span>svg{display:block}.bpk-button svg{fill:currentcolor}.bpk-button--featured{composes:bpk-button;color:#fff;color:var(--bpk-button-featured-text-color, rgb(255, 255, 255));background-color:#0062e3;background-color:var(--bpk-button-featured-background-color, rgb(0, 98, 227))}.bpk-no-touch-support .bpk-button--featured:hover:not(:active):not(:disabled){color:#fff;color:var(--bpk-button-featured-hover-text-color, rgb(255, 255, 255));background-color:#024daf;background-color:var(--bpk-button-featured-hover-background-color, rgb(2, 77, 175))}:global(.bpk-no-touch-support) .bpk-button--featured:hover:not(:active):not(:disabled){color:#fff;color:var(--bpk-button-featured-hover-text-color, rgb(255, 255, 255));background-color:#024daf;background-color:var(--bpk-button-featured-hover-background-color, rgb(2, 77, 175))}.bpk-button--featured:active{color:#fff;color:var(--bpk-button-featured-active-text-color, rgb(255, 255, 255));background-color:#024daf;background-color:var(--bpk-button-featured-active-background-color, rgb(2, 77, 175))}.bpk-button--featured:disabled{background-color:#e0e4e9;color:rgba(0,0,0,.2)}.bpk-button--destructive{composes:bpk-button;color:#e70866;color:var(--bpk-button-destructive-text-color, rgb(231, 8, 102));background-color:#e0e4e9;background-color:var(--bpk-button-destructive-background-color, rgb(224, 228, 233))}.bpk-no-touch-support .bpk-button--destructive:hover:not(:active):not(:disabled){color:#fff;color:var(--bpk-button-destructive-hover-text-color, rgb(255, 255, 255));background-color:#e70866;background-color:var(--bpk-button-destructive-hover-background-color, rgb(231, 8, 102))}:global(.bpk-no-touch-support) .bpk-button--destructive:hover:not(:active):not(:disabled){color:#fff;color:var(--bpk-button-destructive-hover-text-color, rgb(255, 255, 255));background-color:#e70866;background-color:var(--bpk-button-destructive-hover-background-color, rgb(231, 8, 102))}.bpk-button--destructive:active{color:#fff;color:var(--bpk-button-destructive-active-text-color, rgb(255, 255, 255));background-color:#e70866;background-color:var(--bpk-button-destructive-active-background-color, rgb(231, 8, 102))}.bpk-button--destructive:disabled{background-color:#e0e4e9;color:rgba(0,0,0,.2)}.bpk-button--link{composes:bpk-button;background:none;box-shadow:none;padding:0;border:0;background-color:rgba(0,0,0,0);text-decoration:none;cursor:pointer;appearance:none;color:#0062e3;color:var(--bpk-link-color, rgb(0, 98, 227));padding:.375rem 0;color:#0062e3}.bpk-no-touch-support .bpk-button--link:hover:not(:active):not(:disabled){text-decoration:underline;color:#0062e3;color:var(--bpk-link-hover-color, rgb(0, 98, 227))}:global(.bpk-no-touch-support) .bpk-button--link:hover:not(:active):not(:disabled){text-decoration:underline;color:#0062e3;color:var(--bpk-link-hover-color, rgb(0, 98, 227))}.bpk-button--link:visited{color:#0062e3;color:var(--bpk-link-visited-color, rgb(0, 98, 227))}.bpk-button--link:active{text-decoration:underline;color:#0062e3;color:var(--bpk-link-active-color, rgb(0, 98, 227))}.bpk-no-touch-support .bpk-button--link:hover:not(:active):not(:disabled){background:none;color:#024daf;text-decoration:none}:global(.bpk-no-touch-support) .bpk-button--link:hover:not(:active):not(:disabled){background:none;color:#024daf;text-decoration:none}.bpk-button--link:active{background:none;color:#024daf;text-decoration:none}.bpk-button--link:disabled{background:none;color:rgba(0,0,0,.2);text-decoration:none}.bpk-button--link-large{padding:.75rem 0}.bpk-button--linkOnDark{composes:bpk-button;background:none;box-shadow:none;padding:0;border:0;background-color:rgba(0,0,0,0);text-decoration:none;cursor:pointer;appearance:none;color:#0062e3;color:var(--bpk-link-color, rgb(0, 98, 227));padding:.375rem 0;color:#0062e3;color:#fff;color:var(--bpk-button-link-on-dark-text-color, rgb(255, 255, 255))}.bpk-no-touch-support .bpk-button--linkOnDark:hover:not(:active):not(:disabled){text-decoration:underline;color:#0062e3;color:var(--bpk-link-hover-color, rgb(0, 98, 227))}:global(.bpk-no-touch-support) .bpk-button--linkOnDark:hover:not(:active):not(:disabled){text-decoration:underline;color:#0062e3;color:var(--bpk-link-hover-color, rgb(0, 98, 227))}.bpk-button--linkOnDark:visited{color:#0062e3;color:var(--bpk-link-visited-color, rgb(0, 98, 227))}.bpk-button--linkOnDark:active{text-decoration:underline;color:#0062e3;color:var(--bpk-link-active-color, rgb(0, 98, 227))}.bpk-no-touch-support .bpk-button--linkOnDark:hover:not(:active):not(:disabled){background:none;color:#024daf;text-decoration:none}:global(.bpk-no-touch-support) .bpk-button--linkOnDark:hover:not(:active):not(:disabled){background:none;color:#024daf;text-decoration:none}.bpk-button--linkOnDark:active{background:none;color:#024daf;text-decoration:none}.bpk-button--linkOnDark:disabled{background:none;color:rgba(0,0,0,.2);text-decoration:none}.bpk-button--linkOnDark-large{padding:.75rem 0}.bpk-no-touch-support .bpk-button--linkOnDark:hover:not(:active):not(:disabled){color:rgba(255,255,255,.5);color:var(--bpk-button-link-on-dark-hover-text-color, rgba(255, 255, 255, 0.5))}:global(.bpk-no-touch-support) .bpk-button--linkOnDark:hover:not(:active):not(:disabled){color:rgba(255,255,255,.5);color:var(--bpk-button-link-on-dark-hover-text-color, rgba(255, 255, 255, 0.5))}.bpk-button--linkOnDark:active{color:rgba(255,255,255,.5);color:var(--bpk-button-link-on-dark-active-text-color, rgba(255, 255, 255, 0.5))}.bpk-button--linkOnDark:visited{color:#fff;color:var(--bpk-button-link-on-dark-text-color, rgb(255, 255, 255))}.bpk-button--linkOnDark:disabled{color:rgba(255,255,255,.2);color:var(--bpk-button-link-on-dark-disabled-color, rgba(255, 255, 255, 0.2))}.bpk-button--primaryOnDark{composes:bpk-button;color:#161616;color:var(--bpk-button-primary-on-dark-text-color, rgb(22, 22, 22));background-color:#fff;background-color:var(--bpk-button-primary-on-dark-background-color, rgb(255, 255, 255))}.bpk-no-touch-support .bpk-button--primaryOnDark:hover:not(:active):not(:disabled){color:#161616;color:var(--bpk-button-primary-on-dark-hover-text-color, rgb(22, 22, 22));background-color:#c1c7cf;background-color:var(--bpk-button-primary-on-dark-hover-background-color, rgb(193, 199, 207))}:global(.bpk-no-touch-support) .bpk-button--primaryOnDark:hover:not(:active):not(:disabled){color:#161616;color:var(--bpk-button-primary-on-dark-hover-text-color, rgb(22, 22, 22));background-color:#c1c7cf;background-color:var(--bpk-button-primary-on-dark-hover-background-color, rgb(193, 199, 207))}.bpk-button--primaryOnDark:active{color:#161616;color:var(--bpk-button-primary-on-dark-active-text-color, rgb(22, 22, 22));background-color:#c1c7cf;background-color:var(--bpk-button-primary-on-dark-active-background-color, rgb(193, 199, 207))}.bpk-button--primaryOnDark:disabled{background-color:#e0e4e9;color:rgba(0,0,0,.2)}.bpk-button--primaryOnLight{composes:bpk-button;color:#fff;color:var(--bpk-button-primary-on-light-text-color, rgb(255, 255, 255));background-color:#05203c;background-color:var(--bpk-button-primary-on-light-background-color, rgb(5, 32, 60))}.bpk-no-touch-support .bpk-button--primaryOnLight:hover:not(:active):not(:disabled){color:#fff;color:var(--bpk-button-primary-on-light-hover-text-color, rgb(255, 255, 255));background-color:#154679;background-color:var(--bpk-button-primary-on-light-hover-background-color, rgb(21, 70, 121))}:global(.bpk-no-touch-support) .bpk-button--primaryOnLight:hover:not(:active):not(:disabled){color:#fff;color:var(--bpk-button-primary-on-light-hover-text-color, rgb(255, 255, 255));background-color:#154679;background-color:var(--bpk-button-primary-on-light-hover-background-color, rgb(21, 70, 121))}.bpk-button--primaryOnLight:active{color:#fff;color:var(--bpk-button-primary-on-light-active-text-color, rgb(255, 255, 255));background-color:#154679;background-color:var(--bpk-button-primary-on-light-active-background-color, rgb(21, 70, 121))}.bpk-button--primaryOnLight:disabled{background-color:#e0e4e9;color:rgba(0,0,0,.2)}.bpk-button--secondary{composes:bpk-button;color:#161616;color:var(--bpk-button-secondary-text-color, rgb(22, 22, 22));background-color:#e0e4e9;background-color:var(--bpk-button-secondary-background-color, rgb(224, 228, 233))}.bpk-no-touch-support .bpk-button--secondary:hover:not(:active):not(:disabled){color:#161616;color:var(--bpk-button-secondary-hover-text-color, rgb(22, 22, 22));background-color:#c1c7cf;background-color:var(--bpk-button-secondary-hover-background-color, rgb(193, 199, 207))}:global(.bpk-no-touch-support) .bpk-button--secondary:hover:not(:active):not(:disabled){color:#161616;color:var(--bpk-button-secondary-hover-text-color, rgb(22, 22, 22));background-color:#c1c7cf;background-color:var(--bpk-button-secondary-hover-background-color, rgb(193, 199, 207))}.bpk-button--secondary:active{color:#161616;color:var(--bpk-button-secondary-active-text-color, rgb(22, 22, 22));background-color:#c1c7cf;background-color:var(--bpk-button-secondary-active-background-color, rgb(193, 199, 207))}.bpk-button--secondary:disabled{background-color:#e0e4e9;color:rgba(0,0,0,.2)}.bpk-button--secondaryOnDark{composes:bpk-button;color:#fff;color:var(--bpk-button-secondary-on-dark-text-color, rgb(255, 255, 255));background-color:rgba(255,255,255,.1);background-color:var(--bpk-button-secondary-on-dark-background-color, rgba(255, 255, 255, 0.1))}.bpk-no-touch-support .bpk-button--secondaryOnDark:hover:not(:active):not(:disabled){color:#fff;color:var(--bpk-button-secondary-on-dark-hover-text-color, rgb(255, 255, 255));background-color:#010913;background-color:var(--bpk-button-secondary-on-dark-hover-background-color, rgb(1, 9, 19))}:global(.bpk-no-touch-support) .bpk-button--secondaryOnDark:hover:not(:active):not(:disabled){color:#fff;color:var(--bpk-button-secondary-on-dark-hover-text-color, rgb(255, 255, 255));background-color:#010913;background-color:var(--bpk-button-secondary-on-dark-hover-background-color, rgb(1, 9, 19))}.bpk-button--secondaryOnDark:active{color:#fff;color:var(--bpk-button-secondary-on-dark-active-text-color, rgb(255, 255, 255));background-color:#010913;background-color:var(--bpk-button-secondary-on-dark-active-background-color, rgb(1, 9, 19))}.bpk-button--secondaryOnDark:disabled{background-color:#0b121d;color:rgba(255,255,255,.2)}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import type { ReactNode, SyntheticEvent } from 'react';
|
|
3
|
+
export type Props = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
href?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
onClick?: (event: SyntheticEvent) => unknown;
|
|
9
|
+
submit: boolean;
|
|
10
|
+
large: boolean;
|
|
11
|
+
iconOnly: boolean;
|
|
12
|
+
blank: boolean;
|
|
13
|
+
rel?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const defaultProps: {
|
|
16
|
+
href: null;
|
|
17
|
+
className: null;
|
|
18
|
+
disabled: boolean;
|
|
19
|
+
onClick: null;
|
|
20
|
+
submit: boolean;
|
|
21
|
+
large: boolean;
|
|
22
|
+
iconOnly: boolean;
|
|
23
|
+
blank: boolean;
|
|
24
|
+
rel: null;
|
|
25
|
+
};
|
|
26
|
+
export declare const propTypes: {
|
|
27
|
+
children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
28
|
+
href: PropTypes.Requireable<string>;
|
|
29
|
+
className: PropTypes.Requireable<string>;
|
|
30
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
31
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
32
|
+
submit: PropTypes.Requireable<boolean>;
|
|
33
|
+
large: PropTypes.Requireable<boolean>;
|
|
34
|
+
iconOnly: PropTypes.Requireable<boolean>;
|
|
35
|
+
blank: PropTypes.Requireable<boolean>;
|
|
36
|
+
rel: PropTypes.Requireable<string>;
|
|
37
|
+
};
|
|
@@ -14,20 +14,10 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
className: PropTypes.string,
|
|
22
|
-
disabled: PropTypes.bool,
|
|
23
|
-
onClick: PropTypes.func,
|
|
24
|
-
submit: PropTypes.bool,
|
|
25
|
-
large: PropTypes.bool,
|
|
26
|
-
iconOnly: PropTypes.bool,
|
|
27
|
-
blank: PropTypes.bool,
|
|
28
|
-
rel: PropTypes.string
|
|
29
|
-
};
|
|
30
|
-
const defaultProps = {
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import PropTypes from 'prop-types';
|
|
20
|
+
export const defaultProps = {
|
|
31
21
|
href: null,
|
|
32
22
|
className: null,
|
|
33
23
|
disabled: false,
|
|
@@ -38,4 +28,15 @@ const defaultProps = {
|
|
|
38
28
|
blank: false,
|
|
39
29
|
rel: null
|
|
40
30
|
};
|
|
41
|
-
export
|
|
31
|
+
export const propTypes = {
|
|
32
|
+
children: PropTypes.node.isRequired,
|
|
33
|
+
href: PropTypes.string,
|
|
34
|
+
className: PropTypes.string,
|
|
35
|
+
disabled: PropTypes.bool,
|
|
36
|
+
onClick: PropTypes.func,
|
|
37
|
+
submit: PropTypes.bool,
|
|
38
|
+
large: PropTypes.bool,
|
|
39
|
+
iconOnly: PropTypes.bool,
|
|
40
|
+
blank: PropTypes.bool,
|
|
41
|
+
rel: PropTypes.string
|
|
42
|
+
};
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
+
import { useContext } from 'react';
|
|
19
20
|
import { cssModules } from "../../bpk-react-utils";
|
|
21
|
+
import { CardContext } from "./CardContext";
|
|
20
22
|
import STYLES from "./BpkCard.module.css";
|
|
21
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
24
|
const getClassName = cssModules(STYLES);
|
|
@@ -29,7 +31,8 @@ const BpkCard = ({
|
|
|
29
31
|
padded = true,
|
|
30
32
|
...rest
|
|
31
33
|
}) => {
|
|
32
|
-
const
|
|
34
|
+
const cardContext = useContext(CardContext);
|
|
35
|
+
const classNames = getClassName('bpk-card', atomic && !href && 'bpk-card--atomic-button', padded && 'bpk-card--padded', !cardContext.elevated && 'bpk-card--no-elevation', className);
|
|
33
36
|
const atomicProps = {};
|
|
34
37
|
if (href) {
|
|
35
38
|
let blankProps = {};
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
.bpk-card{position:relative;display:block;background-color:#fff;color:#161616;text-decoration:none;cursor:pointer;box-shadow:0px 1px 3px 0px rgba(37,32,31,.3);border-radius:.75rem}.bpk-no-touch-support .bpk-card:hover:not(:active):not(:disabled)::after{opacity:1}:global(.bpk-no-touch-support) .bpk-card:hover:not(:active):not(:disabled)::after{opacity:1}.bpk-card::after{position:absolute;top:0;right:0;bottom:0;left:0;content:"";transition:opacity 200ms ease-in-out;opacity:0;pointer-events:none;box-shadow:0px 4px 14px 0px rgba(37,32,31,.25);border-radius:.75rem}@media screen\0 {.bpk-card::after{z-index:-1}}.bpk-card:active::after{box-shadow:none}.bpk-card--atomic-button{width:100%;padding:0;border:none;background:none;color:inherit;text-align:inherit;cursor:pointer;appearance:none}.bpk-card--padded{padding:1rem}
|
|
18
|
+
.bpk-card{position:relative;display:block;background-color:#fff;color:#161616;text-decoration:none;cursor:pointer;box-shadow:0px 1px 3px 0px rgba(37,32,31,.3);border-radius:.75rem}.bpk-no-touch-support .bpk-card:hover:not(:active):not(:disabled)::after{opacity:1}:global(.bpk-no-touch-support) .bpk-card:hover:not(:active):not(:disabled)::after{opacity:1}.bpk-card::after{position:absolute;top:0;right:0;bottom:0;left:0;content:"";transition:opacity 200ms ease-in-out;opacity:0;pointer-events:none;box-shadow:0px 4px 14px 0px rgba(37,32,31,.25);border-radius:.75rem}@media screen\0 {.bpk-card::after{z-index:-1}}.bpk-card:active::after{box-shadow:none}.bpk-card--atomic-button{width:100%;padding:0;border:none;background:none;color:inherit;text-align:inherit;cursor:pointer;appearance:none}.bpk-card--padded{padding:1rem}.bpk-card--no-elevation{box-shadow:none}.bpk-card--no-elevation::after{box-shadow:none}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { cssModules } from "../../bpk-react-utils";
|
|
20
|
+
import { CardContext } from "./CardContext";
|
|
20
21
|
import STYLES from "./BpkCardWrapper.module.css";
|
|
21
22
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
23
|
const getClassName = cssModules(STYLES);
|
|
@@ -27,19 +28,24 @@ const BpkCardWrapper = ({
|
|
|
27
28
|
header
|
|
28
29
|
}) => {
|
|
29
30
|
const classNames = getClassName('bpk-card-wrapper', className);
|
|
30
|
-
return /*#__PURE__*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// @ts-expect-error TS is reporting this incorrectly as --background-color is valid
|
|
34
|
-
'--background-color': backgroundColor
|
|
31
|
+
return /*#__PURE__*/_jsx(CardContext.Provider, {
|
|
32
|
+
value: {
|
|
33
|
+
elevated: false
|
|
35
34
|
},
|
|
36
|
-
children:
|
|
37
|
-
className:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
36
|
+
className: classNames,
|
|
37
|
+
style: {
|
|
38
|
+
// @ts-expect-error TS is reporting this incorrectly as --background-color is valid
|
|
39
|
+
'--background-color': backgroundColor
|
|
40
|
+
},
|
|
41
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
42
|
+
className: getClassName('bpk-card-wrapper--header'),
|
|
43
|
+
children: header
|
|
44
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
45
|
+
className: getClassName('bpk-card-wrapper--content'),
|
|
46
|
+
children: card
|
|
47
|
+
})]
|
|
48
|
+
})
|
|
43
49
|
});
|
|
44
50
|
};
|
|
45
51
|
export default BpkCardWrapper;
|
|
@@ -12,5 +12,5 @@ export type Props = {
|
|
|
12
12
|
isElevated?: boolean;
|
|
13
13
|
[rest: string]: any;
|
|
14
14
|
};
|
|
15
|
-
declare const BpkDividedCard: ({
|
|
15
|
+
declare const BpkDividedCard: ({ href, isElevated, orientation, primaryContent, secondaryContent, ...rest }: Props) => JSX.Element;
|
|
16
16
|
export default BpkDividedCard;
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
import { cssModules } from "../../bpk-react-utils";
|
|
20
20
|
import BpkCard from "./BpkCard";
|
|
21
|
+
import { CardContext } from "./CardContext";
|
|
21
22
|
import STYLES from "./BpkDividedCard.module.css";
|
|
22
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
24
|
const getClassName = cssModules(STYLES);
|
|
@@ -26,7 +27,6 @@ export const ORIENTATION = {
|
|
|
26
27
|
vertical: 'vertical'
|
|
27
28
|
};
|
|
28
29
|
const BpkDividedCard = ({
|
|
29
|
-
className = null,
|
|
30
30
|
href = null,
|
|
31
31
|
isElevated = true,
|
|
32
32
|
orientation = ORIENTATION.horizontal,
|
|
@@ -35,24 +35,31 @@ const BpkDividedCard = ({
|
|
|
35
35
|
...rest
|
|
36
36
|
}) => {
|
|
37
37
|
const isVertical = orientation === ORIENTATION.vertical;
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
38
|
+
const containerClassName = getClassName(isVertical ? 'bpk-divided-card--vertical-container' : 'bpk-divided-card--horizontal-container');
|
|
39
|
+
const contentClassName = getClassName('bpk-divided-card--content', isVertical && 'bpk-divided-card--vertical-content');
|
|
40
|
+
const secondaryContentClassName = getClassName(isVertical ? 'bpk-divided-card__secondary--vertical' : 'bpk-divided-card__secondary--horizontal');
|
|
41
|
+
return /*#__PURE__*/_jsx(CardContext.Provider, {
|
|
42
|
+
value: {
|
|
43
|
+
elevated: isElevated
|
|
44
|
+
},
|
|
45
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
46
|
+
className: containerClassName,
|
|
47
|
+
children: /*#__PURE__*/_jsx(BpkCard, {
|
|
48
|
+
href: href,
|
|
49
|
+
padded: false,
|
|
50
|
+
...rest,
|
|
51
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
52
|
+
className: contentClassName,
|
|
53
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
54
|
+
className: getClassName(!isVertical && 'bpk-divided-card__primary--horizontal'),
|
|
55
|
+
children: primaryContent
|
|
56
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
57
|
+
className: secondaryContentClassName,
|
|
58
|
+
children: secondaryContent
|
|
59
|
+
})]
|
|
60
|
+
})
|
|
61
|
+
})
|
|
55
62
|
})
|
|
56
|
-
);
|
|
63
|
+
});
|
|
57
64
|
};
|
|
58
65
|
export default BpkDividedCard;
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
.bpk-divided-card{display:flex;align-items:stretch}.bpk-divided-card--vertical{min-width:15rem;max-width:45rem
|
|
18
|
+
.bpk-divided-card--content{display:flex;height:100%;align-items:stretch}.bpk-divided-card--vertical-content{flex-direction:column}.bpk-divided-card--vertical-container{display:flex;min-width:15rem;max-width:45rem}.bpk-divided-card--horizontal-container{display:flex;min-width:45.0625rem;min-height:18.25rem}.bpk-divided-card__primary--horizontal{flex:1}.bpk-divided-card__secondary--vertical{border-top:solid .0625rem #c1c7cf}.bpk-divided-card__secondary--horizontal{width:13.5rem;border-left:solid .0625rem #c1c7cf}html[dir=rtl] .bpk-divided-card__secondary--horizontal{border-right:solid .0625rem #c1c7cf;border-left:unset}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface BpkCardContext {
|
|
3
|
+
/**
|
|
4
|
+
* Indicates if the BpkCard should render elevated from the page or not. Parent card types can specify `false` when they handle elevation internally, rather than BpkCard.
|
|
5
|
+
* BpkCard will render elevated by default.
|
|
6
|
+
*/
|
|
7
|
+
elevated: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* CardContext is an internal context to be used only within Backpack parent Card types (time of writing BpkDividedCard & BpkCardWrapper).
|
|
11
|
+
* It facillitates the BpkCard to render appropriately when wrapped and/or is rendered indirectly from a parent.
|
|
12
|
+
*/
|
|
13
|
+
export declare const CardContext: import("react").Context<BpkCardContext>;
|
|
14
|
+
export {};
|
package/{bpk-component-button/src/BpkButtonPrimary.js → bpk-component-card/src/CardContext.js}
RENAMED
|
@@ -14,19 +14,15 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// avoid a breaking change in the mixin. Review after this is tested.
|
|
22
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
-
const BpkButtonPrimary = props => /*#__PURE__*/_jsx(BpkButtonBase, {
|
|
24
|
-
...props
|
|
25
|
-
});
|
|
26
|
-
BpkButtonPrimary.propTypes = {
|
|
27
|
-
...propTypes
|
|
28
|
-
};
|
|
29
|
-
BpkButtonPrimary.defaultProps = {
|
|
30
|
-
...defaultProps
|
|
17
|
+
*/
|
|
18
|
+
import { createContext } from 'react';
|
|
19
|
+
const defaultContext = {
|
|
20
|
+
elevated: true
|
|
31
21
|
};
|
|
32
|
-
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* CardContext is an internal context to be used only within Backpack parent Card types (time of writing BpkDividedCard & BpkCardWrapper).
|
|
25
|
+
* It facillitates the BpkCard to render appropriately when wrapped and/or is rendered indirectly from a parent.
|
|
26
|
+
*/
|
|
27
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
28
|
+
export const CardContext = /*#__PURE__*/createContext(defaultContext);
|
|
@@ -50,11 +50,9 @@ const BpkDialogInner = props => {
|
|
|
50
50
|
"aria-modal": ariaModal,
|
|
51
51
|
className: classNames,
|
|
52
52
|
ref: dialogRef,
|
|
53
|
-
children: [flare && /*#__PURE__*/_jsx(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
, {
|
|
57
|
-
className: flareClassNames
|
|
53
|
+
children: [flare && /*#__PURE__*/_jsx("div", {
|
|
54
|
+
className: flareClassNames,
|
|
55
|
+
children: /*#__PURE__*/_jsx(BpkContentBubble, {})
|
|
58
56
|
}), /*#__PURE__*/_jsx("div", {
|
|
59
57
|
className: contentClassNames,
|
|
60
58
|
children: children
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
.bpk-dialog-inner{z-index:1100;width:100%;max-width:32rem;margin:auto;transform:scale(1);transition:opacity 200ms ease-in-out,transform 200ms ease-in-out;outline:0;background-color:#fff;opacity:1;-webkit-tap-highlight-color:rgba(0,0,0,0);box-shadow:0px 12px 50px 0px rgba(37,32,31,.25);border-radius:.5rem}.bpk-dialog-inner--appear{transform:scale(0.9);opacity:0}.bpk-dialog-inner--appear-active{transform:scale(1);opacity:1}.bpk-dialog-inner__content{padding:1rem;flex:1;overflow-y:auto}.bpk-dialog-inner__flare{height:15rem;border-radius:inherit;background-color:#05203c}
|
|
18
|
+
.bpk-dialog-inner{z-index:1100;width:100%;max-width:32rem;margin:auto;transform:scale(1);transition:opacity 200ms ease-in-out,transform 200ms ease-in-out;outline:0;background-color:#fff;opacity:1;-webkit-tap-highlight-color:rgba(0,0,0,0);box-shadow:0px 12px 50px 0px rgba(37,32,31,.25);border-radius:.5rem}.bpk-dialog-inner--appear{transform:scale(0.9);opacity:0}.bpk-dialog-inner--appear-active{transform:scale(1);opacity:1}.bpk-dialog-inner__content{padding:1rem;flex:1;overflow-y:auto}.bpk-dialog-inner__flare{display:flex;height:15rem;border-radius:inherit;background-color:#05203c}
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
.bpk-popover-
|
|
18
|
+
.bpk-popover-container{z-index:900}.bpk-popover{transition:opacity 200ms ease-in-out;outline:0;background-color:#fff;opacity:1;border-radius:.5rem;box-shadow:0px 4px 14px 0px rgba(37,32,31,.25)}@media(min-width: 32.0625rem){.bpk-popover{max-width:32rem;transition:opacity 50ms ease-in-out}}.bpk-popover--appear{opacity:0}.bpk-popover--appear-active{opacity:1}.bpk-popover__arrow{width:1.5rem;height:1.5rem;fill:#fff}.bpk-popover__arrow[data-hide]{visibility:hidden}.bpk-popover__body--padded{padding:1rem}.bpk-popover__header{display:flex;padding:1rem;justify-content:space-between;box-shadow:0 -1px 0 0 #e0e4e9 inset}.bpk-popover__label{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0)}.bpk-popover__footer{padding:.5rem 1rem;text-align:right;box-shadow:0 1px 0 0 #e0e4e9 inset}html[dir=rtl] .bpk-popover__footer{text-align:left}
|
package/package.json
CHANGED
|
@@ -1,48 +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
|
-
*/import BpkButtonBase, { cssModules } from "./BpkButtonBase";
|
|
18
|
-
import { defaultProps, propTypes } from "./common-types";
|
|
19
|
-
import STYLES from "./BpkButtonDestructive.module.css";
|
|
20
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
-
const getClassName = cssModules(STYLES);
|
|
22
|
-
const BpkButtonDestructive = props => {
|
|
23
|
-
const {
|
|
24
|
-
className,
|
|
25
|
-
...rest
|
|
26
|
-
} = props;
|
|
27
|
-
const classNames = [getClassName('bpk-button--destructive')];
|
|
28
|
-
if (className) {
|
|
29
|
-
classNames.push(className);
|
|
30
|
-
}
|
|
31
|
-
const classNamesFinal = classNames.join(' ');
|
|
32
|
-
return /*#__PURE__*/_jsx(BpkButtonBase
|
|
33
|
-
// TODO: className to be removed
|
|
34
|
-
// eslint-disable-next-line @skyscanner/rules/forbid-component-props
|
|
35
|
-
, {
|
|
36
|
-
className: classNamesFinal
|
|
37
|
-
// $FlowFixMe[cannot-spread-inexact] - inexact rest. See 'decisions/flowfixme.md'.
|
|
38
|
-
,
|
|
39
|
-
...rest
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
BpkButtonDestructive.propTypes = {
|
|
43
|
-
...propTypes
|
|
44
|
-
};
|
|
45
|
-
BpkButtonDestructive.defaultProps = {
|
|
46
|
-
...defaultProps
|
|
47
|
-
};
|
|
48
|
-
export default BpkButtonDestructive;
|
|
@@ -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
|
-
.bpk-button--destructive{color:#161616;color:var(--bpk-button-secondary-text-color, rgb(22, 22, 22));background-color:#e0e4e9;background-color:var(--bpk-button-secondary-background-color, rgb(224, 228, 233));color:#e70866;color:var(--bpk-button-destructive-text-color, rgb(231, 8, 102));background-color:#e0e4e9;background-color:var(--bpk-button-destructive-background-color, rgb(224, 228, 233))}.bpk-no-touch-support .bpk-button--destructive:hover:not(:active):not(:disabled){color:#161616;color:var(--bpk-button-secondary-hover-text-color, rgb(22, 22, 22));background-color:#c1c7cf;background-color:var(--bpk-button-secondary-hover-background-color, rgb(193, 199, 207))}:global(.bpk-no-touch-support) .bpk-button--destructive:hover:not(:active):not(:disabled){color:#161616;color:var(--bpk-button-secondary-hover-text-color, rgb(22, 22, 22));background-color:#c1c7cf;background-color:var(--bpk-button-secondary-hover-background-color, rgb(193, 199, 207))}.bpk-button--destructive:active{color:#161616;color:var(--bpk-button-secondary-active-text-color, rgb(22, 22, 22));background-color:#c1c7cf;background-color:var(--bpk-button-secondary-active-background-color, rgb(193, 199, 207))}.bpk-button--destructive:disabled{background-color:#e0e4e9;color:rgba(0,0,0,.2)}.bpk-no-touch-support .bpk-button--destructive:hover:not(:active):not(:disabled){color:#fff;color:var(--bpk-button-destructive-hover-text-color, rgb(255, 255, 255));background-color:#e70866;background-color:var(--bpk-button-destructive-hover-background-color, rgb(231, 8, 102))}:global(.bpk-no-touch-support) .bpk-button--destructive:hover:not(:active):not(:disabled){color:#fff;color:var(--bpk-button-destructive-hover-text-color, rgb(255, 255, 255));background-color:#e70866;background-color:var(--bpk-button-destructive-hover-background-color, rgb(231, 8, 102))}.bpk-button--destructive:active{color:#fff;color:var(--bpk-button-destructive-active-text-color, rgb(255, 255, 255));background-color:#e70866;background-color:var(--bpk-button-destructive-active-background-color, rgb(231, 8, 102))}.bpk-button--destructive:disabled{background-color:#e0e4e9;color:rgba(0,0,0,.2)}
|
|
@@ -1,48 +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
|
-
*/import BpkButtonBase, { cssModules } from "./BpkButtonBase";
|
|
18
|
-
import { defaultProps, propTypes } from "./common-types";
|
|
19
|
-
import STYLES from "./BpkButtonFeatured.module.css";
|
|
20
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
-
const getClassName = cssModules(STYLES);
|
|
22
|
-
const BpkButtonFeatured = props => {
|
|
23
|
-
const {
|
|
24
|
-
className,
|
|
25
|
-
...rest
|
|
26
|
-
} = props;
|
|
27
|
-
const classNames = [getClassName('bpk-button--featured')];
|
|
28
|
-
if (className) {
|
|
29
|
-
classNames.push(className);
|
|
30
|
-
}
|
|
31
|
-
const classNamesFinal = classNames.join(' ');
|
|
32
|
-
return /*#__PURE__*/_jsx(BpkButtonBase
|
|
33
|
-
// TODO: className to be removed
|
|
34
|
-
// eslint-disable-next-line @skyscanner/rules/forbid-component-props
|
|
35
|
-
, {
|
|
36
|
-
className: classNamesFinal
|
|
37
|
-
// $FlowFixMe[cannot-spread-inexact] - inexact rest. See 'decisions/flowfixme.md'.
|
|
38
|
-
,
|
|
39
|
-
...rest
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
BpkButtonFeatured.propTypes = {
|
|
43
|
-
...propTypes
|
|
44
|
-
};
|
|
45
|
-
BpkButtonFeatured.defaultProps = {
|
|
46
|
-
...defaultProps
|
|
47
|
-
};
|
|
48
|
-
export default BpkButtonFeatured;
|