@oaknational/oak-components 3.17.0 → 3.19.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 +204 -319
- package/dist/npm/cjs/types.d.ts +10 -54
- package/dist/npm/es/components/navigation/OakCard/OakCard.js +11 -7
- package/dist/npm/es/index.js +0 -2
- package/dist/npm/es/types.d.ts +10 -54
- package/package.json +1 -1
- package/dist/npm/es/components/house-cat/OakCaptionCard/OakCaptionCard.js +0 -81
- package/dist/npm/es/components/house-cat/OakCaptionSearch/OakCaptionSearch.js +0 -24
- package/dist/npm/es/components/house-cat/utils.js +0 -33
package/dist/npm/cjs/types.d.ts
CHANGED
|
@@ -2703,56 +2703,6 @@ type OakSearchFilterCheckBoxProps = Omit<BaseCheckBoxProps, "defaultChecked"> &
|
|
|
2703
2703
|
*/
|
|
2704
2704
|
declare const OakSearchFilterCheckBox: (props: OakSearchFilterCheckBoxProps) => React$1.JSX.Element;
|
|
2705
2705
|
|
|
2706
|
-
interface OakCaptionCardProps {
|
|
2707
|
-
captionId: string;
|
|
2708
|
-
videoTitle: string;
|
|
2709
|
-
lessonUid: string;
|
|
2710
|
-
videoType: "lesson";
|
|
2711
|
-
lastUpdated: string;
|
|
2712
|
-
lastEdited?: string;
|
|
2713
|
-
checked?: boolean;
|
|
2714
|
-
highlighted?: boolean;
|
|
2715
|
-
disabled?: boolean;
|
|
2716
|
-
onCheckChanged?: (event: React$1.ChangeEvent<HTMLInputElement>) => void;
|
|
2717
|
-
onClick?: (event: React$1.MouseEvent<HTMLDivElement>) => void;
|
|
2718
|
-
editHref: string;
|
|
2719
|
-
lessonHref: string;
|
|
2720
|
-
"data-testid"?: string;
|
|
2721
|
-
}
|
|
2722
|
-
/**
|
|
2723
|
-
* A caption card with links to the associated lesson and rev edit page.
|
|
2724
|
-
*
|
|
2725
|
-
* ## Events
|
|
2726
|
-
* The following callbacks are available for tracking checkbox events:
|
|
2727
|
-
*
|
|
2728
|
-
* ### onCheckChanged
|
|
2729
|
-
* onCheckChanged?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
2730
|
-
*
|
|
2731
|
-
*/
|
|
2732
|
-
declare const OakCaptionCard: (props: OakCaptionCardProps) => React$1.JSX.Element;
|
|
2733
|
-
|
|
2734
|
-
interface OakCaptionSearchProps {
|
|
2735
|
-
defaultValue?: string;
|
|
2736
|
-
/**
|
|
2737
|
-
* Callback function that is called when the search is submitted.
|
|
2738
|
-
* It receives the caption ID string as an argument.
|
|
2739
|
-
*/
|
|
2740
|
-
onSearch?: (captionIdString: string) => void;
|
|
2741
|
-
/**
|
|
2742
|
-
* Indicates if there is an error in the search input.
|
|
2743
|
-
*/
|
|
2744
|
-
hasError?: boolean;
|
|
2745
|
-
/**
|
|
2746
|
-
* Text to display when there is an error in the search input.
|
|
2747
|
-
*/
|
|
2748
|
-
errorText?: string;
|
|
2749
|
-
/**
|
|
2750
|
-
* Indicates if the search is currently loading. will disable the input and button.
|
|
2751
|
-
*/
|
|
2752
|
-
isLoading?: boolean;
|
|
2753
|
-
}
|
|
2754
|
-
declare const OakCaptionSearch: ({ onSearch, hasError, errorText, isLoading, defaultValue, }: OakCaptionSearchProps) => React$1.JSX.Element;
|
|
2755
|
-
|
|
2756
2706
|
type OakFlexProps = FlexStyleProps & OakBoxProps;
|
|
2757
2707
|
declare const oakFlexCss: styled_components.FlattenInterpolation<styled_components.ThemedStyledProps<FlexStyleProps, styled_components.DefaultTheme>>;
|
|
2758
2708
|
/**
|
|
@@ -3502,6 +3452,9 @@ type OakTabsProps<T extends string> = {
|
|
|
3502
3452
|
};
|
|
3503
3453
|
declare function OakTabs<T extends string>(props: Readonly<OakTabsProps<T>>): React$1.JSX.Element;
|
|
3504
3454
|
|
|
3455
|
+
/**
|
|
3456
|
+
* Border and colour style props are forwarded to the card's `<a>` element.
|
|
3457
|
+
*/
|
|
3505
3458
|
type OakCardProps = {
|
|
3506
3459
|
as?: "div" | "li";
|
|
3507
3460
|
/**
|
|
@@ -3572,7 +3525,7 @@ type OakCardProps = {
|
|
|
3572
3525
|
* Whether to show the image or not
|
|
3573
3526
|
*/
|
|
3574
3527
|
showImage?: ResponsiveValues<boolean>;
|
|
3575
|
-
};
|
|
3528
|
+
} & BorderStyleProps & ColorStyleProps;
|
|
3576
3529
|
/**
|
|
3577
3530
|
* A highly customisable card component that displays a heading and takes a href at minimum.
|
|
3578
3531
|
*
|
|
@@ -3580,8 +3533,11 @@ type OakCardProps = {
|
|
|
3580
3533
|
*
|
|
3581
3534
|
* The card can be oriented in a row or column layout and its width can be adjusted using spacing tokens.
|
|
3582
3535
|
* The image aspect ratio can be set to either 1:1 or 4:3.
|
|
3536
|
+
*
|
|
3537
|
+
* Border and colour style props are forwarded to the card's `<a>` element, so the
|
|
3538
|
+
* background, border radii, borders etc. can be overridden directly.
|
|
3583
3539
|
*/
|
|
3584
|
-
declare const OakCard: ({ as, heading, headingLevel, href, cardOrientation, cardWidth, imageSrc, imageAlt, aspectRatio, subCopy, subCopyColor, tagName, tagBackground, linkText, linkIconName, hoverBackground, imageBackgroundColor, showImage, }: OakCardProps) => React$1.JSX.Element;
|
|
3540
|
+
declare const OakCard: ({ as, heading, headingLevel, href, cardOrientation, cardWidth, imageSrc, imageAlt, aspectRatio, subCopy, subCopyColor, tagName, tagBackground, linkText, linkIconName, hoverBackground, imageBackgroundColor, $background, $borderRadius, showImage, ...styleProps }: OakCardProps) => React$1.JSX.Element;
|
|
3585
3541
|
|
|
3586
3542
|
type OakBreadcrumb = {
|
|
3587
3543
|
text: string;
|
|
@@ -5392,5 +5348,5 @@ declare const useIsScrolled: () => {
|
|
|
5392
5348
|
|
|
5393
5349
|
declare const useBreakpoint: () => Device;
|
|
5394
5350
|
|
|
5395
|
-
export { DropdownContext, HeadingTagComponent, IconDown, IconUp, OakAccordion, OakAnchorTarget, OakAspectRatio, OakBackLink, OakBasicAccordion, OakBox, OakBreadcrumbs, OakBulletList, OakButtonAsRadioGroup, OakButtonWithDropdown, OakButtonWithDropdownProvider,
|
|
5396
|
-
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,
|
|
5351
|
+
export { DropdownContext, HeadingTagComponent, IconDown, IconUp, OakAccordion, OakAnchorTarget, OakAspectRatio, OakBackLink, OakBasicAccordion, OakBox, OakBreadcrumbs, OakBulletList, OakButtonAsRadioGroup, OakButtonWithDropdown, OakButtonWithDropdownProvider, OakCard, OakCardHeader, OakCardWithHandDrawnBorder, OakCarousel, OakCheckBox, OakCloseButton, OakCloudinaryConfigProvider, OakCloudinaryImage, OakCodeRenderer, OakCollapsibleContent, OakCookieBanner, OakCookieConsent, OakCookieConsentContext, OakCookieConsentProvider, OakCookieSettingsModal, OakCopyLinkButton, OakDownloadsJourneyChildSubjectTierSelector, OakDragAndDropInstructions, OakDraggable, OakDraggableFeedback, OakDroppable, OakErrorBoundary, OakErrorBoundaryBorderColor, 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, OakResourceCard, OakResourcesAccordion, 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, parseBorderWidth, parseColor, parseColorFilter, parseDropShadow, parseFontSize, parseFontWeight, parseLetterSpacing, parseLineHeight, parseOpacity, parseSpacing, parseTransitions, parseZIndex, placeholderStyles, removedGuidanceDuplicates, responsiveStyle, rgbToHex, useBreakpoint, useCookieConsent, useDevice, useDropdownContext, useIsScrolled, useMediaQuery, useMounted };
|
|
5352
|
+
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, OakCardHeaderprops, OakCardProps, OakCardWithHandDrawnBorderProps, OakCarouselProps, OakCheckBoxProps, OakCloseButtonProps, OakCloudinaryImageProps, OakCodeRendererProps, OakCollapsibleContentProps, OakColorFilterToken, OakColorToken, OakCombinedSpacingToken, OakCookieBannerProps, OakCookieConsentProps, OakCookieSettingsModalProps, OakDownloadsJourneyChildSubjectTierSelectorProps, OakDropShadowToken, OakDroppableProps, OakErrorBoundaryCloseAction, OakErrorBoundaryProps, 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, OakResourceCardProps, OakResourcesAccordionProps, 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,4 +1,4 @@
|
|
|
1
|
-
import { __makeTemplateObject, __read } from 'tslib';
|
|
1
|
+
import { __makeTemplateObject, __read, __rest, __assign } from 'tslib';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
4
|
import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
|
|
@@ -11,8 +11,9 @@ import { OakSpan } from '../../typography/OakSpan/OakSpan.js';
|
|
|
11
11
|
import { OakTagFunctional } from '../../messaging-and-feedback/OakTagFunctional/OakTagFunctional.js';
|
|
12
12
|
import '../../../styles/theme/color.js';
|
|
13
13
|
import '../../../styles/theme/typography.js';
|
|
14
|
+
import { parseColor } from '../../../styles/helpers/parseColor.js';
|
|
14
15
|
import { parseSpacing } from '../../../styles/helpers/parseSpacing.js';
|
|
15
|
-
import { getBreakpoint } from '../../../styles/utils/responsiveStyle.js';
|
|
16
|
+
import { responsiveStyle, getBreakpoint } from '../../../styles/utils/responsiveStyle.js';
|
|
16
17
|
import { sizeStyle } from '../../../styles/utils/sizeStyle.js';
|
|
17
18
|
import { flexStyle } from '../../../styles/utils/flexStyle.js';
|
|
18
19
|
import { colorStyle } from '../../../styles/utils/colorStyle.js';
|
|
@@ -39,10 +40,10 @@ var getResponsiveCardOrientationStyles = function (cardOrientation) {
|
|
|
39
40
|
var _a = __read(cardOrientation, 2), smallOrientation = _a[0], largeOrientation = _a[1];
|
|
40
41
|
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n ", ";\n\n @media (min-width: ", "px) {\n ", "\n }\n "], ["\n ", ";\n\n @media (min-width: ", "px) {\n ", "\n }\n "])), getCardOrientationStyles(smallOrientation), getBreakpoint("small"), getCardOrientationStyles(largeOrientation));
|
|
41
42
|
};
|
|
42
|
-
var StyledOakFlex = styled(OakFlex)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", "\n\n ", "\n\n &:hover {\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n span {\n text-decoration: underline;\n }\n\n span {\n text-decoration-thickness: 18%;\n }\n }\n"], ["\n ", "\n\n ", "\n\n &:hover {\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n span {\n text-decoration: underline;\n }\n\n span {\n text-decoration-thickness: 18%;\n }\n }\n"])), flexStyle, function (_a) {
|
|
43
|
+
var StyledOakFlex = styled(OakFlex)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", "\n\n ", "\n\n &:hover {\n ", "\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n span {\n text-decoration: underline;\n }\n\n span {\n text-decoration-thickness: 18%;\n }\n }\n"], ["\n ", "\n\n ", "\n\n &:hover {\n ", "\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n span {\n text-decoration: underline;\n }\n\n span {\n text-decoration-thickness: 18%;\n }\n }\n"])), flexStyle, function (_a) {
|
|
43
44
|
var $cardOrientation = _a.$cardOrientation;
|
|
44
45
|
return getResponsiveCardOrientationStyles($cardOrientation);
|
|
45
|
-
});
|
|
46
|
+
}, responsiveStyle("background", function (props) { return props.$hoverBackground; }, parseColor));
|
|
46
47
|
function boolAsDisplay(input) {
|
|
47
48
|
if (input === undefined)
|
|
48
49
|
return;
|
|
@@ -55,14 +56,17 @@ function boolAsDisplay(input) {
|
|
|
55
56
|
*
|
|
56
57
|
* The card can be oriented in a row or column layout and its width can be adjusted using spacing tokens.
|
|
57
58
|
* The image aspect ratio can be set to either 1:1 or 4:3.
|
|
59
|
+
*
|
|
60
|
+
* Border and colour style props are forwarded to the card's `<a>` element, so the
|
|
61
|
+
* background, border radii, borders etc. can be overridden directly.
|
|
58
62
|
*/
|
|
59
63
|
var OakCard = function (_a) {
|
|
60
|
-
var _b = _a.as, as = _b === void 0 ? "div" : _b, heading = _a.heading, _c = _a.headingLevel, headingLevel = _c === void 0 ? "h3" : _c, href = _a.href, _d = _a.cardOrientation, cardOrientation = _d === void 0 ? "column" : _d, cardWidth = _a.cardWidth, imageSrc = _a.imageSrc, imageAlt = _a.imageAlt, _e = _a.aspectRatio, aspectRatio = _e === void 0 ? "1/1" : _e, subCopy = _a.subCopy, _f = _a.subCopyColor, subCopyColor = _f === void 0 ? "text-primary" : _f, tagName = _a.tagName, _g = _a.tagBackground, tagBackground = _g === void 0 ? "bg-decorative3-very-subdued" : _g, linkText = _a.linkText, _h = _a.linkIconName, linkIconName = _h === void 0 ? "arrow-right" : _h, _j = _a.hoverBackground, hoverBackground = _j === void 0 ? "bg-btn-secondary-hover" : _j, _k = _a.imageBackgroundColor, imageBackgroundColor = _k === void 0 ? "bg-neutral" : _k, showImage = _a.showImage;
|
|
64
|
+
var _b = _a.as, as = _b === void 0 ? "div" : _b, heading = _a.heading, _c = _a.headingLevel, headingLevel = _c === void 0 ? "h3" : _c, href = _a.href, _d = _a.cardOrientation, cardOrientation = _d === void 0 ? "column" : _d, cardWidth = _a.cardWidth, imageSrc = _a.imageSrc, imageAlt = _a.imageAlt, _e = _a.aspectRatio, aspectRatio = _e === void 0 ? "1/1" : _e, subCopy = _a.subCopy, _f = _a.subCopyColor, subCopyColor = _f === void 0 ? "text-primary" : _f, tagName = _a.tagName, _g = _a.tagBackground, tagBackground = _g === void 0 ? "bg-decorative3-very-subdued" : _g, linkText = _a.linkText, _h = _a.linkIconName, linkIconName = _h === void 0 ? "arrow-right" : _h, _j = _a.hoverBackground, hoverBackground = _j === void 0 ? "bg-btn-secondary-hover" : _j, _k = _a.imageBackgroundColor, imageBackgroundColor = _k === void 0 ? "bg-neutral" : _k, _l = _a.$background, $background = _l === void 0 ? "bg-primary" : _l, _m = _a.$borderRadius, $borderRadius = _m === void 0 ? "border-radius-m2" : _m, showImage = _a.showImage, styleProps = __rest(_a, ["as", "heading", "headingLevel", "href", "cardOrientation", "cardWidth", "imageSrc", "imageAlt", "aspectRatio", "subCopy", "subCopyColor", "tagName", "tagBackground", "linkText", "linkIconName", "hoverBackground", "imageBackgroundColor", "$background", "$borderRadius", "showImage"]);
|
|
61
65
|
var displayImage = Array.isArray(showImage)
|
|
62
66
|
? showImage.map(function (value) { return boolAsDisplay(value); })
|
|
63
67
|
: boolAsDisplay(showImage);
|
|
64
|
-
return (React.createElement(OakFocusIndicator, { as: as, "$
|
|
65
|
-
React.createElement(StyledOakFlex, { as: "a", href: href, "$cardOrientation": cardOrientation, "$height": "100%", "$pa": "spacing-16", "$gap": "spacing-16" },
|
|
68
|
+
return (React.createElement(OakFocusIndicator, { as: as, "$height": "100%", "$width": cardWidth },
|
|
69
|
+
React.createElement(StyledOakFlex, __assign({ as: "a", href: href, "$cardOrientation": cardOrientation, "$height": "100%", "$pa": "spacing-16", "$gap": "spacing-16", "$hoverBackground": hoverBackground, "$background": $background, "$borderRadius": $borderRadius }, styleProps),
|
|
66
70
|
imageSrc && (React.createElement(OakBox, { "$display": displayImage },
|
|
67
71
|
React.createElement(StyledOakImage, { src: imageSrc || "", alt: imageAlt || "", "$width": "auto", "$aspectRatio": aspectRatio, "$background": imageBackgroundColor, "$borderRadius": "border-radius-m2" }))),
|
|
68
72
|
React.createElement(CardContent, { "$flexDirection": "column", "$justifyContent": "space-between", "$gap": "spacing-16" },
|
package/dist/npm/es/index.js
CHANGED
|
@@ -38,8 +38,6 @@ export { OakOptGroup } from './components/form-elements/OakSelect/OakOptGroup.js
|
|
|
38
38
|
export { OakTextInput } from './components/form-elements/OakTextInput/OakTextInput.js';
|
|
39
39
|
export { OakRadioAsButton, colorSchemes } from './components/form-elements/OakRadioAsButton/OakRadioAsButton.js';
|
|
40
40
|
export { OakSearchFilterCheckBox } from './components/form-elements/OakSearchFilterCheckBox/OakSearchFilterCheckBox.js';
|
|
41
|
-
export { OakCaptionCard } from './components/house-cat/OakCaptionCard/OakCaptionCard.js';
|
|
42
|
-
export { OakCaptionSearch } from './components/house-cat/OakCaptionSearch/OakCaptionSearch.js';
|
|
43
41
|
export { OakAspectRatio } from './components/images-and-icons/OakAspectRatio/OakAspectRatio.js';
|
|
44
42
|
export { OakIcon } from './components/images-and-icons/OakIcon/OakIcon.js';
|
|
45
43
|
export { OakImage, oakPlaceholder, placeholderStyles } from './components/images-and-icons/OakImage/OakImage.js';
|
package/dist/npm/es/types.d.ts
CHANGED
|
@@ -2703,56 +2703,6 @@ type OakSearchFilterCheckBoxProps = Omit<BaseCheckBoxProps, "defaultChecked"> &
|
|
|
2703
2703
|
*/
|
|
2704
2704
|
declare const OakSearchFilterCheckBox: (props: OakSearchFilterCheckBoxProps) => React$1.JSX.Element;
|
|
2705
2705
|
|
|
2706
|
-
interface OakCaptionCardProps {
|
|
2707
|
-
captionId: string;
|
|
2708
|
-
videoTitle: string;
|
|
2709
|
-
lessonUid: string;
|
|
2710
|
-
videoType: "lesson";
|
|
2711
|
-
lastUpdated: string;
|
|
2712
|
-
lastEdited?: string;
|
|
2713
|
-
checked?: boolean;
|
|
2714
|
-
highlighted?: boolean;
|
|
2715
|
-
disabled?: boolean;
|
|
2716
|
-
onCheckChanged?: (event: React$1.ChangeEvent<HTMLInputElement>) => void;
|
|
2717
|
-
onClick?: (event: React$1.MouseEvent<HTMLDivElement>) => void;
|
|
2718
|
-
editHref: string;
|
|
2719
|
-
lessonHref: string;
|
|
2720
|
-
"data-testid"?: string;
|
|
2721
|
-
}
|
|
2722
|
-
/**
|
|
2723
|
-
* A caption card with links to the associated lesson and rev edit page.
|
|
2724
|
-
*
|
|
2725
|
-
* ## Events
|
|
2726
|
-
* The following callbacks are available for tracking checkbox events:
|
|
2727
|
-
*
|
|
2728
|
-
* ### onCheckChanged
|
|
2729
|
-
* onCheckChanged?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
2730
|
-
*
|
|
2731
|
-
*/
|
|
2732
|
-
declare const OakCaptionCard: (props: OakCaptionCardProps) => React$1.JSX.Element;
|
|
2733
|
-
|
|
2734
|
-
interface OakCaptionSearchProps {
|
|
2735
|
-
defaultValue?: string;
|
|
2736
|
-
/**
|
|
2737
|
-
* Callback function that is called when the search is submitted.
|
|
2738
|
-
* It receives the caption ID string as an argument.
|
|
2739
|
-
*/
|
|
2740
|
-
onSearch?: (captionIdString: string) => void;
|
|
2741
|
-
/**
|
|
2742
|
-
* Indicates if there is an error in the search input.
|
|
2743
|
-
*/
|
|
2744
|
-
hasError?: boolean;
|
|
2745
|
-
/**
|
|
2746
|
-
* Text to display when there is an error in the search input.
|
|
2747
|
-
*/
|
|
2748
|
-
errorText?: string;
|
|
2749
|
-
/**
|
|
2750
|
-
* Indicates if the search is currently loading. will disable the input and button.
|
|
2751
|
-
*/
|
|
2752
|
-
isLoading?: boolean;
|
|
2753
|
-
}
|
|
2754
|
-
declare const OakCaptionSearch: ({ onSearch, hasError, errorText, isLoading, defaultValue, }: OakCaptionSearchProps) => React$1.JSX.Element;
|
|
2755
|
-
|
|
2756
2706
|
type OakFlexProps = FlexStyleProps & OakBoxProps;
|
|
2757
2707
|
declare const oakFlexCss: styled_components.FlattenInterpolation<styled_components.ThemedStyledProps<FlexStyleProps, styled_components.DefaultTheme>>;
|
|
2758
2708
|
/**
|
|
@@ -3502,6 +3452,9 @@ type OakTabsProps<T extends string> = {
|
|
|
3502
3452
|
};
|
|
3503
3453
|
declare function OakTabs<T extends string>(props: Readonly<OakTabsProps<T>>): React$1.JSX.Element;
|
|
3504
3454
|
|
|
3455
|
+
/**
|
|
3456
|
+
* Border and colour style props are forwarded to the card's `<a>` element.
|
|
3457
|
+
*/
|
|
3505
3458
|
type OakCardProps = {
|
|
3506
3459
|
as?: "div" | "li";
|
|
3507
3460
|
/**
|
|
@@ -3572,7 +3525,7 @@ type OakCardProps = {
|
|
|
3572
3525
|
* Whether to show the image or not
|
|
3573
3526
|
*/
|
|
3574
3527
|
showImage?: ResponsiveValues<boolean>;
|
|
3575
|
-
};
|
|
3528
|
+
} & BorderStyleProps & ColorStyleProps;
|
|
3576
3529
|
/**
|
|
3577
3530
|
* A highly customisable card component that displays a heading and takes a href at minimum.
|
|
3578
3531
|
*
|
|
@@ -3580,8 +3533,11 @@ type OakCardProps = {
|
|
|
3580
3533
|
*
|
|
3581
3534
|
* The card can be oriented in a row or column layout and its width can be adjusted using spacing tokens.
|
|
3582
3535
|
* The image aspect ratio can be set to either 1:1 or 4:3.
|
|
3536
|
+
*
|
|
3537
|
+
* Border and colour style props are forwarded to the card's `<a>` element, so the
|
|
3538
|
+
* background, border radii, borders etc. can be overridden directly.
|
|
3583
3539
|
*/
|
|
3584
|
-
declare const OakCard: ({ as, heading, headingLevel, href, cardOrientation, cardWidth, imageSrc, imageAlt, aspectRatio, subCopy, subCopyColor, tagName, tagBackground, linkText, linkIconName, hoverBackground, imageBackgroundColor, showImage, }: OakCardProps) => React$1.JSX.Element;
|
|
3540
|
+
declare const OakCard: ({ as, heading, headingLevel, href, cardOrientation, cardWidth, imageSrc, imageAlt, aspectRatio, subCopy, subCopyColor, tagName, tagBackground, linkText, linkIconName, hoverBackground, imageBackgroundColor, $background, $borderRadius, showImage, ...styleProps }: OakCardProps) => React$1.JSX.Element;
|
|
3585
3541
|
|
|
3586
3542
|
type OakBreadcrumb = {
|
|
3587
3543
|
text: string;
|
|
@@ -5392,5 +5348,5 @@ declare const useIsScrolled: () => {
|
|
|
5392
5348
|
|
|
5393
5349
|
declare const useBreakpoint: () => Device;
|
|
5394
5350
|
|
|
5395
|
-
export { DropdownContext, HeadingTagComponent, IconDown, IconUp, OakAccordion, OakAnchorTarget, OakAspectRatio, OakBackLink, OakBasicAccordion, OakBox, OakBreadcrumbs, OakBulletList, OakButtonAsRadioGroup, OakButtonWithDropdown, OakButtonWithDropdownProvider,
|
|
5396
|
-
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,
|
|
5351
|
+
export { DropdownContext, HeadingTagComponent, IconDown, IconUp, OakAccordion, OakAnchorTarget, OakAspectRatio, OakBackLink, OakBasicAccordion, OakBox, OakBreadcrumbs, OakBulletList, OakButtonAsRadioGroup, OakButtonWithDropdown, OakButtonWithDropdownProvider, OakCard, OakCardHeader, OakCardWithHandDrawnBorder, OakCarousel, OakCheckBox, OakCloseButton, OakCloudinaryConfigProvider, OakCloudinaryImage, OakCodeRenderer, OakCollapsibleContent, OakCookieBanner, OakCookieConsent, OakCookieConsentContext, OakCookieConsentProvider, OakCookieSettingsModal, OakCopyLinkButton, OakDownloadsJourneyChildSubjectTierSelector, OakDragAndDropInstructions, OakDraggable, OakDraggableFeedback, OakDroppable, OakErrorBoundary, OakErrorBoundaryBorderColor, 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, OakResourceCard, OakResourcesAccordion, 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, parseBorderWidth, parseColor, parseColorFilter, parseDropShadow, parseFontSize, parseFontWeight, parseLetterSpacing, parseLineHeight, parseOpacity, parseSpacing, parseTransitions, parseZIndex, placeholderStyles, removedGuidanceDuplicates, responsiveStyle, rgbToHex, useBreakpoint, useCookieConsent, useDevice, useDropdownContext, useIsScrolled, useMediaQuery, useMounted };
|
|
5352
|
+
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, OakCardHeaderprops, OakCardProps, OakCardWithHandDrawnBorderProps, OakCarouselProps, OakCheckBoxProps, OakCloseButtonProps, OakCloudinaryImageProps, OakCodeRendererProps, OakCollapsibleContentProps, OakColorFilterToken, OakColorToken, OakCombinedSpacingToken, OakCookieBannerProps, OakCookieConsentProps, OakCookieSettingsModalProps, OakDownloadsJourneyChildSubjectTierSelectorProps, OakDropShadowToken, OakDroppableProps, OakErrorBoundaryCloseAction, OakErrorBoundaryProps, 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, OakResourceCardProps, OakResourcesAccordionProps, 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,81 +0,0 @@
|
|
|
1
|
-
import { __makeTemplateObject } from 'tslib';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import styled, { css } from 'styled-components';
|
|
4
|
-
import { getTimeText } from '../utils.js';
|
|
5
|
-
import { OakBox } from '../../layout-and-structure/OakBox/OakBox.js';
|
|
6
|
-
import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
|
|
7
|
-
import { OakIcon } from '../../images-and-icons/OakIcon/OakIcon.js';
|
|
8
|
-
import { OakSpan } from '../../typography/OakSpan/OakSpan.js';
|
|
9
|
-
import { InternalCheckBoxLabelHoverDecor } from '../../internal-components/InternalCheckBoxLabel/InternalCheckBoxLabel.js';
|
|
10
|
-
import { parseColor } from '../../../styles/helpers/parseColor.js';
|
|
11
|
-
import { parseDropShadow } from '../../../styles/helpers/parseDropShadow.js';
|
|
12
|
-
import { OakCheckBox } from '../../form-elements/OakCheckBox/OakCheckBox.js';
|
|
13
|
-
import { OakLink } from '../../navigation/OakLink/OakLink.js';
|
|
14
|
-
|
|
15
|
-
var StyledFlexBox = styled(OakFlex)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n &:hover:has(input:not(:disabled)) ", " {\n text-decoration: underline;\n }\n\n &:has(input:focus-visible) {\n box-shadow:\n ", ",\n ", ";\n }\n\n ", "\n\n ", "\n ", "\n"], ["\n &:hover:has(input:not(:disabled)) ", " {\n text-decoration: underline;\n }\n\n &:has(input:focus-visible) {\n box-shadow:\n ", ",\n ", ";\n }\n\n ", "\n\n ", "\n ", "\n"])), InternalCheckBoxLabelHoverDecor, parseDropShadow("drop-shadow-centered-lemon"), parseDropShadow("drop-shadow-centered-grey"), function (props) {
|
|
16
|
-
return props.$disabled && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n cursor: not-allowed;\n background-color: ", ";\n color: ", ";\n "], ["\n cursor: not-allowed;\n background-color: ", ";\n color: ", ";\n "])), parseColor("bg-neutral-stronger"), parseColor("text-disabled"));
|
|
17
|
-
}, function (props) {
|
|
18
|
-
return !props.$disabled &&
|
|
19
|
-
props.$highlighted && css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background-color: ", ";\n border-color: ", ";\n &:hover {\n background-color: ", ";\n }\n "], ["\n background-color: ", ";\n border-color: ", ";\n &:hover {\n background-color: ", ";\n }\n "])), parseColor("bg-decorative3-very-subdued"), parseColor("bg-decorative3-main"), parseColor("bg-decorative3-subdued"));
|
|
20
|
-
}, function (props) {
|
|
21
|
-
return !props.$disabled &&
|
|
22
|
-
!props.$highlighted && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n &:hover {\n background-color: ", ";\n }\n "], ["\n &:hover {\n background-color: ", ";\n }\n "])), parseColor("bg-decorative3-subdued"));
|
|
23
|
-
});
|
|
24
|
-
/**
|
|
25
|
-
* A caption card with links to the associated lesson and rev edit page.
|
|
26
|
-
*
|
|
27
|
-
* ## Events
|
|
28
|
-
* The following callbacks are available for tracking checkbox events:
|
|
29
|
-
*
|
|
30
|
-
* ### onCheckChanged
|
|
31
|
-
* onCheckChanged?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
32
|
-
*
|
|
33
|
-
*/
|
|
34
|
-
var OakCaptionCard = function (props) {
|
|
35
|
-
var checked = props.checked, onCheckChanged = props.onCheckChanged, onClick = props.onClick, captionId = props.captionId, videoTitle = props.videoTitle, lessonUid = props.lessonUid, videoType = props.videoType, lastUpdated = props.lastUpdated, lastEdited = props.lastEdited, _a = props.highlighted, highlighted = _a === void 0 ? false : _a, _b = props.disabled, disabled = _b === void 0 ? false : _b, _c = props["data-testid"], dataTestId = _c === void 0 ? "caption-card" : _c, editHref = props.editHref, lessonHref = props.lessonHref;
|
|
36
|
-
var filterColor = disabled ? "icon-disabled" : null;
|
|
37
|
-
return (React.createElement(StyledFlexBox, { "data-testid": dataTestId, "$minHeight": "spacing-40", "$position": "relative", "$background": "bg-primary", "$borderRadius": "border-radius-s", "$pa": "spacing-16", "$gap": "spacing-12", "$flexDirection": "column", "$width": "100%", "$highlighted": !!highlighted, "$disabled": !!disabled, onClick: onClick },
|
|
38
|
-
React.createElement(OakFlex, { "$justifyContent": "flex-start", "$alignItems": "center", "$width": "100%", "$gap": "spacing-12", "$font": "heading-7" },
|
|
39
|
-
React.createElement(OakCheckBox, { checked: checked, value: "Caption ID: ".concat(captionId), displayValue: "", disabled: disabled, onChange: onCheckChanged, "aria-labelledby": captionId, "aria-label": "check caption ".concat(captionId), "data-testid": "checkbox", id: captionId }),
|
|
40
|
-
React.createElement(OakFlex, { "$font": "heading-7", "$justifyContent": "flex-start", "$gap": "spacing-8", "$flexWrap": "wrap" },
|
|
41
|
-
React.createElement(OakSpan, { "$font": "heading-7" },
|
|
42
|
-
"Caption ID: ",
|
|
43
|
-
captionId),
|
|
44
|
-
React.createElement(OakSpan, null, " \u2022 "),
|
|
45
|
-
React.createElement(OakBox, null,
|
|
46
|
-
"Video Title: ",
|
|
47
|
-
videoTitle)),
|
|
48
|
-
React.createElement(OakFlex, { "$flexGrow": 10, "$justifyContent": "flex-end" },
|
|
49
|
-
React.createElement(OakLink, { variant: "secondary", href: editHref, iconName: "external", isTrailingIcon: true, "aria-label": "edit caption ".concat(captionId, " in a new tab in rev"), target: "_blank", onClick: function (e) {
|
|
50
|
-
e.stopPropagation();
|
|
51
|
-
} }, "Edit"))),
|
|
52
|
-
React.createElement(OakFlex, { "$justifyContent": "flex-start", "$alignItems": "center", "$width": "100%", "$gap": "spacing-32", "$font": "body-2" },
|
|
53
|
-
React.createElement(OakLink, { variant: "secondary", href: lessonHref, "aria-label": "view lesson ".concat(lessonUid, " in a new tab"), "data-testid": "lesson_uid", iconName: "external", isTrailingIcon: true, target: "_blank", onClick: function (e) {
|
|
54
|
-
e.stopPropagation();
|
|
55
|
-
} }, lessonUid),
|
|
56
|
-
React.createElement(OakFlex, { "$alignItems": "center", "$gap": "spacing-4" },
|
|
57
|
-
" ",
|
|
58
|
-
React.createElement(OakIcon, { alt: "", iconName: "video", iconWidth: "spacing-24", iconHeight: "spacing-24", "$colorFilter": filterColor }),
|
|
59
|
-
getVideoTypeText(videoType)),
|
|
60
|
-
lastEdited ? (React.createElement(OakFlex, { "$alignItems": "center" },
|
|
61
|
-
React.createElement(OakIcon, { alt: "", iconName: "equipment-required", iconWidth: "spacing-24", iconHeight: "spacing-24", "$colorFilter": filterColor }),
|
|
62
|
-
"Edited ",
|
|
63
|
-
getTimeText(lastEdited))) : null,
|
|
64
|
-
React.createElement(OakFlex, { "$alignItems": "center" },
|
|
65
|
-
React.createElement(OakIcon, { alt: "", iconName: "success", iconWidth: "spacing-24", iconHeight: "spacing-24", "$colorFilter": filterColor }),
|
|
66
|
-
"Updated ",
|
|
67
|
-
getTimeText(lastUpdated)))));
|
|
68
|
-
};
|
|
69
|
-
function getVideoTypeText(videoType) {
|
|
70
|
-
switch (videoType) {
|
|
71
|
-
case "lesson":
|
|
72
|
-
return "Lesson video";
|
|
73
|
-
case "media clip":
|
|
74
|
-
return "Media clip";
|
|
75
|
-
default:
|
|
76
|
-
return "Unknown";
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
80
|
-
|
|
81
|
-
export { OakCaptionCard };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { OakFlex } from '../../layout-and-structure/OakFlex/OakFlex.js';
|
|
3
|
-
import { OakPrimaryButton } from '../../buttons/OakPrimaryButton/OakPrimaryButton.js';
|
|
4
|
-
import { OakFormInputWithLabels } from '../../owa/OakFormInputWithLabels/OakFormInputWithLabels.js';
|
|
5
|
-
|
|
6
|
-
var OakCaptionSearch = function (_a) {
|
|
7
|
-
var onSearch = _a.onSearch, hasError = _a.hasError, errorText = _a.errorText, _b = _a.isLoading, isLoading = _b === void 0 ? false : _b, defaultValue = _a.defaultValue;
|
|
8
|
-
var handleFormSubmit = function (event) {
|
|
9
|
-
// NB. we don't handle caption ID validation here to remain decoupled from the application logic
|
|
10
|
-
event.preventDefault();
|
|
11
|
-
// get the input value from the form
|
|
12
|
-
var form = event.target;
|
|
13
|
-
var input = form.querySelector('input[name="caption-id"]');
|
|
14
|
-
var captionIdString = input.value.trim();
|
|
15
|
-
if (onSearch) {
|
|
16
|
-
onSearch(captionIdString);
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
return (React.createElement(OakFlex, { as: "form", "$flexDirection": "column", "$color": "text-primary", "$background": "bg-primary", "$pa": "spacing-24", "$gap": "spacing-24", "$borderRadius": "border-radius-s", onSubmit: handleFormSubmit },
|
|
20
|
-
React.createElement(OakFormInputWithLabels, { label: "Caption ID", inputName: "caption-id", helperText: "Enter on or more IDs (separated by commas).", invalid: hasError, invalidText: errorText, disabled: isLoading, defaultValue: defaultValue, required: true }),
|
|
21
|
-
React.createElement(OakPrimaryButton, { type: "submit", iconName: "search", isTrailingIcon: true, isLoading: isLoading }, "Search")));
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export { OakCaptionSearch };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
function getTimeText(timestamp) {
|
|
2
|
-
var date = new Date(timestamp);
|
|
3
|
-
if (isNaN(date.getTime())) {
|
|
4
|
-
return "at an unknown time";
|
|
5
|
-
}
|
|
6
|
-
var now = Date.now();
|
|
7
|
-
var diff = now - date.getTime();
|
|
8
|
-
var seconds = Math.floor(diff / 1000);
|
|
9
|
-
if (seconds < 1) {
|
|
10
|
-
return "just now";
|
|
11
|
-
}
|
|
12
|
-
if (seconds < 60) {
|
|
13
|
-
return "".concat(seconds, " secs ago");
|
|
14
|
-
}
|
|
15
|
-
if (seconds < 3600) {
|
|
16
|
-
return "".concat(Math.floor(seconds / 60), " mins ago");
|
|
17
|
-
}
|
|
18
|
-
if (seconds < 86400) {
|
|
19
|
-
return "".concat(Math.floor(seconds / 3600), " hrs ago");
|
|
20
|
-
}
|
|
21
|
-
if (seconds < 604800) {
|
|
22
|
-
return "".concat(Math.floor(seconds / 86400), " days ago");
|
|
23
|
-
}
|
|
24
|
-
if (seconds < 2592000) {
|
|
25
|
-
return "".concat(Math.floor(seconds / 604800), " weeks ago");
|
|
26
|
-
}
|
|
27
|
-
if (seconds < 31536000) {
|
|
28
|
-
return "".concat(Math.floor(seconds / 2592000), " months ago");
|
|
29
|
-
}
|
|
30
|
-
return "".concat(Math.floor(seconds / 31536000), " years ago");
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export { getTimeText };
|