@oaknational/oak-components 3.6.2 → 3.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/dist/npm/cjs/index.js
CHANGED
|
@@ -4505,7 +4505,7 @@ function OakTabs(props) {
|
|
|
4505
4505
|
var hoverBackground = colorVariant === "black" ? "bg-btn-primary-hover" : "bg-neutral-stronger";
|
|
4506
4506
|
var hoverText = colorVariant === "black" ? "text-inverted" : "text-primary";
|
|
4507
4507
|
return (React__default.default.createElement(OakUL, { "$display": "flex", "$justifyContent": "space-around", "$height": sizeVariant === "compact" ? "spacing-40" : "spacing-56", "$background": backgroundColor, "$borderRadius": "border-radius-circle", "$gap": "spacing-8", "$pa": "spacing-8", "$alignItems": "center", "$font": sizeVariant === "compact" ? "body-3" : "heading-light-7", "$ba": "border-solid-s", "$borderColor": colorVariant === "white" ? "border-neutral-lighter" : backgroundColor }, tabs.map(function (tab) {
|
|
4508
|
-
var label = tab.label, type = tab.type;
|
|
4508
|
+
var label = tab.label, type = tab.type, showPromo = tab.showPromo;
|
|
4509
4509
|
var isSelected = activeTab === label;
|
|
4510
4510
|
return (React__default.default.createElement(OakLI, { "$listStyle": "none", "$width": "100%", "$height": "100%", "$display": "flex", key: label },
|
|
4511
4511
|
React__default.default.createElement(StyledTabButton, { element: type === "link" ? Link__default.default : undefined, href: type === "link" ? tab.href : undefined, "aria-current": type === "link" && isSelected ? "page" : undefined, "$background": isSelected ? "bg-decorative1-main" : backgroundColor, "$color": isSelected ? "text-primary" : textColor, "$hoverColor": isSelected ? "text-primary" : hoverText, "$hoverBackground": isSelected ? "bg-decorative1-main" : hoverBackground, "$ba": "border-solid-s", "$borderColor": isSelected ? "border-decorative1-stronger" : backgroundColor, onClick: function (event) {
|
|
@@ -4513,7 +4513,10 @@ function OakTabs(props) {
|
|
|
4513
4513
|
onTabClick(label, event);
|
|
4514
4514
|
}
|
|
4515
4515
|
} },
|
|
4516
|
-
React__default.default.createElement(StyledFocusOutline, { "$width": "100%", "$height": "100%", "$borderRadius": "border-radius-circle", "$pa": "spacing-4", "$alignItems": "center", "$justifyContent": "center", "$whiteSpace": "nowrap" },
|
|
4516
|
+
React__default.default.createElement(StyledFocusOutline, { "$width": "100%", "$height": "100%", "$borderRadius": "border-radius-circle", "$pa": "spacing-4", "$alignItems": "center", "$justifyContent": "center", "$whiteSpace": "nowrap" },
|
|
4517
|
+
React__default.default.createElement(OakFlex, { "$alignItems": "center", "$gap": "spacing-8" },
|
|
4518
|
+
React__default.default.createElement(OakSpan, null, label),
|
|
4519
|
+
showPromo && (React__default.default.createElement(OakPromoTag, { variant: colorVariant === "black" ? "inverted" : "default" })))))));
|
|
4517
4520
|
})));
|
|
4518
4521
|
}
|
|
4519
4522
|
var templateObject_1$T, templateObject_2$n;
|
|
@@ -6906,12 +6909,12 @@ var StyledPromoTag = styled__default.default(OakFlex)(templateObject_1$j || (tem
|
|
|
6906
6909
|
* Renders a tag with the text "New"
|
|
6907
6910
|
*/
|
|
6908
6911
|
var OakPromoTag = function (props) {
|
|
6909
|
-
var _a = props.width, width = _a === void 0 ? ["spacing-40", "spacing-48", "spacing-56"] : _a, _b = props.display, display = _b === void 0 ? "flex" : _b;
|
|
6912
|
+
var _a = props.width, width = _a === void 0 ? ["spacing-40", "spacing-48", "spacing-56"] : _a, _b = props.display, display = _b === void 0 ? "flex" : _b, _c = props.variant, variant = _c === void 0 ? "default" : _c;
|
|
6910
6913
|
return (React__default.default.createElement(StyledPromoTag, { "$alignItems": "center", "$justifyContent": "center", "$position": "relative", "$width": width, "$display": display },
|
|
6911
|
-
React__default.default.createElement(InternalStyledSvg, { height: "100%", width: "100%", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 56 27", "$fill": "
|
|
6914
|
+
React__default.default.createElement(InternalStyledSvg, { height: "100%", width: "100%", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 56 27", "$fill": variant === "default" ? "bg-inverted" : "bg-decorative5-main" },
|
|
6912
6915
|
React__default.default.createElement("path", { d: "M6.421 0c8.661.839 17.303.834 26.16.714a89.843 89.843 0 0 1 4.834-.013c6.333.32 12.39.317 18.506-.275 0 1.26.178 2.352 0 3.44-.276 1.38-.829 2.759-1.342 4.15-.138.354-.532.706-.808 1.06-.445.248-.63.5-.553.753 1.598 1.093-.256 2.185 0 3.277.276 1.529 1.322 3.058 1.204 4.572-.138 1.771-1.046 3.543-1.973 5.312-.288.4-1.065.792-2.309 1.169-2.288.755-4.103 1.67-11.206 1.965-9.936.417-20.953.385-30.678-.09-2.447-.12-4.38-.532-5.209-.853-1.035-.458-1.52-.929-1.44-1.4C.937 18.988-.109 14.194.01 9.4c0-2.645 1.973-5.29 3.413-7.933.237-.424 1.697-.839 3-1.468Z" })),
|
|
6913
6916
|
React__default.default.createElement(OakFlex, { "$position": "absolute", "$inset": "spacing-0", "$alignItems": "center", "$justifyContent": "center" },
|
|
6914
|
-
React__default.default.createElement(OakSpan, { "$color": "text-promo"
|
|
6917
|
+
React__default.default.createElement(OakSpan, { "$color": variant === "default" ? "text-promo" : "text-primary", "$font": ["body-3-bold", "body-3-bold", "heading-7"] }, "New"))));
|
|
6915
6918
|
};
|
|
6916
6919
|
var templateObject_1$j;
|
|
6917
6920
|
|
package/dist/npm/cjs/types.d.ts
CHANGED
|
@@ -3405,6 +3405,7 @@ declare const OakSecondaryLink: OakLinkComponent;
|
|
|
3405
3405
|
|
|
3406
3406
|
type Tab<T> = {
|
|
3407
3407
|
label: T;
|
|
3408
|
+
showPromo?: boolean;
|
|
3408
3409
|
} & ({
|
|
3409
3410
|
type: "button";
|
|
3410
3411
|
} | {
|
|
@@ -4768,6 +4769,7 @@ declare const OakOutlineAccordion: ({ header, children, id, initialOpen, ...styl
|
|
|
4768
4769
|
type OakPromoTagProps = {
|
|
4769
4770
|
width?: SizeStyleProps["$width"];
|
|
4770
4771
|
display?: DisplayStyleProps["$display"];
|
|
4772
|
+
variant?: "default" | "inverted";
|
|
4771
4773
|
};
|
|
4772
4774
|
/**
|
|
4773
4775
|
* Renders a tag with the text "New"
|
|
@@ -18,9 +18,10 @@ import '../../typography/OakHeading/OakHeading.js';
|
|
|
18
18
|
import { OakLI } from '../../typography/OakLI/OakLI.js';
|
|
19
19
|
import '../../typography/OakOL/OakOL.js';
|
|
20
20
|
import '../../typography/OakP/OakP.js';
|
|
21
|
-
import '../../typography/OakSpan/OakSpan.js';
|
|
21
|
+
import { OakSpan } from '../../typography/OakSpan/OakSpan.js';
|
|
22
22
|
import '../../typography/OakTypography/OakTypography.js';
|
|
23
23
|
import { OakUL } from '../../typography/OakUL/OakUL.js';
|
|
24
|
+
import { OakPromoTag } from '../../owa/OakPromoTag/OakPromoTag.js';
|
|
24
25
|
|
|
25
26
|
var StyledFocusOutline = styled(OakFlex)(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
|
|
26
27
|
var StyledTabButton = styled(InternalButton)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 100%;\n height: 100%;\n border-radius: ", ";\n &:hover {\n color: ", ";\n background: ", ";\n }\n &:focus-visible:not(&:active) {\n box-shadow: ", ";\n ", " {\n box-shadow: ", ";\n }\n }\n"], ["\n width: 100%;\n height: 100%;\n border-radius: ", ";\n &:hover {\n color: ", ";\n background: ", ";\n }\n &:focus-visible:not(&:active) {\n box-shadow: ", ";\n ", " {\n box-shadow: ", ";\n }\n }\n"])), parseBorderRadius("border-radius-circle"), function (props) { return parseColor(props.$hoverColor); }, function (props) { return parseColor(props.$hoverBackground); }, parseDropShadow("drop-shadow-centered-grey"), StyledFocusOutline, parseDropShadow("drop-shadow-centered-lemon"));
|
|
@@ -31,7 +32,7 @@ function OakTabs(props) {
|
|
|
31
32
|
var hoverBackground = colorVariant === "black" ? "bg-btn-primary-hover" : "bg-neutral-stronger";
|
|
32
33
|
var hoverText = colorVariant === "black" ? "text-inverted" : "text-primary";
|
|
33
34
|
return (React.createElement(OakUL, { "$display": "flex", "$justifyContent": "space-around", "$height": sizeVariant === "compact" ? "spacing-40" : "spacing-56", "$background": backgroundColor, "$borderRadius": "border-radius-circle", "$gap": "spacing-8", "$pa": "spacing-8", "$alignItems": "center", "$font": sizeVariant === "compact" ? "body-3" : "heading-light-7", "$ba": "border-solid-s", "$borderColor": colorVariant === "white" ? "border-neutral-lighter" : backgroundColor }, tabs.map(function (tab) {
|
|
34
|
-
var label = tab.label, type = tab.type;
|
|
35
|
+
var label = tab.label, type = tab.type, showPromo = tab.showPromo;
|
|
35
36
|
var isSelected = activeTab === label;
|
|
36
37
|
return (React.createElement(OakLI, { "$listStyle": "none", "$width": "100%", "$height": "100%", "$display": "flex", key: label },
|
|
37
38
|
React.createElement(StyledTabButton, { element: type === "link" ? Link : undefined, href: type === "link" ? tab.href : undefined, "aria-current": type === "link" && isSelected ? "page" : undefined, "$background": isSelected ? "bg-decorative1-main" : backgroundColor, "$color": isSelected ? "text-primary" : textColor, "$hoverColor": isSelected ? "text-primary" : hoverText, "$hoverBackground": isSelected ? "bg-decorative1-main" : hoverBackground, "$ba": "border-solid-s", "$borderColor": isSelected ? "border-decorative1-stronger" : backgroundColor, onClick: function (event) {
|
|
@@ -39,7 +40,10 @@ function OakTabs(props) {
|
|
|
39
40
|
onTabClick(label, event);
|
|
40
41
|
}
|
|
41
42
|
} },
|
|
42
|
-
React.createElement(StyledFocusOutline, { "$width": "100%", "$height": "100%", "$borderRadius": "border-radius-circle", "$pa": "spacing-4", "$alignItems": "center", "$justifyContent": "center", "$whiteSpace": "nowrap" },
|
|
43
|
+
React.createElement(StyledFocusOutline, { "$width": "100%", "$height": "100%", "$borderRadius": "border-radius-circle", "$pa": "spacing-4", "$alignItems": "center", "$justifyContent": "center", "$whiteSpace": "nowrap" },
|
|
44
|
+
React.createElement(OakFlex, { "$alignItems": "center", "$gap": "spacing-8" },
|
|
45
|
+
React.createElement(OakSpan, null, label),
|
|
46
|
+
showPromo && (React.createElement(OakPromoTag, { variant: colorVariant === "black" ? "inverted" : "default" })))))));
|
|
43
47
|
})));
|
|
44
48
|
}
|
|
45
49
|
var templateObject_1, templateObject_2;
|
|
@@ -10,12 +10,12 @@ var StyledPromoTag = styled(OakFlex)(templateObject_1 || (templateObject_1 = __m
|
|
|
10
10
|
* Renders a tag with the text "New"
|
|
11
11
|
*/
|
|
12
12
|
var OakPromoTag = function (props) {
|
|
13
|
-
var _a = props.width, width = _a === void 0 ? ["spacing-40", "spacing-48", "spacing-56"] : _a, _b = props.display, display = _b === void 0 ? "flex" : _b;
|
|
13
|
+
var _a = props.width, width = _a === void 0 ? ["spacing-40", "spacing-48", "spacing-56"] : _a, _b = props.display, display = _b === void 0 ? "flex" : _b, _c = props.variant, variant = _c === void 0 ? "default" : _c;
|
|
14
14
|
return (React.createElement(StyledPromoTag, { "$alignItems": "center", "$justifyContent": "center", "$position": "relative", "$width": width, "$display": display },
|
|
15
|
-
React.createElement(InternalStyledSvg, { height: "100%", width: "100%", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 56 27", "$fill": "
|
|
15
|
+
React.createElement(InternalStyledSvg, { height: "100%", width: "100%", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 56 27", "$fill": variant === "default" ? "bg-inverted" : "bg-decorative5-main" },
|
|
16
16
|
React.createElement("path", { d: "M6.421 0c8.661.839 17.303.834 26.16.714a89.843 89.843 0 0 1 4.834-.013c6.333.32 12.39.317 18.506-.275 0 1.26.178 2.352 0 3.44-.276 1.38-.829 2.759-1.342 4.15-.138.354-.532.706-.808 1.06-.445.248-.63.5-.553.753 1.598 1.093-.256 2.185 0 3.277.276 1.529 1.322 3.058 1.204 4.572-.138 1.771-1.046 3.543-1.973 5.312-.288.4-1.065.792-2.309 1.169-2.288.755-4.103 1.67-11.206 1.965-9.936.417-20.953.385-30.678-.09-2.447-.12-4.38-.532-5.209-.853-1.035-.458-1.52-.929-1.44-1.4C.937 18.988-.109 14.194.01 9.4c0-2.645 1.973-5.29 3.413-7.933.237-.424 1.697-.839 3-1.468Z" })),
|
|
17
17
|
React.createElement(OakFlex, { "$position": "absolute", "$inset": "spacing-0", "$alignItems": "center", "$justifyContent": "center" },
|
|
18
|
-
React.createElement(OakSpan, { "$color": "text-promo"
|
|
18
|
+
React.createElement(OakSpan, { "$color": variant === "default" ? "text-promo" : "text-primary", "$font": ["body-3-bold", "body-3-bold", "heading-7"] }, "New"))));
|
|
19
19
|
};
|
|
20
20
|
var templateObject_1;
|
|
21
21
|
|
package/dist/npm/es/types.d.ts
CHANGED
|
@@ -3405,6 +3405,7 @@ declare const OakSecondaryLink: OakLinkComponent;
|
|
|
3405
3405
|
|
|
3406
3406
|
type Tab<T> = {
|
|
3407
3407
|
label: T;
|
|
3408
|
+
showPromo?: boolean;
|
|
3408
3409
|
} & ({
|
|
3409
3410
|
type: "button";
|
|
3410
3411
|
} | {
|
|
@@ -4768,6 +4769,7 @@ declare const OakOutlineAccordion: ({ header, children, id, initialOpen, ...styl
|
|
|
4768
4769
|
type OakPromoTagProps = {
|
|
4769
4770
|
width?: SizeStyleProps["$width"];
|
|
4770
4771
|
display?: DisplayStyleProps["$display"];
|
|
4772
|
+
variant?: "default" | "inverted";
|
|
4771
4773
|
};
|
|
4772
4774
|
/**
|
|
4773
4775
|
* Renders a tag with the text "New"
|