@skyscanner/backpack-web 34.2.0 → 34.4.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-autosuggest/src/BpkAutosuggest.module.css +1 -1
- package/bpk-component-autosuggest/src/BpkAutosuggestSuggestion.js +3 -5
- package/bpk-component-banner-alert/src/BpkBannerAlertInner.js +3 -5
- package/bpk-component-breakpoint/src/BpkBreakpoint.js +13 -7
- package/bpk-component-button/BpkButtonDestructive.d.ts +4 -0
- package/bpk-component-button/BpkButtonDestructive.js +9 -1
- package/bpk-component-button/BpkButtonFeatured.d.ts +4 -0
- package/bpk-component-button/BpkButtonFeatured.js +9 -1
- package/bpk-component-button/BpkButtonLink.d.ts +4 -0
- package/bpk-component-button/BpkButtonLink.js +9 -1
- package/bpk-component-button/BpkButtonLinkOnDark.d.ts +4 -0
- package/bpk-component-button/BpkButtonLinkOnDark.js +8 -1
- package/bpk-component-button/BpkButtonPrimary.d.ts +4 -0
- package/bpk-component-button/BpkButtonPrimary.js +8 -1
- package/bpk-component-button/BpkButtonPrimaryOnDark.d.ts +4 -0
- package/bpk-component-button/BpkButtonPrimaryOnDark.js +9 -1
- package/bpk-component-button/BpkButtonPrimaryOnLight.d.ts +4 -0
- package/bpk-component-button/BpkButtonPrimaryOnLight.js +9 -1
- package/bpk-component-button/BpkButtonSecondary.d.ts +4 -0
- package/bpk-component-button/BpkButtonSecondary.js +9 -1
- package/bpk-component-button/BpkButtonSecondaryOnDark.d.ts +4 -0
- package/bpk-component-button/BpkButtonSecondaryOnDark.js +9 -1
- package/bpk-component-button/index.d.ts +9 -9
- package/bpk-component-button/index.js +10 -20
- package/bpk-component-button/src/BpkButton.d.ts +56 -0
- package/bpk-component-button/src/BpkButton.js +31 -24
- package/bpk-component-button/src/BpkButtonBase.d.ts +53 -0
- package/bpk-component-button/src/BpkButtonBase.js +70 -43
- package/bpk-component-button/src/BpkButtonBase.module.css +1 -1
- package/bpk-component-button/src/common-types.d.ts +37 -0
- package/bpk-component-button/src/common-types.js +16 -15
- package/bpk-component-card/src/BpkCard.d.ts +1 -1
- package/bpk-component-card/src/BpkCard.js +4 -1
- package/bpk-component-card/src/BpkCard.module.css +1 -1
- package/bpk-component-card/src/BpkCardWrapper.js +18 -12
- package/bpk-component-card/src/BpkDividedCard.d.ts +1 -1
- package/bpk-component-card/src/BpkDividedCard.js +26 -19
- package/bpk-component-card/src/BpkDividedCard.module.css +1 -1
- package/bpk-component-card/src/CardContext.d.ts +14 -0
- package/{bpk-component-button/src/BpkButtonPrimary.js → bpk-component-card/src/CardContext.js} +11 -15
- package/bpk-component-card-button/src/BpkSaveButton.js +20 -24
- package/bpk-component-card-button/src/BpkSaveButton.module.css +1 -1
- package/bpk-component-close-button/src/BpkCloseButton.module.css +1 -1
- package/bpk-component-description-list/index.d.ts +4 -0
- package/bpk-component-description-list/src/BpkDescriptionDetails.d.ts +8 -0
- package/bpk-component-description-list/src/BpkDescriptionDetails.js +14 -2
- package/bpk-component-description-list/src/BpkDescriptionList.d.ts +8 -0
- package/bpk-component-description-list/src/BpkDescriptionList.js +14 -2
- package/bpk-component-description-list/src/BpkDescriptionTerm.d.ts +8 -0
- package/bpk-component-description-list/src/BpkDescriptionTerm.js +14 -2
- package/bpk-component-dialog/src/BpkDialogInner.js +3 -5
- package/bpk-component-dialog/src/BpkDialogInner.module.css +1 -1
- package/bpk-component-dialog/src/common-types.d.ts +1 -1
- package/bpk-component-floating-notification/src/BpkFloatingNotification.js +12 -9
- package/bpk-component-floating-notification/src/BpkFloatingNotification.module.css +1 -1
- package/bpk-component-icon/src/classNameModifierHOCFactory.js +0 -3
- package/bpk-component-modal/src/BpkModalInner.js +6 -15
- package/bpk-component-modal/src/BpkModalInner.module.css +1 -1
- package/bpk-component-modal/src/BpkModalV2/BpKModal.module.css +1 -1
- package/bpk-component-modal/src/BpkModalV2/BpkModal.js +5 -11
- package/bpk-component-nudger/src/BpkConfigurableNudger.js +0 -1
- package/bpk-component-pagination/src/BpkPaginationPage.js +6 -9
- package/bpk-component-pagination/src/BpkPaginationPage.module.css +1 -1
- package/bpk-component-popover/src/BpkPopover.d.ts +13 -3
- package/bpk-component-popover/src/BpkPopover.js +13 -3
- package/bpk-component-popover/src/BpkPopover.module.css +1 -1
- package/bpk-component-text/src/BpkText.module.css +1 -1
- package/bpk-stylesheets/larken.css +1 -1
- package/bpk-stylesheets/larken.scss +90 -0
- package/package.json +2 -2
- package/bpk-component-button/src/BpkButtonDestructive.js +0 -48
- package/bpk-component-button/src/BpkButtonDestructive.module.css +0 -18
- package/bpk-component-button/src/BpkButtonFeatured.js +0 -48
- package/bpk-component-button/src/BpkButtonFeatured.module.css +0 -18
- package/bpk-component-button/src/BpkButtonLink.js +0 -53
- package/bpk-component-button/src/BpkButtonLink.module.css +0 -18
- package/bpk-component-button/src/BpkButtonLinkOnDark.js +0 -53
- package/bpk-component-button/src/BpkButtonLinkOnDark.module.css +0 -18
- package/bpk-component-button/src/BpkButtonPrimaryOnDark.js +0 -48
- package/bpk-component-button/src/BpkButtonPrimaryOnDark.module.css +0 -18
- package/bpk-component-button/src/BpkButtonPrimaryOnLight.js +0 -48
- package/bpk-component-button/src/BpkButtonPrimaryOnLight.module.css +0 -18
- package/bpk-component-button/src/BpkButtonSecondary.js +0 -47
- package/bpk-component-button/src/BpkButtonSecondary.module.css +0 -18
- package/bpk-component-button/src/BpkButtonSecondaryOnDark.js +0 -48
- package/bpk-component-button/src/BpkButtonSecondaryOnDark.module.css +0 -18
- package/bpk-component-description-list/src/ComponentFactory.js +0 -54
|
@@ -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-autosuggest__container--open{position:relative}.bpk-autosuggest__suggestions-container{display:none}.bpk-autosuggest__suggestions-container--open{position:absolute;top:100%;display:block;z-index:900;width:100%;margin-top:.75rem}.bpk-autosuggest__suggestions-container--open::before{position:absolute;bottom:100%;left:50%;content:" ";display:block;margin-bottom:-0.0625rem;margin-left:-0.8125rem;border:.8125rem solid rgba(0,0,0,0);border-bottom-color:#e0e4e9;pointer-events:none}.bpk-autosuggest__suggestions-container--open::after{position:absolute;bottom:100%;left:50%;content:" ";display:block;margin-bottom:-0.0625rem;margin-left:-0.75rem;border:.75rem solid rgba(0,0,0,0);border-bottom-color:#fff;pointer-events:none}.bpk-autosuggest__suggestions-list{min-width:fit-content;margin:0;padding:0;list-style:none;overflow:hidden;border:.0625rem solid #e0e4e9;background-color:#fff;border-radius:.5rem;box-shadow:0px 4px 14px 0px rgba(37,32,31,.25)}.bpk-autosuggest__suggestion-item{cursor:pointer;margin:0;font-size:1rem;line-height:1.5rem;font-weight:400}.bpk-autosuggest__suggestion-item:not(:last-child){box-shadow:0 -1px 0 0 #c1c7cf inset}.bpk-autosuggest__suggestion-item:active{background-color:#eff3f8}.bpk-autosuggest__suggestion-item--highlighted{background-color:#eff3f8}.bpk-autosuggest__suggestion{display:table;width:100%;padding:1rem}.bpk-autosuggest__suggestion--indent{padding-left:2rem}.bpk-autosuggest__suggestion-icon{display:
|
|
18
|
+
.bpk-autosuggest__container--open{position:relative}.bpk-autosuggest__suggestions-container{display:none}.bpk-autosuggest__suggestions-container--open{position:absolute;top:100%;display:block;z-index:900;width:100%;margin-top:.75rem}.bpk-autosuggest__suggestions-container--open::before{position:absolute;bottom:100%;left:50%;content:" ";display:block;margin-bottom:-0.0625rem;margin-left:-0.8125rem;border:.8125rem solid rgba(0,0,0,0);border-bottom-color:#e0e4e9;pointer-events:none}.bpk-autosuggest__suggestions-container--open::after{position:absolute;bottom:100%;left:50%;content:" ";display:block;margin-bottom:-0.0625rem;margin-left:-0.75rem;border:.75rem solid rgba(0,0,0,0);border-bottom-color:#fff;pointer-events:none}.bpk-autosuggest__suggestions-list{min-width:fit-content;margin:0;padding:0;list-style:none;overflow:hidden;border:.0625rem solid #e0e4e9;background-color:#fff;border-radius:.5rem;box-shadow:0px 4px 14px 0px rgba(37,32,31,.25)}.bpk-autosuggest__suggestion-item{cursor:pointer;margin:0;font-size:1rem;line-height:1.5rem;font-weight:400}.bpk-autosuggest__suggestion-item:not(:last-child){box-shadow:0 -1px 0 0 #c1c7cf inset}.bpk-autosuggest__suggestion-item:active{background-color:#eff3f8}.bpk-autosuggest__suggestion-item--highlighted{background-color:#eff3f8}.bpk-autosuggest__suggestion{display:table;width:100%;padding:1rem}.bpk-autosuggest__suggestion--indent{padding-left:2rem}.bpk-autosuggest__suggestion-icon{display:flex;margin-right:.5rem;vertical-align:top;fill:#626971}html[dir=rtl] .bpk-autosuggest__suggestion-icon{margin-right:0;margin-left:.5rem}.bpk-autosuggest__suggestion-content{display:table-cell;width:100%;vertical-align:top}.bpk-autosuggest__suggestion-inner{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-between}.bpk-autosuggest__suggestion-value{display:block}.bpk-autosuggest__suggestion-sub-heading{display:table-cell;width:100%;vertical-align:top;margin:0;font-size:.75rem;line-height:1rem;font-weight:400}.bpk-autosuggest__suggestion-tertiary-label{display:table-cell;align-self:center;color:#626971;vertical-align:top;word-break:keep-all;margin:0;font-size:.75rem;line-height:1rem;font-weight:400}
|
|
@@ -43,11 +43,9 @@ const BpkAutosuggestSuggestion = props => {
|
|
|
43
43
|
_jsxs("section", {
|
|
44
44
|
className: classNames.join(' '),
|
|
45
45
|
...rest,
|
|
46
|
-
children: [icon ? /*#__PURE__*/_jsx(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
, {
|
|
50
|
-
className: getClassName('bpk-autosuggest__suggestion-icon')
|
|
46
|
+
children: [icon ? /*#__PURE__*/_jsx("div", {
|
|
47
|
+
className: getClassName('bpk-autosuggest__suggestion-icon'),
|
|
48
|
+
children: /*#__PURE__*/_jsx(Icon, {})
|
|
51
49
|
}) : null, /*#__PURE__*/_jsx("div", {
|
|
52
50
|
className: getClassName('bpk-autosuggest__suggestion-content'),
|
|
53
51
|
children: /*#__PURE__*/_jsxs("div", {
|
|
@@ -60,11 +60,9 @@ const getIconForType = (type, CustomIcon) => {
|
|
|
60
60
|
};
|
|
61
61
|
const Icon = CustomIcon || componentMap[type];
|
|
62
62
|
const AlignedIcon = withButtonAlignment(Icon);
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return /*#__PURE__*/_jsx(AlignedIcon, {
|
|
67
|
-
className: className
|
|
63
|
+
return /*#__PURE__*/_jsx("span", {
|
|
64
|
+
className: className,
|
|
65
|
+
children: /*#__PURE__*/_jsx(AlignedIcon, {})
|
|
68
66
|
});
|
|
69
67
|
};
|
|
70
68
|
const ToggleButton = props => {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import { useEffect, useState } from 'react';
|
|
19
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
20
20
|
import { breakpoints } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
21
21
|
import useMediaQuery from "./useMediaQuery";
|
|
22
22
|
const BREAKPOINTS = {
|
|
@@ -31,6 +31,14 @@ const BREAKPOINTS = {
|
|
|
31
31
|
ABOVE_DESKTOP: breakpoints.breakpointQueryAboveDesktop,
|
|
32
32
|
DESKTOP_ONLY: breakpoints.breakpointQueryDesktopOnly
|
|
33
33
|
};
|
|
34
|
+
const useLegacyWarning = (query, legacy, isClient) => useMemo(() => {
|
|
35
|
+
if (isClient) {
|
|
36
|
+
// @ts-expect-error invariant check. query: string matching limited BREAKPOINTS string values
|
|
37
|
+
if (!legacy && !Object.values(BREAKPOINTS).includes(query)) {
|
|
38
|
+
console.warn(`Invalid query ${query}. Use one of the supported queries or pass the legacy prop.`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}, [isClient, legacy, query]);
|
|
34
42
|
const BpkBreakpoint = ({
|
|
35
43
|
children,
|
|
36
44
|
legacy = false,
|
|
@@ -42,16 +50,14 @@ const BpkBreakpoint = ({
|
|
|
42
50
|
* Consumers of BpkBreakpoint have become reliant on this behaviour particularly when using BpkBreakpoint within a SSR'd application.
|
|
43
51
|
* This shouldn't be removed without a breaking change & understanding how to migrate consumers away from this reliance.
|
|
44
52
|
*/
|
|
45
|
-
const [
|
|
53
|
+
const [, updateState] = useState({});
|
|
46
54
|
useEffect(() => {
|
|
47
|
-
|
|
55
|
+
updateState({}); // force re-render when on client
|
|
48
56
|
}, []);
|
|
49
57
|
const matches = useMediaQuery(query, matchSSR);
|
|
58
|
+
const isClient = typeof window !== 'undefined';
|
|
59
|
+
useLegacyWarning(query, legacy, isClient);
|
|
50
60
|
if (isClient) {
|
|
51
|
-
// @ts-expect-error invariant check. query: string matching limited BREAKPOINTS string values
|
|
52
|
-
if (!legacy && !Object.values(BREAKPOINTS).includes(query)) {
|
|
53
|
-
console.warn(`Invalid query ${query}. Use one of the supported queries or pass the legacy prop.`);
|
|
54
|
-
}
|
|
55
61
|
if (typeof children === 'function') {
|
|
56
62
|
return children(matches);
|
|
57
63
|
}
|
|
@@ -14,4 +14,12 @@
|
|
|
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 BpkButton from "./src/BpkButton";
|
|
20
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
+
const BpkButtonDestructive = props => /*#__PURE__*/_jsx(BpkButton, {
|
|
22
|
+
...props,
|
|
23
|
+
destructive: true
|
|
24
|
+
});
|
|
25
|
+
export default BpkButtonDestructive;
|
|
@@ -14,4 +14,12 @@
|
|
|
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 BpkButton from "./src/BpkButton";
|
|
20
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
+
const BpkButtonFeatured = props => /*#__PURE__*/_jsx(BpkButton, {
|
|
22
|
+
...props,
|
|
23
|
+
featured: true
|
|
24
|
+
});
|
|
25
|
+
export default BpkButtonFeatured;
|
|
@@ -14,4 +14,12 @@
|
|
|
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 BpkButton from "./src/BpkButton";
|
|
20
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
+
const BpkButtonLink = props => /*#__PURE__*/_jsx(BpkButton, {
|
|
22
|
+
...props,
|
|
23
|
+
link: true
|
|
24
|
+
});
|
|
25
|
+
export default BpkButtonLink;
|
|
@@ -14,4 +14,11 @@
|
|
|
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
|
+
import BpkButton from "./src/BpkButton";
|
|
19
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
+
const BpkButtonLinkOnDark = props => /*#__PURE__*/_jsx(BpkButton, {
|
|
21
|
+
...props,
|
|
22
|
+
linkOnDark: true
|
|
23
|
+
});
|
|
24
|
+
export default BpkButtonLinkOnDark;
|
|
@@ -14,4 +14,11 @@
|
|
|
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 BpkButton from "./src/BpkButton";
|
|
20
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
+
const BpkButtonPrimary = props => /*#__PURE__*/_jsx(BpkButton, {
|
|
22
|
+
...props
|
|
23
|
+
});
|
|
24
|
+
export default BpkButtonPrimary;
|
|
@@ -14,4 +14,12 @@
|
|
|
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 BpkButton from "./src/BpkButton";
|
|
20
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
+
const BpkButtonPrimaryOnDark = props => /*#__PURE__*/_jsx(BpkButton, {
|
|
22
|
+
...props,
|
|
23
|
+
primaryOnDark: true
|
|
24
|
+
});
|
|
25
|
+
export default BpkButtonPrimaryOnDark;
|
|
@@ -14,4 +14,12 @@
|
|
|
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 BpkButton from "./src/BpkButton";
|
|
20
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
+
const BpkButtonPrimaryOnLight = props => /*#__PURE__*/_jsx(BpkButton, {
|
|
22
|
+
...props,
|
|
23
|
+
primaryOnLight: true
|
|
24
|
+
});
|
|
25
|
+
export default BpkButtonPrimaryOnLight;
|
|
@@ -14,4 +14,12 @@
|
|
|
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 BpkButton from "./src/BpkButton";
|
|
20
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
+
const BpkButtonSecondary = props => /*#__PURE__*/_jsx(BpkButton, {
|
|
22
|
+
...props,
|
|
23
|
+
secondary: true
|
|
24
|
+
});
|
|
25
|
+
export default BpkButtonSecondary;
|
|
@@ -14,4 +14,12 @@
|
|
|
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 BpkButton from "./src/BpkButton";
|
|
20
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
+
const BpkButtonSecondaryOnDark = props => /*#__PURE__*/_jsx(BpkButton, {
|
|
22
|
+
...props,
|
|
23
|
+
secondaryOnDark: true
|
|
24
|
+
});
|
|
25
|
+
export default BpkButtonSecondaryOnDark;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import BpkButtonDestructive from './BpkButtonDestructive';
|
|
2
|
+
import BpkButtonFeatured from './BpkButtonFeatured';
|
|
3
|
+
import BpkButtonLink from './BpkButtonLink';
|
|
4
|
+
import BpkButtonLinkOnDark from './BpkButtonLinkOnDark';
|
|
5
|
+
import BpkButtonPrimary from './BpkButtonPrimary';
|
|
6
|
+
import BpkButtonPrimaryOnDark from './BpkButtonPrimaryOnDark';
|
|
7
|
+
import BpkButtonPrimaryOnLight from './BpkButtonPrimaryOnLight';
|
|
8
|
+
import BpkButtonSecondary from './BpkButtonSecondary';
|
|
9
|
+
import BpkButtonSecondaryOnDark from './BpkButtonSecondaryOnDark';
|
|
1
10
|
import BpkButton from './src/BpkButton';
|
|
2
|
-
import BpkButtonDestructive from './src/BpkButtonDestructive';
|
|
3
|
-
import BpkButtonFeatured from './src/BpkButtonFeatured';
|
|
4
|
-
import BpkButtonLink from './src/BpkButtonLink';
|
|
5
|
-
import BpkButtonLinkOnDark from './src/BpkButtonLinkOnDark';
|
|
6
|
-
import BpkButtonPrimary from './src/BpkButtonPrimary';
|
|
7
|
-
import BpkButtonPrimaryOnDark from './src/BpkButtonPrimaryOnDark';
|
|
8
|
-
import BpkButtonPrimaryOnLight from './src/BpkButtonPrimaryOnLight';
|
|
9
|
-
import BpkButtonSecondary from './src/BpkButtonSecondary';
|
|
10
|
-
import BpkButtonSecondaryOnDark from './src/BpkButtonSecondaryOnDark';
|
|
11
11
|
import { BpkButtonV2 } from './src/BpkButtonV2/BpkButton';
|
|
12
12
|
export { BUTTON_TYPES, SIZE_TYPES } from './src/BpkButtonV2/common-types';
|
|
13
13
|
export { buttonThemeAttributes, primaryThemeAttributes, primaryOnDarkThemeAttributes, primaryOnLightThemeAttributes, secondaryThemeAttributes, secondaryOnDarkThemeAttributes, featuredThemeAttributes, destructiveThemeAttributes, } from './themeAttributes';
|
|
@@ -16,26 +16,16 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
import
|
|
21
|
-
|
|
22
|
-
import
|
|
23
|
-
|
|
24
|
-
import
|
|
25
|
-
|
|
26
|
-
import
|
|
27
|
-
|
|
28
|
-
import
|
|
29
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
30
|
-
import BpkButtonPrimary from "./src/BpkButtonPrimary";
|
|
31
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
32
|
-
import BpkButtonPrimaryOnDark from "./src/BpkButtonPrimaryOnDark";
|
|
33
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
34
|
-
import BpkButtonPrimaryOnLight from "./src/BpkButtonPrimaryOnLight";
|
|
35
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
36
|
-
import BpkButtonSecondary from "./src/BpkButtonSecondary";
|
|
37
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
38
|
-
import BpkButtonSecondaryOnDark from "./src/BpkButtonSecondaryOnDark";
|
|
19
|
+
import BpkButtonDestructive from "./BpkButtonDestructive";
|
|
20
|
+
import BpkButtonFeatured from "./BpkButtonFeatured";
|
|
21
|
+
import BpkButtonLink from "./BpkButtonLink";
|
|
22
|
+
import BpkButtonLinkOnDark from "./BpkButtonLinkOnDark";
|
|
23
|
+
import BpkButtonPrimary from "./BpkButtonPrimary";
|
|
24
|
+
import BpkButtonPrimaryOnDark from "./BpkButtonPrimaryOnDark";
|
|
25
|
+
import BpkButtonPrimaryOnLight from "./BpkButtonPrimaryOnLight";
|
|
26
|
+
import BpkButtonSecondary from "./BpkButtonSecondary";
|
|
27
|
+
import BpkButtonSecondaryOnDark from "./BpkButtonSecondaryOnDark";
|
|
28
|
+
import BpkButton from "./src/BpkButton";
|
|
39
29
|
import { BpkButtonV2 } from "./src/BpkButtonV2/BpkButton";
|
|
40
30
|
export { BUTTON_TYPES, SIZE_TYPES } from "./src/BpkButtonV2/common-types";
|
|
41
31
|
export { buttonThemeAttributes, primaryThemeAttributes, primaryOnDarkThemeAttributes, primaryOnLightThemeAttributes, secondaryThemeAttributes, secondaryOnDarkThemeAttributes, featuredThemeAttributes, destructiveThemeAttributes } from "./themeAttributes";
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { type Props as CommonProps } from './common-types';
|
|
4
|
+
export type Props = CommonProps & {
|
|
5
|
+
primaryOnDark?: boolean;
|
|
6
|
+
primaryOnLight?: boolean;
|
|
7
|
+
secondary?: boolean;
|
|
8
|
+
secondaryOnDark?: boolean;
|
|
9
|
+
destructive?: boolean;
|
|
10
|
+
featured?: boolean;
|
|
11
|
+
link?: boolean;
|
|
12
|
+
linkOnDark?: boolean;
|
|
13
|
+
};
|
|
14
|
+
declare const BpkButton: {
|
|
15
|
+
(props: Props): JSX.Element;
|
|
16
|
+
defaultProps: {
|
|
17
|
+
primaryOnDark: boolean;
|
|
18
|
+
primaryOnLight: boolean;
|
|
19
|
+
secondary: boolean;
|
|
20
|
+
secondaryOnDark: boolean;
|
|
21
|
+
destructive: boolean;
|
|
22
|
+
featured: boolean;
|
|
23
|
+
link: boolean;
|
|
24
|
+
linkOnDark: boolean;
|
|
25
|
+
href: null;
|
|
26
|
+
className: null;
|
|
27
|
+
disabled: boolean;
|
|
28
|
+
onClick: null;
|
|
29
|
+
submit: boolean;
|
|
30
|
+
large: boolean;
|
|
31
|
+
iconOnly: boolean;
|
|
32
|
+
blank: boolean;
|
|
33
|
+
rel: null;
|
|
34
|
+
};
|
|
35
|
+
propTypes: {
|
|
36
|
+
primaryOnDark: PropTypes.Requireable<boolean>;
|
|
37
|
+
primaryOnLight: PropTypes.Requireable<boolean>;
|
|
38
|
+
secondary: PropTypes.Requireable<boolean>;
|
|
39
|
+
secondaryOnDark: PropTypes.Requireable<boolean>;
|
|
40
|
+
destructive: PropTypes.Requireable<boolean>;
|
|
41
|
+
featured: PropTypes.Requireable<boolean>;
|
|
42
|
+
link: PropTypes.Requireable<boolean>;
|
|
43
|
+
linkOnDark: PropTypes.Requireable<boolean>;
|
|
44
|
+
children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
45
|
+
href: PropTypes.Requireable<string>;
|
|
46
|
+
className: PropTypes.Requireable<string>;
|
|
47
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
48
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
49
|
+
submit: PropTypes.Requireable<boolean>;
|
|
50
|
+
large: PropTypes.Requireable<boolean>;
|
|
51
|
+
iconOnly: PropTypes.Requireable<boolean>;
|
|
52
|
+
blank: PropTypes.Requireable<boolean>;
|
|
53
|
+
rel: PropTypes.Requireable<string>;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
export default BpkButton;
|
|
@@ -14,10 +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
|
-
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
import { BpkButtonPrimary, BpkButtonPrimaryOnDark, BpkButtonPrimaryOnLight, BpkButtonSecondary, BpkButtonSecondaryOnDark, BpkButtonDestructive, BpkButtonLink, BpkButtonLinkOnDark, BpkButtonFeatured } from "../index";
|
|
17
|
+
*/
|
|
18
|
+
import PropTypes from 'prop-types';
|
|
19
|
+
import BpkButtonBase, { BUTTON_TYPES } from "./BpkButtonBase";
|
|
21
20
|
import { propTypes, defaultProps } from "./common-types";
|
|
22
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
22
|
const BpkButton = props => {
|
|
@@ -33,60 +32,57 @@ const BpkButton = props => {
|
|
|
33
32
|
...rest
|
|
34
33
|
} = props;
|
|
35
34
|
if (primaryOnDark) {
|
|
36
|
-
return /*#__PURE__*/_jsx(
|
|
35
|
+
return /*#__PURE__*/_jsx(BpkButtonBase, {
|
|
36
|
+
type: BUTTON_TYPES.primaryOnDark,
|
|
37
37
|
...rest
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
if (primaryOnLight) {
|
|
41
|
-
return /*#__PURE__*/_jsx(
|
|
41
|
+
return /*#__PURE__*/_jsx(BpkButtonBase, {
|
|
42
|
+
type: BUTTON_TYPES.primaryOnLight,
|
|
42
43
|
...rest
|
|
43
44
|
});
|
|
44
45
|
}
|
|
45
46
|
if (secondary) {
|
|
46
|
-
return /*#__PURE__*/_jsx(
|
|
47
|
+
return /*#__PURE__*/_jsx(BpkButtonBase, {
|
|
48
|
+
type: BUTTON_TYPES.secondary,
|
|
47
49
|
...rest
|
|
48
50
|
});
|
|
49
51
|
}
|
|
50
52
|
if (secondaryOnDark) {
|
|
51
|
-
return /*#__PURE__*/_jsx(
|
|
53
|
+
return /*#__PURE__*/_jsx(BpkButtonBase, {
|
|
54
|
+
type: BUTTON_TYPES.secondaryOnDark,
|
|
52
55
|
...rest
|
|
53
56
|
});
|
|
54
57
|
}
|
|
55
58
|
if (destructive) {
|
|
56
|
-
return /*#__PURE__*/_jsx(
|
|
59
|
+
return /*#__PURE__*/_jsx(BpkButtonBase, {
|
|
60
|
+
type: BUTTON_TYPES.destructive,
|
|
57
61
|
...rest
|
|
58
62
|
});
|
|
59
63
|
}
|
|
60
64
|
if (featured) {
|
|
61
|
-
return /*#__PURE__*/_jsx(
|
|
65
|
+
return /*#__PURE__*/_jsx(BpkButtonBase, {
|
|
66
|
+
type: BUTTON_TYPES.featured,
|
|
62
67
|
...rest
|
|
63
68
|
});
|
|
64
69
|
}
|
|
65
70
|
if (link) {
|
|
66
|
-
return /*#__PURE__*/_jsx(
|
|
71
|
+
return /*#__PURE__*/_jsx(BpkButtonBase, {
|
|
72
|
+
type: BUTTON_TYPES.link,
|
|
67
73
|
...rest
|
|
68
74
|
});
|
|
69
75
|
}
|
|
70
76
|
if (linkOnDark) {
|
|
71
|
-
return /*#__PURE__*/_jsx(
|
|
77
|
+
return /*#__PURE__*/_jsx(BpkButtonBase, {
|
|
78
|
+
type: BUTTON_TYPES.linkOnDark,
|
|
72
79
|
...rest
|
|
73
80
|
});
|
|
74
81
|
}
|
|
75
|
-
return /*#__PURE__*/_jsx(
|
|
82
|
+
return /*#__PURE__*/_jsx(BpkButtonBase, {
|
|
76
83
|
...rest
|
|
77
84
|
});
|
|
78
85
|
};
|
|
79
|
-
BpkButton.propTypes = {
|
|
80
|
-
...propTypes,
|
|
81
|
-
primaryOnDark: PropTypes.bool,
|
|
82
|
-
primaryOnLight: PropTypes.bool,
|
|
83
|
-
secondary: PropTypes.bool,
|
|
84
|
-
secondaryOnDark: PropTypes.bool,
|
|
85
|
-
destructive: PropTypes.bool,
|
|
86
|
-
featured: PropTypes.bool,
|
|
87
|
-
link: PropTypes.bool,
|
|
88
|
-
linkOnDark: PropTypes.bool
|
|
89
|
-
};
|
|
90
86
|
BpkButton.defaultProps = {
|
|
91
87
|
...defaultProps,
|
|
92
88
|
primaryOnDark: false,
|
|
@@ -98,4 +94,15 @@ BpkButton.defaultProps = {
|
|
|
98
94
|
link: false,
|
|
99
95
|
linkOnDark: false
|
|
100
96
|
};
|
|
97
|
+
BpkButton.propTypes = {
|
|
98
|
+
...propTypes,
|
|
99
|
+
primaryOnDark: PropTypes.bool,
|
|
100
|
+
primaryOnLight: PropTypes.bool,
|
|
101
|
+
secondary: PropTypes.bool,
|
|
102
|
+
secondaryOnDark: PropTypes.bool,
|
|
103
|
+
destructive: PropTypes.bool,
|
|
104
|
+
featured: PropTypes.bool,
|
|
105
|
+
link: PropTypes.bool,
|
|
106
|
+
linkOnDark: PropTypes.bool
|
|
107
|
+
};
|
|
101
108
|
export default BpkButton;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type Props } from './common-types';
|
|
3
|
+
export declare const BUTTON_TYPES: {
|
|
4
|
+
readonly primary: "primary";
|
|
5
|
+
readonly primaryOnDark: "primary-on-dark";
|
|
6
|
+
readonly primaryOnLight: "primary-on-light";
|
|
7
|
+
readonly secondary: "secondary";
|
|
8
|
+
readonly secondaryOnDark: "secondary-on-dark";
|
|
9
|
+
readonly destructive: "destructive";
|
|
10
|
+
readonly featured: "featured";
|
|
11
|
+
readonly link: "link";
|
|
12
|
+
readonly linkOnDark: "link-on-dark";
|
|
13
|
+
};
|
|
14
|
+
type ValueOf<T> = T[keyof T];
|
|
15
|
+
declare const BpkButtonBase: {
|
|
16
|
+
(props: Props & {
|
|
17
|
+
type?: ValueOf<{
|
|
18
|
+
readonly primary: "primary";
|
|
19
|
+
readonly primaryOnDark: "primary-on-dark";
|
|
20
|
+
readonly primaryOnLight: "primary-on-light";
|
|
21
|
+
readonly secondary: "secondary";
|
|
22
|
+
readonly secondaryOnDark: "secondary-on-dark";
|
|
23
|
+
readonly destructive: "destructive";
|
|
24
|
+
readonly featured: "featured";
|
|
25
|
+
readonly link: "link";
|
|
26
|
+
readonly linkOnDark: "link-on-dark";
|
|
27
|
+
}> | undefined;
|
|
28
|
+
}): JSX.Element;
|
|
29
|
+
propTypes: {
|
|
30
|
+
children: import("prop-types").Validator<NonNullable<import("prop-types").ReactNodeLike>>;
|
|
31
|
+
href: import("prop-types").Requireable<string>;
|
|
32
|
+
className: import("prop-types").Requireable<string>;
|
|
33
|
+
disabled: import("prop-types").Requireable<boolean>;
|
|
34
|
+
onClick: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
35
|
+
submit: import("prop-types").Requireable<boolean>;
|
|
36
|
+
large: import("prop-types").Requireable<boolean>;
|
|
37
|
+
iconOnly: import("prop-types").Requireable<boolean>;
|
|
38
|
+
blank: import("prop-types").Requireable<boolean>;
|
|
39
|
+
rel: import("prop-types").Requireable<string>;
|
|
40
|
+
};
|
|
41
|
+
defaultProps: {
|
|
42
|
+
href: null;
|
|
43
|
+
className: null;
|
|
44
|
+
disabled: boolean;
|
|
45
|
+
onClick: null;
|
|
46
|
+
submit: boolean;
|
|
47
|
+
large: boolean;
|
|
48
|
+
iconOnly: boolean;
|
|
49
|
+
blank: boolean;
|
|
50
|
+
rel: null;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export default BpkButtonBase;
|