@oaknational/oak-components 3.14.3 → 3.15.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 +17 -11
- package/dist/npm/cjs/types.d.ts +10 -0
- package/dist/npm/es/components/messaging-and-feedback/OakErrorBoundary/OakErrorBoundary.js +13 -0
- package/dist/npm/es/components/navigation/OakTabs/OakTabs.js +12 -0
- package/dist/npm/es/components/owa/OakResourceCard/OakResourceCard.js +14 -8
- package/dist/npm/es/components/owa/teacher/OakResourcesAccordion/OakResourcesAccordion.js +3 -3
- package/dist/npm/es/types.d.ts +10 -0
- package/package.json +8 -7
package/dist/npm/cjs/index.js
CHANGED
|
@@ -4679,13 +4679,13 @@ var StyledAccordionButton$2 = styled__default.default(InternalAccordionButton)(t
|
|
|
4679
4679
|
* Internal accordion component that handles the accordion logic
|
|
4680
4680
|
*/
|
|
4681
4681
|
var Accordion$2 = function (_a) {
|
|
4682
|
-
var children = _a.children, id = _a.id, selectAllChecked = _a.selectAllChecked, subheading = _a.subheading, handleToggleSelectAll = _a.handleToggleSelectAll, styleProps = tslib.__rest(_a, ["children", "id", "selectAllChecked", "subheading", "handleToggleSelectAll"]);
|
|
4682
|
+
var children = _a.children, id = _a.id, selectAllChecked = _a.selectAllChecked, subheading = _a.subheading, _b = _a.showCheckbox, showCheckbox = _b === void 0 ? true : _b, handleToggleSelectAll = _a.handleToggleSelectAll, styleProps = tslib.__rest(_a, ["children", "id", "selectAllChecked", "subheading", "showCheckbox", "handleToggleSelectAll"]);
|
|
4683
4683
|
var isOpen = useAccordionContext().isOpen;
|
|
4684
4684
|
return (React__default.default.createElement(OakFlex, tslib.__assign({ "$bt": "border-solid-s", "$bb": isOpen ? "border-solid-none" : "border-solid-s", "$borderColor": "border-neutral-lighter", "$pv": "spacing-12", "$flexDirection": "column", "$width": "100%" }, styleProps),
|
|
4685
4685
|
React__default.default.createElement(OakFlex, { "$alignItems": "center", "$width": "100%" },
|
|
4686
4686
|
React__default.default.createElement(OakFlex, { "$alignItems": "center", "$width": "100%", "$gap": "spacing-16" },
|
|
4687
|
-
React__default.default.createElement(OakBox, { id: "select-all-wrapper", "$pa": "spacing-8", onClick: handleToggleSelectAll },
|
|
4688
|
-
React__default.default.createElement(OakCheckBox, { onChange: function () { return undefined; }, checked: selectAllChecked, id: "select-all", name: "select-all", value: "", "aria-labelledby": "resources-accordion-heading" })),
|
|
4687
|
+
showCheckbox ? (React__default.default.createElement(OakBox, { id: "select-all-wrapper", "$pa": "spacing-8", onClick: handleToggleSelectAll },
|
|
4688
|
+
React__default.default.createElement(OakCheckBox, { onChange: function () { return undefined; }, checked: selectAllChecked, id: "select-all", name: "select-all", value: "", "aria-labelledby": "resources-accordion-heading" }))) : null,
|
|
4689
4689
|
React__default.default.createElement(StyledAccordionButton$2, { "$justifyContent": "space-between", "$flexGrow": 1, id: id, "$alignItems": "center", "$mr": "spacing-12" },
|
|
4690
4690
|
React__default.default.createElement(OakFlex, { "$justifyContent": "center", "$alignItems": "center", "$gap": "spacing-12" },
|
|
4691
4691
|
React__default.default.createElement(OakFlex, { "$flexDirection": "column", "$justifyContent": "center", "$alignItems": "start" },
|
|
@@ -6859,9 +6859,15 @@ var MultipleIcons = function (_a) {
|
|
|
6859
6859
|
return (React__default.default.createElement(OakFlex, { "$background": "bg-decorative5-main", "$pa": "spacing-12", "$alignItems": "center", "$flexDirection": "column", "$gap": "spacing-16", "$justifyContent": "center" }, iconName.map(function (name, index) { return (React__default.default.createElement(OakFlex, { key: "".concat(name, "-").concat(index), "$position": "relative", "$alignContent": "center", "$alignItems": "center", "$justifyContent": "center" },
|
|
6860
6860
|
React__default.default.createElement(OakIcon, { iconName: name, "$width": "spacing-40", "$height": "spacing-40", "$mr": index < iconName.length - 1 ? "spacing-8" : "spacing-0" }))); })));
|
|
6861
6861
|
};
|
|
6862
|
-
var LabelContainer = styled__default.default("label")(templateObject_1$j || (templateObject_1$j = tslib.__makeTemplateObject(["\n flex: 1;\n cursor:
|
|
6863
|
-
var Container = styled__default.default(OakFlex)(templateObject_2$8 || (templateObject_2$8 = tslib.__makeTemplateObject(["\n &:has(input:focus-visible) {\n box-shadow:\n ", ",\n ", ";\n }\n\n @media (hover: hover) {\n &:hover:not(:has(input:disabled), :active) {\n background: ", ";\n #resource-card-title {\n text-decoration:
|
|
6864
|
-
return props.$
|
|
6862
|
+
var LabelContainer = styled__default.default("label")(templateObject_1$j || (templateObject_1$j = tslib.__makeTemplateObject(["\n flex: 1;\n cursor: ", ";\n display: flex;\n\n &:has(input:disabled) {\n cursor: default;\n #resource-card-title {\n text-decoration: none;\n }\n }\n"], ["\n flex: 1;\n cursor: ", ";\n display: flex;\n\n &:has(input:disabled) {\n cursor: default;\n #resource-card-title {\n text-decoration: none;\n }\n }\n"])), function (props) { return (props.$showSelectionControl ? "pointer" : "default"); });
|
|
6863
|
+
var Container = styled__default.default(OakFlex)(templateObject_2$8 || (templateObject_2$8 = tslib.__makeTemplateObject(["\n &:has(input:focus-visible) {\n box-shadow:\n ", ",\n ", ";\n }\n\n @media (hover: hover) {\n &:hover:not(:has(input:disabled), :active) {\n background: ", ";\n #resource-card-title {\n text-decoration: ", ";\n }\n }\n\n &:hover:active:not(:has(input:disabled)) {\n #resource-card-title {\n text-decoration: ", ";\n }\n }\n }\n"], ["\n &:has(input:focus-visible) {\n box-shadow:\n ", ",\n ", ";\n }\n\n @media (hover: hover) {\n &:hover:not(:has(input:disabled), :active) {\n background: ", ";\n #resource-card-title {\n text-decoration: ", ";\n }\n }\n\n &:hover:active:not(:has(input:disabled)) {\n #resource-card-title {\n text-decoration: ", ";\n }\n }\n }\n"])), parseDropShadow("drop-shadow-centered-lemon"), parseDropShadow("drop-shadow-centered-grey"), function (props) {
|
|
6864
|
+
return props.$showSelectionControl
|
|
6865
|
+
? parseColor("bg-btn-secondary-hover")
|
|
6866
|
+
: parseColor("bg-primary");
|
|
6867
|
+
}, function (props) {
|
|
6868
|
+
return props.$showSelectionControl ? "underline" : "none";
|
|
6869
|
+
}, function (props) {
|
|
6870
|
+
return props.$showSelectionControl ? "underline" : "none";
|
|
6865
6871
|
});
|
|
6866
6872
|
/**
|
|
6867
6873
|
* Resource cards present a downloadable/shareable resource with metadata and a selectable control.
|
|
@@ -6875,7 +6881,7 @@ var Container = styled__default.default(OakFlex)(templateObject_2$8 || (template
|
|
|
6875
6881
|
var OakResourceCard = function (props) {
|
|
6876
6882
|
var _a;
|
|
6877
6883
|
var radioContext = React.useContext(RadioContext);
|
|
6878
|
-
var title = props.title, fileSize = props.fileSize, description = props.description, iconName = props.iconName, value = props.value, _b = props.disabled, disabled = _b === void 0 ? false : _b, defaultChecked = props.defaultChecked, checked = props.checked, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, onHovered = props.onHovered, _c = props.isRadio, isRadio =
|
|
6884
|
+
var title = props.title, fileSize = props.fileSize, description = props.description, iconName = props.iconName, value = props.value, _b = props.disabled, disabled = _b === void 0 ? false : _b, defaultChecked = props.defaultChecked, checked = props.checked, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, onHovered = props.onHovered, _c = props.showSelectionControl, showSelectionControl = _c === void 0 ? true : _c, _d = props.isRadio, isRadio = _d === void 0 ? false : _d, dataTestId = props["data-testid"], _e = props.isEditable, isEditable = _e === void 0 ? false : _e, rest = tslib.__rest(props, ["title", "fileSize", "description", "iconName", "value", "disabled", "defaultChecked", "checked", "onChange", "onFocus", "onBlur", "onHovered", "showSelectionControl", "isRadio", "data-testid", "isEditable"]);
|
|
6879
6885
|
var checkboxSize = "spacing-24";
|
|
6880
6886
|
var checkedBorderColor = "border-primary";
|
|
6881
6887
|
var disabledColor = "text-disabled";
|
|
@@ -6894,8 +6900,8 @@ var OakResourceCard = function (props) {
|
|
|
6894
6900
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
6895
6901
|
};
|
|
6896
6902
|
var isMultipleIcon = Array.isArray(iconName);
|
|
6897
|
-
return (React__default.default.createElement(Container, { "data-testid": dataTestId, "$background": "bg-primary", "$ba": "border-solid-m", "$borderRadius": "border-radius-s", "$overflow": "hidden", "$
|
|
6898
|
-
React__default.default.createElement(LabelContainer,
|
|
6903
|
+
return (React__default.default.createElement(Container, { "data-testid": dataTestId, "$background": "bg-primary", "$ba": "border-solid-m", "$borderRadius": "border-radius-s", "$overflow": "hidden", "$showSelectionControl": showSelectionControl, "$color": "text-primary", "$width": "100%" },
|
|
6904
|
+
React__default.default.createElement(LabelContainer, { "$showSelectionControl": showSelectionControl },
|
|
6899
6905
|
React__default.default.createElement(OakFlex, { "$alignItems": "stretch", "$flexGrow": 1 },
|
|
6900
6906
|
isMultipleIcon ? (React__default.default.createElement(MultipleIcons, { iconName: iconName })) : (React__default.default.createElement(SingleIcon, { iconName: iconName })),
|
|
6901
6907
|
React__default.default.createElement(OakFlex, { "$flexGrow": 1, "$flexDirection": "column", "$justifyContent": "center", "$gap": "spacing-4", "$pv": "spacing-12", "$ph": "spacing-16" },
|
|
@@ -6906,8 +6912,8 @@ var OakResourceCard = function (props) {
|
|
|
6906
6912
|
isEditable && (React__default.default.createElement(OakTagFunctional, { "$alignSelf": "flex-end", "$font": "heading-light-7", label: "Editable", "$background": "bg-decorative2-main" }))))),
|
|
6907
6913
|
React__default.default.createElement(OakFlex, null,
|
|
6908
6914
|
React__default.default.createElement(OakFlex, { "$alignItems": "center", "$pr": "spacing-16" },
|
|
6909
|
-
isRadio && (React__default.default.createElement(InternalRadioWrapper, { checked: isChecked, size: checkboxSize, disabled: anyDisabled, radioBorderColor: checkedBorderColor, internalRadio: React__default.default.createElement(InternalRadio, tslib.__assign({}, rest, { id: props.id, name: (_a = props.name) !== null && _a !== void 0 ? _a : radioContext.name, value: value, disabled: anyDisabled, onHovered: onHovered, onChange: handleRadioChange, onFocus: onFocus, onBlur: onBlur, defaultChecked: defaultChecked, checked: radioChecked })) })),
|
|
6910
|
-
!isRadio && (React__default.default.createElement(InternalCheckBoxWrapper, { size: checkboxSize, internalCheckbox: React__default.default.createElement(InternalCheckBoxHoverFocus, tslib.__assign({ name: radioContext.name, value: value, "$width": checkboxSize, "$height": checkboxSize, "$ba": "border-solid-m", "$borderRadius": "border-radius-xs", "$borderColor": "text-primary", "$checkedBackground": currentCheckedBackgroundFill, "$checkedBorderColor": currentCheckedBorderColor, "$uncheckedBorderColor": "border-neutral", "$hoverBorderRadius": "border-radius-xs", onHovered: onHovered, onChange: onChange, onFocus: onFocus, onBlur: onBlur, defaultChecked: defaultChecked, checked: checked, disabled: anyDisabled }, rest)), iconPadding: "spacing-0" })))))));
|
|
6915
|
+
showSelectionControl && isRadio && (React__default.default.createElement(InternalRadioWrapper, { checked: isChecked, size: checkboxSize, disabled: anyDisabled, radioBorderColor: checkedBorderColor, internalRadio: React__default.default.createElement(InternalRadio, tslib.__assign({}, rest, { id: props.id, name: (_a = props.name) !== null && _a !== void 0 ? _a : radioContext.name, value: value, disabled: anyDisabled, onHovered: onHovered, onChange: handleRadioChange, onFocus: onFocus, onBlur: onBlur, defaultChecked: defaultChecked, checked: radioChecked })) })),
|
|
6916
|
+
showSelectionControl && !isRadio && (React__default.default.createElement(InternalCheckBoxWrapper, { size: checkboxSize, internalCheckbox: React__default.default.createElement(InternalCheckBoxHoverFocus, tslib.__assign({ name: radioContext.name, value: value, "$width": checkboxSize, "$height": checkboxSize, "$ba": "border-solid-m", "$borderRadius": "border-radius-xs", "$borderColor": "text-primary", "$checkedBackground": currentCheckedBackgroundFill, "$checkedBorderColor": currentCheckedBorderColor, "$uncheckedBorderColor": "border-neutral", "$hoverBorderRadius": "border-radius-xs", onHovered: onHovered, onChange: onChange, onFocus: onFocus, onBlur: onBlur, defaultChecked: defaultChecked, checked: checked, disabled: anyDisabled }, rest)), iconPadding: "spacing-0" })))))));
|
|
6911
6917
|
};
|
|
6912
6918
|
var templateObject_1$j, templateObject_2$8;
|
|
6913
6919
|
|
package/dist/npm/cjs/types.d.ts
CHANGED
|
@@ -3621,6 +3621,10 @@ type OakResourcesAccordionProps = {
|
|
|
3621
3621
|
* Whether the accordion starts in the open state, defaults to false
|
|
3622
3622
|
*/
|
|
3623
3623
|
initialOpen?: boolean;
|
|
3624
|
+
/**
|
|
3625
|
+
* Whether to show the select all checkbox
|
|
3626
|
+
*/
|
|
3627
|
+
showCheckbox?: boolean;
|
|
3624
3628
|
} & FlexStyleProps & OakBoxProps & ColorStyleProps;
|
|
3625
3629
|
/**
|
|
3626
3630
|
* OakResourcesAccordion renamed from OakDownloadsAccordion.
|
|
@@ -4453,6 +4457,12 @@ type OakResourceCardProps = BaseCheckBoxProps & {
|
|
|
4453
4457
|
* The icon used to represent the resource type.
|
|
4454
4458
|
*/
|
|
4455
4459
|
iconName: IconName | IconName[];
|
|
4460
|
+
/**
|
|
4461
|
+
* Whether to show the selection control (checkbox or radio button).
|
|
4462
|
+
*
|
|
4463
|
+
* @default true
|
|
4464
|
+
*/
|
|
4465
|
+
showSelectionControl?: boolean;
|
|
4456
4466
|
/**
|
|
4457
4467
|
* If true, renders the selection control as a radio button instead of a checkbox.
|
|
4458
4468
|
*
|
|
@@ -14,8 +14,21 @@ import '../../images-and-icons/OakImage/OakImage.js';
|
|
|
14
14
|
import '../../images-and-icons/OakSvg/OakSvg.js';
|
|
15
15
|
import '../../images-and-icons/OakHandDrawnHR/OakHandDrawnHR.js';
|
|
16
16
|
import { OakHeading } from '../../typography/OakHeading/OakHeading.js';
|
|
17
|
+
import '../../typography/OakLI/OakLI.js';
|
|
18
|
+
import '../../typography/OakOL/OakOL.js';
|
|
17
19
|
import { OakP } from '../../typography/OakP/OakP.js';
|
|
20
|
+
import '../../typography/OakSpan/OakSpan.js';
|
|
21
|
+
import '../../typography/OakTypography/OakTypography.js';
|
|
22
|
+
import '../../typography/OakUL/OakUL.js';
|
|
23
|
+
import '../../buttons/OakButtonWithDropdown/OakButtonWithDropdown.js';
|
|
24
|
+
import '../../buttons/OakButtonWithDropdown/OakButtonWithDropdownProvider.js';
|
|
25
|
+
import '../../internal-components/InternalShadowRoundButton/InternalShadowRoundButton.js';
|
|
26
|
+
import '../../internal-components/InternalShadowRectButton/InternalShadowRectButton.js';
|
|
18
27
|
import { OakSecondaryButton } from '../../buttons/OakSecondaryButton/OakSecondaryButton.js';
|
|
28
|
+
import '../../buttons/OakSecondaryButtonWithDropdown/OakSecondaryButtonWithDropdown.js';
|
|
29
|
+
import '../../buttons/OakSmallSecondaryButtonWithDropdown/OakSmallSecondaryButtonWithDropdown.js';
|
|
30
|
+
import '../../internal-components/InternalShadowIconButton/InternalShadowIconButton.js';
|
|
31
|
+
import '../../buttons/OakLeftAlignedButton/OakLeftAlignedButton.js';
|
|
19
32
|
|
|
20
33
|
var OakErrorBoundaryBorderColor = createContext("border-neutral-lighter");
|
|
21
34
|
/**
|
|
@@ -21,7 +21,19 @@ import '../../typography/OakP/OakP.js';
|
|
|
21
21
|
import { OakSpan } from '../../typography/OakSpan/OakSpan.js';
|
|
22
22
|
import '../../typography/OakTypography/OakTypography.js';
|
|
23
23
|
import { OakUL } from '../../typography/OakUL/OakUL.js';
|
|
24
|
+
import '../../messaging-and-feedback/OakScreenReader/OakScreenReader.js';
|
|
25
|
+
import '../../messaging-and-feedback/OakInformativeModal/OakInformativeModal.js';
|
|
26
|
+
import '../../messaging-and-feedback/OakLoadingSpinner/OakLoadingSpinner.js';
|
|
27
|
+
import '../../internal-components/InternalShadowRoundButton/InternalShadowRoundButton.js';
|
|
28
|
+
import '../../images-and-icons/OakImage/OakImage.js';
|
|
29
|
+
import '../../messaging-and-feedback/OakModalCenter/OakModalCenter.js';
|
|
30
|
+
import '../../messaging-and-feedback/OakToast/OakToast.js';
|
|
31
|
+
import 'react-dom';
|
|
32
|
+
import '../../internal-components/InternalTooltip/InternalTooltip.js';
|
|
33
|
+
import '../../messaging-and-feedback/OakFocusIndicator/OakFocusIndicator.js';
|
|
34
|
+
import '../../messaging-and-feedback/OakHandDrawnFocusUnderline/OakHandDrawnFocusUnderline.js';
|
|
24
35
|
import { OakPromoTag } from '../../messaging-and-feedback/OakPromoTag/OakPromoTag.js';
|
|
36
|
+
import '../../messaging-and-feedback/OakErrorBoundary/OakErrorBoundary.js';
|
|
25
37
|
|
|
26
38
|
var StyledFocusOutline = styled(OakFlex)(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
|
|
27
39
|
var StyledTabButton = styled(InternalButton)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 100%;\n height: 100%;\n border-radius: ", ";\n &:hover {\n color: ", ";\n background: ", ";\n }\n &:focus-visible:not(&:active) {\n box-shadow: ", ";\n ", " {\n box-shadow: ", ";\n }\n }\n"], ["\n width: 100%;\n height: 100%;\n border-radius: ", ";\n &:hover {\n color: ", ";\n background: ", ";\n }\n &:focus-visible:not(&:active) {\n box-shadow: ", ";\n ", " {\n box-shadow: ", ";\n }\n }\n"])), parseBorderRadius("border-radius-circle"), function (props) { return parseColor(props.$hoverColor); }, function (props) { return parseColor(props.$hoverBackground); }, parseDropShadow("drop-shadow-centered-grey"), StyledFocusOutline, parseDropShadow("drop-shadow-centered-lemon"));
|
|
@@ -33,9 +33,15 @@ var MultipleIcons = function (_a) {
|
|
|
33
33
|
return (React.createElement(OakFlex, { "$background": "bg-decorative5-main", "$pa": "spacing-12", "$alignItems": "center", "$flexDirection": "column", "$gap": "spacing-16", "$justifyContent": "center" }, iconName.map(function (name, index) { return (React.createElement(OakFlex, { key: "".concat(name, "-").concat(index), "$position": "relative", "$alignContent": "center", "$alignItems": "center", "$justifyContent": "center" },
|
|
34
34
|
React.createElement(OakIcon, { iconName: name, "$width": "spacing-40", "$height": "spacing-40", "$mr": index < iconName.length - 1 ? "spacing-8" : "spacing-0" }))); })));
|
|
35
35
|
};
|
|
36
|
-
var LabelContainer = styled("label")(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex: 1;\n cursor:
|
|
37
|
-
var Container = styled(OakFlex)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n &:has(input:focus-visible) {\n box-shadow:\n ", ",\n ", ";\n }\n\n @media (hover: hover) {\n &:hover:not(:has(input:disabled), :active) {\n background: ", ";\n #resource-card-title {\n text-decoration:
|
|
38
|
-
return props.$
|
|
36
|
+
var LabelContainer = styled("label")(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex: 1;\n cursor: ", ";\n display: flex;\n\n &:has(input:disabled) {\n cursor: default;\n #resource-card-title {\n text-decoration: none;\n }\n }\n"], ["\n flex: 1;\n cursor: ", ";\n display: flex;\n\n &:has(input:disabled) {\n cursor: default;\n #resource-card-title {\n text-decoration: none;\n }\n }\n"])), function (props) { return (props.$showSelectionControl ? "pointer" : "default"); });
|
|
37
|
+
var Container = styled(OakFlex)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n &:has(input:focus-visible) {\n box-shadow:\n ", ",\n ", ";\n }\n\n @media (hover: hover) {\n &:hover:not(:has(input:disabled), :active) {\n background: ", ";\n #resource-card-title {\n text-decoration: ", ";\n }\n }\n\n &:hover:active:not(:has(input:disabled)) {\n #resource-card-title {\n text-decoration: ", ";\n }\n }\n }\n"], ["\n &:has(input:focus-visible) {\n box-shadow:\n ", ",\n ", ";\n }\n\n @media (hover: hover) {\n &:hover:not(:has(input:disabled), :active) {\n background: ", ";\n #resource-card-title {\n text-decoration: ", ";\n }\n }\n\n &:hover:active:not(:has(input:disabled)) {\n #resource-card-title {\n text-decoration: ", ";\n }\n }\n }\n"])), parseDropShadow("drop-shadow-centered-lemon"), parseDropShadow("drop-shadow-centered-grey"), function (props) {
|
|
38
|
+
return props.$showSelectionControl
|
|
39
|
+
? parseColor("bg-btn-secondary-hover")
|
|
40
|
+
: parseColor("bg-primary");
|
|
41
|
+
}, function (props) {
|
|
42
|
+
return props.$showSelectionControl ? "underline" : "none";
|
|
43
|
+
}, function (props) {
|
|
44
|
+
return props.$showSelectionControl ? "underline" : "none";
|
|
39
45
|
});
|
|
40
46
|
/**
|
|
41
47
|
* Resource cards present a downloadable/shareable resource with metadata and a selectable control.
|
|
@@ -49,7 +55,7 @@ var Container = styled(OakFlex)(templateObject_2 || (templateObject_2 = __makeTe
|
|
|
49
55
|
var OakResourceCard = function (props) {
|
|
50
56
|
var _a;
|
|
51
57
|
var radioContext = useContext(RadioContext);
|
|
52
|
-
var title = props.title, fileSize = props.fileSize, description = props.description, iconName = props.iconName, value = props.value, _b = props.disabled, disabled = _b === void 0 ? false : _b, defaultChecked = props.defaultChecked, checked = props.checked, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, onHovered = props.onHovered, _c = props.isRadio, isRadio =
|
|
58
|
+
var title = props.title, fileSize = props.fileSize, description = props.description, iconName = props.iconName, value = props.value, _b = props.disabled, disabled = _b === void 0 ? false : _b, defaultChecked = props.defaultChecked, checked = props.checked, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, onHovered = props.onHovered, _c = props.showSelectionControl, showSelectionControl = _c === void 0 ? true : _c, _d = props.isRadio, isRadio = _d === void 0 ? false : _d, dataTestId = props["data-testid"], _e = props.isEditable, isEditable = _e === void 0 ? false : _e, rest = __rest(props, ["title", "fileSize", "description", "iconName", "value", "disabled", "defaultChecked", "checked", "onChange", "onFocus", "onBlur", "onHovered", "showSelectionControl", "isRadio", "data-testid", "isEditable"]);
|
|
53
59
|
var checkboxSize = "spacing-24";
|
|
54
60
|
var checkedBorderColor = "border-primary";
|
|
55
61
|
var disabledColor = "text-disabled";
|
|
@@ -68,8 +74,8 @@ var OakResourceCard = function (props) {
|
|
|
68
74
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
69
75
|
};
|
|
70
76
|
var isMultipleIcon = Array.isArray(iconName);
|
|
71
|
-
return (React.createElement(Container, { "data-testid": dataTestId, "$background": "bg-primary", "$ba": "border-solid-m", "$borderRadius": "border-radius-s", "$overflow": "hidden", "$
|
|
72
|
-
React.createElement(LabelContainer,
|
|
77
|
+
return (React.createElement(Container, { "data-testid": dataTestId, "$background": "bg-primary", "$ba": "border-solid-m", "$borderRadius": "border-radius-s", "$overflow": "hidden", "$showSelectionControl": showSelectionControl, "$color": "text-primary", "$width": "100%" },
|
|
78
|
+
React.createElement(LabelContainer, { "$showSelectionControl": showSelectionControl },
|
|
73
79
|
React.createElement(OakFlex, { "$alignItems": "stretch", "$flexGrow": 1 },
|
|
74
80
|
isMultipleIcon ? (React.createElement(MultipleIcons, { iconName: iconName })) : (React.createElement(SingleIcon, { iconName: iconName })),
|
|
75
81
|
React.createElement(OakFlex, { "$flexGrow": 1, "$flexDirection": "column", "$justifyContent": "center", "$gap": "spacing-4", "$pv": "spacing-12", "$ph": "spacing-16" },
|
|
@@ -80,8 +86,8 @@ var OakResourceCard = function (props) {
|
|
|
80
86
|
isEditable && (React.createElement(OakTagFunctional, { "$alignSelf": "flex-end", "$font": "heading-light-7", label: "Editable", "$background": "bg-decorative2-main" }))))),
|
|
81
87
|
React.createElement(OakFlex, null,
|
|
82
88
|
React.createElement(OakFlex, { "$alignItems": "center", "$pr": "spacing-16" },
|
|
83
|
-
isRadio && (React.createElement(InternalRadioWrapper, { checked: isChecked, size: checkboxSize, disabled: anyDisabled, radioBorderColor: checkedBorderColor, internalRadio: React.createElement(InternalRadio, __assign({}, rest, { id: props.id, name: (_a = props.name) !== null && _a !== void 0 ? _a : radioContext.name, value: value, disabled: anyDisabled, onHovered: onHovered, onChange: handleRadioChange, onFocus: onFocus, onBlur: onBlur, defaultChecked: defaultChecked, checked: radioChecked })) })),
|
|
84
|
-
!isRadio && (React.createElement(InternalCheckBoxWrapper, { size: checkboxSize, internalCheckbox: React.createElement(InternalCheckBoxHoverFocus, __assign({ name: radioContext.name, value: value, "$width": checkboxSize, "$height": checkboxSize, "$ba": "border-solid-m", "$borderRadius": "border-radius-xs", "$borderColor": "text-primary", "$checkedBackground": currentCheckedBackgroundFill, "$checkedBorderColor": currentCheckedBorderColor, "$uncheckedBorderColor": "border-neutral", "$hoverBorderRadius": "border-radius-xs", onHovered: onHovered, onChange: onChange, onFocus: onFocus, onBlur: onBlur, defaultChecked: defaultChecked, checked: checked, disabled: anyDisabled }, rest)), iconPadding: "spacing-0" })))))));
|
|
89
|
+
showSelectionControl && isRadio && (React.createElement(InternalRadioWrapper, { checked: isChecked, size: checkboxSize, disabled: anyDisabled, radioBorderColor: checkedBorderColor, internalRadio: React.createElement(InternalRadio, __assign({}, rest, { id: props.id, name: (_a = props.name) !== null && _a !== void 0 ? _a : radioContext.name, value: value, disabled: anyDisabled, onHovered: onHovered, onChange: handleRadioChange, onFocus: onFocus, onBlur: onBlur, defaultChecked: defaultChecked, checked: radioChecked })) })),
|
|
90
|
+
showSelectionControl && !isRadio && (React.createElement(InternalCheckBoxWrapper, { size: checkboxSize, internalCheckbox: React.createElement(InternalCheckBoxHoverFocus, __assign({ name: radioContext.name, value: value, "$width": checkboxSize, "$height": checkboxSize, "$ba": "border-solid-m", "$borderRadius": "border-radius-xs", "$borderColor": "text-primary", "$checkedBackground": currentCheckedBackgroundFill, "$checkedBorderColor": currentCheckedBorderColor, "$uncheckedBorderColor": "border-neutral", "$hoverBorderRadius": "border-radius-xs", onHovered: onHovered, onChange: onChange, onFocus: onFocus, onBlur: onBlur, defaultChecked: defaultChecked, checked: checked, disabled: anyDisabled }, rest)), iconPadding: "spacing-0" })))))));
|
|
85
91
|
};
|
|
86
92
|
var templateObject_1, templateObject_2;
|
|
87
93
|
|
|
@@ -19,13 +19,13 @@ var StyledAccordionButton = styled(InternalAccordionButton)(templateObject_1 ||
|
|
|
19
19
|
* Internal accordion component that handles the accordion logic
|
|
20
20
|
*/
|
|
21
21
|
var Accordion = function (_a) {
|
|
22
|
-
var children = _a.children, id = _a.id, selectAllChecked = _a.selectAllChecked, subheading = _a.subheading, handleToggleSelectAll = _a.handleToggleSelectAll, styleProps = __rest(_a, ["children", "id", "selectAllChecked", "subheading", "handleToggleSelectAll"]);
|
|
22
|
+
var children = _a.children, id = _a.id, selectAllChecked = _a.selectAllChecked, subheading = _a.subheading, _b = _a.showCheckbox, showCheckbox = _b === void 0 ? true : _b, handleToggleSelectAll = _a.handleToggleSelectAll, styleProps = __rest(_a, ["children", "id", "selectAllChecked", "subheading", "showCheckbox", "handleToggleSelectAll"]);
|
|
23
23
|
var isOpen = useAccordionContext().isOpen;
|
|
24
24
|
return (React.createElement(OakFlex, __assign({ "$bt": "border-solid-s", "$bb": isOpen ? "border-solid-none" : "border-solid-s", "$borderColor": "border-neutral-lighter", "$pv": "spacing-12", "$flexDirection": "column", "$width": "100%" }, styleProps),
|
|
25
25
|
React.createElement(OakFlex, { "$alignItems": "center", "$width": "100%" },
|
|
26
26
|
React.createElement(OakFlex, { "$alignItems": "center", "$width": "100%", "$gap": "spacing-16" },
|
|
27
|
-
React.createElement(OakBox, { id: "select-all-wrapper", "$pa": "spacing-8", onClick: handleToggleSelectAll },
|
|
28
|
-
React.createElement(OakCheckBox, { onChange: function () { return undefined; }, checked: selectAllChecked, id: "select-all", name: "select-all", value: "", "aria-labelledby": "resources-accordion-heading" })),
|
|
27
|
+
showCheckbox ? (React.createElement(OakBox, { id: "select-all-wrapper", "$pa": "spacing-8", onClick: handleToggleSelectAll },
|
|
28
|
+
React.createElement(OakCheckBox, { onChange: function () { return undefined; }, checked: selectAllChecked, id: "select-all", name: "select-all", value: "", "aria-labelledby": "resources-accordion-heading" }))) : null,
|
|
29
29
|
React.createElement(StyledAccordionButton, { "$justifyContent": "space-between", "$flexGrow": 1, id: id, "$alignItems": "center", "$mr": "spacing-12" },
|
|
30
30
|
React.createElement(OakFlex, { "$justifyContent": "center", "$alignItems": "center", "$gap": "spacing-12" },
|
|
31
31
|
React.createElement(OakFlex, { "$flexDirection": "column", "$justifyContent": "center", "$alignItems": "start" },
|
package/dist/npm/es/types.d.ts
CHANGED
|
@@ -3621,6 +3621,10 @@ type OakResourcesAccordionProps = {
|
|
|
3621
3621
|
* Whether the accordion starts in the open state, defaults to false
|
|
3622
3622
|
*/
|
|
3623
3623
|
initialOpen?: boolean;
|
|
3624
|
+
/**
|
|
3625
|
+
* Whether to show the select all checkbox
|
|
3626
|
+
*/
|
|
3627
|
+
showCheckbox?: boolean;
|
|
3624
3628
|
} & FlexStyleProps & OakBoxProps & ColorStyleProps;
|
|
3625
3629
|
/**
|
|
3626
3630
|
* OakResourcesAccordion renamed from OakDownloadsAccordion.
|
|
@@ -4453,6 +4457,12 @@ type OakResourceCardProps = BaseCheckBoxProps & {
|
|
|
4453
4457
|
* The icon used to represent the resource type.
|
|
4454
4458
|
*/
|
|
4455
4459
|
iconName: IconName | IconName[];
|
|
4460
|
+
/**
|
|
4461
|
+
* Whether to show the selection control (checkbox or radio button).
|
|
4462
|
+
*
|
|
4463
|
+
* @default true
|
|
4464
|
+
*/
|
|
4465
|
+
showSelectionControl?: boolean;
|
|
4456
4466
|
/**
|
|
4457
4467
|
* If true, renders the selection control as a radio button instead of a checkbox.
|
|
4458
4468
|
*
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oaknational/oak-components",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.15.0",
|
|
4
4
|
"licence": "MIT",
|
|
5
5
|
"packageManager": "pnpm@11.2.0",
|
|
6
6
|
"description": "Shared components for Oak applications",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
9
|
"import": {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
10
|
+
"types": "./dist/npm/es/types.d.ts",
|
|
11
|
+
"default": "./dist/npm/es/index.js"
|
|
12
12
|
},
|
|
13
13
|
"require": {
|
|
14
|
-
"
|
|
15
|
-
"
|
|
14
|
+
"types": "./dist/npm/cjs/types.d.ts",
|
|
15
|
+
"default": "./dist/npm/cjs/index.js"
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
},
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
},
|
|
46
46
|
"author": "",
|
|
47
47
|
"peerDependencies": {
|
|
48
|
+
"@portabletext/react": ">=4.0.1",
|
|
48
49
|
"next": ">=14.2.12",
|
|
49
50
|
"next-cloudinary": ">=6.16.0",
|
|
50
51
|
"react": ">=18.2.0",
|
|
51
52
|
"react-dom": ">=18.2.0",
|
|
52
|
-
"styled-components": ">=5.3.11"
|
|
53
|
-
"@portabletext/react": ">=4.0.1"
|
|
53
|
+
"styled-components": ">=5.3.11"
|
|
54
54
|
},
|
|
55
55
|
"engines": {
|
|
56
56
|
"node": "24",
|
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
"@tiptap/react": "^2.11.0",
|
|
64
64
|
"react-focus-on": "^3.10.2",
|
|
65
65
|
"react-transition-group": "^4.4.5",
|
|
66
|
+
"tslib": "^2.8.1",
|
|
66
67
|
"url": "^0.11.4"
|
|
67
68
|
},
|
|
68
69
|
"devDependencies": {
|