@oaknational/oak-components 3.15.0 → 3.16.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
|
@@ -4626,6 +4626,11 @@ var StyledOakFlex$2 = styled__default.default(OakFlex)(templateObject_6$5 || (te
|
|
|
4626
4626
|
var $cardOrientation = _a.$cardOrientation;
|
|
4627
4627
|
return getResponsiveCardOrientationStyles($cardOrientation);
|
|
4628
4628
|
});
|
|
4629
|
+
function boolAsDisplay(input) {
|
|
4630
|
+
if (input === undefined)
|
|
4631
|
+
return;
|
|
4632
|
+
return input ? "block" : "none";
|
|
4633
|
+
}
|
|
4629
4634
|
/**
|
|
4630
4635
|
* A highly customisable card component that displays a heading and takes a href at minimum.
|
|
4631
4636
|
*
|
|
@@ -4635,10 +4640,14 @@ var StyledOakFlex$2 = styled__default.default(OakFlex)(templateObject_6$5 || (te
|
|
|
4635
4640
|
* The image aspect ratio can be set to either 1:1 or 4:3.
|
|
4636
4641
|
*/
|
|
4637
4642
|
var OakCard = function (_a) {
|
|
4638
|
-
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;
|
|
4643
|
+
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;
|
|
4644
|
+
var displayImage = Array.isArray(showImage)
|
|
4645
|
+
? showImage.map(function (value) { return boolAsDisplay(value); })
|
|
4646
|
+
: boolAsDisplay(showImage);
|
|
4639
4647
|
return (React__default.default.createElement(OakFocusIndicator, { as: as, "$background": "bg-primary", hoverBackground: hoverBackground, "$height": "100%", "$width": cardWidth, "$borderRadius": "border-radius-m2" },
|
|
4640
4648
|
React__default.default.createElement(StyledOakFlex$2, { as: "a", href: href, "$cardOrientation": cardOrientation, "$height": "100%", "$pa": "spacing-16", "$gap": "spacing-16" },
|
|
4641
|
-
imageSrc && (React__default.default.createElement(
|
|
4649
|
+
imageSrc && (React__default.default.createElement(OakBox, { "$display": displayImage },
|
|
4650
|
+
React__default.default.createElement(StyledOakImage, { src: imageSrc || "", alt: imageAlt || "", "$width": "auto", "$aspectRatio": aspectRatio, "$background": imageBackgroundColor, "$borderRadius": "border-radius-m2" }))),
|
|
4642
4651
|
React__default.default.createElement(CardContent, { "$flexDirection": "column", "$justifyContent": "space-between", "$gap": "spacing-16" },
|
|
4643
4652
|
React__default.default.createElement(OakFlex, { "$flexDirection": "column", "$gap": "spacing-16" },
|
|
4644
4653
|
React__default.default.createElement(OakHeading, { tag: headingLevel, "$font": "heading-6" }, heading),
|
package/dist/npm/cjs/types.d.ts
CHANGED
|
@@ -3567,6 +3567,10 @@ type OakCardProps = {
|
|
|
3567
3567
|
* The background colour of the card on hover.
|
|
3568
3568
|
*/
|
|
3569
3569
|
hoverBackground?: OakUiRoleToken;
|
|
3570
|
+
/**
|
|
3571
|
+
* Whether to show the image or not
|
|
3572
|
+
*/
|
|
3573
|
+
showImage?: ResponsiveValues<boolean>;
|
|
3570
3574
|
};
|
|
3571
3575
|
/**
|
|
3572
3576
|
* A highly customisable card component that displays a heading and takes a href at minimum.
|
|
@@ -3576,7 +3580,7 @@ type OakCardProps = {
|
|
|
3576
3580
|
* The card can be oriented in a row or column layout and its width can be adjusted using spacing tokens.
|
|
3577
3581
|
* The image aspect ratio can be set to either 1:1 or 4:3.
|
|
3578
3582
|
*/
|
|
3579
|
-
declare const OakCard: ({ as, heading, headingLevel, href, cardOrientation, cardWidth, imageSrc, imageAlt, aspectRatio, subCopy, subCopyColor, tagName, tagBackground, linkText, linkIconName, hoverBackground, imageBackgroundColor, }: OakCardProps) => React$1.JSX.Element;
|
|
3583
|
+
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;
|
|
3580
3584
|
|
|
3581
3585
|
type OakBreadcrumb = {
|
|
3582
3586
|
text: string;
|
|
@@ -17,6 +17,13 @@ import { sizeStyle } from '../../../styles/utils/sizeStyle.js';
|
|
|
17
17
|
import { flexStyle } from '../../../styles/utils/flexStyle.js';
|
|
18
18
|
import { colorStyle } from '../../../styles/utils/colorStyle.js';
|
|
19
19
|
import { borderStyle } from '../../../styles/utils/borderStyle.js';
|
|
20
|
+
import { OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
|
|
21
|
+
import '../../layout-and-structure/OakGrid/OakGrid.js';
|
|
22
|
+
import '../../layout-and-structure/OakGridArea/OakGridArea.js';
|
|
23
|
+
import '../../layout-and-structure/OakMaxWidth/OakMaxWidth.js';
|
|
24
|
+
import '../../layout-and-structure/OakAccordion/OakAccordion.js';
|
|
25
|
+
import '../../internal-components/InternalChevronAccordion/InternalChevronAccordion.js';
|
|
26
|
+
import '../../layout-and-structure/OakCollapsibleContent/OakCollapsibleContent.js';
|
|
20
27
|
|
|
21
28
|
var CardContent = styled(OakFlex)(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
|
|
22
29
|
var StyledOakImage = styled(OakImage)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n ", "\n ", "\n\n img {\n border-radius: inherit;\n object-fit: cover;\n }\n"], ["\n ", "\n ", "\n ", "\n\n img {\n border-radius: inherit;\n object-fit: cover;\n }\n"])), sizeStyle, colorStyle, borderStyle);
|
|
@@ -36,6 +43,11 @@ var StyledOakFlex = styled(OakFlex)(templateObject_6 || (templateObject_6 = __ma
|
|
|
36
43
|
var $cardOrientation = _a.$cardOrientation;
|
|
37
44
|
return getResponsiveCardOrientationStyles($cardOrientation);
|
|
38
45
|
});
|
|
46
|
+
function boolAsDisplay(input) {
|
|
47
|
+
if (input === undefined)
|
|
48
|
+
return;
|
|
49
|
+
return input ? "block" : "none";
|
|
50
|
+
}
|
|
39
51
|
/**
|
|
40
52
|
* A highly customisable card component that displays a heading and takes a href at minimum.
|
|
41
53
|
*
|
|
@@ -45,10 +57,14 @@ var StyledOakFlex = styled(OakFlex)(templateObject_6 || (templateObject_6 = __ma
|
|
|
45
57
|
* The image aspect ratio can be set to either 1:1 or 4:3.
|
|
46
58
|
*/
|
|
47
59
|
var OakCard = function (_a) {
|
|
48
|
-
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;
|
|
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;
|
|
61
|
+
var displayImage = Array.isArray(showImage)
|
|
62
|
+
? showImage.map(function (value) { return boolAsDisplay(value); })
|
|
63
|
+
: boolAsDisplay(showImage);
|
|
49
64
|
return (React.createElement(OakFocusIndicator, { as: as, "$background": "bg-primary", hoverBackground: hoverBackground, "$height": "100%", "$width": cardWidth, "$borderRadius": "border-radius-m2" },
|
|
50
65
|
React.createElement(StyledOakFlex, { as: "a", href: href, "$cardOrientation": cardOrientation, "$height": "100%", "$pa": "spacing-16", "$gap": "spacing-16" },
|
|
51
|
-
imageSrc && (React.createElement(
|
|
66
|
+
imageSrc && (React.createElement(OakBox, { "$display": displayImage },
|
|
67
|
+
React.createElement(StyledOakImage, { src: imageSrc || "", alt: imageAlt || "", "$width": "auto", "$aspectRatio": aspectRatio, "$background": imageBackgroundColor, "$borderRadius": "border-radius-m2" }))),
|
|
52
68
|
React.createElement(CardContent, { "$flexDirection": "column", "$justifyContent": "space-between", "$gap": "spacing-16" },
|
|
53
69
|
React.createElement(OakFlex, { "$flexDirection": "column", "$gap": "spacing-16" },
|
|
54
70
|
React.createElement(OakHeading, { tag: headingLevel, "$font": "heading-6" }, heading),
|
package/dist/npm/es/types.d.ts
CHANGED
|
@@ -3567,6 +3567,10 @@ type OakCardProps = {
|
|
|
3567
3567
|
* The background colour of the card on hover.
|
|
3568
3568
|
*/
|
|
3569
3569
|
hoverBackground?: OakUiRoleToken;
|
|
3570
|
+
/**
|
|
3571
|
+
* Whether to show the image or not
|
|
3572
|
+
*/
|
|
3573
|
+
showImage?: ResponsiveValues<boolean>;
|
|
3570
3574
|
};
|
|
3571
3575
|
/**
|
|
3572
3576
|
* A highly customisable card component that displays a heading and takes a href at minimum.
|
|
@@ -3576,7 +3580,7 @@ type OakCardProps = {
|
|
|
3576
3580
|
* The card can be oriented in a row or column layout and its width can be adjusted using spacing tokens.
|
|
3577
3581
|
* The image aspect ratio can be set to either 1:1 or 4:3.
|
|
3578
3582
|
*/
|
|
3579
|
-
declare const OakCard: ({ as, heading, headingLevel, href, cardOrientation, cardWidth, imageSrc, imageAlt, aspectRatio, subCopy, subCopyColor, tagName, tagBackground, linkText, linkIconName, hoverBackground, imageBackgroundColor, }: OakCardProps) => React$1.JSX.Element;
|
|
3583
|
+
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;
|
|
3580
3584
|
|
|
3581
3585
|
type OakBreadcrumb = {
|
|
3582
3586
|
text: string;
|