@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.
Files changed (78) hide show
  1. package/bpk-component-button/index.d.ts +3 -3
  2. package/bpk-component-button/index.js +3 -3
  3. package/bpk-component-button/src/BpkButton.d.ts +3 -0
  4. package/bpk-component-button/src/{BpkButton/BpkButton.js → BpkButton.js} +53 -7
  5. package/bpk-component-button/src/BpkButton.module.css +18 -0
  6. package/bpk-component-button/src/{BpkButton/common-types.d.ts → common-types.d.ts} +4 -0
  7. package/bpk-component-button/src/themeAttributes.d.ts +1 -0
  8. package/bpk-component-button/src/themeAttributes.js +2 -1
  9. package/bpk-component-checkbox/index.d.ts +7 -1
  10. package/bpk-component-checkbox/index.js +3 -1
  11. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckbox.d.ts +9 -0
  12. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckbox.js +33 -0
  13. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckbox.module.css +18 -0
  14. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxControl.d.ts +6 -0
  15. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxControl.js +30 -0
  16. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxDescription.d.ts +6 -0
  17. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxDescription.js +32 -0
  18. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxHiddenInput.d.ts +2 -0
  19. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxHiddenInput.js +25 -0
  20. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxIndicator.d.ts +2 -0
  21. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxIndicator.js +23 -0
  22. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxLabel.d.ts +6 -0
  23. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxLabel.js +30 -0
  24. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxRoot.d.ts +16 -0
  25. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxRoot.js +49 -0
  26. package/bpk-component-checkbox/src/BpkCheckboxV2/themeAttributes.d.ts +2 -0
  27. package/bpk-component-checkbox/src/BpkCheckboxV2/themeAttributes.js +20 -0
  28. package/bpk-component-checkbox-card/index.d.ts +3 -0
  29. package/bpk-component-checkbox-card/index.js +20 -0
  30. package/bpk-component-checkbox-card/src/BpkCheckboxCard.d.ts +128 -0
  31. package/bpk-component-checkbox-card/src/BpkCheckboxCard.js +216 -0
  32. package/bpk-component-checkbox-card/src/BpkCheckboxCard.module.css +18 -0
  33. package/bpk-component-checkbox-card/src/BpkCheckboxCardRoot.d.ts +95 -0
  34. package/bpk-component-checkbox-card/src/BpkCheckboxCardRoot.js +101 -0
  35. package/bpk-component-checkbox-card/src/CheckboxCardContext.d.ts +27 -0
  36. package/bpk-component-checkbox-card/src/CheckboxCardContext.js +47 -0
  37. package/bpk-component-checkbox-card/src/common-types.d.ts +27 -0
  38. package/bpk-component-checkbox-card/src/common-types.js +43 -0
  39. package/bpk-component-checkbox-card/src/themeAttributes.d.ts +46 -0
  40. package/bpk-component-checkbox-card/src/themeAttributes.js +87 -0
  41. package/bpk-component-chip/index.d.ts +2 -2
  42. package/bpk-component-chip/index.js +2 -2
  43. package/bpk-component-chip/src/BpkSelectableChip.module.css +1 -1
  44. package/bpk-component-chip/src/themeAttributes.d.ts +4 -0
  45. package/bpk-component-chip/src/themeAttributes.js +7 -1
  46. package/bpk-component-pagination/src/BpkPaginationPage.module.css +1 -1
  47. package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarGridList.js +40 -22
  48. package/bpk-component-scrollable-calendar/src/BpkScrollableCalendarGridList.module.css +1 -1
  49. package/bpk-component-scrollable-calendar/src/utils.d.ts +1 -1
  50. package/bpk-component-segmented-control/index.d.ts +2 -0
  51. package/bpk-component-segmented-control/index.js +2 -1
  52. package/bpk-component-segmented-control/src/BpkSegmentedControlV2/BpkSegmentedControlV2.d.ts +19 -0
  53. package/bpk-component-segmented-control/src/BpkSegmentedControlV2/BpkSegmentedControlV2.js +81 -0
  54. package/bpk-component-segmented-control/src/BpkSegmentedControlV2/BpkSegmentedControlV2.module.css +18 -0
  55. package/bpk-component-segmented-control/src/BpkSegmentedControlV2/common-types.d.ts +57 -0
  56. package/bpk-component-segmented-control/src/BpkSegmentedControlV2/common-types.js +24 -0
  57. package/bpk-component-table/index.d.ts +13 -0
  58. package/bpk-component-table/index.js +3 -1
  59. package/bpk-component-table/src/BpkTable.d.ts +8 -0
  60. package/bpk-component-table/src/BpkTable.js +7 -14
  61. package/bpk-component-table/src/BpkTableBody.d.ts +7 -0
  62. package/bpk-component-table/src/BpkTableBody.js +3 -5
  63. package/bpk-component-table/src/BpkTableCell.d.ts +9 -0
  64. package/bpk-component-table/src/BpkTableCell.js +7 -15
  65. package/bpk-component-table/src/BpkTableHead.d.ts +7 -0
  66. package/bpk-component-table/src/BpkTableHead.js +3 -5
  67. package/bpk-component-table/src/BpkTableHeadCell.d.ts +9 -0
  68. package/bpk-component-table/src/BpkTableHeadCell.js +2 -6
  69. package/bpk-component-table/src/BpkTableRow.d.ts +7 -0
  70. package/bpk-component-table/src/BpkTableRow.js +3 -5
  71. package/bpk-mixins/_buttons.scss +168 -76
  72. package/bpk-mixins/_chips.scss +104 -18
  73. package/bpk-mixins/_index.scss +1 -0
  74. package/bpk-mixins/_segmented-control.scss +263 -0
  75. package/package.json +2 -1
  76. package/bpk-component-button/src/BpkButton/BpkButton.d.ts +0 -3
  77. package/bpk-component-button/src/BpkButton/BpkButton.module.css +0 -18
  78. /package/bpk-component-button/src/{BpkButton/common-types.js → common-types.js} +0 -0
@@ -0,0 +1,128 @@
1
+ import type { ReactNode } from 'react';
2
+ import { Root } from './BpkCheckboxCardRoot';
3
+ import type { TextStyle } from '../../bpk-component-text/src/BpkText';
4
+ /**
5
+ * BpkCheckboxCard.HiddenInput - Accessible hidden checkbox input for form submission.
6
+ *
7
+ * Renders a visually hidden <input type="checkbox"> managed by Ark UI.
8
+ * Handles name, value, checked state, required, and disabled automatically.
9
+ * Must be placed inside BpkCheckboxCard.Root.
10
+ *
11
+ * @returns {JSX.Element} The hidden checkbox input element.
12
+ */
13
+ declare function HiddenInput(): import("react/jsx-runtime").JSX.Element;
14
+ export type ContentProps = {
15
+ /**
16
+ * Child components (slots, Stack layout primitives, etc.)
17
+ * Optional - can be empty for minimal card displays
18
+ */
19
+ children?: ReactNode;
20
+ };
21
+ /**
22
+ * BpkCheckboxCard.Content - Main content container
23
+ *
24
+ * Provides a simple wrapper container for organising checkbox card content.
25
+ * Use BpkVStack / BpkHStack for layout control inside Content.
26
+ */
27
+ declare function Content({ children }: ContentProps): import("react/jsx-runtime").JSX.Element;
28
+ export type LabelProps = {
29
+ /** Label text content (plain string only) */
30
+ children: string;
31
+ /** Text style from Backpack typography system. @default "heading-5" */
32
+ textStyle?: TextStyle;
33
+ /** Maximum number of lines before truncation. @default 2 */
34
+ lineClamp?: number;
35
+ };
36
+ /**
37
+ * BpkCheckboxCard.Label - Primary label slot component
38
+ *
39
+ * Displays the primary text label using BpkText.
40
+ * Automatically truncates with ellipsis after the specified number of lines.
41
+ * Accessibility is provided by the wrapping <label> element from Ark UI's CheckboxRoot.
42
+ */
43
+ declare function Label({ children, lineClamp, textStyle }: LabelProps): import("react/jsx-runtime").JSX.Element;
44
+ export type DescriptionProps = {
45
+ /** Description text content (plain string only) */
46
+ children: string;
47
+ /** Text style from Backpack typography system. @default "body-default" */
48
+ textStyle?: TextStyle;
49
+ /** Maximum number of lines before truncation. @default 3 */
50
+ lineClamp?: number;
51
+ };
52
+ /**
53
+ * BpkCheckboxCard.Description - Secondary description slot component
54
+ *
55
+ * Displays secondary descriptive text using BpkText.
56
+ * Automatically truncates with ellipsis after the specified number of lines.
57
+ */
58
+ declare function Description({ children, lineClamp, textStyle }: DescriptionProps): import("react/jsx-runtime").JSX.Element;
59
+ export type PriceProps = {
60
+ /** Price string, e.g. "£35" */
61
+ price: string;
62
+ /** Leading text before the price, e.g. "from". @default "from" */
63
+ leadingText?: string;
64
+ };
65
+ /**
66
+ * BpkCheckboxCard.Price - Cars-specific price slot.
67
+ *
68
+ * Reads `loading` from context automatically:
69
+ * - loading=true → shows "{leadingText}" + spinner
70
+ * - loading=false → shows "{leadingText} {price}" as secondary description text
71
+ *
72
+ * Intended for use with variant="cars" only.
73
+ */
74
+ declare function Price({ leadingText, price }: PriceProps): import("react/jsx-runtime").JSX.Element;
75
+ export type IndicatorProps = Record<string, never>;
76
+ /**
77
+ * BpkCheckboxCard.Indicator - Visual corner indicator
78
+ *
79
+ * Renders a circular checkbox indicator in the top-right corner of the card.
80
+ * Empty circle when unchecked; filled with a checkmark when checked.
81
+ * The visual state is driven by Ark UI's data-state attribute on the root <label>.
82
+ */
83
+ declare function Indicator(_props?: IndicatorProps): import("react/jsx-runtime").JSX.Element;
84
+ /**
85
+ * BpkCheckboxCard - Compound component for selectable cards.
86
+ *
87
+ * Built on Ark UI's Checkbox primitive — the Root renders as a <label> element,
88
+ * providing native accessibility, keyboard navigation, and form integration.
89
+ *
90
+ * @example Standard layout
91
+ * <BpkCheckboxCard.Root checked={selected} onCheckedChange={setSelected}>
92
+ * <BpkCheckboxCard.HiddenInput />
93
+ * <BpkCheckboxCard.Content>
94
+ * <BpkVStack gap="bpk-spacing-md" align="center" width="100%">
95
+ * <BpkCheckboxCard.Label>City Centre</BpkCheckboxCard.Label>
96
+ * <BpkPrice price="£85" />
97
+ * </BpkVStack>
98
+ * </BpkCheckboxCard.Content>
99
+ * </BpkCheckboxCard.Root>
100
+ *
101
+ * @example With corner indicator
102
+ * <BpkCheckboxCard.Root checked={selected} onCheckedChange={setSelected}>
103
+ * <BpkCheckboxCard.HiddenInput />
104
+ * <BpkCheckboxCard.Indicator />
105
+ * <BpkCheckboxCard.Content>
106
+ * <BpkCheckboxCard.Label>City Centre</BpkCheckboxCard.Label>
107
+ * </BpkCheckboxCard.Content>
108
+ * </BpkCheckboxCard.Root>
109
+ */
110
+ declare const BpkCheckboxCard: typeof Root & {
111
+ Root: typeof Root;
112
+ HiddenInput: typeof HiddenInput;
113
+ Content: typeof Content;
114
+ Indicator: typeof Indicator;
115
+ Label: typeof Label;
116
+ Description: typeof Description;
117
+ Price: typeof Price;
118
+ };
119
+ export { BpkCheckboxCard };
120
+ export default BpkCheckboxCard;
121
+ export type { RootProps, RootProps as BpkCheckboxCardRootProps } from './BpkCheckboxCardRoot';
122
+ export type { ContentProps as BpkCheckboxCardContentProps };
123
+ export type { LabelProps as BpkCheckboxCardLabelProps };
124
+ export type { DescriptionProps as BpkCheckboxCardDescriptionProps };
125
+ export type { PriceProps as BpkCheckboxCardPriceProps };
126
+ export { useCheckboxCardContext } from './CheckboxCardContext';
127
+ export type { CheckboxCardContextValue } from './CheckboxCardContext';
128
+ export * from './common-types';
@@ -0,0 +1,216 @@
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 { CheckboxHiddenInput } from '@ark-ui/react';
20
+ import { withButtonAlignment } from "../../bpk-component-icon";
21
+ import TickCircleIcon from "../../bpk-component-icon/sm/tick-circle";
22
+ import { BpkSpinner, SPINNER_TYPES } from "../../bpk-component-spinner";
23
+ import BpkText, { TEXT_COLORS, TEXT_STYLES } from "../../bpk-component-text";
24
+ import { cssModules } from "../../bpk-react-utils";
25
+ import { Root } from "./BpkCheckboxCardRoot";
26
+ import { useCheckboxCardContext } from "./CheckboxCardContext";
27
+ import STYLES from "./BpkCheckboxCard.module.css";
28
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
29
+ const getClassName = cssModules(STYLES);
30
+ const AlignedTickCircleIcon = withButtonAlignment(TickCircleIcon);
31
+
32
+ // ─── HiddenInput ─────────────────────────────────────────────────────────────
33
+
34
+ /**
35
+ * BpkCheckboxCard.HiddenInput - Accessible hidden checkbox input for form submission.
36
+ *
37
+ * Renders a visually hidden <input type="checkbox"> managed by Ark UI.
38
+ * Handles name, value, checked state, required, and disabled automatically.
39
+ * Must be placed inside BpkCheckboxCard.Root.
40
+ *
41
+ * @returns {JSX.Element} The hidden checkbox input element.
42
+ */
43
+ function HiddenInput() {
44
+ return /*#__PURE__*/_jsx(CheckboxHiddenInput, {});
45
+ }
46
+
47
+ // ─── Content ─────────────────────────────────────────────────────────────────
48
+
49
+ /**
50
+ * BpkCheckboxCard.Content - Main content container
51
+ *
52
+ * Provides a simple wrapper container for organising checkbox card content.
53
+ * Use BpkVStack / BpkHStack for layout control inside Content.
54
+ */
55
+
56
+ function Content({
57
+ children
58
+ }) {
59
+ return /*#__PURE__*/_jsx("div", {
60
+ className: getClassName('bpk-checkbox-card-content'),
61
+ children: children
62
+ });
63
+ }
64
+
65
+ // ─── Label ───────────────────────────────────────────────────────────────────
66
+
67
+ /**
68
+ * BpkCheckboxCard.Label - Primary label slot component
69
+ *
70
+ * Displays the primary text label using BpkText.
71
+ * Automatically truncates with ellipsis after the specified number of lines.
72
+ * Accessibility is provided by the wrapping <label> element from Ark UI's CheckboxRoot.
73
+ */
74
+
75
+ function Label({
76
+ children,
77
+ lineClamp = 2,
78
+ textStyle = TEXT_STYLES.heading5
79
+ }) {
80
+ return /*#__PURE__*/_jsx("div", {
81
+ className: getClassName('bpk-checkbox-card-label'),
82
+ style: {
83
+ '--bpk-label-line-clamp': lineClamp
84
+ },
85
+ children: /*#__PURE__*/_jsx(BpkText, {
86
+ textStyle: textStyle,
87
+ tagName: "span",
88
+ children: children
89
+ })
90
+ });
91
+ }
92
+
93
+ // ─── Description ─────────────────────────────────────────────────────────────
94
+
95
+ /**
96
+ * BpkCheckboxCard.Description - Secondary description slot component
97
+ *
98
+ * Displays secondary descriptive text using BpkText.
99
+ * Automatically truncates with ellipsis after the specified number of lines.
100
+ */
101
+
102
+ function Description({
103
+ children,
104
+ lineClamp = 3,
105
+ textStyle = TEXT_STYLES.bodyDefault
106
+ }) {
107
+ return /*#__PURE__*/_jsx("div", {
108
+ className: getClassName('bpk-checkbox-card-description'),
109
+ style: {
110
+ '--bpk-description-line-clamp': lineClamp
111
+ },
112
+ children: /*#__PURE__*/_jsx(BpkText, {
113
+ textStyle: textStyle,
114
+ tagName: "span",
115
+ children: children
116
+ })
117
+ });
118
+ }
119
+
120
+ // ─── Price (cars variant only) ────────────────────────────────────────────────
121
+
122
+ /**
123
+ * BpkCheckboxCard.Price - Cars-specific price slot.
124
+ *
125
+ * Reads `loading` from context automatically:
126
+ * - loading=true → shows "{leadingText}" + spinner
127
+ * - loading=false → shows "{leadingText} {price}" as secondary description text
128
+ *
129
+ * Intended for use with variant="cars" only.
130
+ */
131
+
132
+ function Price({
133
+ leadingText = 'from',
134
+ price
135
+ }) {
136
+ const {
137
+ loading
138
+ } = useCheckboxCardContext();
139
+ return /*#__PURE__*/_jsxs("div", {
140
+ className: getClassName('bpk-checkbox-card-price'),
141
+ children: [/*#__PURE__*/_jsx(BpkText, {
142
+ textStyle: TEXT_STYLES.footnote,
143
+ tagName: "span",
144
+ color: TEXT_COLORS.textSecondary,
145
+ children: leadingText
146
+ }), loading ? /*#__PURE__*/_jsx(BpkSpinner, {
147
+ type: SPINNER_TYPES.primary,
148
+ small: true
149
+ }) : /*#__PURE__*/_jsx(BpkText, {
150
+ textStyle: TEXT_STYLES.footnote,
151
+ tagName: "span",
152
+ color: TEXT_COLORS.textSecondary,
153
+ children: price
154
+ })]
155
+ });
156
+ }
157
+
158
+ // ─── Indicator ───────────────────────────────────────────────────────────────
159
+
160
+ /**
161
+ * BpkCheckboxCard.Indicator - Visual corner indicator
162
+ *
163
+ * Renders a circular checkbox indicator in the top-right corner of the card.
164
+ * Empty circle when unchecked; filled with a checkmark when checked.
165
+ * The visual state is driven by Ark UI's data-state attribute on the root <label>.
166
+ */
167
+
168
+ function Indicator(_props = {}) {
169
+ return /*#__PURE__*/_jsx("div", {
170
+ className: getClassName('bpk-checkbox-card-indicator'),
171
+ "aria-hidden": true,
172
+ children: /*#__PURE__*/_jsx(AlignedTickCircleIcon, {})
173
+ });
174
+ }
175
+
176
+ // ─── Compound Component ───────────────────────────────────────────────────────
177
+
178
+ /**
179
+ * BpkCheckboxCard - Compound component for selectable cards.
180
+ *
181
+ * Built on Ark UI's Checkbox primitive — the Root renders as a <label> element,
182
+ * providing native accessibility, keyboard navigation, and form integration.
183
+ *
184
+ * @example Standard layout
185
+ * <BpkCheckboxCard.Root checked={selected} onCheckedChange={setSelected}>
186
+ * <BpkCheckboxCard.HiddenInput />
187
+ * <BpkCheckboxCard.Content>
188
+ * <BpkVStack gap="bpk-spacing-md" align="center" width="100%">
189
+ * <BpkCheckboxCard.Label>City Centre</BpkCheckboxCard.Label>
190
+ * <BpkPrice price="£85" />
191
+ * </BpkVStack>
192
+ * </BpkCheckboxCard.Content>
193
+ * </BpkCheckboxCard.Root>
194
+ *
195
+ * @example With corner indicator
196
+ * <BpkCheckboxCard.Root checked={selected} onCheckedChange={setSelected}>
197
+ * <BpkCheckboxCard.HiddenInput />
198
+ * <BpkCheckboxCard.Indicator />
199
+ * <BpkCheckboxCard.Content>
200
+ * <BpkCheckboxCard.Label>City Centre</BpkCheckboxCard.Label>
201
+ * </BpkCheckboxCard.Content>
202
+ * </BpkCheckboxCard.Root>
203
+ */
204
+ const BpkCheckboxCard = Object.assign(Root, {
205
+ Root,
206
+ HiddenInput,
207
+ Content,
208
+ Indicator,
209
+ Label,
210
+ Description,
211
+ Price
212
+ });
213
+ export { BpkCheckboxCard };
214
+ export default BpkCheckboxCard;
215
+ export { useCheckboxCardContext } from "./CheckboxCardContext";
216
+ export * from "./common-types";
@@ -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-card-root{position:relative;display:block;min-width:2.75rem;height:100%;min-height:2.75rem;transition:background-color 200ms ease-in-out,border-color 200ms ease-in-out,color 200ms ease-in-out;border:1px solid var(--bpk-checkbox-card-default-border-color, rgb(193, 199, 207));background-color:var(--bpk-checkbox-card-default-background-color, rgb(255, 255, 255));color:var(--bpk-checkbox-card-default-text-color, rgb(22, 22, 22));cursor:pointer;box-sizing:border-box}.bpk-checkbox-card-root:has(:focus-visible){outline:.125rem solid #0062e3;outline-offset:.125rem}.bpk-no-touch-support .bpk-checkbox-card-root:not([data-state=checked]):not([data-disabled]):hover:not(:active):not(:disabled),.bpk-no-touch-support .bpk-checkbox-card-root:not([data-state=checked])[data-loading]:hover:not(:active):not(:disabled){border-color:var(--bpk-checkbox-card-hover-border-color, rgb(193, 199, 207));background-color:var(--bpk-checkbox-card-hover-background-color, rgb(245, 247, 250))}:global(.bpk-no-touch-support) .bpk-checkbox-card-root:not([data-state=checked]):not([data-disabled]):hover:not(:active):not(:disabled),:global(.bpk-no-touch-support) .bpk-checkbox-card-root:not([data-state=checked])[data-loading]:hover:not(:active):not(:disabled){border-color:var(--bpk-checkbox-card-hover-border-color, rgb(193, 199, 207));background-color:var(--bpk-checkbox-card-hover-background-color, rgb(245, 247, 250))}.bpk-checkbox-card-root[data-state=checked]{border-color:var(--bpk-checkbox-card-checked-border-color, transparent);background-color:var(--bpk-checkbox-card-checked-background-color, rgb(5, 32, 60));color:var(--bpk-checkbox-card-checked-text-color, rgb(255, 255, 255))}.bpk-checkbox-card-root[data-disabled]:not([data-loading]){border-color:var(--bpk-checkbox-card-disabled-border-color, rgb(193, 199, 207));background-color:var(--bpk-checkbox-card-disabled-background-color, rgb(239, 243, 248));color:var(--bpk-checkbox-card-disabled-text-color, rgba(0, 0, 0, 0.2));cursor:not-allowed}.bpk-checkbox-card-root[data-loading]{cursor:not-allowed}.bpk-checkbox-card-root--radius-square{border-radius:0}.bpk-checkbox-card-root--radius-rounded{border-radius:.75rem}.bpk-checkbox-card-root--on-canvas-default{--bpk-checkbox-card-default-background-color: rgb(255, 255, 255);--bpk-checkbox-card-default-border-color: rgb(193, 199, 207)}.bpk-checkbox-card-root--cars{--bpk-checkbox-card-default-background-color: rgb(255, 255, 255);--bpk-checkbox-card-default-border-color: rgb(193, 199, 207);--bpk-checkbox-card-disabled-border-color: transparent;--bpk-checkbox-card-hover-background-color: rgb(255, 255, 255);--bpk-checkbox-card-hover-border-color: rgb(5, 32, 60);--bpk-checkbox-card-checked-background-color: rgb(255, 255, 255);--bpk-checkbox-card-checked-text-color: rgb(22, 22, 22);--bpk-checkbox-card-checked-border-color: rgb(5, 32, 60);--bpk-checkbox-card-indicator-background-color: rgb(5, 32, 60)}.bpk-checkbox-card-root--cars.bpk-checkbox-card-root--cars--radius-rounded{border-radius:1.5rem}.bpk-checkbox-card-root--cars[data-state=checked]{box-shadow:0 0 0 1px #05203c}.bpk-checkbox-card-root--on-canvas-contrast{--bpk-checkbox-card-default-background-color: rgb(255, 255, 255);--bpk-checkbox-card-hover-background-color: rgb(255, 255, 255);--bpk-checkbox-card-default-border-color: transparent;--bpk-checkbox-card-hover-border-color: rgb(193, 199, 207);--bpk-checkbox-card-disabled-background-color: rgb(239, 243, 248)}.bpk-checkbox-card-root--on-surface-contrast{--bpk-checkbox-card-default-background-color: rgba(255, 255, 255, 0.1);--bpk-checkbox-card-default-text-color: rgb(255, 255, 255);--bpk-checkbox-card-secondary-text-color: rgb(255, 255, 255);--bpk-checkbox-card-hover-background-color: rgb(5, 32, 60);--bpk-checkbox-card-checked-background-color: rgb(0, 98, 227);--bpk-checkbox-card-default-border-color: transparent;--bpk-checkbox-card-hover-border-color: transparent;--bpk-checkbox-card-disabled-border-color: transparent}.bpk-checkbox-card-content{width:100%;padding:.5rem}.bpk-checkbox-card-label{display:-webkit-box;width:100%;color:inherit;text-align:center;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:var(--bpk-label-line-clamp, 2);line-clamp:var(--bpk-label-line-clamp, 2)}.bpk-checkbox-card-label>*{text-align:inherit}.bpk-checkbox-card-description{display:-webkit-box;width:100%;color:var(--bpk-checkbox-card-secondary-text-color, rgb(98, 105, 113));text-align:center;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:var(--bpk-description-line-clamp, 3);line-clamp:var(--bpk-description-line-clamp, 3);margin:0}.bpk-checkbox-card-root[data-state=checked] .bpk-checkbox-card-description{color:inherit}.bpk-checkbox-card-root--cars[data-state=checked] .bpk-checkbox-card-description{color:var(--bpk-checkbox-card-secondary-text-color, rgb(98, 105, 113))}.bpk-checkbox-card-description>*{text-align:inherit}.bpk-checkbox-card-price{display:flex;align-items:center;gap:.25rem}.bpk-checkbox-card-indicator{position:absolute;top:.5rem;right:.5rem;display:none;z-index:1;width:1.25rem;height:1.25rem;pointer-events:none}.bpk-checkbox-card-indicator svg{width:100%;height:100%;fill:var(--bpk-checkbox-card-indicator-background-color, rgb(0, 98, 227))}.bpk-checkbox-card-root[data-state=checked] .bpk-checkbox-card-indicator{display:block}.bpk-checkbox-card-root--cars .bpk-checkbox-card-indicator{width:1rem;height:1rem}
@@ -0,0 +1,95 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { CheckboxCardVariant, CheckboxCardRadius } from './common-types';
3
+ export type RootProps = {
4
+ /**
5
+ * Children components (HiddenInput, Content, slots, etc.)
6
+ */
7
+ children: ReactNode;
8
+ /**
9
+ * Controlled checked state.
10
+ * When provided, component operates in controlled mode.
11
+ */
12
+ checked?: boolean;
13
+ /**
14
+ * Default checked state for uncontrolled mode.
15
+ * @default false
16
+ */
17
+ defaultChecked?: boolean;
18
+ /**
19
+ * Callback invoked when checked state changes.
20
+ * @param checked - New checked state
21
+ */
22
+ onCheckedChange?: (checked: boolean) => void;
23
+ /**
24
+ * Whether the checkbox card is disabled.
25
+ * @default false
26
+ */
27
+ disabled?: boolean;
28
+ /**
29
+ * Whether the card is in a loading state.
30
+ * Non-interactive (cursor not-allowed, clicks blocked) but not visually disabled.
31
+ * @default false
32
+ */
33
+ loading?: boolean;
34
+ /**
35
+ * Whether the checkbox is required.
36
+ * @default false
37
+ */
38
+ required?: boolean;
39
+ /**
40
+ * Form name attribute.
41
+ */
42
+ name?: string;
43
+ /**
44
+ * Form value attribute.
45
+ */
46
+ value?: string;
47
+ /**
48
+ * Visual variant based on background context.
49
+ * @default "onCanvasDefault"
50
+ */
51
+ variant?: CheckboxCardVariant;
52
+ /**
53
+ * Border radius style.
54
+ * @default "rounded"
55
+ */
56
+ radius?: CheckboxCardRadius;
57
+ /**
58
+ * ARIA label for accessibility.
59
+ * Provide if no visible label is present.
60
+ */
61
+ 'aria-label'?: string;
62
+ /**
63
+ * ID of element that labels this component.
64
+ */
65
+ 'aria-labelledby'?: string;
66
+ /**
67
+ * ID of element that describes this component.
68
+ */
69
+ 'aria-describedby'?: string;
70
+ };
71
+ /**
72
+ * BpkCheckboxCard.Root - Root container for checkbox card compound component.
73
+ *
74
+ * Built on Ark UI's CheckboxRoot which renders as a <label> element, providing
75
+ * built-in accessibility, keyboard navigation, and form integration.
76
+ *
77
+ * @example Controlled mode
78
+ * <BpkCheckboxCard.Root checked={selected} onCheckedChange={setSelected}>
79
+ * <BpkCheckboxCard.HiddenInput />
80
+ * <BpkCheckboxCard.Content>
81
+ * <BpkCheckboxCard.Label>City Centre</BpkCheckboxCard.Label>
82
+ * </BpkCheckboxCard.Content>
83
+ * </BpkCheckboxCard.Root>
84
+ *
85
+ * @example Uncontrolled mode
86
+ * <BpkCheckboxCard.Root defaultChecked={false}>
87
+ * <BpkCheckboxCard.HiddenInput />
88
+ * <BpkCheckboxCard.Content>
89
+ * <BpkCheckboxCard.Label>City Centre</BpkCheckboxCard.Label>
90
+ * </BpkCheckboxCard.Content>
91
+ * </BpkCheckboxCard.Root>
92
+ *
93
+ * @returns {JSX.Element} The rendered checkbox card root element.
94
+ */
95
+ export declare function Root({ 'aria-describedby': ariaDescribedby, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, checked, children, defaultChecked, disabled, loading, name, onCheckedChange, radius, required, value, variant, }: RootProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,101 @@
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 { useMemo } from 'react';
20
+ import { CheckboxRoot } from '@ark-ui/react';
21
+ import { withButtonAlignment } from "../../bpk-component-icon";
22
+ import TickCircleIcon from "../../bpk-component-icon/sm/tick-circle";
23
+ import { cssModules } from "../../bpk-react-utils";
24
+ import { CheckboxCardContext } from "./CheckboxCardContext";
25
+ import { CHECKBOX_CARD_VARIANTS, CHECKBOX_CARD_RADIUS } from "./common-types";
26
+ import STYLES from "./BpkCheckboxCard.module.css";
27
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
28
+ const getClassName = cssModules(STYLES);
29
+ const AlignedTickCircleIcon = withButtonAlignment(TickCircleIcon);
30
+ /**
31
+ * BpkCheckboxCard.Root - Root container for checkbox card compound component.
32
+ *
33
+ * Built on Ark UI's CheckboxRoot which renders as a <label> element, providing
34
+ * built-in accessibility, keyboard navigation, and form integration.
35
+ *
36
+ * @example Controlled mode
37
+ * <BpkCheckboxCard.Root checked={selected} onCheckedChange={setSelected}>
38
+ * <BpkCheckboxCard.HiddenInput />
39
+ * <BpkCheckboxCard.Content>
40
+ * <BpkCheckboxCard.Label>City Centre</BpkCheckboxCard.Label>
41
+ * </BpkCheckboxCard.Content>
42
+ * </BpkCheckboxCard.Root>
43
+ *
44
+ * @example Uncontrolled mode
45
+ * <BpkCheckboxCard.Root defaultChecked={false}>
46
+ * <BpkCheckboxCard.HiddenInput />
47
+ * <BpkCheckboxCard.Content>
48
+ * <BpkCheckboxCard.Label>City Centre</BpkCheckboxCard.Label>
49
+ * </BpkCheckboxCard.Content>
50
+ * </BpkCheckboxCard.Root>
51
+ *
52
+ * @returns {JSX.Element} The rendered checkbox card root element.
53
+ */
54
+
55
+ export function Root({
56
+ 'aria-describedby': ariaDescribedby,
57
+ 'aria-label': ariaLabel,
58
+ 'aria-labelledby': ariaLabelledby,
59
+ checked,
60
+ children,
61
+ defaultChecked,
62
+ disabled = false,
63
+ loading = false,
64
+ name,
65
+ onCheckedChange,
66
+ radius = CHECKBOX_CARD_RADIUS.rounded,
67
+ required = false,
68
+ value,
69
+ variant = CHECKBOX_CARD_VARIANTS.onCanvasDefault
70
+ }) {
71
+ const contextValue = useMemo(() => ({
72
+ variant,
73
+ radius,
74
+ loading
75
+ }), [variant, radius, loading]);
76
+ return /*#__PURE__*/_jsx(CheckboxCardContext.Provider, {
77
+ value: contextValue,
78
+ children: /*#__PURE__*/_jsx(CheckboxRoot, {
79
+ checked: checked,
80
+ defaultChecked: defaultChecked,
81
+ onCheckedChange: details => onCheckedChange?.(details.checked),
82
+ disabled: disabled || loading,
83
+ name: name,
84
+ value: value,
85
+ required: required,
86
+ asChild: true,
87
+ children: /*#__PURE__*/_jsxs("label", {
88
+ "aria-label": ariaLabel,
89
+ "aria-labelledby": ariaLabelledby,
90
+ "aria-describedby": ariaDescribedby,
91
+ "data-loading": loading || undefined,
92
+ className: getClassName('bpk-checkbox-card-root', `bpk-checkbox-card-root--${variant}`, `bpk-checkbox-card-root--radius-${radius}`),
93
+ children: [variant === CHECKBOX_CARD_VARIANTS.cars && /*#__PURE__*/_jsx("div", {
94
+ className: getClassName('bpk-checkbox-card-indicator'),
95
+ "aria-hidden": true,
96
+ children: /*#__PURE__*/_jsx(AlignedTickCircleIcon, {})
97
+ }), children]
98
+ })
99
+ })
100
+ });
101
+ }
@@ -0,0 +1,27 @@
1
+ import type { CheckboxCardVariant, CheckboxCardRadius } from './common-types';
2
+ /**
3
+ * Context value for checkbox card components.
4
+ * Holds only Backpack-specific props (variant, radius, size).
5
+ * Checkbox state (checked, disabled, etc.) is accessed via Ark UI's useCheckboxContext().
6
+ */
7
+ export type CheckboxCardContextValue = {
8
+ /** Visual variant based on background context */
9
+ variant: CheckboxCardVariant;
10
+ /** Border radius style */
11
+ radius: CheckboxCardRadius;
12
+ /** Whether the card is in a loading state (non-interactive, cursor not-allowed) */
13
+ loading: boolean;
14
+ };
15
+ /**
16
+ * React Context for BPK-specific checkbox card configuration.
17
+ * Checkbox state is managed by Ark UI's CheckboxRoot and accessed via useCheckboxContext().
18
+ */
19
+ export declare const CheckboxCardContext: import("react").Context<CheckboxCardContextValue | null>;
20
+ /**
21
+ * Hook to access BPK checkbox card context.
22
+ * Must be used within a BpkCheckboxCard.Root component.
23
+ *
24
+ * @throws Error if used outside of BpkCheckboxCard.Root
25
+ * @returns {CheckboxCardContextValue} The checkbox card context value.
26
+ */
27
+ export declare function useCheckboxCardContext(): CheckboxCardContextValue;
@@ -0,0 +1,47 @@
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 { createContext, useContext } from 'react';
20
+
21
+ /**
22
+ * Context value for checkbox card components.
23
+ * Holds only Backpack-specific props (variant, radius, size).
24
+ * Checkbox state (checked, disabled, etc.) is accessed via Ark UI's useCheckboxContext().
25
+ */
26
+
27
+ /**
28
+ * React Context for BPK-specific checkbox card configuration.
29
+ * Checkbox state is managed by Ark UI's CheckboxRoot and accessed via useCheckboxContext().
30
+ */
31
+ export const CheckboxCardContext = /*#__PURE__*/createContext(null);
32
+
33
+ /**
34
+ * Hook to access BPK checkbox card context.
35
+ * Must be used within a BpkCheckboxCard.Root component.
36
+ *
37
+ * @throws Error if used outside of BpkCheckboxCard.Root
38
+ * @returns {CheckboxCardContextValue} The checkbox card context value.
39
+ */
40
+
41
+ export function useCheckboxCardContext() {
42
+ const context = useContext(CheckboxCardContext);
43
+ if (!context) {
44
+ throw new Error('CheckboxCard compound components must be used within BpkCheckboxCard.Root. ' + 'Make sure you have wrapped your components in <BpkCheckboxCard.Root>.');
45
+ }
46
+ return context;
47
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Variant types for visual presentation based on canvas/surface background
3
+ * - onCanvasDefault: For use on default/white backgrounds (selected: dark blue #05203C)
4
+ * - onCanvasContrast: For use on contrast/colored backgrounds (selected: dark blue #05203C)
5
+ * - onSurfaceContrast: For use on contrast surfaces (selected: accent blue #0062E3)
6
+ * - cars: For use in cars product context — same styling as onCanvasDefault but with
7
+ * the corner Indicator automatically rendered (no need to add <BpkCheckboxCard.Indicator />)
8
+ */
9
+ export declare const CHECKBOX_CARD_VARIANTS: {
10
+ readonly onCanvasDefault: "on-canvas-default";
11
+ readonly onCanvasContrast: "on-canvas-contrast";
12
+ readonly onSurfaceContrast: "on-surface-contrast";
13
+ readonly cars: "cars";
14
+ };
15
+ export type CheckboxCardVariant = (typeof CHECKBOX_CARD_VARIANTS)[keyof typeof CHECKBOX_CARD_VARIANTS];
16
+ /**
17
+ * Radius types for border-radius
18
+ */
19
+ export declare const CHECKBOX_CARD_RADIUS: {
20
+ readonly square: "square";
21
+ readonly rounded: "rounded";
22
+ };
23
+ export type CheckboxCardRadius = (typeof CHECKBOX_CARD_RADIUS)[keyof typeof CHECKBOX_CARD_RADIUS];
24
+ /**
25
+ * Change handler signature for checkbox card
26
+ */
27
+ export type CheckboxCardChangeHandler = (checked: boolean) => void;