@codecademy/styleguide 79.1.3-alpha.f73629.0 → 79.1.4-alpha.26684b.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/.storybook/components/Elements/ImageGallery.tsx +1 -1
- package/.storybook/theming/GamutThemeProvider.tsx +2 -0
- package/CHANGELOG.md +7 -1
- package/package.json +2 -2
- package/src/lib/Atoms/Animations/ExpandInCollapseOut/ExpandInCollapseOut.stories.tsx +1 -1
- package/src/lib/Atoms/Animations/FadeInSlideOut/FadeInSlideOut.stories.tsx +1 -1
- package/src/lib/Meta/ESLint rules.mdx +1 -1
- package/src/lib/Meta/Installation.mdx +14 -2
|
@@ -3,7 +3,7 @@ import { GamutIconProps } from '@codecademy/gamut-icons';
|
|
|
3
3
|
import { IllustrationProps } from '@codecademy/gamut-illustrations';
|
|
4
4
|
import { PatternProps } from '@codecademy/gamut-patterns';
|
|
5
5
|
import { css, timingValues } from '@codecademy/gamut-styles';
|
|
6
|
-
import { motion, AnimatePresence } from '
|
|
6
|
+
import { motion, AnimatePresence } from 'motion/react';
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import { useState } from 'react';
|
|
9
9
|
import styled from '@emotion/styled';
|
|
@@ -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,10 +3,16 @@
|
|
|
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.1.
|
|
6
|
+
### [79.1.4-alpha.26684b.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.1.3...@codecademy/styleguide@79.1.4-alpha.26684b.0) (2026-03-02)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @codecademy/styleguide
|
|
9
9
|
|
|
10
|
+
### [79.1.3](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.1.2...@codecademy/styleguide@79.1.3) (2026-03-02)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **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)
|
|
15
|
+
|
|
10
16
|
### [79.1.2](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.1.1...@codecademy/styleguide@79.1.2) (2026-02-12)
|
|
11
17
|
|
|
12
18
|
**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.1.
|
|
4
|
+
"version": "79.1.4-alpha.26684b.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": "
|
|
11
|
+
"gitHead": "2b96cff9296172ba680aa95dbd20c3ea1182563b"
|
|
12
12
|
}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
FlexBox,
|
|
6
6
|
} from '@codecademy/gamut';
|
|
7
7
|
import type { Meta } from '@storybook/react';
|
|
8
|
-
import { AnimatePresence } from '
|
|
8
|
+
import { AnimatePresence } from 'motion/react';
|
|
9
9
|
import { PropsWithChildren, useState } from 'react';
|
|
10
10
|
|
|
11
11
|
const meta: Meta<typeof ExpandInCollapseOut> = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Box, FadeInSlideOut, FillButton, FlexBox } from '@codecademy/gamut';
|
|
2
2
|
import type { Meta } from '@storybook/react';
|
|
3
|
-
import { AnimatePresence } from '
|
|
3
|
+
import { AnimatePresence } from 'motion/react';
|
|
4
4
|
import { useState } from 'react';
|
|
5
5
|
|
|
6
6
|
const meta: Meta<typeof FadeInSlideOut> = {
|
|
@@ -79,7 +79,7 @@ const ExpandableContainer = styled.Box(
|
|
|
79
79
|
|
|
80
80
|
#### Disabling the rule
|
|
81
81
|
|
|
82
|
-
For third-party components or edge cases where inline styles are necessary (e.g.,
|
|
82
|
+
For third-party components or edge cases where inline styles are necessary (e.g., motion animations), you can disable the rule:
|
|
83
83
|
|
|
84
84
|
```tsx
|
|
85
85
|
// eslint-disable-next-line gamut/no-inline-style
|
|
@@ -91,7 +91,7 @@ GamutProvider handles a few critical tasks that need to happen in order for comp
|
|
|
91
91
|
- **Next** `_app.tsx`
|
|
92
92
|
- **Gatsby** `gatsby-ssr.js` `gatsby-browser.js` and use `wrapRootElement` in each.
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
5. Add required types for your theme, which will determine what props Gamut components allow.
|
|
95
95
|
|
|
96
96
|
```tsx
|
|
97
97
|
// theme.d.ts
|
|
@@ -107,7 +107,7 @@ declare module '@emotion/react' {
|
|
|
107
107
|
|
|
108
108
|
For more information this declaration please checkout the [official emotion documentation](https://emotion.sh/docs/typescript#define-a-theme)!
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
6. Start Building!
|
|
111
111
|
|
|
112
112
|
```tsx
|
|
113
113
|
import { Background } from '@codecademy/gamut-styles';
|
|
@@ -119,3 +119,15 @@ export const App = () => (
|
|
|
119
119
|
</Background>
|
|
120
120
|
);
|
|
121
121
|
```
|
|
122
|
+
|
|
123
|
+
### Content Security Policy (CSP)
|
|
124
|
+
|
|
125
|
+
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:
|
|
126
|
+
|
|
127
|
+
```tsx
|
|
128
|
+
<GamutProvider nonce={yourCspNonce}>
|
|
129
|
+
<App />
|
|
130
|
+
</GamutProvider>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Your nonce should be the same value you use in your CSP header (e.g. `style-src 'self' 'nonce-{value}'`).
|