@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,43 @@
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
+ /**
20
+ * Variant types for visual presentation based on canvas/surface background
21
+ * - onCanvasDefault: For use on default/white backgrounds (selected: dark blue #05203C)
22
+ * - onCanvasContrast: For use on contrast/colored backgrounds (selected: dark blue #05203C)
23
+ * - onSurfaceContrast: For use on contrast surfaces (selected: accent blue #0062E3)
24
+ * - cars: For use in cars product context — same styling as onCanvasDefault but with
25
+ * the corner Indicator automatically rendered (no need to add <BpkCheckboxCard.Indicator />)
26
+ */
27
+ export const CHECKBOX_CARD_VARIANTS = {
28
+ onCanvasDefault: 'on-canvas-default',
29
+ onCanvasContrast: 'on-canvas-contrast',
30
+ onSurfaceContrast: 'on-surface-contrast',
31
+ cars: 'cars'
32
+ };
33
+ /**
34
+ * Radius types for border-radius
35
+ */
36
+ export const CHECKBOX_CARD_RADIUS = {
37
+ square: 'square',
38
+ rounded: 'rounded'
39
+ };
40
+
41
+ /**
42
+ * Change handler signature for checkbox card
43
+ */
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Theme attributes for BpkCheckboxCard component.
3
+ *
4
+ * These attributes can be customized using BpkThemeProvider to override
5
+ * the default colors and styles of the checkbox card.
6
+ *
7
+ * Use `createCheckboxCardTheme` to build a partial theme — only specify
8
+ * the attributes you want to change; the rest fall back to design tokens.
9
+ *
10
+ * @example
11
+ * import BpkThemeProvider from '@skyscanner/backpack-web/bpk-theming';
12
+ * import {
13
+ * BpkCheckboxCard,
14
+ * CHECKBOX_CARD_THEME_ATTRIBUTES,
15
+ * createCheckboxCardTheme,
16
+ * } from '@skyscanner/backpack-web/bpk-component-checkbox-card';
17
+ *
18
+ * const theme = createCheckboxCardTheme({
19
+ * checkboxCardCheckedBackgroundColor: '#FFFFFF',
20
+ * checkboxCardCheckedTextColor: '#111236',
21
+ * checkboxCardCheckedBorderColor: '#111236',
22
+ * checkboxCardIndicatorBackgroundColor: '#111236',
23
+ * });
24
+ *
25
+ * <BpkThemeProvider theme={theme} themeAttributes={CHECKBOX_CARD_THEME_ATTRIBUTES}>
26
+ * <BpkCheckboxCard.Root>
27
+ * ...
28
+ * </BpkCheckboxCard.Root>
29
+ * </BpkThemeProvider>
30
+ */
31
+ declare const CHECKBOX_CARD_THEME_ATTRIBUTES: readonly ["checkboxCardDefaultBackgroundColor", "checkboxCardDefaultTextColor", "checkboxCardSecondaryTextColor", "checkboxCardHoverBackgroundColor", "checkboxCardDefaultBorderColor", "checkboxCardHoverBorderColor", "checkboxCardCheckedBackgroundColor", "checkboxCardCheckedTextColor", "checkboxCardCheckedBorderColor", "checkboxCardDisabledBackgroundColor", "checkboxCardDisabledTextColor", "checkboxCardIndicatorBackgroundColor", "checkboxCardIndicatorTextColor"];
32
+ type CheckboxCardThemeKey = (typeof CHECKBOX_CARD_THEME_ATTRIBUTES)[number];
33
+ type CheckboxCardTheme = Record<CheckboxCardThemeKey, string>;
34
+ /**
35
+ * Creates a complete BpkCheckboxCard theme by merging your overrides with the
36
+ * default design-token values. Pass only the attributes you want to change.
37
+ *
38
+ * @example
39
+ * const theme = createCheckboxCardTheme({
40
+ * checkboxCardCheckedBackgroundColor: '#FFFFFF',
41
+ * checkboxCardCheckedBorderColor: '#111236',
42
+ * checkboxCardIndicatorBackgroundColor: '#111236',
43
+ * });
44
+ */
45
+ export declare function createCheckboxCardTheme(overrides?: Partial<CheckboxCardTheme>): CheckboxCardTheme;
46
+ export default CHECKBOX_CARD_THEME_ATTRIBUTES;
@@ -0,0 +1,87 @@
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 { canvasDay, coreAccentDay, colorWhite, lineDay, surfaceContrastDay, surfaceLowContrastDay, textDisabledDay, textOnDarkDay, textPrimaryDay, textSecondaryDay } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
20
+
21
+ /**
22
+ * Theme attributes for BpkCheckboxCard component.
23
+ *
24
+ * These attributes can be customized using BpkThemeProvider to override
25
+ * the default colors and styles of the checkbox card.
26
+ *
27
+ * Use `createCheckboxCardTheme` to build a partial theme — only specify
28
+ * the attributes you want to change; the rest fall back to design tokens.
29
+ *
30
+ * @example
31
+ * import BpkThemeProvider from '@skyscanner/backpack-web/bpk-theming';
32
+ * import {
33
+ * BpkCheckboxCard,
34
+ * CHECKBOX_CARD_THEME_ATTRIBUTES,
35
+ * createCheckboxCardTheme,
36
+ * } from '@skyscanner/backpack-web/bpk-component-checkbox-card';
37
+ *
38
+ * const theme = createCheckboxCardTheme({
39
+ * checkboxCardCheckedBackgroundColor: '#FFFFFF',
40
+ * checkboxCardCheckedTextColor: '#111236',
41
+ * checkboxCardCheckedBorderColor: '#111236',
42
+ * checkboxCardIndicatorBackgroundColor: '#111236',
43
+ * });
44
+ *
45
+ * <BpkThemeProvider theme={theme} themeAttributes={CHECKBOX_CARD_THEME_ATTRIBUTES}>
46
+ * <BpkCheckboxCard.Root>
47
+ * ...
48
+ * </BpkCheckboxCard.Root>
49
+ * </BpkThemeProvider>
50
+ */
51
+ const CHECKBOX_CARD_THEME_ATTRIBUTES = ['checkboxCardDefaultBackgroundColor', 'checkboxCardDefaultTextColor', 'checkboxCardSecondaryTextColor', 'checkboxCardHoverBackgroundColor', 'checkboxCardDefaultBorderColor', 'checkboxCardHoverBorderColor', 'checkboxCardCheckedBackgroundColor', 'checkboxCardCheckedTextColor', 'checkboxCardCheckedBorderColor', 'checkboxCardDisabledBackgroundColor', 'checkboxCardDisabledTextColor', 'checkboxCardIndicatorBackgroundColor', 'checkboxCardIndicatorTextColor'];
52
+ /** Default theme values matching the SCSS token fallbacks */
53
+ const CHECKBOX_CARD_DEFAULT_THEME = {
54
+ checkboxCardDefaultBackgroundColor: canvasDay,
55
+ checkboxCardDefaultTextColor: textPrimaryDay,
56
+ checkboxCardSecondaryTextColor: textSecondaryDay,
57
+ checkboxCardHoverBackgroundColor: surfaceLowContrastDay,
58
+ checkboxCardDefaultBorderColor: lineDay,
59
+ checkboxCardHoverBorderColor: lineDay,
60
+ checkboxCardCheckedBackgroundColor: surfaceContrastDay,
61
+ checkboxCardCheckedTextColor: textOnDarkDay,
62
+ checkboxCardCheckedBorderColor: 'transparent',
63
+ checkboxCardDisabledBackgroundColor: canvasDay,
64
+ checkboxCardDisabledTextColor: textDisabledDay,
65
+ checkboxCardIndicatorBackgroundColor: coreAccentDay,
66
+ checkboxCardIndicatorTextColor: colorWhite
67
+ };
68
+
69
+ /**
70
+ * Creates a complete BpkCheckboxCard theme by merging your overrides with the
71
+ * default design-token values. Pass only the attributes you want to change.
72
+ *
73
+ * @example
74
+ * const theme = createCheckboxCardTheme({
75
+ * checkboxCardCheckedBackgroundColor: '#FFFFFF',
76
+ * checkboxCardCheckedBorderColor: '#111236',
77
+ * checkboxCardIndicatorBackgroundColor: '#111236',
78
+ * });
79
+ */
80
+
81
+ export function createCheckboxCardTheme(overrides = {}) {
82
+ return {
83
+ ...CHECKBOX_CARD_DEFAULT_THEME,
84
+ ...overrides
85
+ };
86
+ }
87
+ export default CHECKBOX_CARD_THEME_ATTRIBUTES;
@@ -3,10 +3,10 @@ import BpkDropdownChip from './src/BpkDropdownChip';
3
3
  import BpkIconChip from './src/BpkIconChip';
4
4
  import BpkSelectableChip, { type Props as SelectableProps } from './src/BpkSelectableChip';
5
5
  import { CHIP_TYPES } from './src/commonTypes';
6
- import themeAttributes from './src/themeAttributes';
6
+ import themeAttributes, { chipBorderRadiusThemeAttributes, chipDefaultThemeAttributes, chipOnDarkThemeAttributes, chipOnImageThemeAttributes } from './src/themeAttributes';
7
7
  import type { CommonProps } from './src/commonTypes';
8
8
  export type BpkSelectableChipProps = SelectableProps;
9
9
  export type BpkDismissibleChipProps = CommonProps;
10
10
  export type BpkDropdownChipProps = CommonProps;
11
11
  export default BpkSelectableChip;
12
- export { BpkDismissibleChip, BpkDropdownChip, BpkIconChip, CHIP_TYPES, themeAttributes };
12
+ export { BpkDismissibleChip, BpkDropdownChip, BpkIconChip, CHIP_TYPES, themeAttributes, chipBorderRadiusThemeAttributes, chipDefaultThemeAttributes, chipOnDarkThemeAttributes, chipOnImageThemeAttributes, };
@@ -21,6 +21,6 @@ import BpkDropdownChip from "./src/BpkDropdownChip";
21
21
  import BpkIconChip from "./src/BpkIconChip";
22
22
  import BpkSelectableChip from "./src/BpkSelectableChip";
23
23
  import { CHIP_TYPES } from "./src/commonTypes";
24
- import themeAttributes from "./src/themeAttributes";
24
+ import themeAttributes, { chipBorderRadiusThemeAttributes, chipDefaultThemeAttributes, chipOnDarkThemeAttributes, chipOnImageThemeAttributes } from "./src/themeAttributes";
25
25
  export default BpkSelectableChip;
26
- export { BpkDismissibleChip, BpkDropdownChip, BpkIconChip, CHIP_TYPES, themeAttributes };
26
+ export { BpkDismissibleChip, BpkDropdownChip, BpkIconChip, CHIP_TYPES, themeAttributes, chipBorderRadiusThemeAttributes, chipDefaultThemeAttributes, chipOnDarkThemeAttributes, chipOnImageThemeAttributes };
@@ -15,4 +15,4 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */
18
- .bpk-chip{display:inline-flex;height:2rem;padding:0 1rem;align-items:center;border:none;border-radius:.5rem;cursor:pointer}.bpk-chip__leading-accessory-view{display:inline-flex;fill:currentcolor;margin-left:0;margin-right:.5rem}html[dir=rtl] .bpk-chip__leading-accessory-view{margin-left:.5rem;margin-right:0}.bpk-chip__trailing-accessory-view{display:inline-flex;fill:currentcolor;margin-left:.5rem;margin-right:-0.5rem}html[dir=rtl] .bpk-chip__trailing-accessory-view{margin-right:.5rem}html[dir=rtl] .bpk-chip__trailing-accessory-view{margin-left:-0.5rem}.bpk-chip--on-dark{background-color:rgba(0,0,0,0);color:#fff;box-shadow:0 0 0 1px hsla(0,0%,100%,.5) inset}.bpk-no-touch-support .bpk-chip--on-dark:hover:not(:active):not(:disabled){box-shadow:0 0 0 1px #fff inset}:global(.bpk-no-touch-support) .bpk-chip--on-dark:hover:not(:active):not(:disabled){box-shadow:0 0 0 1px #fff inset}.bpk-chip--on-dark:active:not(:disabled){box-shadow:0 0 0 1px #fff inset}.bpk-chip--on-dark-selected{color:#161616;color:var(--bpk-chip-on-dark-selected-text-color, rgb(22, 22, 22));background-color:#fff;background-color:var(--bpk-chip-on-dark-selected-background-color, rgb(255, 255, 255));box-shadow:0 0 0 1px rgba(0,0,0,0) inset}.bpk-no-touch-support .bpk-chip--on-dark-selected:hover:not(:active):not(:disabled){box-shadow:0 0 0 1px rgba(0,0,0,0) inset}:global(.bpk-no-touch-support) .bpk-chip--on-dark-selected:hover:not(:active):not(:disabled){box-shadow:0 0 0 1px rgba(0,0,0,0) inset}.bpk-chip--on-dark-selected:active:not(:disabled){box-shadow:0 0 0 1px rgba(0,0,0,0) inset}.bpk-no-touch-support .bpk-chip--on-dark-dismissible:hover:not(:active):not(:disabled) svg{fill:currentcolor}:global(.bpk-no-touch-support) .bpk-chip--on-dark-dismissible:hover:not(:active):not(:disabled) svg{fill:currentcolor}.bpk-chip--on-dark-dismissible:active:not(:disabled) svg{fill:currentcolor}.bpk-chip--on-dark-dismissible__trailing-accessory-view{fill:#626971}.bpk-chip--on-dark-disabled{box-shadow:0 0 0 1px rgba(0,0,0,0) inset}.bpk-chip--default{background-color:rgba(0,0,0,0);color:#161616;box-shadow:0 0 0 1px #c1c7cf inset}.bpk-no-touch-support .bpk-chip--default:hover:not(:active):not(:disabled){box-shadow:0 0 0 1px #05203c inset}:global(.bpk-no-touch-support) .bpk-chip--default:hover:not(:active):not(:disabled){box-shadow:0 0 0 1px #05203c inset}.bpk-chip--default:active:not(:disabled){box-shadow:0 0 0 1px #05203c inset}.bpk-chip--default-selected{color:#fff;color:var(--bpk-chip-default-selected-text-color, rgb(255, 255, 255));background-color:#05203c;background-color:var(--bpk-chip-default-selected-background-color, rgb(5, 32, 60));box-shadow:0 0 0 1px rgba(0,0,0,0) inset}.bpk-no-touch-support .bpk-chip--default-selected:hover:not(:active):not(:disabled){box-shadow:0 0 0 1px rgba(0,0,0,0) inset}:global(.bpk-no-touch-support) .bpk-chip--default-selected:hover:not(:active):not(:disabled){box-shadow:0 0 0 1px rgba(0,0,0,0) inset}.bpk-chip--default-selected:active:not(:disabled){box-shadow:0 0 0 1px rgba(0,0,0,0) inset}.bpk-no-touch-support .bpk-chip--default-dismissible:hover:not(:active):not(:disabled) svg{fill:currentcolor}:global(.bpk-no-touch-support) .bpk-chip--default-dismissible:hover:not(:active):not(:disabled) svg{fill:currentcolor}.bpk-chip--default-dismissible:active:not(:disabled) svg{fill:currentcolor}.bpk-chip--default-dismissible__trailing-accessory-view{fill:hsla(0,0%,100%,.5)}.bpk-chip--default-disabled{box-shadow:0 0 0 1px rgba(0,0,0,0) inset}.bpk-chip--on-image{background-color:#fff;color:#161616;box-shadow:0px 1px 3px 0px rgba(37,32,31,.3)}.bpk-no-touch-support .bpk-chip--on-image:hover:not(:active):not(:disabled){background-color:#eff3f8}:global(.bpk-no-touch-support) .bpk-chip--on-image:hover:not(:active):not(:disabled){background-color:#eff3f8}.bpk-chip--on-image:active:not(:disabled){background-color:#eff3f8}.bpk-chip--on-image-selected{color:#fff;color:var(--bpk-chip-on-image-selected-text-color, rgb(255, 255, 255));background-color:#05203c;background-color:var(--bpk-chip-on-image-selected-background-color, rgb(5, 32, 60))}.bpk-no-touch-support .bpk-chip--on-image-selected:hover:not(:active):not(:disabled){background-color:#05203c;background-color:var(--bpk-chip-on-image-selected-hover-background-color, rgb(5, 32, 60))}:global(.bpk-no-touch-support) .bpk-chip--on-image-selected:hover:not(:active):not(:disabled){background-color:#05203c;background-color:var(--bpk-chip-on-image-selected-hover-background-color, rgb(5, 32, 60))}.bpk-chip--on-image-selected:active:not(:disabled){background-color:#05203c;background-color:var(--bpk-chip-on-image-selected-active-background-color, rgb(5, 32, 60))}.bpk-no-touch-support .bpk-chip--on-image-dismissible:hover:not(:active):not(:disabled) svg{fill:currentcolor}:global(.bpk-no-touch-support) .bpk-chip--on-image-dismissible:hover:not(:active):not(:disabled) svg{fill:currentcolor}.bpk-chip--on-image-dismissible:active:not(:disabled) svg{fill:currentcolor}.bpk-chip--on-image-dismissible__trailing-accessory-view{fill:hsla(0,0%,100%,.5)}.bpk-chip--on-image-disabled{box-shadow:0px 1px 3px 0px rgba(37,32,31,.3)}.bpk-chip--disabled{background-color:#e0e4e9;color:rgba(0,0,0,.2);cursor:not-allowed}.bpk-chip--icon-only{padding-inline-end:.5rem;padding-inline-start:.5rem}.bpk-chip--icon-only__leading-accessory-view{margin-left:0;margin-right:0}html[dir=rtl] .bpk-chip--icon-only__leading-accessory-view{margin-left:0;margin-right:0}
18
+ .bpk-chip{display:inline-flex;height:2rem;padding:0 1rem;align-items:center;border:none;cursor:pointer;border-radius:.5rem;border-radius:var(--bpk-chip-border-radius, 0.5rem)}.bpk-chip__leading-accessory-view{display:inline-flex;fill:currentcolor;margin-left:0;margin-right:.5rem}html[dir=rtl] .bpk-chip__leading-accessory-view{margin-left:.5rem;margin-right:0}.bpk-chip__trailing-accessory-view{display:inline-flex;fill:currentcolor;margin-left:.5rem;margin-right:-0.5rem}html[dir=rtl] .bpk-chip__trailing-accessory-view{margin-right:.5rem}html[dir=rtl] .bpk-chip__trailing-accessory-view{margin-left:-0.5rem}.bpk-chip--on-dark{background-color:rgba(0,0,0,0);background-color:var(--bpk-chip-on-dark-background-color, transparent);color:#fff;color:var(--bpk-chip-on-dark-text-color, rgb(255, 255, 255));box-shadow:0 0 0 1px hsla(0,0%,100%,.5) inset;box-shadow:0 0 0 1px var(--bpk-chip-on-dark-border-color, rgba(255, 255, 255, 0.5)) inset}.bpk-no-touch-support .bpk-chip--on-dark:hover:not(:active):not(:disabled){box-shadow:0 0 0 1px #fff inset;box-shadow:0 0 0 1px var(--bpk-chip-on-dark-hover-border-color, rgb(255, 255, 255)) inset}:global(.bpk-no-touch-support) .bpk-chip--on-dark:hover:not(:active):not(:disabled){box-shadow:0 0 0 1px #fff inset;box-shadow:0 0 0 1px var(--bpk-chip-on-dark-hover-border-color, rgb(255, 255, 255)) inset}.bpk-chip--on-dark:active:not(:disabled){box-shadow:0 0 0 1px #fff inset;box-shadow:0 0 0 1px var(--bpk-chip-on-dark-active-border-color, rgb(255, 255, 255)) inset}.bpk-chip--on-dark-selected{color:#161616;color:var(--bpk-chip-on-dark-selected-text-color, rgb(22, 22, 22));background-color:#fff;background-color:var(--bpk-chip-on-dark-selected-background-color, rgb(255, 255, 255));box-shadow:0 0 0 1px rgba(0,0,0,0) inset}.bpk-no-touch-support .bpk-chip--on-dark-selected:hover:not(:active):not(:disabled){background-color:#fff;background-color:var(--bpk-chip-on-dark-selected-hover-background-color, rgb(255, 255, 255));box-shadow:0 0 0 1px rgba(0,0,0,0) inset}:global(.bpk-no-touch-support) .bpk-chip--on-dark-selected:hover:not(:active):not(:disabled){background-color:#fff;background-color:var(--bpk-chip-on-dark-selected-hover-background-color, rgb(255, 255, 255));box-shadow:0 0 0 1px rgba(0,0,0,0) inset}.bpk-chip--on-dark-selected:active:not(:disabled){background-color:#fff;background-color:var(--bpk-chip-on-dark-selected-active-background-color, rgb(255, 255, 255));box-shadow:0 0 0 1px rgba(0,0,0,0) inset}.bpk-no-touch-support .bpk-chip--on-dark-dismissible:hover:not(:active):not(:disabled) svg{fill:currentcolor}:global(.bpk-no-touch-support) .bpk-chip--on-dark-dismissible:hover:not(:active):not(:disabled) svg{fill:currentcolor}.bpk-chip--on-dark-dismissible:active:not(:disabled) svg{fill:currentcolor}.bpk-chip--on-dark-dismissible__trailing-accessory-view{fill:#626971}.bpk-chip--on-dark-disabled{box-shadow:0 0 0 1px rgba(0,0,0,0) inset}.bpk-chip--default{background-color:rgba(0,0,0,0);background-color:var(--bpk-chip-default-background-color, transparent);color:#161616;color:var(--bpk-chip-default-text-color, rgb(22, 22, 22));box-shadow:0 0 0 1px #c1c7cf inset;box-shadow:0 0 0 1px var(--bpk-chip-default-border-color, rgb(193, 199, 207)) inset}.bpk-no-touch-support .bpk-chip--default:hover:not(:active):not(:disabled){background-color:rgba(0,0,0,0);background-color:var(--bpk-chip-default-hover-background-color, transparent);box-shadow:0 0 0 1px #05203c inset;box-shadow:0 0 0 1px var(--bpk-chip-default-hover-border-color, rgb(5, 32, 60)) inset}:global(.bpk-no-touch-support) .bpk-chip--default:hover:not(:active):not(:disabled){background-color:rgba(0,0,0,0);background-color:var(--bpk-chip-default-hover-background-color, transparent);box-shadow:0 0 0 1px #05203c inset;box-shadow:0 0 0 1px var(--bpk-chip-default-hover-border-color, rgb(5, 32, 60)) inset}.bpk-chip--default:active:not(:disabled){box-shadow:0 0 0 1px #05203c inset;box-shadow:0 0 0 1px var(--bpk-chip-default-active-border-color, rgb(5, 32, 60)) inset}.bpk-chip--default-selected{color:#fff;color:var(--bpk-chip-default-selected-text-color, rgb(255, 255, 255));background-color:#05203c;background-color:var(--bpk-chip-default-selected-background-color, rgb(5, 32, 60));box-shadow:0 0 0 1px rgba(0,0,0,0) inset}.bpk-no-touch-support .bpk-chip--default-selected:hover:not(:active):not(:disabled){background-color:#05203c;background-color:var(--bpk-chip-default-selected-hover-background-color, rgb(5, 32, 60));box-shadow:0 0 0 1px rgba(0,0,0,0) inset}:global(.bpk-no-touch-support) .bpk-chip--default-selected:hover:not(:active):not(:disabled){background-color:#05203c;background-color:var(--bpk-chip-default-selected-hover-background-color, rgb(5, 32, 60));box-shadow:0 0 0 1px rgba(0,0,0,0) inset}.bpk-chip--default-selected:active:not(:disabled){background-color:#05203c;background-color:var(--bpk-chip-default-selected-active-background-color, rgb(5, 32, 60));box-shadow:0 0 0 1px rgba(0,0,0,0) inset}.bpk-no-touch-support .bpk-chip--default-dismissible:hover:not(:active):not(:disabled) svg{fill:currentcolor}:global(.bpk-no-touch-support) .bpk-chip--default-dismissible:hover:not(:active):not(:disabled) svg{fill:currentcolor}.bpk-chip--default-dismissible:active:not(:disabled) svg{fill:currentcolor}.bpk-chip--default-dismissible__trailing-accessory-view{fill:hsla(0,0%,100%,.5)}.bpk-chip--default-disabled{box-shadow:0 0 0 1px rgba(0,0,0,0) inset}.bpk-chip--on-image{background-color:#fff;background-color:var(--bpk-chip-on-image-background-color, rgb(255, 255, 255));color:#161616;color:var(--bpk-chip-on-image-text-color, rgb(22, 22, 22));box-shadow:0px 1px 3px 0px rgba(37,32,31,.3)}.bpk-no-touch-support .bpk-chip--on-image:hover:not(:active):not(:disabled){background-color:#eff3f8;background-color:var(--bpk-chip-on-image-hover-background-color, rgb(239, 243, 248))}:global(.bpk-no-touch-support) .bpk-chip--on-image:hover:not(:active):not(:disabled){background-color:#eff3f8;background-color:var(--bpk-chip-on-image-hover-background-color, rgb(239, 243, 248))}.bpk-chip--on-image:active:not(:disabled){background-color:#eff3f8;background-color:var(--bpk-chip-on-image-active-background-color, rgb(239, 243, 248))}.bpk-chip--on-image-selected{color:#fff;color:var(--bpk-chip-on-image-selected-text-color, rgb(255, 255, 255));background-color:#05203c;background-color:var(--bpk-chip-on-image-selected-background-color, rgb(5, 32, 60))}.bpk-no-touch-support .bpk-chip--on-image-selected:hover:not(:active):not(:disabled){background-color:#05203c;background-color:var(--bpk-chip-on-image-selected-hover-background-color, rgb(5, 32, 60))}:global(.bpk-no-touch-support) .bpk-chip--on-image-selected:hover:not(:active):not(:disabled){background-color:#05203c;background-color:var(--bpk-chip-on-image-selected-hover-background-color, rgb(5, 32, 60))}.bpk-chip--on-image-selected:active:not(:disabled){background-color:#05203c;background-color:var(--bpk-chip-on-image-selected-active-background-color, rgb(5, 32, 60))}.bpk-no-touch-support .bpk-chip--on-image-dismissible:hover:not(:active):not(:disabled) svg{fill:currentcolor}:global(.bpk-no-touch-support) .bpk-chip--on-image-dismissible:hover:not(:active):not(:disabled) svg{fill:currentcolor}.bpk-chip--on-image-dismissible:active:not(:disabled) svg{fill:currentcolor}.bpk-chip--on-image-dismissible__trailing-accessory-view{fill:hsla(0,0%,100%,.5)}.bpk-chip--on-image-disabled{box-shadow:0px 1px 3px 0px rgba(37,32,31,.3)}.bpk-chip--disabled{background-color:#e0e4e9;color:rgba(0,0,0,.2);cursor:not-allowed}.bpk-chip--icon-only{padding-inline-end:.5rem;padding-inline-start:.5rem}.bpk-chip--icon-only__leading-accessory-view{margin-left:0;margin-right:0}html[dir=rtl] .bpk-chip--icon-only__leading-accessory-view{margin-left:0;margin-right:0}
@@ -1,2 +1,6 @@
1
1
  declare const _default: string[];
2
2
  export default _default;
3
+ export declare const chipBorderRadiusThemeAttributes: string[];
4
+ export declare const chipDefaultThemeAttributes: string[];
5
+ export declare const chipOnDarkThemeAttributes: string[];
6
+ export declare const chipOnImageThemeAttributes: string[];
@@ -16,4 +16,10 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- export default ['chipDefaultSelectedBackgroundColor', 'chipDefaultSelectedTextColor', 'chipOnDarkSelectedBackgroundColor', 'chipOnDarkSelectedTextColor', 'chipOnImageSelectedBackgroundColor', 'chipOnImageSelectedHoverBackgroundColor', 'chipOnImageSelectedActiveBackgroundColor', 'chipOnImageSelectedTextColor'];
19
+ // Backward-compatible: original 8 selected-state attributes.
20
+ // Do not modify — existing consumers depend on this exact list.
21
+ export default ['chipDefaultSelectedBackgroundColor', 'chipDefaultSelectedTextColor', 'chipOnDarkSelectedBackgroundColor', 'chipOnDarkSelectedTextColor', 'chipOnImageSelectedBackgroundColor', 'chipOnImageSelectedHoverBackgroundColor', 'chipOnImageSelectedActiveBackgroundColor', 'chipOnImageSelectedTextColor'];
22
+ export const chipBorderRadiusThemeAttributes = ['chipBorderRadius'];
23
+ export const chipDefaultThemeAttributes = ['chipDefaultBackgroundColor', 'chipDefaultTextColor', 'chipDefaultBorderColor', 'chipDefaultHoverBackgroundColor', 'chipDefaultHoverBorderColor', 'chipDefaultActiveBorderColor', 'chipDefaultSelectedBackgroundColor', 'chipDefaultSelectedTextColor', 'chipDefaultSelectedHoverBackgroundColor', 'chipDefaultSelectedActiveBackgroundColor'];
24
+ export const chipOnDarkThemeAttributes = ['chipOnDarkBackgroundColor', 'chipOnDarkTextColor', 'chipOnDarkBorderColor', 'chipOnDarkHoverBorderColor', 'chipOnDarkActiveBorderColor', 'chipOnDarkSelectedBackgroundColor', 'chipOnDarkSelectedTextColor', 'chipOnDarkSelectedHoverBackgroundColor', 'chipOnDarkSelectedActiveBackgroundColor'];
25
+ export const chipOnImageThemeAttributes = ['chipOnImageBackgroundColor', 'chipOnImageTextColor', 'chipOnImageHoverBackgroundColor', 'chipOnImageActiveBackgroundColor', 'chipOnImageSelectedBackgroundColor', 'chipOnImageSelectedTextColor', 'chipOnImageSelectedHoverBackgroundColor', 'chipOnImageSelectedActiveBackgroundColor'];
@@ -15,4 +15,4 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */
18
- .bpk-pagination-page{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-pagination-page:hover:not(:active):not(:disabled){color:#fff;color:var(--bpk-button-primary-hover-text-color, rgb(255, 255, 255));background-color:#154679;background-color:var(--bpk-button-primary-hover-background-color, rgb(21, 70, 121))}:global(.bpk-no-touch-support) .bpk-pagination-page:hover:not(:active):not(:disabled){color:#fff;color:var(--bpk-button-primary-hover-text-color, rgb(255, 255, 255));background-color:#154679;background-color:var(--bpk-button-primary-hover-background-color, rgb(21, 70, 121))}.bpk-pagination-page: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-pagination-page:disabled{background-color:#e0e4e9;color:rgba(0,0,0,.2);cursor:not-allowed}.bpk-no-touch-support .bpk-pagination-page:hover:not(:active):not(:disabled){background-color:rgba(0,0,0,0);color:#161616;box-shadow:0 0 0 1px #05203c inset}:global(.bpk-no-touch-support) .bpk-pagination-page:hover:not(:active):not(:disabled){background-color:rgba(0,0,0,0);color:#161616;box-shadow:0 0 0 1px #05203c inset}.bpk-pagination-page--not-selected{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));box-shadow:0 0 0 1px var(--bpk-pagination-selected-background-color, rgb(193, 199, 207)) inset}.bpk-no-touch-support .bpk-pagination-page--not-selected:hover:not(:active):not(:disabled){color:#161616;color:var(--bpk-button-primary-on-dark-hover-text-color, rgb(22, 22, 22));background-color:#c1c7cf;background-color:var(--bpk-button-primary-on-dark-hover-background-color, rgb(193, 199, 207))}:global(.bpk-no-touch-support) .bpk-pagination-page--not-selected:hover:not(:active):not(:disabled){color:#161616;color:var(--bpk-button-primary-on-dark-hover-text-color, rgb(22, 22, 22));background-color:#c1c7cf;background-color:var(--bpk-button-primary-on-dark-hover-background-color, rgb(193, 199, 207))}.bpk-pagination-page--not-selected: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-pagination-page--not-selected:disabled{background-color:#e0e4e9;color:rgba(0,0,0,.2)}.bpk-no-touch-support .bpk-pagination-page--not-selected:hover:not(:active):not(:disabled){background-color:rgba(0,0,0,0);color:#161616}:global(.bpk-no-touch-support) .bpk-pagination-page--not-selected:hover:not(:active):not(:disabled){background-color:rgba(0,0,0,0);color:#161616}
18
+ .bpk-pagination-page{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-pagination-page: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-pagination-page: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-pagination-page: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-pagination-page:disabled{background-color:#e0e4e9;color:rgba(0,0,0,.2);cursor:not-allowed}.bpk-pagination-page.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))}.bpk-no-touch-support .bpk-pagination-page:hover:not(:active):not(:disabled){background-color:rgba(0,0,0,0);color:#161616;box-shadow:0 0 0 1px #05203c inset}:global(.bpk-no-touch-support) .bpk-pagination-page:hover:not(:active):not(:disabled){background-color:rgba(0,0,0,0);color:#161616;box-shadow:0 0 0 1px #05203c inset}.bpk-pagination-page--not-selected{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));box-shadow:0 0 0 1px var(--bpk-pagination-selected-background-color, rgb(193, 199, 207)) inset}.bpk-no-touch-support .bpk-pagination-page--not-selected: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-pagination-page--not-selected: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-pagination-page--not-selected: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-pagination-page--not-selected:disabled{background-color:#e0e4e9;color:rgba(0,0,0,.2)}.bpk-pagination-page--not-selected.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-no-touch-support .bpk-pagination-page--not-selected:hover:not(:active):not(:disabled){background-color:rgba(0,0,0,0);color:#161616}:global(.bpk-no-touch-support) .bpk-pagination-page--not-selected:hover:not(:active):not(:disabled){background-color:rgba(0,0,0,0);color:#161616}
@@ -25,7 +25,7 @@ import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
25
25
  import BpkScrollableCalendarGrid from "./BpkScrollableCalendarGrid";
26
26
  import { getMonthsArray, getMonthItemHeights } from "./utils";
27
27
  import STYLES from "./BpkScrollableCalendarGridList.module.css";
28
- import { jsx as _jsx } from "react/jsx-runtime";
28
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
29
29
  const getClassName = cssModules(STYLES);
30
30
 
31
31
  // These constants are here to facilitate calculating the height
@@ -46,6 +46,7 @@ const BpkScrollableCalendarGridList = props => {
46
46
  ...rest
47
47
  } = props;
48
48
  const listRef = useRef(null);
49
+ const sentinelRef = useRef(null);
49
50
  const startDate = startOfDay(startOfMonth(minDate));
50
51
  const endDate = startOfDay(startOfMonth(rest.maxDate));
51
52
  const monthsCount = DateUtils.differenceInCalendarMonths(endDate, startDate);
@@ -54,11 +55,13 @@ const BpkScrollableCalendarGridList = props => {
54
55
  const rowHeight = customRowHeight;
55
56
  // Most calendar grids have 5 rows. Calculate height in px as this is what react-window expects.
56
57
  const estimatedMonthItemHeight = (BASE_MONTH_ITEM_HEIGHT + 5 * rowHeight) * DEFAULT_ROOT_FONT_SIZE;
57
- const getInitialRootFontSize = () => parseFloat(getComputedStyle(document.documentElement).fontSize) || DEFAULT_ROOT_FONT_SIZE;
58
58
 
59
59
  // The `react-window` API requires the height in pixels to be specified
60
60
  // To be able to scale text size, we use rem and then we get the root font size so that we can calculate the final value in px
61
- const [rootFontSize, setRootFontSize] = useState(getInitialRootFontSize);
61
+ // Initialise to the default; the sentinel ResizeObserver corrects this to the true rendered
62
+ // value immediately on mount, so we never rely on getComputedStyle which can be stale under
63
+ // browser font scaling.
64
+ const [rootFontSize, setRootFontSize] = useState(DEFAULT_ROOT_FONT_SIZE);
62
65
  const months = useMemo(() => getMonthsArray(startDate, monthsCount), [minDate, monthsCount]);
63
66
  const monthItemHeights = useMemo(() => getMonthItemHeights(months, rest.weekStartsOn, COLUMN_COUNT, rowHeight * rootFontSize, BASE_MONTH_ITEM_HEIGHT * rootFontSize), [rootFontSize, months, rest.weekStartsOn]);
64
67
  useEffect(() => {
@@ -67,8 +70,35 @@ const BpkScrollableCalendarGridList = props => {
67
70
  listRef.current.resetAfterIndex(0);
68
71
  }
69
72
  }, [monthItemHeights]);
73
+ useEffect(() => {
74
+ // Some browsers apply font scaling at the rendering level without updating getComputedStyle.
75
+ // A sentinel element sized to 1rem lets us measure the true rendered px-per-rem directly,
76
+ // so that react-window item heights stay accurate regardless of browser font scaling.
77
+ const sentinel = sentinelRef.current;
78
+ if (!sentinel || typeof ResizeObserver === 'undefined') return undefined;
79
+ const observer = new ResizeObserver(entries => {
80
+ const entry = entries[0];
81
+ if (entry) {
82
+ const newRootFontSize = entry.contentRect.width || DEFAULT_ROOT_FONT_SIZE;
83
+ setRootFontSize(newRootFontSize);
84
+ }
85
+ });
86
+ observer.observe(sentinel);
87
+ return () => observer.disconnect();
88
+ }, []);
70
89
  const getHtmlElement = () => typeof document !== 'undefined' ? document.querySelector('html') : {};
71
90
  const getItemSize = index => monthItemHeights[index] || estimatedMonthItemHeight;
91
+ const calculateOffsetInPixels = numberOfMonths => {
92
+ // The `react-window` API requires the scroll offset to be provided in pixels.
93
+ // Here we use the pre-calculated item heights to find the correct pixel offset
94
+ let result = 0;
95
+ for (let i = 0; i < numberOfMonths; i += 1) {
96
+ result += getItemSize(i);
97
+ }
98
+ return result;
99
+ };
100
+ const date = selectionConfiguration?.type === CALENDAR_SELECTION_TYPE.single ? selectionConfiguration?.date : selectionConfiguration?.startDate;
101
+ const selectedDate = focusedDate || date;
72
102
  const rowRenderer = ({
73
103
  index,
74
104
  style
@@ -85,26 +115,14 @@ const BpkScrollableCalendarGridList = props => {
85
115
  "aria-hidden": index !== 1
86
116
  })
87
117
  });
88
- const calculateOffsetInPixels = numberOfMonths => {
89
- // The `react-window` API requires the scroll offset to be provided in pixels.
90
- // Here we use the pre-calculated item heights to find the correct pixel offset
91
- let result = 0;
92
- for (let i = 0; i < numberOfMonths; i += 1) {
93
- result += getItemSize(i);
94
- }
95
- return result;
96
- };
97
- const onResize = () => {
98
- const newRootFontSize = parseFloat(getComputedStyle(document.documentElement).fontSize) || DEFAULT_ROOT_FONT_SIZE;
99
- setRootFontSize(newRootFontSize);
100
- };
101
- const date = selectionConfiguration?.type === CALENDAR_SELECTION_TYPE.single ? selectionConfiguration?.date : selectionConfiguration?.startDate;
102
- const selectedDate = focusedDate || date;
103
- return /*#__PURE__*/_jsx("div", {
118
+ return /*#__PURE__*/_jsxs("div", {
104
119
  className: getClassName('bpk-scrollable-calendar-grid-list', className),
105
120
  ...getDataComponentAttribute('ScrollableCalendarGridList'),
106
- children: /*#__PURE__*/_jsx(AutoSizer, {
107
- onResize: onResize,
121
+ children: [/*#__PURE__*/_jsx("div", {
122
+ ref: sentinelRef,
123
+ className: getClassName('bpk-scrollable-calendar-grid-list__font-sentinel'),
124
+ "aria-hidden": "true"
125
+ }), /*#__PURE__*/_jsx(AutoSizer, {
108
126
  defaultHeight: estimatedMonthItemHeight,
109
127
  defaultWidth: ESTIMATED_MONTH_ITEM_WIDTH,
110
128
  children: ({
@@ -124,7 +142,7 @@ const BpkScrollableCalendarGridList = props => {
124
142
  ref: listRef,
125
143
  children: rowRenderer
126
144
  })
127
- })
145
+ })]
128
146
  });
129
147
  };
130
148
  export default BpkScrollableCalendarGridList;
@@ -15,4 +15,4 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */
18
- .bpk-scrollable-calendar-grid-list{position:relative;width:100%;height:100%;min-height:26.25rem;overflow-x:hidden;box-sizing:border-box;-ms-overflow-style:-ms-autohiding-scrollbar}
18
+ .bpk-scrollable-calendar-grid-list{position:relative;width:100%;height:100%;min-height:26.25rem;overflow-x:hidden;box-sizing:border-box;-ms-overflow-style:-ms-autohiding-scrollbar}.bpk-scrollable-calendar-grid-list__font-sentinel{position:absolute;visibility:hidden;width:1rem;height:1rem;overflow:hidden;pointer-events:none}
@@ -1,3 +1,3 @@
1
- declare const getMonthsArray: (startDate: Date, count: number) => Date[];
1
+ declare const getMonthsArray: (startDate: Date, count: number) => any[];
2
2
  declare const getMonthItemHeights: (months: Date[], weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6, columnCount: number, rowHeight: number, baseMonthItemHeight: number) => number[];
3
3
  export { getMonthsArray, getMonthItemHeights };
@@ -2,3 +2,5 @@ import BpkSegmentedControl, { useSegmentedControlPanels, type Props as BpkSegmen
2
2
  export type { BpkSegmentControlProps, TabPanelProps };
3
3
  export { useSegmentedControlPanels };
4
4
  export default BpkSegmentedControl;
5
+ export { default as BpkSegmentedControlV2, SEGMENT_TYPES_V2 } from './src/BpkSegmentedControlV2/BpkSegmentedControlV2';
6
+ export type { BpkSegmentedControlV2RootProps, BpkSegmentedControlV2ItemProps, BpkSegmentedControlV2ItemTextProps, SegmentTypesV2, } from './src/BpkSegmentedControlV2/common-types';
@@ -18,4 +18,5 @@
18
18
 
19
19
  import BpkSegmentedControl, { useSegmentedControlPanels } from "./src/BpkSegmentedControl";
20
20
  export { useSegmentedControlPanels };
21
- export default BpkSegmentedControl;
21
+ export default BpkSegmentedControl;
22
+ export { default as BpkSegmentedControlV2, SEGMENT_TYPES_V2 } from "./src/BpkSegmentedControlV2/BpkSegmentedControlV2";
@@ -0,0 +1,19 @@
1
+ import { SEGMENT_TYPES_V2 } from './common-types';
2
+ import type { BpkSegmentedControlV2ItemProps, BpkSegmentedControlV2ItemTextProps, BpkSegmentedControlV2RootProps } from './common-types';
3
+ declare const BpkSegmentedControlV2Root: ({ children, defaultValue, label, onChange, shadow, type, value, }: BpkSegmentedControlV2RootProps) => import("react/jsx-runtime").JSX.Element;
4
+ declare const BpkSegmentedControlV2Item: ({ children, value, }: BpkSegmentedControlV2ItemProps) => import("react/jsx-runtime").JSX.Element;
5
+ declare const BpkSegmentedControlV2ItemText: ({ children, }: BpkSegmentedControlV2ItemTextProps) => import("react/jsx-runtime").JSX.Element;
6
+ declare const BpkSegmentedControlV2ItemControl: () => import("react/jsx-runtime").JSX.Element;
7
+ declare const BpkSegmentedControlV2ItemHiddenInput: () => import("react/jsx-runtime").JSX.Element;
8
+ declare const BpkSegmentedControlV2Indicator: () => import("react/jsx-runtime").JSX.Element;
9
+ declare const BpkSegmentedControlV2: {
10
+ Root: ({ children, defaultValue, label, onChange, shadow, type, value, }: BpkSegmentedControlV2RootProps) => import("react/jsx-runtime").JSX.Element;
11
+ Item: ({ children, value, }: BpkSegmentedControlV2ItemProps) => import("react/jsx-runtime").JSX.Element;
12
+ ItemText: ({ children, }: BpkSegmentedControlV2ItemTextProps) => import("react/jsx-runtime").JSX.Element;
13
+ ItemControl: () => import("react/jsx-runtime").JSX.Element;
14
+ ItemHiddenInput: () => import("react/jsx-runtime").JSX.Element;
15
+ Indicator: () => import("react/jsx-runtime").JSX.Element;
16
+ };
17
+ export default BpkSegmentedControlV2;
18
+ export { BpkSegmentedControlV2Root, BpkSegmentedControlV2Item, BpkSegmentedControlV2ItemText, BpkSegmentedControlV2ItemControl, BpkSegmentedControlV2ItemHiddenInput, BpkSegmentedControlV2Indicator, SEGMENT_TYPES_V2, };
19
+ export type { BpkSegmentedControlV2RootProps, BpkSegmentedControlV2ItemProps, BpkSegmentedControlV2ItemTextProps, };
@@ -0,0 +1,81 @@
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 { SegmentGroup } from '@ark-ui/react';
20
+ import { cssModules, getDataComponentAttribute } from "../../../bpk-react-utils";
21
+ import { SEGMENT_TYPES_V2 } from "./common-types";
22
+ import STYLES from "./BpkSegmentedControlV2.module.css";
23
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
+ const getClassName = cssModules(STYLES);
25
+ const BpkSegmentedControlV2Root = ({
26
+ children,
27
+ defaultValue,
28
+ label,
29
+ onChange,
30
+ shadow = false,
31
+ type = SEGMENT_TYPES_V2.CanvasDefault,
32
+ value
33
+ }) => {
34
+ const containerClass = getClassName('bpk-segmented-control-v2', `bpk-segmented-control-v2--${type}`, shadow && 'bpk-segmented-control-v2--shadow');
35
+ return /*#__PURE__*/_jsxs(SegmentGroup.Root, {
36
+ className: containerClass,
37
+ value: value,
38
+ defaultValue: defaultValue,
39
+ onValueChange: onChange ? ({
40
+ value: selectedValue
41
+ }) => {
42
+ if (selectedValue !== null) onChange(selectedValue);
43
+ } : undefined,
44
+ orientation: "horizontal",
45
+ ...getDataComponentAttribute('SegmentedControlV2'),
46
+ children: [/*#__PURE__*/_jsx(SegmentGroup.Label, {
47
+ children: label
48
+ }), children]
49
+ });
50
+ };
51
+ const BpkSegmentedControlV2Item = ({
52
+ children,
53
+ value
54
+ }) => /*#__PURE__*/_jsx(SegmentGroup.Item, {
55
+ value: value,
56
+ className: getClassName('bpk-segmented-control-v2__item'),
57
+ children: children
58
+ });
59
+ const BpkSegmentedControlV2ItemText = ({
60
+ children
61
+ }) => /*#__PURE__*/_jsx(SegmentGroup.ItemText, {
62
+ className: getClassName('bpk-segmented-control-v2__item-text'),
63
+ children: children
64
+ });
65
+ const BpkSegmentedControlV2ItemControl = () => /*#__PURE__*/_jsx(SegmentGroup.ItemControl, {
66
+ className: getClassName('bpk-segmented-control-v2__item-control')
67
+ });
68
+ const BpkSegmentedControlV2ItemHiddenInput = () => /*#__PURE__*/_jsx(SegmentGroup.ItemHiddenInput, {});
69
+ const BpkSegmentedControlV2Indicator = () => /*#__PURE__*/_jsx(SegmentGroup.Indicator, {
70
+ className: getClassName('bpk-segmented-control-v2__indicator')
71
+ });
72
+ const BpkSegmentedControlV2 = {
73
+ Root: BpkSegmentedControlV2Root,
74
+ Item: BpkSegmentedControlV2Item,
75
+ ItemText: BpkSegmentedControlV2ItemText,
76
+ ItemControl: BpkSegmentedControlV2ItemControl,
77
+ ItemHiddenInput: BpkSegmentedControlV2ItemHiddenInput,
78
+ Indicator: BpkSegmentedControlV2Indicator
79
+ };
80
+ export default BpkSegmentedControlV2;
81
+ export { BpkSegmentedControlV2Root, BpkSegmentedControlV2Item, BpkSegmentedControlV2ItemText, BpkSegmentedControlV2ItemControl, BpkSegmentedControlV2ItemHiddenInput, BpkSegmentedControlV2Indicator, SEGMENT_TYPES_V2 };
@@ -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-segmented-control-v2{position:relative;display:grid;grid-auto-columns:1fr;grid-auto-flow:column;border-radius:.5rem;background-color:#eff3f8;overflow:hidden}.bpk-segmented-control-v2--canvas-default{background-color:#eff3f8}.bpk-segmented-control-v2--canvas-contrast{background-color:#fff}.bpk-segmented-control-v2--canvas-contrast .bpk-segmented-control-v2__indicator{background-color:#fff}.bpk-segmented-control-v2--surface-default{background-color:#eff3f8}.bpk-segmented-control-v2--surface-default .bpk-segmented-control-v2__indicator{background-color:#eff3f8}.bpk-segmented-control-v2--surface-contrast{background-color:hsla(0,0%,100%,.1)}.bpk-segmented-control-v2--surface-contrast .bpk-segmented-control-v2__indicator{background-color:#024daf}.bpk-segmented-control-v2--surface-contrast .bpk-segmented-control-v2__item-text{color:#fff;border-inline-start-color:hsla(0,0%,100%,.5)}.bpk-segmented-control-v2--shadow{box-shadow:0px 1px 3px 0px rgba(37,32,31,.3)}.bpk-segmented-control-v2>[data-part=label]{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;white-space:nowrap;overflow:hidden;clip:rect(0 0 0 0)}.bpk-segmented-control-v2__indicator{position:absolute;top:var(--top);left:var(--left);width:var(--width);height:var(--height);background-color:#05203c;--transition-duration: 0ms}.bpk-segmented-control-v2__item{display:grid;cursor:pointer}.bpk-segmented-control-v2__item:first-of-type .bpk-segmented-control-v2__item-text{border-inline-start:none}.bpk-segmented-control-v2__item:has([data-state=checked]) .bpk-segmented-control-v2__item-text{border-inline-start-color:rgba(0,0,0,0)}.bpk-segmented-control-v2__item:has([data-state=checked])+.bpk-segmented-control-v2__item .bpk-segmented-control-v2__item-text{border-inline-start-color:rgba(0,0,0,0)}.bpk-segmented-control-v2__item:has(:focus-visible){z-index:1;outline:.125rem solid #0062e3;outline-offset:-0.125rem}.bpk-segmented-control-v2__item-control{display:none}.bpk-segmented-control-v2__item-text{padding:.25rem .5rem;display:flex;z-index:1;min-height:2rem;grid-area:1/1;justify-content:center;align-items:center;transition:color 50ms ease-in-out;color:#161616;overflow:hidden;border-inline-start:1px solid #c1c7cf;pointer-events:none;font-size:.875rem;line-height:1.25rem;font-weight:700}.bpk-segmented-control-v2__item-text svg{fill:currentcolor}.bpk-segmented-control-v2__item-text[data-state=checked]{color:#fff}
@@ -0,0 +1,57 @@
1
+ import type { ReactNode } from 'react';
2
+ export declare const SEGMENT_TYPES_V2: {
3
+ readonly CanvasDefault: "canvas-default";
4
+ readonly CanvasContrast: "canvas-contrast";
5
+ readonly SurfaceDefault: "surface-default";
6
+ readonly SurfaceContrast: "surface-contrast";
7
+ };
8
+ export type SegmentTypesV2 = (typeof SEGMENT_TYPES_V2)[keyof typeof SEGMENT_TYPES_V2];
9
+ export type BpkSegmentedControlV2RootProps = {
10
+ /**
11
+ * Slot content — one or more BpkSegmentedControlV2.Item elements.
12
+ */
13
+ children: ReactNode;
14
+ /**
15
+ * Controlled selected value. When provided, onChange must also be provided.
16
+ */
17
+ value?: string;
18
+ /**
19
+ * Initial selected value for uncontrolled usage.
20
+ */
21
+ defaultValue?: string;
22
+ /**
23
+ * Called when the selected segment changes. Receives the value of the newly selected item.
24
+ */
25
+ onChange?: (value: string) => void;
26
+ /**
27
+ * Pre-defined surface theme controlling default token values.
28
+ * @default 'canvas-default'
29
+ */
30
+ type?: SegmentTypesV2;
31
+ /**
32
+ * Applies a box shadow to the group container.
33
+ * @default false
34
+ */
35
+ shadow?: boolean;
36
+ /**
37
+ * Accessible label for the radiogroup. Always required to satisfy WCAG 4.1.2
38
+ * (the role="radiogroup" element must have an accessible name).
39
+ */
40
+ label: string;
41
+ };
42
+ export type BpkSegmentedControlV2ItemProps = {
43
+ /**
44
+ * Unique identifier for this segment within the group.
45
+ */
46
+ value: string;
47
+ /**
48
+ * Slot content — typically ItemText + ItemControl + ItemHiddenInput.
49
+ */
50
+ children: ReactNode;
51
+ };
52
+ export type BpkSegmentedControlV2ItemTextProps = {
53
+ /**
54
+ * Visible content of the segment — text, icons, or a combination.
55
+ */
56
+ children: ReactNode;
57
+ };
@@ -0,0 +1,24 @@
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 SEGMENT_TYPES_V2 = {
20
+ CanvasDefault: 'canvas-default',
21
+ CanvasContrast: 'canvas-contrast',
22
+ SurfaceDefault: 'surface-default',
23
+ SurfaceContrast: 'surface-contrast'
24
+ };