diff --git a/package-lock.json b/package-lock.json index 0781d09b..5f27695c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@oaknational/oak-components", - "version": "0.16.1", + "version": "0.20.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@oaknational/oak-components", - "version": "0.16.1", + "version": "0.20.0", "devDependencies": { "@commitlint/cli": "^18.4.4", "@commitlint/config-conventional": "^18.4.4", diff --git a/package.json b/package.json index c37572fa..bcb1959d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@oaknational/oak-components", - "version": "0.16.1", + "version": "0.20.0", "licence": "MIT", "description": "Shared components for Oak applications", "main": "dist/cjs/index.js", diff --git a/src/components/atoms/InternalCheckBoxLabel/InternalCheckBoxLabel.tsx b/src/components/atoms/InternalCheckBoxLabel/InternalCheckBoxLabel.tsx index c663bdd8..4c55fa96 100644 --- a/src/components/atoms/InternalCheckBoxLabel/InternalCheckBoxLabel.tsx +++ b/src/components/atoms/InternalCheckBoxLabel/InternalCheckBoxLabel.tsx @@ -1,4 +1,4 @@ -import styled, { css } from "styled-components"; +import styled, { CSSProperties } from "styled-components"; import { OakLabel, OakLabelProps } from "@/components/atoms"; import { responsiveStyle } from "@/styles/utils/responsiveStyle"; @@ -9,6 +9,7 @@ export type InternalCheckBoxLabelProps = { labelAlignItems?: FlexStyleProps["$alignItems"]; labelGap?: FlexStyleProps["$gap"]; disabled?: boolean; + pointerEvents?: CSSProperties["pointerEvents"]; "data-testid"?: string; } & OakLabelProps; @@ -27,14 +28,10 @@ export const InternalCheckBoxLabel = styled( `; export const InternalCheckBoxLabelHoverDecor = styled(InternalCheckBoxLabel)` - ${(props) => - props.disabled - ? css` - pointer-events: none; - ` - : css` - cursor: pointer; - `} + ${(props) => ` + ${props.pointerEvents ? `pointer-events: ${props.pointerEvents};` : ""} + ${props.disabled ? `pointer-events: none;` : `cursor: pointer;`} + `} @media (hover: hover) { &:hover { text-decoration: ${(props) => (props.disabled ? "none" : "underline")}; diff --git a/src/components/organisms/index.ts b/src/components/organisms/index.ts index 01d4a902..5a2d8333 100644 --- a/src/components/organisms/index.ts +++ b/src/components/organisms/index.ts @@ -1,4 +1,5 @@ export * from "./pupil"; +export * from "./teacher"; export * from "./OakSubjectIcon"; export * from "./OakPrimaryNavItem"; export * from "./OakPrimaryNav"; diff --git a/src/components/organisms/pupil/OakQuizCheckBox/OakQuizCheckBox.tsx b/src/components/organisms/pupil/OakQuizCheckBox/OakQuizCheckBox.tsx index b9ca234b..617d596f 100644 --- a/src/components/organisms/pupil/OakQuizCheckBox/OakQuizCheckBox.tsx +++ b/src/components/organisms/pupil/OakQuizCheckBox/OakQuizCheckBox.tsx @@ -32,12 +32,6 @@ const StyledInternalCheckBox = styled(InternalCheckBox)` } `; -const StyledInternalCheckBoxLabelHoverDecor = styled( - InternalCheckBoxLabelHoverDecor, -)` - pointer-events: none; // To prevent the label from stealing the click event from the input -`; - type StyledFlexBoxProps = OakFlexProps & { $overlayBorderColor: OakCombinedColorToken; $feedbackBgColor?: OakCombinedColorToken; @@ -69,7 +63,7 @@ const StyledFlexBox = styled(OakFlex)` } @media (hover: hover) { - &:hover:has(input:not(:disabled)){ + &:hover:has(input:not(:disabled)) { background-color: ${parseColor("bg-decorative1-subdued")}; } @@ -82,7 +76,8 @@ const StyledFlexBox = styled(OakFlex)` } &:hover:has( - ${InternalCheckBoxLabelHoverDecor} input:not(:focus-visible):not(:checked):not(:disabled) + ${InternalCheckBoxLabelHoverDecor} + input:not(:focus-visible):not(:checked):not(:disabled) )::after { content: ""; inset: 0; @@ -96,31 +91,32 @@ const StyledFlexBox = styled(OakFlex)` box-shadow: ${parseDropShadow("drop-shadow-centered-lemon")}, ${parseDropShadow("drop-shadow-centered-grey")}; } - + &:has(input:checked:not(:disabled)) { outline: ${parseBorder("border-solid-xl")}; - } + } - &:has(input:checked:disabled) { - outline-color: ${(props) => css` - ${parseColor(props.$overlayBorderColor)} - `}; - } + &:has(input:checked:disabled) { + outline-color: ${(props) => css` + ${parseColor(props.$overlayBorderColor)} + `}; + } - &:has(input:disabled:not(:checked)) { - ${(props) => - props.$feedbackBgColor - ? css` - background-color: ${props.$feedbackBgColor}; - ` - : undefined} - } + &:has(input:disabled:not(:checked)) { + ${(props) => + props.$feedbackBgColor + ? css` + background-color: ${props.$feedbackBgColor}; + ` + : undefined} + } - &:has(input:disabled:checked) { - ${(props) => css` - background-color: ${parseColor(props.$feedbackBgColor)}; - `}; - } + &:has(input:disabled:checked) { + ${(props) => css` + background-color: ${parseColor(props.$feedbackBgColor)}; + `}; + } + } `; export type OakQuizCheckBoxProps = Omit & { @@ -204,7 +200,8 @@ export const OakQuizCheckBox = (props: OakQuizCheckBoxProps) => { isHighlighted ? "border-decorative5-stronger" : "transparent" } > - { } /> {image ? imageContainer : displayValue} - + {isFeedback && (showTick || showCross) && (