@oaknational/oak-components 3.5.0 → 3.6.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 +36 -4
- package/dist/npm/cjs/types.d.ts +3 -2
- package/dist/npm/es/components/layout-and-structure/OakPortableText/OakPortableText.js +25 -0
- package/dist/npm/es/components/presentational/OakVideo/OakVideo.js +15 -4
- package/dist/npm/es/types.d.ts +3 -2
- package/package.json +10 -1
package/dist/npm/cjs/index.js
CHANGED
|
@@ -12,6 +12,7 @@ var core = require('@dnd-kit/core');
|
|
|
12
12
|
var sortable = require('@dnd-kit/sortable');
|
|
13
13
|
var utilities = require('@dnd-kit/utilities');
|
|
14
14
|
var nextCloudinary = require('next-cloudinary');
|
|
15
|
+
var react = require('@portabletext/react');
|
|
15
16
|
|
|
16
17
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
18
|
|
|
@@ -7573,6 +7574,27 @@ var OakQuote = function (_a) {
|
|
|
7573
7574
|
};
|
|
7574
7575
|
var templateObject_1$4, templateObject_2;
|
|
7575
7576
|
|
|
7577
|
+
/**
|
|
7578
|
+
* This component will provide a default maxWidth and ph value, it take Flex props.
|
|
7579
|
+
* ## Usage
|
|
7580
|
+
* Use this component on pages to limit the max-width to a specific container.
|
|
7581
|
+
* This will make it easier to create full browser width or custom width containers on the same page
|
|
7582
|
+
* with different background colors / image url.
|
|
7583
|
+
*/
|
|
7584
|
+
function OakPortableText(_a) {
|
|
7585
|
+
var value = _a.value, _b = _a.components, paragraph = _b.paragraph, strong = _b.strong, em = _b.em;
|
|
7586
|
+
return (React__default.default.createElement(react.PortableText, { value: value, components: {
|
|
7587
|
+
block: {
|
|
7588
|
+
normal: paragraph,
|
|
7589
|
+
},
|
|
7590
|
+
types: {},
|
|
7591
|
+
marks: {
|
|
7592
|
+
strong: strong,
|
|
7593
|
+
em: em,
|
|
7594
|
+
},
|
|
7595
|
+
} }));
|
|
7596
|
+
}
|
|
7597
|
+
|
|
7576
7598
|
/**
|
|
7577
7599
|
* Video component with controls to standardise layout across use
|
|
7578
7600
|
*/
|
|
@@ -7587,7 +7609,13 @@ function OakVideo(_a) {
|
|
|
7587
7609
|
React__default.default.createElement(OakBox, { "$aspectRatio": "16/9" }, videoSlot)),
|
|
7588
7610
|
React__default.default.createElement(OakFlex, { "$flexDirection": "column", "$gap": "spacing-8", "$display": !heading && !body ? "none" : undefined },
|
|
7589
7611
|
heading && (React__default.default.createElement(OakHeading, { tag: headingTag, "$color": "text-primary", "$font": ["heading-5", "heading-4", "heading-4"] }, heading)),
|
|
7590
|
-
body && (React__default.default.createElement(
|
|
7612
|
+
Array.isArray(body) && (React__default.default.createElement(OakPortableText, { value: body, components: {
|
|
7613
|
+
paragraph: function (_a) {
|
|
7614
|
+
var children = _a.children;
|
|
7615
|
+
return (React__default.default.createElement(OakP, { "$color": "text-primary", "$font": ["body-2", "body-1", "body-1"] }, children));
|
|
7616
|
+
},
|
|
7617
|
+
} })),
|
|
7618
|
+
!Array.isArray(body) && (React__default.default.createElement(OakP, { "$color": "text-primary", "$font": ["body-2", "body-1", "body-1"] }, body))),
|
|
7591
7619
|
hasButtonsEnabled && (React__default.default.createElement(OakFlex, { "$flexDirection": "row", "$gap": ["spacing-16"], "$flexWrap": ["wrap", "nowrap", "nowrap"] },
|
|
7592
7620
|
transcriptEnabled && (React__default.default.createElement(OakFlex, { "$order": ["2", "1", "1"] },
|
|
7593
7621
|
React__default.default.createElement(OakSmallSecondaryButton, { isTrailingIcon: true, iconName: isTranscriptOpen ? "chevron-up" : "chevron-down", onClick: function () { return setIsTranscriptOpen(!isTranscriptOpen); }, "aria-controls": transcriptId, "aria-expanded": isTranscriptOpen },
|
|
@@ -7598,9 +7626,13 @@ function OakVideo(_a) {
|
|
|
7598
7626
|
showSignLanguage && (React__default.default.createElement(OakFlex, { "$order": ["1", "3", "3"], "$width": ["100%", "auto", "auto"] },
|
|
7599
7627
|
React__default.default.createElement(OakSmallSecondaryButton, { isTrailingIcon: true, onClick: onShowSignLanguage, iconName: "sign-language" }, "Show sign language"))))),
|
|
7600
7628
|
transcriptEnabled && (React__default.default.createElement(OakFlex, { "data-testid": "oak-video-transcript-container", id: transcriptId, "$display": !isTranscriptOpen ? "none" : undefined, "$height": "spacing-360", "$background": "bg-neutral-stronger", "$pa": "spacing-16", "$borderRadius": "border-radius-s", "$gap": "spacing-32", "$flexDirection": "column" },
|
|
7601
|
-
React__default.default.createElement(OakFlex, { "$gap": "spacing-8", "$overflowY": "auto", "$flexDirection": "column" },
|
|
7602
|
-
|
|
7603
|
-
|
|
7629
|
+
React__default.default.createElement(OakFlex, { "$gap": "spacing-8", "$overflowY": "auto", "$flexDirection": "column" },
|
|
7630
|
+
React__default.default.createElement(OakPortableText, { value: transcript, components: {
|
|
7631
|
+
paragraph: function (_a) {
|
|
7632
|
+
var children = _a.children;
|
|
7633
|
+
return (React__default.default.createElement(OakP, { "$color": "text-primary", "$font": "body-1" }, children));
|
|
7634
|
+
},
|
|
7635
|
+
} }))))));
|
|
7604
7636
|
}
|
|
7605
7637
|
|
|
7606
7638
|
var StyledAccordionButton = styled__default.default(InternalAccordionButton)(templateObject_1$3 || (templateObject_1$3 = tslib.__makeTemplateObject(["\n ", "\n ", "\n &:hover {\n .chevron-icon {\n filter: ", ";\n }\n }\n &:focus-visible {\n .focus-outline {\n box-shadow:\n ", ",\n ", ";\n }\n }\n"], ["\n ", "\n ", "\n &:hover {\n .chevron-icon {\n filter: ", ";\n }\n }\n &:focus-visible {\n .focus-outline {\n box-shadow:\n ", ",\n ", ";\n }\n }\n"])), flexStyle, oakBoxCss, parseColorFilter("icon-subdued"), parseDropShadow("drop-shadow-centered-lemon"), parseDropShadow("drop-shadow-centered-grey"));
|
package/dist/npm/cjs/types.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import Image, { ImageProps as ImageProps$1 } from 'next/image';
|
|
|
5
5
|
import { UrlObject } from 'url';
|
|
6
6
|
import { Announcements } from '@dnd-kit/core';
|
|
7
7
|
import { CldImage } from 'next-cloudinary';
|
|
8
|
+
import { PortableTextBlock } from '@portabletext/react';
|
|
8
9
|
|
|
9
10
|
declare const oakColorTokens: {
|
|
10
11
|
white: string;
|
|
@@ -5197,7 +5198,7 @@ type OakVideoProps = {
|
|
|
5197
5198
|
/**
|
|
5198
5199
|
* The body text to display below the heading and above the video.
|
|
5199
5200
|
*/
|
|
5200
|
-
body?: string;
|
|
5201
|
+
body?: string | PortableTextBlock[];
|
|
5201
5202
|
/**
|
|
5202
5203
|
* The video slot to display. This is a React node that can be any valid React element.
|
|
5203
5204
|
*/
|
|
@@ -5205,7 +5206,7 @@ type OakVideoProps = {
|
|
|
5205
5206
|
/**
|
|
5206
5207
|
* The transcript to display below the video.
|
|
5207
5208
|
*/
|
|
5208
|
-
transcript?:
|
|
5209
|
+
transcript?: PortableTextBlock[];
|
|
5209
5210
|
/**
|
|
5210
5211
|
* Whether to show the transcript button.
|
|
5211
5212
|
*/
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PortableText } from '@portabletext/react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This component will provide a default maxWidth and ph value, it take Flex props.
|
|
6
|
+
* ## Usage
|
|
7
|
+
* Use this component on pages to limit the max-width to a specific container.
|
|
8
|
+
* This will make it easier to create full browser width or custom width containers on the same page
|
|
9
|
+
* with different background colors / image url.
|
|
10
|
+
*/
|
|
11
|
+
function OakPortableText(_a) {
|
|
12
|
+
var value = _a.value, _b = _a.components, paragraph = _b.paragraph, strong = _b.strong, em = _b.em;
|
|
13
|
+
return (React.createElement(PortableText, { value: value, components: {
|
|
14
|
+
block: {
|
|
15
|
+
normal: paragraph,
|
|
16
|
+
},
|
|
17
|
+
types: {},
|
|
18
|
+
marks: {
|
|
19
|
+
strong: strong,
|
|
20
|
+
em: em,
|
|
21
|
+
},
|
|
22
|
+
} }));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { OakPortableText };
|
|
@@ -24,6 +24,7 @@ import { OakP } from '../../typography/OakP/OakP.js';
|
|
|
24
24
|
import '../../typography/OakSpan/OakSpan.js';
|
|
25
25
|
import '../../typography/OakTypography/OakTypography.js';
|
|
26
26
|
import '../../typography/OakUL/OakUL.js';
|
|
27
|
+
import { OakPortableText } from '../../layout-and-structure/OakPortableText/OakPortableText.js';
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* Video component with controls to standardise layout across use
|
|
@@ -39,7 +40,13 @@ function OakVideo(_a) {
|
|
|
39
40
|
React.createElement(OakBox, { "$aspectRatio": "16/9" }, videoSlot)),
|
|
40
41
|
React.createElement(OakFlex, { "$flexDirection": "column", "$gap": "spacing-8", "$display": !heading && !body ? "none" : undefined },
|
|
41
42
|
heading && (React.createElement(OakHeading, { tag: headingTag, "$color": "text-primary", "$font": ["heading-5", "heading-4", "heading-4"] }, heading)),
|
|
42
|
-
body && (React.createElement(
|
|
43
|
+
Array.isArray(body) && (React.createElement(OakPortableText, { value: body, components: {
|
|
44
|
+
paragraph: function (_a) {
|
|
45
|
+
var children = _a.children;
|
|
46
|
+
return (React.createElement(OakP, { "$color": "text-primary", "$font": ["body-2", "body-1", "body-1"] }, children));
|
|
47
|
+
},
|
|
48
|
+
} })),
|
|
49
|
+
!Array.isArray(body) && (React.createElement(OakP, { "$color": "text-primary", "$font": ["body-2", "body-1", "body-1"] }, body))),
|
|
43
50
|
hasButtonsEnabled && (React.createElement(OakFlex, { "$flexDirection": "row", "$gap": ["spacing-16"], "$flexWrap": ["wrap", "nowrap", "nowrap"] },
|
|
44
51
|
transcriptEnabled && (React.createElement(OakFlex, { "$order": ["2", "1", "1"] },
|
|
45
52
|
React.createElement(OakSmallSecondaryButton, { isTrailingIcon: true, iconName: isTranscriptOpen ? "chevron-up" : "chevron-down", onClick: function () { return setIsTranscriptOpen(!isTranscriptOpen); }, "aria-controls": transcriptId, "aria-expanded": isTranscriptOpen },
|
|
@@ -50,9 +57,13 @@ function OakVideo(_a) {
|
|
|
50
57
|
showSignLanguage && (React.createElement(OakFlex, { "$order": ["1", "3", "3"], "$width": ["100%", "auto", "auto"] },
|
|
51
58
|
React.createElement(OakSmallSecondaryButton, { isTrailingIcon: true, onClick: onShowSignLanguage, iconName: "sign-language" }, "Show sign language"))))),
|
|
52
59
|
transcriptEnabled && (React.createElement(OakFlex, { "data-testid": "oak-video-transcript-container", id: transcriptId, "$display": !isTranscriptOpen ? "none" : undefined, "$height": "spacing-360", "$background": "bg-neutral-stronger", "$pa": "spacing-16", "$borderRadius": "border-radius-s", "$gap": "spacing-32", "$flexDirection": "column" },
|
|
53
|
-
React.createElement(OakFlex, { "$gap": "spacing-8", "$overflowY": "auto", "$flexDirection": "column" },
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
React.createElement(OakFlex, { "$gap": "spacing-8", "$overflowY": "auto", "$flexDirection": "column" },
|
|
61
|
+
React.createElement(OakPortableText, { value: transcript, components: {
|
|
62
|
+
paragraph: function (_a) {
|
|
63
|
+
var children = _a.children;
|
|
64
|
+
return (React.createElement(OakP, { "$color": "text-primary", "$font": "body-1" }, children));
|
|
65
|
+
},
|
|
66
|
+
} }))))));
|
|
56
67
|
}
|
|
57
68
|
|
|
58
69
|
export { OakVideo };
|
package/dist/npm/es/types.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import Image, { ImageProps as ImageProps$1 } from 'next/image';
|
|
|
5
5
|
import { UrlObject } from 'url';
|
|
6
6
|
import { Announcements } from '@dnd-kit/core';
|
|
7
7
|
import { CldImage } from 'next-cloudinary';
|
|
8
|
+
import { PortableTextBlock } from '@portabletext/react';
|
|
8
9
|
|
|
9
10
|
declare const oakColorTokens: {
|
|
10
11
|
white: string;
|
|
@@ -5197,7 +5198,7 @@ type OakVideoProps = {
|
|
|
5197
5198
|
/**
|
|
5198
5199
|
* The body text to display below the heading and above the video.
|
|
5199
5200
|
*/
|
|
5200
|
-
body?: string;
|
|
5201
|
+
body?: string | PortableTextBlock[];
|
|
5201
5202
|
/**
|
|
5202
5203
|
* The video slot to display. This is a React node that can be any valid React element.
|
|
5203
5204
|
*/
|
|
@@ -5205,7 +5206,7 @@ type OakVideoProps = {
|
|
|
5205
5206
|
/**
|
|
5206
5207
|
* The transcript to display below the video.
|
|
5207
5208
|
*/
|
|
5208
|
-
transcript?:
|
|
5209
|
+
transcript?: PortableTextBlock[];
|
|
5209
5210
|
/**
|
|
5210
5211
|
* Whether to show the transcript button.
|
|
5211
5212
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oaknational/oak-components",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"licence": "MIT",
|
|
5
5
|
"packageManager": "pnpm@11.2.0",
|
|
6
6
|
"description": "Shared components for Oak applications",
|
|
@@ -58,12 +58,18 @@
|
|
|
58
58
|
"@dnd-kit/core": "^6.3.1",
|
|
59
59
|
"@dnd-kit/sortable": "^10.0.0",
|
|
60
60
|
"@dnd-kit/utilities": "^3.2.2",
|
|
61
|
+
"@portabletext/react": "^7.0.1",
|
|
61
62
|
"@tiptap/react": "^2.11.0",
|
|
62
63
|
"react-focus-on": "^3.10.2",
|
|
63
64
|
"react-transition-group": "^4.4.5",
|
|
64
65
|
"url": "^0.11.4"
|
|
65
66
|
},
|
|
66
67
|
"devDependencies": {
|
|
68
|
+
"@babel/plugin-transform-runtime": "^8.0.1",
|
|
69
|
+
"@babel/preset-env": "^8.0.2",
|
|
70
|
+
"@babel/preset-react": "^8.0.1",
|
|
71
|
+
"@babel/preset-typescript": "^8.0.1",
|
|
72
|
+
"@babel/runtime": "^8.0.0",
|
|
67
73
|
"@commitlint/cli": "^18.4.4",
|
|
68
74
|
"@commitlint/config-conventional": "^18.4.4",
|
|
69
75
|
"@rollup/plugin-commonjs": "^29.0.2",
|
|
@@ -96,6 +102,8 @@
|
|
|
96
102
|
"@typescript-eslint/eslint-plugin": "^6.18.1",
|
|
97
103
|
"@typescript-eslint/parser": "^6.18.1",
|
|
98
104
|
"assert": "^2.1.0",
|
|
105
|
+
"babel-jest": "^30.4.1",
|
|
106
|
+
"babel-plugin-module-resolver": "^5.0.3",
|
|
99
107
|
"eslint": "^8.56.0",
|
|
100
108
|
"eslint-config-prettier": "^9.1.0",
|
|
101
109
|
"eslint-import-resolver-typescript": "^3.6.1",
|
|
@@ -115,6 +123,7 @@
|
|
|
115
123
|
"knip": "^6.4.1",
|
|
116
124
|
"prettier": "^3.8.3",
|
|
117
125
|
"react": "^18.2.0",
|
|
126
|
+
"react-compiler-runtime": "^1.0.0",
|
|
118
127
|
"react-dom": "^18.2.0",
|
|
119
128
|
"rollup": "^4.60.1",
|
|
120
129
|
"rollup-plugin-dts": "^6.4.1",
|