@skyscanner/backpack-web 42.25.0 → 42.26.0-dev-v27635015998.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -58
- package/bpk-component-accordion/src/BpkAccordionItem.d.ts +1 -1
- package/bpk-component-accordion/src/withAccordionItemState.d.ts +2 -7
- package/bpk-component-accordion/src/withAccordionItemState.js +4 -6
- package/bpk-component-accordion/src/withSingleItemAccordionState.d.ts +1 -1
- package/bpk-component-aria-live/src/BpkAriaLive.d.ts +1 -1
- package/bpk-component-aria-live/src/BpkAriaLive.story-helpers.d.ts +2 -2
- package/bpk-component-autosuggest/src/BpkAutosuggestV2/BpkAutosuggest.d.ts +4 -4
- package/bpk-component-badge/src/BpkBadge.module.css +1 -1
- package/bpk-component-banner-alert/src/AnimateAndFade.d.ts +4 -7
- package/bpk-component-banner-alert/src/AnimateAndFade.js +14 -10
- package/bpk-component-banner-alert/src/withBannerAlertState.d.ts +0 -10
- package/bpk-component-banner-alert/src/withBannerAlertState.js +3 -13
- package/bpk-component-barchart/src/BpkBarchart.js +24 -41
- package/bpk-component-barchart/src/BpkBarchartBar.js +7 -16
- package/bpk-component-barchart/src/BpkBarchartBars.js +6 -14
- package/bpk-component-barchart/src/BpkChartAxis.js +5 -12
- package/bpk-component-barchart/src/BpkChartDataTable.js +1 -4
- package/bpk-component-barchart/src/BpkChartGridLines.js +3 -8
- package/bpk-component-calendar/index.d.ts +2 -2
- package/bpk-component-calendar/index.js +2 -2
- package/bpk-component-calendar/src/BpkCalendarContainer.d.ts +3 -28
- package/bpk-component-calendar/src/BpkCalendarContainer.js +47 -34
- package/bpk-component-calendar/src/BpkCalendarDate.d.ts +0 -1
- package/bpk-component-calendar/src/BpkCalendarDate.js +32 -31
- package/bpk-component-calendar/src/BpkCalendarGrid.d.ts +13 -14
- package/bpk-component-calendar/src/BpkCalendarGrid.js +28 -37
- package/bpk-component-calendar/src/BpkCalendarGridHeader.d.ts +0 -4
- package/bpk-component-calendar/src/BpkCalendarGridHeader.js +2 -6
- package/bpk-component-calendar/src/BpkCalendarGridTransition.d.ts +0 -5
- package/bpk-component-calendar/src/BpkCalendarGridTransition.js +0 -5
- package/bpk-component-calendar/src/BpkCalendarWeek.d.ts +0 -1
- package/bpk-component-calendar/src/BpkCalendarWeek.js +19 -27
- package/bpk-component-calendar/src/custom-proptypes.d.ts +1 -1
- package/bpk-component-card-list/src/BpkCardList.js +0 -3
- package/bpk-component-card-list/src/BpkCardListRowRail/BpkCardListCarousel.js +1 -3
- package/bpk-component-card-list/src/BpkCardListRowRail/BpkCardListRowRailContainer.js +1 -14
- package/bpk-component-card-list/src/BpkCardListRowRail/utils.d.ts +1 -2
- package/bpk-component-card-list/src/BpkCardListRowRail/utils.js +0 -21
- package/bpk-component-card-list/src/common-types.d.ts +4 -7
- package/bpk-component-chatbot-input/src/hooks/useChatbotInput.d.ts +1 -1
- package/bpk-component-chatbot-input/src/hooks/useTextAreaAutoResize.d.ts +1 -1
- package/bpk-component-datepicker/src/BpkDatepicker.d.ts +6 -192
- package/bpk-component-datepicker/src/BpkDatepicker.js +46 -53
- package/bpk-component-dialog/src/BpkDialogInner.d.ts +0 -7
- package/bpk-component-drawer/src/BpkDrawerContent.d.ts +2 -2
- package/bpk-component-drawer/src/BpkDrawerContent.js +13 -1
- package/bpk-component-fieldset/src/BpkFieldset.d.ts +1 -1
- package/bpk-component-floating-notification/src/BpkFloatingNotification.js +4 -1
- package/bpk-component-grid-toggle/src/BpkGridToggle.js +9 -7
- package/bpk-component-image/src/BpkBackgroundImage.d.ts +1 -9
- package/bpk-component-image/src/BpkBackgroundImage.js +18 -18
- package/bpk-component-image/src/BpkImage.d.ts +1 -8
- package/bpk-component-image/src/BpkImage.js +10 -18
- package/bpk-component-image/src/withLazyLoading.d.ts +0 -4
- package/bpk-component-image/src/withLazyLoading.js +2 -6
- package/bpk-component-infinite-scroll/src/withInfiniteScroll.js +6 -8
- package/bpk-component-info-banner/src/AnimateAndFade.d.ts +4 -7
- package/bpk-component-info-banner/src/AnimateAndFade.js +14 -10
- package/bpk-component-info-banner/src/withBannerAlertState.d.ts +0 -10
- package/bpk-component-info-banner/src/withBannerAlertState.js +3 -13
- package/bpk-component-input/index.d.ts +2 -2
- package/bpk-component-input/index.js +2 -2
- package/bpk-component-input/src/BpkInput.d.ts +0 -13
- package/bpk-component-input/src/BpkInput.js +13 -12
- package/bpk-component-input/src/common-types.d.ts +0 -32
- package/bpk-component-input/src/common-types.js +1 -56
- package/bpk-component-input/src/withOpenEvents.d.ts +1 -12
- package/bpk-component-input/src/withOpenEvents.js +2 -14
- package/bpk-component-layout/src/BpkProvider.d.ts +3 -3
- package/bpk-component-layout/src/BpkProvider.js +59 -3
- package/bpk-component-map/src/BpkBasicMapMarker.d.ts +1 -8
- package/bpk-component-map/src/BpkBasicMapMarker.js +0 -6
- package/bpk-component-map/src/BpkIconMarker.js +4 -10
- package/bpk-component-map/src/BpkIconMarkerBackground.js +3 -8
- package/bpk-component-map/src/BpkMap.js +14 -30
- package/bpk-component-map/src/withGoogleMapsScript.js +4 -8
- package/bpk-component-mobile-scroll-container/src/BpkMobileScrollContainer.d.ts +0 -1
- package/bpk-component-mobile-scroll-container/src/BpkMobileScrollContainer.js +1 -5
- package/bpk-component-modal/index.d.ts +1 -2
- package/bpk-component-modal/index.js +1 -3
- package/bpk-component-navigation-bar/src/BpkNavigationBar.d.ts +2 -2
- package/bpk-component-phone-input/src/BpkPhoneInput.js +6 -14
- package/bpk-component-progress/src/BpkProgress.d.ts +0 -8
- package/bpk-component-progress/src/BpkProgress.js +10 -16
- package/bpk-component-scrollable-calendar/src/BpkScrollableCalendar.d.ts +0 -14
- package/bpk-component-section-list/src/BpkSectionListItem.js +4 -10
- package/bpk-component-section-list/src/BpkSectionListSection.js +1 -4
- package/bpk-component-segmented-control/src/BpkSegmentedControl.d.ts +1 -1
- package/bpk-component-select/src/BpkSelect.d.ts +1 -1
- package/bpk-component-slider/src/BpkSlider.js +1 -1
- package/bpk-component-spinner/src/SpinnerLayout.story-helpers.d.ts +1 -7
- package/bpk-component-spinner/src/SpinnerLayout.story-helpers.js +0 -4
- package/bpk-component-split-input/src/BpkInputField.d.ts +2 -6
- package/bpk-component-split-input/src/BpkInputField.js +2 -6
- package/bpk-component-split-input/src/BpkSplitInput.d.ts +0 -6
- package/bpk-component-split-input/src/BpkSplitInput.js +7 -13
- package/bpk-component-star-rating/src/withInteractiveStarRatingState.d.ts +0 -3
- package/bpk-component-star-rating/src/withInteractiveStarRatingState.js +0 -3
- package/bpk-component-ticket/src/BpkTicket.js +6 -14
- package/bpk-mixins/_badges.scss +3 -3
- package/bpk-react-utils/index.d.ts +3 -1
- package/bpk-react-utils/src/BpkDialogWrapper/BpkDialogWrapper.js +1 -0
- package/bpk-react-utils/src/Portal.d.ts +10 -22
- package/bpk-react-utils/src/Portal.js +22 -19
- package/bpk-react-utils/src/TransitionInitialMount.d.ts +4 -2
- package/bpk-react-utils/src/TransitionInitialMount.js +23 -14
- package/bpk-scrim-utils/index.d.ts +0 -7
- package/bpk-scrim-utils/src/withScrim.d.ts +0 -7
- package/bpk-scrim-utils/src/withScrim.js +10 -15
- package/bpk-stylesheets/base.css +1 -1
- package/bpk-stylesheets/primitives.css +2 -0
- package/bpk-stylesheets/theme-backpack-dark.css +3 -2
- package/bpk-stylesheets/theme-backpack-light.css +5 -4
- package/package.json +5 -3
- package/bpk-component-modal/src/legacy-prop-types.js +0 -74
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import PropTypes from 'prop-types';
|
|
20
19
|
export const CLEAR_BUTTON_MODES = {
|
|
21
20
|
never: 'never',
|
|
22
21
|
whileEditing: 'whileEditing',
|
|
@@ -30,58 +29,4 @@ export const INPUT_TYPES = {
|
|
|
30
29
|
tel: 'tel'
|
|
31
30
|
};
|
|
32
31
|
|
|
33
|
-
// Declaring this type here as react docgen gets confused and reads them as native input types
|
|
34
|
-
|
|
35
|
-
// TODO - this function should be removed once all input examples have been migrated to TS
|
|
36
|
-
export const clearablePropType = (props, propName, componentName) => {
|
|
37
|
-
const createError = message => new Error(`Invalid prop \`${propName}\` supplied to \`${componentName}\`. ${message}.`);
|
|
38
|
-
const propBeingChecked = props[propName];
|
|
39
|
-
if (props.clearButtonMode && props.clearButtonMode !== CLEAR_BUTTON_MODES.never) {
|
|
40
|
-
if (!propBeingChecked) {
|
|
41
|
-
return createError(`When \`clearButtonMode\` is not 'never', \`${propName}\` must be supplied`);
|
|
42
|
-
}
|
|
43
|
-
switch (propName) {
|
|
44
|
-
case 'clearButtonLabel':
|
|
45
|
-
return typeof propBeingChecked === 'string' ? null : createError(`\`clearButtonLabel\` must be a string`);
|
|
46
|
-
case 'onClear':
|
|
47
|
-
return typeof propBeingChecked === 'function' ? null : createError(`\`onClear\` must be a function`);
|
|
48
|
-
default:
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return null;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
// TODO - this should be removed once all input examples have been migrated to TS
|
|
56
|
-
export const propTypes = {
|
|
57
|
-
id: PropTypes.string.isRequired,
|
|
58
|
-
name: PropTypes.string.isRequired,
|
|
59
|
-
value: PropTypes.string.isRequired,
|
|
60
|
-
type: PropTypes.oneOf([INPUT_TYPES.text, INPUT_TYPES.email, INPUT_TYPES.number, INPUT_TYPES.password, INPUT_TYPES.tel]),
|
|
61
|
-
className: PropTypes.string,
|
|
62
|
-
valid: PropTypes.bool,
|
|
63
|
-
large: PropTypes.bool,
|
|
64
|
-
docked: PropTypes.bool,
|
|
65
|
-
dockedFirst: PropTypes.bool,
|
|
66
|
-
dockedMiddle: PropTypes.bool,
|
|
67
|
-
dockedLast: PropTypes.bool,
|
|
68
|
-
inputRef: PropTypes.func,
|
|
69
|
-
clearButtonMode: PropTypes.oneOf(Object.keys(CLEAR_BUTTON_MODES)),
|
|
70
|
-
clearButtonLabel: clearablePropType,
|
|
71
|
-
onClear: clearablePropType
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
// TODO - this should be removed once all input examples have been migrated to TS
|
|
75
|
-
export const defaultProps = {
|
|
76
|
-
type: INPUT_TYPES.text,
|
|
77
|
-
valid: null,
|
|
78
|
-
large: false,
|
|
79
|
-
docked: false,
|
|
80
|
-
dockedFirst: false,
|
|
81
|
-
dockedMiddle: false,
|
|
82
|
-
dockedLast: false,
|
|
83
|
-
inputRef: null,
|
|
84
|
-
clearButtonMode: CLEAR_BUTTON_MODES.never,
|
|
85
|
-
clearButtonLabel: null,
|
|
86
|
-
onClear: null
|
|
87
|
-
};
|
|
32
|
+
// Declaring this type here as react docgen gets confused and reads them as native input types
|
|
@@ -40,7 +40,7 @@ declare const withOpenEvents: <P extends object>(WithOpenEventsInputComponent: C
|
|
|
40
40
|
handleTouchEnd: (event: UIEvent) => void;
|
|
41
41
|
handleFocus: () => void;
|
|
42
42
|
handleBlur: () => void;
|
|
43
|
-
render(): ReactElement
|
|
43
|
+
render(): ReactElement<any>;
|
|
44
44
|
context: unknown;
|
|
45
45
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<P & import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement> & Omit<EventHandlers, "inputMode" | "aria-readonly" | "readOnly"> & WithOpenEventsProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
46
46
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
@@ -63,17 +63,6 @@ declare const withOpenEvents: <P extends object>(WithOpenEventsInputComponent: C
|
|
|
63
63
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<P & import("react").ClassAttributes<HTMLInputElement> & import("react").InputHTMLAttributes<HTMLInputElement> & Omit<EventHandlers, "inputMode" | "aria-readonly" | "readOnly"> & WithOpenEventsProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
64
64
|
};
|
|
65
65
|
displayName: string;
|
|
66
|
-
defaultProps: {
|
|
67
|
-
isOpen: boolean;
|
|
68
|
-
hasTouchSupport: boolean;
|
|
69
|
-
onOpen: null;
|
|
70
|
-
onClick: null;
|
|
71
|
-
onFocus: null;
|
|
72
|
-
onBlur: null;
|
|
73
|
-
onTouchEnd: null;
|
|
74
|
-
onKeyDown: null;
|
|
75
|
-
onKeyUp: null;
|
|
76
|
-
};
|
|
77
66
|
contextType?: import("react").Context<any> | undefined;
|
|
78
67
|
};
|
|
79
68
|
export default withOpenEvents;
|
|
@@ -23,6 +23,7 @@ const KEYCODES = {
|
|
|
23
23
|
ENTER: 'Enter',
|
|
24
24
|
SPACEBAR: 'Space'
|
|
25
25
|
};
|
|
26
|
+
const HAS_TOUCH_SUPPORT = !!(typeof window !== 'undefined' && 'ontouchstart' in window);
|
|
26
27
|
const handleKeyEvent = callback => e => {
|
|
27
28
|
if (e.code === KEYCODES.ENTER || e.code === KEYCODES.SPACEBAR) {
|
|
28
29
|
if (callback) {
|
|
@@ -40,19 +41,6 @@ const withEventHandler = (fn, eventHandler) => e => {
|
|
|
40
41
|
};
|
|
41
42
|
const withOpenEvents = WithOpenEventsInputComponent => {
|
|
42
43
|
class WithOpenEvents extends Component {
|
|
43
|
-
static defaultProps = {
|
|
44
|
-
// Custom props
|
|
45
|
-
isOpen: false,
|
|
46
|
-
hasTouchSupport: !!(typeof window !== 'undefined' && 'ontouchstart' in window),
|
|
47
|
-
onOpen: null,
|
|
48
|
-
// Input props
|
|
49
|
-
onClick: null,
|
|
50
|
-
onFocus: null,
|
|
51
|
-
onBlur: null,
|
|
52
|
-
onTouchEnd: null,
|
|
53
|
-
onKeyDown: null,
|
|
54
|
-
onKeyUp: null
|
|
55
|
-
};
|
|
56
44
|
constructor(props) {
|
|
57
45
|
super(props);
|
|
58
46
|
this.focusCanOpen = true;
|
|
@@ -87,7 +75,7 @@ const withOpenEvents = WithOpenEventsInputComponent => {
|
|
|
87
75
|
render() {
|
|
88
76
|
const {
|
|
89
77
|
className,
|
|
90
|
-
hasTouchSupport,
|
|
78
|
+
hasTouchSupport = HAS_TOUCH_SUPPORT,
|
|
91
79
|
isOpen,
|
|
92
80
|
onBlur,
|
|
93
81
|
onClick,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
2
|
export interface BpkProviderProps {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
}
|
|
@@ -14,6 +14,6 @@ export interface BpkProviderProps {
|
|
|
14
14
|
* tree render correctly in RTL without requiring additional wrapping or prop changes.
|
|
15
15
|
*
|
|
16
16
|
* @param {BpkProviderProps} props - The provider props.
|
|
17
|
-
* @returns {
|
|
17
|
+
* @returns {ReactElement} The provider wrapping its children with Chakra and Ark context.
|
|
18
18
|
*/
|
|
19
|
-
export declare const BpkProvider: ({ children }: BpkProviderProps) =>
|
|
19
|
+
export declare const BpkProvider: ({ children }: BpkProviderProps) => ReactElement;
|
|
@@ -16,9 +16,11 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import { useEffect, useState } from 'react';
|
|
19
|
+
import { createContext, useContext, useEffect, useRef, useState } from 'react';
|
|
20
20
|
import { LocaleProvider } from '@ark-ui/react';
|
|
21
21
|
import { ChakraProvider, createSystem, defaultBaseConfig } from '@chakra-ui/react';
|
|
22
|
+
import createCache from '@emotion/cache';
|
|
23
|
+
import { CacheProvider } from '@emotion/react';
|
|
22
24
|
import { createBpkConfig } from "./theme";
|
|
23
25
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
26
|
/**
|
|
@@ -29,6 +31,34 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
29
31
|
* See: https://chakra-ui.com/guides/component-bundle-optimization
|
|
30
32
|
*/
|
|
31
33
|
const bpkSystem = createSystem(defaultBaseConfig, createBpkConfig());
|
|
34
|
+
|
|
35
|
+
// Cypress/Percy workaround: `hydrateRoot()` strips SSR <style> nodes, then
|
|
36
|
+
// Emotion falls back to speedy mode (insertRule) which Percy can't serialise.
|
|
37
|
+
// Force speedy:false + recreate after mount in Cypress. Remove once Emotion /
|
|
38
|
+
// React Router 7 provide a cleaner hydration story. Ported from hotels-website#12025.
|
|
39
|
+
|
|
40
|
+
const isCypressEnv = () => {
|
|
41
|
+
if (typeof window === 'undefined') return false;
|
|
42
|
+
const win = window;
|
|
43
|
+
// `bpkDisableEmotionSpeedy` is an explicit escape hatch for non-Cypress
|
|
44
|
+
// Percy runs; consumers set it in their test bootstrap.
|
|
45
|
+
if (win.Cypress || win.bpkDisableEmotionSpeedy) return true;
|
|
46
|
+
try {
|
|
47
|
+
return Boolean(win.parent?.Cypress);
|
|
48
|
+
} catch {
|
|
49
|
+
return false; // cross-origin parent frame
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// `'css'` is shared with Chakra v3's internal key on purpose — keeps this
|
|
54
|
+
// boundary in front of Chakra's auto-created cache.
|
|
55
|
+
const createBpkEmotionCache = speedy => createCache(speedy === undefined ? {
|
|
56
|
+
key: 'css'
|
|
57
|
+
} : {
|
|
58
|
+
key: 'css',
|
|
59
|
+
speedy
|
|
60
|
+
});
|
|
61
|
+
const BpkEmotionCacheContext = /*#__PURE__*/createContext(null);
|
|
32
62
|
// Fallback locale mapping used when no explicit locale is available on the document.
|
|
33
63
|
// Maps DOM direction to minimal BCP 47 locales understood by Ark's isRTL() utility.
|
|
34
64
|
// 'ar-SA' is the minimal RTL locale — Ark only uses it to derive dir='rtl'.
|
|
@@ -116,17 +146,43 @@ const useArkLocale = () => {
|
|
|
116
146
|
* tree render correctly in RTL without requiring additional wrapping or prop changes.
|
|
117
147
|
*
|
|
118
148
|
* @param {BpkProviderProps} props - The provider props.
|
|
119
|
-
* @returns {
|
|
149
|
+
* @returns {ReactElement} The provider wrapping its children with Chakra and Ark context.
|
|
120
150
|
*/
|
|
121
151
|
export const BpkProvider = ({
|
|
122
152
|
children
|
|
123
153
|
}) => {
|
|
154
|
+
const parentCache = useContext(BpkEmotionCacheContext);
|
|
155
|
+
const isNested = parentCache !== null;
|
|
156
|
+
const [isCypress] = useState(isCypressEnv);
|
|
157
|
+
const [ownCache, setOwnCache] = useState(() => isNested ? parentCache : createBpkEmotionCache(isCypress ? false : undefined));
|
|
158
|
+
const hasRecreated = useRef(false);
|
|
124
159
|
const locale = useArkLocale();
|
|
125
|
-
|
|
160
|
+
|
|
161
|
+
// Recreate the cache once after mount in Cypress to replace SSR <style>
|
|
162
|
+
// nodes the hydrator stripped. `hasRecreated` guards StrictMode double-invoke.
|
|
163
|
+
// Deps stable for provider lifetime → empty array is intentional.
|
|
164
|
+
useEffect(() => {
|
|
165
|
+
if (isNested || !isCypress) return;
|
|
166
|
+
if (hasRecreated.current) return;
|
|
167
|
+
hasRecreated.current = true;
|
|
168
|
+
setOwnCache(createBpkEmotionCache(false));
|
|
169
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
170
|
+
}, []);
|
|
171
|
+
const inner = /*#__PURE__*/_jsx(ChakraProvider, {
|
|
126
172
|
value: bpkSystem,
|
|
127
173
|
children: /*#__PURE__*/_jsx(LocaleProvider, {
|
|
128
174
|
locale: locale,
|
|
129
175
|
children: children
|
|
130
176
|
})
|
|
131
177
|
});
|
|
178
|
+
if (isNested) {
|
|
179
|
+
return inner;
|
|
180
|
+
}
|
|
181
|
+
return /*#__PURE__*/_jsx(BpkEmotionCacheContext.Provider, {
|
|
182
|
+
value: ownCache,
|
|
183
|
+
children: /*#__PURE__*/_jsx(CacheProvider, {
|
|
184
|
+
value: ownCache,
|
|
185
|
+
children: inner
|
|
186
|
+
})
|
|
187
|
+
});
|
|
132
188
|
};
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
1
|
import type { ReactNode } from 'react';
|
|
3
2
|
import { type LatLong } from './common-types';
|
|
4
3
|
type Props = {
|
|
5
4
|
children: ReactNode;
|
|
6
5
|
position: LatLong;
|
|
7
6
|
};
|
|
8
|
-
declare const BpkBasicMapMarker:
|
|
9
|
-
(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
propTypes: {
|
|
11
|
-
children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
12
|
-
position: any;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
7
|
+
declare const BpkBasicMapMarker: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
15
8
|
export default BpkBasicMapMarker;
|
|
@@ -16,13 +16,11 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import PropTypes from 'prop-types';
|
|
20
19
|
import { getDataComponentAttribute } from "../../bpk-react-utils";
|
|
21
20
|
|
|
22
21
|
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
23
22
|
import BpkOverlayView from "./BpkOverlayView";
|
|
24
23
|
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
25
|
-
import { LatLongPropType } from "./common-types";
|
|
26
24
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
27
25
|
const getPixelPositionOffset = (width, height) => ({
|
|
28
26
|
x: -(width / 2),
|
|
@@ -42,8 +40,4 @@ const BpkBasicMapMarker = props => {
|
|
|
42
40
|
children: children
|
|
43
41
|
});
|
|
44
42
|
};
|
|
45
|
-
BpkBasicMapMarker.propTypes = {
|
|
46
|
-
children: PropTypes.node.isRequired,
|
|
47
|
-
position: LatLongPropType.isRequired
|
|
48
|
-
};
|
|
49
43
|
export default BpkBasicMapMarker;
|
|
@@ -24,12 +24,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
24
24
|
const getClassName = cssModules(STYLES);
|
|
25
25
|
const BpkIconMarker = props => {
|
|
26
26
|
const {
|
|
27
|
-
buttonProps,
|
|
28
|
-
className,
|
|
27
|
+
buttonProps = null,
|
|
28
|
+
className = null,
|
|
29
29
|
icon,
|
|
30
|
-
onClick,
|
|
30
|
+
onClick = null,
|
|
31
31
|
position,
|
|
32
|
-
selected,
|
|
32
|
+
selected = false,
|
|
33
33
|
...rest
|
|
34
34
|
} = props;
|
|
35
35
|
const wrapperClassNames = getClassName('bpk-icon-marker__wrapper', selected && 'bpk-icon-marker__wrapper--selected', className);
|
|
@@ -64,10 +64,4 @@ BpkIconMarker.propTypes = {
|
|
|
64
64
|
selected: PropTypes.bool,
|
|
65
65
|
buttonProps: PropTypes.object // eslint-disable-line react/forbid-prop-types
|
|
66
66
|
};
|
|
67
|
-
BpkIconMarker.defaultProps = {
|
|
68
|
-
className: null,
|
|
69
|
-
onClick: null,
|
|
70
|
-
selected: false,
|
|
71
|
-
buttonProps: null
|
|
72
|
-
};
|
|
73
67
|
export default BpkIconMarker;
|
|
@@ -20,9 +20,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
20
20
|
const getClassName = cssModules(STYLES);
|
|
21
21
|
const BpkIconMarkerBackground = props => {
|
|
22
22
|
const {
|
|
23
|
-
disabled,
|
|
24
|
-
interactive,
|
|
25
|
-
selected,
|
|
23
|
+
disabled = false,
|
|
24
|
+
interactive = false,
|
|
25
|
+
selected = false,
|
|
26
26
|
...rest
|
|
27
27
|
} = props;
|
|
28
28
|
const classNames = getClassName('bpk-icon-marker-background', interactive && 'bpk-icon-marker-background--interactive', disabled && 'bpk-icon-marker-background--disabled', selected && 'bpk-icon-marker-background--selected');
|
|
@@ -61,9 +61,4 @@ const BpkIconMarkerBackground = props => {
|
|
|
61
61
|
})
|
|
62
62
|
);
|
|
63
63
|
};
|
|
64
|
-
BpkIconMarkerBackground.defaultProps = {
|
|
65
|
-
disabled: false,
|
|
66
|
-
interactive: false,
|
|
67
|
-
selected: false
|
|
68
|
-
};
|
|
69
64
|
export default BpkIconMarkerBackground;
|
|
@@ -24,20 +24,20 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
24
24
|
const getClassName = cssModules(STYLES);
|
|
25
25
|
const BpkMap = props => {
|
|
26
26
|
const {
|
|
27
|
-
bounds,
|
|
28
|
-
center,
|
|
29
|
-
children,
|
|
30
|
-
className,
|
|
31
|
-
greedyGestureHandling,
|
|
32
|
-
mapId,
|
|
33
|
-
mapOptionStyles,
|
|
34
|
-
mapRef,
|
|
35
|
-
onRegionChange,
|
|
36
|
-
onTilesLoaded,
|
|
37
|
-
onZoom,
|
|
38
|
-
panEnabled,
|
|
39
|
-
showControls,
|
|
40
|
-
zoom
|
|
27
|
+
bounds = null,
|
|
28
|
+
center = undefined,
|
|
29
|
+
children = null,
|
|
30
|
+
className = null,
|
|
31
|
+
greedyGestureHandling = false,
|
|
32
|
+
mapId = null,
|
|
33
|
+
mapOptionStyles = null,
|
|
34
|
+
mapRef = null,
|
|
35
|
+
onRegionChange = null,
|
|
36
|
+
onTilesLoaded = null,
|
|
37
|
+
onZoom = null,
|
|
38
|
+
panEnabled = true,
|
|
39
|
+
showControls = true,
|
|
40
|
+
zoom = 15
|
|
41
41
|
} = props;
|
|
42
42
|
if (!bounds && !center) {
|
|
43
43
|
throw new Error('BpkMap: Provide either `bounds` or `center` props.');
|
|
@@ -138,20 +138,4 @@ BpkMap.propTypes = {
|
|
|
138
138
|
})),
|
|
139
139
|
mapId: PropTypes.string
|
|
140
140
|
};
|
|
141
|
-
BpkMap.defaultProps = {
|
|
142
|
-
bounds: null,
|
|
143
|
-
center: undefined,
|
|
144
|
-
children: null,
|
|
145
|
-
greedyGestureHandling: false,
|
|
146
|
-
mapRef: null,
|
|
147
|
-
onRegionChange: null,
|
|
148
|
-
onZoom: null,
|
|
149
|
-
onTilesLoaded: null,
|
|
150
|
-
panEnabled: true,
|
|
151
|
-
showControls: true,
|
|
152
|
-
zoom: 15,
|
|
153
|
-
className: null,
|
|
154
|
-
mapOptionStyles: null,
|
|
155
|
-
mapId: null
|
|
156
|
-
};
|
|
157
141
|
export default BpkMap;
|
|
@@ -19,12 +19,13 @@ import { useJsApiLoader } from '@react-google-maps/api';
|
|
|
19
19
|
import DefaultLoadingElement from "./DefaultLoadingElement";
|
|
20
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
21
|
export const LibraryShapeType = PropTypes.arrayOf(PropTypes.oneOf(['drawing', 'geometry', 'localContext', 'places', 'visualization']));
|
|
22
|
+
const DEFAULT_LIBRARIES = ['geometry', 'drawing', 'places'];
|
|
22
23
|
function withGoogleMapsScript(Component) {
|
|
23
24
|
const WithGoogleMapsScript = ({
|
|
24
25
|
googleMapsApiKey,
|
|
25
|
-
libraries,
|
|
26
|
-
loadingElement,
|
|
27
|
-
preventGoogleFontsLoading,
|
|
26
|
+
libraries = DEFAULT_LIBRARIES,
|
|
27
|
+
loadingElement = /*#__PURE__*/_jsx(DefaultLoadingElement, {}),
|
|
28
|
+
preventGoogleFontsLoading = false,
|
|
28
29
|
...rest
|
|
29
30
|
}) => {
|
|
30
31
|
const {
|
|
@@ -52,11 +53,6 @@ function withGoogleMapsScript(Component) {
|
|
|
52
53
|
libraries: LibraryShapeType,
|
|
53
54
|
preventGoogleFontsLoading: PropTypes.bool
|
|
54
55
|
};
|
|
55
|
-
WithGoogleMapsScript.defaultProps = {
|
|
56
|
-
loadingElement: /*#__PURE__*/_jsx(DefaultLoadingElement, {}),
|
|
57
|
-
preventGoogleFontsLoading: false,
|
|
58
|
-
libraries: ['geometry', 'drawing', 'places']
|
|
59
|
-
};
|
|
60
56
|
return WithGoogleMapsScript;
|
|
61
57
|
}
|
|
62
58
|
export default withGoogleMapsScript;
|
|
@@ -21,7 +21,6 @@ type State = {
|
|
|
21
21
|
};
|
|
22
22
|
declare class BpkMobileScrollContainer extends Component<Props, State> {
|
|
23
23
|
debouncedResize: DebouncedFunc<() => void>;
|
|
24
|
-
static defaultProps: Partial<Props>;
|
|
25
24
|
constructor(props: Props);
|
|
26
25
|
componentDidMount(): void;
|
|
27
26
|
componentWillUnmount(): void;
|
|
@@ -52,10 +52,6 @@ const computeScrollIndicatorClassName = (scrollerEl, leadingIndicatorClassName,
|
|
|
52
52
|
return classNames;
|
|
53
53
|
};
|
|
54
54
|
class BpkMobileScrollContainer extends Component {
|
|
55
|
-
static defaultProps = {
|
|
56
|
-
innerContainerTagName: 'div',
|
|
57
|
-
showScrollbar: false
|
|
58
|
-
};
|
|
59
55
|
constructor(props) {
|
|
60
56
|
super(props);
|
|
61
57
|
this.state = {
|
|
@@ -111,7 +107,7 @@ class BpkMobileScrollContainer extends Component {
|
|
|
111
107
|
leadingIndicatorClassName,
|
|
112
108
|
onScroll,
|
|
113
109
|
scrollerRef,
|
|
114
|
-
showScrollbar,
|
|
110
|
+
showScrollbar = false,
|
|
115
111
|
style,
|
|
116
112
|
trailingIndicatorClassName,
|
|
117
113
|
...rest
|
|
@@ -3,9 +3,8 @@ import { MODAL_STYLING } from './src/BpkModalInner';
|
|
|
3
3
|
import { BpkModalV2 } from './src/BpkModalV2/BpkModal';
|
|
4
4
|
import BpkModalV3 from './src/BpkModalV3/BpkModalV3';
|
|
5
5
|
import { MODAL_V3_TYPES } from './src/BpkModalV3/common-types';
|
|
6
|
-
import { propTypes, defaultProps } from './src/legacy-prop-types';
|
|
7
6
|
import themeAttributes from './src/themeAttributes';
|
|
8
7
|
import type { Props } from './src/BpkModal';
|
|
9
8
|
export type BpkModalProps = Props;
|
|
10
9
|
export default BpkModal;
|
|
11
|
-
export {
|
|
10
|
+
export { themeAttributes, BpkModalV2, BpkModalV3, MODAL_V3_TYPES, MODAL_STYLING, };
|
|
@@ -21,8 +21,6 @@ import { MODAL_STYLING } from "./src/BpkModalInner";
|
|
|
21
21
|
import { BpkModalV2 } from "./src/BpkModalV2/BpkModal";
|
|
22
22
|
import BpkModalV3 from "./src/BpkModalV3/BpkModalV3";
|
|
23
23
|
import { MODAL_V3_TYPES } from "./src/BpkModalV3/common-types";
|
|
24
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
25
|
-
import { propTypes, defaultProps } from "./src/legacy-prop-types";
|
|
26
24
|
import themeAttributes from "./src/themeAttributes";
|
|
27
25
|
export default BpkModal;
|
|
28
|
-
export {
|
|
26
|
+
export { themeAttributes, BpkModalV2, BpkModalV3, MODAL_V3_TYPES, MODAL_STYLING };
|
|
@@ -14,8 +14,8 @@ export type Props = {
|
|
|
14
14
|
* Note: this prop only applies when `title` is a string; ReactNode titles are not truncated and wrap naturally. */
|
|
15
15
|
wrapTitle?: boolean;
|
|
16
16
|
className?: string;
|
|
17
|
-
leadingButton?: ReactElement | null;
|
|
18
|
-
trailingButton?: ReactElement | null;
|
|
17
|
+
leadingButton?: ReactElement<any> | null;
|
|
18
|
+
trailingButton?: ReactElement<any> | null;
|
|
19
19
|
sticky?: boolean;
|
|
20
20
|
barStyle?: BarStyle;
|
|
21
21
|
[rest: string]: any;
|
|
@@ -24,21 +24,21 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
24
24
|
const getClassName = cssModules(STYLES);
|
|
25
25
|
const BpkPhoneInput = props => {
|
|
26
26
|
const {
|
|
27
|
-
className,
|
|
27
|
+
className = null,
|
|
28
28
|
dialingCode,
|
|
29
|
-
dialingCodeMask,
|
|
29
|
+
dialingCodeMask = false,
|
|
30
30
|
dialingCodeProps,
|
|
31
31
|
dialingCodes,
|
|
32
|
-
disabled,
|
|
32
|
+
disabled = false,
|
|
33
33
|
id,
|
|
34
34
|
label,
|
|
35
|
-
large,
|
|
35
|
+
large = false,
|
|
36
36
|
name,
|
|
37
37
|
onChange,
|
|
38
38
|
onDialingCodeChange,
|
|
39
|
-
valid,
|
|
39
|
+
valid = null,
|
|
40
40
|
value,
|
|
41
|
-
wrapperProps,
|
|
41
|
+
wrapperProps = {},
|
|
42
42
|
...rest
|
|
43
43
|
} = props;
|
|
44
44
|
const commonProps = {
|
|
@@ -164,12 +164,4 @@ BpkPhoneInput.propTypes = {
|
|
|
164
164
|
valid: PropTypes.bool,
|
|
165
165
|
wrapperProps: PropTypes.object // eslint-disable-line react/forbid-prop-types
|
|
166
166
|
};
|
|
167
|
-
BpkPhoneInput.defaultProps = {
|
|
168
|
-
className: null,
|
|
169
|
-
disabled: false,
|
|
170
|
-
dialingCodeMask: false,
|
|
171
|
-
large: false,
|
|
172
|
-
valid: null,
|
|
173
|
-
wrapperProps: {}
|
|
174
|
-
};
|
|
175
167
|
export default BpkPhoneInput;
|
|
@@ -12,14 +12,6 @@ export type Props = Omit<NativeDivProps, 'className'> & {
|
|
|
12
12
|
getValueText?: ((value: number, min: number, max: number) => string) | null;
|
|
13
13
|
};
|
|
14
14
|
declare class BpkProgress extends Component<Props> {
|
|
15
|
-
static defaultProps: {
|
|
16
|
-
className: null;
|
|
17
|
-
stepped: boolean;
|
|
18
|
-
small: boolean;
|
|
19
|
-
onComplete: () => null;
|
|
20
|
-
onCompleteTransitionEnd: () => null;
|
|
21
|
-
getValueText: null;
|
|
22
|
-
};
|
|
23
15
|
componentDidUpdate(previousProps: Props): void;
|
|
24
16
|
handleCompleteTransitionEnd: () => void;
|
|
25
17
|
render(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -37,23 +37,17 @@ const renderSteps = numberOfSteps => {
|
|
|
37
37
|
return steps;
|
|
38
38
|
};
|
|
39
39
|
class BpkProgress extends Component {
|
|
40
|
-
static defaultProps = {
|
|
41
|
-
className: null,
|
|
42
|
-
stepped: false,
|
|
43
|
-
small: false,
|
|
44
|
-
onComplete: () => null,
|
|
45
|
-
onCompleteTransitionEnd: () => null,
|
|
46
|
-
getValueText: null
|
|
47
|
-
};
|
|
48
40
|
componentDidUpdate(previousProps) {
|
|
49
41
|
const {
|
|
50
42
|
max,
|
|
43
|
+
onComplete,
|
|
44
|
+
onCompleteTransitionEnd,
|
|
51
45
|
value
|
|
52
46
|
} = this.props;
|
|
53
|
-
if (value >= max && value !== previousProps.value
|
|
54
|
-
|
|
55
|
-
if (!isTransitionEndSupported() &&
|
|
56
|
-
|
|
47
|
+
if (value >= max && value !== previousProps.value) {
|
|
48
|
+
onComplete?.();
|
|
49
|
+
if (!isTransitionEndSupported() && onCompleteTransitionEnd) {
|
|
50
|
+
onCompleteTransitionEnd();
|
|
57
51
|
}
|
|
58
52
|
}
|
|
59
53
|
}
|
|
@@ -69,14 +63,14 @@ class BpkProgress extends Component {
|
|
|
69
63
|
};
|
|
70
64
|
render() {
|
|
71
65
|
const {
|
|
72
|
-
className,
|
|
73
|
-
getValueText,
|
|
66
|
+
className = null,
|
|
67
|
+
getValueText = null,
|
|
74
68
|
max,
|
|
75
69
|
min,
|
|
76
70
|
onComplete,
|
|
77
71
|
onCompleteTransitionEnd,
|
|
78
|
-
small,
|
|
79
|
-
stepped,
|
|
72
|
+
small = false,
|
|
73
|
+
stepped = false,
|
|
80
74
|
value,
|
|
81
75
|
...rest
|
|
82
76
|
} = this.props;
|
|
@@ -145,20 +145,6 @@ declare const _default: {
|
|
|
145
145
|
focusedDate: Date;
|
|
146
146
|
}>, nextContext: any): void;
|
|
147
147
|
};
|
|
148
|
-
defaultProps: {
|
|
149
|
-
fixedWidth: boolean;
|
|
150
|
-
maxDate: Date;
|
|
151
|
-
minDate: Date;
|
|
152
|
-
onDateSelect: null;
|
|
153
|
-
onMonthChange: null;
|
|
154
|
-
selectionConfiguration: {
|
|
155
|
-
type: "single";
|
|
156
|
-
date: null;
|
|
157
|
-
};
|
|
158
|
-
initiallyFocusedDate: null;
|
|
159
|
-
markToday: boolean;
|
|
160
|
-
markOutsideDays: boolean;
|
|
161
|
-
};
|
|
162
148
|
contextType?: import("react").Context<any> | undefined;
|
|
163
149
|
};
|
|
164
150
|
export default _default;
|
|
@@ -24,11 +24,11 @@ const BpkLargeChevronRightIconWithRtlSupport = withRtlSupport(BpkLargeChevronRig
|
|
|
24
24
|
const getClassName = cssModules(STYLES);
|
|
25
25
|
const BpkSectionListItem = props => {
|
|
26
26
|
const {
|
|
27
|
-
blank,
|
|
27
|
+
blank = false,
|
|
28
28
|
children,
|
|
29
|
-
className,
|
|
30
|
-
href,
|
|
31
|
-
onClick,
|
|
29
|
+
className = null,
|
|
30
|
+
href = null,
|
|
31
|
+
onClick = null,
|
|
32
32
|
...rest
|
|
33
33
|
} = props;
|
|
34
34
|
const classNames = [getClassName('bpk-section-list-item', (href || onClick) && 'bpk-section-list-item--interactive', className)];
|
|
@@ -83,10 +83,4 @@ BpkSectionListItem.propTypes = {
|
|
|
83
83
|
href: PropTypes.string,
|
|
84
84
|
onClick: PropTypes.func
|
|
85
85
|
};
|
|
86
|
-
BpkSectionListItem.defaultProps = {
|
|
87
|
-
blank: false,
|
|
88
|
-
className: null,
|
|
89
|
-
href: null,
|
|
90
|
-
onClick: null
|
|
91
|
-
};
|
|
92
86
|
export default BpkSectionListItem;
|
|
@@ -24,7 +24,7 @@ const getClassName = cssModules(STYLES);
|
|
|
24
24
|
const BpkSectionListSection = props => {
|
|
25
25
|
const {
|
|
26
26
|
children,
|
|
27
|
-
headerText,
|
|
27
|
+
headerText = null,
|
|
28
28
|
...rest
|
|
29
29
|
} = props;
|
|
30
30
|
return /*#__PURE__*/_jsxs("section", {
|
|
@@ -47,7 +47,4 @@ BpkSectionListSection.propTypes = {
|
|
|
47
47
|
children: PropTypes.node.isRequired,
|
|
48
48
|
headerText: PropTypes.string
|
|
49
49
|
};
|
|
50
|
-
BpkSectionListSection.defaultProps = {
|
|
51
|
-
headerText: null
|
|
52
|
-
};
|
|
53
50
|
export default BpkSectionListSection;
|
|
@@ -27,7 +27,7 @@ export type TabPanelProps = {
|
|
|
27
27
|
export declare const useSegmentedControlPanels: (buttonContents: string[] | ReactNode[], selectedIndex: number) => {
|
|
28
28
|
controlProps: {
|
|
29
29
|
id: string;
|
|
30
|
-
buttonContents:
|
|
30
|
+
buttonContents: ReactNode[] | string[];
|
|
31
31
|
selectedIndex: number;
|
|
32
32
|
};
|
|
33
33
|
getPanelProps: (index: number) => TabPanelProps;
|