@codecademy/brand 1.19.0-alpha.c7e56c87e5.0 → 1.19.0-alpha.d7b0b48c59.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.
Files changed (27) hide show
  1. package/dist/AppHeader/AppHeaderElements/AppHeaderLinkSections/index.js +0 -0
  2. package/dist/GlobalHeader/GlobalHeaderItems.js +5 -6
  3. package/dist/LearningOutcomeBadges/LearningOutcomeLevelBadge.d.ts +18 -0
  4. package/dist/LearningOutcomeBadges/LearningOutcomeLevelBadge.js +57 -0
  5. package/dist/LearningOutcomeBadges/LearningOutcomeLowAssessmentBadge.d.ts +10 -0
  6. package/dist/LearningOutcomeBadges/LearningOutcomeLowAssessmentBadge.js +35 -0
  7. package/dist/LearningOutcomeBadges/index.d.ts +2 -0
  8. package/dist/LearningOutcomeBadges/index.js +2 -0
  9. package/dist/LearningOutcomePopover/index.d.ts +11 -0
  10. package/dist/LearningOutcomePopover/index.js +125 -0
  11. package/dist/LearningOutcomeTile/Tile.d.ts +7 -0
  12. package/dist/LearningOutcomeTile/Tile.js +79 -0
  13. package/dist/LearningOutcomeTile/index.d.ts +2 -0
  14. package/dist/LearningOutcomeTile/index.js +75 -0
  15. package/dist/LearningOutcomeTile/types.d.ts +43 -0
  16. package/dist/LearningOutcomeTile/types.js +11 -0
  17. package/dist/index.d.ts +2 -0
  18. package/dist/index.js +2 -0
  19. package/dist/stories/Molecules/LearningOutcomeLevelBadge.stories.d.ts +6 -0
  20. package/dist/stories/Molecules/LearningOutcomeLevelBadge.stories.js +20 -0
  21. package/dist/stories/Molecules/LearningOutcomeLowAssessmentBadge.stories.d.ts +6 -0
  22. package/dist/stories/Molecules/LearningOutcomeLowAssessmentBadge.stories.js +10 -0
  23. package/dist/stories/Molecules/LearningOutcomePopover.stories.d.ts +5 -0
  24. package/dist/stories/Molecules/LearningOutcomePopover.stories.js +40 -0
  25. package/dist/stories/Molecules/LearningOutcomeTile.stories.d.ts +10 -0
  26. package/dist/stories/Molecules/LearningOutcomeTile.stories.js +248 -0
  27. package/package.json +1 -1
@@ -220,7 +220,7 @@ const profileBusinessAccount = {
220
220
  icon: PieLineGraphIcon,
221
221
  href: '/business/plans',
222
222
  trackingTarget: 'avatar_business',
223
- text: 'Admin Dashboard',
223
+ text: 'Business Account Management',
224
224
  type: 'link'
225
225
  };
226
226
  const profileHelpCenter = {
@@ -300,12 +300,11 @@ export const proProfile = user => {
300
300
  topSection.push(profileAccount);
301
301
  }
302
302
  topSection.push(profileMyHome);
303
- topSection.push(profileHelpCenter);
304
- topSection.push(profileFeedback);
305
- const teamsAdminSection = [];
306
303
  if ((user?.isAccountManager || user?.isBusinessAdmin) && !user?.hideBusinessAccount) {
307
- teamsAdminSection.push(profileBusinessAccount);
304
+ topSection.push(profileBusinessAccount);
308
305
  }
306
+ topSection.push(profileHelpCenter);
307
+ topSection.push(profileFeedback);
309
308
  const middleSection = [];
310
309
  if (user.isAdmin) {
311
310
  middleSection.push(profileAdmin);
@@ -317,7 +316,7 @@ export const proProfile = user => {
317
316
  middleSection.push(profileReportBug);
318
317
  }
319
318
  const bottomSection = [profileLogOut];
320
- const popover = [topSection, teamsAdminSection, middleSection, bottomSection];
319
+ const popover = [topSection, middleSection, bottomSection];
321
320
  return {
322
321
  avatar: user.avatar,
323
322
  userDisplayName: user.displayName,
@@ -0,0 +1,18 @@
1
+ import { TextProps } from '@codecademy/gamut';
2
+ export declare enum LearningOutcomeLevels {
3
+ One = 1,
4
+ Two = 2,
5
+ Three = 3
6
+ }
7
+ export declare const learningOutcomeLabels: {
8
+ 1: string;
9
+ 2: string;
10
+ 3: string;
11
+ };
12
+ interface LearningOutcomeLevelBadgeProps extends Pick<TextProps, 'textColor'> {
13
+ level: LearningOutcomeLevels;
14
+ size?: 'sm' | 'base';
15
+ removeBackground?: boolean;
16
+ }
17
+ export declare const LearningOutcomeLevelBadge: React.FC<LearningOutcomeLevelBadgeProps>;
18
+ export {};
@@ -0,0 +1,57 @@
1
+ import _styled from "@emotion/styled/base";
2
+ import { Badge, FlexBox, Text } from '@codecademy/gamut';
3
+ import { css, variant } from '@codecademy/gamut-styles';
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ export let LearningOutcomeLevels = /*#__PURE__*/function (LearningOutcomeLevels) {
6
+ LearningOutcomeLevels[LearningOutcomeLevels["One"] = 1] = "One";
7
+ LearningOutcomeLevels[LearningOutcomeLevels["Two"] = 2] = "Two";
8
+ LearningOutcomeLevels[LearningOutcomeLevels["Three"] = 3] = "Three";
9
+ return LearningOutcomeLevels;
10
+ }({});
11
+ export const learningOutcomeLabels = {
12
+ [LearningOutcomeLevels.One]: 'Subskill',
13
+ [LearningOutcomeLevels.Two]: 'Skill',
14
+ [LearningOutcomeLevels.Three]: 'Skill set'
15
+ };
16
+ const StyledBadge = /*#__PURE__*/_styled(Badge, {
17
+ target: "e187pstn0",
18
+ label: "StyledBadge"
19
+ })(css({
20
+ borderColor: 'border-tertiary'
21
+ }), variant({
22
+ prop: 'level',
23
+ variants: {
24
+ [LearningOutcomeLevels.One]: {
25
+ bg: 'background-selected'
26
+ },
27
+ [LearningOutcomeLevels.Two]: {
28
+ bg: 'green-100'
29
+ },
30
+ [LearningOutcomeLevels.Three]: {
31
+ bg: 'blue-100'
32
+ }
33
+ }
34
+ }), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9MZWFybmluZ091dGNvbWVCYWRnZXMvTGVhcm5pbmdPdXRjb21lTGV2ZWxCYWRnZS50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBZ0JvQiIsImZpbGUiOiIuLi8uLi9zcmMvTGVhcm5pbmdPdXRjb21lQmFkZ2VzL0xlYXJuaW5nT3V0Y29tZUxldmVsQmFkZ2UudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgQmFkZ2UsIEZsZ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gfSxcbiAgfSlcbik7XG5cbmludGVyZmFjZSBMZWFybmluZ091dGNvbWVMZXZlbEJhZGdlUHJvcHMgZXh0ZW5kcyBQaWNrPFRleHRQcm9wcywgJ3RleHRDb2xvcic+IHtcbiAgbGV2ZWw6IExlYXJuaW5nT3V0Y29tZUxldmVscztcbiAgc2l6ZT86ICdzbScgfCAnYmFzZSc7XG4gIHJlbW92ZUJhY2tncm91bmQ/OiBib29sZWFuO1xufVxuXG5leHBvcnQgY29uc3QgTGVhcm5pbmdPdXRjb21lTGV2ZWxCYWRnZTogUmVhY3QuRkM8XG4gIExlYXJuaW5nT3V0Y29tZUxldmVsQmFkZ2VQcm9wc1xuPiA9ICh7IGxldmVsLCBzaXplID0gJ3NtJywgdGV4dENvbG9yLCByZW1vdmVCYWNrZ3JvdW5kIH0pID0+IHtcbiAgcmV0dXJuIChcbiAgICA8RmxleEJveFxuICAgICAgYmc9e3JlbW92ZUJhY2tncm91bmQgPyAndHJhbnNwYXJlbnQnIDogJ3doaXRlJ31cbiAgICAgIGhlaWdodD1cIm1pbi1jb250ZW50XCJcbiAgICAgIHdpZHRoPVwibWluLWNvbnRlbnRcIlxuICAgICAgYm9yZGVyUmFkaXVzPVwieGxcIlxuICAgID5cbiAgICAgIDxTdHlsZWRCYWRnZVxuICAgICAgICBkYXRhLXRlc3RpZD1cImxlYXJuaW5nLW91dGNvbWUtYmFkZ2VcIlxuICAgICAgICBzaXplPXtzaXplfVxuICAgICAgICB2YXJpYW50PVwidGVydGlhcnlcIlxuICAgICAgICBsZXZlbD17bGV2ZWx9XG4gICAgICA+XG4gICAgICAgIDxUZXh0IGNvbG9yPXt0ZXh0Q29sb3IgfHwgJ3RleHQnfT57bGVhcm5pbmdPdXRjb21lTGFiZWxzW2xldmVsXX08L1RleHQ+XG4gICAgICA8L1N0eWxlZEJhZGdlPlxuICAgIDwvRmxleEJveD5cbiAgKTtcbn07XG4iXX0= */");
35
+ export const LearningOutcomeLevelBadge = ({
36
+ level,
37
+ size = 'sm',
38
+ textColor,
39
+ removeBackground
40
+ }) => {
41
+ return /*#__PURE__*/_jsx(FlexBox, {
42
+ bg: removeBackground ? 'transparent' : 'white',
43
+ height: "min-content",
44
+ width: "min-content",
45
+ borderRadius: "xl",
46
+ children: /*#__PURE__*/_jsx(StyledBadge, {
47
+ "data-testid": "learning-outcome-badge",
48
+ size: size,
49
+ variant: "tertiary",
50
+ level: level,
51
+ children: /*#__PURE__*/_jsx(Text, {
52
+ color: textColor || 'text',
53
+ children: learningOutcomeLabels[level]
54
+ })
55
+ })
56
+ });
57
+ };
@@ -0,0 +1,10 @@
1
+ export declare const LearningOutcomeLowAssessmentDot: import("@emotion/styled").StyledComponent<{
2
+ theme?: import("@emotion/react").Theme | undefined;
3
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
4
+ } & import("@codecademy/gamut").BoxProps & Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "onClick" | "slot" | "style" | "title" | "children" | "onAnimationStart" | "onDragStart" | "onDragEnd" | "onDrag" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "content" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDragCapture" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | keyof import("react").ClassAttributes<HTMLDivElement>> & {
5
+ theme?: import("@emotion/react").Theme;
6
+ } & {
7
+ hasBorder?: boolean;
8
+ small?: boolean;
9
+ }, {}, {}>;
10
+ export declare const LearningOutcomeLowAssessmentBadge: React.FC;
@@ -0,0 +1,35 @@
1
+ import _styled from "@emotion/styled/base";
2
+ import { Badge, Box, Text } from '@codecademy/gamut';
3
+ import { css, states } from '@codecademy/gamut-styles';
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
+ export const LearningOutcomeLowAssessmentDot = /*#__PURE__*/_styled(Box, {
6
+ target: "ege7mnh0",
7
+ label: "LearningOutcomeLowAssessmentDot"
8
+ })(css({
9
+ bg: 'orange-500',
10
+ borderRadius: 'full',
11
+ height: 16,
12
+ width: 16
13
+ }), states({
14
+ hasBorder: {
15
+ border: 2,
16
+ borderColor: 'background-contrast'
17
+ },
18
+ small: {
19
+ height: 8,
20
+ width: 8
21
+ }
22
+ }), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9MZWFybmluZ091dGNvbWVCYWRnZXMvTGVhcm5pbmdPdXRjb21lTG93QXNzZXNzbWVudEJhZGdlLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFJK0MiLCJmaWxlIjoiLi4vLi4vc3JjL0xlYXJuaW5nT3V0Y29tZUJhZGdlcy9MZWFybmluZ091dGNvbWVMb3dBc3Nlc3NtZW50QmFkZ2UudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgQmFkZ2UsIEJveCwgVGV4dCB9IGZyb20gJ0Bjb2RlY2FkZW15L2dhbXV0JztcbmltcG9ydCB7IGNzcywgc3RhdGVzIH0gZnJvbSAnQGNvZGVjYWRlbXkvZ2FtdXQtc3R5bGVzJztcbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcblxuZXhwb3J0IGNvbnN0IExlYXJuaW5nT3V0Y29tZUxvd0Fzc2Vzc21lbnREb3QgPSBzdHlsZWQoQm94KTx7XG4gIGhhc0JvcmRlcj86IGJvb2xlYW47XG4gIHNtYWxsPzogYm9vbGVhbjtcbn0+KFxuICBjc3Moe1xuICAgIGJnOiAnb3JhbmdlLTUwMCcsXG4gICAgYm9yZGVyUmFkaXVzOiAnZnVsbCcsXG4gICAgaGVpZ2h0OiAxNixcbiAgICB3aWR0aDogMTYsXG4gIH0pLFxuICBzdGF0ZXMoe1xuICAgIGhhc0JvcmRlcjoge1xuICAgICAgYm9yZGVyOiAyLFxuICAgICAgYm9yZGVyQ29sb3I6ICdiYWNrZ3JvdW5kLWNvbnRyYXN0JyxcbiAgICB9LFxuICAgIHNtYWxsOiB7XG4gICAgICBoZWlnaHQ6IDgsXG4gICAgICB3aWR0aDogOCxcbiAgICB9LFxuICB9KVxuKTtcblxuZXhwb3J0IGNvbnN0IExlYXJuaW5nT3V0Y29tZUxvd0Fzc2Vzc21lbnRCYWRnZTogUmVhY3QuRkMgPSAoKSA9PiB7XG4gIHJldHVybiAoXG4gICAgPEJhZGdlIHZhcmlhbnQ9XCJjdXN0b21cIiBzaXplPVwic21cIiBiZz1cIm9yYW5nZS0xMDBcIj5cbiAgICAgIDxMZWFybmluZ091dGNvbWVMb3dBc3Nlc3NtZW50RG90IHNtYWxsIC8+XG4gICAgICA8VGV4dCBtbD17NH0+TmVlZHMgcmV2aWV3PC9UZXh0PlxuICAgIDwvQmFkZ2U+XG4gICk7XG59O1xuIl19 */");
23
+ export const LearningOutcomeLowAssessmentBadge = () => {
24
+ return /*#__PURE__*/_jsxs(Badge, {
25
+ variant: "custom",
26
+ size: "sm",
27
+ bg: "orange-100",
28
+ children: [/*#__PURE__*/_jsx(LearningOutcomeLowAssessmentDot, {
29
+ small: true
30
+ }), /*#__PURE__*/_jsx(Text, {
31
+ ml: 4,
32
+ children: "Needs review"
33
+ })]
34
+ });
35
+ };
@@ -0,0 +1,2 @@
1
+ export * from './LearningOutcomeLevelBadge';
2
+ export * from './LearningOutcomeLowAssessmentBadge';
@@ -0,0 +1,2 @@
1
+ export * from './LearningOutcomeLevelBadge';
2
+ export * from './LearningOutcomeLowAssessmentBadge';
@@ -0,0 +1,11 @@
1
+ import { LearningOutcomePopoverDetailsProps } from '../LearningOutcomeTile/types';
2
+ interface LearningOutcomePopoverProps {
3
+ activeElRef: React.RefObject<HTMLDivElement>;
4
+ id: string;
5
+ isOpen: boolean;
6
+ learningOutcomeDetails: LearningOutcomePopoverDetailsProps;
7
+ setIsOpen: (isOpen: boolean) => void;
8
+ horizontalOffset?: number;
9
+ }
10
+ export declare const LearningOutcomePopover: React.FC<LearningOutcomePopoverProps>;
11
+ export {};
@@ -0,0 +1,125 @@
1
+ import { FlexBox, Popover, Text } from '@codecademy/gamut';
2
+ import { SmallCheckIcon } from '@codecademy/gamut-icons';
3
+ import { LearningOutcomeLevelBadge, LearningOutcomeLowAssessmentBadge } from '../LearningOutcomeBadges';
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
+ const POPOVER_WIDTH = 332;
6
+ const POPOVER_HORIZONTAL_PADDING = 16;
7
+ const ASSESSMENT_WIDTH = (POPOVER_WIDTH - POPOVER_HORIZONTAL_PADDING * 2) / 2;
8
+ const Assessment = ({
9
+ score,
10
+ type,
11
+ noBorderLeft
12
+ }) => /*#__PURE__*/_jsxs(FlexBox, {
13
+ borderTop: 1,
14
+ borderBottom: 1,
15
+ borderRight: 1,
16
+ borderLeft: !noBorderLeft ? 1 : undefined,
17
+ borderColor: "background-hover",
18
+ p: 8,
19
+ gap: 4,
20
+ width: ASSESSMENT_WIDTH,
21
+ children: [/*#__PURE__*/_jsx(Text, {
22
+ variant: "p-small",
23
+ color: "text-secondary",
24
+ children: type === 'highest' ? 'Highest score:' : 'Most recent:'
25
+ }), score != null ? /*#__PURE__*/_jsx(Text, {
26
+ variant: "p-small",
27
+ color: score && score >= 70 ? 'green-700' : 'text',
28
+ fontWeight: 700,
29
+ children: `${score}%`
30
+ }) : /*#__PURE__*/_jsx(Text, {
31
+ variant: "p-small",
32
+ color: "text-disabled",
33
+ children: "-"
34
+ })]
35
+ });
36
+ export const LearningOutcomePopover = ({
37
+ activeElRef,
38
+ isOpen,
39
+ setIsOpen,
40
+ learningOutcomeDetails,
41
+ ...rest
42
+ }) => {
43
+ const {
44
+ level,
45
+ outcome,
46
+ latestScore,
47
+ highestScore,
48
+ percentComplete = 0
49
+ } = learningOutcomeDetails || {};
50
+ const lowLatestAssessment = Boolean(latestScore != null && latestScore < 70);
51
+ const renderProgress = () => /*#__PURE__*/_jsxs(FlexBox, {
52
+ children: [Boolean(percentComplete === 100) && /*#__PURE__*/_jsx(FlexBox, {
53
+ width: 16,
54
+ height: 16,
55
+ borderRadius: "md",
56
+ bg: "primary",
57
+ mr: 4,
58
+ alignItems: "center",
59
+ justifyContent: "center",
60
+ children: /*#__PURE__*/_jsx(SmallCheckIcon, {
61
+ size: 11,
62
+ color: "white"
63
+ })
64
+ }), /*#__PURE__*/_jsx(Text, {
65
+ color: "text",
66
+ variant: "p-small",
67
+ children: `${percentComplete}% progress`
68
+ })]
69
+ });
70
+ return /*#__PURE__*/_jsx(Popover, {
71
+ ...rest,
72
+ isOpen: isOpen,
73
+ targetRef: activeElRef,
74
+ onRequestClose: () => setIsOpen(false),
75
+ position: "above",
76
+ beak: "center",
77
+ outline: true,
78
+ children: /*#__PURE__*/_jsxs(FlexBox, {
79
+ width: POPOVER_WIDTH,
80
+ pt: 24,
81
+ pb: 4,
82
+ px: POPOVER_HORIZONTAL_PADDING,
83
+ gap: 24,
84
+ column: true,
85
+ children: [/*#__PURE__*/_jsxs(FlexBox, {
86
+ gap: 16,
87
+ column: true,
88
+ children: [/*#__PURE__*/_jsxs(FlexBox, {
89
+ justifyContent: "space-between",
90
+ children: [!!level && /*#__PURE__*/_jsx(LearningOutcomeLevelBadge, {
91
+ level: level
92
+ }), lowLatestAssessment && /*#__PURE__*/_jsx(LearningOutcomeLowAssessmentBadge, {})]
93
+ }), /*#__PURE__*/_jsx(Text, {
94
+ color: "text",
95
+ textAlign: "left",
96
+ variant: "title-xs",
97
+ whiteSpace: "break-spaces",
98
+ children: outcome
99
+ }), renderProgress()]
100
+ }), /*#__PURE__*/_jsxs(FlexBox, {
101
+ alignItems: "flex-start",
102
+ gap: 4,
103
+ pt: 16,
104
+ pb: 12,
105
+ borderTop: 1,
106
+ borderColor: "background-hover",
107
+ column: true,
108
+ children: [/*#__PURE__*/_jsx(Text, {
109
+ variant: "p-small",
110
+ fontWeight: 700,
111
+ children: "Evaluation results"
112
+ }), /*#__PURE__*/_jsxs(FlexBox, {
113
+ children: [/*#__PURE__*/_jsx(Assessment, {
114
+ score: highestScore,
115
+ type: "highest"
116
+ }), /*#__PURE__*/_jsx(Assessment, {
117
+ score: latestScore,
118
+ type: "latest",
119
+ noBorderLeft: true
120
+ })]
121
+ })]
122
+ })]
123
+ })
124
+ });
125
+ };
@@ -0,0 +1,7 @@
1
+ import { TileProps } from './types';
2
+ export declare const Tile: import("@emotion/styled").StyledComponent<{
3
+ theme?: import("@emotion/react").Theme | undefined;
4
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
5
+ } & import("@codecademy/gamut").FlexBoxProps & Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "onClick" | "slot" | "style" | "title" | "children" | "onAnimationStart" | "onDragStart" | "onDragEnd" | "onDrag" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "content" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDragCapture" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | keyof import("react").ClassAttributes<HTMLDivElement>> & {
6
+ theme?: import("@emotion/react").Theme;
7
+ } & TileProps, {}, {}>;
@@ -0,0 +1,79 @@
1
+ import _styled from "@emotion/styled/base";
2
+ import { FlexBox } from '@codecademy/gamut';
3
+ import { variant } from '@codecademy/gamut-styles';
4
+ import { Progress } from './types';
5
+ const tileStyles = {
6
+ alignItems: 'center',
7
+ justifyContent: 'center',
8
+ borderRadius: 'md',
9
+ cursor: 'default',
10
+ position: 'relative'
11
+ };
12
+ const hoverVariants = hover => variant({
13
+ prop: 'progress',
14
+ variants: {
15
+ [Progress.notStarted]: {
16
+ '&:hover': {
17
+ bg: hover ? 'background-hover' : undefined
18
+ }
19
+ },
20
+ [Progress.inProgress]: {
21
+ '&:hover': {
22
+ bg: hover ? 'rgba(85, 51, 255, 0.12)' : undefined
23
+ } // this is primary-hover color with 12% opacity
24
+ },
25
+ [Progress.completed]: {
26
+ '&:hover': {
27
+ bg: hover ? 'primary-hover' : undefined
28
+ }
29
+ }
30
+ }
31
+ });
32
+ const sizeVariants = size => variant({
33
+ prop: 'progress',
34
+ base: {
35
+ border: size === 'small' ? 'none' : 2
36
+ },
37
+ variants: {
38
+ [Progress.notStarted]: {
39
+ width: size === 'small' ? 32 : 40,
40
+ height: size === 'small' ? 24 : 40
41
+ },
42
+ [Progress.inProgress]: {
43
+ width: size === 'small' ? 32 : 40,
44
+ height: size === 'small' ? 24 : 40
45
+ },
46
+ [Progress.completed]: {
47
+ width: size === 'small' ? 20 : 40,
48
+ height: size === 'small' ? 20 : 40
49
+ }
50
+ }
51
+ });
52
+ export const Tile = /*#__PURE__*/_styled(FlexBox, {
53
+ target: "e4znlwe0",
54
+ label: "Tile"
55
+ })(props => ({
56
+ ...hoverVariants(props.hover)(props),
57
+ ...sizeVariants(props.size)(props),
58
+ ...variant({
59
+ prop: 'progress',
60
+ base: {
61
+ ...tileStyles
62
+ },
63
+ variants: {
64
+ [Progress.notStarted]: {
65
+ bg: 'background-selected',
66
+ borderColor: 'background-hover'
67
+ },
68
+ [Progress.inProgress]: {
69
+ bg: 'rgba(58, 16, 229, 0.12)',
70
+ // this is primary color with 12% opacity
71
+ borderColor: 'primary'
72
+ },
73
+ [Progress.completed]: {
74
+ bg: 'primary',
75
+ borderColor: 'border-tertiary'
76
+ }
77
+ }
78
+ })(props)
79
+ }), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9MZWFybmluZ091dGNvbWVUaWxlL1RpbGUudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXNEb0IiLCJmaWxlIjoiLi4vLi4vc3JjL0xlYXJuaW5nT3V0Y29tZVRpbGUvVGlsZS50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBGbGV4Qm94IH0gZnJvbSAnQGNvZGVjYWRlbXkvZ2FtdXQnO1xuaW1wb3J0IHsgdmFyaWFudCB9IGZyb20gJ0Bjb2RlY2FkZW15L2dhbXV0LXN0eWxlcyc7XG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XG5cbmltcG9ydCB7IFByb2dyZXNzLCBTaXplVHlwZSwgVGlsZVByb3BzIH0gZnJvbSAnLi90eXBlcyc7XG5cbmNvbnN0IHRpbGVTdHlsZXMgPSB7XG4gIGFsaWduSXRlbXM6ICdjZW50ZXInLFxuICBqdXN0aWZ5Q29udGVudDogJ2NlbnRlcicsXG4gIGJvcmRlclJhZGl1czogJ21kJyxcbiAgY3Vyc29yOiAnZGVmYXVsdCcsXG4gIHBvc2l0aW9uOiAncmVsYXRpdmUnLFxufSBhcyBjb25zdDtcblxuY29uc3QgaG92ZXJWYXJpYW50cyA9IChob3ZlcjogYm9vbGVhbikgPT5cbiAgdmFyaWFudCh7XG4gICAgcHJvcDogJ3Byb2dyZXNzJyxcbiAgICB2YXJpYW50czoge1xuICAgICAgW1Byb2dyZXNzLm5vdFN0YXJ0ZWRdOiB7XG4gICAgIC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 import { LearningOutcomeTileProps } from './types';
2
+ export declare const LearningOutcomeTile: React.FC<LearningOutcomeTileProps>;
@@ -0,0 +1,75 @@
1
+ import { Text } from '@codecademy/gamut';
2
+ import { SmallCheckIcon } from '@codecademy/gamut-icons';
3
+ import { useRef, useState } from 'react';
4
+ import { LearningOutcomeLowAssessmentDot } from '../LearningOutcomeBadges';
5
+ import { LearningOutcomePopover } from '../LearningOutcomePopover';
6
+ import { Tile } from './Tile';
7
+ import { Progress } from './types';
8
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
9
+ const progressState = percentComplete => {
10
+ if (percentComplete === 0) {
11
+ return Progress.notStarted;
12
+ }
13
+ if (percentComplete > 0 && percentComplete < 100) {
14
+ return Progress.inProgress;
15
+ }
16
+ return Progress.completed;
17
+ };
18
+ export const LearningOutcomeTile = ({
19
+ learningOutcomeDetails,
20
+ popover = false,
21
+ hover = false,
22
+ size = 'normal'
23
+ }) => {
24
+ const {
25
+ id,
26
+ latestScore,
27
+ percentComplete = 0
28
+ } = learningOutcomeDetails || {};
29
+ const [isOpen, setIsOpen] = useState(false);
30
+ const activeElRef = useRef(null);
31
+ const hoverProps = popover && hover ? {
32
+ ref: activeElRef,
33
+ tabIndex: 0,
34
+ onMouseEnter: () => setIsOpen(true),
35
+ onMouseLeave: () => setIsOpen(false),
36
+ onFocus: () => setIsOpen(true),
37
+ // For keyboard users
38
+ onBlur: () => setIsOpen(false),
39
+ // Close on blur
40
+ 'aria-describedby': `${id}-popover`
41
+ } : {};
42
+ const lowLatestAssessment = Boolean(latestScore != null && latestScore < 70);
43
+ const progress = progressState(percentComplete);
44
+ const isCompleted = progress === Progress.completed;
45
+ const isSmall = size === 'small';
46
+ const showLowAssessmentDot = lowLatestAssessment && !isSmall;
47
+ return /*#__PURE__*/_jsxs(_Fragment, {
48
+ children: [/*#__PURE__*/_jsxs(Tile, {
49
+ hover: hover,
50
+ progress: progress,
51
+ size: size,
52
+ ...hoverProps,
53
+ children: [isCompleted ? /*#__PURE__*/_jsx(SmallCheckIcon, {
54
+ size: size === 'small' ? 12 : 16,
55
+ textColor: "background-contrast"
56
+ }) : /*#__PURE__*/_jsx(Text, {
57
+ fontSize: 14,
58
+ fontWeight: 700,
59
+ children: `${percentComplete}%`
60
+ }), showLowAssessmentDot && /*#__PURE__*/_jsx(LearningOutcomeLowAssessmentDot, {
61
+ position: "absolute",
62
+ top: "-20%",
63
+ right: "-20%",
64
+ hasBorder: true
65
+ })]
66
+ }), isOpen && /*#__PURE__*/_jsx(LearningOutcomePopover, {
67
+ id: `${id}-popover`,
68
+ activeElRef: activeElRef,
69
+ isOpen: isOpen,
70
+ setIsOpen: setIsOpen,
71
+ horizontalOffset: isSmall && isCompleted ? 159 : isSmall ? 153 : 150,
72
+ learningOutcomeDetails: learningOutcomeDetails
73
+ })]
74
+ });
75
+ };
@@ -0,0 +1,43 @@
1
+ export declare enum Progress {
2
+ notStarted = "notStarted",
3
+ inProgress = "inProgress",
4
+ completed = "completed"
5
+ }
6
+ export type SizeType = 'small' | 'normal';
7
+ export interface TileProps {
8
+ hover: boolean;
9
+ progress: Progress;
10
+ size: SizeType;
11
+ }
12
+ interface LearningOutcomeTileDetailsProps {
13
+ id: string;
14
+ percentComplete: number | undefined;
15
+ latestScore?: number;
16
+ }
17
+ export interface LearningOutcomePopoverDetailsProps {
18
+ id: string;
19
+ percentComplete: number | undefined;
20
+ level: number;
21
+ outcome: string;
22
+ latestScore?: number;
23
+ highestScore?: number;
24
+ }
25
+ interface WithHoverAndWithPopover {
26
+ learningOutcomeDetails: LearningOutcomePopoverDetailsProps;
27
+ hover: true;
28
+ popover: true;
29
+ }
30
+ interface WithHoverAndWithoutPopover {
31
+ learningOutcomeDetails: LearningOutcomeTileDetailsProps;
32
+ hover: true;
33
+ popover: false;
34
+ }
35
+ interface WithoutHoverAndWithoutPopover {
36
+ learningOutcomeDetails: LearningOutcomeTileDetailsProps;
37
+ hover?: false;
38
+ popover?: false;
39
+ }
40
+ export type LearningOutcomeTileProps = {
41
+ size?: SizeType;
42
+ } & (WithHoverAndWithPopover | WithHoverAndWithoutPopover | WithoutHoverAndWithoutPopover);
43
+ export {};
@@ -0,0 +1,11 @@
1
+ export let Progress = /*#__PURE__*/function (Progress) {
2
+ Progress["notStarted"] = "notStarted";
3
+ Progress["inProgress"] = "inProgress";
4
+ Progress["completed"] = "completed";
5
+ return Progress;
6
+ }({});
7
+
8
+ /* The following interfaces define the props for the LearningOutcomeTile component based on different states of hover and popover.
9
+ When hover is true, popover prop is required (either true or false).
10
+ When hover is false, popover prop is optional and defaults to false.
11
+ */
package/dist/index.d.ts CHANGED
@@ -45,7 +45,9 @@ export * from './InfoCard';
45
45
  export * from './Konamimojisplosion';
46
46
  export * from './LandingPage';
47
47
  export * from './LayoutMenu';
48
+ export * from './LearningOutcomeBadges';
48
49
  export * from './LearningOutcomeCard';
50
+ export * from './LearningOutcomeTile';
49
51
  export * from './lib/breakpointHooks';
50
52
  export * from './ListSection';
51
53
  export * from './Loading';
package/dist/index.js CHANGED
@@ -45,7 +45,9 @@ export * from './InfoCard';
45
45
  export * from './Konamimojisplosion';
46
46
  export * from './LandingPage';
47
47
  export * from './LayoutMenu';
48
+ export * from './LearningOutcomeBadges';
48
49
  export * from './LearningOutcomeCard';
50
+ export * from './LearningOutcomeTile';
49
51
  export * from './lib/breakpointHooks';
50
52
  export * from './ListSection';
51
53
  export * from './Loading';
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { LearningOutcomeLevelBadge } from '../../LearningOutcomeBadges';
3
+ declare const meta: Meta<typeof LearningOutcomeLevelBadge>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof LearningOutcomeLevelBadge>;
6
+ export declare const AllLevels: Story;
@@ -0,0 +1,20 @@
1
+ import { FlexBox } from '@codecademy/gamut';
2
+ import { LearningOutcomeLevelBadge } from '../../LearningOutcomeBadges';
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ const meta = {
5
+ component: LearningOutcomeLevelBadge
6
+ };
7
+ export default meta;
8
+ export const AllLevels = {
9
+ render: () => /*#__PURE__*/_jsxs(FlexBox, {
10
+ gap: 16,
11
+ children: [/*#__PURE__*/_jsx(LearningOutcomeLevelBadge, {
12
+ level: 1
13
+ }), /*#__PURE__*/_jsx(LearningOutcomeLevelBadge, {
14
+ level: 2
15
+ }), /*#__PURE__*/_jsx(LearningOutcomeLevelBadge, {
16
+ level: 3
17
+ })]
18
+ }),
19
+ name: 'Learning Outcome Level Badge - All Levels'
20
+ };
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { LearningOutcomeLowAssessmentBadge } from '../../LearningOutcomeBadges';
3
+ declare const meta: Meta<typeof LearningOutcomeLowAssessmentBadge>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof LearningOutcomeLowAssessmentBadge>;
6
+ export declare const Default: Story;
@@ -0,0 +1,10 @@
1
+ import { LearningOutcomeLowAssessmentBadge } from '../../LearningOutcomeBadges';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ const meta = {
4
+ component: LearningOutcomeLowAssessmentBadge
5
+ };
6
+ export default meta;
7
+ export const Default = {
8
+ render: () => /*#__PURE__*/_jsx(LearningOutcomeLowAssessmentBadge, {}),
9
+ name: 'Learning Outcome Low Assessment Badge - Default'
10
+ };
@@ -0,0 +1,5 @@
1
+ import type { Meta } from '@storybook/react';
2
+ import { LearningOutcomePopover } from '../../LearningOutcomePopover';
3
+ declare const meta: Meta<typeof LearningOutcomePopover>;
4
+ export default meta;
5
+ export declare const Example: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,40 @@
1
+ import { Box, FillButton, FlexBox } from '@codecademy/gamut';
2
+ import { useRef, useState } from 'react';
3
+ import { LearningOutcomePopover } from '../../LearningOutcomePopover';
4
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
5
+ const meta = {
6
+ component: LearningOutcomePopover,
7
+ args: {}
8
+ };
9
+ export default meta;
10
+ export const Example = () => {
11
+ const [open, setOpen] = useState(false);
12
+ const activeElRef = useRef(null);
13
+ const toggleOpen = () => setOpen(!open);
14
+ return /*#__PURE__*/_jsxs(_Fragment, {
15
+ children: [/*#__PURE__*/_jsx(Box, {
16
+ ref: activeElRef,
17
+ children: /*#__PURE__*/_jsx(FillButton, {
18
+ onClick: toggleOpen,
19
+ children: "Open Popover"
20
+ })
21
+ }), /*#__PURE__*/_jsx(FlexBox, {
22
+ width: "100%",
23
+ children: /*#__PURE__*/_jsx(LearningOutcomePopover, {
24
+ id: "learning-outcome-popover",
25
+ activeElRef: activeElRef,
26
+ isOpen: open,
27
+ setIsOpen: setOpen,
28
+ learningOutcomeDetails: {
29
+ id: '1',
30
+ level: 2,
31
+ outcome: 'Understand the basics of React',
32
+ latestScore: 68,
33
+ highestScore: 100,
34
+ percentComplete: 75
35
+ },
36
+ horizontalOffset: 90
37
+ })
38
+ })]
39
+ });
40
+ };
@@ -0,0 +1,10 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { LearningOutcomeTile } from '../../LearningOutcomeTile';
3
+ declare const meta: Meta<typeof LearningOutcomeTile>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof LearningOutcomeTile>;
6
+ export declare const Default: Story;
7
+ export declare const WithLowAssessments: Story;
8
+ export declare const WithPopover: Story;
9
+ export declare const Small: Story;
10
+ export declare const DarkMode: Story;
@@ -0,0 +1,248 @@
1
+ import { FlexBox } from '@codecademy/gamut';
2
+ import { Background } from '@codecademy/gamut-styles';
3
+ import { LearningOutcomeTile } from '../../LearningOutcomeTile';
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
+ const meta = {
6
+ component: LearningOutcomeTile,
7
+ args: {
8
+ learningOutcomeDetails: {
9
+ id: '1',
10
+ percentComplete: 0
11
+ },
12
+ size: 'normal'
13
+ }
14
+ };
15
+ export default meta;
16
+ export const Default = {
17
+ render: args => /*#__PURE__*/_jsxs(FlexBox, {
18
+ gap: 16,
19
+ children: [/*#__PURE__*/_jsx(LearningOutcomeTile, {
20
+ ...args,
21
+ popover: false,
22
+ hover: true
23
+ }), /*#__PURE__*/_jsx(LearningOutcomeTile, {
24
+ ...args,
25
+ learningOutcomeDetails: {
26
+ id: '2',
27
+ percentComplete: 50
28
+ },
29
+ popover: false,
30
+ hover: true
31
+ }), /*#__PURE__*/_jsx(LearningOutcomeTile, {
32
+ ...args,
33
+ learningOutcomeDetails: {
34
+ id: '3',
35
+ percentComplete: 100
36
+ },
37
+ popover: false,
38
+ hover: true
39
+ })]
40
+ }),
41
+ name: 'Learning Outcome Tile - Default'
42
+ };
43
+ export const WithLowAssessments = {
44
+ render: args => /*#__PURE__*/_jsxs(FlexBox, {
45
+ gap: 16,
46
+ children: [/*#__PURE__*/_jsx(LearningOutcomeTile, {
47
+ ...args,
48
+ learningOutcomeDetails: {
49
+ id: '1',
50
+ percentComplete: 0,
51
+ latestScore: 50
52
+ },
53
+ popover: false,
54
+ hover: true
55
+ }), /*#__PURE__*/_jsx(LearningOutcomeTile, {
56
+ ...args,
57
+ learningOutcomeDetails: {
58
+ id: '2',
59
+ percentComplete: 50,
60
+ latestScore: 50
61
+ },
62
+ popover: false,
63
+ hover: true
64
+ }), /*#__PURE__*/_jsx(LearningOutcomeTile, {
65
+ ...args,
66
+ learningOutcomeDetails: {
67
+ id: '3',
68
+ percentComplete: 100,
69
+ latestScore: 50
70
+ },
71
+ popover: false,
72
+ hover: true
73
+ })]
74
+ }),
75
+ name: 'Learning Outcome Tile - with Low Assessment Indicator'
76
+ };
77
+ export const WithPopover = {
78
+ render: args => /*#__PURE__*/_jsxs(FlexBox, {
79
+ gap: 16,
80
+ children: [/*#__PURE__*/_jsx(LearningOutcomeTile, {
81
+ ...args,
82
+ learningOutcomeDetails: {
83
+ id: '1',
84
+ level: 1,
85
+ outcome: 'Understand the basics of programming',
86
+ percentComplete: 0
87
+ },
88
+ hover: true,
89
+ popover: true
90
+ }), /*#__PURE__*/_jsx(LearningOutcomeTile, {
91
+ ...args,
92
+ learningOutcomeDetails: {
93
+ id: '2',
94
+ level: 2,
95
+ outcome: 'Apply programming fundamentals',
96
+ percentComplete: 50,
97
+ highestScore: 65,
98
+ latestScore: 50
99
+ },
100
+ hover: true,
101
+ popover: true
102
+ }), /*#__PURE__*/_jsx(LearningOutcomeTile, {
103
+ ...args,
104
+ learningOutcomeDetails: {
105
+ id: '3',
106
+ level: 3,
107
+ outcome: 'Master advanced programming concepts',
108
+ percentComplete: 100,
109
+ highestScore: 70,
110
+ latestScore: 70
111
+ },
112
+ hover: true,
113
+ popover: true
114
+ })]
115
+ }),
116
+ name: 'Learning Outcome Tile - with Popover'
117
+ };
118
+ export const Small = {
119
+ render: args => /*#__PURE__*/_jsxs(FlexBox, {
120
+ gap: 16,
121
+ children: [/*#__PURE__*/_jsx(LearningOutcomeTile, {
122
+ ...args,
123
+ size: "small",
124
+ popover: false,
125
+ hover: true
126
+ }), /*#__PURE__*/_jsx(LearningOutcomeTile, {
127
+ ...args,
128
+ size: "small",
129
+ learningOutcomeDetails: {
130
+ id: '2',
131
+ percentComplete: 50
132
+ },
133
+ popover: false,
134
+ hover: true
135
+ }), /*#__PURE__*/_jsx(LearningOutcomeTile, {
136
+ ...args,
137
+ size: "small",
138
+ learningOutcomeDetails: {
139
+ id: '3',
140
+ percentComplete: 100
141
+ },
142
+ popover: false,
143
+ hover: true
144
+ }), /*#__PURE__*/_jsx(LearningOutcomeTile, {
145
+ ...args,
146
+ size: "small",
147
+ learningOutcomeDetails: {
148
+ id: '2',
149
+ percentComplete: 0,
150
+ outcome: 'Apply programming fundamentals',
151
+ level: 2
152
+ },
153
+ hover: true,
154
+ popover: true
155
+ }), /*#__PURE__*/_jsx(LearningOutcomeTile, {
156
+ ...args,
157
+ size: "small",
158
+ learningOutcomeDetails: {
159
+ id: '2',
160
+ percentComplete: 50,
161
+ outcome: 'Apply programming fundamentals',
162
+ level: 2
163
+ },
164
+ hover: true,
165
+ popover: true
166
+ }), /*#__PURE__*/_jsx(LearningOutcomeTile, {
167
+ ...args,
168
+ size: "small",
169
+ learningOutcomeDetails: {
170
+ id: '3',
171
+ percentComplete: 100,
172
+ outcome: 'Apply programming fundamentals',
173
+ level: 2
174
+ },
175
+ hover: true,
176
+ popover: true
177
+ })]
178
+ }),
179
+ name: 'Learning Outcome Tile - Small'
180
+ };
181
+ export const DarkMode = {
182
+ render: args => /*#__PURE__*/_jsx(Background, {
183
+ bg: "navy",
184
+ p: 24,
185
+ children: /*#__PURE__*/_jsxs(FlexBox, {
186
+ gap: 16,
187
+ children: [/*#__PURE__*/_jsx(LearningOutcomeTile, {
188
+ ...args,
189
+ learningOutcomeDetails: {
190
+ id: '1',
191
+ percentComplete: 0,
192
+ latestScore: 50
193
+ },
194
+ popover: false,
195
+ hover: true
196
+ }), /*#__PURE__*/_jsx(LearningOutcomeTile, {
197
+ ...args,
198
+ learningOutcomeDetails: {
199
+ id: '2',
200
+ percentComplete: 50,
201
+ latestScore: 50
202
+ },
203
+ popover: false,
204
+ hover: true
205
+ }), /*#__PURE__*/_jsx(LearningOutcomeTile, {
206
+ ...args,
207
+ learningOutcomeDetails: {
208
+ id: '3',
209
+ percentComplete: 100,
210
+ latestScore: 50
211
+ },
212
+ popover: false,
213
+ hover: true
214
+ }), /*#__PURE__*/_jsx(LearningOutcomeTile, {
215
+ ...args,
216
+ learningOutcomeDetails: {
217
+ id: '4',
218
+ percentComplete: 0,
219
+ latestScore: 50
220
+ },
221
+ size: "small",
222
+ popover: false,
223
+ hover: true
224
+ }), /*#__PURE__*/_jsx(LearningOutcomeTile, {
225
+ ...args,
226
+ learningOutcomeDetails: {
227
+ id: '5',
228
+ percentComplete: 50,
229
+ latestScore: 50
230
+ },
231
+ size: "small",
232
+ popover: false,
233
+ hover: true
234
+ }), /*#__PURE__*/_jsx(LearningOutcomeTile, {
235
+ ...args,
236
+ learningOutcomeDetails: {
237
+ id: '6',
238
+ percentComplete: 100,
239
+ latestScore: 50
240
+ },
241
+ size: "small",
242
+ popover: false,
243
+ hover: true
244
+ })]
245
+ })
246
+ }),
247
+ name: 'Learning Outcome Tile - Dark Mode'
248
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@codecademy/brand",
3
3
  "description": "Brand component library for Codecademy",
4
- "version": "1.19.0-alpha.c7e56c87e5.0",
4
+ "version": "1.19.0-alpha.d7b0b48c59.0",
5
5
  "author": "Codecademy Engineering <dev@codecademy.com>",
6
6
  "dependencies": {
7
7
  "@emotion/is-prop-valid": "^1.2.1",