@skyscanner/backpack-web 42.24.0-dev-v27268545366.1 → 42.24.0-dev-v27397479883.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/bpk-component-accordion/src/BpkAccordionItem.d.ts +1 -1
- package/bpk-component-accordion/src/withAccordionItemState.d.ts +7 -2
- package/bpk-component-accordion/src/withAccordionItemState.js +6 -4
- 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-banner-alert/src/AnimateAndFade.d.ts +7 -4
- package/bpk-component-banner-alert/src/AnimateAndFade.js +10 -14
- package/bpk-component-banner-alert/src/withBannerAlertState.d.ts +10 -0
- package/bpk-component-banner-alert/src/withBannerAlertState.js +13 -3
- package/bpk-component-barchart/src/BpkBarchart.js +41 -24
- package/bpk-component-barchart/src/BpkBarchartBar.js +16 -7
- package/bpk-component-barchart/src/BpkBarchartBars.js +14 -6
- package/bpk-component-barchart/src/BpkChartAxis.js +12 -5
- package/bpk-component-barchart/src/BpkChartDataTable.js +4 -1
- package/bpk-component-barchart/src/BpkChartGridLines.js +8 -3
- 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 +28 -3
- package/bpk-component-calendar/src/BpkCalendarContainer.js +30 -43
- package/bpk-component-calendar/src/BpkCalendarDate.d.ts +1 -0
- package/bpk-component-calendar/src/BpkCalendarDate.js +31 -32
- package/bpk-component-calendar/src/BpkCalendarGrid.d.ts +14 -13
- package/bpk-component-calendar/src/BpkCalendarGrid.js +37 -28
- package/bpk-component-calendar/src/BpkCalendarGridHeader.d.ts +4 -0
- package/bpk-component-calendar/src/BpkCalendarGridHeader.js +6 -2
- package/bpk-component-calendar/src/BpkCalendarGridTransition.d.ts +5 -0
- package/bpk-component-calendar/src/BpkCalendarGridTransition.js +5 -0
- package/bpk-component-calendar/src/BpkCalendarWeek.d.ts +1 -0
- package/bpk-component-calendar/src/BpkCalendarWeek.js +23 -15
- package/bpk-component-calendar/src/custom-proptypes.d.ts +1 -1
- package/bpk-component-card-list/src/common-types.d.ts +4 -4
- 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 +192 -6
- package/bpk-component-datepicker/src/BpkDatepicker.js +51 -41
- package/bpk-component-dialog/src/BpkDialogInner.d.ts +7 -0
- package/bpk-component-drawer/src/BpkDrawerContent.d.ts +2 -2
- package/bpk-component-drawer/src/BpkDrawerContent.js +1 -13
- package/bpk-component-fieldset/src/BpkFieldset.d.ts +1 -1
- package/bpk-component-floating-notification/src/BpkFloatingNotification.js +1 -4
- package/bpk-component-grid-toggle/src/BpkGridToggle.js +7 -9
- package/bpk-component-image/src/BpkBackgroundImage.d.ts +9 -0
- package/bpk-component-image/src/BpkBackgroundImage.js +17 -14
- package/bpk-component-image/src/BpkImage.d.ts +8 -0
- package/bpk-component-image/src/BpkImage.js +16 -5
- package/bpk-component-image/src/withLazyLoading.d.ts +4 -0
- package/bpk-component-image/src/withLazyLoading.js +6 -2
- package/bpk-component-infinite-scroll/src/withInfiniteScroll.js +8 -6
- package/bpk-component-info-banner/src/AnimateAndFade.d.ts +7 -4
- package/bpk-component-info-banner/src/AnimateAndFade.js +10 -14
- package/bpk-component-info-banner/src/withBannerAlertState.d.ts +10 -0
- package/bpk-component-info-banner/src/withBannerAlertState.js +13 -3
- package/bpk-component-input/src/BpkInput.d.ts +13 -0
- package/bpk-component-input/src/BpkInput.js +12 -13
- package/bpk-component-input/src/withOpenEvents.d.ts +12 -1
- package/bpk-component-input/src/withOpenEvents.js +14 -2
- package/bpk-component-layout/src/BpkProvider.d.ts +3 -3
- package/bpk-component-layout/src/BpkProvider.js +17 -6
- package/bpk-component-map/src/BpkBasicMapMarker.d.ts +8 -1
- package/bpk-component-map/src/BpkBasicMapMarker.js +6 -0
- package/bpk-component-map/src/BpkIconMarker.js +10 -4
- package/bpk-component-map/src/BpkIconMarkerBackground.js +8 -3
- package/bpk-component-map/src/BpkMap.js +30 -14
- package/bpk-component-map/src/withGoogleMapsScript.js +8 -3
- package/bpk-component-mobile-scroll-container/src/BpkMobileScrollContainer.d.ts +1 -0
- package/bpk-component-mobile-scroll-container/src/BpkMobileScrollContainer.js +5 -1
- package/bpk-component-navigation-bar/src/BpkNavigationBar.d.ts +2 -2
- package/bpk-component-phone-input/src/BpkPhoneInput.js +14 -6
- package/bpk-component-progress/src/BpkProgress.d.ts +8 -0
- package/bpk-component-progress/src/BpkProgress.js +16 -10
- package/bpk-component-scrollable-calendar/src/BpkScrollableCalendar.d.ts +14 -0
- package/bpk-component-section-list/src/BpkSectionListItem.js +10 -4
- package/bpk-component-section-list/src/BpkSectionListSection.js +4 -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 +7 -1
- package/bpk-component-spinner/src/SpinnerLayout.story-helpers.js +4 -0
- package/bpk-component-split-input/src/BpkInputField.d.ts +6 -2
- package/bpk-component-split-input/src/BpkInputField.js +6 -2
- package/bpk-component-split-input/src/BpkSplitInput.d.ts +6 -0
- package/bpk-component-split-input/src/BpkSplitInput.js +13 -7
- package/bpk-component-star-rating/src/withInteractiveStarRatingState.d.ts +3 -0
- package/bpk-component-star-rating/src/withInteractiveStarRatingState.js +3 -0
- package/bpk-component-ticket/src/BpkTicket.js +14 -6
- package/bpk-react-utils/src/Portal.d.ts +22 -10
- package/bpk-react-utils/src/Portal.js +19 -22
- package/bpk-scrim-utils/index.d.ts +7 -0
- package/bpk-scrim-utils/src/withScrim.d.ts +7 -0
- package/bpk-scrim-utils/src/withScrim.js +15 -10
- package/bpk-stylesheets/base.css +1 -1
- package/bpk-stylesheets/primitives.css +5 -0
- package/bpk-stylesheets/theme-backpack-light.css +1 -1
- package/package.json +5 -3
|
@@ -7,7 +7,7 @@ export type BpkAccordionItemProps = {
|
|
|
7
7
|
className?: string;
|
|
8
8
|
expanded?: boolean;
|
|
9
9
|
initiallyExpanded?: boolean;
|
|
10
|
-
icon?: ReactElement
|
|
10
|
+
icon?: ReactElement;
|
|
11
11
|
onClick?: () => void;
|
|
12
12
|
tagName?: 'span' | 'p' | 'text' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
13
13
|
textStyle?: (typeof TEXT_STYLES)[keyof typeof TEXT_STYLES];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
2
|
import type { BpkAccordionItemProps } from './BpkAccordionItem';
|
|
3
3
|
type Props = {
|
|
4
|
-
initiallyExpanded
|
|
5
|
-
expanded
|
|
4
|
+
initiallyExpanded: boolean;
|
|
5
|
+
expanded: boolean;
|
|
6
6
|
onClick?: () => void;
|
|
7
7
|
};
|
|
8
8
|
type State = {
|
|
@@ -34,6 +34,11 @@ declare const withAccordionItemState: <P extends BpkAccordionItemProps>(Composed
|
|
|
34
34
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<P & Props>, nextState: Readonly<State>, nextContext: any): void;
|
|
35
35
|
};
|
|
36
36
|
displayName: string;
|
|
37
|
+
defaultProps: {
|
|
38
|
+
initiallyExpanded: boolean;
|
|
39
|
+
expanded: boolean;
|
|
40
|
+
onClick: null;
|
|
41
|
+
};
|
|
37
42
|
contextType?: import("react").Context<any> | undefined;
|
|
38
43
|
};
|
|
39
44
|
export default withAccordionItemState;
|
|
@@ -22,13 +22,15 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
22
22
|
const withAccordionItemState = ComposedComponent => {
|
|
23
23
|
class WithAccordionItemState extends Component {
|
|
24
24
|
static displayName = wrapDisplayName(ComposedComponent, 'withAccordionItemState');
|
|
25
|
+
static defaultProps = {
|
|
26
|
+
initiallyExpanded: false,
|
|
27
|
+
expanded: false,
|
|
28
|
+
onClick: null
|
|
29
|
+
};
|
|
25
30
|
constructor(props) {
|
|
26
31
|
super(props);
|
|
27
|
-
const {
|
|
28
|
-
initiallyExpanded = false
|
|
29
|
-
} = props;
|
|
30
32
|
this.state = {
|
|
31
|
-
expanded: initiallyExpanded
|
|
33
|
+
expanded: props.initiallyExpanded
|
|
32
34
|
};
|
|
33
35
|
}
|
|
34
36
|
onClick = () => {
|
|
@@ -9,7 +9,7 @@ type State = {
|
|
|
9
9
|
declare const withSingleItemAccordionState: <P extends BpkAccordionProps>(ComposedComponent: ComponentType<P>) => {
|
|
10
10
|
new (props: P & Props): {
|
|
11
11
|
openAccordionItem: (key?: string | number | null) => void;
|
|
12
|
-
renderAccordionItem: (accordionItem: ReactElement
|
|
12
|
+
renderAccordionItem: (accordionItem: ReactElement) => ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
13
13
|
render(): import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
context: unknown;
|
|
15
15
|
setState<K extends "expanded">(state: State | ((prevState: Readonly<State>, props: Readonly<P & Props>) => State | Pick<State, K> | null) | Pick<State, K> | null, callback?: (() => void) | undefined): void;
|
|
@@ -6,7 +6,7 @@ export declare const POLITENESS_SETTINGS: {
|
|
|
6
6
|
};
|
|
7
7
|
export type PolitenessSetting = (typeof POLITENESS_SETTINGS)[keyof typeof POLITENESS_SETTINGS];
|
|
8
8
|
export type Props = {
|
|
9
|
-
children: ReactElement
|
|
9
|
+
children: ReactElement | string;
|
|
10
10
|
politenessSetting?: PolitenessSetting;
|
|
11
11
|
visible?: boolean;
|
|
12
12
|
className?: string | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
2
|
type AriaLiveDemoProps = {
|
|
3
|
-
preamble?: ReactElement
|
|
4
|
-
children: ReactElement
|
|
3
|
+
preamble?: ReactElement | null;
|
|
4
|
+
children: ReactElement;
|
|
5
5
|
className?: string | null;
|
|
6
6
|
style?: {};
|
|
7
7
|
visible?: Boolean;
|
|
@@ -37,7 +37,7 @@ export type BpkAutoSuggestProps<T> = {
|
|
|
37
37
|
}) => void;
|
|
38
38
|
onSuggestionsFetchRequested: (value: string) => void;
|
|
39
39
|
onSuggestionsClearRequested: () => void;
|
|
40
|
-
renderSuggestion: (suggestion: T) => ReactElement
|
|
40
|
+
renderSuggestion: (suggestion: T) => ReactElement;
|
|
41
41
|
id: string;
|
|
42
42
|
enterKeyHint?: EnterKeyHintType;
|
|
43
43
|
getA11yResultsMessage: (resultCount: number) => string;
|
|
@@ -45,20 +45,20 @@ export type BpkAutoSuggestProps<T> = {
|
|
|
45
45
|
isDesktop?: boolean;
|
|
46
46
|
onLoad?: (inputValue: string) => void;
|
|
47
47
|
onClick?: () => void;
|
|
48
|
-
renderBesideInput?: () => ReactElement
|
|
48
|
+
renderBesideInput?: () => ReactElement;
|
|
49
49
|
showClear?: boolean;
|
|
50
50
|
theme?: Partial<BpkAutoSuggestTheme>;
|
|
51
51
|
highlightFirstSuggestion?: boolean;
|
|
52
52
|
shouldRenderSuggestions?: (value?: string) => boolean;
|
|
53
53
|
multiSection?: boolean;
|
|
54
54
|
getSectionSuggestions?: (section: T) => T[];
|
|
55
|
-
renderSectionTitle?: (section: T) => ReactElement
|
|
55
|
+
renderSectionTitle?: (section: T) => ReactElement | null;
|
|
56
56
|
alwaysRenderSuggestions?: boolean;
|
|
57
57
|
onInputValueChange?: (input: {
|
|
58
58
|
method: string;
|
|
59
59
|
newValue: string;
|
|
60
60
|
}) => void;
|
|
61
|
-
renderInputComponent?: (inputProps: BpkInputRenderProps) => ReactElement
|
|
61
|
+
renderInputComponent?: (inputProps: BpkInputRenderProps) => ReactElement;
|
|
62
62
|
onSuggestionHighlighted?: (data: {
|
|
63
63
|
suggestion: T | null;
|
|
64
64
|
}) => void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Component } from 'react';
|
|
2
|
-
import type { ReactNode
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
3
|
type Props = {
|
|
4
|
-
animateOnEnter
|
|
5
|
-
animateOnLeave
|
|
4
|
+
animateOnEnter: boolean;
|
|
5
|
+
animateOnLeave: boolean;
|
|
6
6
|
children: ReactNode | string;
|
|
7
7
|
show: boolean;
|
|
8
8
|
className?: string | undefined;
|
|
@@ -16,12 +16,15 @@ type State = {
|
|
|
16
16
|
};
|
|
17
17
|
declare class AnimateAndFade extends Component<Props, State> {
|
|
18
18
|
toggleImmediately: boolean;
|
|
19
|
+
static defaultProps: {
|
|
20
|
+
animateOnEnter: boolean;
|
|
21
|
+
animateOnLeave: boolean;
|
|
22
|
+
};
|
|
19
23
|
constructor(props: Props);
|
|
20
24
|
componentDidMount(): void;
|
|
21
25
|
componentDidUpdate(prevProps: Props): void;
|
|
22
26
|
onAnimateHeightComplete: () => void;
|
|
23
27
|
onFadeComplete: () => void;
|
|
24
|
-
nodeRef: RefObject<HTMLElement>;
|
|
25
28
|
toggle: () => void;
|
|
26
29
|
render(): import("react/jsx-runtime").JSX.Element | null;
|
|
27
30
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import { Component
|
|
19
|
+
import { Component } from 'react';
|
|
20
20
|
import { TransitionGroup, CSSTransition } from 'react-transition-group';
|
|
21
21
|
import { durationSm } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
22
22
|
import BpkAnimateHeight from "../../bpk-animate-height";
|
|
@@ -26,14 +26,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
26
26
|
const getClassName = cssModules(STYLES);
|
|
27
27
|
const ANIMATION_DURATION = parseInt(durationSm, 10);
|
|
28
28
|
class AnimateAndFade extends Component {
|
|
29
|
+
static defaultProps = {
|
|
30
|
+
animateOnEnter: false,
|
|
31
|
+
animateOnLeave: false
|
|
32
|
+
};
|
|
29
33
|
constructor(props) {
|
|
30
34
|
super(props);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
show
|
|
34
|
-
} = props;
|
|
35
|
-
this.toggleImmediately = show && animateOnEnter;
|
|
36
|
-
const initiallyShown = this.toggleImmediately ? false : show;
|
|
35
|
+
this.toggleImmediately = this.props.show && this.props.animateOnEnter;
|
|
36
|
+
const initiallyShown = this.toggleImmediately ? false : this.props.show;
|
|
37
37
|
this.state = {
|
|
38
38
|
isExpanded: initiallyShown,
|
|
39
39
|
visible: initiallyShown,
|
|
@@ -78,7 +78,6 @@ class AnimateAndFade extends Component {
|
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
-
nodeRef = /*#__PURE__*/createRef();
|
|
82
81
|
toggle = () => {
|
|
83
82
|
if (this.state.visible && this.state.isExpanded) {
|
|
84
83
|
this.setState({
|
|
@@ -94,8 +93,8 @@ class AnimateAndFade extends Component {
|
|
|
94
93
|
};
|
|
95
94
|
render() {
|
|
96
95
|
const {
|
|
97
|
-
animateOnEnter
|
|
98
|
-
animateOnLeave
|
|
96
|
+
animateOnEnter,
|
|
97
|
+
animateOnLeave,
|
|
99
98
|
children,
|
|
100
99
|
className
|
|
101
100
|
} = this.props;
|
|
@@ -120,7 +119,6 @@ class AnimateAndFade extends Component {
|
|
|
120
119
|
appear: animateOnEnter,
|
|
121
120
|
onTransitionEnd: this.onFadeComplete,
|
|
122
121
|
children: this.state.visible && /*#__PURE__*/_jsx(CSSTransition, {
|
|
123
|
-
nodeRef: this.nodeRef,
|
|
124
122
|
classNames: {
|
|
125
123
|
exit: getClassName('bpk-animate-and-fade--leave'),
|
|
126
124
|
exitActive: getClassName('bpk-animate-and-fade--leave-active'),
|
|
@@ -133,9 +131,7 @@ class AnimateAndFade extends Component {
|
|
|
133
131
|
enter: ANIMATION_DURATION * 2,
|
|
134
132
|
exit: ANIMATION_DURATION * 2
|
|
135
133
|
},
|
|
136
|
-
children:
|
|
137
|
-
ref: this.nodeRef
|
|
138
|
-
}) : children
|
|
134
|
+
children: children
|
|
139
135
|
})
|
|
140
136
|
})]
|
|
141
137
|
})
|
|
@@ -71,6 +71,16 @@ declare const withBannerAlertState: <P extends BpkBannerAlertProps>(WrappedCompo
|
|
|
71
71
|
}>, nextContext: any): void;
|
|
72
72
|
};
|
|
73
73
|
displayName: string;
|
|
74
|
+
defaultProps: {
|
|
75
|
+
onDismiss: null;
|
|
76
|
+
onExpandToggle: null;
|
|
77
|
+
onHide: null;
|
|
78
|
+
expanded: boolean;
|
|
79
|
+
show: boolean;
|
|
80
|
+
hideAfter: null;
|
|
81
|
+
animateOnLeave: boolean;
|
|
82
|
+
children: null;
|
|
83
|
+
};
|
|
74
84
|
contextType?: import("react").Context<any> | undefined;
|
|
75
85
|
};
|
|
76
86
|
export default withBannerAlertState;
|
|
@@ -22,10 +22,20 @@ import BpkBannerAlertExpandable from "./BpkBannerAlertExpandable";
|
|
|
22
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
23
|
const withBannerAlertState = WrappedComponent => {
|
|
24
24
|
class component extends Component {
|
|
25
|
+
static defaultProps = {
|
|
26
|
+
onDismiss: null,
|
|
27
|
+
onExpandToggle: null,
|
|
28
|
+
onHide: null,
|
|
29
|
+
expanded: false,
|
|
30
|
+
show: true,
|
|
31
|
+
hideAfter: null,
|
|
32
|
+
animateOnLeave: false,
|
|
33
|
+
children: null
|
|
34
|
+
};
|
|
25
35
|
constructor(props) {
|
|
26
36
|
super(props);
|
|
27
37
|
this.state = {
|
|
28
|
-
expanded: props.expanded
|
|
38
|
+
expanded: props.expanded,
|
|
29
39
|
show: true
|
|
30
40
|
};
|
|
31
41
|
this.hideIntervalId = null;
|
|
@@ -74,8 +84,8 @@ const withBannerAlertState = WrappedComponent => {
|
|
|
74
84
|
};
|
|
75
85
|
render() {
|
|
76
86
|
const {
|
|
77
|
-
animateOnLeave
|
|
78
|
-
children
|
|
87
|
+
animateOnLeave,
|
|
88
|
+
children,
|
|
79
89
|
expanded,
|
|
80
90
|
hideAfter,
|
|
81
91
|
onDismiss,
|
|
@@ -37,17 +37,34 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
37
37
|
const getClassName = cssModules(STYLES);
|
|
38
38
|
const spacing = remToPx('.375rem');
|
|
39
39
|
const lineHeight = remToPx(lineHeightSm);
|
|
40
|
-
const DEFAULT_X_AXIS_MARGIN = 2 * (lineHeight + spacing);
|
|
41
|
-
const DEFAULT_Y_AXIS_MARGIN = 4 * lineHeight + spacing;
|
|
42
|
-
const DEFAULT_Y_AXIS_DOMAIN = [null, null];
|
|
43
|
-
const DEFAULT_GET_BAR_LABEL = (point, xScaleDataKey, yScaleDataKey) => `${point[xScaleDataKey]} - ${point[yScaleDataKey]}`;
|
|
44
|
-
const DEFAULT_GET_BAR_SELECTION = () => false;
|
|
45
40
|
const getMaxYValue = (dataPoints, outlierPercentage) => {
|
|
46
41
|
const meanValue = dataPoints.reduce((d, t) => d + t, 0) / dataPoints.length;
|
|
47
42
|
const maxYValue = Math.max(...dataPoints);
|
|
48
43
|
return outlierPercentage ? Math.min(maxYValue, meanValue * (outlierPercentage / 100) + meanValue) : maxYValue;
|
|
49
44
|
};
|
|
50
45
|
class BpkBarchart extends Component {
|
|
46
|
+
static defaultProps = {
|
|
47
|
+
leadingScrollIndicatorClassName: null,
|
|
48
|
+
trailingScrollIndicatorClassName: null,
|
|
49
|
+
outlierPercentage: null,
|
|
50
|
+
showGridlines: false,
|
|
51
|
+
xAxisMargin: 2 * (lineHeight + spacing),
|
|
52
|
+
xAxisTickValue: identity,
|
|
53
|
+
xAxisTickOffset: 0,
|
|
54
|
+
xAxisTickEvery: 1,
|
|
55
|
+
yAxisMargin: 4 * lineHeight + spacing,
|
|
56
|
+
yAxisTickValue: identity,
|
|
57
|
+
yAxisNumTicks: null,
|
|
58
|
+
yAxisDomain: [null, null],
|
|
59
|
+
onBarClick: null,
|
|
60
|
+
onBarHover: null,
|
|
61
|
+
onBarFocus: null,
|
|
62
|
+
// Using type any here as xScaleDataKey or yScaleDataKey are strings and there is an issue that strings are not valid keys
|
|
63
|
+
getBarLabel: (point, xScaleDataKey, yScaleDataKey) => `${point[xScaleDataKey]} - ${point[yScaleDataKey]}`,
|
|
64
|
+
getBarSelection: () => false,
|
|
65
|
+
BarComponent: BpkBarchartBar,
|
|
66
|
+
disableDataTable: false
|
|
67
|
+
};
|
|
51
68
|
constructor(props) {
|
|
52
69
|
super(props);
|
|
53
70
|
this.state = {
|
|
@@ -80,31 +97,31 @@ class BpkBarchart extends Component {
|
|
|
80
97
|
};
|
|
81
98
|
render() {
|
|
82
99
|
const {
|
|
83
|
-
BarComponent
|
|
100
|
+
BarComponent,
|
|
84
101
|
data,
|
|
85
|
-
disableDataTable
|
|
86
|
-
getBarLabel
|
|
87
|
-
getBarSelection
|
|
102
|
+
disableDataTable,
|
|
103
|
+
getBarLabel,
|
|
104
|
+
getBarSelection,
|
|
88
105
|
initialHeight,
|
|
89
106
|
initialWidth,
|
|
90
|
-
leadingScrollIndicatorClassName
|
|
91
|
-
onBarClick
|
|
92
|
-
onBarFocus
|
|
93
|
-
onBarHover
|
|
94
|
-
outlierPercentage
|
|
95
|
-
showGridlines
|
|
96
|
-
trailingScrollIndicatorClassName
|
|
107
|
+
leadingScrollIndicatorClassName,
|
|
108
|
+
onBarClick,
|
|
109
|
+
onBarFocus,
|
|
110
|
+
onBarHover,
|
|
111
|
+
outlierPercentage,
|
|
112
|
+
showGridlines,
|
|
113
|
+
trailingScrollIndicatorClassName,
|
|
97
114
|
xAxisLabel,
|
|
98
|
-
xAxisMargin
|
|
99
|
-
xAxisTickEvery
|
|
100
|
-
xAxisTickOffset
|
|
101
|
-
xAxisTickValue
|
|
115
|
+
xAxisMargin,
|
|
116
|
+
xAxisTickEvery,
|
|
117
|
+
xAxisTickOffset,
|
|
118
|
+
xAxisTickValue,
|
|
102
119
|
xScaleDataKey,
|
|
103
|
-
yAxisDomain
|
|
120
|
+
yAxisDomain,
|
|
104
121
|
yAxisLabel,
|
|
105
|
-
yAxisMargin
|
|
106
|
-
yAxisNumTicks
|
|
107
|
-
yAxisTickValue
|
|
122
|
+
yAxisMargin,
|
|
123
|
+
yAxisNumTicks,
|
|
124
|
+
yAxisTickValue,
|
|
108
125
|
yScaleDataKey,
|
|
109
126
|
...rest
|
|
110
127
|
} = this.props;
|
|
@@ -34,15 +34,15 @@ const handleKeyboardEvent = callback => event => {
|
|
|
34
34
|
const borderRadius = remToPx(borderRadiusXs);
|
|
35
35
|
const BpkBarchartBar = props => {
|
|
36
36
|
const {
|
|
37
|
-
className
|
|
37
|
+
className,
|
|
38
38
|
height,
|
|
39
39
|
label,
|
|
40
|
-
onClick
|
|
41
|
-
onFocus
|
|
42
|
-
onHover
|
|
43
|
-
outlier
|
|
44
|
-
padding
|
|
45
|
-
selected
|
|
40
|
+
onClick,
|
|
41
|
+
onFocus,
|
|
42
|
+
onHover,
|
|
43
|
+
outlier,
|
|
44
|
+
padding,
|
|
45
|
+
selected,
|
|
46
46
|
width,
|
|
47
47
|
x,
|
|
48
48
|
y,
|
|
@@ -98,4 +98,13 @@ BpkBarchartBar.propTypes = {
|
|
|
98
98
|
padding: PropTypes.number,
|
|
99
99
|
selected: PropTypes.bool
|
|
100
100
|
};
|
|
101
|
+
BpkBarchartBar.defaultProps = {
|
|
102
|
+
className: null,
|
|
103
|
+
onClick: null,
|
|
104
|
+
onHover: null,
|
|
105
|
+
onFocus: null,
|
|
106
|
+
outlier: false,
|
|
107
|
+
padding: 0,
|
|
108
|
+
selected: false
|
|
109
|
+
};
|
|
101
110
|
export default BpkBarchartBar;
|
|
@@ -49,15 +49,15 @@ const BpkBarchartBars = props => {
|
|
|
49
49
|
BarComponent,
|
|
50
50
|
data,
|
|
51
51
|
getBarLabel,
|
|
52
|
-
getBarSelection
|
|
52
|
+
getBarSelection,
|
|
53
53
|
height,
|
|
54
|
-
innerPadding
|
|
54
|
+
innerPadding,
|
|
55
55
|
margin,
|
|
56
56
|
maxYValue,
|
|
57
|
-
onBarClick
|
|
58
|
-
onBarFocus
|
|
59
|
-
onBarHover
|
|
60
|
-
outerPadding
|
|
57
|
+
onBarClick,
|
|
58
|
+
onBarFocus,
|
|
59
|
+
onBarHover,
|
|
60
|
+
outerPadding,
|
|
61
61
|
xScale,
|
|
62
62
|
xScaleDataKey,
|
|
63
63
|
yScale,
|
|
@@ -130,4 +130,12 @@ BpkBarchartBars.propTypes = {
|
|
|
130
130
|
onBarHover: PropTypes.func,
|
|
131
131
|
onBarFocus: PropTypes.func
|
|
132
132
|
};
|
|
133
|
+
BpkBarchartBars.defaultProps = {
|
|
134
|
+
outerPadding: 0.35,
|
|
135
|
+
innerPadding: 0.35,
|
|
136
|
+
onBarClick: null,
|
|
137
|
+
onBarHover: null,
|
|
138
|
+
onBarFocus: null,
|
|
139
|
+
getBarSelection: () => false
|
|
140
|
+
};
|
|
133
141
|
export default BpkBarchartBars;
|
|
@@ -72,14 +72,14 @@ const getAxisConfig = ({
|
|
|
72
72
|
const BpkChartAxis = props => {
|
|
73
73
|
const {
|
|
74
74
|
height,
|
|
75
|
-
label
|
|
75
|
+
label,
|
|
76
76
|
margin,
|
|
77
|
-
numTicks
|
|
77
|
+
numTicks,
|
|
78
78
|
orientation,
|
|
79
79
|
scale,
|
|
80
|
-
tickEvery
|
|
81
|
-
tickOffset
|
|
82
|
-
tickValue
|
|
80
|
+
tickEvery,
|
|
81
|
+
tickOffset,
|
|
82
|
+
tickValue,
|
|
83
83
|
width,
|
|
84
84
|
...rest
|
|
85
85
|
} = props;
|
|
@@ -131,4 +131,11 @@ BpkChartAxis.propTypes = {
|
|
|
131
131
|
tickOffset: PropTypes.number,
|
|
132
132
|
tickEvery: PropTypes.number
|
|
133
133
|
};
|
|
134
|
+
BpkChartAxis.defaultProps = {
|
|
135
|
+
tickOffset: 0,
|
|
136
|
+
tickEvery: 1,
|
|
137
|
+
tickValue: identity,
|
|
138
|
+
numTicks: null,
|
|
139
|
+
label: null
|
|
140
|
+
};
|
|
134
141
|
export default BpkChartAxis;
|
|
@@ -22,7 +22,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
22
22
|
const getClassName = cssModules(STYLES);
|
|
23
23
|
const BpkChartDataTable = props => {
|
|
24
24
|
const {
|
|
25
|
-
data
|
|
25
|
+
data,
|
|
26
26
|
xAxisLabel,
|
|
27
27
|
xScaleDataKey,
|
|
28
28
|
yAxisLabel,
|
|
@@ -61,4 +61,7 @@ BpkChartDataTable.propTypes = {
|
|
|
61
61
|
xAxisLabel: PropTypes.string.isRequired,
|
|
62
62
|
yAxisLabel: PropTypes.string.isRequired
|
|
63
63
|
};
|
|
64
|
+
BpkChartDataTable.defaultProps = {
|
|
65
|
+
data: null
|
|
66
|
+
};
|
|
64
67
|
export default BpkChartDataTable;
|
|
@@ -25,11 +25,11 @@ const BpkChartGridLines = props => {
|
|
|
25
25
|
const {
|
|
26
26
|
height,
|
|
27
27
|
margin,
|
|
28
|
-
numTicks
|
|
28
|
+
numTicks,
|
|
29
29
|
orientation,
|
|
30
30
|
scale,
|
|
31
|
-
tickEvery
|
|
32
|
-
tickOffset
|
|
31
|
+
tickEvery,
|
|
32
|
+
tickOffset,
|
|
33
33
|
width,
|
|
34
34
|
...rest
|
|
35
35
|
} = props;
|
|
@@ -75,4 +75,9 @@ BpkChartGridLines.propTypes = {
|
|
|
75
75
|
tickOffset: PropTypes.number,
|
|
76
76
|
tickEvery: PropTypes.number
|
|
77
77
|
};
|
|
78
|
+
BpkChartGridLines.defaultProps = {
|
|
79
|
+
numTicks: null,
|
|
80
|
+
tickOffset: 0,
|
|
81
|
+
tickEvery: 1
|
|
82
|
+
};
|
|
78
83
|
export default BpkChartGridLines;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import BpkCalendarContainer, {
|
|
1
|
+
import BpkCalendarContainer, { withCalendarState } from './src/BpkCalendarContainer';
|
|
2
2
|
import BpkCalendarDate, { ROW_TYPES, SELECTION_TYPES } from './src/BpkCalendarDate';
|
|
3
3
|
import BpkCalendarGrid, { BpkCalendarGridWithTransition } from './src/BpkCalendarGrid';
|
|
4
4
|
import BpkCalendarGridHeader from './src/BpkCalendarGridHeader';
|
|
@@ -12,4 +12,4 @@ import type { Props as BpkCalendarDateProps } from './src/BpkCalendarDate';
|
|
|
12
12
|
import type { Props as BpkCalendarGridProps } from './src/BpkCalendarGrid';
|
|
13
13
|
import type { DaysOfWeek, ReactComponent, WeekDay, WeekDayKey, SelectionConfiguration } from './src/custom-proptypes';
|
|
14
14
|
export default BpkCalendarContainer;
|
|
15
|
-
export { BpkCalendarGrid, BpkCalendarGridHeader, BpkCalendarNav, BpkCalendarDate, DateUtils, CALENDAR_SELECTION_TYPE,
|
|
15
|
+
export { BpkCalendarGrid, BpkCalendarGridHeader, BpkCalendarNav, BpkCalendarDate, DateUtils, CALENDAR_SELECTION_TYPE, DaysOfWeek, ReactComponent, WeekDay, WeekDayKey, SelectionConfiguration, ROW_TYPES, SELECTION_TYPES, composeCalendar, withCalendarState, themeAttributes, BpkCalendarGridWithTransition, CustomPropTypes, BpkCalendarGridPropTypes, BpkCalendarDatePropTypes, BpkCalendarDateProps, BpkCalendarGridProps, };
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import BpkCalendarContainer, {
|
|
19
|
+
import BpkCalendarContainer, { withCalendarState } from "./src/BpkCalendarContainer";
|
|
20
20
|
import BpkCalendarDate, { ROW_TYPES, SELECTION_TYPES } from "./src/BpkCalendarDate";
|
|
21
21
|
import BpkCalendarGrid, { BpkCalendarGridWithTransition } from "./src/BpkCalendarGrid";
|
|
22
22
|
import BpkCalendarGridHeader from "./src/BpkCalendarGridHeader";
|
|
@@ -28,4 +28,4 @@ import CustomPropTypes, { BpkCalendarGridPropTypes, BpkCalendarDatePropTypes //
|
|
|
28
28
|
import * as DateUtils from "./src/date-utils";
|
|
29
29
|
import themeAttributes from "./src/themeAttributes";
|
|
30
30
|
export default BpkCalendarContainer;
|
|
31
|
-
export { BpkCalendarGrid, BpkCalendarGridHeader, BpkCalendarNav, BpkCalendarDate, DateUtils, CALENDAR_SELECTION_TYPE,
|
|
31
|
+
export { BpkCalendarGrid, BpkCalendarGridHeader, BpkCalendarNav, BpkCalendarDate, DateUtils, CALENDAR_SELECTION_TYPE, ROW_TYPES, SELECTION_TYPES, composeCalendar, withCalendarState, themeAttributes, BpkCalendarGridWithTransition, CustomPropTypes, BpkCalendarGridPropTypes, BpkCalendarDatePropTypes };
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
2
|
import type { SelectionConfiguration } from './custom-proptypes';
|
|
3
|
-
export declare const DEFAULT_MARK_TODAY = true;
|
|
4
|
-
export declare const DEFAULT_MAX_DATE: Date;
|
|
5
|
-
export declare const DEFAULT_MIN_DATE: Date;
|
|
6
3
|
export type Props = {
|
|
7
4
|
/**
|
|
8
5
|
* If set to true (default), it sets a fixed width on the calendar container. This is necessary to support transitions and to create the right size for the Datepicker component.
|
|
@@ -79,6 +76,20 @@ declare const withCalendarState: <P extends object>(Calendar: ComponentType<P>)
|
|
|
79
76
|
componentWillUpdate?(nextProps: Readonly<CalendarProps<P>>, nextState: Readonly<State>, nextContext: any): void;
|
|
80
77
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<CalendarProps<P>>, nextState: Readonly<State>, nextContext: any): void;
|
|
81
78
|
};
|
|
79
|
+
defaultProps: {
|
|
80
|
+
fixedWidth: boolean;
|
|
81
|
+
maxDate: Date;
|
|
82
|
+
minDate: Date;
|
|
83
|
+
onDateSelect: null;
|
|
84
|
+
onMonthChange: null;
|
|
85
|
+
selectionConfiguration: {
|
|
86
|
+
type: "single";
|
|
87
|
+
date: null;
|
|
88
|
+
};
|
|
89
|
+
initiallyFocusedDate: null;
|
|
90
|
+
markToday: boolean;
|
|
91
|
+
markOutsideDays: boolean;
|
|
92
|
+
};
|
|
82
93
|
contextType?: import("react").Context<any> | undefined;
|
|
83
94
|
};
|
|
84
95
|
declare const _default: {
|
|
@@ -115,6 +126,20 @@ declare const _default: {
|
|
|
115
126
|
componentWillUpdate?(nextProps: Readonly<CalendarProps<import("./composeCalendar").Props>>, nextState: Readonly<State>, nextContext: any): void;
|
|
116
127
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<CalendarProps<import("./composeCalendar").Props>>, nextState: Readonly<State>, nextContext: any): void;
|
|
117
128
|
};
|
|
129
|
+
defaultProps: {
|
|
130
|
+
fixedWidth: boolean;
|
|
131
|
+
maxDate: Date;
|
|
132
|
+
minDate: Date;
|
|
133
|
+
onDateSelect: null;
|
|
134
|
+
onMonthChange: null;
|
|
135
|
+
selectionConfiguration: {
|
|
136
|
+
type: "single";
|
|
137
|
+
date: null;
|
|
138
|
+
};
|
|
139
|
+
initiallyFocusedDate: null;
|
|
140
|
+
markToday: boolean;
|
|
141
|
+
markOutsideDays: boolean;
|
|
142
|
+
};
|
|
118
143
|
contextType?: import("react").Context<any> | undefined;
|
|
119
144
|
};
|
|
120
145
|
export default _default;
|