@skyscanner/backpack-web 25.5.0 → 25.7.0
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-boilerplate/src/BpkBoilerplate.js +5 -12
- package/bpk-component-calendar/src/BpkCalendarGrid.module.css +1 -1
- package/bpk-component-dialog/src/common-types.d.ts +1 -19
- package/bpk-component-icon/lg/ai.js +38 -0
- package/bpk-component-icon/sm/ai.js +39 -0
- package/bpk-component-nudger/index.d.ts +23 -0
- package/bpk-component-nudger/src/BpkConfigurableNudger.d.ts +29 -0
- package/bpk-component-nudger/src/BpkConfigurableNudger.js +17 -28
- package/bpk-component-nudger/src/BpkNudger.d.ts +22 -0
- package/bpk-component-nudger/src/BpkNudger.js +35 -38
- package/bpk-component-nudger/src/common-types.d.ts +29 -0
- package/bpk-component-nudger/src/common-types.js +1 -34
- package/bpk-component-nudger/src/themeAttributes.js +1 -0
- package/bpk-component-nudger-row/index.d.ts +21 -0
- package/bpk-component-nudger-row/index.js +27 -0
- package/bpk-component-nudger-row/src/BpkNudgerRow.d.ts +33 -0
- package/bpk-component-nudger-row/src/BpkNudgerRow.js +79 -0
- package/bpk-component-nudger-row/src/BpkNudgerRow.module.css +18 -0
- package/package.json +3 -3
|
@@ -40,18 +40,11 @@ const BpkBoilerplate = _ref => {
|
|
|
40
40
|
} = _ref,
|
|
41
41
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
42
42
|
const classNames = getClassName('bpk-boilerplate', className);
|
|
43
|
-
return (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}, rest), {}, {
|
|
49
|
-
children: "I am an example component."
|
|
50
|
-
}))
|
|
51
|
-
);
|
|
52
|
-
};
|
|
53
|
-
BpkBoilerplate.defaultProps = {
|
|
54
|
-
className: null
|
|
43
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({
|
|
44
|
+
className: classNames
|
|
45
|
+
}, rest), {}, {
|
|
46
|
+
children: "I am an example component."
|
|
47
|
+
}));
|
|
55
48
|
};
|
|
56
49
|
var _default = BpkBoilerplate;
|
|
57
50
|
exports.default = _default;
|
|
@@ -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
|
-
@keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}@keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-calendar-grid{width:100%;border-collapse:separate;border-spacing:0}.bpk-calendar-grid--animating{z-index:1;transition:transform 0.2s ease-in-out}.bpk-calendar-grid__caption{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0)}.bpk-calendar-grid__date{width:100%;text-align:center}.bpk-calendar-grid__date--start{background-image:linear-gradient(to right, #fff 50%, #e0e3e5 50%)}.bpk-calendar-grid__date--middle{background-color:#e0e3e5}.bpk-calendar-grid__date--end{background-image:linear-gradient(to left, #fff 50%, #e0e3e5 50%)}.bpk-calendar-grid__week{display:flex;padding-top:1.5rem}
|
|
18
|
+
@keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}@keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-calendar-grid{width:100%;border-collapse:separate;border-spacing:0}.bpk-calendar-grid--animating{z-index:1;transition:transform 0.2s ease-in-out}.bpk-calendar-grid__caption{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0)}.bpk-calendar-grid__date{width:100%;text-align:center}.bpk-calendar-grid__date--start{background-image:linear-gradient(to right, #fff 50%, #e0e3e5 50%)}html[dir='rtl'] .bpk-calendar-grid__date--start{background-image:linear-gradient(to left, #fff 50%, #e0e3e5 50%)}.bpk-calendar-grid__date--middle{background-color:#e0e3e5}.bpk-calendar-grid__date--end{background-image:linear-gradient(to left, #fff 50%, #e0e3e5 50%)}html[dir='rtl'] .bpk-calendar-grid__date--end{background-image:linear-gradient(to right, #fff 50%, #e0e3e5 50%)}.bpk-calendar-grid__week{display:flex;padding-top:1.5rem}
|
|
@@ -1,21 +1,3 @@
|
|
|
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
1
|
import type { ReactNode } from 'react';
|
|
20
2
|
export declare const HEADER_ICON_TYPES: {
|
|
21
3
|
readonly primary: "primary";
|
|
@@ -33,7 +15,7 @@ export type DialogInnerProps = {
|
|
|
33
15
|
flare?: boolean;
|
|
34
16
|
flareClassName?: string;
|
|
35
17
|
};
|
|
36
|
-
export type Props = DialogInnerProps & {
|
|
18
|
+
export type Props = Omit<DialogInnerProps, 'dialogRef'> & {
|
|
37
19
|
dialogRef?: (ref: HTMLElement | null | undefined) => void;
|
|
38
20
|
isOpen: boolean;
|
|
39
21
|
renderTarget?: () => HTMLElement | null;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
const _excluded = ["styles"];
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
12
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
15
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
16
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
17
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
18
|
+
var _default = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
styles = {}
|
|
21
|
+
} = _ref,
|
|
22
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
23
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", _objectSpread(_objectSpread({
|
|
24
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
25
|
+
width: "24",
|
|
26
|
+
height: "24",
|
|
27
|
+
style: {
|
|
28
|
+
width: "1.5rem",
|
|
29
|
+
height: "1.5rem"
|
|
30
|
+
}
|
|
31
|
+
}, props), {}, {
|
|
32
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
33
|
+
d: "M4.9 1.061c.025-.096.162-.096.187 0 .215.824.735 2.775.897 2.938.163.162 2.114.682 2.938.897.096.024.096.162 0 .187-.824.214-2.775.734-2.938.897-.162.162-.682 2.113-.897 2.937-.025.096-.162.096-.187 0-.214-.824-.734-2.775-.897-2.937-.162-.163-2.113-.683-2.938-.897-.095-.025-.095-.163 0-.187.825-.215 2.776-.735 2.938-.897.163-.163.683-2.114.897-2.938zm6.668 1.267c.116-.437.748-.437.863 0 .638 2.42 1.797 6.668 2.185 7.056.388.388 4.635 1.547 7.056 2.185.437.115.437.747 0 .862-2.42.638-6.668 1.797-7.056 2.185-.388.388-1.547 4.635-2.185 7.056-.115.437-.747.437-.862 0-.638-2.42-1.797-6.668-2.185-7.056-.388-.388-4.635-1.547-7.056-2.185-.437-.115-.437-.747 0-.862 2.42-.638 6.668-1.797 7.056-2.185.388-.388 1.547-4.635 2.184-7.056zm-6.516 14.19c-.015-.06-.101-.06-.117 0-.134.516-.459 1.735-.56 1.836-.102.102-1.321.427-1.836.561-.06.015-.06.102 0 .117.515.134 1.734.459 1.836.56.101.102.426 1.321.56 1.837.016.06.102.06.117 0 .134-.516.46-1.735.56-1.836.102-.102 1.322-.427 1.837-.561.06-.015.06-.102 0-.117-.515-.134-1.735-.459-1.836-.56-.102-.102-.427-1.321-.56-1.837zM18.935 2.425c.016-.06.102-.06.117 0 .134.515.46 1.734.56 1.836.102.101 1.322.426 1.837.56.06.016.06.102 0 .117-.515.134-1.735.46-1.836.56-.102.102-.427 1.322-.56 1.837-.016.06-.102.06-.118 0-.134-.515-.459-1.735-.56-1.836-.102-.102-1.321-.427-1.836-.56-.06-.016-.06-.102 0-.118.515-.134 1.734-.459 1.836-.56.101-.102.426-1.321.56-1.836zm.152 12.657c-.025-.096-.162-.096-.187 0-.214.824-.734 2.775-.897 2.938-.162.162-2.113.682-2.938.896-.095.025-.095.163 0 .188.825.214 2.776.734 2.938.896.163.163.683 2.114.897 2.938.025.096.162.096.187 0 .215-.824.735-2.775.897-2.938.163-.162 2.113-.682 2.938-.896.096-.025.096-.163 0-.188-.825-.214-2.775-.734-2.938-.896-.163-.163-.682-2.114-.897-2.938z",
|
|
34
|
+
clipRule: "evenodd"
|
|
35
|
+
})
|
|
36
|
+
}));
|
|
37
|
+
};
|
|
38
|
+
exports.default = _default;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
const _excluded = ["styles"];
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
12
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
15
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
16
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
17
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
18
|
+
var _default = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
styles = {}
|
|
21
|
+
} = _ref,
|
|
22
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
23
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", _objectSpread(_objectSpread({
|
|
24
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
25
|
+
viewBox: "0 0 24 24",
|
|
26
|
+
width: "16",
|
|
27
|
+
height: "16",
|
|
28
|
+
style: {
|
|
29
|
+
width: "1rem",
|
|
30
|
+
height: "1rem"
|
|
31
|
+
}
|
|
32
|
+
}, props), {}, {
|
|
33
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
34
|
+
d: "M4.9 1.061c.025-.096.162-.096.187 0 .215.824.735 2.775.897 2.938.163.162 2.114.682 2.938.897.096.024.096.162 0 .187-.824.214-2.775.734-2.938.897-.162.162-.682 2.113-.897 2.937-.025.096-.162.096-.187 0-.214-.824-.734-2.775-.897-2.937-.162-.163-2.113-.683-2.938-.897-.095-.025-.095-.163 0-.187.825-.215 2.776-.735 2.938-.897.163-.163.683-2.114.897-2.938zm6.669 1.267c.115-.438.747-.438.862 0 .638 2.42 1.797 6.668 2.185 7.056.388.388 4.635 1.547 7.056 2.184.438.116.438.748 0 .863-2.42.638-6.668 1.797-7.056 2.185-.388.388-1.547 4.635-2.184 7.056-.116.437-.748.437-.863 0-.638-2.42-1.797-6.668-2.185-7.056-.388-.388-4.635-1.547-7.056-2.185-.437-.115-.437-.747 0-.862 2.42-.638 6.668-1.797 7.056-2.185.388-.388 1.547-4.635 2.185-7.056zm-6.517 14.19c-.015-.06-.101-.06-.117 0-.134.515-.459 1.735-.56 1.836-.102.102-1.321.427-1.836.56-.06.016-.06.102 0 .118.515.134 1.734.459 1.836.56.101.102.426 1.321.56 1.836.016.06.102.06.117 0 .134-.515.46-1.734.56-1.836.102-.101 1.322-.426 1.837-.56.06-.016.06-.102 0-.117-.515-.134-1.735-.46-1.836-.56-.102-.102-.427-1.322-.56-1.837zM18.935 2.425c.016-.06.102-.06.117 0 .134.515.46 1.734.56 1.836.102.101 1.322.426 1.837.56.06.016.06.102 0 .117-.515.134-1.735.46-1.836.56-.102.102-.427 1.322-.56 1.837-.016.06-.102.06-.118 0-.134-.515-.459-1.735-.56-1.836-.102-.102-1.321-.427-1.836-.56-.06-.016-.06-.102 0-.118.515-.134 1.734-.459 1.836-.56.101-.102.426-1.321.56-1.836zm.152 12.657c-.024-.096-.162-.096-.187 0-.214.824-.734 2.775-.897 2.937-.162.163-2.113.683-2.937.897-.096.025-.096.163 0 .188.824.214 2.775.734 2.937.896.163.163.683 2.114.897 2.938.025.096.163.096.187 0 .215-.824.735-2.775.897-2.938.163-.162 2.114-.682 2.938-.896.096-.025.096-.163 0-.188-.824-.214-2.775-.734-2.938-.897-.162-.162-.682-2.113-.897-2.937z",
|
|
35
|
+
clipRule: "evenodd"
|
|
36
|
+
})
|
|
37
|
+
}));
|
|
38
|
+
};
|
|
39
|
+
exports.default = _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
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 BpkNudger from './src/BpkNudger';
|
|
20
|
+
import BpkConfigurableNudger from './src/BpkConfigurableNudger';
|
|
21
|
+
import themeAttributes from './src/themeAttributes';
|
|
22
|
+
export default BpkNudger;
|
|
23
|
+
export { themeAttributes, BpkConfigurableNudger };
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
/// <reference types="react" />
|
|
20
|
+
import { type CommonProps } from './common-types';
|
|
21
|
+
type Props = CommonProps & {
|
|
22
|
+
inputClassName?: string | null;
|
|
23
|
+
formatValue: (arg0: any) => string;
|
|
24
|
+
incrementValue: (arg0: any) => string | number;
|
|
25
|
+
decrementValue: (arg0: any) => string | number;
|
|
26
|
+
compareValues: (arg0: any, arg1: any) => number;
|
|
27
|
+
};
|
|
28
|
+
declare const BpkConfigurableNudger: ({ buttonType, className, compareValues, decreaseButtonLabel, decrementValue, formatValue, id, increaseButtonLabel, incrementValue, inputClassName, max, min, onChange, value, ...rest }: Props) => JSX.Element;
|
|
29
|
+
export default BpkConfigurableNudger;
|
|
@@ -4,14 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var
|
|
8
|
-
var _BpkButtonSecondary = _interopRequireDefault(require("../../bpk-component-button/BpkButtonSecondary"));
|
|
9
|
-
var _BpkButtonSecondaryOnDark = _interopRequireDefault(require("../../bpk-component-button/BpkButtonSecondaryOnDark"));
|
|
7
|
+
var _bpkComponentButton = require("../../bpk-component-button");
|
|
10
8
|
var _bpkComponentIcon = require("../../bpk-component-icon");
|
|
11
9
|
var _minus = _interopRequireDefault(require("../../bpk-component-icon/sm/minus"));
|
|
12
10
|
var _plus = _interopRequireDefault(require("../../bpk-component-icon/sm/plus"));
|
|
13
11
|
var _bpkReactUtils = require("../../bpk-react-utils");
|
|
14
|
-
var _commonTypes = require("./common-types");
|
|
15
12
|
var _BpkNudgerModule = _interopRequireDefault(require("./BpkNudger.module.css"));
|
|
16
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
14
|
const _excluded = ["buttonType", "className", "compareValues", "decreaseButtonLabel", "decrementValue", "formatValue", "id", "increaseButtonLabel", "incrementValue", "inputClassName", "max", "min", "onChange", "value"];
|
|
@@ -33,6 +30,9 @@ const _excluded = ["buttonType", "className", "compareValues", "decreaseButtonLa
|
|
|
33
30
|
* See the License for the specific language governing permissions and
|
|
34
31
|
* limitations under the License.
|
|
35
32
|
*/
|
|
33
|
+
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
34
|
+
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
35
|
+
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
36
36
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
37
37
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
38
38
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -44,10 +44,10 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
44
44
|
const getClassName = (0, _bpkReactUtils.cssModules)(_BpkNudgerModule.default);
|
|
45
45
|
const AlignedMinusIcon = (0, _bpkComponentIcon.withButtonAlignment)(_minus.default);
|
|
46
46
|
const AlignedPlusIcon = (0, _bpkComponentIcon.withButtonAlignment)(_plus.default);
|
|
47
|
-
const BpkConfigurableNudger =
|
|
48
|
-
|
|
49
|
-
buttonType,
|
|
50
|
-
className,
|
|
47
|
+
const BpkConfigurableNudger = _ref => {
|
|
48
|
+
let {
|
|
49
|
+
buttonType = 'secondary',
|
|
50
|
+
className = null,
|
|
51
51
|
compareValues,
|
|
52
52
|
decreaseButtonLabel,
|
|
53
53
|
decrementValue,
|
|
@@ -55,23 +55,23 @@ const BpkConfigurableNudger = props => {
|
|
|
55
55
|
id,
|
|
56
56
|
increaseButtonLabel,
|
|
57
57
|
incrementValue,
|
|
58
|
-
inputClassName,
|
|
58
|
+
inputClassName = null,
|
|
59
59
|
max,
|
|
60
60
|
min,
|
|
61
61
|
onChange,
|
|
62
62
|
value
|
|
63
|
-
} =
|
|
64
|
-
rest = _objectWithoutProperties(
|
|
63
|
+
} = _ref,
|
|
64
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
65
65
|
const classNames = getClassName('bpk-nudger', className);
|
|
66
66
|
const maxButtonDisabled = compareValues(value, max) >= 0;
|
|
67
67
|
const minButtonDisabled = compareValues(value, min) <= 0;
|
|
68
68
|
const minusIconClassNames = getClassName('bpk-nudger__icon', minButtonDisabled && 'bpk-nudger__icon--disabled');
|
|
69
69
|
const plusIconClassNames = getClassName('bpk-nudger__icon', maxButtonDisabled && 'bpk-nudger__icon--disabled');
|
|
70
70
|
const inputStyles = getClassName('bpk-nudger__input', inputClassName && inputClassName, buttonType === 'secondaryOnDark' && 'bpk-nudger__input--secondary-on-dark');
|
|
71
|
-
const ButtonComponent = buttonType === 'secondary' ? _BpkButtonSecondary.default : _BpkButtonSecondaryOnDark.default;
|
|
72
71
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
73
72
|
className: classNames,
|
|
74
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
73
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_bpkComponentButton.BpkButtonV2, {
|
|
74
|
+
type: _bpkComponentButton.BUTTON_TYPES[buttonType],
|
|
75
75
|
iconOnly: true,
|
|
76
76
|
onClick: () => onChange(decrementValue(value)),
|
|
77
77
|
disabled: minButtonDisabled,
|
|
@@ -87,8 +87,10 @@ const BpkConfigurableNudger = props => {
|
|
|
87
87
|
readOnly: true,
|
|
88
88
|
value: formatValue(value),
|
|
89
89
|
id: id,
|
|
90
|
-
className: inputStyles
|
|
91
|
-
|
|
90
|
+
className: inputStyles,
|
|
91
|
+
tabIndex: -1
|
|
92
|
+
}, rest)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_bpkComponentButton.BpkButtonV2, {
|
|
93
|
+
type: _bpkComponentButton.BUTTON_TYPES[buttonType],
|
|
92
94
|
iconOnly: true,
|
|
93
95
|
onClick: () => onChange(incrementValue(value)),
|
|
94
96
|
disabled: maxButtonDisabled,
|
|
@@ -101,18 +103,5 @@ const BpkConfigurableNudger = props => {
|
|
|
101
103
|
})]
|
|
102
104
|
});
|
|
103
105
|
};
|
|
104
|
-
BpkConfigurableNudger.propTypes = _objectSpread(_objectSpread({}, _commonTypes.COMMON_PROP_TYPES), {}, {
|
|
105
|
-
compareValues: _propTypes.default.func.isRequired,
|
|
106
|
-
decrementValue: _propTypes.default.func.isRequired,
|
|
107
|
-
formatValue: _propTypes.default.PropTypes.func.isRequired,
|
|
108
|
-
incrementValue: _propTypes.default.func.isRequired,
|
|
109
|
-
max: _propTypes.default.any.isRequired,
|
|
110
|
-
min: _propTypes.default.any.isRequired,
|
|
111
|
-
value: _propTypes.default.any.isRequired,
|
|
112
|
-
inputClassName: _propTypes.default.string
|
|
113
|
-
});
|
|
114
|
-
BpkConfigurableNudger.defaultProps = _objectSpread(_objectSpread({}, _commonTypes.COMMON_DEFAULT_PROPS), {}, {
|
|
115
|
-
inputClassName: null
|
|
116
|
-
});
|
|
117
106
|
var _default = BpkConfigurableNudger;
|
|
118
107
|
exports.default = _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
/// <reference types="react" />
|
|
20
|
+
import { type CommonProps } from './common-types';
|
|
21
|
+
declare const BpkNudger: ({ className, buttonType, ...rest }: CommonProps) => JSX.Element;
|
|
22
|
+
export default BpkNudger;
|
|
@@ -4,59 +4,56 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
7
|
var _bpkReactUtils = require("../../bpk-react-utils");
|
|
9
8
|
var _BpkConfigurableNudger = _interopRequireDefault(require("./BpkConfigurableNudger"));
|
|
10
|
-
var _commonTypes = require("./common-types");
|
|
11
9
|
var _BpkNudgerModule = _interopRequireDefault(require("./BpkNudger.module.css"));
|
|
12
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
const _excluded = ["buttonType", "className"];
|
|
12
|
+
/*
|
|
13
|
+
* Backpack - Skyscanner's Design System
|
|
14
|
+
*
|
|
15
|
+
* Copyright 2016 Skyscanner Ltd
|
|
16
|
+
*
|
|
17
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
18
|
+
* you may not use this file except in compliance with the License.
|
|
19
|
+
* You may obtain a copy of the License at
|
|
20
|
+
*
|
|
21
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
22
|
+
*
|
|
23
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
24
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
25
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
26
|
+
* See the License for the specific language governing permissions and
|
|
27
|
+
* limitations under the License.
|
|
28
|
+
*/
|
|
13
29
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
30
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15
31
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
32
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
33
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
18
34
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
*
|
|
22
|
-
* Copyright 2016 Skyscanner Ltd
|
|
23
|
-
*
|
|
24
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
25
|
-
* you may not use this file except in compliance with the License.
|
|
26
|
-
* You may obtain a copy of the License at
|
|
27
|
-
*
|
|
28
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
29
|
-
*
|
|
30
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
31
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
32
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
33
|
-
* See the License for the specific language governing permissions and
|
|
34
|
-
* limitations under the License.
|
|
35
|
-
*/
|
|
35
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
36
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
36
37
|
const getClassName = (0, _bpkReactUtils.cssModules)(_BpkNudgerModule.default);
|
|
37
38
|
const compareValues = (a, b) => a - b;
|
|
38
39
|
const incrementValue = currentValue => currentValue + 1;
|
|
39
40
|
const decrementValue = currentValue => currentValue - 1;
|
|
40
41
|
const formatValue = currentValue => currentValue.toString();
|
|
41
|
-
const BpkNudger =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
42
|
+
const BpkNudger = _ref => {
|
|
43
|
+
let {
|
|
44
|
+
buttonType = 'secondary',
|
|
45
|
+
className = null
|
|
46
|
+
} = _ref,
|
|
47
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
48
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_BpkConfigurableNudger.default, _objectSpread({
|
|
49
|
+
inputClassName: getClassName('bpk-nudger__input--numeric'),
|
|
50
|
+
compareValues: compareValues,
|
|
51
|
+
incrementValue: incrementValue,
|
|
52
|
+
decrementValue: decrementValue,
|
|
53
|
+
formatValue: formatValue,
|
|
54
|
+
className: className,
|
|
55
|
+
buttonType: buttonType
|
|
56
|
+
}, rest));
|
|
54
57
|
};
|
|
55
|
-
BpkNudger.propTypes = _objectSpread(_objectSpread({}, _commonTypes.COMMON_PROP_TYPES), {}, {
|
|
56
|
-
max: _propTypes.default.number.isRequired,
|
|
57
|
-
min: _propTypes.default.number.isRequired,
|
|
58
|
-
value: _propTypes.default.number.isRequired
|
|
59
|
-
});
|
|
60
|
-
BpkNudger.defaultProps = _commonTypes.COMMON_DEFAULT_PROPS;
|
|
61
58
|
var _default = BpkNudger;
|
|
62
59
|
exports.default = _default;
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
export type CommonProps = {
|
|
20
|
+
id: string;
|
|
21
|
+
min: string | number;
|
|
22
|
+
max: string | number;
|
|
23
|
+
value: string | number;
|
|
24
|
+
onChange: (arg0: any) => (void | null);
|
|
25
|
+
className?: string | null;
|
|
26
|
+
increaseButtonLabel: string;
|
|
27
|
+
decreaseButtonLabel: string;
|
|
28
|
+
buttonType?: string;
|
|
29
|
+
};
|
|
@@ -2,37 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.COMMON_PROP_TYPES = exports.COMMON_DEFAULT_PROPS = void 0;
|
|
7
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
/*
|
|
10
|
-
* Backpack - Skyscanner's Design System
|
|
11
|
-
*
|
|
12
|
-
* Copyright 2016 Skyscanner Ltd
|
|
13
|
-
*
|
|
14
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
15
|
-
* you may not use this file except in compliance with the License.
|
|
16
|
-
* You may obtain a copy of the License at
|
|
17
|
-
*
|
|
18
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
19
|
-
*
|
|
20
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
21
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
22
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
23
|
-
* See the License for the specific language governing permissions and
|
|
24
|
-
* limitations under the License.
|
|
25
|
-
*/const COMMON_PROP_TYPES = {
|
|
26
|
-
id: _propTypes.default.string.isRequired,
|
|
27
|
-
decreaseButtonLabel: _propTypes.default.string.isRequired,
|
|
28
|
-
increaseButtonLabel: _propTypes.default.string.isRequired,
|
|
29
|
-
onChange: _propTypes.default.func.isRequired,
|
|
30
|
-
className: _propTypes.default.string,
|
|
31
|
-
buttonType: _propTypes.default.oneOf(['secondary', 'secondaryOnDark'])
|
|
32
|
-
};
|
|
33
|
-
exports.COMMON_PROP_TYPES = COMMON_PROP_TYPES;
|
|
34
|
-
const COMMON_DEFAULT_PROPS = {
|
|
35
|
-
className: null,
|
|
36
|
-
buttonType: 'secondary'
|
|
37
|
-
};
|
|
38
|
-
exports.COMMON_DEFAULT_PROPS = COMMON_DEFAULT_PROPS;
|
|
5
|
+
});
|
|
@@ -22,5 +22,6 @@ var _themeAttributes = require("../../bpk-component-button/themeAttributes");
|
|
|
22
22
|
* See the License for the specific language governing permissions and
|
|
23
23
|
* limitations under the License.
|
|
24
24
|
*/
|
|
25
|
+
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
25
26
|
var _default = _themeAttributes.secondaryThemeAttributes;
|
|
26
27
|
exports.default = _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
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 BpkNudgerRow, { type Props as BpkNudgerRowProps } from './src/BpkNudgerRow';
|
|
20
|
+
export type { BpkNudgerRowProps };
|
|
21
|
+
export default BpkNudgerRow;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _BpkNudgerRow = _interopRequireDefault(require("./src/BpkNudgerRow"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
/*
|
|
10
|
+
* Backpack - Skyscanner's Design System
|
|
11
|
+
*
|
|
12
|
+
* Copyright 2016 Skyscanner Ltd
|
|
13
|
+
*
|
|
14
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
15
|
+
* you may not use this file except in compliance with the License.
|
|
16
|
+
* You may obtain a copy of the License at
|
|
17
|
+
*
|
|
18
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
19
|
+
*
|
|
20
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
21
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
22
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
23
|
+
* See the License for the specific language governing permissions and
|
|
24
|
+
* limitations under the License.
|
|
25
|
+
*/
|
|
26
|
+
var _default = _BpkNudgerRow.default;
|
|
27
|
+
exports.default = _default;
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
/// <reference types="react" />
|
|
20
|
+
export type Props = {
|
|
21
|
+
title: string;
|
|
22
|
+
nudgerId: string;
|
|
23
|
+
value: number;
|
|
24
|
+
decreaseButtonLabel: string;
|
|
25
|
+
increaseButtonLabel: string;
|
|
26
|
+
min: number;
|
|
27
|
+
max: number;
|
|
28
|
+
onChange: (arg0: any) => (null | void);
|
|
29
|
+
subtitle?: string;
|
|
30
|
+
className?: string | null;
|
|
31
|
+
};
|
|
32
|
+
declare const BpkNudgerRow: ({ title, nudgerId, subtitle, decreaseButtonLabel, increaseButtonLabel, min, max, onChange, value, className }: Props) => JSX.Element;
|
|
33
|
+
export default BpkNudgerRow;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _bpkReactUtils = require("../../bpk-react-utils");
|
|
8
|
+
var _bpkComponentText = _interopRequireWildcard(require("../../bpk-component-text"));
|
|
9
|
+
var _bpkComponentNudger = _interopRequireDefault(require("../../bpk-component-nudger"));
|
|
10
|
+
var _bpkComponentLabel = _interopRequireDefault(require("../../bpk-component-label"));
|
|
11
|
+
var _BpkNudgerRowModule = _interopRequireDefault(require("./BpkNudgerRow.module.css"));
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
+
/*
|
|
17
|
+
* Backpack - Skyscanner's Design System
|
|
18
|
+
*
|
|
19
|
+
* Copyright 2016 Skyscanner Ltd
|
|
20
|
+
*
|
|
21
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
22
|
+
* you may not use this file except in compliance with the License.
|
|
23
|
+
* You may obtain a copy of the License at
|
|
24
|
+
*
|
|
25
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
26
|
+
*
|
|
27
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
28
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
29
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
30
|
+
* See the License for the specific language governing permissions and
|
|
31
|
+
* limitations under the License.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
35
|
+
|
|
36
|
+
const getClassName = (0, _bpkReactUtils.cssModules)(_BpkNudgerRowModule.default);
|
|
37
|
+
const BpkNudgerRow = ({
|
|
38
|
+
className = null,
|
|
39
|
+
decreaseButtonLabel,
|
|
40
|
+
increaseButtonLabel,
|
|
41
|
+
max,
|
|
42
|
+
min,
|
|
43
|
+
nudgerId,
|
|
44
|
+
onChange,
|
|
45
|
+
subtitle,
|
|
46
|
+
title,
|
|
47
|
+
value
|
|
48
|
+
}) => {
|
|
49
|
+
const classNames = getClassName('bpk-nudger-row', className);
|
|
50
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
51
|
+
className: classNames,
|
|
52
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_bpkComponentLabel.default, {
|
|
53
|
+
htmlFor: nudgerId,
|
|
54
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
55
|
+
// For a11y on IOS, role='text' forces label to be read in full. More info: https://axesslab.com/text-splitting/
|
|
56
|
+
// eslint-disable-next-line jsx-a11y/aria-role
|
|
57
|
+
role: "text",
|
|
58
|
+
className: getClassName('bpk-nudger-row__title-subtitle'),
|
|
59
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_bpkComponentText.default, {
|
|
60
|
+
textStyle: _bpkComponentText.TEXT_STYLES.heading5,
|
|
61
|
+
children: title
|
|
62
|
+
}), subtitle && /*#__PURE__*/(0, _jsxRuntime.jsx)(_bpkComponentText.default, {
|
|
63
|
+
className: getClassName('bpk-nudger-row__subtitle'),
|
|
64
|
+
children: subtitle
|
|
65
|
+
})]
|
|
66
|
+
})
|
|
67
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_bpkComponentNudger.default, {
|
|
68
|
+
id: nudgerId,
|
|
69
|
+
decreaseButtonLabel: decreaseButtonLabel,
|
|
70
|
+
increaseButtonLabel: increaseButtonLabel,
|
|
71
|
+
min: min,
|
|
72
|
+
max: max,
|
|
73
|
+
onChange: onChange,
|
|
74
|
+
value: value
|
|
75
|
+
})]
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
var _default = BpkNudgerRow;
|
|
79
|
+
exports.default = _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
@keyframes bpk-keyframe-spin{100%{transform:rotate(1turn)}}.bpk-nudger-row{display:flex;justify-content:space-between;align-items:center}.bpk-nudger-row__title-subtitle{display:flex;flex-direction:column;justify-content:space-between}.bpk-nudger-row__subtitle{color:#545860}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyscanner/backpack-web",
|
|
3
|
-
"version": "25.
|
|
3
|
+
"version": "25.7.0",
|
|
4
4
|
"description": "Backpack Design System web library",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"@popperjs/core": "^2.11.5",
|
|
26
26
|
"@react-google-maps/api": "^2.12.0",
|
|
27
27
|
"@skyscanner/bpk-foundations-web": "^16.1.0",
|
|
28
|
-
"@skyscanner/bpk-svgs": "^16.
|
|
28
|
+
"@skyscanner/bpk-svgs": "^16.4.0",
|
|
29
29
|
"a11y-focus-scope": "^1.1.3",
|
|
30
30
|
"a11y-focus-store": "^1.0.0",
|
|
31
|
-
"bpk-mixins": "^41.1.
|
|
31
|
+
"bpk-mixins": "^41.1.1",
|
|
32
32
|
"d3-path": "^2.0.0",
|
|
33
33
|
"d3-scale": "^4.0.2",
|
|
34
34
|
"date-fns": "^2.21.1",
|