@oaknational/oak-components 3.11.0 → 3.12.1

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/README.md CHANGED
@@ -43,7 +43,6 @@ export default function RootLayout({ children }) {
43
43
 
44
44
  To enable SSR of styles and avoid a flicker of unstyled content you'll need to configure your Next.js app to support [styled-components](https://nextjs.org/docs/app/building-your-application/styling/css-in-js#styled-components)
45
45
 
46
-
47
46
  ## Development
48
47
 
49
48
  1. Copy the example env config `cp .env.example .env`
@@ -83,6 +82,13 @@ Sometimes it isn't enough to develop entirely inside Storybook and it might be n
83
82
  - 🚨 if you're an Oak engineer developing in OWA there is a convenience script and you should use `pnpm run remove-local-components` instead
84
83
  as it will automatically re-install the library from NPM.
85
84
 
85
+ ## Testing Stories
86
+
87
+ To check that all stories render successfully, you can use [@storybook/test-runner](https://storybook.js.org/docs/writing-tests/integrations/test-runner). These tests will also run against the deployed preview on PRs. To run locally:
88
+
89
+ 1. Ensure browsers are installed once: `pnpm exec playwright install`
90
+ 2. Run tests with `pnpm run test:storybook`
91
+
86
92
  ## Organisational structure
87
93
 
88
94
  ⚠️ When creating a new component and in doubt of which category or folder it should belong to, discuss in #oak-components Slack channel.
@@ -1037,6 +1037,8 @@ var icons = {
1037
1037
  "media-clips": "v1774884267/icons/media-clips_nw3zpt.svg",
1038
1038
  retake: "v1775141914/icons/retake-icon_xgqxzv.svg",
1039
1039
  globe: "v1776851811/icons/globe.svg",
1040
+ "video-2": "v1787662089/icons/video-2.svg",
1041
+ audio: "v1787662158/icons/audio.svg",
1040
1042
  };
1041
1043
  var backgrounds = {
1042
1044
  "confetti-pink": "v1734522868/pupil-journey/confetti-pink.svg",
@@ -3875,9 +3877,6 @@ var bannerVariants = {
3875
3877
  heading: {
3876
3878
  $font: ["heading-7"],
3877
3879
  },
3878
- ctaWrapper: {
3879
- $mt: "spacing-12",
3880
- },
3881
3880
  flexDirection: "row",
3882
3881
  bannerPadding: "spacing-16",
3883
3882
  textContentGap: "spacing-4",
@@ -3893,9 +3892,6 @@ var bannerVariants = {
3893
3892
  heading: {
3894
3893
  $font: ["heading-6"],
3895
3894
  },
3896
- ctaWrapper: {
3897
- $mt: "spacing-8",
3898
- },
3899
3895
  closeButtonWrapper: {
3900
3896
  $position: "absolute",
3901
3897
  $top: "spacing-0",
@@ -3938,10 +3934,11 @@ var OakInlineBanner = function (_a) {
3938
3934
  iconLogic,
3939
3935
  canDismiss && (React__default.default.createElement(OakFlex, tslib.__assign({ "$order": 2 }, bannerVariants[variant].closeButtonWrapper),
3940
3936
  React__default.default.createElement(InternalShadowRoundButton, tslib.__assign({ "aria-label": "Dismiss banner", defaultIconBackground: "transparent", defaultIconColor: "icon-primary", defaultTextColor: "transparent", hoverTextColor: "transparent", disabledTextColor: "transparent", hoverIconBackground: "icon-primary", hoverIconColor: "icon-inverted", disabledIconBackground: "transparent", iconBackgroundSize: "spacing-24", iconSize: "spacing-24", iconName: "cross", "data-testid": "inline-banner-close-button", onClick: onDismiss }, closeButtonOverrideProps)))),
3941
- React__default.default.createElement(OakFlex, { "$order": 1, "$width": "100%", "$flexDirection": title ? "column" : "row", "$justifyContent": title ? "center" : "space-between", "$alignItems": title ? "start" : "center", "$gap": bannerVariants[variant].textContentGap },
3942
- title && (React__default.default.createElement(OakHeading, tslib.__assign({ "data-testid": "inline-banner-title", tag: titleTag }, bannerVariants[variant].heading), title)),
3943
- React__default.default.createElement(OakBox, { "$font": "body-2", "data-testid": "inline-banner-message" }, message),
3944
- cta && (React__default.default.createElement(OakFlex, tslib.__assign({}, (title ? bannerVariants[variant].ctaWrapper : {})), cta))))));
3937
+ React__default.default.createElement(OakFlex, { "$order": 1, "$flexDirection": title ? "column" : ["column", "row"], "$gap": title ? "spacing-24" : ["spacing-12", "spacing-24"], "$width": "100%", "$alignItems": "start" },
3938
+ React__default.default.createElement(OakFlex, { "$width": "100%", "$flexDirection": title ? "column" : "row", "$justifyContent": title ? "center" : "space-between", "$alignItems": title ? "start" : "center", "$gap": bannerVariants[variant].textContentGap },
3939
+ title && (React__default.default.createElement(OakHeading, tslib.__assign({ "data-testid": "inline-banner-title", tag: titleTag }, bannerVariants[variant].heading), title)),
3940
+ React__default.default.createElement(OakBox, { "$font": "body-2", "data-testid": "inline-banner-message" }, message)),
3941
+ cta && React__default.default.createElement(OakFlex, { "$flexShrink": 0 }, cta)))));
3945
3942
  };
3946
3943
 
3947
3944
  var FocusOnBox = styled__default.default(reactFocusOn.FocusOn)(templateObject_1$$ || (templateObject_1$$ = tslib.__makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), oakBoxCss);
@@ -783,6 +783,8 @@ declare const icons: {
783
783
  readonly "media-clips": "v1774884267/icons/media-clips_nw3zpt.svg";
784
784
  readonly retake: "v1775141914/icons/retake-icon_xgqxzv.svg";
785
785
  readonly globe: "v1776851811/icons/globe.svg";
786
+ readonly "video-2": "v1787662089/icons/video-2.svg";
787
+ readonly audio: "v1787662158/icons/audio.svg";
786
788
  };
787
789
  type IconName = keyof typeof icons;
788
790
 
@@ -3068,7 +3070,6 @@ type OakInlineBannerVariantProps = {
3068
3070
  loadingSpinnerDimensions: Partial<OakLoadingSpinnerProps>;
3069
3071
  heading: Partial<OakHeadingProps>;
3070
3072
  closeButtonWrapper?: Partial<OakBoxProps>;
3071
- ctaWrapper?: Partial<OakBoxProps>;
3072
3073
  flexDirection: FlexStyleProps["$flexDirection"];
3073
3074
  bannerPadding: PaddingStyleProps["$pa"];
3074
3075
  textContentGap?: FlexStyleProps["$gap"];
@@ -57,9 +57,6 @@ var bannerVariants = {
57
57
  heading: {
58
58
  $font: ["heading-7"],
59
59
  },
60
- ctaWrapper: {
61
- $mt: "spacing-12",
62
- },
63
60
  flexDirection: "row",
64
61
  bannerPadding: "spacing-16",
65
62
  textContentGap: "spacing-4",
@@ -75,9 +72,6 @@ var bannerVariants = {
75
72
  heading: {
76
73
  $font: ["heading-6"],
77
74
  },
78
- ctaWrapper: {
79
- $mt: "spacing-8",
80
- },
81
75
  closeButtonWrapper: {
82
76
  $position: "absolute",
83
77
  $top: "spacing-0",
@@ -120,10 +114,11 @@ var OakInlineBanner = function (_a) {
120
114
  iconLogic,
121
115
  canDismiss && (React.createElement(OakFlex, __assign({ "$order": 2 }, bannerVariants[variant].closeButtonWrapper),
122
116
  React.createElement(InternalShadowRoundButton, __assign({ "aria-label": "Dismiss banner", defaultIconBackground: "transparent", defaultIconColor: "icon-primary", defaultTextColor: "transparent", hoverTextColor: "transparent", disabledTextColor: "transparent", hoverIconBackground: "icon-primary", hoverIconColor: "icon-inverted", disabledIconBackground: "transparent", iconBackgroundSize: "spacing-24", iconSize: "spacing-24", iconName: "cross", "data-testid": "inline-banner-close-button", onClick: onDismiss }, closeButtonOverrideProps)))),
123
- React.createElement(OakFlex, { "$order": 1, "$width": "100%", "$flexDirection": title ? "column" : "row", "$justifyContent": title ? "center" : "space-between", "$alignItems": title ? "start" : "center", "$gap": bannerVariants[variant].textContentGap },
124
- title && (React.createElement(OakHeading, __assign({ "data-testid": "inline-banner-title", tag: titleTag }, bannerVariants[variant].heading), title)),
125
- React.createElement(OakBox, { "$font": "body-2", "data-testid": "inline-banner-message" }, message),
126
- cta && (React.createElement(OakFlex, __assign({}, (title ? bannerVariants[variant].ctaWrapper : {})), cta))))));
117
+ React.createElement(OakFlex, { "$order": 1, "$flexDirection": title ? "column" : ["column", "row"], "$gap": title ? "spacing-24" : ["spacing-12", "spacing-24"], "$width": "100%", "$alignItems": "start" },
118
+ React.createElement(OakFlex, { "$width": "100%", "$flexDirection": title ? "column" : "row", "$justifyContent": title ? "center" : "space-between", "$alignItems": title ? "start" : "center", "$gap": bannerVariants[variant].textContentGap },
119
+ title && (React.createElement(OakHeading, __assign({ "data-testid": "inline-banner-title", tag: titleTag }, bannerVariants[variant].heading), title)),
120
+ React.createElement(OakBox, { "$font": "body-2", "data-testid": "inline-banner-message" }, message)),
121
+ cta && React.createElement(OakFlex, { "$flexShrink": 0 }, cta)))));
127
122
  };
128
123
 
129
124
  export { OakInlineBanner, bannerTypes, bannerVariants };
@@ -188,6 +188,8 @@ var icons = {
188
188
  "media-clips": "v1774884267/icons/media-clips_nw3zpt.svg",
189
189
  retake: "v1775141914/icons/retake-icon_xgqxzv.svg",
190
190
  globe: "v1776851811/icons/globe.svg",
191
+ "video-2": "v1787662089/icons/video-2.svg",
192
+ audio: "v1787662158/icons/audio.svg",
191
193
  };
192
194
  var backgrounds = {
193
195
  "confetti-pink": "v1734522868/pupil-journey/confetti-pink.svg",
@@ -783,6 +783,8 @@ declare const icons: {
783
783
  readonly "media-clips": "v1774884267/icons/media-clips_nw3zpt.svg";
784
784
  readonly retake: "v1775141914/icons/retake-icon_xgqxzv.svg";
785
785
  readonly globe: "v1776851811/icons/globe.svg";
786
+ readonly "video-2": "v1787662089/icons/video-2.svg";
787
+ readonly audio: "v1787662158/icons/audio.svg";
786
788
  };
787
789
  type IconName = keyof typeof icons;
788
790
 
@@ -3068,7 +3070,6 @@ type OakInlineBannerVariantProps = {
3068
3070
  loadingSpinnerDimensions: Partial<OakLoadingSpinnerProps>;
3069
3071
  heading: Partial<OakHeadingProps>;
3070
3072
  closeButtonWrapper?: Partial<OakBoxProps>;
3071
- ctaWrapper?: Partial<OakBoxProps>;
3072
3073
  flexDirection: FlexStyleProps["$flexDirection"];
3073
3074
  bannerPadding: PaddingStyleProps["$pa"];
3074
3075
  textContentGap?: FlexStyleProps["$gap"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oaknational/oak-components",
3
- "version": "3.11.0",
3
+ "version": "3.12.1",
4
4
  "licence": "MIT",
5
5
  "packageManager": "pnpm@11.2.0",
6
6
  "description": "Shared components for Oak applications",
@@ -27,6 +27,7 @@
27
27
  "test": "jest --watch --collectCoverage=false",
28
28
  "test:snapshot": "jest --collectCoverage=false --updateSnapshot",
29
29
  "test:ci": "jest",
30
+ "test:storybook": "test-storybook",
30
31
  "check-types": "tsc",
31
32
  "format": "prettier '**/*.{j,t}{s,sx}' --write",
32
33
  "format:precommit": "prettier '**/*.{j,t}{s,sx}' --write",
@@ -85,6 +86,7 @@
85
86
  "@storybook/addon-onboarding": "9.1.20",
86
87
  "@storybook/addon-themes": "9.1.20",
87
88
  "@storybook/nextjs": "9.1.20",
89
+ "@storybook/test-runner": "^0.24.4",
88
90
  "@testing-library/jest-dom": "^6.9.1",
89
91
  "@testing-library/react": "^16.3.2",
90
92
  "@testing-library/user-event": "^14.6.1",
@@ -121,6 +123,7 @@
121
123
  "jest-util": "^30.3.0",
122
124
  "jscodeshift": "^17.3.0",
123
125
  "knip": "^6.4.1",
126
+ "playwright": "^1.61.1",
124
127
  "prettier": "^3.8.3",
125
128
  "react": "^18.2.0",
126
129
  "react-compiler-runtime": "^1.0.0",