@oaknational/oak-components 3.16.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.
@@ -936,6 +936,7 @@ var icons = {
936
936
  strand: "v1776850533/icons/strand.svg",
937
937
  plus: "v1781533362/icons/plus.svg",
938
938
  hide: "v1785931149/icons/Icon_Hide_r1q6se.svg",
939
+ clock: "v1789035961/icons/clock.svg",
939
940
  //learning cycle icons
940
941
  "lc-explanation": "v1788336387/icons/lc-explanation.svg",
941
942
  "lc-check-for-understanding": "v1788336388/icons/lc-check-for-understanding.svg",
@@ -4622,10 +4623,10 @@ var getResponsiveCardOrientationStyles = function (cardOrientation) {
4622
4623
  var _a = tslib.__read(cardOrientation, 2), smallOrientation = _a[0], largeOrientation = _a[1];
4623
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));
4624
4625
  };
4625
- 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) {
4626
4627
  var $cardOrientation = _a.$cardOrientation;
4627
4628
  return getResponsiveCardOrientationStyles($cardOrientation);
4628
- });
4629
+ }, responsiveStyle("background", function (props) { return props.$hoverBackground; }, parseColor));
4629
4630
  function boolAsDisplay(input) {
4630
4631
  if (input === undefined)
4631
4632
  return;
@@ -4638,14 +4639,17 @@ function boolAsDisplay(input) {
4638
4639
  *
4639
4640
  * The card can be oriented in a row or column layout and its width can be adjusted using spacing tokens.
4640
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.
4641
4645
  */
4642
4646
  var OakCard = function (_a) {
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;
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"]);
4644
4648
  var displayImage = Array.isArray(showImage)
4645
4649
  ? showImage.map(function (value) { return boolAsDisplay(value); })
4646
4650
  : boolAsDisplay(showImage);
4647
- return (React__default.default.createElement(OakFocusIndicator, { as: as, "$background": "bg-primary", hoverBackground: hoverBackground, "$height": "100%", "$width": cardWidth, "$borderRadius": "border-radius-m2" },
4648
- 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),
4649
4653
  imageSrc && (React__default.default.createElement(OakBox, { "$display": displayImage },
4650
4654
  React__default.default.createElement(StyledOakImage, { src: imageSrc || "", alt: imageAlt || "", "$width": "auto", "$aspectRatio": aspectRatio, "$background": imageBackgroundColor, "$borderRadius": "border-radius-m2" }))),
4651
4655
  React__default.default.createElement(CardContent, { "$flexDirection": "column", "$justifyContent": "space-between", "$gap": "spacing-16" },
@@ -686,6 +686,7 @@ declare const icons: {
686
686
  readonly strand: "v1776850533/icons/strand.svg";
687
687
  readonly plus: "v1781533362/icons/plus.svg";
688
688
  readonly hide: "v1785931149/icons/Icon_Hide_r1q6se.svg";
689
+ readonly clock: "v1789035961/icons/clock.svg";
689
690
  readonly "lc-explanation": "v1788336387/icons/lc-explanation.svg";
690
691
  readonly "lc-check-for-understanding": "v1788336388/icons/lc-check-for-understanding.svg";
691
692
  readonly "lc-practice": "v1788336389/icons/lc-practice.svg";
@@ -3501,6 +3502,9 @@ type OakTabsProps<T extends string> = {
3501
3502
  };
3502
3503
  declare function OakTabs<T extends string>(props: Readonly<OakTabsProps<T>>): React$1.JSX.Element;
3503
3504
 
3505
+ /**
3506
+ * Border and colour style props are forwarded to the card's `<a>` element.
3507
+ */
3504
3508
  type OakCardProps = {
3505
3509
  as?: "div" | "li";
3506
3510
  /**
@@ -3571,7 +3575,7 @@ type OakCardProps = {
3571
3575
  * Whether to show the image or not
3572
3576
  */
3573
3577
  showImage?: ResponsiveValues<boolean>;
3574
- };
3578
+ } & BorderStyleProps & ColorStyleProps;
3575
3579
  /**
3576
3580
  * A highly customisable card component that displays a heading and takes a href at minimum.
3577
3581
  *
@@ -3579,8 +3583,11 @@ type OakCardProps = {
3579
3583
  *
3580
3584
  * The card can be oriented in a row or column layout and its width can be adjusted using spacing tokens.
3581
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.
3582
3589
  */
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;
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;
3584
3591
 
3585
3592
  type OakBreadcrumb = {
3586
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, "$background": "bg-primary", hoverBackground: hoverBackground, "$height": "100%", "$width": cardWidth, "$borderRadius": "border-radius-m2" },
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" },
@@ -87,6 +87,7 @@ var icons = {
87
87
  strand: "v1776850533/icons/strand.svg",
88
88
  plus: "v1781533362/icons/plus.svg",
89
89
  hide: "v1785931149/icons/Icon_Hide_r1q6se.svg",
90
+ clock: "v1789035961/icons/clock.svg",
90
91
  //learning cycle icons
91
92
  "lc-explanation": "v1788336387/icons/lc-explanation.svg",
92
93
  "lc-check-for-understanding": "v1788336388/icons/lc-check-for-understanding.svg",
@@ -686,6 +686,7 @@ declare const icons: {
686
686
  readonly strand: "v1776850533/icons/strand.svg";
687
687
  readonly plus: "v1781533362/icons/plus.svg";
688
688
  readonly hide: "v1785931149/icons/Icon_Hide_r1q6se.svg";
689
+ readonly clock: "v1789035961/icons/clock.svg";
689
690
  readonly "lc-explanation": "v1788336387/icons/lc-explanation.svg";
690
691
  readonly "lc-check-for-understanding": "v1788336388/icons/lc-check-for-understanding.svg";
691
692
  readonly "lc-practice": "v1788336389/icons/lc-practice.svg";
@@ -3501,6 +3502,9 @@ type OakTabsProps<T extends string> = {
3501
3502
  };
3502
3503
  declare function OakTabs<T extends string>(props: Readonly<OakTabsProps<T>>): React$1.JSX.Element;
3503
3504
 
3505
+ /**
3506
+ * Border and colour style props are forwarded to the card's `<a>` element.
3507
+ */
3504
3508
  type OakCardProps = {
3505
3509
  as?: "div" | "li";
3506
3510
  /**
@@ -3571,7 +3575,7 @@ type OakCardProps = {
3571
3575
  * Whether to show the image or not
3572
3576
  */
3573
3577
  showImage?: ResponsiveValues<boolean>;
3574
- };
3578
+ } & BorderStyleProps & ColorStyleProps;
3575
3579
  /**
3576
3580
  * A highly customisable card component that displays a heading and takes a href at minimum.
3577
3581
  *
@@ -3579,8 +3583,11 @@ type OakCardProps = {
3579
3583
  *
3580
3584
  * The card can be oriented in a row or column layout and its width can be adjusted using spacing tokens.
3581
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.
3582
3589
  */
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;
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;
3584
3591
 
3585
3592
  type OakBreadcrumb = {
3586
3593
  text: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oaknational/oak-components",
3
- "version": "3.16.0",
3
+ "version": "3.18.0",
4
4
  "licence": "MIT",
5
5
  "packageManager": "pnpm@11.2.0",
6
6
  "description": "Shared components for Oak applications",