@skyscanner/backpack-web 34.16.0 → 35.0.0-premajor.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-button/src/BpkButtonDestructive.module.css +18 -0
- package/bpk-component-button/src/BpkButtonFeatured.module.css +18 -0
- package/bpk-component-button/src/BpkButtonLink.module.css +18 -0
- package/bpk-component-button/src/BpkButtonLinkOnDark.module.css +18 -0
- package/bpk-component-button/src/BpkButtonPrimaryOnDark.module.css +18 -0
- package/bpk-component-button/src/BpkButtonPrimaryOnLight.module.css +18 -0
- package/bpk-component-button/src/BpkButtonSecondary.module.css +18 -0
- package/bpk-component-button/src/BpkButtonSecondaryOnDark.module.css +18 -0
- package/bpk-component-close-button/src/BpkCloseButton.d.ts +10 -0
- package/bpk-component-close-button/src/BpkCloseButton.js +21 -37
- package/bpk-component-datepicker/src/BpkDatepicker.module.css +18 -0
- package/bpk-component-flare/src/__generated__/js/corner-radius.d.ts +5 -0
- package/bpk-component-flare/src/__generated__/js/pointer.d.ts +5 -0
- package/bpk-component-input/src/BpkClearButton.module.css +18 -0
- package/bpk-component-input/src/BpkInput.js +1 -1
- package/bpk-component-input/src/common-types.d.ts +1 -1
- package/bpk-component-loading-button/src/BpkLoadingButton.d.ts +6 -38
- package/bpk-component-loading-button/src/BpkLoadingButton.js +13 -44
- package/bpk-component-navigation-bar/src/BpkNavigationBarButtonLink.module.css +18 -0
- package/bpk-component-nudger/index.d.ts +1 -2
- package/bpk-component-nudger/index.js +1 -2
- package/bpk-component-nudger/src/BpkNudger.d.ts +1 -1
- package/bpk-component-nudger/src/BpkNudger.js +102 -20
- package/bpk-component-nudger/src/BpkNudger.module.css +1 -1
- package/bpk-component-nudger/src/common-types.d.ts +7 -5
- package/bpk-component-slider/src/BpkSlider.d.ts +4 -1
- package/bpk-component-slider/src/BpkSlider.js +51 -3
- package/bpk-component-spinner/src/BpkExtraLargeSpinner.d.ts +4 -14
- package/bpk-component-spinner/src/BpkExtraLargeSpinner.js +5 -16
- package/bpk-component-spinner/src/BpkLargeSpinner.d.ts +5 -17
- package/bpk-component-spinner/src/BpkLargeSpinner.js +6 -19
- package/bpk-component-spinner/src/BpkSpinner.d.ts +5 -17
- package/bpk-component-spinner/src/BpkSpinner.js +6 -19
- package/bpk-component-split-input/src/BpkInputField.d.ts +21 -0
- package/bpk-component-split-input/src/BpkInputField.js +12 -17
- package/bpk-component-split-input/src/BpkSplitInput.d.ts +44 -0
- package/bpk-component-split-input/src/BpkSplitInput.js +22 -33
- package/bpk-react-utils/src/nativeEventHandler.d.ts +1 -1
- package/bpk-react-utils/src/nativeEventHandler.js +7 -5
- package/bpk-stylesheets/test.css +164 -0
- package/package.json +3 -1
- package/bpk-component-nudger/src/BpkConfigurableNudger.d.ts +0 -26
- package/bpk-component-nudger/src/BpkConfigurableNudger.js +0 -96
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Backpack - Skyscanner's Design System
|
|
3
|
-
*
|
|
4
|
-
* Copyright 2016 Skyscanner Ltd
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
import { useRef } from 'react';
|
|
20
|
-
import { BpkButtonV2, BUTTON_TYPES } from "../../bpk-component-button";
|
|
21
|
-
import { withButtonAlignment } from "../../bpk-component-icon";
|
|
22
|
-
import MinusIcon from "../../bpk-component-icon/sm/minus";
|
|
23
|
-
import PlusIcon from "../../bpk-component-icon/sm/plus";
|
|
24
|
-
import { cssModules, setNativeValue } from "../../bpk-react-utils";
|
|
25
|
-
import STYLES from "./BpkNudger.module.css";
|
|
26
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
|
-
const getClassName = cssModules(STYLES);
|
|
28
|
-
const AlignedMinusIcon = withButtonAlignment(MinusIcon);
|
|
29
|
-
const AlignedPlusIcon = withButtonAlignment(PlusIcon);
|
|
30
|
-
const BpkConfigurableNudger = ({
|
|
31
|
-
buttonType = 'secondary',
|
|
32
|
-
className = null,
|
|
33
|
-
compareValues,
|
|
34
|
-
decreaseButtonLabel,
|
|
35
|
-
decrementValue,
|
|
36
|
-
formatValue,
|
|
37
|
-
id,
|
|
38
|
-
increaseButtonLabel,
|
|
39
|
-
incrementValue,
|
|
40
|
-
inputClassName = null,
|
|
41
|
-
max,
|
|
42
|
-
min,
|
|
43
|
-
name,
|
|
44
|
-
onChange,
|
|
45
|
-
value,
|
|
46
|
-
...rest
|
|
47
|
-
}) => {
|
|
48
|
-
const classNames = getClassName('bpk-nudger', className);
|
|
49
|
-
const maxButtonDisabled = compareValues(value, max) >= 0;
|
|
50
|
-
const minButtonDisabled = compareValues(value, min) <= 0;
|
|
51
|
-
const inputStyles = getClassName('bpk-nudger__input', inputClassName && inputClassName, buttonType === 'secondaryOnDark' && 'bpk-nudger__input--secondary-on-dark');
|
|
52
|
-
const inputRef = useRef(null);
|
|
53
|
-
return /*#__PURE__*/_jsxs("div", {
|
|
54
|
-
className: classNames,
|
|
55
|
-
children: [/*#__PURE__*/_jsx(BpkButtonV2, {
|
|
56
|
-
type: BUTTON_TYPES[buttonType],
|
|
57
|
-
iconOnly: true,
|
|
58
|
-
onClick: () => {
|
|
59
|
-
const newValue = decrementValue(value);
|
|
60
|
-
onChange(newValue);
|
|
61
|
-
// We want to maintain native input events across our form components. Along with react updating
|
|
62
|
-
// the value attribute we can set it via native handlers and emit a "change" event.
|
|
63
|
-
inputRef.current && setNativeValue(inputRef.current, `${newValue}`);
|
|
64
|
-
},
|
|
65
|
-
disabled: minButtonDisabled,
|
|
66
|
-
title: decreaseButtonLabel,
|
|
67
|
-
"aria-controls": id,
|
|
68
|
-
children: /*#__PURE__*/_jsx(AlignedMinusIcon, {})
|
|
69
|
-
}), /*#__PURE__*/_jsx("input", {
|
|
70
|
-
type: "text",
|
|
71
|
-
"aria-live": "polite",
|
|
72
|
-
defaultValue: formatValue(value),
|
|
73
|
-
id: id,
|
|
74
|
-
ref: inputRef,
|
|
75
|
-
name: name || id,
|
|
76
|
-
onChange: event => onChange(parseInt(event?.target.value, 10)),
|
|
77
|
-
className: inputStyles,
|
|
78
|
-
...rest
|
|
79
|
-
}), /*#__PURE__*/_jsx(BpkButtonV2, {
|
|
80
|
-
type: BUTTON_TYPES[buttonType],
|
|
81
|
-
iconOnly: true,
|
|
82
|
-
onClick: () => {
|
|
83
|
-
const newValue = incrementValue(value);
|
|
84
|
-
onChange(newValue);
|
|
85
|
-
// We want to maintain native input events across our form components. Along with react updating
|
|
86
|
-
// the value attribute we can set it via native handlers and emit a "change" event.
|
|
87
|
-
inputRef.current && setNativeValue(inputRef.current, `${newValue}`);
|
|
88
|
-
},
|
|
89
|
-
disabled: maxButtonDisabled,
|
|
90
|
-
title: increaseButtonLabel,
|
|
91
|
-
"aria-controls": id,
|
|
92
|
-
children: /*#__PURE__*/_jsx(AlignedPlusIcon, {})
|
|
93
|
-
})]
|
|
94
|
-
});
|
|
95
|
-
};
|
|
96
|
-
export default BpkConfigurableNudger;
|