@skyscanner/backpack-web 42.23.0 → 42.24.0-dev-v27250828403.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/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 +2 -1
- package/bpk-component-banner-alert/src/AnimateAndFade.js +6 -2
- 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/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 +3 -3
- 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-info-banner/src/AnimateAndFade.d.ts +2 -1
- package/bpk-component-info-banner/src/AnimateAndFade.js +6 -2
- package/bpk-component-input/src/withOpenEvents.d.ts +1 -1
- package/bpk-component-layout/src/BpkProvider.d.ts +1 -1
- 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 +3 -8
- package/bpk-component-navigation-bar/src/BpkNavigationBar.d.ts +2 -2
- package/bpk-component-page-indicator/src/BpkPageIndicator.module.css +1 -1
- package/bpk-component-phone-input/src/BpkPhoneInput.js +6 -14
- package/bpk-component-price/index.d.ts +5 -0
- package/bpk-component-price/index.js +3 -1
- package/bpk-component-price/src/BpkPrice.d.ts +21 -0
- package/bpk-component-price/src/BpkPrice.js +3 -15
- package/bpk-component-price/src/common-types.d.ts +10 -0
- package/bpk-component-price/src/common-types.js +3 -1
- package/bpk-component-section-list/src/BpkSectionListItem.js +4 -10
- package/bpk-component-section-list/src/BpkSectionListSection.js +1 -4
- 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-star-rating/index.d.ts +9 -0
- package/bpk-component-star-rating/index.js +3 -1
- package/bpk-component-star-rating/src/BpkInteractiveStar.d.ts +17 -0
- package/bpk-component-star-rating/src/BpkInteractiveStar.js +4 -13
- package/bpk-component-star-rating/src/BpkInteractiveStarRating.d.ts +20 -0
- package/bpk-component-star-rating/src/BpkInteractiveStarRating.js +2 -14
- package/bpk-component-star-rating/src/BpkStar.d.ts +21 -0
- package/bpk-component-star-rating/src/BpkStar.js +9 -22
- package/bpk-component-star-rating/src/BpkStarRating.d.ts +21 -0
- package/bpk-component-star-rating/src/BpkStarRating.js +2 -10
- package/bpk-component-star-rating/src/themeAttributes.d.ts +2 -0
- package/bpk-component-star-rating/src/themeAttributes.js +3 -1
- package/bpk-component-star-rating/src/withInteractiveStarRatingState.d.ts +42 -0
- package/bpk-component-star-rating/src/withInteractiveStarRatingState.js +9 -10
- package/bpk-component-ticket/src/BpkTicket.js +6 -14
- package/bpk-stylesheets/base.css +1 -1
- package/bpk-stylesheets/primitives.css +4 -1
- package/bpk-stylesheets/theme-backpack-dark.css +39 -11
- package/bpk-stylesheets/theme-backpack-light.css +39 -11
- package/package.json +3 -3
|
@@ -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;
|
|
@@ -22,9 +22,9 @@ export const LibraryShapeType = PropTypes.arrayOf(PropTypes.oneOf(['drawing', 'g
|
|
|
22
22
|
function withGoogleMapsScript(Component) {
|
|
23
23
|
const WithGoogleMapsScript = ({
|
|
24
24
|
googleMapsApiKey,
|
|
25
|
-
libraries,
|
|
26
|
-
loadingElement,
|
|
27
|
-
preventGoogleFontsLoading,
|
|
25
|
+
libraries = ['geometry', 'drawing', 'places'],
|
|
26
|
+
loadingElement = /*#__PURE__*/_jsx(DefaultLoadingElement, {}),
|
|
27
|
+
preventGoogleFontsLoading = false,
|
|
28
28
|
...rest
|
|
29
29
|
}) => {
|
|
30
30
|
const {
|
|
@@ -52,11 +52,6 @@ function withGoogleMapsScript(Component) {
|
|
|
52
52
|
libraries: LibraryShapeType,
|
|
53
53
|
preventGoogleFontsLoading: PropTypes.bool
|
|
54
54
|
};
|
|
55
|
-
WithGoogleMapsScript.defaultProps = {
|
|
56
|
-
loadingElement: /*#__PURE__*/_jsx(DefaultLoadingElement, {}),
|
|
57
|
-
preventGoogleFontsLoading: false,
|
|
58
|
-
libraries: ['geometry', 'drawing', 'places']
|
|
59
|
-
};
|
|
60
55
|
return WithGoogleMapsScript;
|
|
61
56
|
}
|
|
62
57
|
export default withGoogleMapsScript;
|
|
@@ -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;
|
|
@@ -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-page-indicator-fullWidth__container{width:100%}.bpk-page-indicator{display:flex;width:100%;justify-content:center;align-items:center}.bpk-page-indicator__showNav{justify-content:space-between}.bpk-page-indicator__container{max-width:5rem;min-height:.5rem;overflow:hidden}.bpk-page-indicator__indicators-container{--direction: -1;transform:translateX(calc(var(--direction) * var(--scroll-index, 0) * 1rem));transition:transform 200ms ease-in-out;white-space:nowrap}html[dir=rtl] .bpk-page-indicator__indicators-container{--direction: 1}.bpk-page-indicator__indicator{display:inline-block;width:.5rem;height:.5rem;padding:0;border:none;border-radius:50%;margin-inline:.25rem}.bpk-page-indicator__indicator:hover{cursor:pointer}.bpk-page-indicator__indicator--default{background-color:#c1c7cf}.bpk-page-indicator__indicator--overImage,.bpk-page-indicator__indicator--overImageSpaced,.bpk-page-indicator__indicator--carousel{background-color:hsla(0,0%,100%,.5)}.bpk-page-indicator__indicator--active-default{background-color:#626971;pointer-events:none}.bpk-page-indicator__indicator--active-overImage,.bpk-page-indicator__indicator--active-overImageSpaced,.bpk-page-indicator__indicator--active-carousel{background-color:#fff;pointer-events:none}.bpk-page-indicator__nav-carousel{--bpk-button-border-radius: 50%;--bpk-button-secondary-on-dark-background-color: rgba(255, 255, 255, 0.5);--bpk-button-secondary-on-dark-hover-background-color: rgba(255, 255, 255, 0.8);--bpk-button-secondary-on-dark-active-background-color: rgba(255, 255, 255, 0.8);--bpk-button-secondary-on-dark-text-color: rgb(22, 22, 22);--bpk-button-secondary-on-dark-hover-text-color: rgb(22, 22, 22);--bpk-button-secondary-on-dark-active-text-color: rgb(22, 22, 22)}.bpk-page-indicator__nav-carousel-button{display:inline-flex;width:2rem;height:2rem;min-height:2rem;padding:0;justify-content:center;align-items:center}
|
|
18
|
+
.bpk-page-indicator-fullWidth__container{width:100%}.bpk-page-indicator{display:flex;width:100%;justify-content:center;align-items:center}.bpk-page-indicator__showNav{justify-content:space-between}.bpk-page-indicator__container{max-width:5rem;min-height:.5rem;overflow:hidden}.bpk-page-indicator__indicators-container{--direction: -1;transform:translateX(calc(var(--direction) * var(--scroll-index, 0) * 1rem));transition:transform 200ms ease-in-out;white-space:nowrap}html[dir=rtl] .bpk-page-indicator__indicators-container{--direction: 1}.bpk-page-indicator__indicator{display:inline-block;width:.5rem;height:.5rem;padding:0;border:none;border-radius:50%;margin-inline:.25rem}.bpk-page-indicator__indicator:hover{cursor:pointer}.bpk-page-indicator__indicator--default{background-color:#c1c7cf}.bpk-page-indicator__indicator--overImage,.bpk-page-indicator__indicator--overImageSpaced,.bpk-page-indicator__indicator--carousel{background-color:hsla(0,0%,100%,.5)}.bpk-page-indicator__indicator--active-default{background-color:#626971;pointer-events:none}.bpk-page-indicator__indicator--active-overImage,.bpk-page-indicator__indicator--active-overImageSpaced,.bpk-page-indicator__indicator--active-carousel{background-color:#fff;pointer-events:none}.bpk-page-indicator__nav-carousel{--bpk-button-border-radius: 50%;--bpk-button-secondary-on-dark-background-color: rgba(255, 255, 255, 0.5);--bpk-button-secondary-on-dark-hover-background-color: rgba(255, 255, 255, 0.8);--bpk-button-secondary-on-dark-active-background-color: rgba(255, 255, 255, 0.8);--bpk-button-secondary-on-dark-text-color: rgb(22, 22, 22);--bpk-button-secondary-on-dark-hover-text-color: rgb(22, 22, 22);--bpk-button-secondary-on-dark-active-text-color: rgb(22, 22, 22)}.bpk-page-indicator__nav-carousel .bpk-page-indicator__nav-carousel-button{display:inline-flex;width:2rem;height:2rem;min-height:2rem;padding:0;justify-content:center;align-items:center}
|
|
@@ -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;
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import BpkPrice from "./src/BpkPrice";
|
|
18
20
|
import { SIZES, ALIGNS } from "./src/common-types";
|
|
19
21
|
export default BpkPrice;
|
|
20
22
|
export { SIZES, ALIGNS };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { SIZES, ALIGNS } from './common-types';
|
|
3
|
+
type NativeDivProps = HTMLAttributes<HTMLDivElement>;
|
|
4
|
+
export type Props = Omit<NativeDivProps, 'className'> & {
|
|
5
|
+
price: string;
|
|
6
|
+
size?: (typeof SIZES)[keyof typeof SIZES];
|
|
7
|
+
align?: (typeof ALIGNS)[keyof typeof ALIGNS];
|
|
8
|
+
className?: string | null;
|
|
9
|
+
leadingText?: string | null;
|
|
10
|
+
/**
|
|
11
|
+
* **Experimental** This prop is experimental and subject to change.
|
|
12
|
+
* Use with caution.
|
|
13
|
+
*/
|
|
14
|
+
leadingClassName?: string | null;
|
|
15
|
+
trailingText?: string | null;
|
|
16
|
+
previousPrice?: string | null;
|
|
17
|
+
icon?: ReactNode;
|
|
18
|
+
dataAttributes?: Record<string, string>;
|
|
19
|
+
};
|
|
20
|
+
declare const BpkPrice: ({ align, className, dataAttributes, icon, leadingClassName, leadingText, previousPrice, price, size, trailingText, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export default BpkPrice;
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
|
|
18
19
|
import BpkText, { TEXT_STYLES } from "../../bpk-component-text";
|
|
19
20
|
import { cssModules } from "../../bpk-react-utils";
|
|
20
21
|
import { SIZES, ALIGNS } from "./common-types";
|
|
@@ -75,9 +76,7 @@ const BpkPrice = ({
|
|
|
75
76
|
});
|
|
76
77
|
};
|
|
77
78
|
return /*#__PURE__*/_jsxs("div", {
|
|
78
|
-
className: getClassName('bpk-price', isAlignRight && 'bpk-price--right', className)
|
|
79
|
-
// $FlowFixMe[cannot-spread-inexact] - inexact rest. See 'decisions/flowfixme.md'.
|
|
80
|
-
,
|
|
79
|
+
className: getClassName('bpk-price', isAlignRight && 'bpk-price--right', className),
|
|
81
80
|
...rest,
|
|
82
81
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
83
82
|
className: getClassName(previousPrice && 'bpk-price__leading', isAlignRight && 'bpk-price__leading--right', leadingClassName),
|
|
@@ -120,15 +119,4 @@ const BpkPrice = ({
|
|
|
120
119
|
}), isAlignRight && getTrailingTextNode()]
|
|
121
120
|
});
|
|
122
121
|
};
|
|
123
|
-
BpkPrice.propTypes = {
|
|
124
|
-
price: PropTypes.string.isRequired,
|
|
125
|
-
size: PropTypes.oneOf(Object.keys(SIZES)),
|
|
126
|
-
align: PropTypes.oneOf(Object.keys(ALIGNS)),
|
|
127
|
-
className: PropTypes.string,
|
|
128
|
-
leadingText: PropTypes.string,
|
|
129
|
-
trailingText: PropTypes.string,
|
|
130
|
-
previousPrice: PropTypes.string,
|
|
131
|
-
leadingClassName: PropTypes.string,
|
|
132
|
-
dataAttributes: PropTypes.objectOf(PropTypes.string)
|
|
133
|
-
};
|
|
134
122
|
export default BpkPrice;
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export const SIZES = {
|
|
18
20
|
xsmall: 'xsmall',
|
|
19
21
|
small: 'small',
|
|
20
22
|
medium: 'medium',
|
|
@@ -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;
|
|
@@ -9,7 +9,7 @@ export type Props = Omit<SelectHTMLAttributes<HTMLSelectElement>, 'className' |
|
|
|
9
9
|
dockedFirst?: boolean;
|
|
10
10
|
dockedLast?: boolean;
|
|
11
11
|
dockedMiddle?: boolean;
|
|
12
|
-
image?: ReactElement | null;
|
|
12
|
+
image?: ReactElement<any> | null;
|
|
13
13
|
large?: boolean;
|
|
14
14
|
valid?: boolean | null;
|
|
15
15
|
wrapperClassName?: string | null;
|
|
@@ -155,7 +155,7 @@ const BubbleInput = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
155
155
|
value,
|
|
156
156
|
...inputProps
|
|
157
157
|
} = props;
|
|
158
|
-
const ref = useRef();
|
|
158
|
+
const ref = useRef(null);
|
|
159
159
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
160
160
|
|
|
161
161
|
// This Hook Provides the native behaviour that the input range type would have around the "change" event.
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
1
|
import type { ReactElement } from 'react';
|
|
3
2
|
type Props = {
|
|
4
3
|
children: Array<ReactElement<any, any>> | ReactElement<any, any>;
|
|
5
4
|
};
|
|
6
|
-
declare const SpinnerLayout:
|
|
7
|
-
(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
propTypes: {
|
|
9
|
-
children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
5
|
+
declare const SpinnerLayout: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
12
6
|
export default SpinnerLayout;
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import PropTypes from 'prop-types';
|
|
20
19
|
import { Children } from 'react';
|
|
21
20
|
import { cssModules } from "../../bpk-react-utils";
|
|
22
21
|
import SPINNER_TYPES from "./spinnerTypes";
|
|
@@ -41,7 +40,4 @@ const SpinnerLayout = props => {
|
|
|
41
40
|
})
|
|
42
41
|
});
|
|
43
42
|
};
|
|
44
|
-
SpinnerLayout.propTypes = {
|
|
45
|
-
children: PropTypes.node.isRequired
|
|
46
|
-
};
|
|
47
43
|
export default SpinnerLayout;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import BpkInteractiveStar, { type Props as BpkInteractiveStarProps } from './src/BpkInteractiveStar';
|
|
2
|
+
import BpkInteractiveStarRating, { type Props as BpkInteractiveStarRatingProps } from './src/BpkInteractiveStarRating';
|
|
3
|
+
import BpkStar, { BpkStarNonRtl, STAR_TYPES, type Props as BpkStarProps } from './src/BpkStar';
|
|
4
|
+
import BpkStarRating, { ROUNDING_TYPES, type Props as BpkStarRatingProps } from './src/BpkStarRating';
|
|
5
|
+
import themeAttributes from './src/themeAttributes';
|
|
6
|
+
import withInteractiveStarRatingState from './src/withInteractiveStarRatingState';
|
|
7
|
+
export { BpkStar, BpkStarNonRtl, STAR_TYPES, ROUNDING_TYPES, BpkInteractiveStar, BpkInteractiveStarRating, withInteractiveStarRatingState, themeAttributes, };
|
|
8
|
+
export type { BpkStarProps, BpkStarRatingProps, BpkInteractiveStarProps, BpkInteractiveStarRatingProps, };
|
|
9
|
+
export default BpkStarRating;
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import BpkInteractiveStar from "./src/BpkInteractiveStar";
|
|
18
20
|
import BpkInteractiveStarRating from "./src/BpkInteractiveStarRating";
|
|
19
21
|
import BpkStar, { BpkStarNonRtl, STAR_TYPES } from "./src/BpkStar";
|
|
20
22
|
import BpkStarRating, { ROUNDING_TYPES } from "./src/BpkStarRating";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, MouseEventHandler } from 'react';
|
|
2
|
+
import { type STAR_TYPES } from './BpkStar';
|
|
3
|
+
type InteractiveStarType = typeof STAR_TYPES.EMPTY | typeof STAR_TYPES.FULL;
|
|
4
|
+
type NativeButtonProps = ButtonHTMLAttributes<HTMLButtonElement>;
|
|
5
|
+
export type Props = Omit<NativeButtonProps, 'className' | 'type' | 'onClick' | 'onMouseEnter' | 'name' | 'value' | 'aria-label' | 'aria-pressed'> & {
|
|
6
|
+
label: string;
|
|
7
|
+
name: string;
|
|
8
|
+
onClick: MouseEventHandler<HTMLButtonElement>;
|
|
9
|
+
onMouseEnter: MouseEventHandler<HTMLButtonElement>;
|
|
10
|
+
type: InteractiveStarType;
|
|
11
|
+
value: number;
|
|
12
|
+
selected?: boolean;
|
|
13
|
+
large?: boolean;
|
|
14
|
+
extraLarge?: boolean;
|
|
15
|
+
};
|
|
16
|
+
declare const BpkInteractiveStar: ({ label, name, onClick, onMouseEnter, selected, type, value, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export default BpkInteractiveStar;
|
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
|
|
18
19
|
import { cssModules } from "../../bpk-react-utils";
|
|
19
|
-
import { BpkStarNonRtl
|
|
20
|
+
import { BpkStarNonRtl } from "./BpkStar";
|
|
20
21
|
import STYLES from "./BpkInteractiveStar.module.css";
|
|
21
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
23
|
const getClassName = cssModules(STYLES);
|
|
@@ -46,20 +47,10 @@ const BpkInteractiveStar = ({
|
|
|
46
47
|
children: /*#__PURE__*/_jsx("div", {
|
|
47
48
|
className: iconClassNames,
|
|
48
49
|
children: /*#__PURE__*/_jsx(BpkStarNonRtl, {
|
|
49
|
-
type: type
|
|
50
|
-
/* $FlowFixMe[cannot-spread-inexact] - inexact rest. See decisions/flowfixme.md */,
|
|
50
|
+
type: type,
|
|
51
51
|
...rest
|
|
52
52
|
})
|
|
53
53
|
})
|
|
54
54
|
});
|
|
55
55
|
};
|
|
56
|
-
BpkInteractiveStar.propTypes = {
|
|
57
|
-
label: PropTypes.string.isRequired,
|
|
58
|
-
name: PropTypes.string.isRequired,
|
|
59
|
-
onClick: PropTypes.func.isRequired,
|
|
60
|
-
onMouseEnter: PropTypes.func.isRequired,
|
|
61
|
-
type: PropTypes.oneOf([STAR_TYPES.EMPTY, STAR_TYPES.FULL]).isRequired,
|
|
62
|
-
value: PropTypes.number.isRequired,
|
|
63
|
-
selected: PropTypes.bool
|
|
64
|
-
};
|
|
65
56
|
export default BpkInteractiveStar;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { HTMLAttributes, MouseEvent } from 'react';
|
|
2
|
+
export declare const getTypeByRating: (starNumber: number, rating: number) => "full" | "empty";
|
|
3
|
+
type StarLabel = (rating: number, maxRating: number) => string;
|
|
4
|
+
type RatingHandler = (rating: number, event: MouseEvent<HTMLButtonElement>) => unknown;
|
|
5
|
+
type NativeDivProps = HTMLAttributes<HTMLDivElement>;
|
|
6
|
+
export type Props = Omit<NativeDivProps, 'className' | 'id' | 'onMouseLeave'> & {
|
|
7
|
+
getStarLabel: StarLabel;
|
|
8
|
+
id: string;
|
|
9
|
+
className?: string | null;
|
|
10
|
+
hoverRating?: number;
|
|
11
|
+
large?: boolean;
|
|
12
|
+
extraLarge?: boolean;
|
|
13
|
+
maxRating?: number;
|
|
14
|
+
onMouseLeave?: () => unknown;
|
|
15
|
+
onRatingHover?: RatingHandler;
|
|
16
|
+
onRatingSelect?: RatingHandler;
|
|
17
|
+
rating?: number;
|
|
18
|
+
};
|
|
19
|
+
declare const BpkInteractiveStarRating: ({ className, extraLarge, getStarLabel, hoverRating, id, large, maxRating, onMouseLeave, onRatingHover, onRatingSelect, rating, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export default BpkInteractiveStarRating;
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
|
|
18
19
|
import { cssModules } from "../../bpk-react-utils";
|
|
19
20
|
import BpkInteractiveStar from "./BpkInteractiveStar";
|
|
20
21
|
import { STAR_TYPES } from "./BpkStar";
|
|
@@ -70,17 +71,4 @@ const BpkInteractiveStarRating = ({
|
|
|
70
71
|
children: stars
|
|
71
72
|
});
|
|
72
73
|
};
|
|
73
|
-
BpkInteractiveStarRating.propTypes = {
|
|
74
|
-
getStarLabel: PropTypes.func.isRequired,
|
|
75
|
-
id: PropTypes.string.isRequired,
|
|
76
|
-
className: PropTypes.string,
|
|
77
|
-
hoverRating: PropTypes.number,
|
|
78
|
-
large: PropTypes.bool,
|
|
79
|
-
extraLarge: PropTypes.bool,
|
|
80
|
-
maxRating: PropTypes.number,
|
|
81
|
-
onMouseLeave: PropTypes.func,
|
|
82
|
-
onRatingHover: PropTypes.func,
|
|
83
|
-
onRatingSelect: PropTypes.func,
|
|
84
|
-
rating: PropTypes.number
|
|
85
|
-
};
|
|
86
74
|
export default BpkInteractiveStarRating;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const STAR_TYPES: {
|
|
2
|
+
readonly EMPTY: "empty";
|
|
3
|
+
readonly HALF: "half";
|
|
4
|
+
readonly FULL: "full";
|
|
5
|
+
};
|
|
6
|
+
export type StarType = (typeof STAR_TYPES)[keyof typeof STAR_TYPES];
|
|
7
|
+
export type Props = {
|
|
8
|
+
type: StarType;
|
|
9
|
+
className?: string | null;
|
|
10
|
+
large?: boolean;
|
|
11
|
+
extraLarge?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare const BpkStarNonRtl: ({ className, extraLarge, large, type, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare const _default: {
|
|
15
|
+
(props: {
|
|
16
|
+
className?: string | null;
|
|
17
|
+
[rest: string]: any;
|
|
18
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
displayName: string;
|
|
20
|
+
};
|
|
21
|
+
export default _default;
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
|
|
18
19
|
import { withRtlSupport } from "../../bpk-component-icon";
|
|
19
20
|
import LargeIcon from "../../bpk-component-icon/lg/star";
|
|
20
21
|
import HalfLargeIcon from "../../bpk-component-icon/lg/star-half";
|
|
@@ -60,37 +61,23 @@ const BpkStar = ({
|
|
|
60
61
|
HalfIcon = withRtlSupport(HalfExtraLargeIcon);
|
|
61
62
|
}
|
|
62
63
|
if (type === STAR_TYPES.HALF) {
|
|
63
|
-
return (
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
_jsx(
|
|
67
|
-
|
|
68
|
-
...rest,
|
|
69
|
-
children: /*#__PURE__*/_jsx(HalfIcon, {})
|
|
70
|
-
})
|
|
71
|
-
);
|
|
64
|
+
return /*#__PURE__*/_jsx("span", {
|
|
65
|
+
className: [containerClassNames, halfIconClassNames].join(' '),
|
|
66
|
+
...rest,
|
|
67
|
+
children: /*#__PURE__*/_jsx(HalfIcon, {})
|
|
68
|
+
});
|
|
72
69
|
}
|
|
73
70
|
return type === STAR_TYPES.FULL ? /*#__PURE__*/_jsx("span", {
|
|
74
71
|
className: iconClassNames,
|
|
75
|
-
children: /*#__PURE__*/_jsx(Icon
|
|
76
|
-
// $FlowFixMe[cannot-spread-inexact] - inexact rest. See decisions/flowfixme.md
|
|
77
|
-
, {
|
|
72
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
78
73
|
...rest
|
|
79
74
|
})
|
|
80
75
|
}) : /*#__PURE__*/_jsx("span", {
|
|
81
76
|
className: iconClassNames,
|
|
82
|
-
children: /*#__PURE__*/_jsx(OutlineIcon
|
|
83
|
-
// $FlowFixMe[cannot-spread-inexact] - inexact rest. See decisions/flowfixme.md
|
|
84
|
-
, {
|
|
77
|
+
children: /*#__PURE__*/_jsx(OutlineIcon, {
|
|
85
78
|
...rest
|
|
86
79
|
})
|
|
87
80
|
});
|
|
88
81
|
};
|
|
89
|
-
BpkStar.propTypes = {
|
|
90
|
-
type: PropTypes.oneOf([STAR_TYPES.EMPTY, STAR_TYPES.HALF, STAR_TYPES.FULL]).isRequired,
|
|
91
|
-
className: PropTypes.string,
|
|
92
|
-
large: PropTypes.bool,
|
|
93
|
-
extraLarge: PropTypes.bool
|
|
94
|
-
};
|
|
95
82
|
export const BpkStarNonRtl = BpkStar;
|
|
96
83
|
export default withRtlSupport(BpkStar);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react';
|
|
2
|
+
export declare const getTypeByRating: (starNumber: number, rating: number) => "full" | "empty" | "half";
|
|
3
|
+
export declare const ROUNDING_TYPES: {
|
|
4
|
+
down: (n: number) => number;
|
|
5
|
+
up: (n: number) => number;
|
|
6
|
+
nearest: (n: number) => number;
|
|
7
|
+
};
|
|
8
|
+
type RatingLabel = string | ((rating: number, maxRating: number) => string);
|
|
9
|
+
type Rounding = typeof ROUNDING_TYPES.down | typeof ROUNDING_TYPES.up | typeof ROUNDING_TYPES.nearest;
|
|
10
|
+
type NativeDivProps = HTMLAttributes<HTMLDivElement>;
|
|
11
|
+
export type Props = Omit<NativeDivProps, 'className' | 'aria-label'> & {
|
|
12
|
+
ratingLabel: RatingLabel;
|
|
13
|
+
className?: string | null;
|
|
14
|
+
large?: boolean;
|
|
15
|
+
extraLarge?: boolean;
|
|
16
|
+
maxRating?: number;
|
|
17
|
+
rating?: number;
|
|
18
|
+
rounding?: Rounding;
|
|
19
|
+
};
|
|
20
|
+
declare const BpkStarRating: ({ className, extraLarge, large, maxRating, rating, ratingLabel, rounding, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export default BpkStarRating;
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
|
|
18
19
|
import { cssModules } from "../../bpk-react-utils";
|
|
19
20
|
import BpkStar, { STAR_TYPES } from "./BpkStar";
|
|
20
21
|
import STYLES from "./BpkStarRating.module.css";
|
|
@@ -68,13 +69,4 @@ const BpkStarRating = ({
|
|
|
68
69
|
children: stars
|
|
69
70
|
});
|
|
70
71
|
};
|
|
71
|
-
BpkStarRating.propTypes = {
|
|
72
|
-
ratingLabel: PropTypes.oneOfType([PropTypes.string, PropTypes.func]).isRequired,
|
|
73
|
-
className: PropTypes.string,
|
|
74
|
-
large: PropTypes.bool,
|
|
75
|
-
extraLarge: PropTypes.bool,
|
|
76
|
-
maxRating: PropTypes.number,
|
|
77
|
-
rating: PropTypes.number,
|
|
78
|
-
rounding: PropTypes.oneOf([ROUNDING_TYPES.down, ROUNDING_TYPES.up, ROUNDING_TYPES.nearest])
|
|
79
|
-
};
|
|
80
72
|
export default BpkStarRating;
|
|
@@ -14,4 +14,6 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export default ['starRatingFilledColor'];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ComponentType, MouseEvent } from 'react';
|
|
2
|
+
type WithInteractiveStarRatingStateProps = {
|
|
3
|
+
onRatingSelect?: (rating: number, event?: MouseEvent<HTMLButtonElement> | null) => unknown;
|
|
4
|
+
};
|
|
5
|
+
type State = {
|
|
6
|
+
rating: number;
|
|
7
|
+
hoverRating: number;
|
|
8
|
+
};
|
|
9
|
+
declare const withInteractiveStarRatingState: <P extends object>(InteractiveStarRating: ComponentType<P>) => {
|
|
10
|
+
new (props: P & WithInteractiveStarRatingStateProps): {
|
|
11
|
+
onRatingSelect: (rating: number, event?: MouseEvent<HTMLButtonElement> | null) => void;
|
|
12
|
+
onMouseLeave: () => void;
|
|
13
|
+
onRatingHover: (hoverRating: number) => void;
|
|
14
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
context: unknown;
|
|
16
|
+
setState<K extends keyof State>(state: State | ((prevState: Readonly<State>, props: Readonly<P & WithInteractiveStarRatingStateProps>) => State | Pick<State, K> | null) | Pick<State, K> | null, callback?: (() => void) | undefined): void;
|
|
17
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
|
18
|
+
readonly props: Readonly<P & WithInteractiveStarRatingStateProps>;
|
|
19
|
+
state: Readonly<State>;
|
|
20
|
+
refs: {
|
|
21
|
+
[key: string]: import("react").ReactInstance;
|
|
22
|
+
};
|
|
23
|
+
componentDidMount?(): void;
|
|
24
|
+
shouldComponentUpdate?(nextProps: Readonly<P & WithInteractiveStarRatingStateProps>, nextState: Readonly<State>, nextContext: any): boolean;
|
|
25
|
+
componentWillUnmount?(): void;
|
|
26
|
+
componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
|
|
27
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<P & WithInteractiveStarRatingStateProps>, prevState: Readonly<State>): any;
|
|
28
|
+
componentDidUpdate?(prevProps: Readonly<P & WithInteractiveStarRatingStateProps>, prevState: Readonly<State>, snapshot?: any): void;
|
|
29
|
+
componentWillMount?(): void;
|
|
30
|
+
UNSAFE_componentWillMount?(): void;
|
|
31
|
+
componentWillReceiveProps?(nextProps: Readonly<P & WithInteractiveStarRatingStateProps>, nextContext: any): void;
|
|
32
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<P & WithInteractiveStarRatingStateProps>, nextContext: any): void;
|
|
33
|
+
componentWillUpdate?(nextProps: Readonly<P & WithInteractiveStarRatingStateProps>, nextState: Readonly<State>, nextContext: any): void;
|
|
34
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<P & WithInteractiveStarRatingStateProps>, nextState: Readonly<State>, nextContext: any): void;
|
|
35
|
+
};
|
|
36
|
+
displayName: string;
|
|
37
|
+
defaultProps: {
|
|
38
|
+
onRatingSelect: () => null;
|
|
39
|
+
};
|
|
40
|
+
contextType?: import("react").Context<any> | undefined;
|
|
41
|
+
};
|
|
42
|
+
export default withInteractiveStarRatingState;
|