@oaknational/oak-components 3.17.0 → 3.18.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
|
@@ -4623,10 +4623,10 @@ var getResponsiveCardOrientationStyles = function (cardOrientation) {
|
|
|
4623
4623
|
var _a = tslib.__read(cardOrientation, 2), smallOrientation = _a[0], largeOrientation = _a[1];
|
|
4624
4624
|
return styled.css(templateObject_5$8 || (templateObject_5$8 = tslib.__makeTemplateObject(["\n ", ";\n\n @media (min-width: ", "px) {\n ", "\n }\n "], ["\n ", ";\n\n @media (min-width: ", "px) {\n ", "\n }\n "])), getCardOrientationStyles(smallOrientation), getBreakpoint("small"), getCardOrientationStyles(largeOrientation));
|
|
4625
4625
|
};
|
|
4626
|
-
var StyledOakFlex$2 = styled__default.default(OakFlex)(templateObject_6$5 || (templateObject_6$5 = tslib.__makeTemplateObject(["\n ", "\n\n ", "\n\n &:hover {\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n span {\n text-decoration: underline;\n }\n\n span {\n text-decoration-thickness: 18%;\n }\n }\n"], ["\n ", "\n\n ", "\n\n &:hover {\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n span {\n text-decoration: underline;\n }\n\n span {\n text-decoration-thickness: 18%;\n }\n }\n"])), flexStyle, function (_a) {
|
|
4626
|
+
var StyledOakFlex$2 = styled__default.default(OakFlex)(templateObject_6$5 || (templateObject_6$5 = tslib.__makeTemplateObject(["\n ", "\n\n ", "\n\n &:hover {\n ", "\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n span {\n text-decoration: underline;\n }\n\n span {\n text-decoration-thickness: 18%;\n }\n }\n"], ["\n ", "\n\n ", "\n\n &:hover {\n ", "\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n span {\n text-decoration: underline;\n }\n\n span {\n text-decoration-thickness: 18%;\n }\n }\n"])), flexStyle, function (_a) {
|
|
4627
4627
|
var $cardOrientation = _a.$cardOrientation;
|
|
4628
4628
|
return getResponsiveCardOrientationStyles($cardOrientation);
|
|
4629
|
-
});
|
|
4629
|
+
}, responsiveStyle("background", function (props) { return props.$hoverBackground; }, parseColor));
|
|
4630
4630
|
function boolAsDisplay(input) {
|
|
4631
4631
|
if (input === undefined)
|
|
4632
4632
|
return;
|
|
@@ -4639,14 +4639,17 @@ function boolAsDisplay(input) {
|
|
|
4639
4639
|
*
|
|
4640
4640
|
* The card can be oriented in a row or column layout and its width can be adjusted using spacing tokens.
|
|
4641
4641
|
* The image aspect ratio can be set to either 1:1 or 4:3.
|
|
4642
|
+
*
|
|
4643
|
+
* Border and colour style props are forwarded to the card's `<a>` element, so the
|
|
4644
|
+
* background, border radii, borders etc. can be overridden directly.
|
|
4642
4645
|
*/
|
|
4643
4646
|
var OakCard = function (_a) {
|
|
4644
|
-
var _b = _a.as, as = _b === void 0 ? "div" : _b, heading = _a.heading, _c = _a.headingLevel, headingLevel = _c === void 0 ? "h3" : _c, href = _a.href, _d = _a.cardOrientation, cardOrientation = _d === void 0 ? "column" : _d, cardWidth = _a.cardWidth, imageSrc = _a.imageSrc, imageAlt = _a.imageAlt, _e = _a.aspectRatio, aspectRatio = _e === void 0 ? "1/1" : _e, subCopy = _a.subCopy, _f = _a.subCopyColor, subCopyColor = _f === void 0 ? "text-primary" : _f, tagName = _a.tagName, _g = _a.tagBackground, tagBackground = _g === void 0 ? "bg-decorative3-very-subdued" : _g, linkText = _a.linkText, _h = _a.linkIconName, linkIconName = _h === void 0 ? "arrow-right" : _h, _j = _a.hoverBackground, hoverBackground = _j === void 0 ? "bg-btn-secondary-hover" : _j, _k = _a.imageBackgroundColor, imageBackgroundColor = _k === void 0 ? "bg-neutral" : _k, showImage = _a.showImage;
|
|
4647
|
+
var _b = _a.as, as = _b === void 0 ? "div" : _b, heading = _a.heading, _c = _a.headingLevel, headingLevel = _c === void 0 ? "h3" : _c, href = _a.href, _d = _a.cardOrientation, cardOrientation = _d === void 0 ? "column" : _d, cardWidth = _a.cardWidth, imageSrc = _a.imageSrc, imageAlt = _a.imageAlt, _e = _a.aspectRatio, aspectRatio = _e === void 0 ? "1/1" : _e, subCopy = _a.subCopy, _f = _a.subCopyColor, subCopyColor = _f === void 0 ? "text-primary" : _f, tagName = _a.tagName, _g = _a.tagBackground, tagBackground = _g === void 0 ? "bg-decorative3-very-subdued" : _g, linkText = _a.linkText, _h = _a.linkIconName, linkIconName = _h === void 0 ? "arrow-right" : _h, _j = _a.hoverBackground, hoverBackground = _j === void 0 ? "bg-btn-secondary-hover" : _j, _k = _a.imageBackgroundColor, imageBackgroundColor = _k === void 0 ? "bg-neutral" : _k, _l = _a.$background, $background = _l === void 0 ? "bg-primary" : _l, _m = _a.$borderRadius, $borderRadius = _m === void 0 ? "border-radius-m2" : _m, showImage = _a.showImage, styleProps = tslib.__rest(_a, ["as", "heading", "headingLevel", "href", "cardOrientation", "cardWidth", "imageSrc", "imageAlt", "aspectRatio", "subCopy", "subCopyColor", "tagName", "tagBackground", "linkText", "linkIconName", "hoverBackground", "imageBackgroundColor", "$background", "$borderRadius", "showImage"]);
|
|
4645
4648
|
var displayImage = Array.isArray(showImage)
|
|
4646
4649
|
? showImage.map(function (value) { return boolAsDisplay(value); })
|
|
4647
4650
|
: boolAsDisplay(showImage);
|
|
4648
|
-
return (React__default.default.createElement(OakFocusIndicator, { as: as, "$
|
|
4649
|
-
React__default.default.createElement(StyledOakFlex$2, { as: "a", href: href, "$cardOrientation": cardOrientation, "$height": "100%", "$pa": "spacing-16", "$gap": "spacing-16" },
|
|
4651
|
+
return (React__default.default.createElement(OakFocusIndicator, { as: as, "$height": "100%", "$width": cardWidth },
|
|
4652
|
+
React__default.default.createElement(StyledOakFlex$2, tslib.__assign({ as: "a", href: href, "$cardOrientation": cardOrientation, "$height": "100%", "$pa": "spacing-16", "$gap": "spacing-16", "$hoverBackground": hoverBackground, "$background": $background, "$borderRadius": $borderRadius }, styleProps),
|
|
4650
4653
|
imageSrc && (React__default.default.createElement(OakBox, { "$display": displayImage },
|
|
4651
4654
|
React__default.default.createElement(StyledOakImage, { src: imageSrc || "", alt: imageAlt || "", "$width": "auto", "$aspectRatio": aspectRatio, "$background": imageBackgroundColor, "$borderRadius": "border-radius-m2" }))),
|
|
4652
4655
|
React__default.default.createElement(CardContent, { "$flexDirection": "column", "$justifyContent": "space-between", "$gap": "spacing-16" },
|
package/dist/npm/cjs/types.d.ts
CHANGED
|
@@ -3502,6 +3502,9 @@ type OakTabsProps<T extends string> = {
|
|
|
3502
3502
|
};
|
|
3503
3503
|
declare function OakTabs<T extends string>(props: Readonly<OakTabsProps<T>>): React$1.JSX.Element;
|
|
3504
3504
|
|
|
3505
|
+
/**
|
|
3506
|
+
* Border and colour style props are forwarded to the card's `<a>` element.
|
|
3507
|
+
*/
|
|
3505
3508
|
type OakCardProps = {
|
|
3506
3509
|
as?: "div" | "li";
|
|
3507
3510
|
/**
|
|
@@ -3572,7 +3575,7 @@ type OakCardProps = {
|
|
|
3572
3575
|
* Whether to show the image or not
|
|
3573
3576
|
*/
|
|
3574
3577
|
showImage?: ResponsiveValues<boolean>;
|
|
3575
|
-
};
|
|
3578
|
+
} & BorderStyleProps & ColorStyleProps;
|
|
3576
3579
|
/**
|
|
3577
3580
|
* A highly customisable card component that displays a heading and takes a href at minimum.
|
|
3578
3581
|
*
|
|
@@ -3580,8 +3583,11 @@ type OakCardProps = {
|
|
|
3580
3583
|
*
|
|
3581
3584
|
* The card can be oriented in a row or column layout and its width can be adjusted using spacing tokens.
|
|
3582
3585
|
* The image aspect ratio can be set to either 1:1 or 4:3.
|
|
3586
|
+
*
|
|
3587
|
+
* Border and colour style props are forwarded to the card's `<a>` element, so the
|
|
3588
|
+
* background, border radii, borders etc. can be overridden directly.
|
|
3583
3589
|
*/
|
|
3584
|
-
declare const OakCard: ({ as, heading, headingLevel, href, cardOrientation, cardWidth, imageSrc, imageAlt, aspectRatio, subCopy, subCopyColor, tagName, tagBackground, linkText, linkIconName, hoverBackground, imageBackgroundColor, showImage, }: OakCardProps) => React$1.JSX.Element;
|
|
3590
|
+
declare const OakCard: ({ as, heading, headingLevel, href, cardOrientation, cardWidth, imageSrc, imageAlt, aspectRatio, subCopy, subCopyColor, tagName, tagBackground, linkText, linkIconName, hoverBackground, imageBackgroundColor, $background, $borderRadius, showImage, ...styleProps }: OakCardProps) => React$1.JSX.Element;
|
|
3585
3591
|
|
|
3586
3592
|
type OakBreadcrumb = {
|
|
3587
3593
|
text: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __makeTemplateObject, __read } from 'tslib';
|
|
1
|
+
import { __makeTemplateObject, __read, __rest, __assign } from 'tslib';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
4
|
import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
|
|
@@ -11,8 +11,9 @@ import { OakSpan } from '../../typography/OakSpan/OakSpan.js';
|
|
|
11
11
|
import { OakTagFunctional } from '../../messaging-and-feedback/OakTagFunctional/OakTagFunctional.js';
|
|
12
12
|
import '../../../styles/theme/color.js';
|
|
13
13
|
import '../../../styles/theme/typography.js';
|
|
14
|
+
import { parseColor } from '../../../styles/helpers/parseColor.js';
|
|
14
15
|
import { parseSpacing } from '../../../styles/helpers/parseSpacing.js';
|
|
15
|
-
import { getBreakpoint } from '../../../styles/utils/responsiveStyle.js';
|
|
16
|
+
import { responsiveStyle, getBreakpoint } from '../../../styles/utils/responsiveStyle.js';
|
|
16
17
|
import { sizeStyle } from '../../../styles/utils/sizeStyle.js';
|
|
17
18
|
import { flexStyle } from '../../../styles/utils/flexStyle.js';
|
|
18
19
|
import { colorStyle } from '../../../styles/utils/colorStyle.js';
|
|
@@ -39,10 +40,10 @@ var getResponsiveCardOrientationStyles = function (cardOrientation) {
|
|
|
39
40
|
var _a = __read(cardOrientation, 2), smallOrientation = _a[0], largeOrientation = _a[1];
|
|
40
41
|
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n ", ";\n\n @media (min-width: ", "px) {\n ", "\n }\n "], ["\n ", ";\n\n @media (min-width: ", "px) {\n ", "\n }\n "])), getCardOrientationStyles(smallOrientation), getBreakpoint("small"), getCardOrientationStyles(largeOrientation));
|
|
41
42
|
};
|
|
42
|
-
var StyledOakFlex = styled(OakFlex)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", "\n\n ", "\n\n &:hover {\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n span {\n text-decoration: underline;\n }\n\n span {\n text-decoration-thickness: 18%;\n }\n }\n"], ["\n ", "\n\n ", "\n\n &:hover {\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n span {\n text-decoration: underline;\n }\n\n span {\n text-decoration-thickness: 18%;\n }\n }\n"])), flexStyle, function (_a) {
|
|
43
|
+
var StyledOakFlex = styled(OakFlex)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", "\n\n ", "\n\n &:hover {\n ", "\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n span {\n text-decoration: underline;\n }\n\n span {\n text-decoration-thickness: 18%;\n }\n }\n"], ["\n ", "\n\n ", "\n\n &:hover {\n ", "\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n span {\n text-decoration: underline;\n }\n\n span {\n text-decoration-thickness: 18%;\n }\n }\n"])), flexStyle, function (_a) {
|
|
43
44
|
var $cardOrientation = _a.$cardOrientation;
|
|
44
45
|
return getResponsiveCardOrientationStyles($cardOrientation);
|
|
45
|
-
});
|
|
46
|
+
}, responsiveStyle("background", function (props) { return props.$hoverBackground; }, parseColor));
|
|
46
47
|
function boolAsDisplay(input) {
|
|
47
48
|
if (input === undefined)
|
|
48
49
|
return;
|
|
@@ -55,14 +56,17 @@ function boolAsDisplay(input) {
|
|
|
55
56
|
*
|
|
56
57
|
* The card can be oriented in a row or column layout and its width can be adjusted using spacing tokens.
|
|
57
58
|
* The image aspect ratio can be set to either 1:1 or 4:3.
|
|
59
|
+
*
|
|
60
|
+
* Border and colour style props are forwarded to the card's `<a>` element, so the
|
|
61
|
+
* background, border radii, borders etc. can be overridden directly.
|
|
58
62
|
*/
|
|
59
63
|
var OakCard = function (_a) {
|
|
60
|
-
var _b = _a.as, as = _b === void 0 ? "div" : _b, heading = _a.heading, _c = _a.headingLevel, headingLevel = _c === void 0 ? "h3" : _c, href = _a.href, _d = _a.cardOrientation, cardOrientation = _d === void 0 ? "column" : _d, cardWidth = _a.cardWidth, imageSrc = _a.imageSrc, imageAlt = _a.imageAlt, _e = _a.aspectRatio, aspectRatio = _e === void 0 ? "1/1" : _e, subCopy = _a.subCopy, _f = _a.subCopyColor, subCopyColor = _f === void 0 ? "text-primary" : _f, tagName = _a.tagName, _g = _a.tagBackground, tagBackground = _g === void 0 ? "bg-decorative3-very-subdued" : _g, linkText = _a.linkText, _h = _a.linkIconName, linkIconName = _h === void 0 ? "arrow-right" : _h, _j = _a.hoverBackground, hoverBackground = _j === void 0 ? "bg-btn-secondary-hover" : _j, _k = _a.imageBackgroundColor, imageBackgroundColor = _k === void 0 ? "bg-neutral" : _k, showImage = _a.showImage;
|
|
64
|
+
var _b = _a.as, as = _b === void 0 ? "div" : _b, heading = _a.heading, _c = _a.headingLevel, headingLevel = _c === void 0 ? "h3" : _c, href = _a.href, _d = _a.cardOrientation, cardOrientation = _d === void 0 ? "column" : _d, cardWidth = _a.cardWidth, imageSrc = _a.imageSrc, imageAlt = _a.imageAlt, _e = _a.aspectRatio, aspectRatio = _e === void 0 ? "1/1" : _e, subCopy = _a.subCopy, _f = _a.subCopyColor, subCopyColor = _f === void 0 ? "text-primary" : _f, tagName = _a.tagName, _g = _a.tagBackground, tagBackground = _g === void 0 ? "bg-decorative3-very-subdued" : _g, linkText = _a.linkText, _h = _a.linkIconName, linkIconName = _h === void 0 ? "arrow-right" : _h, _j = _a.hoverBackground, hoverBackground = _j === void 0 ? "bg-btn-secondary-hover" : _j, _k = _a.imageBackgroundColor, imageBackgroundColor = _k === void 0 ? "bg-neutral" : _k, _l = _a.$background, $background = _l === void 0 ? "bg-primary" : _l, _m = _a.$borderRadius, $borderRadius = _m === void 0 ? "border-radius-m2" : _m, showImage = _a.showImage, styleProps = __rest(_a, ["as", "heading", "headingLevel", "href", "cardOrientation", "cardWidth", "imageSrc", "imageAlt", "aspectRatio", "subCopy", "subCopyColor", "tagName", "tagBackground", "linkText", "linkIconName", "hoverBackground", "imageBackgroundColor", "$background", "$borderRadius", "showImage"]);
|
|
61
65
|
var displayImage = Array.isArray(showImage)
|
|
62
66
|
? showImage.map(function (value) { return boolAsDisplay(value); })
|
|
63
67
|
: boolAsDisplay(showImage);
|
|
64
|
-
return (React.createElement(OakFocusIndicator, { as: as, "$
|
|
65
|
-
React.createElement(StyledOakFlex, { as: "a", href: href, "$cardOrientation": cardOrientation, "$height": "100%", "$pa": "spacing-16", "$gap": "spacing-16" },
|
|
68
|
+
return (React.createElement(OakFocusIndicator, { as: as, "$height": "100%", "$width": cardWidth },
|
|
69
|
+
React.createElement(StyledOakFlex, __assign({ as: "a", href: href, "$cardOrientation": cardOrientation, "$height": "100%", "$pa": "spacing-16", "$gap": "spacing-16", "$hoverBackground": hoverBackground, "$background": $background, "$borderRadius": $borderRadius }, styleProps),
|
|
66
70
|
imageSrc && (React.createElement(OakBox, { "$display": displayImage },
|
|
67
71
|
React.createElement(StyledOakImage, { src: imageSrc || "", alt: imageAlt || "", "$width": "auto", "$aspectRatio": aspectRatio, "$background": imageBackgroundColor, "$borderRadius": "border-radius-m2" }))),
|
|
68
72
|
React.createElement(CardContent, { "$flexDirection": "column", "$justifyContent": "space-between", "$gap": "spacing-16" },
|
package/dist/npm/es/types.d.ts
CHANGED
|
@@ -3502,6 +3502,9 @@ type OakTabsProps<T extends string> = {
|
|
|
3502
3502
|
};
|
|
3503
3503
|
declare function OakTabs<T extends string>(props: Readonly<OakTabsProps<T>>): React$1.JSX.Element;
|
|
3504
3504
|
|
|
3505
|
+
/**
|
|
3506
|
+
* Border and colour style props are forwarded to the card's `<a>` element.
|
|
3507
|
+
*/
|
|
3505
3508
|
type OakCardProps = {
|
|
3506
3509
|
as?: "div" | "li";
|
|
3507
3510
|
/**
|
|
@@ -3572,7 +3575,7 @@ type OakCardProps = {
|
|
|
3572
3575
|
* Whether to show the image or not
|
|
3573
3576
|
*/
|
|
3574
3577
|
showImage?: ResponsiveValues<boolean>;
|
|
3575
|
-
};
|
|
3578
|
+
} & BorderStyleProps & ColorStyleProps;
|
|
3576
3579
|
/**
|
|
3577
3580
|
* A highly customisable card component that displays a heading and takes a href at minimum.
|
|
3578
3581
|
*
|
|
@@ -3580,8 +3583,11 @@ type OakCardProps = {
|
|
|
3580
3583
|
*
|
|
3581
3584
|
* The card can be oriented in a row or column layout and its width can be adjusted using spacing tokens.
|
|
3582
3585
|
* The image aspect ratio can be set to either 1:1 or 4:3.
|
|
3586
|
+
*
|
|
3587
|
+
* Border and colour style props are forwarded to the card's `<a>` element, so the
|
|
3588
|
+
* background, border radii, borders etc. can be overridden directly.
|
|
3583
3589
|
*/
|
|
3584
|
-
declare const OakCard: ({ as, heading, headingLevel, href, cardOrientation, cardWidth, imageSrc, imageAlt, aspectRatio, subCopy, subCopyColor, tagName, tagBackground, linkText, linkIconName, hoverBackground, imageBackgroundColor, showImage, }: OakCardProps) => React$1.JSX.Element;
|
|
3590
|
+
declare const OakCard: ({ as, heading, headingLevel, href, cardOrientation, cardWidth, imageSrc, imageAlt, aspectRatio, subCopy, subCopyColor, tagName, tagBackground, linkText, linkIconName, hoverBackground, imageBackgroundColor, $background, $borderRadius, showImage, ...styleProps }: OakCardProps) => React$1.JSX.Element;
|
|
3585
3591
|
|
|
3586
3592
|
type OakBreadcrumb = {
|
|
3587
3593
|
text: string;
|