@skyscanner/backpack-web 33.7.0 → 33.8.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.
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
3
|
+
export declare const ICON_POSITION: {
|
|
4
|
+
LEADING: string;
|
|
5
|
+
TRAILING: string;
|
|
6
|
+
};
|
|
7
|
+
type LoadingProps = {
|
|
8
|
+
featured?: boolean;
|
|
9
|
+
secondaryOnDark?: boolean;
|
|
10
|
+
primaryOnLight?: boolean;
|
|
11
|
+
primaryOnDark?: boolean;
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
secondary?: boolean;
|
|
16
|
+
destructive?: boolean;
|
|
17
|
+
large?: boolean;
|
|
18
|
+
link?: boolean;
|
|
19
|
+
linkOnDark?: boolean;
|
|
20
|
+
loading: boolean;
|
|
21
|
+
iconOnly: boolean;
|
|
22
|
+
icon?: ReactElement<any>;
|
|
23
|
+
iconPosition: string;
|
|
24
|
+
iconDisabled?: ReactElement<any>;
|
|
25
|
+
iconLoading?: ReactElement<any>;
|
|
26
|
+
};
|
|
27
|
+
declare const BpkLoadingButton: {
|
|
28
|
+
(props: LoadingProps): JSX.Element;
|
|
29
|
+
propTypes: {
|
|
30
|
+
children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
31
|
+
className: PropTypes.Requireable<string>;
|
|
32
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
33
|
+
secondary: PropTypes.Requireable<boolean>;
|
|
34
|
+
destructive: PropTypes.Requireable<boolean>;
|
|
35
|
+
link: PropTypes.Requireable<boolean>;
|
|
36
|
+
linkOnDark: PropTypes.Requireable<boolean>;
|
|
37
|
+
loading: PropTypes.Requireable<boolean>;
|
|
38
|
+
iconOnly: PropTypes.Requireable<boolean>;
|
|
39
|
+
icon: PropTypes.Requireable<PropTypes.ReactElementLike>;
|
|
40
|
+
iconPosition: PropTypes.Requireable<string>;
|
|
41
|
+
iconDisabled: PropTypes.Requireable<PropTypes.ReactElementLike>;
|
|
42
|
+
iconLoading: PropTypes.Requireable<PropTypes.ReactElementLike>;
|
|
43
|
+
};
|
|
44
|
+
defaultProps: {
|
|
45
|
+
className: null;
|
|
46
|
+
disabled: boolean;
|
|
47
|
+
secondary: boolean;
|
|
48
|
+
destructive: boolean;
|
|
49
|
+
large: boolean;
|
|
50
|
+
link: boolean;
|
|
51
|
+
linkOnDark: boolean;
|
|
52
|
+
loading: boolean;
|
|
53
|
+
iconOnly: boolean;
|
|
54
|
+
icon: null;
|
|
55
|
+
iconPosition: string;
|
|
56
|
+
iconDisabled: null;
|
|
57
|
+
iconLoading: null;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export default BpkLoadingButton;
|
|
@@ -14,8 +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
|
-
*/
|
|
18
|
-
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import PropTypes from 'prop-types';
|
|
20
|
+
import { BUTTON_TYPES, BpkButtonV2, SIZE_TYPES } from "../../bpk-component-button";
|
|
19
21
|
import { withButtonAlignment, withLargeButtonAlignment, withRtlSupport } from "../../bpk-component-icon";
|
|
20
22
|
import ArrowIconLg from "../../bpk-component-icon/lg/long-arrow-right";
|
|
21
23
|
import ArrowIconSm from "../../bpk-component-icon/sm/long-arrow-right";
|
|
@@ -58,7 +60,6 @@ const getLoadingIcon = props => {
|
|
|
58
60
|
const BpkLoadingButton = props => {
|
|
59
61
|
const {
|
|
60
62
|
children,
|
|
61
|
-
className,
|
|
62
63
|
disabled,
|
|
63
64
|
icon,
|
|
64
65
|
iconDisabled,
|
|
@@ -66,8 +67,6 @@ const BpkLoadingButton = props => {
|
|
|
66
67
|
iconOnly,
|
|
67
68
|
iconPosition,
|
|
68
69
|
large,
|
|
69
|
-
link,
|
|
70
|
-
linkOnDark,
|
|
71
70
|
loading,
|
|
72
71
|
...rest
|
|
73
72
|
} = props;
|
|
@@ -76,28 +75,49 @@ const BpkLoadingButton = props => {
|
|
|
76
75
|
const buttonIcon = getPropsIcon(props) || getEnabledIcon(large);
|
|
77
76
|
const [child0, child1, child2] = iconPosition === ICON_POSITION.LEADING ? [buttonIcon, spacer, children] : [children, spacer, buttonIcon];
|
|
78
77
|
const loadingIcon = getLoadingIcon(props);
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
78
|
+
const iconClassNames = getClassName('bpk-loading-button__icon');
|
|
79
|
+
let type = BUTTON_TYPES.primary;
|
|
80
|
+
if (props.link) {
|
|
81
|
+
type = BUTTON_TYPES.link;
|
|
82
|
+
}
|
|
83
|
+
if (props.linkOnDark) {
|
|
84
|
+
type = BUTTON_TYPES.linkOnDark;
|
|
85
|
+
}
|
|
86
|
+
if (props.featured) {
|
|
87
|
+
type = BUTTON_TYPES.featured;
|
|
88
|
+
}
|
|
89
|
+
if (props.destructive) {
|
|
90
|
+
type = BUTTON_TYPES.destructive;
|
|
91
|
+
}
|
|
92
|
+
if (props.secondaryOnDark) {
|
|
93
|
+
type = BUTTON_TYPES.secondaryOnDark;
|
|
94
|
+
}
|
|
95
|
+
if (props.secondary) {
|
|
96
|
+
type = BUTTON_TYPES.secondary;
|
|
97
|
+
}
|
|
98
|
+
if (props.primaryOnLight) {
|
|
99
|
+
type = BUTTON_TYPES.primaryOnLight;
|
|
100
|
+
}
|
|
101
|
+
if (props.primaryOnDark) {
|
|
102
|
+
type = BUTTON_TYPES.primaryOnDark;
|
|
103
|
+
}
|
|
104
|
+
return /*#__PURE__*/_jsx(BpkButtonV2, {
|
|
105
|
+
iconOnly: iconOnly,
|
|
106
|
+
disabled: showBtnDisabled,
|
|
107
|
+
size: large ? SIZE_TYPES.large : SIZE_TYPES.small,
|
|
108
|
+
type: type,
|
|
109
|
+
...rest,
|
|
110
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
111
|
+
className: getClassName('bpk-loading-button__container'),
|
|
95
112
|
children: [loading && /*#__PURE__*/_jsx("span", {
|
|
96
113
|
className: iconClassNames,
|
|
97
114
|
children: loadingIcon
|
|
98
|
-
}),
|
|
115
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
116
|
+
className: getClassName(loading ? "bpk-loading-button--hidden" : "bpk-loading-button--visible"),
|
|
117
|
+
children: [child0, child1, child2]
|
|
118
|
+
})]
|
|
99
119
|
})
|
|
100
|
-
);
|
|
120
|
+
});
|
|
101
121
|
};
|
|
102
122
|
BpkLoadingButton.propTypes = {
|
|
103
123
|
children: PropTypes.node.isRequired,
|
|
@@ -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-loading-
|
|
18
|
+
.bpk-loading-button__container{display:inline-flex;justify-content:center;align-items:center}.bpk-loading-button__icon{position:absolute;display:inline-flex}.bpk-loading-button--hidden{visibility:hidden}.bpk-loading-button--visible{visibility:visible}
|
package/bpk-mixins/_forms.scss
CHANGED
|
@@ -190,7 +190,7 @@
|
|
|
190
190
|
padding: 0;
|
|
191
191
|
border: 0;
|
|
192
192
|
background-color: transparent;
|
|
193
|
-
color:
|
|
193
|
+
color: $bpk-text-secondary-day;
|
|
194
194
|
cursor: pointer;
|
|
195
195
|
appearance: none; // hidden by default
|
|
196
196
|
|
|
@@ -200,11 +200,11 @@
|
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
@include utils.bpk-hover {
|
|
203
|
-
color:
|
|
203
|
+
color: $bpk-text-primary-day;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
&:active {
|
|
207
|
-
color:
|
|
207
|
+
color: $bpk-text-primary-day;
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
&--large {
|