@skyscanner/backpack-web 42.0.0-test → 42.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bpk-component-button/index.d.ts +3 -3
- package/bpk-component-button/index.js +3 -3
- package/bpk-component-button/src/BpkButton.d.ts +3 -0
- package/bpk-component-button/src/{BpkButton/BpkButton.js → BpkButton.js} +53 -7
- package/bpk-component-button/src/BpkButton.module.css +18 -0
- package/bpk-component-button/src/{BpkButton/common-types.d.ts → common-types.d.ts} +4 -0
- package/bpk-component-button/src/themeAttributes.d.ts +1 -0
- package/bpk-component-button/src/themeAttributes.js +2 -1
- package/bpk-component-checkbox/index.d.ts +7 -1
- package/bpk-component-checkbox/index.js +3 -1
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckbox.d.ts +9 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckbox.js +33 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckbox.module.css +18 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxControl.d.ts +6 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxControl.js +30 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxDescription.d.ts +6 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxDescription.js +32 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxHiddenInput.d.ts +2 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxHiddenInput.js +25 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxIndicator.d.ts +2 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxIndicator.js +23 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxLabel.d.ts +6 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxLabel.js +30 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxRoot.d.ts +16 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxRoot.js +49 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/themeAttributes.d.ts +2 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/themeAttributes.js +20 -0
- package/bpk-component-checkbox-card/index.d.ts +3 -0
- package/bpk-component-checkbox-card/index.js +20 -0
- package/bpk-component-checkbox-card/src/BpkCheckboxCard.d.ts +128 -0
- package/bpk-component-checkbox-card/src/BpkCheckboxCard.js +216 -0
- package/bpk-component-checkbox-card/src/BpkCheckboxCard.module.css +18 -0
- package/bpk-component-checkbox-card/src/BpkCheckboxCardRoot.d.ts +95 -0
- package/bpk-component-checkbox-card/src/BpkCheckboxCardRoot.js +101 -0
- package/bpk-component-checkbox-card/src/CheckboxCardContext.d.ts +27 -0
- package/bpk-component-checkbox-card/src/CheckboxCardContext.js +47 -0
- package/bpk-component-checkbox-card/src/common-types.d.ts +27 -0
- package/bpk-component-checkbox-card/src/common-types.js +43 -0
- package/bpk-component-checkbox-card/src/themeAttributes.d.ts +46 -0
- package/bpk-component-checkbox-card/src/themeAttributes.js +87 -0
- package/bpk-component-chip/index.d.ts +2 -2
- package/bpk-component-chip/index.js +2 -2
- package/bpk-component-chip/src/BpkSelectableChip.module.css +1 -1
- package/bpk-component-chip/src/themeAttributes.d.ts +4 -0
- package/bpk-component-chip/src/themeAttributes.js +7 -1
- package/bpk-component-pagination/src/BpkPaginationPage.module.css +1 -1
- package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarGridList.js +40 -22
- package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarGridList.module.css +1 -1
- package/bpk-component-scrollable-calendar/src/utils.d.ts +1 -1
- package/bpk-component-segmented-control/index.d.ts +2 -0
- package/bpk-component-segmented-control/index.js +2 -1
- package/bpk-component-segmented-control/src/BpkSegmentedControlV2/BpkSegmentedControlV2.d.ts +19 -0
- package/bpk-component-segmented-control/src/BpkSegmentedControlV2/BpkSegmentedControlV2.js +81 -0
- package/bpk-component-segmented-control/src/BpkSegmentedControlV2/BpkSegmentedControlV2.module.css +18 -0
- package/bpk-component-segmented-control/src/BpkSegmentedControlV2/common-types.d.ts +57 -0
- package/bpk-component-segmented-control/src/BpkSegmentedControlV2/common-types.js +24 -0
- package/bpk-component-table/index.d.ts +13 -0
- package/bpk-component-table/index.js +3 -1
- package/bpk-component-table/src/BpkTable.d.ts +8 -0
- package/bpk-component-table/src/BpkTable.js +7 -14
- package/bpk-component-table/src/BpkTableBody.d.ts +7 -0
- package/bpk-component-table/src/BpkTableBody.js +3 -5
- package/bpk-component-table/src/BpkTableCell.d.ts +9 -0
- package/bpk-component-table/src/BpkTableCell.js +7 -15
- package/bpk-component-table/src/BpkTableHead.d.ts +7 -0
- package/bpk-component-table/src/BpkTableHead.js +3 -5
- package/bpk-component-table/src/BpkTableHeadCell.d.ts +9 -0
- package/bpk-component-table/src/BpkTableHeadCell.js +2 -6
- package/bpk-component-table/src/BpkTableRow.d.ts +7 -0
- package/bpk-component-table/src/BpkTableRow.js +3 -5
- package/bpk-mixins/_buttons.scss +168 -76
- package/bpk-mixins/_chips.scss +104 -18
- package/bpk-mixins/_index.scss +1 -0
- package/bpk-mixins/_segmented-control.scss +263 -0
- package/package.json +2 -1
- package/bpk-component-button/src/BpkButton/BpkButton.d.ts +0 -3
- package/bpk-component-button/src/BpkButton/BpkButton.module.css +0 -18
- /package/bpk-component-button/src/{BpkButton/common-types.js → common-types.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import BpkButton from './src/BpkButton
|
|
2
|
-
export { BUTTON_TYPES, SIZE_TYPES, type ButtonType, type SizeType, type Props, } from './src/
|
|
3
|
-
export { buttonThemeAttributes, primaryThemeAttributes, primaryOnDarkThemeAttributes, primaryOnLightThemeAttributes, secondaryThemeAttributes, secondaryOnDarkThemeAttributes, featuredThemeAttributes, destructiveThemeAttributes, } from './src/themeAttributes';
|
|
1
|
+
import BpkButton from './src/BpkButton';
|
|
2
|
+
export { BUTTON_TYPES, SIZE_TYPES, type ButtonType, type SizeType, type Props, } from './src/common-types';
|
|
3
|
+
export { buttonThemeAttributes, primaryThemeAttributes, primaryOnDarkThemeAttributes, primaryOnLightThemeAttributes, secondaryThemeAttributes, secondaryOnDarkThemeAttributes, featuredThemeAttributes, destructiveThemeAttributes, linkThemeAttributes, } from './src/themeAttributes';
|
|
4
4
|
export default BpkButton;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import BpkButton from "./src/BpkButton
|
|
20
|
-
export { BUTTON_TYPES, SIZE_TYPES } from "./src/
|
|
21
|
-
export { buttonThemeAttributes, primaryThemeAttributes, primaryOnDarkThemeAttributes, primaryOnLightThemeAttributes, secondaryThemeAttributes, secondaryOnDarkThemeAttributes, featuredThemeAttributes, destructiveThemeAttributes } from "./src/themeAttributes";
|
|
19
|
+
import BpkButton from "./src/BpkButton";
|
|
20
|
+
export { BUTTON_TYPES, SIZE_TYPES } from "./src/common-types";
|
|
21
|
+
export { buttonThemeAttributes, primaryThemeAttributes, primaryOnDarkThemeAttributes, primaryOnLightThemeAttributes, secondaryThemeAttributes, secondaryOnDarkThemeAttributes, featuredThemeAttributes, destructiveThemeAttributes, linkThemeAttributes } from "./src/themeAttributes";
|
|
22
22
|
export default BpkButton;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Props } from './common-types';
|
|
2
|
+
declare const BpkButton: ({ blank, children, className, disabled, fullWidth, href, iconOnly, implicit, leadingIcon, loading, onClick, rel: propRel, size, submit, trailingIcon, type, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default BpkButton;
|
|
@@ -15,11 +15,23 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
import {
|
|
18
|
+
import { BpkSpinner, BpkLargeSpinner, SPINNER_TYPES } from "../../bpk-component-spinner";
|
|
19
|
+
import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
19
20
|
import { BUTTON_TYPES, SIZE_TYPES } from "./common-types";
|
|
20
21
|
import COMMON_STYLES from "./BpkButton.module.css";
|
|
21
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
23
|
const getCommonClassName = cssModules(COMMON_STYLES);
|
|
24
|
+
const getSpinnerType = buttonType => {
|
|
25
|
+
switch (buttonType) {
|
|
26
|
+
case BUTTON_TYPES.secondary:
|
|
27
|
+
case BUTTON_TYPES.destructive:
|
|
28
|
+
case BUTTON_TYPES.link:
|
|
29
|
+
case BUTTON_TYPES.primaryOnDark:
|
|
30
|
+
return SPINNER_TYPES.dark;
|
|
31
|
+
default:
|
|
32
|
+
return SPINNER_TYPES.light;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
23
35
|
const BpkButton = ({
|
|
24
36
|
blank = false,
|
|
25
37
|
children,
|
|
@@ -29,25 +41,58 @@ const BpkButton = ({
|
|
|
29
41
|
href = null,
|
|
30
42
|
iconOnly = false,
|
|
31
43
|
implicit = false,
|
|
44
|
+
leadingIcon = null,
|
|
45
|
+
loading = false,
|
|
32
46
|
onClick = () => {},
|
|
33
47
|
rel: propRel = undefined,
|
|
34
48
|
size = SIZE_TYPES.small,
|
|
35
49
|
submit = false,
|
|
50
|
+
trailingIcon = null,
|
|
36
51
|
type = BUTTON_TYPES.primary,
|
|
37
52
|
...rest
|
|
38
53
|
}) => {
|
|
54
|
+
const isDisabled = disabled || loading;
|
|
39
55
|
const isLinkType = type === BUTTON_TYPES.link || type === BUTTON_TYPES.linkOnDark;
|
|
40
56
|
const alternate = type === BUTTON_TYPES.linkOnDark;
|
|
41
|
-
const shouldUnderline = isLinkType && !iconOnly && !
|
|
42
|
-
const
|
|
57
|
+
const shouldUnderline = isLinkType && !iconOnly && !isDisabled;
|
|
58
|
+
const hasIcons = !!(leadingIcon || trailingIcon);
|
|
59
|
+
const classNames = getCommonClassName('bpk-button', size === SIZE_TYPES.large && 'bpk-button--large', iconOnly && 'bpk-button--icon-only', iconOnly && size === SIZE_TYPES.large && 'bpk-button--large-icon-only', `bpk-button--${type}`, loading && 'bpk-button--loading', fullWidth && 'bpk-button--full-width', hasIcons && 'bpk-button--has-icon', isLinkType && iconOnly && 'bpk-button--link--icon-only', isLinkType && implicit && 'bpk-button--link--implicit', className);
|
|
43
60
|
const underlinedClassName = shouldUnderline ? getCommonClassName('bpk-button--link-underlined', implicit && !alternate && 'bpk-button--link-underlined--implicit', alternate && !implicit && 'bpk-button--link-underlined--alternate', implicit && alternate && 'bpk-button--link-underlined--implicit--alternate') : null;
|
|
44
|
-
const
|
|
61
|
+
const textContent = underlinedClassName ? /*#__PURE__*/_jsx("span", {
|
|
45
62
|
className: underlinedClassName,
|
|
46
63
|
children: children
|
|
47
64
|
}) : children;
|
|
65
|
+
const leadingIconEl = !iconOnly && leadingIcon ? /*#__PURE__*/_jsx("span", {
|
|
66
|
+
className: getCommonClassName('bpk-button__leading-icon'),
|
|
67
|
+
children: leadingIcon
|
|
68
|
+
}) : null;
|
|
69
|
+
const trailingIconEl = !iconOnly && trailingIcon ? /*#__PURE__*/_jsx("span", {
|
|
70
|
+
className: getCommonClassName('bpk-button__trailing-icon'),
|
|
71
|
+
children: trailingIcon
|
|
72
|
+
}) : null;
|
|
73
|
+
const innerContent = /*#__PURE__*/_jsxs(_Fragment, {
|
|
74
|
+
children: [leadingIconEl, textContent, trailingIconEl]
|
|
75
|
+
});
|
|
76
|
+
const content = loading ? /*#__PURE__*/_jsxs("div", {
|
|
77
|
+
className: getCommonClassName('bpk-button__loading-container'),
|
|
78
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
79
|
+
className: getCommonClassName('bpk-button__loading-icon'),
|
|
80
|
+
"aria-hidden": "true",
|
|
81
|
+
children: size === SIZE_TYPES.large ? /*#__PURE__*/_jsx(BpkLargeSpinner, {
|
|
82
|
+
type: getSpinnerType(type),
|
|
83
|
+
alignToButton: true
|
|
84
|
+
}) : /*#__PURE__*/_jsx(BpkSpinner, {
|
|
85
|
+
type: getSpinnerType(type),
|
|
86
|
+
alignToButton: true
|
|
87
|
+
})
|
|
88
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
89
|
+
className: getCommonClassName('bpk-button__content--hidden'),
|
|
90
|
+
children: innerContent
|
|
91
|
+
})]
|
|
92
|
+
}) : innerContent;
|
|
48
93
|
const target = blank ? '_blank' : '';
|
|
49
94
|
const rel = blank ? propRel || 'noopener noreferrer' : propRel;
|
|
50
|
-
if (!
|
|
95
|
+
if (!isDisabled && href) {
|
|
51
96
|
return /*#__PURE__*/_jsx("a", {
|
|
52
97
|
href: href,
|
|
53
98
|
className: classNames,
|
|
@@ -61,9 +106,10 @@ const BpkButton = ({
|
|
|
61
106
|
}
|
|
62
107
|
return /*#__PURE__*/_jsx("button", {
|
|
63
108
|
type: submit ? 'submit' : 'button',
|
|
64
|
-
disabled:
|
|
109
|
+
disabled: isDisabled,
|
|
65
110
|
className: classNames,
|
|
66
111
|
...getDataComponentAttribute('Button'),
|
|
112
|
+
"aria-busy": loading || undefined,
|
|
67
113
|
onClick: onClick,
|
|
68
114
|
...rest,
|
|
69
115
|
children: content
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Backpack - Skyscanner's Design System
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2016 Skyscanner Ltd
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
.bpk-button{display:inline-block;min-height:2.25rem;margin:0;padding:.375rem 1rem;border:0;text-align:center;text-decoration:none;cursor:pointer;vertical-align:middle;user-select:none;border-radius:.5rem;border-radius:var(--bpk-button-border-radius, 0.5rem);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){background-color:#154679;background-color:var(--bpk-button-primary-hover-background-color, rgb(21, 70, 121));color:#fff;color:var(--bpk-button-primary-hover-text-color, rgb(255, 255, 255))}:global(.bpk-no-touch-support) .bpk-button:hover:not(:active):not(:disabled){background-color:#154679;background-color:var(--bpk-button-primary-hover-background-color, rgb(21, 70, 121));color:#fff;color:var(--bpk-button-primary-hover-text-color, rgb(255, 255, 255))}.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.bpk-button--loading:disabled{background-color:#154679;background-color:var(--bpk-button-primary-hover-background-color, rgb(21, 70, 121));color:#fff;color:var(--bpk-button-primary-hover-text-color, rgb(255, 255, 255))}@media(hover: hover){.bpk-button--link:hover:not(:active):not(:disabled) .bpk-button--link-underlined,.bpk-button--link-on-dark:hover:not(:active):not(:disabled) .bpk-button--link-underlined{background-size:0 1px}.bpk-button--link:hover:not(:active):not(:disabled) .bpk-button--link-underlined--implicit,.bpk-button--link-on-dark:hover:not(:active):not(:disabled) .bpk-button--link-underlined--implicit--alternate{background-size:100% 1px}}.bpk-button--large{min-height:3rem;padding:.75rem 1rem}.bpk-button--icon-only{padding-right:.625rem;padding-left:.625rem}.bpk-button--large-icon-only{padding-right:.75rem;padding-left:.75rem}.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){background-color:#c1c7cf;background-color:var(--bpk-button-secondary-hover-background-color, rgb(193, 199, 207));color:#161616;color:var(--bpk-button-secondary-hover-text-color, rgb(22, 22, 22))}:global(.bpk-no-touch-support) .bpk-button--destructive:hover:not(:active):not(:disabled){background-color:#c1c7cf;background-color:var(--bpk-button-secondary-hover-background-color, rgb(193, 199, 207));color:#161616;color:var(--bpk-button-secondary-hover-text-color, rgb(22, 22, 22))}.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-button--destructive.bpk-button--loading:disabled{background-color:#c1c7cf;background-color:var(--bpk-button-secondary-hover-background-color, rgb(193, 199, 207));color:#161616;color:var(--bpk-button-secondary-hover-text-color, rgb(22, 22, 22))}.bpk-no-touch-support .bpk-button--destructive:hover:not(:active):not(:disabled){background-color:#e70866;background-color:var(--bpk-button-destructive-hover-background-color, rgb(231, 8, 102));color:#fff;color:var(--bpk-button-destructive-hover-text-color, rgb(255, 255, 255))}:global(.bpk-no-touch-support) .bpk-button--destructive:hover:not(:active):not(:disabled){background-color:#e70866;background-color:var(--bpk-button-destructive-hover-background-color, rgb(231, 8, 102));color:#fff;color:var(--bpk-button-destructive-hover-text-color, rgb(255, 255, 255))}.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--destructive.bpk-button--loading:disabled{background-color:#e70866;background-color:var(--bpk-button-destructive-hover-background-color, rgb(231, 8, 102));color:#fff;color:var(--bpk-button-destructive-hover-text-color, rgb(255, 255, 255))}.bpk-button--featured{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){background-color:#024daf;background-color:var(--bpk-button-featured-hover-background-color, rgb(2, 77, 175));color:#fff;color:var(--bpk-button-featured-hover-text-color, rgb(255, 255, 255))}:global(.bpk-no-touch-support) .bpk-button--featured:hover:not(:active):not(:disabled){background-color:#024daf;background-color:var(--bpk-button-featured-hover-background-color, rgb(2, 77, 175));color:#fff;color:var(--bpk-button-featured-hover-text-color, rgb(255, 255, 255))}.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--featured.bpk-button--loading:disabled{background-color:#024daf;background-color:var(--bpk-button-featured-hover-background-color, rgb(2, 77, 175));color:#fff;color:var(--bpk-button-featured-hover-text-color, rgb(255, 255, 255))}.bpk-button--link{background:none;box-shadow:none;color:#161616;color:var(--bpk-link-color, rgb(22, 22, 22));padding:.375rem 0;color:#0062e3;position:relative;display:inline;padding:0;border:0;background-color:rgba(0,0,0,0);text-decoration:none;cursor:pointer;appearance:none;color:#161616;color:var(--bpk-link-color, rgb(22, 22, 22));--bpk-button-svg-display: inline-block;--bpk-button-svg-vertical-align: middle}.bpk-no-touch-support .bpk-button--link:hover:not(:active):not(:disabled){color:#161616;color:var(--bpk-link-hover-color, rgb(22, 22, 22))}:global(.bpk-no-touch-support) .bpk-button--link:hover:not(:active):not(:disabled){color:#161616;color:var(--bpk-link-hover-color, rgb(22, 22, 22))}.bpk-button--link:active{text-decoration:none;color:#161616;color:var(--bpk-link-active-color, rgb(22, 22, 22))}.bpk-button--link::after{bottom:auto}.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,.bpk-button--link:disabled:active{background:none;color:rgba(0,0,0,.2);text-decoration:none}.bpk-button--link.bpk-button--loading:disabled,.bpk-button--link.bpk-button--loading:disabled:active{background:none;color:#161616;color:var(--bpk-button-link-loading-color, rgb(22, 22, 22))}.bpk-button--link-large{padding:.75rem 0}.bpk-no-touch-support .bpk-button--link:hover:not(:active):not(:disabled){text-decoration:none;color:#161616;color:var(--bpk-link-hover-color, rgb(22, 22, 22))}:global(.bpk-no-touch-support) .bpk-button--link:hover:not(:active):not(:disabled){text-decoration:none;color:#161616;color:var(--bpk-link-hover-color, rgb(22, 22, 22))}.bpk-button--link:visited{color:#161616;color:var(--bpk-link-visited-color, rgb(22, 22, 22))}.bpk-button--link:active{color:#161616;color:var(--bpk-link-active-color, rgb(22, 22, 22))}.bpk-button--link--implicit{color:#161616;color:var(--bpk-link-color, rgb(22, 22, 22))}.bpk-no-touch-support .bpk-button--link--implicit:hover:not(:active):not(:disabled){color:#161616;color:var(--bpk-link-hover-color, rgb(22, 22, 22))}:global(.bpk-no-touch-support) .bpk-button--link--implicit:hover:not(:active):not(:disabled){color:#161616;color:var(--bpk-link-hover-color, rgb(22, 22, 22))}.bpk-button--link--implicit:active{text-decoration:none;color:#161616;color:var(--bpk-link-active-color, rgb(22, 22, 22))}.bpk-button--link--icon-only{display:inline-flex;justify-content:center;align-items:center;vertical-align:middle}.bpk-button--link-on-dark{background:none;box-shadow:none;color:#161616;color:var(--bpk-link-color, rgb(22, 22, 22));padding:.375rem 0;color:#0062e3;color:#fff;color:var(--bpk-button-link-on-dark-text-color, rgb(255, 255, 255));color:#fff;color:var(--bpk-link-alternate-color, rgb(255, 255, 255));--bpk-button-svg-display: inline-block;--bpk-button-svg-vertical-align: middle}.bpk-no-touch-support .bpk-button--link-on-dark:hover:not(:active):not(:disabled){color:#161616;color:var(--bpk-link-hover-color, rgb(22, 22, 22))}:global(.bpk-no-touch-support) .bpk-button--link-on-dark:hover:not(:active):not(:disabled){color:#161616;color:var(--bpk-link-hover-color, rgb(22, 22, 22))}.bpk-button--link-on-dark:active{text-decoration:none;color:#161616;color:var(--bpk-link-active-color, rgb(22, 22, 22))}.bpk-button--link-on-dark::after{bottom:auto}.bpk-no-touch-support .bpk-button--link-on-dark:hover:not(:active):not(:disabled){background:none;color:#024daf;text-decoration:none}:global(.bpk-no-touch-support) .bpk-button--link-on-dark:hover:not(:active):not(:disabled){background:none;color:#024daf;text-decoration:none}.bpk-button--link-on-dark:active{background:none;color:#024daf;text-decoration:none}.bpk-button--link-on-dark:disabled,.bpk-button--link-on-dark:disabled:active{background:none;color:rgba(0,0,0,.2);text-decoration:none}.bpk-button--link-on-dark.bpk-button--loading:disabled,.bpk-button--link-on-dark.bpk-button--loading:disabled:active{background:none;color:#161616;color:var(--bpk-button-link-loading-color, rgb(22, 22, 22))}.bpk-button--link-on-dark-large{padding:.75rem 0}.bpk-no-touch-support .bpk-button--link-on-dark:hover:not(:active):not(:disabled){color:hsla(0,0%,100%,.5);color:var(--bpk-button-link-on-dark-hover-text-color, rgba(255, 255, 255, 0.5))}:global(.bpk-no-touch-support) .bpk-button--link-on-dark:hover:not(:active):not(:disabled){color:hsla(0,0%,100%,.5);color:var(--bpk-button-link-on-dark-hover-text-color, rgba(255, 255, 255, 0.5))}.bpk-button--link-on-dark:active{color:hsla(0,0%,100%,.5);color:var(--bpk-button-link-on-dark-active-text-color, rgba(255, 255, 255, 0.5))}.bpk-button--link-on-dark:visited{color:#fff;color:var(--bpk-button-link-on-dark-text-color, rgb(255, 255, 255))}.bpk-button--link-on-dark:disabled,.bpk-button--link-on-dark:disabled:active{color:hsla(0,0%,100%,.2);color:var(--bpk-button-link-on-dark-disabled-color, rgba(255, 255, 255, 0.2))}.bpk-button--link-on-dark.bpk-button--loading:disabled,.bpk-button--link-on-dark.bpk-button--loading:disabled:active{color:hsla(0,0%,100%,.5);color:var(--bpk-button-link-on-dark-hover-text-color, rgba(255, 255, 255, 0.5))}.bpk-no-touch-support .bpk-button--link-on-dark:hover:not(:active):not(:disabled){color:#fff;color:var(--bpk-link-alternate-hover-color, rgb(255, 255, 255))}:global(.bpk-no-touch-support) .bpk-button--link-on-dark:hover:not(:active):not(:disabled){color:#fff;color:var(--bpk-link-alternate-hover-color, rgb(255, 255, 255))}.bpk-button--link-on-dark:visited{color:#fff;color:var(--bpk-link-alternate-visited-color, rgb(255, 255, 255))}.bpk-button--link-on-dark:active{color:#fff;color:var(--bpk-link-alternate-active-color, rgb(255, 255, 255))}.bpk-button--link-on-dark--implicit{color:#161616;color:var(--bpk-link-color, rgb(22, 22, 22))}.bpk-no-touch-support .bpk-button--link-on-dark--implicit:hover:not(:active):not(:disabled){color:#161616;color:var(--bpk-link-hover-color, rgb(22, 22, 22))}:global(.bpk-no-touch-support) .bpk-button--link-on-dark--implicit:hover:not(:active):not(:disabled){color:#161616;color:var(--bpk-link-hover-color, rgb(22, 22, 22))}.bpk-button--link-on-dark--implicit:active{text-decoration:none;color:#161616;color:var(--bpk-link-active-color, rgb(22, 22, 22))}.bpk-button--link-underlined{gap:.5rem;display:inline-flex;justify-content:center;align-items:center;vertical-align:middle;padding-bottom:.0625rem;transition:background-size 200ms ease;background:linear-gradient(rgb(22, 22, 22), rgb(22, 22, 22));background-repeat:no-repeat;background-position:0 100%;background-size:100% 1px}.bpk-no-touch-support .bpk-button--link-underlined:hover:not(:active):not(:disabled){background-size:0 1px}:global(.bpk-no-touch-support) .bpk-button--link-underlined:hover:not(:active):not(:disabled){background-size:0 1px}.bpk-button--link-underlined--implicit{background-size:0 1px}.bpk-no-touch-support .bpk-button--link-underlined--implicit:hover:not(:active):not(:disabled){background-size:100% 1px}:global(.bpk-no-touch-support) .bpk-button--link-underlined--implicit:hover:not(:active):not(:disabled){background-size:100% 1px}.bpk-button--link-underlined--alternate{background:linear-gradient(rgb(255, 255, 255), rgb(255, 255, 255));background-repeat:no-repeat;background-position:0 100%;background-size:100% 1px}.bpk-no-touch-support .bpk-button--link-underlined--alternate:hover:not(:active):not(:disabled){background-size:0 1px}:global(.bpk-no-touch-support) .bpk-button--link-underlined--alternate:hover:not(:active):not(:disabled){background-size:0 1px}.bpk-button--link-underlined--implicit--alternate{background:linear-gradient(rgb(255, 255, 255), rgb(255, 255, 255));background-repeat:no-repeat;background-position:0 100%;background-size:0 1px}.bpk-no-touch-support .bpk-button--link-underlined--implicit--alternate:hover:not(:active):not(:disabled){background-size:100% 1px}:global(.bpk-no-touch-support) .bpk-button--link-underlined--implicit--alternate:hover:not(:active):not(:disabled){background-size:100% 1px}.bpk-button--primary-on-dark{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--primary-on-dark:hover:not(:active):not(:disabled){background-color:#c1c7cf;background-color:var(--bpk-button-primary-on-dark-hover-background-color, rgb(193, 199, 207));color:#161616;color:var(--bpk-button-primary-on-dark-hover-text-color, rgb(22, 22, 22))}:global(.bpk-no-touch-support) .bpk-button--primary-on-dark:hover:not(:active):not(:disabled){background-color:#c1c7cf;background-color:var(--bpk-button-primary-on-dark-hover-background-color, rgb(193, 199, 207));color:#161616;color:var(--bpk-button-primary-on-dark-hover-text-color, rgb(22, 22, 22))}.bpk-button--primary-on-dark: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--primary-on-dark:disabled{background-color:#e0e4e9;color:rgba(0,0,0,.2)}.bpk-button--primary-on-dark.bpk-button--loading:disabled{background-color:#c1c7cf;background-color:var(--bpk-button-primary-on-dark-hover-background-color, rgb(193, 199, 207));color:#161616;color:var(--bpk-button-primary-on-dark-hover-text-color, rgb(22, 22, 22))}.bpk-button--primary-on-light{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--primary-on-light:hover:not(:active):not(:disabled){background-color:#154679;background-color:var(--bpk-button-primary-on-light-hover-background-color, rgb(21, 70, 121));color:#fff;color:var(--bpk-button-primary-on-light-hover-text-color, rgb(255, 255, 255))}:global(.bpk-no-touch-support) .bpk-button--primary-on-light:hover:not(:active):not(:disabled){background-color:#154679;background-color:var(--bpk-button-primary-on-light-hover-background-color, rgb(21, 70, 121));color:#fff;color:var(--bpk-button-primary-on-light-hover-text-color, rgb(255, 255, 255))}.bpk-button--primary-on-light: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--primary-on-light:disabled{background-color:#e0e4e9;color:rgba(0,0,0,.2)}.bpk-button--primary-on-light.bpk-button--loading:disabled{background-color:#154679;background-color:var(--bpk-button-primary-on-light-hover-background-color, rgb(21, 70, 121));color:#fff;color:var(--bpk-button-primary-on-light-hover-text-color, rgb(255, 255, 255))}.bpk-button--secondary{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){background-color:#c1c7cf;background-color:var(--bpk-button-secondary-hover-background-color, rgb(193, 199, 207));color:#161616;color:var(--bpk-button-secondary-hover-text-color, rgb(22, 22, 22))}:global(.bpk-no-touch-support) .bpk-button--secondary:hover:not(:active):not(:disabled){background-color:#c1c7cf;background-color:var(--bpk-button-secondary-hover-background-color, rgb(193, 199, 207));color:#161616;color:var(--bpk-button-secondary-hover-text-color, rgb(22, 22, 22))}.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--secondary.bpk-button--loading:disabled{background-color:#c1c7cf;background-color:var(--bpk-button-secondary-hover-background-color, rgb(193, 199, 207));color:#161616;color:var(--bpk-button-secondary-hover-text-color, rgb(22, 22, 22))}.bpk-button--secondary-on-dark{color:#fff;color:var(--bpk-button-secondary-on-dark-text-color, rgb(255, 255, 255));background-color:hsla(0,0%,100%,.1);background-color:var(--bpk-button-secondary-on-dark-background-color, rgba(255, 255, 255, 0.1))}.bpk-no-touch-support .bpk-button--secondary-on-dark:hover:not(:active):not(:disabled){background-color:#04182d;background-color:var(--bpk-button-secondary-on-dark-hover-background-color, rgb(4, 24, 45));color:#fff;color:var(--bpk-button-secondary-on-dark-hover-text-color, rgb(255, 255, 255))}:global(.bpk-no-touch-support) .bpk-button--secondary-on-dark:hover:not(:active):not(:disabled){background-color:#04182d;background-color:var(--bpk-button-secondary-on-dark-hover-background-color, rgb(4, 24, 45));color:#fff;color:var(--bpk-button-secondary-on-dark-hover-text-color, rgb(255, 255, 255))}.bpk-button--secondary-on-dark:active{color:#fff;color:var(--bpk-button-secondary-on-dark-active-text-color, rgb(255, 255, 255));background-color:#04182d;background-color:var(--bpk-button-secondary-on-dark-active-background-color, rgb(4, 24, 45))}.bpk-button--secondary-on-dark:disabled{background-color:#0b121d;color:hsla(0,0%,100%,.2)}.bpk-button--secondary-on-dark.bpk-button--loading:disabled{background-color:#04182d;background-color:var(--bpk-button-secondary-on-dark-hover-background-color, rgb(4, 24, 45));color:#fff;color:var(--bpk-button-secondary-on-dark-hover-text-color, rgb(255, 255, 255))}.bpk-button--full-width{display:block;width:100%}.bpk-button--has-icon{display:inline-flex;align-items:center;gap:.5rem}.bpk-button--full-width.bpk-button--has-icon{display:flex;justify-content:center}.bpk-button__leading-icon,.bpk-button__trailing-icon{display:inline-flex;flex-shrink:0;text-decoration:none}.bpk-button__loading-container{position:relative;display:inline-flex;justify-content:center;align-items:center}.bpk-button__loading-icon{position:absolute;display:inline-flex;--bpk-button-svg-display: block;--bpk-button-svg-vertical-align: baseline}.bpk-button__content--hidden{opacity:0}.bpk-button span>svg{display:var(--bpk-button-svg-display, block);vertical-align:var(--bpk-button-svg-vertical-align, baseline)}.bpk-button svg{fill:currentcolor}
|
|
@@ -30,5 +30,9 @@ export type Props = {
|
|
|
30
30
|
submit?: boolean;
|
|
31
31
|
href?: string | null;
|
|
32
32
|
blank?: boolean;
|
|
33
|
+
leadingIcon?: ReactNode;
|
|
34
|
+
trailingIcon?: ReactNode;
|
|
35
|
+
/** When true, shows a loading spinner and disables interaction. Layout is preserved. @default false */
|
|
36
|
+
loading?: boolean;
|
|
33
37
|
[rest: string]: any;
|
|
34
38
|
};
|
|
@@ -6,3 +6,4 @@ export declare const secondaryThemeAttributes: string[];
|
|
|
6
6
|
export declare const secondaryOnDarkThemeAttributes: string[];
|
|
7
7
|
export declare const featuredThemeAttributes: string[];
|
|
8
8
|
export declare const destructiveThemeAttributes: string[];
|
|
9
|
+
export declare const linkThemeAttributes: string[];
|
|
@@ -23,4 +23,5 @@ export const primaryOnLightThemeAttributes = ['buttonPrimaryOnLightTextColor', '
|
|
|
23
23
|
export const secondaryThemeAttributes = ['buttonSecondaryTextColor', 'buttonSecondaryHoverTextColor', 'buttonSecondaryActiveTextColor', 'buttonSecondaryBorderColor', 'buttonSecondaryHoverBorderColor', 'buttonSecondaryActiveBorderColor', 'buttonSecondaryBackgroundColor', 'buttonSecondaryHoverBackgroundColor', 'buttonSecondaryActiveBackgroundColor'];
|
|
24
24
|
export const secondaryOnDarkThemeAttributes = ['buttonSecondaryOnDarkTextColor', 'buttonSecondaryOnDarkHoverTextColor', 'buttonSecondaryOnDarkActiveTextColor', 'buttonSecondaryOnDarkBackgroundColor', 'buttonSecondaryOnDarkHoverBackgroundColor', 'buttonSecondaryOnDarkActiveBackgroundColor'];
|
|
25
25
|
export const featuredThemeAttributes = ['buttonFeaturedTextColor', 'buttonFeaturedHoverTextColor', 'buttonFeaturedActiveTextColor', 'buttonFeaturedGradientStartColor', 'buttonFeaturedGradientEndColor', 'buttonFeaturedBackgroundColor', 'buttonFeaturedHoverBackgroundColor', 'buttonFeaturedActiveBackgroundColor'];
|
|
26
|
-
export const destructiveThemeAttributes = ['buttonDestructiveTextColor', 'buttonDestructiveHoverTextColor', 'buttonDestructiveActiveTextColor', 'buttonDestructiveBorderColor', 'buttonDestructiveHoverBorderColor', 'buttonDestructiveActiveBorderColor', 'buttonDestructiveBackgroundColor', 'buttonDestructiveHoverBackgroundColor', 'buttonDestructiveActiveBackgroundColor'];
|
|
26
|
+
export const destructiveThemeAttributes = ['buttonDestructiveTextColor', 'buttonDestructiveHoverTextColor', 'buttonDestructiveActiveTextColor', 'buttonDestructiveBorderColor', 'buttonDestructiveHoverBorderColor', 'buttonDestructiveActiveBorderColor', 'buttonDestructiveBackgroundColor', 'buttonDestructiveHoverBackgroundColor', 'buttonDestructiveActiveBackgroundColor'];
|
|
27
|
+
export const linkThemeAttributes = ['buttonLinkLoadingColor'];
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import BpkCheckbox, { type Props as BpkCheckboxProps } from './src/BpkCheckbox';
|
|
2
|
+
import BpkCheckboxV2 from './src/BpkCheckboxV2/BpkCheckbox';
|
|
3
|
+
import { checkboxSelectedColorThemeAttributes, checkboxBorderRadiusThemeAttributes } from './src/BpkCheckboxV2/themeAttributes';
|
|
2
4
|
import themeAttributes from './src/themeAttributes';
|
|
3
5
|
export type { BpkCheckboxProps };
|
|
6
|
+
export type { BpkCheckboxRootProps, BpkCheckedState } from './src/BpkCheckboxV2/BpkCheckboxRoot';
|
|
7
|
+
export type { BpkCheckboxControlProps } from './src/BpkCheckboxV2/BpkCheckboxControl';
|
|
8
|
+
export type { BpkCheckboxLabelProps } from './src/BpkCheckboxV2/BpkCheckboxLabel';
|
|
9
|
+
export type { BpkCheckboxDescriptionProps } from './src/BpkCheckboxV2/BpkCheckboxDescription';
|
|
4
10
|
export default BpkCheckbox;
|
|
5
|
-
export { themeAttributes };
|
|
11
|
+
export { themeAttributes, checkboxSelectedColorThemeAttributes, checkboxBorderRadiusThemeAttributes, BpkCheckboxV2, };
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import BpkCheckbox from "./src/BpkCheckbox";
|
|
20
|
+
import BpkCheckboxV2 from "./src/BpkCheckboxV2/BpkCheckbox";
|
|
21
|
+
import { checkboxSelectedColorThemeAttributes, checkboxBorderRadiusThemeAttributes } from "./src/BpkCheckboxV2/themeAttributes";
|
|
20
22
|
import themeAttributes from "./src/themeAttributes";
|
|
21
23
|
export default BpkCheckbox;
|
|
22
|
-
export { themeAttributes };
|
|
24
|
+
export { themeAttributes, checkboxSelectedColorThemeAttributes, checkboxBorderRadiusThemeAttributes, BpkCheckboxV2 };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const BpkCheckbox: {
|
|
2
|
+
Root: ({ checked, children, defaultChecked, disabled, id, invalid, name, onCheckedChange, required, value, }: import("./BpkCheckboxRoot").BpkCheckboxRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
Control: ({ children }: import("./BpkCheckboxControl").BpkCheckboxControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
Indicator: () => null;
|
|
5
|
+
Label: ({ children }: import("./BpkCheckboxLabel").BpkCheckboxLabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
Description: ({ children }: import("./BpkCheckboxDescription").BpkCheckboxDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
HiddenInput: () => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
};
|
|
9
|
+
export default BpkCheckbox;
|
|
@@ -0,0 +1,33 @@
|
|
|
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 BpkCheckboxControl from "./BpkCheckboxControl";
|
|
20
|
+
import BpkCheckboxDescription from "./BpkCheckboxDescription";
|
|
21
|
+
import BpkCheckboxHiddenInput from "./BpkCheckboxHiddenInput";
|
|
22
|
+
import BpkCheckboxIndicator from "./BpkCheckboxIndicator";
|
|
23
|
+
import BpkCheckboxLabel from "./BpkCheckboxLabel";
|
|
24
|
+
import BpkCheckboxRoot from "./BpkCheckboxRoot";
|
|
25
|
+
const BpkCheckbox = {
|
|
26
|
+
Root: BpkCheckboxRoot,
|
|
27
|
+
Control: BpkCheckboxControl,
|
|
28
|
+
Indicator: BpkCheckboxIndicator,
|
|
29
|
+
Label: BpkCheckboxLabel,
|
|
30
|
+
Description: BpkCheckboxDescription,
|
|
31
|
+
HiddenInput: BpkCheckboxHiddenInput
|
|
32
|
+
};
|
|
33
|
+
export default BpkCheckbox;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Backpack - Skyscanner's Design System
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2016 Skyscanner Ltd
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
.bpk-checkbox-v2{display:inline-flex;align-items:flex-start;cursor:pointer;gap:.5rem}.bpk-checkbox-v2[data-disabled]{cursor:not-allowed}.bpk-checkbox-v2__control{position:relative;display:flex;width:1.25rem;height:1.25rem;margin-top:.125rem;justify-content:center;align-items:center;flex-shrink:0;border:.1875rem solid #626971;background-color:#fff;border-radius:.25rem;border-radius:var(--bpk-checkbox-border-radius, 0.25rem)}.bpk-checkbox-v2__control[data-focus-visible]{outline:.125rem solid #0062e3;outline-offset:.125rem}.bpk-checkbox-v2__control[data-state=checked]{border-width:.1875rem;border-color:#0062e3;border-color:var(--bpk-checkbox-selected-color, rgb(0, 98, 227));background-color:#0062e3;background-color:var(--bpk-checkbox-selected-color, rgb(0, 98, 227));background-image:url("data:image/svg+xml,%3Csvg%20width%3D%2213%22%20height%3D%229%22%20viewBox%3D%220%200%2013%209%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M2.35352%203.64648L5.5%207.5L11.5%201.5%22%20stroke%3D%22white%22%20stroke-width%3D%223%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E");background-repeat:no-repeat;background-position:.0625rem center;background-size:calc(100% - .15625rem) auto}.bpk-checkbox-v2__control[data-state=checked]:disabled{background-image:url("data:image/svg+xml,%3Csvg%20width%3D%2213%22%20height%3D%229%22%20viewBox%3D%220%200%2013%209%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M2.35352%203.64648L5.5%207.5L11.5%201.5%22%20stroke%3D%22lightgrey%22%20stroke-width%3D%223%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E")}.bpk-checkbox-v2__control[data-state=indeterminate]{border-width:.1875rem;border-color:#0062e3;border-color:var(--bpk-checkbox-selected-color, rgb(0, 98, 227));background-color:#0062e3;background-color:var(--bpk-checkbox-selected-color, rgb(0, 98, 227))}.bpk-checkbox-v2__control[data-state=indeterminate]::before{content:"";width:.625rem;height:.1875rem;border-radius:2px;background-color:#fff}.bpk-checkbox-v2__control[data-invalid]{border-color:#e70866}.bpk-checkbox-v2__control[data-disabled]{border-color:rgba(0,0,0,.2);background-color:#fff}.bpk-checkbox-v2__control[data-disabled][data-state=checked],.bpk-checkbox-v2__control[data-disabled][data-state=indeterminate]{border-color:rgba(0,0,0,.2);background-color:#fff}.bpk-checkbox-v2__control[data-disabled][data-state=checked]{background-image:url("data:image/svg+xml,%3Csvg%20width%3D%2213%22%20height%3D%229%22%20viewBox%3D%220%200%2013%209%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M2.35352%203.64648L5.5%207.5L11.5%201.5%22%20stroke%3D%22lightgrey%22%20stroke-width%3D%223%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E")}.bpk-checkbox-v2__label{color:#161616;user-select:none;font-size:1rem;line-height:1.5rem;font-weight:400}.bpk-checkbox-v2__label a{color:inherit}[data-disabled] .bpk-checkbox-v2__label{color:rgba(0,0,0,.2)}.bpk-checkbox-v2__description{display:block;margin-top:.25rem;color:#626971;font-size:.875rem;line-height:1.25rem;font-weight:400}[data-disabled] .bpk-checkbox-v2__description{color:rgba(0,0,0,.2)}
|
|
@@ -0,0 +1,30 @@
|
|
|
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 { Checkbox } from '@ark-ui/react';
|
|
20
|
+
import { cssModules } from "../../../bpk-react-utils";
|
|
21
|
+
import STYLES from "./BpkCheckbox.module.css";
|
|
22
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
+
const getClassName = cssModules(STYLES);
|
|
24
|
+
const BpkCheckboxControl = ({
|
|
25
|
+
children
|
|
26
|
+
}) => /*#__PURE__*/_jsx(Checkbox.Control, {
|
|
27
|
+
className: getClassName('bpk-checkbox-v2__control'),
|
|
28
|
+
children: children
|
|
29
|
+
});
|
|
30
|
+
export default BpkCheckboxControl;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type BpkCheckboxDescriptionProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
};
|
|
5
|
+
declare const BpkCheckboxDescription: ({ children }: BpkCheckboxDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default BpkCheckboxDescription;
|
|
@@ -0,0 +1,32 @@
|
|
|
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 { cssModules } from "../../../bpk-react-utils";
|
|
20
|
+
import STYLES from "./BpkCheckbox.module.css";
|
|
21
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
+
const getClassName = cssModules(STYLES);
|
|
23
|
+
// Description renders as a <span> inside the Checkbox.Root <label>.
|
|
24
|
+
// Being inside the <label> element means screen readers announce its text
|
|
25
|
+
// as part of the checkbox's accessible name.
|
|
26
|
+
const BpkCheckboxDescription = ({
|
|
27
|
+
children
|
|
28
|
+
}) => /*#__PURE__*/_jsx("span", {
|
|
29
|
+
className: getClassName('bpk-checkbox-v2__description'),
|
|
30
|
+
children: children
|
|
31
|
+
});
|
|
32
|
+
export default BpkCheckboxDescription;
|
|
@@ -0,0 +1,25 @@
|
|
|
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 { Checkbox } from '@ark-ui/react';
|
|
20
|
+
|
|
21
|
+
// Renders Ark's visually hidden native <input type="checkbox">.
|
|
22
|
+
// Include when the checkbox is inside a <form> for native form submission.
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
const BpkCheckboxHiddenInput = () => /*#__PURE__*/_jsx(Checkbox.HiddenInput, {});
|
|
25
|
+
export default BpkCheckboxHiddenInput;
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
// The checkmark and indeterminate bar are rendered via CSS on BpkCheckboxControl
|
|
20
|
+
// (bpk-checkbox__checkmark mixin + ::before pseudo-element), so this slot
|
|
21
|
+
// component intentionally renders nothing.
|
|
22
|
+
const BpkCheckboxIndicator = () => null;
|
|
23
|
+
export default BpkCheckboxIndicator;
|
|
@@ -0,0 +1,30 @@
|
|
|
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 { Checkbox } from '@ark-ui/react';
|
|
20
|
+
import { cssModules } from "../../../bpk-react-utils";
|
|
21
|
+
import STYLES from "./BpkCheckbox.module.css";
|
|
22
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
+
const getClassName = cssModules(STYLES);
|
|
24
|
+
const BpkCheckboxLabel = ({
|
|
25
|
+
children
|
|
26
|
+
}) => /*#__PURE__*/_jsx(Checkbox.Label, {
|
|
27
|
+
className: getClassName('bpk-checkbox-v2__label'),
|
|
28
|
+
children: children
|
|
29
|
+
});
|
|
30
|
+
export default BpkCheckboxLabel;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type BpkCheckedState = boolean | 'indeterminate';
|
|
3
|
+
export type BpkCheckboxRootProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
checked?: BpkCheckedState;
|
|
6
|
+
defaultChecked?: BpkCheckedState;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
id?: string;
|
|
9
|
+
invalid?: boolean;
|
|
10
|
+
name?: string;
|
|
11
|
+
onCheckedChange?: (checked: BpkCheckedState) => void;
|
|
12
|
+
required?: boolean;
|
|
13
|
+
value?: string;
|
|
14
|
+
};
|
|
15
|
+
declare const BpkCheckboxRoot: ({ checked, children, defaultChecked, disabled, id, invalid, name, onCheckedChange, required, value, }: BpkCheckboxRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export default BpkCheckboxRoot;
|
|
@@ -0,0 +1,49 @@
|
|
|
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 { Checkbox } from '@ark-ui/react';
|
|
20
|
+
import { cssModules, getDataComponentAttribute } from "../../../bpk-react-utils";
|
|
21
|
+
import STYLES from "./BpkCheckbox.module.css";
|
|
22
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
+
const getClassName = cssModules(STYLES);
|
|
24
|
+
const BpkCheckboxRoot = ({
|
|
25
|
+
checked,
|
|
26
|
+
children,
|
|
27
|
+
defaultChecked,
|
|
28
|
+
disabled = false,
|
|
29
|
+
id,
|
|
30
|
+
invalid = false,
|
|
31
|
+
name,
|
|
32
|
+
onCheckedChange,
|
|
33
|
+
required = false,
|
|
34
|
+
value
|
|
35
|
+
}) => /*#__PURE__*/_jsx(Checkbox.Root, {
|
|
36
|
+
className: getClassName('bpk-checkbox-v2'),
|
|
37
|
+
checked: checked,
|
|
38
|
+
defaultChecked: defaultChecked,
|
|
39
|
+
disabled: disabled,
|
|
40
|
+
id: id,
|
|
41
|
+
invalid: invalid,
|
|
42
|
+
name: name,
|
|
43
|
+
onCheckedChange: details => onCheckedChange?.(details.checked),
|
|
44
|
+
required: required,
|
|
45
|
+
value: value,
|
|
46
|
+
...getDataComponentAttribute('CheckboxV2'),
|
|
47
|
+
children: children
|
|
48
|
+
});
|
|
49
|
+
export default BpkCheckboxRoot;
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
export const checkboxSelectedColorThemeAttributes = ['checkboxSelectedColor'];
|
|
20
|
+
export const checkboxBorderRadiusThemeAttributes = ['checkboxBorderRadius'];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { BpkCheckboxCard, default, CHECKBOX_CARD_VARIANTS, CHECKBOX_CARD_RADIUS, useCheckboxCardContext, } from './src/BpkCheckboxCard';
|
|
2
|
+
export type { BpkCheckboxCardRootProps, BpkCheckboxCardContentProps, BpkCheckboxCardLabelProps, BpkCheckboxCardDescriptionProps, CheckboxCardContextValue, CheckboxCardVariant, CheckboxCardRadius, CheckboxCardChangeHandler, } from './src/BpkCheckboxCard';
|
|
3
|
+
export { default as CHECKBOX_CARD_THEME_ATTRIBUTES, createCheckboxCardTheme, } from './src/themeAttributes';
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
export { BpkCheckboxCard, default, CHECKBOX_CARD_VARIANTS, CHECKBOX_CARD_RADIUS, useCheckboxCardContext } from "./src/BpkCheckboxCard";
|
|
20
|
+
export { default as CHECKBOX_CARD_THEME_ATTRIBUTES, createCheckboxCardTheme } from "./src/themeAttributes";
|