@codecademy/styleguide 79.2.0-alpha.9e53d2.0 → 79.2.0-alpha.b1330b.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.
@@ -175,8 +175,8 @@ export const globalTypes = {
175
175
  toolbar: {
176
176
  icon: 'transfer',
177
177
  items: [
178
- { value: 'true', title: 'Logical' },
179
178
  { value: 'false', title: 'Physical' },
179
+ { value: 'true', title: 'Logical' }
180
180
  ],
181
181
  showName: true,
182
182
  },
@@ -12,6 +12,8 @@ import {
12
12
  } from '@codecademy/gamut-styles/src';
13
13
  import { Theme } from '@emotion/react';
14
14
 
15
+ const STORYBOOK_CSP_NONCE = 'storybook-csp-nonce';
16
+
15
17
  /**
16
18
  * Story functions must be called as a regular function to avoid full-remounts
17
19
  * See: https://github.com/storybookjs/storybook/issues/12255
package/CHANGELOG.md CHANGED
@@ -3,13 +3,25 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [79.2.0-alpha.9e53d2.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.1.2...@codecademy/styleguide@79.2.0-alpha.9e53d2.0) (2026-03-05)
6
+ ## [79.2.0-alpha.b1330b.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.1.4...@codecademy/styleguide@79.2.0-alpha.b1330b.0) (2026-03-12)
7
7
 
8
8
  ### Features
9
9
 
10
+ - Layout related logical CSS props ([#3267](https://github.com/Codecademy/gamut/issues/3267)) ([b43cbf1](https://github.com/Codecademy/gamut/commit/b43cbf1256fbf292a141c77a3251fd95f0085a04))
11
+ - logical properties for inset and overflow ([#3269](https://github.com/Codecademy/gamut/issues/3269)) ([18a4d7f](https://github.com/Codecademy/gamut/commit/18a4d7fa7e203b847a9f2b7defdd91345bb30194))
10
12
  - Updates to ThemeProvider, tokens, and transform to allow Logical vs Physical prop resolution ([#3234](https://github.com/Codecademy/gamut/issues/3234)) ([7efbb9a](https://github.com/Codecademy/gamut/commit/7efbb9aabcd07dc6429432d007eaa5603ac1d70c))
11
13
  - Updates to ThemeProvider, tokens, and transform to allow Logical vs Physical prop resolution ([#3234](https://github.com/Codecademy/gamut/issues/3234)) ([567a6ae](https://github.com/Codecademy/gamut/commit/567a6aeffb3e8628db4b5c9a37dab965b716d969))
12
14
 
15
+ ### [79.1.4](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.1.3...@codecademy/styleguide@79.1.4) (2026-03-09)
16
+
17
+ **Note:** Version bump only for package @codecademy/styleguide
18
+
19
+ ### [79.1.3](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.1.2...@codecademy/styleguide@79.1.3) (2026-03-02)
20
+
21
+ ### Bug Fixes
22
+
23
+ - **GamutProvider:** CSP improvements ([1026353](https://github.com/Codecademy/gamut/commit/10263537c190aff0e5686872da2be2a30b1d9201)), closes [/github.com/adobe/react-spectrum/issues/8273#issuecomment-3897820426](https://github.com/Codecademy//github.com/adobe/react-spectrum/issues/8273/issues/issuecomment-3897820426)
24
+
13
25
  ### [79.1.2](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.1.1...@codecademy/styleguide@79.1.2) (2026-02-12)
14
26
 
15
27
  **Note:** Version bump only for package @codecademy/styleguide
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@codecademy/styleguide",
3
3
  "description": "Styleguide & Component library for codecademy.com",
4
- "version": "79.2.0-alpha.9e53d2.0",
4
+ "version": "79.2.0-alpha.b1330b.0",
5
5
  "author": "Codecademy Engineering",
6
6
  "license": "MIT",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
10
10
  "repository": "git@github.com:Codecademy/gamut.git",
11
- "gitHead": "cb848b578a24ad4b3657640f469ca68e179c95b7"
11
+ "gitHead": "b012e40f2554976dd9ec77add1d64d60a9f5ca62"
12
12
  }
@@ -18,6 +18,16 @@ export const parameters = {
18
18
 
19
19
  Layout props control the visual structure and dimensions of elements. These properties determine how components take up space, their display behavior, and how they align within their containers. Use these props to set widths, heights, overflow behavior, and container types for responsive layouts.
20
20
 
21
+ ## Examples
22
+
23
+ ### Overflow X
24
+
25
+ <Canvas of={LayoutStories.OverflowXExample} />
26
+
27
+ ### Overflow Y
28
+
29
+ <Canvas of={LayoutStories.OverflowYExample} />
30
+
21
31
  ```tsx
22
32
  import styled from '@emotion/styled';
23
33
  import { system } from '@codecademy/gamut-styles';
@@ -9,6 +9,45 @@ const meta: Meta<typeof Box> = {
9
9
  export default meta;
10
10
  type Story = StoryObj<typeof Box>;
11
11
 
12
+ export const OverflowXExample: Story = {
13
+ render: () => (
14
+ <Box
15
+ bg="background-selected"
16
+ overflowX="scroll"
17
+ p={16}
18
+ whiteSpace="nowrap"
19
+ width="200px"
20
+ >
21
+ <Box
22
+ bg="primary"
23
+ color="background-contrast"
24
+ display="inline-block"
25
+ p={8}
26
+ >
27
+ This content is wider than its container and has{' '}
28
+ <Markdown text="`overflowX='scroll'`." /> Inspect the example to see
29
+ what CSS properties are rendered.
30
+ </Box>
31
+ </Box>
32
+ ),
33
+ };
34
+
35
+ export const OverflowYExample: Story = {
36
+ render: () => (
37
+ <Box bg="background-selected" height="100px" overflowY="scroll" p={16}>
38
+ <Box bg="primary" color="background-contrast" p={8}>
39
+ This content is taller than its container and has{' '}
40
+ <Markdown text="`overflowY='scroll'`." /> Inspect the example to see
41
+ what CSS properties are rendered.
42
+ <Box mt={16}>Line 2</Box>
43
+ <Box mt={16}>Line 3</Box>
44
+ <Box mt={16}>Line 4</Box>
45
+ <Box mt={16}>Line 5</Box>
46
+ </Box>
47
+ </Box>
48
+ ),
49
+ };
50
+
12
51
  export const WidthExample: Story = {
13
52
  render: () => (
14
53
  <Box bg="background-selected" p={16}>
@@ -1,8 +1,9 @@
1
- import { Meta } from '@storybook/blocks';
1
+ import { Canvas, Meta } from '@storybook/blocks';
2
2
 
3
3
  import { AboutHeader, TokenTable } from '~styleguide/blocks';
4
4
 
5
5
  import { defaultColumns, getPropRows } from '../../shared/elements';
6
+ import * as PositioningStories from './Positioning.stories';
6
7
 
7
8
  export const parameters = {
8
9
  title: 'Positioning',
@@ -11,7 +12,7 @@ export const parameters = {
11
12
  status: 'updating',
12
13
  };
13
14
 
14
- <Meta title="Foundations/System/Props/Positioning" />
15
+ <Meta title="Foundations/System/Props/Positioning" of={PositioningStories} />
15
16
 
16
17
  <AboutHeader {...parameters} />
17
18
 
@@ -26,4 +27,8 @@ const PositioningExample = styled.div(system.positioning);
26
27
  <PositioningExample position="absolute" zIndex={2} top="0" left="0" />;
27
28
  ```
28
29
 
30
+ These positioning props support both physical and logical CSS properties and will render the appropriate properties based on `useLogicalProperties`'s value passed into the `<GamutProvider>` at the root of your application.
31
+
32
+ <Canvas of={PositioningStories.PositionExample} />
33
+
29
34
  <TokenTable rows={getPropRows('positioning')} columns={defaultColumns} />
@@ -0,0 +1,32 @@
1
+ import { Box, Markdown } from '@codecademy/gamut';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+
4
+ const meta: Meta<typeof Box> = {
5
+ title: 'Foundations/System/Props/Positioning',
6
+ component: Box,
7
+ };
8
+
9
+ export default meta;
10
+ type Story = StoryObj<typeof Box>;
11
+
12
+ export const PositionExample: Story = {
13
+ render: () => (
14
+ <Box bg="background-selected" height="250px" position="relative">
15
+ <Box
16
+ bg="primary"
17
+ color="background-contrast"
18
+ left={16}
19
+ p={16}
20
+ position="absolute"
21
+ top={16}
22
+ >
23
+ This box has{' '}
24
+ <Markdown text="`position='absolute'`, `top={16}`, and `left={16}`." />{' '}
25
+ Inspect the example to see what CSS properties are rendered. You can
26
+ also change the value of{' '}
27
+ <Markdown text="`useLogicalProperties` and `direction`" /> in the
28
+ toolbar to see how the box renders differently.
29
+ </Box>
30
+ </Box>
31
+ ),
32
+ };
@@ -68,7 +68,7 @@ GamutProvider handles a few critical tasks that need to happen in order for comp
68
68
  - **Next** `_app.tsx`
69
69
  - **Gatsby** `gatsby-ssr.js` `gatsby-browser.js` and use `wrapRootElement` in each.
70
70
 
71
- 4. Add required types for your theme, which will determine what props Gamut components allow.
71
+ 5. Add required types for your theme, which will determine what props Gamut components allow.
72
72
 
73
73
  ```tsx
74
74
  // theme.d.ts
@@ -84,7 +84,7 @@ declare module '@emotion/react' {
84
84
 
85
85
  For more information this declaration please checkout the [official emotion documentation](https://emotion.sh/docs/typescript#define-a-theme)!
86
86
 
87
- 5. Start Building!
87
+ 6. Start Building!
88
88
 
89
89
  ```tsx
90
90
  import { Background } from '@codecademy/gamut-styles';
@@ -96,3 +96,15 @@ export const App = () => (
96
96
  </Background>
97
97
  );
98
98
  ```
99
+
100
+ ### Content Security Policy (CSP)
101
+
102
+ If your app uses a strict Content-Security-Policy (e.g. `style-src` without `'unsafe-inline'`), pass a nonce to `GamutProvider` so Emotion and other Gamut-managed style tags are allowed:
103
+
104
+ ```tsx
105
+ <GamutProvider nonce={yourCspNonce}>
106
+ <App />
107
+ </GamutProvider>
108
+ ```
109
+
110
+ Your nonce should be the same value you use in your CSP header (e.g. `style-src 'self' 'nonce-{value}'`).
@@ -1,11 +1,11 @@
1
1
  import { Meta } from '@storybook/blocks';
2
2
 
3
- import { AboutHeader, LinkTo } from '~styleguide/blocks';
3
+ import { AboutHeader, ImageWrapper, LinkTo } from '~styleguide/blocks';
4
4
 
5
5
  export const parameters = {
6
6
  title: 'Confirmation dialogs',
7
7
  subtitle:
8
- 'Simplify the language, prioritize the message, and make sure the implication of what learners are saying "Yes" (or "No") to is crystal clear.',
8
+ 'Use the same verb from the triggering button, heading, to action confirmation button; clearly communicate the consequences; and keep the copy decision-focused.',
9
9
  status: 'static',
10
10
  design: {
11
11
  type: 'figma',
@@ -17,39 +17,57 @@ export const parameters = {
17
17
 
18
18
  <AboutHeader {...parameters} />
19
19
 
20
- Confirmation dialog boxes are used to verify that a learner wants to take a specific action. They are generally used for actions that are irreversible, may result in critical consequences or loss of data, have other severe consequences, or happen infrequently.
20
+ Confirmation dialogs use the <LinkTo id="Molecules/Modals/Dialog">Dialog component in Gamut</LinkTo> to create intentional friction to verify that a learner wants to take a high-impact action, such as:
21
21
 
22
- They use the <LinkTo id="Molecules/Modals/Dialog">Dialog component in Gamut</LinkTo> and, for actions with serious or irreversible consequences, the `Danger` variant should be used.
22
+ - Irreversible actions (e.g., submitting payment)
23
+ - Loss of data, time, or work (e.g., deleting a course)
24
+ - Unexpected consequences (e.g., losing learning history on an existing prototype when when generating a new prototype)
25
+
26
+ Adding friction for these purposes helps improve trust and avoid unintentional actions by making sure learners clearly understand the consequences before continuing. It also lets us offer alternatives or undo options when needed.
23
27
 
24
28
  ## Best practices
25
29
 
26
- ### Headline
30
+ ### Heading
31
+
32
+ - **Ask or inform about one main action**, mirroring the button that triggered the confirmation dialog.
33
+ - **Frame your headline as a binary question**, when possible, with 2 unambiguous answers.
34
+ - **Avoid generic “Are you sure?” headings and body text.** This phrasing takes up space, increases cognitive load, and may undermine users' confidence or be interpreted as patronizing.
35
+
36
+ ### Body (optional)
37
+
38
+ - **Add essential information about the contextual consequences.** State what will happen, what will be lost/changed, and any critical conditions.
39
+ - **Avoid redundancy.** If the heading is already self-explanatory, the body is not needed.
40
+ - **Keep to 1–2 lines, unless more is required to get all the information across.**
41
+
42
+ ### Buttons (CTA1 and CTA2)
27
43
 
28
- - **Ask or inform about one main action**, clearly and simply.
29
- - **Frame your headline as a binary question**, when possible, with 2 unambiguous answers (i.e. Yes/No, Stay/Leave).
30
- - **Be specific.** Instead of "Are you sure?" focus on what you want to ensure they're sure about (i.e. "Reset your progress?" or "Delete the file?").
44
+ - **Avoid using “Yes” or “No,”** as they can be misinterpreted in global English and internationalization contexts.
45
+ - **CTA1 matches the verb from the heading** to confirm the action.
46
+ - **CTA2 clarifies the alternative or undo** path.
47
+ - Whenever possible, be specific about the alternative. However, when space is limited, 'Cancel' can be used.
31
48
 
32
- ### Explanation
49
+ ### Examples — putting it all together
33
50
 
34
- - **Share only relevant information** that may help the learner make their decision.
35
- - **Avoid redundancy.** If you've already set the stage in your headline, there's no need to re-ask the same question in your explanation. If the explanation doesn't add anything new, leave it out (i.e. "Permanently delete this item? Yes/No").
36
- - **Avoid filler.** Questions like "Are you sure you want to \_\_\_?" take up space, increase cognitive load, and may undermine users' confidence or be interpreted as patronizing.
37
- - **Keep to 1-2 lines**, unless more is required to get all the information across.
51
+ <ImageWrapper
52
+ src="./ux writing/delete_this_course.png"
53
+ alt="Delete this course confirmation dialog"
54
+ />
38
55
 
39
- ### Button copy
56
+ <ImageWrapper
57
+ src="./ux writing/delete_study_plan.png"
58
+ alt="Delete study plan confirmation dialog"
59
+ />
40
60
 
41
- - **Options should be clear and distinct.** Each option should be distinctly different and there should be no opportunity for learners to mix them up (i.e. "Delete" and "Cancel" are ambiguous choices whereas "Yes, remove" and "Cancel" clear up the confusion.
42
- - **Add context to reaffirm the action.** Instead of "Yes," use "Yes, reset progress."
43
- - **Match the verb in your headline.** If you use "Save" in your headline, use "Save" in your button copy, rather than keep. Consistency helps keep the message clear. All of this should also match whatever the learner clicked on that triggered the confirmation dialog.
61
+ <ImageWrapper
62
+ src="./ux writing/clear_chat.png"
63
+ alt="Clear chat confirmation dialog"
64
+ />
44
65
 
45
66
  ## Checklist
46
67
 
47
- - Is the language consistent from the wording on the button that opened the confirmation box, to the headline,
48
- - Does the headline make the action clear?
49
- - Is the headline framed as a question, if possible?
50
- - Does the explanation provide relevant details and consequences of the action?
51
- - Is the explanation 1-2 lines long?
52
- - Are the words on the buttons clear and distinct?
53
- - Do the buttons include context to reaffirm the action?
54
- - Is your copy at a reading level of grade 7 or below? Test with [Hemingway App](https://hemingwayapp.com).
55
- - Have you asked someone unrelated to the project to read the message and did they understand it?
68
+ - Is the action irreversible, destructive, or has unexpected consequences? If not, consider using a different pattern.
69
+ - Is the same verb used from the action triggering the confirmation dialog, to the heading, to CTA1?
70
+ - Did you avoid filler language such as “Are you sure you want to...?”
71
+ - Does the body front-load the critical consequence in 1–3 lines?
72
+ - Are the buttons mutually exclusive (and avoid using “Yes/No”)?
73
+ - Is there a safer alternative or undo to mention? (If available, offer the option as CTA2.)