@codecademy/styleguide 79.0.1-alpha.d8b528.0 → 79.0.1-alpha.df213b.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.
@@ -52,9 +52,6 @@ export const DocsContainer: React.FC<{
52
52
 
53
53
  const globalTheme =
54
54
  (context as any).store.userGlobals?.globals?.theme || 'core';
55
- const globalLogicalProps = (context as any).store.userGlobals?.globals
56
- ?.logicalProps;
57
- const useLogicalProperties = globalLogicalProps !== 'false';
58
55
 
59
56
  const { currentTheme } = useMemo(() => {
60
57
  const findThemeStory: keyof typeof themeSpecificStories | undefined =
@@ -80,7 +77,6 @@ export const DocsContainer: React.FC<{
80
77
  cache={createEmotionCache({ speedy: false })}
81
78
  // This is typed to the CoreTheme in theme.d.ts
82
79
  theme={currentTheme as unknown as CoreTheme}
83
- useLogicalProperties={useLogicalProperties}
84
80
  >
85
81
  <ColorMode mode="light">
86
82
  <HelmetProvider>
@@ -49,7 +49,6 @@ const preview: Preview = {
49
49
  'ESLint rules',
50
50
  'Contributing',
51
51
  'FAQs',
52
- 'Logical and physical CSS properties',
53
52
  'Stories',
54
53
  ],
55
54
  'Foundations',
@@ -164,19 +163,6 @@ export const globalTypes = {
164
163
  showName: true,
165
164
  },
166
165
  },
167
- logicalProps: {
168
- name: 'LogicalProps',
169
- description: 'Toggle between logical and physical CSS properties',
170
- defaultValue: 'true',
171
- toolbar: {
172
- icon: 'transfer',
173
- items: [
174
- { value: 'true', title: 'Logical' },
175
- { value: 'false', title: 'Physical' },
176
- ],
177
- showName: true,
178
- },
179
- },
180
166
  };
181
167
 
182
168
  export const decorators = [withEmotion];
@@ -34,14 +34,12 @@ type GlobalsContext = {
34
34
  globals: {
35
35
  colorMode: 'light' | 'dark';
36
36
  theme: keyof typeof themeMap;
37
- logicalProps: 'true' | 'false';
38
37
  };
39
38
  };
40
39
 
41
40
  export const withEmotion = (Story: any, context: GlobalsContext) => {
42
41
  const colorMode = context.globals.colorMode ?? 'light';
43
42
  const selectedTheme = context.globals.theme;
44
- const useLogicalProperties = context.globals.logicalProps !== 'false';
45
43
  const background = corePalette[themeBackground[colorMode]];
46
44
  const storyRef = useRef<HTMLDivElement>(null);
47
45
  const currentTheme = themeMap[selectedTheme];
@@ -59,7 +57,6 @@ export const withEmotion = (Story: any, context: GlobalsContext) => {
59
57
  <GamutProvider
60
58
  useCache={false}
61
59
  useGlobals={false}
62
- useLogicalProperties={useLogicalProperties}
63
60
  theme={currentTheme as unknown as Theme}
64
61
  >
65
62
  <Background
@@ -75,10 +72,7 @@ export const withEmotion = (Story: any, context: GlobalsContext) => {
75
72
 
76
73
  // Wrap all stories in minimal provider
77
74
  return (
78
- <GamutProvider
79
- useLogicalProperties={useLogicalProperties}
80
- theme={currentTheme as unknown as Theme}
81
- >
75
+ <GamutProvider theme={currentTheme as unknown as Theme}>
82
76
  <Background
83
77
  alwaysSetVariables
84
78
  bg={themeBackground[colorMode]}
package/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
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.0.1-alpha.d8b528.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.0.0...@codecademy/styleguide@79.0.1-alpha.d8b528.0) (2026-01-29)
6
+ ### [79.0.1-alpha.df213b.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.0.0...@codecademy/styleguide@79.0.1-alpha.df213b.0) (2026-01-29)
7
7
 
8
8
  **Note:** Version bump only for package @codecademy/styleguide
9
9
 
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.0.1-alpha.d8b528.0",
4
+ "version": "79.0.1-alpha.df213b.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": "fe5dff414ecab26d29ead6252dccd7e4c5c00f64"
11
+ "gitHead": "ae9a6d7c67b8d1e9b70754cddae185ce2dba44fe"
12
12
  }
@@ -1,9 +1,8 @@
1
- import { Canvas, Meta } from '@storybook/blocks';
1
+ import { Meta } from '@storybook/blocks';
2
2
 
3
- import { AboutHeader, Callout, TokenTable } from '~styleguide/blocks';
3
+ import { AboutHeader, TokenTable } from '~styleguide/blocks';
4
4
 
5
5
  import { defaultColumns, getPropRows } from '../../shared/elements';
6
- import * as SpaceStories from './Space.stories';
7
6
 
8
7
  export const parameters = {
9
8
  title: 'Space',
@@ -11,7 +10,7 @@ export const parameters = {
11
10
  status: 'updating',
12
11
  };
13
12
 
14
- <Meta of={SpaceStories} title="Foundations/System/Props/Space" />
13
+ <Meta title="Foundations/System/Props/Space" />
15
14
 
16
15
  <AboutHeader {...parameters} />
17
16
 
@@ -26,19 +25,4 @@ const SpaceExample = styled.div(system.space);
26
25
  <SpaceExample p={8} my={[16, 24, 32]} />;
27
26
  ```
28
27
 
29
- These space 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.
30
-
31
- <Callout
32
- text={
33
- <>
34
- You can use the <strong>LogicalProps</strong> button in the toolbar to
35
- switch between modes.
36
- </>
37
- }
38
- />
39
-
40
- <Canvas of={SpaceStories.MarginExample} />
41
-
42
- <Canvas of={SpaceStories.PaddingExample} />
43
-
44
28
  <TokenTable rows={getPropRows('space')} columns={defaultColumns} />
@@ -9,7 +9,6 @@ import {
9
9
  } from '@codecademy/gamut-styles';
10
10
  // eslint-disable-next-line gamut/import-paths
11
11
  import * as ALL_PROPS from '@codecademy/gamut-styles/src/variance/config';
12
- import { useTheme } from '@emotion/react';
13
12
  import styled from '@emotion/styled';
14
13
  import kebabCase from 'lodash/kebabCase';
15
14
 
@@ -413,61 +412,29 @@ export const DarkModeTable = () => (
413
412
  );
414
413
  /* eslint-disable gamut/import-paths */
415
414
 
416
- const PropertiesRenderer = ({
417
- property,
418
- properties,
419
- resolveProperty,
420
- }: {
421
- property: string | { physical: string; logical: string };
422
- properties?: string[] | { physical: string[]; logical: string[] };
423
- resolveProperty?: (useLogicalProperties: boolean) => 'logical' | 'physical';
424
- }) => {
425
- const currentTheme = useTheme() as { useLogicalProperties?: boolean };
426
- const useLogicalProperties = currentTheme?.useLogicalProperties ?? true;
427
-
428
- const mode = resolveProperty
429
- ? resolveProperty(useLogicalProperties)
430
- : 'physical';
431
-
432
- const resolvedProperty =
433
- typeof property === 'string' ? property : property[mode];
434
-
435
- let resolvedProperties: string[];
436
- if (!properties) {
437
- resolvedProperties = [resolvedProperty];
438
- } else if (Array.isArray(properties)) {
439
- resolvedProperties = properties;
440
- } else {
441
- resolvedProperties = properties[mode];
442
- }
443
-
444
- return (
445
- <>
446
- {resolvedProperties.map((prop) => (
447
- <Anchor
448
- href={`https://developer.mozilla.org/en-US/docs/Web/CSS/${kebabCase(
449
- prop
450
- )}`}
451
- key={prop}
452
- rel=""
453
- target="_blank"
454
- >
455
- <AnchorCode>{kebabCase(prop)}</AnchorCode>
456
- </Anchor>
457
- ))}
458
- </>
459
- );
460
- };
461
-
462
415
  const PROPERTIES_COLUMN = {
463
416
  key: 'properties',
464
417
  name: 'Properties',
465
418
  size: 'xl',
466
- render: (props: {
467
- property: string | { physical: string; logical: string };
468
- properties?: string[] | { physical: string[]; logical: string[] };
469
- resolveProperty?: (useLogicalProperties: boolean) => 'logical' | 'physical';
470
- }) => <PropertiesRenderer {...props} />,
419
+ render: ({
420
+ property,
421
+ properties = [property],
422
+ }: {
423
+ property: string;
424
+ properties: string[];
425
+ }) =>
426
+ properties.map((property) => (
427
+ <Anchor
428
+ href={`https://developer.mozilla.org/en-US/docs/Web/CSS/${kebabCase(
429
+ property
430
+ )}`}
431
+ key={property}
432
+ rel=""
433
+ target="_blank"
434
+ >
435
+ <AnchorCode>{kebabCase(property)}</AnchorCode>
436
+ </Anchor>
437
+ )),
471
438
  };
472
439
 
473
440
  const SCALE_COLUMN = {
@@ -483,12 +450,7 @@ const TRANSFORM_COLUMN = {
483
450
  key: 'transform',
484
451
  name: 'Transform',
485
452
  size: 'fill',
486
- render: ({ transform, resolveProperty }: any) => (
487
- <>
488
- {transform && <Code>{transform?.name}</Code>}
489
- {resolveProperty && <Code>{resolveProperty?.name}</Code>}
490
- </>
491
- ),
453
+ render: ({ transform }: any) => transform && <Code>{transform?.name}</Code>,
492
454
  };
493
455
 
494
456
  export const defaultColumns = [
@@ -13,7 +13,6 @@ import { parameters as deepControlsParameters } from './Deep Controls Add-On.mdx
13
13
  import { parameters as eslintRulesParameters } from './ESLint rules.mdx';
14
14
  import { parameters as faqsParameters } from './FAQs.mdx';
15
15
  import { parameters as installationParameters } from './Installation.mdx';
16
- import { parameters as logicalPhysicalParameters } from './Logical and physical CSS properties.mdx';
17
16
  import { parameters as storiesParameters } from './Stories.mdx';
18
17
  import { parameters as usageGuideParameters } from './Usage Guide.mdx';
19
18
 
@@ -35,10 +34,9 @@ export const parameters = {
35
34
  deepControlsParameters,
36
35
  eslintRulesParameters,
37
36
  faqsParameters,
38
- installationParameters,
39
- logicalPhysicalParameters,
40
37
  storiesParameters,
41
38
  brandParameters,
39
+ installationParameters,
42
40
  usageGuideParameters,
43
41
  ])}
44
42
  />
@@ -39,8 +39,7 @@ On each page is a toolbar located on the top:
39
39
  1. Grid (the 2x2 collection of squares) - applies a grid to the preview
40
40
  2. Color mode selector (the circle icon) - toggles between light and dark mode for rendered code examples
41
41
  3. Theme switcher (the paintbrush icon) - switches between different design system themes (Core, Admin, LX Studio, Percipio)
42
- 4. LogicalProps (the two arrows icon) - toggles between physical and logical CSS properties
43
- 5. Outline (dotted square) - applies outlines to elements in the rendered code examples
42
+ 4. Outline (dotted square) - applies outlines to elements in the rendered code examples
44
43
 
45
44
  ### Theme Switcher
46
45
 
@@ -59,10 +58,6 @@ Available themes:
59
58
 
60
59
  The theme switcher works in combination with the color mode selector, so you can test both light and dark variants of each theme.
61
60
 
62
- ### LogicalProps
63
-
64
- The LogicalProps button (two arrows icon) provides a menu to select between Logical and Physical CSS properties.
65
-
66
61
  ### Showing code
67
62
 
68
63
  On the bottom right of each canvas (a rendered code example) is a button to show its code:
Binary file
@@ -1,48 +0,0 @@
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/Space',
6
- component: Box,
7
- };
8
-
9
- export default meta;
10
- type Story = StoryObj<typeof Box>;
11
-
12
- export const MarginExample: Story = {
13
- render: () => (
14
- <Box
15
- bg="primary"
16
- color="background-contrast"
17
- mb={64}
18
- ml={16}
19
- mr={32}
20
- mt={4}
21
- textAlign="center"
22
- >
23
- This box has{' '}
24
- <Markdown text="`mt={4}`, `mr={32}`, `mb={64}`, and `ml={16}`." /> Inspect
25
- the example to see what CSS properties are rendered.
26
- </Box>
27
- ),
28
- };
29
-
30
- export const PaddingExample: Story = {
31
- render: () => (
32
- <Box bg="background-selected">
33
- <Box
34
- bg="primary"
35
- color="background-contrast"
36
- pb={64}
37
- pl={16}
38
- pr={32}
39
- pt={4}
40
- textAlign="center"
41
- >
42
- This box has{' '}
43
- <Markdown text="`pt={4}`, `pr={32}`, `pb={64}`, and `pl={16}`." />{' '}
44
- Inspect the example to see what CSS properties are rendered.
45
- </Box>
46
- </Box>
47
- ),
48
- };
@@ -1,123 +0,0 @@
1
- import { Meta } from '@storybook/blocks';
2
-
3
- import {
4
- AboutHeader,
5
- Callout,
6
- Code,
7
- ImageWrapper,
8
- TokenTable,
9
- } from '~styleguide/blocks';
10
-
11
- export const parameters = {
12
- id: 'Meta/Logical and physical CSS properties',
13
- title: 'Logical and physical CSS properties',
14
- subtitle:
15
- 'Understanding CSS logical and physical properties and how Gamut supports both modes.',
16
- status: 'static',
17
- };
18
-
19
- <Meta title="Meta/Logical and physical CSS properties" />
20
-
21
- <AboutHeader {...parameters} />
22
-
23
- ## What are CSS logical properties?
24
-
25
- CSS logical properties are a modern approach to styling that adapts to the writing mode and text direction of your content, rather than being tied to physical screen directions. More information can be found on[MDN: CSS Logical Properties](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_logical_properties_and_values)
26
-
27
- ### Physical Properties (Traditional)
28
-
29
- Physical properties reference the physical dimensions of the viewport. For example:
30
-
31
- - `margin-left`, `margin-right`, `margin-top`, `margin-bottom`
32
- - `padding-left`, `padding-right`, `padding-top`, `padding-bottom`
33
-
34
- These work well for left-to-right (LTR) languages but require manual overrides for right-to-left (RTL) languages like Arabic or Hebrew.
35
-
36
- ### Logical Properties (Modern)
37
-
38
- Logical properties reference the flow of content:
39
-
40
- - **Inline axis** (text direction): `margin-inline-start`, `margin-inline-end`
41
- - **Block axis** (reading direction): `margin-block-start`, `margin-block-end`
42
-
43
- ## Using `useLogicalProperties` in Gamut
44
-
45
- Gamut supports both physical and logical CSS properties through the `useLogicalProperties` prop on `GamutProvider`. This allows you to choose which mode your application uses. By default, `useLogicalProperties` is set to `true`, meaning Gamut will use logical CSS properties. If you want to use physical CSS properties, you have to set `useLogicalProperties` to `false`.
46
-
47
- ### Affected Props
48
-
49
- Here are some examples of how physical and logical properties are affected by the `useLogicalProperties` prop:
50
-
51
- <TokenTable
52
- idKey="prop"
53
- columns={[
54
- {
55
- key: 'prop',
56
- name: 'Prop',
57
- size: 'sm',
58
- render: ({ prop }) => <Code>{prop}</Code>,
59
- },
60
- {
61
- key: 'physical',
62
- name: 'Physical',
63
- size: 'xl',
64
- render: ({ physical }) =>
65
- physical.map((p) => (
66
- <>
67
- <Code key={p}>{p}</Code>{' '}
68
- </>
69
- )),
70
- },
71
- {
72
- key: 'logical',
73
- name: 'Logical',
74
- size: 'xl',
75
- render: ({ logical }) =>
76
- logical.map((l) => (
77
- <>
78
- <Code key={l}>{l}</Code>{' '}
79
- </>
80
- )),
81
- },
82
- ]}
83
- rows={[
84
- {
85
- prop: 'mx',
86
- physical: ['margin-left', 'margin-right'],
87
- logical: ['margin-inline-start', 'margin-inline-end'],
88
- },
89
- { prop: 'mt', physical: ['margin-top'], logical: ['margin-block-start'] },
90
- {
91
- prop: 'py',
92
- physical: ['padding-top', 'padding-bottom'],
93
- logical: ['padding-block-start', 'padding-block-end'],
94
- },
95
- {
96
- prop: 'pb',
97
- physical: ['padding-bottom'],
98
- logical: ['padding-block-end'],
99
- },
100
- ]}
101
- />
102
-
103
- <Callout
104
- text={
105
- <>
106
- Props like <code>m</code> and <code>p</code> (which set all four sides at
107
- once) are not affected by this setting, as the CSS <code>margin</code> and{' '}
108
- <code>padding</code> shorthands work identically in both modes.
109
- </>
110
- }
111
- />
112
-
113
- ## Previewing in Storybook
114
-
115
- You can toggle between logical and physical properties in Storybook using the **LogicalProps** toolbar button:
116
-
117
- <ImageWrapper
118
- src="./meta/toolbar.png"
119
- alt="The Storybook toolbar with the LogicalProps toggle highlighted."
120
- height="auto"
121
- />
122
-
123
- This allows you to preview how components render with either property mode without changing any code.