@codecademy/styleguide 79.2.0-alpha.2d3aae.0 → 79.2.0-alpha.2f9b47.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/CHANGELOG.md +6 -2
- package/package.json +2 -2
- package/src/lib/Foundations/System/Props/Layout.mdx +2 -13
- package/src/lib/Foundations/System/Props/Positioning.mdx +7 -2
- package/src/lib/Foundations/System/Props/Positioning.stories.tsx +32 -0
- package/src/lib/Foundations/shared/elements.tsx +2 -2
- package/src/lib/Meta/Logical and physical CSS properties.mdx +24 -8
- package/src/lib/Molecules/Tips/InfoTip/InfoTip.stories.tsx +2 -2
- package/src/lib/Foundations/System/Props/Layout.stories.tsx +0 -47
package/CHANGELOG.md
CHANGED
|
@@ -3,13 +3,17 @@
|
|
|
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.
|
|
6
|
+
## [79.2.0-alpha.2f9b47.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.1.1...@codecademy/styleguide@79.2.0-alpha.2f9b47.0) (2026-02-13)
|
|
7
7
|
|
|
8
8
|
### Features
|
|
9
9
|
|
|
10
|
-
-
|
|
10
|
+
- 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
11
|
- 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
12
|
|
|
13
|
+
### [79.1.1](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.1.0...@codecademy/styleguide@79.1.1) (2026-02-11)
|
|
14
|
+
|
|
15
|
+
**Note:** Version bump only for package @codecademy/styleguide
|
|
16
|
+
|
|
13
17
|
## [79.1.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.0.0...@codecademy/styleguide@79.1.0) (2026-02-09)
|
|
14
18
|
|
|
15
19
|
### Features
|
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.
|
|
4
|
+
"version": "79.2.0-alpha.2f9b47.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": "4577f2565a67fc116b56c55ecca9c3e849a90be1"
|
|
12
12
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
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"
|
|
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} />
|
|
@@ -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="150px" 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
|
+
};
|
|
@@ -485,8 +485,8 @@ const TRANSFORM_COLUMN = {
|
|
|
485
485
|
size: 'fill',
|
|
486
486
|
render: ({ transform, resolveProperty }: any) => (
|
|
487
487
|
<>
|
|
488
|
-
{transform && <Code>{transform
|
|
489
|
-
{resolveProperty && <Code>{resolveProperty
|
|
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
|
-
|
|
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
|
-
{
|
|
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: '
|
|
97
|
-
physical: ['
|
|
98
|
-
logical: ['
|
|
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
|
/>
|
|
@@ -296,14 +296,14 @@ export const ZIndex: Story = {
|
|
|
296
296
|
},
|
|
297
297
|
render: (args) => (
|
|
298
298
|
<FlexBox center flexDirection="column" m={24} py={64}>
|
|
299
|
-
<Box bg="
|
|
299
|
+
<Box bg="background-primary" zIndex={3}>
|
|
300
300
|
I will not be behind the infotip, sad + unreadable
|
|
301
301
|
</Box>
|
|
302
302
|
<InfoTip
|
|
303
303
|
ariaLabel="z-index example without override"
|
|
304
304
|
info="I am inline, cool"
|
|
305
305
|
/>
|
|
306
|
-
<Box bg="
|
|
306
|
+
<Box bg="background-primary" zIndex={3}>
|
|
307
307
|
I will be behind the infotip, nice + great
|
|
308
308
|
</Box>
|
|
309
309
|
<InfoTip {...args} ariaLabel="z-index example with override" />
|
|
@@ -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
|
-
};
|