Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/bpk-component-calendar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import composeCalendar from './src/composeCalendar';
import { CALENDAR_SELECTION_TYPE } from './src/custom-proptypes';
import CustomPropTypes, {
BpkCalendarGridPropTypes,
BpkCalendarDatePropTypes, // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
} from './src/custom-proptypes-legacy';
import * as DateUtils from './src/date-utils';
import themeAttributes from './src/themeAttributes';
Expand Down Expand Up @@ -69,7 +68,7 @@ export {
BpkCalendarGridWithTransition,
CustomPropTypes,
BpkCalendarGridPropTypes,
BpkCalendarDatePropTypes,
// BpkCalendarDatePropTypes is deprecated - use BpkCalendarDateProps instead
BpkCalendarDateProps,
BpkCalendarGridProps,
};
1 change: 0 additions & 1 deletion packages/bpk-component-calendar/src/BpkCalendarNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
import BpkAriaLive from '../../bpk-component-aria-live';
import ArrowLeftIcon from '../../bpk-component-icon/lg/arrow-left';
import ArrowRightIcon from '../../bpk-component-icon/lg/arrow-right';
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
import BpkSelect from '../../bpk-component-select';

Check failure on line 28 in packages/bpk-component-calendar/src/BpkCalendarNav.tsx

View workflow job for this annotation

GitHub Actions / Build / Build

Could not find a declaration file for module '../../bpk-component-select'. '/home/runner/work/backpack/backpack/packages/bpk-component-select/index.js' implicitly has an 'any' type.
import { cssModules, getDataComponentAttribute } from '../../bpk-react-utils';

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`BpkCalendarContainer should focus the correct date when \`initiallyFocusedDate\` is set and selected date is not 1`] = `
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`BpkCalendarDate should pass props through to button 1`] = `
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`BpkCalendarGrid should render correctly with "weekDayKey" attribute set to nameNarrow 1`] = `
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`BpkCalendar should render correctly 1`] = `
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`BpkCalendarNav should disable inputs when disabled 1`] = `
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`BpkCalendarWeek should render correctly 1`] = `
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`composeCalendar should compose a nav, header, grid and date component correctly 1`] = `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
* limitations under the License.
*/


import PropTypes from 'prop-types';

import { isBefore, isSameDay } from './date-utils';

const DateType = () => (props) => {
const DateType = () => (props: Record<string, Date | null | undefined>) => {
const { endDate, startDate } = props;

// No range selected
Expand All @@ -39,7 +40,7 @@ const DateType = () => (props) => {
}

// Start date cannot be after end date
if (isBefore(endDate, startDate) && !isSameDay(endDate, startDate)) {
if (endDate && startDate && isBefore(endDate, startDate) && !isSameDay(endDate, startDate)) {
return new Error(
`Start date \`${startDate}\` cannot be after end date \`${endDate}\`.`,
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`BpkDatepicker "readOnly" can be overriden in "inputProps" 1`] = `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,23 @@
* limitations under the License.
*/

/* @flow strict */

import BpkIconMarker, {
type Props as IconMarkerProps,
} from './src/BpkIconMarker';

import BpkIconMarker
from './src/BpkIconMarker';
Comment on lines +21 to +22
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import statement is split across two lines unnecessarily. Keep the import on a single line for better readability.

Suggested change
import BpkIconMarker
from './src/BpkIconMarker';
import BpkIconMarker from './src/BpkIconMarker';

Copilot uses AI. Check for mistakes.
import BpkMap from './src/BpkMap';
import BpkOverlayView from './src/BpkOverlayView';
import BpkPriceMarker from './src/BpkPriceMarker';
import BpkPriceMarkerButton, {
MARKER_STATUSES,
} from './src/BpkPriceMarkerButton';
import { type LatLong } from './src/common-types';
import {
defaultIconMarkerThemeAttributes,
priceMarkerThemeAttributes,
} from './src/themeAttributes';
import withGoogleMapsScript from './src/withGoogleMapsScript';

export default BpkMap;
export type BpkMapLatLong = LatLong;
export type BpkIconMarkerProps = IconMarkerProps;
export {
BpkIconMarker,
BpkPriceMarker,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@
* limitations under the License.
*/

/* @flow strict */


import type { ReactNode } from 'react';

import { render } from '@testing-library/react';

import BpkBasicMapMarker from './BpkBasicMapMarker';

jest.mock('@react-google-maps/api', () => ({
OverlayView: (props) => (
OverlayView: (props: { children: ReactNode }) => (
<div>
<div className="mock-overlay-view" />
{/* eslint-disable-next-line react/prop-types */}
{props.children}
</div>
),
Expand Down
7 changes: 3 additions & 4 deletions packages/bpk-component-map/src/BpkBasicMapMarker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ import type { ReactNode } from 'react';

import { getDataComponentAttribute } from '../../bpk-react-utils';

// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
import BpkOverlayView from './BpkOverlayView';
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
import { LatLongPropType, type LatLong } from './common-types';

type Props = {
children: ReactNode,
position: LatLong,
children: ReactNode;
position: LatLong;
[key: string]: unknown;
};

const getPixelPositionOffset = (width: number, height: number) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@
* limitations under the License.
*/

/* @flow strict */


import type { ReactNode } from 'react';

import { render } from '@testing-library/react';

import BpkIconMarker from './BpkIconMarker';

jest.mock('@react-google-maps/api', () => ({
OverlayView: (props) => (
OverlayView: (props: { children: ReactNode }) => (
<div>
<div className="mock-overlay-view" />
{/* eslint-disable-next-line react/prop-types */}
{props.children}
</div>
),
Expand Down Expand Up @@ -69,7 +70,7 @@ describe('BpkIconMarker', () => {
<BpkIconMarker
position={position}
icon={icon}
buttonProps={{ testId: 'arbitrary value' }}
buttonProps={{ 'data-testid': 'arbitrary value' }}
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test was updated to use 'data-testid' instead of 'testId', but the snapshot should be updated to verify this change is captured correctly.

Copilot uses AI. Check for mistakes.
/>,
);
expect(asFragment()).toMatchSnapshot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,30 @@
* limitations under the License.
*/

/* @flow strict */

import PropTypes from 'prop-types';
import type { Node } from 'react';
import type { ReactNode, MouseEvent, ButtonHTMLAttributes } from 'react';


import { cssModules } from '../../bpk-react-utils';

import BpkBasicMapMarker from './BpkBasicMapMarker';
import BpkIconMarkerBackground from './BpkIconMarkerBackground';
import { LatLongPropType, type LatLong } from './common-types';
import { LatLongPropType } from './common-types';

import type { LatLong } from './common-types';

import STYLES from './BpkIconMarker.module.scss';

const getClassName = cssModules(STYLES);

export type Props = {
icon: Node,
position: LatLong,
selected: boolean,
className: ?string,
onClick: ?(event: SyntheticEvent<>) => mixed,
buttonProps: ?{ [string]: any },
type Props = {
icon: ReactNode;
position: LatLong;
className?: string | null;
onClick?: ((event: MouseEvent<HTMLButtonElement>) => void) | null;
selected?: boolean;
buttonProps?: (ButtonHTMLAttributes<HTMLButtonElement> & { [key: `data-${string}`]: string }) | null;
[key: string]: unknown;
};

const BpkIconMarker = (props: Props) => {
Expand All @@ -63,7 +65,7 @@ const BpkIconMarker = (props: Props) => {
<button
type="button"
className={wrapperClassNames}
onClick={onClick}
onClick={onClick ?? undefined}
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The nullish coalescing operator is unnecessary here since undefined and null are both valid for optional onClick props. Simply pass onClick directly.

Suggested change
onClick={onClick ?? undefined}
onClick={onClick}

Copilot uses AI. Check for mistakes.
{...buttonProps}
>
<BpkIconMarkerBackground
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

/* @flow strict */


import { render } from '@testing-library/react';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,23 @@
* limitations under the License.
*/

/* @flow strict */


import type { SVGProps } from 'react';

import { cssModules } from '../../bpk-react-utils';

import STYLES from './BpkIconMarkerBackground.module.scss';

const getClassName = cssModules(STYLES);

type Props = {
disabled: boolean,
interactive: boolean,
selected: boolean,
};
interface BpkIconMarkerBackgroundProps extends SVGProps<SVGSVGElement> {
disabled?: boolean;
interactive?: boolean;
selected?: boolean;
}

const BpkIconMarkerBackground = (props: Props) => {
const BpkIconMarkerBackground = (props: BpkIconMarkerBackgroundProps) => {
const { disabled, interactive, selected, ...rest } = props;

const classNames = getClassName(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,64 +16,58 @@
* limitations under the License.
*/

/* @flow strict */


import PropTypes from 'prop-types';
import type { Node } from 'react';
import { useCallback, useRef } from 'react';

import { GoogleMap } from '@react-google-maps/api';

import { cssModules } from '../../bpk-react-utils';

import { LatLongPropType, type LatLong } from './common-types';
import { LatLongPropType, } from './common-types';
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the trailing comma after LatLongPropType in the import statement as it serves no purpose when there's only one import.

Suggested change
import { LatLongPropType, } from './common-types';
import { LatLongPropType } from './common-types';

Copilot uses AI. Check for mistakes.

import STYLES from './BpkMap.module.scss';

const getClassName = cssModules(STYLES);

export type Bounds = {
south: number,
west: number,
north: number,
east: number,




type LatLong = {
latitude: number;
longitude: number;
};
Comment on lines +38 to 41
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LatLong type is being duplicated here when it should be imported from './common-types' instead. Remove this local definition and import the type from the common-types module.

Copilot uses AI. Check for mistakes.

export type MapRef = ?{
getBounds: () => Bounds,
getCenter: () => LatLong,
getZoom: () => number,
fitBounds: (Bounds) => void,
type Bounds = {
south: number;
west: number;
north: number;
east: number;
};

type MapOptionStyle = {
featureType: ?string,
elementType: ?string,
stylers: Array<{
[string]: string,
}>,
featureType?: string;
elementType?: string;
stylers: Array<Record<string, unknown>>;
};

type Props = {
greedyGestureHandling: boolean,
panEnabled: boolean,
showControls: boolean,
zoom: number,
/**
* Note: One of `bounds` and `center` must be provided.
*/
bounds: ?Bounds,
/**
* Note: One of `bounds` and `center` must be provided.
*/
center: ?LatLong,
children: ?Node,
mapRef: ?(MapRef) => mixed,
onRegionChange: ?(Bounds, LatLong) => mixed,
onZoom: ?(number) => mixed,
onTilesLoaded: ?() => void,
className: ?string,
mapOptionStyles: ?Array<MapOptionStyle>,
bounds?: Bounds | null;
center?: LatLong;
children?: React.ReactNode;
greedyGestureHandling?: boolean;
mapRef?: ((map: google.maps.Map | null) => void) | null;
className?: string | null;
onRegionChange?: ((bounds: google.maps.LatLngBounds | undefined, center: google.maps.LatLng | undefined) => void) | null;
onZoom?: ((zoom: number | undefined) => void) | null;
onTilesLoaded?: (() => void) | null;
panEnabled?: boolean;
showControls?: boolean;
zoom?: number;
mapOptionStyles?: MapOptionStyle[] | null;
mapId?: string | null;
};

const BpkMap = (props: Props) => {
Expand Down Expand Up @@ -106,11 +100,11 @@ const BpkMap = (props: Props) => {
gestureHandling = 'greedy';
}

const ref = useRef(null);
const ref = useRef<google.maps.Map | null>(null);
const mapContainerClassName = getClassName('bpk-map', className);

const onLoad = useCallback(
(map) => {
(map: google.maps.Map) => {
ref.current = map;
if (map && bounds) {
map.fitBounds({
Expand Down
Loading
Loading