@oaknational/oak-components 3.3.2 → 3.4.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/dist/npm/cjs/index.js +36 -7
- package/dist/npm/cjs/types.d.ts +21 -2
- package/dist/npm/es/components/buttons/OakButtonWithDropdown/OakButtonWithDropdown.js +18 -6
- package/dist/npm/es/components/buttons/OakButtonWithDropdown/OakButtonWithDropdownProvider.js +10 -0
- package/dist/npm/es/components/buttons/OakButtonWithDropdown/useDropdownContext.js +12 -0
- package/dist/npm/es/components/buttons/OakSecondaryButtonWithDropdown/OakSecondaryButtonWithDropdown.js +1 -0
- package/dist/npm/es/components/buttons/OakSmallSecondaryButtonWithDropdown/OakSmallSecondaryButtonWithDropdown.js +1 -0
- package/dist/npm/es/components/presentational/OakVideo/OakVideo.js +1 -0
- package/dist/npm/es/index.js +2 -0
- package/dist/npm/es/styles/global/reset.styles.js +1 -1
- package/dist/npm/es/types.d.ts +21 -2
- package/package.json +6 -6
package/dist/npm/cjs/index.js
CHANGED
|
@@ -20,6 +20,13 @@ var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
|
20
20
|
var Image__default = /*#__PURE__*/_interopDefault(Image);
|
|
21
21
|
var Link__default = /*#__PURE__*/_interopDefault(Link);
|
|
22
22
|
|
|
23
|
+
var DropdownContext = React.createContext(null);
|
|
24
|
+
var OakButtonWithDropdownProvider = function (_a) {
|
|
25
|
+
var onClose = _a.onClose, children = _a.children;
|
|
26
|
+
var context = React.useMemo(function () { return ({ onClose: onClose }); }, [onClose]);
|
|
27
|
+
return (React__default.default.createElement(DropdownContext.Provider, { value: context }, children));
|
|
28
|
+
};
|
|
29
|
+
|
|
23
30
|
var oakColorTokens = {
|
|
24
31
|
white: "#ffffff",
|
|
25
32
|
grey10: "#f9f9f9",
|
|
@@ -1257,9 +1264,13 @@ var OakSecondaryButton = function (_a) {
|
|
|
1257
1264
|
* Accepts the button component as a prop to eliminate code duplication.
|
|
1258
1265
|
*/
|
|
1259
1266
|
var OakButtonWithDropdown = function (_a) {
|
|
1260
|
-
var
|
|
1261
|
-
var
|
|
1267
|
+
var _b, _c;
|
|
1268
|
+
var primaryActionText = _a.primaryActionText, _d = _a.primaryActionIcon, primaryActionIcon = _d === void 0 ? "chevron-down" : _d, onPrimaryAction = _a.onPrimaryAction, children = _a.children, _e = _a.isLoading, isLoading = _e === void 0 ? false : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, ariaLabel = _a.ariaLabel, ariaDescription = _a.ariaDescription, leadingButtonIcon = _a.leadingButtonIcon, dataTestId = _a["data-testid"], ButtonComponent = _a.buttonComponent, _g = _a.dropdownTopSpacing, dropdownTopSpacing = _g === void 0 ? "spacing-56" : _g, flexWidth = _a.flexWidth, closeOnChange = _a.closeOnChange, _h = _a.dropdownProps, dropdownProps = _h === void 0 ? {
|
|
1269
|
+
role: "menu",
|
|
1270
|
+
} : _h;
|
|
1271
|
+
var _j = tslib.__read(React.useState(false), 2), isOpen = _j[0], setIsOpen = _j[1];
|
|
1262
1272
|
var dropdownRef = React.useRef(null);
|
|
1273
|
+
var wasOpen = React.useRef(false);
|
|
1263
1274
|
// Get all focusable elements within the dropdown
|
|
1264
1275
|
var getFocusableElements = function () {
|
|
1265
1276
|
if (!dropdownRef.current)
|
|
@@ -1271,7 +1282,7 @@ var OakButtonWithDropdown = function (_a) {
|
|
|
1271
1282
|
setIsOpen(false);
|
|
1272
1283
|
}
|
|
1273
1284
|
};
|
|
1274
|
-
// Handle clicks
|
|
1285
|
+
// Handle clicks on the dropdown to close it
|
|
1275
1286
|
React.useEffect(function () {
|
|
1276
1287
|
var handleKeyDown = function (event) {
|
|
1277
1288
|
var _a, _b;
|
|
@@ -1325,6 +1336,12 @@ var OakButtonWithDropdown = function (_a) {
|
|
|
1325
1336
|
document.addEventListener("mousedown", handleClick);
|
|
1326
1337
|
document.addEventListener("keydown", handleKeyDown);
|
|
1327
1338
|
}
|
|
1339
|
+
if (wasOpen.current && !isOpen) {
|
|
1340
|
+
var timeoutId_1 = setTimeout(function () { var _a; return (_a = getFocusableElements()[0]) === null || _a === void 0 ? void 0 : _a.focus(); }, 0);
|
|
1341
|
+
wasOpen.current = isOpen;
|
|
1342
|
+
return function () { return clearTimeout(timeoutId_1); };
|
|
1343
|
+
}
|
|
1344
|
+
wasOpen.current = isOpen;
|
|
1328
1345
|
return function () {
|
|
1329
1346
|
document.removeEventListener("mousedown", handleClick);
|
|
1330
1347
|
document.removeEventListener("keydown", handleKeyDown);
|
|
@@ -1337,12 +1354,13 @@ var OakButtonWithDropdown = function (_a) {
|
|
|
1337
1354
|
return (React__default.default.createElement(OakBox, { as: "section", "aria-label": ariaLabel, "aria-describedby": ariaDescription ? "".concat(dataTestId, "-description") : undefined, "data-testid": dataTestId, ref: dropdownRef, "$position": "relative" },
|
|
1338
1355
|
React__default.default.createElement(OakFlex, { "$flexDirection": "column", "$gap": "spacing-12" },
|
|
1339
1356
|
React__default.default.createElement(OakFlex, { "$width": flexWidth, "$gap": "spacing-12" },
|
|
1340
|
-
React__default.default.createElement(ButtonComponent, { iconName: primaryActionIcon, isTrailingIcon: true, onClick: handlePrimaryAction, isLoading: isLoading, disabled: disabled, width: "max-content", "aria-expanded": isOpen, "aria-haspopup": "menu", "aria-label": primaryActionText, "data-testid": dataTestId ? "".concat(dataTestId, "-primary-action") : undefined },
|
|
1357
|
+
React__default.default.createElement(ButtonComponent, { iconName: primaryActionIcon, isTrailingIcon: true, onClick: handlePrimaryAction, isLoading: isLoading, disabled: disabled, width: "max-content", "aria-expanded": isOpen, "aria-haspopup": dropdownProps.role === "menu" ? "menu" : undefined, "aria-label": primaryActionText, "data-testid": dataTestId ? "".concat(dataTestId, "-primary-action") : undefined },
|
|
1341
1358
|
React__default.default.createElement(OakFlex, { "$alignItems": "center" },
|
|
1342
1359
|
leadingButtonIcon,
|
|
1343
1360
|
primaryActionText))),
|
|
1344
|
-
isOpen && (React__default.default.createElement(OakBox, { "$background": "bg-primary", "$borderRadius": "border-radius-s", "$ba": "border-solid-m", "$borderColor": "border-primary", "$pa": "spacing-8", "$position": "absolute", "$top": dropdownTopSpacing, "$zIndex": "modal-close-button", role: "menu", "aria-label": "Dropdown menu. Use arrow keys to navigate, Tab to cycle through items, Escape to close.", "data-testid": dataTestId ? "".concat(dataTestId, "-dropdown") : undefined },
|
|
1345
|
-
React__default.default.createElement(OakFlex, { "$flexDirection": "column", "$gap": "spacing-8" },
|
|
1361
|
+
isOpen && (React__default.default.createElement(OakBox, { "$background": "bg-primary", "$borderRadius": "border-radius-s", "$ba": "border-solid-m", "$borderColor": "border-primary", "$pa": "spacing-8", "$position": "absolute", "$top": dropdownTopSpacing, "$zIndex": "modal-close-button", role: (_b = dropdownProps === null || dropdownProps === void 0 ? void 0 : dropdownProps["role"]) !== null && _b !== void 0 ? _b : "menu", "aria-label": (_c = dropdownProps["aria-label"]) !== null && _c !== void 0 ? _c : "Dropdown menu. Use arrow keys to navigate, Tab to cycle through items, Escape to close.", "data-testid": dataTestId ? "".concat(dataTestId, "-dropdown") : undefined },
|
|
1362
|
+
React__default.default.createElement(OakFlex, { "$flexDirection": "column", "$gap": "spacing-8" },
|
|
1363
|
+
React__default.default.createElement(OakButtonWithDropdownProvider, { onClose: function () { return setIsOpen(false); } }, children)))))));
|
|
1346
1364
|
};
|
|
1347
1365
|
OakButtonWithDropdown.Divider = function () { return (React__default.default.createElement(OakBox, { "$height": "spacing-0", "$width": "100%", "$bt": "border-solid-s", "$borderColor": "border-neutral-lighter", "aria-hidden": "true" })); };
|
|
1348
1366
|
OakButtonWithDropdown.Item = function (_a) {
|
|
@@ -1350,6 +1368,14 @@ OakButtonWithDropdown.Item = function (_a) {
|
|
|
1350
1368
|
return (React__default.default.createElement(OakSecondaryButton, tslib.__assign({ element: "a", role: "menuitem", isTrailingIcon: true }, rest), children));
|
|
1351
1369
|
};
|
|
1352
1370
|
|
|
1371
|
+
var useDropdownContext = function () {
|
|
1372
|
+
var dropdownValue = React.useContext(DropdownContext);
|
|
1373
|
+
if (!dropdownValue) {
|
|
1374
|
+
throw new Error("useDropdownContext() called outside of provider");
|
|
1375
|
+
}
|
|
1376
|
+
return dropdownValue;
|
|
1377
|
+
};
|
|
1378
|
+
|
|
1353
1379
|
var StyledInternalButton$4 = styled__default.default(InternalButton)(templateObject_2$P || (templateObject_2$P = tslib.__makeTemplateObject(["\n display: inline-block;\n ", "\n ", "\n ", "\n"], ["\n display: inline-block;\n ", "\n ", "\n ", "\n"])), positionStyle, sizeStyle, function (props) { return styled.css(templateObject_1$1K || (templateObject_1$1K = tslib.__makeTemplateObject(["\n &:hover {\n text-decoration: underline;\n color: ", ";\n\n &:not(:active) [data-icon-for=\"button\"] img {\n filter: ", ";\n }\n }\n &:active {\n color: ", ";\n }\n &:disabled {\n color: ", ";\n }\n "], ["\n &:hover {\n text-decoration: underline;\n color: ", ";\n\n &:not(:active) [data-icon-for=\"button\"] img {\n filter: ", ";\n }\n }\n &:active {\n color: ", ";\n }\n &:disabled {\n color: ", ";\n }\n "])), parseColor(props.$hoverTextColor), props.$hoverIconColor
|
|
1354
1380
|
? parseColorFilter(props.$hoverIconColor)
|
|
1355
1381
|
: undefined, parseColor(props.$defaultTextColor), parseColor(props.$disabledTextColor)); });
|
|
@@ -7621,7 +7647,7 @@ var templateObject_1$3;
|
|
|
7621
7647
|
* From https://piccalil.li/blog/a-modern-css-reset/
|
|
7622
7648
|
* Do not edit this file. If you want to add global styles, use oak.styles.ts
|
|
7623
7649
|
*/
|
|
7624
|
-
var resetGlobalCss = styled.css(templateObject_1$2 || (templateObject_1$2 = tslib.__makeTemplateObject(["\n /* Box sizing rules */\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n /* Remove default margin */\n body,\n h1,\n h2,\n h3,\n h4,\n h5,\n p,\n figure,\n blockquote,\n dl,\n dd {\n margin: 0;\n }\n\n /* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */\n ul[role=\"list\"],\n ol[role=\"list\"] {\n list-style: none;\n padding-left: 0;\n margin-top: 0;\n margin-bottom: 0;\n }\n\n /* Set core root defaults */\n html,\n html:focus-within {\n scroll-behavior: smooth;\n }\n\n /* Set core body defaults */\n body {\n min-height: 100vh;\n text-rendering: optimizespeed;\n line-height: 1.5;\n }\n\n /* A elements that don't have a class get default styles */\n a:not([class]) {\n text-decoration-skip-ink: auto;\n }\n\n /* Make images easier to work with */\n img,\n picture {\n max-width: 100%;\n display: block;\n }\n\n /* Inherit fonts for inputs and buttons */\n input,\n button,\n textarea,\n select {\n font: inherit;\n }\n\n cite {\n font-style: inherit;\n }\n\n /* Remove all animations, transitions and smooth scroll for people that prefer not to see them */\n @media (prefers-reduced-motion: reduce) {\n html:focus-within {\n scroll-behavior: auto;\n }\n\n *,\n *::before,\n *::after {\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n scroll-behavior: auto !important;\n }\n }\n"], ["\n /* Box sizing rules */\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n /* Remove default margin */\n body,\n h1,\n h2,\n h3,\n h4,\n h5,\n p,\n figure,\n blockquote,\n dl,\n dd {\n margin: 0;\n }\n\n /* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */\n ul[role=\"list\"],\n ol[role=\"list\"] {\n list-style: none;\n padding-left: 0;\n margin-top: 0;\n margin-bottom: 0;\n }\n\n /* Set core root defaults */\n html,\n html:focus-within {\n scroll-behavior: smooth;\n }\n\n /* Set core body defaults */\n body {\n min-height: 100vh;\n text-rendering: optimizespeed;\n line-height: 1.5;\n }\n\n /* A elements that don't have a class get default styles */\n a:not([class]) {\n text-decoration-skip-ink: auto;\n }\n\n /* Make images easier to work with */\n img,\n picture {\n max-width: 100%;\n display: block;\n }\n\n /* Inherit fonts for inputs and buttons */\n input,\n button,\n textarea,\n select {\n font: inherit;\n }\n\n cite {\n font-style: inherit;\n }\n\n /* Remove all animations, transitions and smooth scroll for people that prefer not to see them */\n @media (prefers-reduced-motion: reduce) {\n html:focus-within {\n scroll-behavior: auto;\n }\n\n *,\n *::before,\n *::after {\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n scroll-behavior: auto !important;\n }\n }\n"])));
|
|
7650
|
+
var resetGlobalCss = styled.css(templateObject_1$2 || (templateObject_1$2 = tslib.__makeTemplateObject(["\n /* Box sizing rules */\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n /* Remove default margin */\n body,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n p,\n figure,\n blockquote,\n dl,\n dd {\n margin: 0;\n }\n\n /* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */\n ul[role=\"list\"],\n ol[role=\"list\"] {\n list-style: none;\n padding-left: 0;\n margin-top: 0;\n margin-bottom: 0;\n }\n\n /* Set core root defaults */\n html,\n html:focus-within {\n scroll-behavior: smooth;\n }\n\n /* Set core body defaults */\n body {\n min-height: 100vh;\n text-rendering: optimizespeed;\n line-height: 1.5;\n }\n\n /* A elements that don't have a class get default styles */\n a:not([class]) {\n text-decoration-skip-ink: auto;\n }\n\n /* Make images easier to work with */\n img,\n picture {\n max-width: 100%;\n display: block;\n }\n\n /* Inherit fonts for inputs and buttons */\n input,\n button,\n textarea,\n select {\n font: inherit;\n }\n\n cite {\n font-style: inherit;\n }\n\n /* Remove all animations, transitions and smooth scroll for people that prefer not to see them */\n @media (prefers-reduced-motion: reduce) {\n html:focus-within {\n scroll-behavior: auto;\n }\n\n *,\n *::before,\n *::after {\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n scroll-behavior: auto !important;\n }\n }\n"], ["\n /* Box sizing rules */\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n /* Remove default margin */\n body,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n p,\n figure,\n blockquote,\n dl,\n dd {\n margin: 0;\n }\n\n /* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */\n ul[role=\"list\"],\n ol[role=\"list\"] {\n list-style: none;\n padding-left: 0;\n margin-top: 0;\n margin-bottom: 0;\n }\n\n /* Set core root defaults */\n html,\n html:focus-within {\n scroll-behavior: smooth;\n }\n\n /* Set core body defaults */\n body {\n min-height: 100vh;\n text-rendering: optimizespeed;\n line-height: 1.5;\n }\n\n /* A elements that don't have a class get default styles */\n a:not([class]) {\n text-decoration-skip-ink: auto;\n }\n\n /* Make images easier to work with */\n img,\n picture {\n max-width: 100%;\n display: block;\n }\n\n /* Inherit fonts for inputs and buttons */\n input,\n button,\n textarea,\n select {\n font: inherit;\n }\n\n cite {\n font-style: inherit;\n }\n\n /* Remove all animations, transitions and smooth scroll for people that prefer not to see them */\n @media (prefers-reduced-motion: reduce) {\n html:focus-within {\n scroll-behavior: auto;\n }\n\n *,\n *::before,\n *::after {\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n scroll-behavior: auto !important;\n }\n }\n"])));
|
|
7625
7651
|
var templateObject_1$2;
|
|
7626
7652
|
|
|
7627
7653
|
/**
|
|
@@ -7738,6 +7764,7 @@ var rgbToHex = function (rgb) {
|
|
|
7738
7764
|
.join(""));
|
|
7739
7765
|
};
|
|
7740
7766
|
|
|
7767
|
+
exports.DropdownContext = DropdownContext;
|
|
7741
7768
|
exports.HeadingTagComponent = HeadingTagComponent;
|
|
7742
7769
|
exports.IconDown = IconDown;
|
|
7743
7770
|
exports.IconUp = IconUp;
|
|
@@ -7751,6 +7778,7 @@ exports.OakBreadcrumbs = OakBreadcrumbs;
|
|
|
7751
7778
|
exports.OakBulletList = OakBulletList;
|
|
7752
7779
|
exports.OakButtonAsRadioGroup = OakButtonAsRadioGroup;
|
|
7753
7780
|
exports.OakButtonWithDropdown = OakButtonWithDropdown;
|
|
7781
|
+
exports.OakButtonWithDropdownProvider = OakButtonWithDropdownProvider;
|
|
7754
7782
|
exports.OakCaptionCard = OakCaptionCard;
|
|
7755
7783
|
exports.OakCaptionSearch = OakCaptionSearch;
|
|
7756
7784
|
exports.OakCard = OakCard;
|
|
@@ -7976,6 +8004,7 @@ exports.rgbToHex = rgbToHex;
|
|
|
7976
8004
|
exports.useBreakpoint = useBreakpoint;
|
|
7977
8005
|
exports.useCookieConsent = useCookieConsent;
|
|
7978
8006
|
exports.useDevice = useDevice;
|
|
8007
|
+
exports.useDropdownContext = useDropdownContext;
|
|
7979
8008
|
exports.useIsScrolled = useIsScrolled;
|
|
7980
8009
|
exports.useMediaQuery = useMediaQuery;
|
|
7981
8010
|
exports.useMounted = useMounted;
|
package/dist/npm/cjs/types.d.ts
CHANGED
|
@@ -1328,19 +1328,38 @@ type OakButtonWithDropdownProps = {
|
|
|
1328
1328
|
dropdownTopSpacing?: ResponsiveValues<OakAllSpacingToken | OakSpaceBetweenToken | null | undefined>;
|
|
1329
1329
|
flexWidth?: ResponsiveValues<OakCombinedSpacingToken | null | undefined>;
|
|
1330
1330
|
closeOnChange?: boolean;
|
|
1331
|
+
dropdownProps?: {
|
|
1332
|
+
/** The ARIA role for the dropdown panel. Defaults to "menu". */
|
|
1333
|
+
role?: React$1.AriaRole;
|
|
1334
|
+
/** The ARIA label for the dropdown panel. Defaults to undefined (no label). */
|
|
1335
|
+
"aria-label"?: string;
|
|
1336
|
+
};
|
|
1331
1337
|
};
|
|
1332
1338
|
/**
|
|
1333
1339
|
* A shared component that provides dropdown functionality for any button type.
|
|
1334
1340
|
* Accepts the button component as a prop to eliminate code duplication.
|
|
1335
1341
|
*/
|
|
1336
1342
|
declare const OakButtonWithDropdown: {
|
|
1337
|
-
({ primaryActionText, primaryActionIcon, onPrimaryAction, children, isLoading, disabled, ariaLabel, ariaDescription, leadingButtonIcon, "data-testid": dataTestId, buttonComponent: ButtonComponent, dropdownTopSpacing, flexWidth, closeOnChange, }: OakButtonWithDropdownProps): React$1.JSX.Element;
|
|
1343
|
+
({ primaryActionText, primaryActionIcon, onPrimaryAction, children, isLoading, disabled, ariaLabel, ariaDescription, leadingButtonIcon, "data-testid": dataTestId, buttonComponent: ButtonComponent, dropdownTopSpacing, flexWidth, closeOnChange, dropdownProps, }: OakButtonWithDropdownProps): React$1.JSX.Element;
|
|
1338
1344
|
Divider(): React$1.ReactElement;
|
|
1339
1345
|
Item<C extends ElementType = "button">({ children, element, ...rest }: {
|
|
1340
1346
|
children: React$1.ReactNode;
|
|
1341
1347
|
} & OakSecondaryButtonProps & PolymorphicPropsWithoutRef<C>): React$1.ReactElement;
|
|
1342
1348
|
};
|
|
1343
1349
|
|
|
1350
|
+
type DropdownContextType = {
|
|
1351
|
+
onClose: () => void;
|
|
1352
|
+
};
|
|
1353
|
+
declare const DropdownContext: React$1.Context<DropdownContextType | null>;
|
|
1354
|
+
declare const OakButtonWithDropdownProvider: ({ onClose, children, }: {
|
|
1355
|
+
onClose: () => void;
|
|
1356
|
+
children: React$1.ReactNode;
|
|
1357
|
+
}) => React$1.JSX.Element;
|
|
1358
|
+
|
|
1359
|
+
declare const useDropdownContext: () => {
|
|
1360
|
+
onClose: () => void;
|
|
1361
|
+
};
|
|
1362
|
+
|
|
1344
1363
|
type OakCloseButtonProps = {
|
|
1345
1364
|
onClose: () => void;
|
|
1346
1365
|
};
|
|
@@ -5295,5 +5314,5 @@ declare const useIsScrolled: () => {
|
|
|
5295
5314
|
|
|
5296
5315
|
declare const useBreakpoint: () => Device;
|
|
5297
5316
|
|
|
5298
|
-
export { HeadingTagComponent, IconDown, IconUp, OakAccordion, OakAnchorTarget, OakAspectRatio, OakBackLink, OakBasicAccordion, OakBox, OakBreadcrumbs, OakBulletList, OakButtonAsRadioGroup, OakButtonWithDropdown, OakCaptionCard, OakCaptionSearch, OakCard, OakCardHeader, OakCardWithHandDrawnBorder, OakCarousel, OakCheckBox, OakCloseButton, OakCloudinaryConfigProvider, OakCloudinaryImage, OakCodeRenderer, OakCollapsibleContent, OakCookieBanner, OakCookieConsent, OakCookieConsentContext, OakCookieConsentProvider, OakCookieSettingsModal, OakCopyLinkButton, OakDownloadCard, OakDownloadsAccordion, OakDownloadsJourneyChildSubjectTierSelector, OakDragAndDropInstructions, OakDraggable, OakDraggableFeedback, OakDroppable, OakFieldError, OakFieldset, OakFilterDrawer, OakFlex, OakFocusIndicator, OakForm, OakFormInput, OakFormInputWithLabels, OakGlobalStyle, OakGrid, OakGridArea, OakHandDrawnCard, OakHandDrawnCardWithIcon, OakHandDrawnFocusUnderline, OakHandDrawnHR, OakHeaderHero, OakHeading, OakHintButton, OakHomepageTabButton, OakHoverLink, OakIcon, OakImage, OakInfo, OakInfoButton, OakInformativeModal, OakInformativeModalBody, OakInformativeModalBorderColor, OakInformativeModalFooter, OakInlineBanner, OakInlineRegistrationBanner, OakJauntyAngleLabel, OakKbd, OakLI, OakLabel, OakLeftAlignedButton, OakLessonBottomNav, OakLessonInfoCard, OakLessonLayout, OakLessonNavItem, OakLessonReviewIntroVideo, OakLessonReviewItem, OakLessonReviewQuiz, OakLessonTopNav, OakLessonVideoTranscript, OakLink, OakLinkCard, OakListItem, OakLoadingSpinner, OakMaxWidth, OakMediaClip, OakMediaClipList, OakMediaClipListAccordion, OakMediaClipStackListItem, OakModalCenter, OakModalCenterBody, OakMultilineText, OakOL, OakOptGroup, OakOption, OakOutlineAccordion, OakP, OakPagination, OakPrimaryButton, OakPrimaryInvertedButton, OakPrimaryNav, OakPrimaryNavItem, OakPromoTag, OakPupilJourneyContentGuidance, OakPupilJourneyHeader, OakPupilJourneyLayout, OakPupilJourneyList, OakPupilJourneyListCounter, OakPupilJourneyListItem, OakPupilJourneyListItemSubheading, OakPupilJourneyOptionalityButton, OakPupilJourneyOptionalityItem, OakPupilJourneyProgrammeOptions, OakPupilJourneyUnitsFilter, OakPupilJourneyYearButton, OakQuizCheckBox, OakQuizCounter, OakQuizFeedback, OakQuizHint, OakQuizMatch, OakQuizMatchItemId, OakQuizOrder, OakQuizOrderitemId, OakQuizPrintableHeader, OakQuizPrintableSubHeader, OakQuizRadioButton, OakQuizResultItem, OakQuizTextInput, OakQuote, OakRadioAsButton, OakRadioButton, OakRadioGroup, OakRadioTile, OakRoundIcon, OakSaveCount, OakScaleImageButton, OakScreenReader, OakSearchFilterCheckBox, OakSecondaryButton, OakSecondaryButtonAsRadio, OakSecondaryButtonWithDropdown, OakSecondaryLink, OakSelect, OakSideMenuNav, OakSideMenuNavLink, OakSignLanguageButton, OakSmallPrimaryButton, OakSmallPrimaryInvertedButton, OakSmallSecondaryButton, OakSmallSecondaryButtonWithDropdown, OakSmallSecondaryToggleButton, OakSmallTertiaryInvertedButton, OakSpan, OakStaticMessageCard, OakSubjectIcon, OakSubjectIconButton, OakSvg, OakTabs, OakTagFunctional, OakTeacherNotesInline, OakTeacherNotesModal, OakTertiaryButton, OakTertiaryInvertedButton, OakTertiaryOLNav, OakTextArea, OakTextInput, OakThemeProvider, OakTimer, OakToast, OakTooltip, OakTypography, OakUL, OakUnitListItem, OakUnitListOptionalityItem, OakVideo, OakVideoTranscript, RadioContext, ReviewItemContainer, ReviewItemTitleSection, StyledMediaClipImage, UnstyledChevronAccordion, announcements, bannerTypes, bannerVariants, colorSchemes, formatTimeCode, generateOakIconURL, getBackgroundUrlForSection, getBreakpoint, getDefaultContextState, getMediaQuery, installMockIntersectionObserver, installMockResizeObserver, isTileItem, isValidIconName, lessonSectionNames, oakAllSpacingTokens, oakBorderRadiusTokens, oakBorderWidthTokens, oakBoxCss, oakColorTokens, oakDarkTheme, oakDefaultTheme, oakDropShadowTokens, oakFlexCss, oakFontSizeTokens, oakFontTokens, oakHeadingTags, oakIconNames, oakLIDefaults, oakOpacityTokens, oakPlaceholder, oakSpaceBetweenTokens, oakTransitionTokens, oakUiRoleTokens, oakZIndexTokens, parseBorder, parseBorderRadius, parseColor, parseColorFilter, parseDropShadow, parseFontSize, parseFontWeight, parseLetterSpacing, parseLineHeight, parseOpacity, parseSpacing, parseTransitions, parseZIndex, placeholderStyles, removedGuidanceDuplicates, responsiveStyle, rgbToHex, useBreakpoint, useCookieConsent, useDevice, useIsScrolled, useMediaQuery, useMounted };
|
|
5317
|
+
export { DropdownContext, HeadingTagComponent, IconDown, IconUp, OakAccordion, OakAnchorTarget, OakAspectRatio, OakBackLink, OakBasicAccordion, OakBox, OakBreadcrumbs, OakBulletList, OakButtonAsRadioGroup, OakButtonWithDropdown, OakButtonWithDropdownProvider, OakCaptionCard, OakCaptionSearch, OakCard, OakCardHeader, OakCardWithHandDrawnBorder, OakCarousel, OakCheckBox, OakCloseButton, OakCloudinaryConfigProvider, OakCloudinaryImage, OakCodeRenderer, OakCollapsibleContent, OakCookieBanner, OakCookieConsent, OakCookieConsentContext, OakCookieConsentProvider, OakCookieSettingsModal, OakCopyLinkButton, OakDownloadCard, OakDownloadsAccordion, OakDownloadsJourneyChildSubjectTierSelector, OakDragAndDropInstructions, OakDraggable, OakDraggableFeedback, OakDroppable, OakFieldError, OakFieldset, OakFilterDrawer, OakFlex, OakFocusIndicator, OakForm, OakFormInput, OakFormInputWithLabels, OakGlobalStyle, OakGrid, OakGridArea, OakHandDrawnCard, OakHandDrawnCardWithIcon, OakHandDrawnFocusUnderline, OakHandDrawnHR, OakHeaderHero, OakHeading, OakHintButton, OakHomepageTabButton, OakHoverLink, OakIcon, OakImage, OakInfo, OakInfoButton, OakInformativeModal, OakInformativeModalBody, OakInformativeModalBorderColor, OakInformativeModalFooter, OakInlineBanner, OakInlineRegistrationBanner, OakJauntyAngleLabel, OakKbd, OakLI, OakLabel, OakLeftAlignedButton, OakLessonBottomNav, OakLessonInfoCard, OakLessonLayout, OakLessonNavItem, OakLessonReviewIntroVideo, OakLessonReviewItem, OakLessonReviewQuiz, OakLessonTopNav, OakLessonVideoTranscript, OakLink, OakLinkCard, OakListItem, OakLoadingSpinner, OakMaxWidth, OakMediaClip, OakMediaClipList, OakMediaClipListAccordion, OakMediaClipStackListItem, OakModalCenter, OakModalCenterBody, OakMultilineText, OakOL, OakOptGroup, OakOption, OakOutlineAccordion, OakP, OakPagination, OakPrimaryButton, OakPrimaryInvertedButton, OakPrimaryNav, OakPrimaryNavItem, OakPromoTag, OakPupilJourneyContentGuidance, OakPupilJourneyHeader, OakPupilJourneyLayout, OakPupilJourneyList, OakPupilJourneyListCounter, OakPupilJourneyListItem, OakPupilJourneyListItemSubheading, OakPupilJourneyOptionalityButton, OakPupilJourneyOptionalityItem, OakPupilJourneyProgrammeOptions, OakPupilJourneyUnitsFilter, OakPupilJourneyYearButton, OakQuizCheckBox, OakQuizCounter, OakQuizFeedback, OakQuizHint, OakQuizMatch, OakQuizMatchItemId, OakQuizOrder, OakQuizOrderitemId, OakQuizPrintableHeader, OakQuizPrintableSubHeader, OakQuizRadioButton, OakQuizResultItem, OakQuizTextInput, OakQuote, OakRadioAsButton, OakRadioButton, OakRadioGroup, OakRadioTile, OakRoundIcon, OakSaveCount, OakScaleImageButton, OakScreenReader, OakSearchFilterCheckBox, OakSecondaryButton, OakSecondaryButtonAsRadio, OakSecondaryButtonWithDropdown, OakSecondaryLink, OakSelect, OakSideMenuNav, OakSideMenuNavLink, OakSignLanguageButton, OakSmallPrimaryButton, OakSmallPrimaryInvertedButton, OakSmallSecondaryButton, OakSmallSecondaryButtonWithDropdown, OakSmallSecondaryToggleButton, OakSmallTertiaryInvertedButton, OakSpan, OakStaticMessageCard, OakSubjectIcon, OakSubjectIconButton, OakSvg, OakTabs, OakTagFunctional, OakTeacherNotesInline, OakTeacherNotesModal, OakTertiaryButton, OakTertiaryInvertedButton, OakTertiaryOLNav, OakTextArea, OakTextInput, OakThemeProvider, OakTimer, OakToast, OakTooltip, OakTypography, OakUL, OakUnitListItem, OakUnitListOptionalityItem, OakVideo, OakVideoTranscript, RadioContext, ReviewItemContainer, ReviewItemTitleSection, StyledMediaClipImage, UnstyledChevronAccordion, announcements, bannerTypes, bannerVariants, colorSchemes, formatTimeCode, generateOakIconURL, getBackgroundUrlForSection, getBreakpoint, getDefaultContextState, getMediaQuery, installMockIntersectionObserver, installMockResizeObserver, isTileItem, isValidIconName, lessonSectionNames, oakAllSpacingTokens, oakBorderRadiusTokens, oakBorderWidthTokens, oakBoxCss, oakColorTokens, oakDarkTheme, oakDefaultTheme, oakDropShadowTokens, oakFlexCss, oakFontSizeTokens, oakFontTokens, oakHeadingTags, oakIconNames, oakLIDefaults, oakOpacityTokens, oakPlaceholder, oakSpaceBetweenTokens, oakTransitionTokens, oakUiRoleTokens, oakZIndexTokens, parseBorder, parseBorderRadius, parseColor, parseColorFilter, parseDropShadow, parseFontSize, parseFontWeight, parseLetterSpacing, parseLineHeight, parseOpacity, parseSpacing, parseTransitions, parseZIndex, placeholderStyles, removedGuidanceDuplicates, responsiveStyle, rgbToHex, useBreakpoint, useCookieConsent, useDevice, useDropdownContext, useIsScrolled, useMediaQuery, useMounted };
|
|
5299
5318
|
export type { BannerTypes, BreakpointName, Consent, Device, InternalQuizResultItemProps, LessonSectionName$1 as LessonSectionName, MenuItemProps, OakAccordionProps, OakAllSpacingToken, OakAnchorTargetProps, OakAspectRatioProps, OakBackLinkProps, OakBasicAccordionProps, OakBorderRadiusToken, OakBorderWidthToken, OakBoxProps, OakBreadcrumb, OakBreadcrumbWithoutHref, OakBreadcrumbsProps, OakBulletListProps, OakButtonWithDropdownProps, OakCaptionCardProps, OakCaptionSearchProps, OakCardHeaderprops, OakCardProps, OakCardWithHandDrawnBorderProps, OakCarouselProps, OakCheckBoxProps, OakCloseButtonProps, OakCloudinaryImageProps, OakCodeRendererProps, OakCollapsibleContentProps, OakColorFilterToken, OakColorToken, OakCombinedSpacingToken, OakCookieBannerProps, OakCookieConsentProps, OakCookieSettingsModalProps, OakDownloadCardProps, OakDownloadsAccordionProps, OakDownloadsJourneyChildSubjectTierSelectorProps, OakDropShadowToken, OakDroppableProps, OakFieldErrorProps, OakFieldsetProps, OakFlexProps, OakFocusIndicatorProps, OakFontSizeToken, OakFontToken, OakFormInputProps, OakFormInputWithLabelsProps, OakFormProps, OakGridAreaProps, OakGridProps, OakHandDrawnBoxWithIconProps, OakHandDrawnCardProps, OakHandDrawnFocusUnderlineProps, OakHandDrawnHRProps, OakHeaderHeroProps, OakHeadingProps, OakHeadingTag, OakHintButtonProps, OakHomepageTabButtonProps, OakHoverLinkProps, OakIconName, OakIconProps, OakImageProps, OakInfoButtonProps, OakInfoCardProps, OakInfoProps, OakInformativeModalBodyProps, OakInformativeModalCloseAction, OakInformativeModalFooterProps, OakInformativeModalProps, OakInlineBannerProps, OakInlineBannerTypes, OakInlineBannerVariantProps, OakInlineBannerVariants, OakInlineRegistrationBannerProps, OakJauntyAngleLabelProps, OakKbdProps, OakLIProps, OakLabelProps, OakLeftAlignedButtonProps, OakLessonBottomNavProps, OakLessonLayoutProps, OakLessonNavItemProps, OakLessonReviewIntroVideoProps, OakLessonReviewItemProps, OakLessonTopNavProps, OakLinkCardProps, OakLinkProps, OakListItemProps, OakLoadingSpinnerProps, OakMediaClipListProps, OakMediaClipProps, OakMediaClipStackListItemProps, OakModalCenterBodyProps, OakModalCenterProps, OakMultilineTextProps, OakOLProps, OakOpacityToken, OakOptGroupProps, OakOptionProps, OakOutlineAccordionProps, OakPProps, OakPaginationProps, OakPrimaryButtonProps, OakPrimaryInvertedButtonProps, OakPrimaryNavItemProps, OakPrimaryNavProps, OakPromoTagProps, OakPupilContentGuidance, OakPupilJourneyContentGuidanceProps, OakPupilJourneyHeaderProps, OakPupilJourneyLayoutProps, OakPupilJourneyListItemSubheadingProps, OakPupilJourneyListProps, OakPupilJourneyOptionalityItemProps, OakPupilJourneyProgrammeOptionsProps, OakPupilJourneyUnitsFilterProps, OakPupilJourneyYearButtonProps, OakQuizCheckBoxProps, OakQuizCounterProps, OakQuizFeedbackProps, OakQuizHintProps, OakQuizMatchProps, OakQuizOrderProps, OakQuizPrintableHeaderProps, OakQuizPrintableSubHeaderProps, OakQuizRadioButtonProps, OakQuoteProps, OakRadioAsButtonProps, OakRadioGroupProps, OakRadioTileProps, OakRoundIconProps, OakSaveCountProps, OakScaleImageButtonProps, OakSearchFilterCheckBoxProps, OakSecondaryButtonAsRadioProps, OakSecondaryButtonProps, OakSecondaryButtonWithDropdownProps, OakSecondaryLinkProps, OakSelectProps, OakSideMenuNavLinkProps, OakSideMenuNavProps, OakSmallPrimaryButtonProps, OakSmallPrimaryInvertedButtonProps, OakSmallSecondaryButtonProps, OakSmallSecondaryButtonWithDropdownProps, OakSmallSecondaryToggleButtonProps, OakSmallTertiaryInvertedButtonProps, OakSolidBorderAccordionProps, OakSpaceBetweenToken, OakSpanProps, OakSubjectIconButtonProps, OakSubjectIconProps, OakSvgNames, OakSvgProps, OakTabsProps, OakTagFunctionalProps, OakTeacherNotesInlineProps, OakTeacherNotesModalProps, OakTertiaryOLNavProps, OakTextAreaProps, OakTextInputProps, OakTheme, OakThemeProviderProps, OakTimerProps, OakToastProps, OakTooltipProps, OakTransitionToken, OakTypographyProps, OakULProps, OakUiRoleToken, OakUnitListItemProps, OakUnitListOptionalityItemProps, OakVideoProps, OakZIndexToken, Phase$1 as Phase, PolicyConsent, PupilJourneySectionName, Subject, Tier, TileItem, UnstyledChevronAccordionProps };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __read, __rest, __assign } from 'tslib';
|
|
2
2
|
import React, { useState, useRef, useEffect } from 'react';
|
|
3
|
+
import { OakButtonWithDropdownProvider } from './OakButtonWithDropdownProvider.js';
|
|
3
4
|
import { OakSecondaryButton } from '../OakSecondaryButton/OakSecondaryButton.js';
|
|
4
5
|
import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
|
|
5
6
|
import { OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
|
|
@@ -9,9 +10,13 @@ import { OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
|
|
|
9
10
|
* Accepts the button component as a prop to eliminate code duplication.
|
|
10
11
|
*/
|
|
11
12
|
var OakButtonWithDropdown = function (_a) {
|
|
12
|
-
var
|
|
13
|
-
var
|
|
13
|
+
var _b, _c;
|
|
14
|
+
var primaryActionText = _a.primaryActionText, _d = _a.primaryActionIcon, primaryActionIcon = _d === void 0 ? "chevron-down" : _d, onPrimaryAction = _a.onPrimaryAction, children = _a.children, _e = _a.isLoading, isLoading = _e === void 0 ? false : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, ariaLabel = _a.ariaLabel, ariaDescription = _a.ariaDescription, leadingButtonIcon = _a.leadingButtonIcon, dataTestId = _a["data-testid"], ButtonComponent = _a.buttonComponent, _g = _a.dropdownTopSpacing, dropdownTopSpacing = _g === void 0 ? "spacing-56" : _g, flexWidth = _a.flexWidth, closeOnChange = _a.closeOnChange, _h = _a.dropdownProps, dropdownProps = _h === void 0 ? {
|
|
15
|
+
role: "menu",
|
|
16
|
+
} : _h;
|
|
17
|
+
var _j = __read(useState(false), 2), isOpen = _j[0], setIsOpen = _j[1];
|
|
14
18
|
var dropdownRef = useRef(null);
|
|
19
|
+
var wasOpen = useRef(false);
|
|
15
20
|
// Get all focusable elements within the dropdown
|
|
16
21
|
var getFocusableElements = function () {
|
|
17
22
|
if (!dropdownRef.current)
|
|
@@ -23,7 +28,7 @@ var OakButtonWithDropdown = function (_a) {
|
|
|
23
28
|
setIsOpen(false);
|
|
24
29
|
}
|
|
25
30
|
};
|
|
26
|
-
// Handle clicks
|
|
31
|
+
// Handle clicks on the dropdown to close it
|
|
27
32
|
useEffect(function () {
|
|
28
33
|
var handleKeyDown = function (event) {
|
|
29
34
|
var _a, _b;
|
|
@@ -77,6 +82,12 @@ var OakButtonWithDropdown = function (_a) {
|
|
|
77
82
|
document.addEventListener("mousedown", handleClick);
|
|
78
83
|
document.addEventListener("keydown", handleKeyDown);
|
|
79
84
|
}
|
|
85
|
+
if (wasOpen.current && !isOpen) {
|
|
86
|
+
var timeoutId_1 = setTimeout(function () { var _a; return (_a = getFocusableElements()[0]) === null || _a === void 0 ? void 0 : _a.focus(); }, 0);
|
|
87
|
+
wasOpen.current = isOpen;
|
|
88
|
+
return function () { return clearTimeout(timeoutId_1); };
|
|
89
|
+
}
|
|
90
|
+
wasOpen.current = isOpen;
|
|
80
91
|
return function () {
|
|
81
92
|
document.removeEventListener("mousedown", handleClick);
|
|
82
93
|
document.removeEventListener("keydown", handleKeyDown);
|
|
@@ -89,12 +100,13 @@ var OakButtonWithDropdown = function (_a) {
|
|
|
89
100
|
return (React.createElement(OakBox, { as: "section", "aria-label": ariaLabel, "aria-describedby": ariaDescription ? "".concat(dataTestId, "-description") : undefined, "data-testid": dataTestId, ref: dropdownRef, "$position": "relative" },
|
|
90
101
|
React.createElement(OakFlex, { "$flexDirection": "column", "$gap": "spacing-12" },
|
|
91
102
|
React.createElement(OakFlex, { "$width": flexWidth, "$gap": "spacing-12" },
|
|
92
|
-
React.createElement(ButtonComponent, { iconName: primaryActionIcon, isTrailingIcon: true, onClick: handlePrimaryAction, isLoading: isLoading, disabled: disabled, width: "max-content", "aria-expanded": isOpen, "aria-haspopup": "menu", "aria-label": primaryActionText, "data-testid": dataTestId ? "".concat(dataTestId, "-primary-action") : undefined },
|
|
103
|
+
React.createElement(ButtonComponent, { iconName: primaryActionIcon, isTrailingIcon: true, onClick: handlePrimaryAction, isLoading: isLoading, disabled: disabled, width: "max-content", "aria-expanded": isOpen, "aria-haspopup": dropdownProps.role === "menu" ? "menu" : undefined, "aria-label": primaryActionText, "data-testid": dataTestId ? "".concat(dataTestId, "-primary-action") : undefined },
|
|
93
104
|
React.createElement(OakFlex, { "$alignItems": "center" },
|
|
94
105
|
leadingButtonIcon,
|
|
95
106
|
primaryActionText))),
|
|
96
|
-
isOpen && (React.createElement(OakBox, { "$background": "bg-primary", "$borderRadius": "border-radius-s", "$ba": "border-solid-m", "$borderColor": "border-primary", "$pa": "spacing-8", "$position": "absolute", "$top": dropdownTopSpacing, "$zIndex": "modal-close-button", role: "menu", "aria-label": "Dropdown menu. Use arrow keys to navigate, Tab to cycle through items, Escape to close.", "data-testid": dataTestId ? "".concat(dataTestId, "-dropdown") : undefined },
|
|
97
|
-
React.createElement(OakFlex, { "$flexDirection": "column", "$gap": "spacing-8" },
|
|
107
|
+
isOpen && (React.createElement(OakBox, { "$background": "bg-primary", "$borderRadius": "border-radius-s", "$ba": "border-solid-m", "$borderColor": "border-primary", "$pa": "spacing-8", "$position": "absolute", "$top": dropdownTopSpacing, "$zIndex": "modal-close-button", role: (_b = dropdownProps === null || dropdownProps === void 0 ? void 0 : dropdownProps["role"]) !== null && _b !== void 0 ? _b : "menu", "aria-label": (_c = dropdownProps["aria-label"]) !== null && _c !== void 0 ? _c : "Dropdown menu. Use arrow keys to navigate, Tab to cycle through items, Escape to close.", "data-testid": dataTestId ? "".concat(dataTestId, "-dropdown") : undefined },
|
|
108
|
+
React.createElement(OakFlex, { "$flexDirection": "column", "$gap": "spacing-8" },
|
|
109
|
+
React.createElement(OakButtonWithDropdownProvider, { onClose: function () { return setIsOpen(false); } }, children)))))));
|
|
98
110
|
};
|
|
99
111
|
OakButtonWithDropdown.Divider = function () { return (React.createElement(OakBox, { "$height": "spacing-0", "$width": "100%", "$bt": "border-solid-s", "$borderColor": "border-neutral-lighter", "aria-hidden": "true" })); };
|
|
100
112
|
OakButtonWithDropdown.Item = function (_a) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { createContext, useMemo } from 'react';
|
|
2
|
+
|
|
3
|
+
var DropdownContext = createContext(null);
|
|
4
|
+
var OakButtonWithDropdownProvider = function (_a) {
|
|
5
|
+
var onClose = _a.onClose, children = _a.children;
|
|
6
|
+
var context = useMemo(function () { return ({ onClose: onClose }); }, [onClose]);
|
|
7
|
+
return (React.createElement(DropdownContext.Provider, { value: context }, children));
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { DropdownContext, OakButtonWithDropdownProvider };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { DropdownContext } from './OakButtonWithDropdownProvider.js';
|
|
3
|
+
|
|
4
|
+
var useDropdownContext = function () {
|
|
5
|
+
var dropdownValue = useContext(DropdownContext);
|
|
6
|
+
if (!dropdownValue) {
|
|
7
|
+
throw new Error("useDropdownContext() called outside of provider");
|
|
8
|
+
}
|
|
9
|
+
return dropdownValue;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { useDropdownContext };
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { OakPrimaryInvertedButton } from '../OakPrimaryInvertedButton/OakPrimaryInvertedButton.js';
|
|
4
4
|
import { OakSecondaryButton } from '../OakSecondaryButton/OakSecondaryButton.js';
|
|
5
5
|
import { OakButtonWithDropdown } from '../OakButtonWithDropdown/OakButtonWithDropdown.js';
|
|
6
|
+
import '../OakButtonWithDropdown/OakButtonWithDropdownProvider.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* A secondary button that takes custom menu items or .Item and .Divider compound components as children.
|
|
@@ -2,6 +2,7 @@ import { __assign, __rest } from 'tslib';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { OakSmallSecondaryButton } from '../OakSmallSecondaryButton/OakSmallSecondaryButton.js';
|
|
4
4
|
import { OakButtonWithDropdown } from '../OakButtonWithDropdown/OakButtonWithDropdown.js';
|
|
5
|
+
import '../OakButtonWithDropdown/OakButtonWithDropdownProvider.js';
|
|
5
6
|
import { OakSmallPrimaryInvertedButton } from '../OakSmallPrimaryInvertedButton/OakSmallPrimaryInvertedButton.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __read } from 'tslib';
|
|
2
2
|
import React, { useId, useState } from 'react';
|
|
3
3
|
import '../../buttons/OakButtonWithDropdown/OakButtonWithDropdown.js';
|
|
4
|
+
import '../../buttons/OakButtonWithDropdown/OakButtonWithDropdownProvider.js';
|
|
4
5
|
import '../../internal-components/InternalShadowRoundButton/InternalShadowRoundButton.js';
|
|
5
6
|
import '../../internal-components/InternalShadowRectButton/InternalShadowRectButton.js';
|
|
6
7
|
import '../../buttons/OakSecondaryButtonWithDropdown/OakSecondaryButtonWithDropdown.js';
|
package/dist/npm/es/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { OakButtonWithDropdown } from './components/buttons/OakButtonWithDropdown/OakButtonWithDropdown.js';
|
|
2
|
+
export { DropdownContext, OakButtonWithDropdownProvider } from './components/buttons/OakButtonWithDropdown/OakButtonWithDropdownProvider.js';
|
|
3
|
+
export { useDropdownContext } from './components/buttons/OakButtonWithDropdown/useDropdownContext.js';
|
|
2
4
|
export { OakCloseButton } from './components/buttons/OakCloseButton/OakCloseButton.js';
|
|
3
5
|
export { OakPrimaryButton } from './components/buttons/OakPrimaryButton/OakPrimaryButton.js';
|
|
4
6
|
export { OakPrimaryInvertedButton } from './components/buttons/OakPrimaryInvertedButton/OakPrimaryInvertedButton.js';
|
|
@@ -5,7 +5,7 @@ import { css } from 'styled-components';
|
|
|
5
5
|
* From https://piccalil.li/blog/a-modern-css-reset/
|
|
6
6
|
* Do not edit this file. If you want to add global styles, use oak.styles.ts
|
|
7
7
|
*/
|
|
8
|
-
var resetGlobalCss = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n /* Box sizing rules */\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n /* Remove default margin */\n body,\n h1,\n h2,\n h3,\n h4,\n h5,\n p,\n figure,\n blockquote,\n dl,\n dd {\n margin: 0;\n }\n\n /* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */\n ul[role=\"list\"],\n ol[role=\"list\"] {\n list-style: none;\n padding-left: 0;\n margin-top: 0;\n margin-bottom: 0;\n }\n\n /* Set core root defaults */\n html,\n html:focus-within {\n scroll-behavior: smooth;\n }\n\n /* Set core body defaults */\n body {\n min-height: 100vh;\n text-rendering: optimizespeed;\n line-height: 1.5;\n }\n\n /* A elements that don't have a class get default styles */\n a:not([class]) {\n text-decoration-skip-ink: auto;\n }\n\n /* Make images easier to work with */\n img,\n picture {\n max-width: 100%;\n display: block;\n }\n\n /* Inherit fonts for inputs and buttons */\n input,\n button,\n textarea,\n select {\n font: inherit;\n }\n\n cite {\n font-style: inherit;\n }\n\n /* Remove all animations, transitions and smooth scroll for people that prefer not to see them */\n @media (prefers-reduced-motion: reduce) {\n html:focus-within {\n scroll-behavior: auto;\n }\n\n *,\n *::before,\n *::after {\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n scroll-behavior: auto !important;\n }\n }\n"], ["\n /* Box sizing rules */\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n /* Remove default margin */\n body,\n h1,\n h2,\n h3,\n h4,\n h5,\n p,\n figure,\n blockquote,\n dl,\n dd {\n margin: 0;\n }\n\n /* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */\n ul[role=\"list\"],\n ol[role=\"list\"] {\n list-style: none;\n padding-left: 0;\n margin-top: 0;\n margin-bottom: 0;\n }\n\n /* Set core root defaults */\n html,\n html:focus-within {\n scroll-behavior: smooth;\n }\n\n /* Set core body defaults */\n body {\n min-height: 100vh;\n text-rendering: optimizespeed;\n line-height: 1.5;\n }\n\n /* A elements that don't have a class get default styles */\n a:not([class]) {\n text-decoration-skip-ink: auto;\n }\n\n /* Make images easier to work with */\n img,\n picture {\n max-width: 100%;\n display: block;\n }\n\n /* Inherit fonts for inputs and buttons */\n input,\n button,\n textarea,\n select {\n font: inherit;\n }\n\n cite {\n font-style: inherit;\n }\n\n /* Remove all animations, transitions and smooth scroll for people that prefer not to see them */\n @media (prefers-reduced-motion: reduce) {\n html:focus-within {\n scroll-behavior: auto;\n }\n\n *,\n *::before,\n *::after {\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n scroll-behavior: auto !important;\n }\n }\n"])));
|
|
8
|
+
var resetGlobalCss = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n /* Box sizing rules */\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n /* Remove default margin */\n body,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n p,\n figure,\n blockquote,\n dl,\n dd {\n margin: 0;\n }\n\n /* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */\n ul[role=\"list\"],\n ol[role=\"list\"] {\n list-style: none;\n padding-left: 0;\n margin-top: 0;\n margin-bottom: 0;\n }\n\n /* Set core root defaults */\n html,\n html:focus-within {\n scroll-behavior: smooth;\n }\n\n /* Set core body defaults */\n body {\n min-height: 100vh;\n text-rendering: optimizespeed;\n line-height: 1.5;\n }\n\n /* A elements that don't have a class get default styles */\n a:not([class]) {\n text-decoration-skip-ink: auto;\n }\n\n /* Make images easier to work with */\n img,\n picture {\n max-width: 100%;\n display: block;\n }\n\n /* Inherit fonts for inputs and buttons */\n input,\n button,\n textarea,\n select {\n font: inherit;\n }\n\n cite {\n font-style: inherit;\n }\n\n /* Remove all animations, transitions and smooth scroll for people that prefer not to see them */\n @media (prefers-reduced-motion: reduce) {\n html:focus-within {\n scroll-behavior: auto;\n }\n\n *,\n *::before,\n *::after {\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n scroll-behavior: auto !important;\n }\n }\n"], ["\n /* Box sizing rules */\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n\n /* Remove default margin */\n body,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n p,\n figure,\n blockquote,\n dl,\n dd {\n margin: 0;\n }\n\n /* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */\n ul[role=\"list\"],\n ol[role=\"list\"] {\n list-style: none;\n padding-left: 0;\n margin-top: 0;\n margin-bottom: 0;\n }\n\n /* Set core root defaults */\n html,\n html:focus-within {\n scroll-behavior: smooth;\n }\n\n /* Set core body defaults */\n body {\n min-height: 100vh;\n text-rendering: optimizespeed;\n line-height: 1.5;\n }\n\n /* A elements that don't have a class get default styles */\n a:not([class]) {\n text-decoration-skip-ink: auto;\n }\n\n /* Make images easier to work with */\n img,\n picture {\n max-width: 100%;\n display: block;\n }\n\n /* Inherit fonts for inputs and buttons */\n input,\n button,\n textarea,\n select {\n font: inherit;\n }\n\n cite {\n font-style: inherit;\n }\n\n /* Remove all animations, transitions and smooth scroll for people that prefer not to see them */\n @media (prefers-reduced-motion: reduce) {\n html:focus-within {\n scroll-behavior: auto;\n }\n\n *,\n *::before,\n *::after {\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n scroll-behavior: auto !important;\n }\n }\n"])));
|
|
9
9
|
var templateObject_1;
|
|
10
10
|
|
|
11
11
|
export { resetGlobalCss };
|
package/dist/npm/es/types.d.ts
CHANGED
|
@@ -1328,19 +1328,38 @@ type OakButtonWithDropdownProps = {
|
|
|
1328
1328
|
dropdownTopSpacing?: ResponsiveValues<OakAllSpacingToken | OakSpaceBetweenToken | null | undefined>;
|
|
1329
1329
|
flexWidth?: ResponsiveValues<OakCombinedSpacingToken | null | undefined>;
|
|
1330
1330
|
closeOnChange?: boolean;
|
|
1331
|
+
dropdownProps?: {
|
|
1332
|
+
/** The ARIA role for the dropdown panel. Defaults to "menu". */
|
|
1333
|
+
role?: React$1.AriaRole;
|
|
1334
|
+
/** The ARIA label for the dropdown panel. Defaults to undefined (no label). */
|
|
1335
|
+
"aria-label"?: string;
|
|
1336
|
+
};
|
|
1331
1337
|
};
|
|
1332
1338
|
/**
|
|
1333
1339
|
* A shared component that provides dropdown functionality for any button type.
|
|
1334
1340
|
* Accepts the button component as a prop to eliminate code duplication.
|
|
1335
1341
|
*/
|
|
1336
1342
|
declare const OakButtonWithDropdown: {
|
|
1337
|
-
({ primaryActionText, primaryActionIcon, onPrimaryAction, children, isLoading, disabled, ariaLabel, ariaDescription, leadingButtonIcon, "data-testid": dataTestId, buttonComponent: ButtonComponent, dropdownTopSpacing, flexWidth, closeOnChange, }: OakButtonWithDropdownProps): React$1.JSX.Element;
|
|
1343
|
+
({ primaryActionText, primaryActionIcon, onPrimaryAction, children, isLoading, disabled, ariaLabel, ariaDescription, leadingButtonIcon, "data-testid": dataTestId, buttonComponent: ButtonComponent, dropdownTopSpacing, flexWidth, closeOnChange, dropdownProps, }: OakButtonWithDropdownProps): React$1.JSX.Element;
|
|
1338
1344
|
Divider(): React$1.ReactElement;
|
|
1339
1345
|
Item<C extends ElementType = "button">({ children, element, ...rest }: {
|
|
1340
1346
|
children: React$1.ReactNode;
|
|
1341
1347
|
} & OakSecondaryButtonProps & PolymorphicPropsWithoutRef<C>): React$1.ReactElement;
|
|
1342
1348
|
};
|
|
1343
1349
|
|
|
1350
|
+
type DropdownContextType = {
|
|
1351
|
+
onClose: () => void;
|
|
1352
|
+
};
|
|
1353
|
+
declare const DropdownContext: React$1.Context<DropdownContextType | null>;
|
|
1354
|
+
declare const OakButtonWithDropdownProvider: ({ onClose, children, }: {
|
|
1355
|
+
onClose: () => void;
|
|
1356
|
+
children: React$1.ReactNode;
|
|
1357
|
+
}) => React$1.JSX.Element;
|
|
1358
|
+
|
|
1359
|
+
declare const useDropdownContext: () => {
|
|
1360
|
+
onClose: () => void;
|
|
1361
|
+
};
|
|
1362
|
+
|
|
1344
1363
|
type OakCloseButtonProps = {
|
|
1345
1364
|
onClose: () => void;
|
|
1346
1365
|
};
|
|
@@ -5295,5 +5314,5 @@ declare const useIsScrolled: () => {
|
|
|
5295
5314
|
|
|
5296
5315
|
declare const useBreakpoint: () => Device;
|
|
5297
5316
|
|
|
5298
|
-
export { HeadingTagComponent, IconDown, IconUp, OakAccordion, OakAnchorTarget, OakAspectRatio, OakBackLink, OakBasicAccordion, OakBox, OakBreadcrumbs, OakBulletList, OakButtonAsRadioGroup, OakButtonWithDropdown, OakCaptionCard, OakCaptionSearch, OakCard, OakCardHeader, OakCardWithHandDrawnBorder, OakCarousel, OakCheckBox, OakCloseButton, OakCloudinaryConfigProvider, OakCloudinaryImage, OakCodeRenderer, OakCollapsibleContent, OakCookieBanner, OakCookieConsent, OakCookieConsentContext, OakCookieConsentProvider, OakCookieSettingsModal, OakCopyLinkButton, OakDownloadCard, OakDownloadsAccordion, OakDownloadsJourneyChildSubjectTierSelector, OakDragAndDropInstructions, OakDraggable, OakDraggableFeedback, OakDroppable, OakFieldError, OakFieldset, OakFilterDrawer, OakFlex, OakFocusIndicator, OakForm, OakFormInput, OakFormInputWithLabels, OakGlobalStyle, OakGrid, OakGridArea, OakHandDrawnCard, OakHandDrawnCardWithIcon, OakHandDrawnFocusUnderline, OakHandDrawnHR, OakHeaderHero, OakHeading, OakHintButton, OakHomepageTabButton, OakHoverLink, OakIcon, OakImage, OakInfo, OakInfoButton, OakInformativeModal, OakInformativeModalBody, OakInformativeModalBorderColor, OakInformativeModalFooter, OakInlineBanner, OakInlineRegistrationBanner, OakJauntyAngleLabel, OakKbd, OakLI, OakLabel, OakLeftAlignedButton, OakLessonBottomNav, OakLessonInfoCard, OakLessonLayout, OakLessonNavItem, OakLessonReviewIntroVideo, OakLessonReviewItem, OakLessonReviewQuiz, OakLessonTopNav, OakLessonVideoTranscript, OakLink, OakLinkCard, OakListItem, OakLoadingSpinner, OakMaxWidth, OakMediaClip, OakMediaClipList, OakMediaClipListAccordion, OakMediaClipStackListItem, OakModalCenter, OakModalCenterBody, OakMultilineText, OakOL, OakOptGroup, OakOption, OakOutlineAccordion, OakP, OakPagination, OakPrimaryButton, OakPrimaryInvertedButton, OakPrimaryNav, OakPrimaryNavItem, OakPromoTag, OakPupilJourneyContentGuidance, OakPupilJourneyHeader, OakPupilJourneyLayout, OakPupilJourneyList, OakPupilJourneyListCounter, OakPupilJourneyListItem, OakPupilJourneyListItemSubheading, OakPupilJourneyOptionalityButton, OakPupilJourneyOptionalityItem, OakPupilJourneyProgrammeOptions, OakPupilJourneyUnitsFilter, OakPupilJourneyYearButton, OakQuizCheckBox, OakQuizCounter, OakQuizFeedback, OakQuizHint, OakQuizMatch, OakQuizMatchItemId, OakQuizOrder, OakQuizOrderitemId, OakQuizPrintableHeader, OakQuizPrintableSubHeader, OakQuizRadioButton, OakQuizResultItem, OakQuizTextInput, OakQuote, OakRadioAsButton, OakRadioButton, OakRadioGroup, OakRadioTile, OakRoundIcon, OakSaveCount, OakScaleImageButton, OakScreenReader, OakSearchFilterCheckBox, OakSecondaryButton, OakSecondaryButtonAsRadio, OakSecondaryButtonWithDropdown, OakSecondaryLink, OakSelect, OakSideMenuNav, OakSideMenuNavLink, OakSignLanguageButton, OakSmallPrimaryButton, OakSmallPrimaryInvertedButton, OakSmallSecondaryButton, OakSmallSecondaryButtonWithDropdown, OakSmallSecondaryToggleButton, OakSmallTertiaryInvertedButton, OakSpan, OakStaticMessageCard, OakSubjectIcon, OakSubjectIconButton, OakSvg, OakTabs, OakTagFunctional, OakTeacherNotesInline, OakTeacherNotesModal, OakTertiaryButton, OakTertiaryInvertedButton, OakTertiaryOLNav, OakTextArea, OakTextInput, OakThemeProvider, OakTimer, OakToast, OakTooltip, OakTypography, OakUL, OakUnitListItem, OakUnitListOptionalityItem, OakVideo, OakVideoTranscript, RadioContext, ReviewItemContainer, ReviewItemTitleSection, StyledMediaClipImage, UnstyledChevronAccordion, announcements, bannerTypes, bannerVariants, colorSchemes, formatTimeCode, generateOakIconURL, getBackgroundUrlForSection, getBreakpoint, getDefaultContextState, getMediaQuery, installMockIntersectionObserver, installMockResizeObserver, isTileItem, isValidIconName, lessonSectionNames, oakAllSpacingTokens, oakBorderRadiusTokens, oakBorderWidthTokens, oakBoxCss, oakColorTokens, oakDarkTheme, oakDefaultTheme, oakDropShadowTokens, oakFlexCss, oakFontSizeTokens, oakFontTokens, oakHeadingTags, oakIconNames, oakLIDefaults, oakOpacityTokens, oakPlaceholder, oakSpaceBetweenTokens, oakTransitionTokens, oakUiRoleTokens, oakZIndexTokens, parseBorder, parseBorderRadius, parseColor, parseColorFilter, parseDropShadow, parseFontSize, parseFontWeight, parseLetterSpacing, parseLineHeight, parseOpacity, parseSpacing, parseTransitions, parseZIndex, placeholderStyles, removedGuidanceDuplicates, responsiveStyle, rgbToHex, useBreakpoint, useCookieConsent, useDevice, useIsScrolled, useMediaQuery, useMounted };
|
|
5317
|
+
export { DropdownContext, HeadingTagComponent, IconDown, IconUp, OakAccordion, OakAnchorTarget, OakAspectRatio, OakBackLink, OakBasicAccordion, OakBox, OakBreadcrumbs, OakBulletList, OakButtonAsRadioGroup, OakButtonWithDropdown, OakButtonWithDropdownProvider, OakCaptionCard, OakCaptionSearch, OakCard, OakCardHeader, OakCardWithHandDrawnBorder, OakCarousel, OakCheckBox, OakCloseButton, OakCloudinaryConfigProvider, OakCloudinaryImage, OakCodeRenderer, OakCollapsibleContent, OakCookieBanner, OakCookieConsent, OakCookieConsentContext, OakCookieConsentProvider, OakCookieSettingsModal, OakCopyLinkButton, OakDownloadCard, OakDownloadsAccordion, OakDownloadsJourneyChildSubjectTierSelector, OakDragAndDropInstructions, OakDraggable, OakDraggableFeedback, OakDroppable, OakFieldError, OakFieldset, OakFilterDrawer, OakFlex, OakFocusIndicator, OakForm, OakFormInput, OakFormInputWithLabels, OakGlobalStyle, OakGrid, OakGridArea, OakHandDrawnCard, OakHandDrawnCardWithIcon, OakHandDrawnFocusUnderline, OakHandDrawnHR, OakHeaderHero, OakHeading, OakHintButton, OakHomepageTabButton, OakHoverLink, OakIcon, OakImage, OakInfo, OakInfoButton, OakInformativeModal, OakInformativeModalBody, OakInformativeModalBorderColor, OakInformativeModalFooter, OakInlineBanner, OakInlineRegistrationBanner, OakJauntyAngleLabel, OakKbd, OakLI, OakLabel, OakLeftAlignedButton, OakLessonBottomNav, OakLessonInfoCard, OakLessonLayout, OakLessonNavItem, OakLessonReviewIntroVideo, OakLessonReviewItem, OakLessonReviewQuiz, OakLessonTopNav, OakLessonVideoTranscript, OakLink, OakLinkCard, OakListItem, OakLoadingSpinner, OakMaxWidth, OakMediaClip, OakMediaClipList, OakMediaClipListAccordion, OakMediaClipStackListItem, OakModalCenter, OakModalCenterBody, OakMultilineText, OakOL, OakOptGroup, OakOption, OakOutlineAccordion, OakP, OakPagination, OakPrimaryButton, OakPrimaryInvertedButton, OakPrimaryNav, OakPrimaryNavItem, OakPromoTag, OakPupilJourneyContentGuidance, OakPupilJourneyHeader, OakPupilJourneyLayout, OakPupilJourneyList, OakPupilJourneyListCounter, OakPupilJourneyListItem, OakPupilJourneyListItemSubheading, OakPupilJourneyOptionalityButton, OakPupilJourneyOptionalityItem, OakPupilJourneyProgrammeOptions, OakPupilJourneyUnitsFilter, OakPupilJourneyYearButton, OakQuizCheckBox, OakQuizCounter, OakQuizFeedback, OakQuizHint, OakQuizMatch, OakQuizMatchItemId, OakQuizOrder, OakQuizOrderitemId, OakQuizPrintableHeader, OakQuizPrintableSubHeader, OakQuizRadioButton, OakQuizResultItem, OakQuizTextInput, OakQuote, OakRadioAsButton, OakRadioButton, OakRadioGroup, OakRadioTile, OakRoundIcon, OakSaveCount, OakScaleImageButton, OakScreenReader, OakSearchFilterCheckBox, OakSecondaryButton, OakSecondaryButtonAsRadio, OakSecondaryButtonWithDropdown, OakSecondaryLink, OakSelect, OakSideMenuNav, OakSideMenuNavLink, OakSignLanguageButton, OakSmallPrimaryButton, OakSmallPrimaryInvertedButton, OakSmallSecondaryButton, OakSmallSecondaryButtonWithDropdown, OakSmallSecondaryToggleButton, OakSmallTertiaryInvertedButton, OakSpan, OakStaticMessageCard, OakSubjectIcon, OakSubjectIconButton, OakSvg, OakTabs, OakTagFunctional, OakTeacherNotesInline, OakTeacherNotesModal, OakTertiaryButton, OakTertiaryInvertedButton, OakTertiaryOLNav, OakTextArea, OakTextInput, OakThemeProvider, OakTimer, OakToast, OakTooltip, OakTypography, OakUL, OakUnitListItem, OakUnitListOptionalityItem, OakVideo, OakVideoTranscript, RadioContext, ReviewItemContainer, ReviewItemTitleSection, StyledMediaClipImage, UnstyledChevronAccordion, announcements, bannerTypes, bannerVariants, colorSchemes, formatTimeCode, generateOakIconURL, getBackgroundUrlForSection, getBreakpoint, getDefaultContextState, getMediaQuery, installMockIntersectionObserver, installMockResizeObserver, isTileItem, isValidIconName, lessonSectionNames, oakAllSpacingTokens, oakBorderRadiusTokens, oakBorderWidthTokens, oakBoxCss, oakColorTokens, oakDarkTheme, oakDefaultTheme, oakDropShadowTokens, oakFlexCss, oakFontSizeTokens, oakFontTokens, oakHeadingTags, oakIconNames, oakLIDefaults, oakOpacityTokens, oakPlaceholder, oakSpaceBetweenTokens, oakTransitionTokens, oakUiRoleTokens, oakZIndexTokens, parseBorder, parseBorderRadius, parseColor, parseColorFilter, parseDropShadow, parseFontSize, parseFontWeight, parseLetterSpacing, parseLineHeight, parseOpacity, parseSpacing, parseTransitions, parseZIndex, placeholderStyles, removedGuidanceDuplicates, responsiveStyle, rgbToHex, useBreakpoint, useCookieConsent, useDevice, useDropdownContext, useIsScrolled, useMediaQuery, useMounted };
|
|
5299
5318
|
export type { BannerTypes, BreakpointName, Consent, Device, InternalQuizResultItemProps, LessonSectionName$1 as LessonSectionName, MenuItemProps, OakAccordionProps, OakAllSpacingToken, OakAnchorTargetProps, OakAspectRatioProps, OakBackLinkProps, OakBasicAccordionProps, OakBorderRadiusToken, OakBorderWidthToken, OakBoxProps, OakBreadcrumb, OakBreadcrumbWithoutHref, OakBreadcrumbsProps, OakBulletListProps, OakButtonWithDropdownProps, OakCaptionCardProps, OakCaptionSearchProps, OakCardHeaderprops, OakCardProps, OakCardWithHandDrawnBorderProps, OakCarouselProps, OakCheckBoxProps, OakCloseButtonProps, OakCloudinaryImageProps, OakCodeRendererProps, OakCollapsibleContentProps, OakColorFilterToken, OakColorToken, OakCombinedSpacingToken, OakCookieBannerProps, OakCookieConsentProps, OakCookieSettingsModalProps, OakDownloadCardProps, OakDownloadsAccordionProps, OakDownloadsJourneyChildSubjectTierSelectorProps, OakDropShadowToken, OakDroppableProps, OakFieldErrorProps, OakFieldsetProps, OakFlexProps, OakFocusIndicatorProps, OakFontSizeToken, OakFontToken, OakFormInputProps, OakFormInputWithLabelsProps, OakFormProps, OakGridAreaProps, OakGridProps, OakHandDrawnBoxWithIconProps, OakHandDrawnCardProps, OakHandDrawnFocusUnderlineProps, OakHandDrawnHRProps, OakHeaderHeroProps, OakHeadingProps, OakHeadingTag, OakHintButtonProps, OakHomepageTabButtonProps, OakHoverLinkProps, OakIconName, OakIconProps, OakImageProps, OakInfoButtonProps, OakInfoCardProps, OakInfoProps, OakInformativeModalBodyProps, OakInformativeModalCloseAction, OakInformativeModalFooterProps, OakInformativeModalProps, OakInlineBannerProps, OakInlineBannerTypes, OakInlineBannerVariantProps, OakInlineBannerVariants, OakInlineRegistrationBannerProps, OakJauntyAngleLabelProps, OakKbdProps, OakLIProps, OakLabelProps, OakLeftAlignedButtonProps, OakLessonBottomNavProps, OakLessonLayoutProps, OakLessonNavItemProps, OakLessonReviewIntroVideoProps, OakLessonReviewItemProps, OakLessonTopNavProps, OakLinkCardProps, OakLinkProps, OakListItemProps, OakLoadingSpinnerProps, OakMediaClipListProps, OakMediaClipProps, OakMediaClipStackListItemProps, OakModalCenterBodyProps, OakModalCenterProps, OakMultilineTextProps, OakOLProps, OakOpacityToken, OakOptGroupProps, OakOptionProps, OakOutlineAccordionProps, OakPProps, OakPaginationProps, OakPrimaryButtonProps, OakPrimaryInvertedButtonProps, OakPrimaryNavItemProps, OakPrimaryNavProps, OakPromoTagProps, OakPupilContentGuidance, OakPupilJourneyContentGuidanceProps, OakPupilJourneyHeaderProps, OakPupilJourneyLayoutProps, OakPupilJourneyListItemSubheadingProps, OakPupilJourneyListProps, OakPupilJourneyOptionalityItemProps, OakPupilJourneyProgrammeOptionsProps, OakPupilJourneyUnitsFilterProps, OakPupilJourneyYearButtonProps, OakQuizCheckBoxProps, OakQuizCounterProps, OakQuizFeedbackProps, OakQuizHintProps, OakQuizMatchProps, OakQuizOrderProps, OakQuizPrintableHeaderProps, OakQuizPrintableSubHeaderProps, OakQuizRadioButtonProps, OakQuoteProps, OakRadioAsButtonProps, OakRadioGroupProps, OakRadioTileProps, OakRoundIconProps, OakSaveCountProps, OakScaleImageButtonProps, OakSearchFilterCheckBoxProps, OakSecondaryButtonAsRadioProps, OakSecondaryButtonProps, OakSecondaryButtonWithDropdownProps, OakSecondaryLinkProps, OakSelectProps, OakSideMenuNavLinkProps, OakSideMenuNavProps, OakSmallPrimaryButtonProps, OakSmallPrimaryInvertedButtonProps, OakSmallSecondaryButtonProps, OakSmallSecondaryButtonWithDropdownProps, OakSmallSecondaryToggleButtonProps, OakSmallTertiaryInvertedButtonProps, OakSolidBorderAccordionProps, OakSpaceBetweenToken, OakSpanProps, OakSubjectIconButtonProps, OakSubjectIconProps, OakSvgNames, OakSvgProps, OakTabsProps, OakTagFunctionalProps, OakTeacherNotesInlineProps, OakTeacherNotesModalProps, OakTertiaryOLNavProps, OakTextAreaProps, OakTextInputProps, OakTheme, OakThemeProviderProps, OakTimerProps, OakToastProps, OakTooltipProps, OakTransitionToken, OakTypographyProps, OakULProps, OakUiRoleToken, OakUnitListItemProps, OakUnitListOptionalityItemProps, OakVideoProps, OakZIndexToken, Phase$1 as Phase, PolicyConsent, PupilJourneySectionName, Subject, Tier, TileItem, UnstyledChevronAccordionProps };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oaknational/oak-components",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.1",
|
|
4
4
|
"licence": "MIT",
|
|
5
5
|
"packageManager": "pnpm@11.2.0",
|
|
6
6
|
"description": "Shared components for Oak applications",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
},
|
|
19
19
|
"sideEffects": false,
|
|
20
20
|
"files": [
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
21
|
+
"dist",
|
|
22
|
+
"package.json",
|
|
23
|
+
"README.md"
|
|
24
24
|
],
|
|
25
25
|
"scripts": {
|
|
26
26
|
"build": "rollup -c rollup.config.ts --configPlugin typescript",
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"@dnd-kit/sortable": "^10.0.0",
|
|
60
60
|
"@dnd-kit/utilities": "^3.2.2",
|
|
61
61
|
"@tiptap/react": "^2.11.0",
|
|
62
|
-
"url": "^0.11.4",
|
|
63
62
|
"react-focus-on": "^3.10.2",
|
|
64
|
-
"react-transition-group": "^4.4.5"
|
|
63
|
+
"react-transition-group": "^4.4.5",
|
|
64
|
+
"url": "^0.11.4"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@commitlint/cli": "^18.4.4",
|