@codecademy/styleguide 79.0.1-alpha.bd18ee.0 → 79.0.1-alpha.c6600b.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.
@@ -177,6 +177,18 @@ export const globalTypes = {
177
177
  showName: true,
178
178
  },
179
179
  },
180
+ direction: {
181
+ name: 'Direction',
182
+ description: 'Text direction for the page',
183
+ defaultValue: 'ltr',
184
+ toolbar: {
185
+ items: [
186
+ { value: 'ltr', icon: 'arrowright', title: 'Left-To-Right' },
187
+ { value: 'rtl', icon: 'arrowleft', title: 'Right-To-Left' },
188
+ ],
189
+ showName: true,
190
+ },
191
+ },
180
192
  };
181
193
 
182
194
  export const decorators = [withEmotion];
@@ -35,6 +35,7 @@ type GlobalsContext = {
35
35
  colorMode: 'light' | 'dark';
36
36
  theme: keyof typeof themeMap;
37
37
  logicalProps: 'true' | 'false';
38
+ direction: 'ltr' | 'rtl';
38
39
  };
39
40
  };
40
41
 
@@ -42,6 +43,7 @@ export const withEmotion = (Story: any, context: GlobalsContext) => {
42
43
  const colorMode = context.globals.colorMode ?? 'light';
43
44
  const selectedTheme = context.globals.theme;
44
45
  const useLogicalProperties = context.globals.logicalProps !== 'false';
46
+ const direction = context.globals.direction ?? 'ltr';
45
47
  const background = corePalette[themeBackground[colorMode]];
46
48
  const storyRef = useRef<HTMLDivElement>(null);
47
49
  const currentTheme = themeMap[selectedTheme];
@@ -66,6 +68,7 @@ export const withEmotion = (Story: any, context: GlobalsContext) => {
66
68
  alwaysSetVariables
67
69
  bg={themeBackground[colorMode]}
68
70
  ref={storyRef}
71
+ dir={direction}
69
72
  >
70
73
  {Story()}
71
74
  </Background>
@@ -83,6 +86,7 @@ export const withEmotion = (Story: any, context: GlobalsContext) => {
83
86
  alwaysSetVariables
84
87
  bg={themeBackground[colorMode]}
85
88
  ref={storyRef}
89
+ dir={direction}
86
90
  >
87
91
  {Story()}
88
92
  </Background>
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.bd18ee.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.0.0...@codecademy/styleguide@79.0.1-alpha.bd18ee.0) (2026-02-05)
6
+ ### [79.0.1-alpha.c6600b.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.0.0...@codecademy/styleguide@79.0.1-alpha.c6600b.0) (2026-02-06)
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.bd18ee.0",
4
+ "version": "79.0.1-alpha.c6600b.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": "2b6be3cc33f13466ff4fecdbb80202d8994e0ae4"
11
+ "gitHead": "d2ea451d8160591a4ab8bcc85d0b401bc009cd13"
12
12
  }
@@ -1,9 +1,8 @@
1
- import { Canvas, Meta } from '@storybook/blocks';
1
+ import { 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 LayoutStories from './Layout.stories';
7
6
 
8
7
  export const parameters = {
9
8
  title: 'Layout',
@@ -12,7 +11,7 @@ export const parameters = {
12
11
  status: 'updating',
13
12
  };
14
13
 
15
- <Meta title="Foundations/System/Props/Layout" of={LayoutStories} />
14
+ <Meta title="Foundations/System/Props/Layout" />
16
15
 
17
16
  <AboutHeader {...parameters} />
18
17
 
@@ -32,14 +31,4 @@ const LayoutExample = styled.div(system.layout);
32
31
  />;
33
32
  ```
34
33
 
35
- ## Examples
36
-
37
- ### Width
38
-
39
- <Canvas of={LayoutStories.WidthExample} />
40
-
41
- ### Direction
42
-
43
- <Canvas of={LayoutStories.DirectionExample} />
44
-
45
34
  <TokenTable rows={getPropRows('layout')} columns={defaultColumns} />
@@ -485,8 +485,8 @@ const TRANSFORM_COLUMN = {
485
485
  size: 'fill',
486
486
  render: ({ transform, resolveProperty }: any) => (
487
487
  <>
488
- {transform && <Code>{transform.name}</Code>}{' '}
489
- {resolveProperty && <Code>{resolveProperty.name}</Code>}
488
+ {transform && <Code>{transform?.name}</Code>}
489
+ {resolveProperty && <Code>{resolveProperty?.name}</Code>}
490
490
  </>
491
491
  ),
492
492
  };
@@ -22,7 +22,7 @@ export const parameters = {
22
22
 
23
23
  ## What are CSS logical properties?
24
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)
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
26
 
27
27
  ### Physical Properties (Traditional)
28
28
 
@@ -46,7 +46,9 @@ Gamut supports both physical and logical CSS properties through the `useLogicalP
46
46
 
47
47
  ### Affected Props
48
48
 
49
- Here are some examples of how physical and logical properties are affected by the `useLogicalProperties` prop:
49
+ When `useLogicalProperties` is enabled, Gamut replaces physical CSS properties with their logical equivalents. This applies to both **base properties** (like `marginLeft`, `width`) and **shorthand props** (like `mx`, `py`).
50
+
51
+ The table below shows a few examples — this is not a comprehensive list.
50
52
 
51
53
  <TokenTable
52
54
  idKey="prop"
@@ -59,7 +61,7 @@ Here are some examples of how physical and logical properties are affected by th
59
61
  },
60
62
  {
61
63
  key: 'physical',
62
- name: 'Physical',
64
+ name: 'Physical CSS',
63
65
  size: 'xl',
64
66
  render: ({ physical }) =>
65
67
  physical.map((p) => (
@@ -70,7 +72,7 @@ Here are some examples of how physical and logical properties are affected by th
70
72
  },
71
73
  {
72
74
  key: 'logical',
73
- name: 'Logical',
75
+ name: 'Logical CSS',
74
76
  size: 'xl',
75
77
  render: ({ logical }) =>
76
78
  logical.map((l) => (
@@ -81,21 +83,35 @@ Here are some examples of how physical and logical properties are affected by th
81
83
  },
82
84
  ]}
83
85
  rows={[
86
+ {
87
+ prop: 'marginLeft',
88
+ physical: ['margin-left'],
89
+ logical: ['margin-inline-start'],
90
+ },
84
91
  {
85
92
  prop: 'mx',
86
93
  physical: ['margin-left', 'margin-right'],
87
94
  logical: ['margin-inline-start', 'margin-inline-end'],
88
95
  },
89
- { prop: 'mt', physical: ['margin-top'], logical: ['margin-block-start'] },
96
+ {
97
+ prop: 'paddingTop',
98
+ physical: ['padding-top'],
99
+ logical: ['padding-block-start'],
100
+ },
90
101
  {
91
102
  prop: 'py',
92
103
  physical: ['padding-top', 'padding-bottom'],
93
104
  logical: ['padding-block-start', 'padding-block-end'],
94
105
  },
95
106
  {
96
- prop: 'pb',
97
- physical: ['padding-bottom'],
98
- logical: ['padding-block-end'],
107
+ prop: 'width',
108
+ physical: ['width'],
109
+ logical: ['inline-size'],
110
+ },
111
+ {
112
+ prop: 'height',
113
+ physical: ['height'],
114
+ logical: ['block-size'],
99
115
  },
100
116
  ]}
101
117
  />
@@ -1,47 +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/Layout',
6
- component: Box,
7
- };
8
-
9
- export default meta;
10
- type Story = StoryObj<typeof Box>;
11
-
12
- export const WidthExample: Story = {
13
- render: () => (
14
- <Box bg="background-selected" p={16}>
15
- <Box
16
- bg="primary"
17
- color="background-contrast"
18
- height="300px"
19
- p={16}
20
- width="50%"
21
- >
22
- This box has <Markdown text="`width='50%' and height='300px'`." /> It
23
- takes up half the width of its container. Inspect the box to see the
24
- rendered CSS property.
25
- </Box>
26
- </Box>
27
- ),
28
- };
29
-
30
- export const DirectionExample: Story = {
31
- render: () => (
32
- <Box display="flex" flexDirection="row" gap={16}>
33
- <Box bg="background-selected" p={16} width="50%">
34
- <Box bg="primary" color="background-contrast" direction="ltr" p={16}>
35
- <Markdown text="`direction='ltr'`." /> Left-to-right text direction
36
- (default for English).
37
- </Box>
38
- </Box>
39
- <Box bg="background-selected" p={16} width="50%">
40
- <Box bg="primary" color="background-contrast" direction="rtl" p={16}>
41
- <Markdown text="`direction='rtl'`." /> Right-to-left text direction
42
- (used for Arabic, Hebrew, etc.).
43
- </Box>
44
- </Box>
45
- </Box>
46
- ),
47
- };